blob: d220b0018c9705445bb6ed10026405f1d50201a6 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070021import android.content.IIntentReceiver;
22import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.Intent;
24import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070025import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070026import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070027import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.pm.ConfigurationInfo;
29import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070030import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070031import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.content.res.Configuration;
33import android.graphics.Bitmap;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080034import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.net.Uri;
36import android.os.Binder;
37import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070038import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039import android.os.IBinder;
40import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070041import android.os.ParcelFileDescriptor;
42import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070043import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070046import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070047import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080050import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070051import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053import java.util.ArrayList;
54import java.util.List;
55
56/** {@hide} */
57public abstract class ActivityManagerNative extends Binder implements IActivityManager
58{
59 /**
60 * Cast a Binder object into an activity manager interface, generating
61 * a proxy if needed.
62 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080063 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080064 if (obj == null) {
65 return null;
66 }
67 IActivityManager in =
68 (IActivityManager)obj.queryLocalInterface(descriptor);
69 if (in != null) {
70 return in;
71 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080072
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073 return new ActivityManagerProxy(obj);
74 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080075
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076 /**
77 * Retrieve the system's default/global activity manager.
78 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079 static public IActivityManager getDefault() {
80 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080081 }
82
83 /**
84 * Convenience for checking whether the system is ready. For internal use only.
85 */
86 static public boolean isSystemReady() {
87 if (!sSystemReady) {
88 sSystemReady = getDefault().testIsSystemReady();
89 }
90 return sSystemReady;
91 }
92 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080093
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080094 /**
95 * Convenience for sending a sticky broadcast. For internal use only.
96 * If you don't care about permission, use null.
97 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099 try {
100 getDefault().broadcastIntent(
101 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800102 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800103 } catch (RemoteException ex) {
104 }
105 }
106
Dianne Hackborn099bc622014-01-22 13:39:16 -0800107 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800109 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 } catch (RemoteException ex) {
111 }
112 }
113
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800114 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800115 attachInterface(this, descriptor);
116 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700117
118 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800119 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
120 throws RemoteException {
121 switch (code) {
122 case START_ACTIVITY_TRANSACTION:
123 {
124 data.enforceInterface(IActivityManager.descriptor);
125 IBinder b = data.readStrongBinder();
126 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800127 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800128 Intent intent = Intent.CREATOR.createFromParcel(data);
129 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800131 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700133 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700134 String profileFile = data.readString();
135 ParcelFileDescriptor profileFd = data.readInt() != 0
136 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700137 Bundle options = data.readInt() != 0
138 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800139 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700140 resultTo, resultWho, requestCode, startFlags,
141 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 reply.writeNoException();
143 reply.writeInt(result);
144 return true;
145 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700146
Amith Yamasani82644082012-08-03 13:09:11 -0700147 case START_ACTIVITY_AS_USER_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
155 IBinder resultTo = data.readStrongBinder();
156 String resultWho = data.readString();
157 int requestCode = data.readInt();
158 int startFlags = data.readInt();
159 String profileFile = data.readString();
160 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700161 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700162 Bundle options = data.readInt() != 0
163 ? Bundle.CREATOR.createFromParcel(data) : null;
164 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800165 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700166 resultTo, resultWho, requestCode, startFlags,
167 profileFile, profileFd, options, userId);
168 reply.writeNoException();
169 reply.writeInt(result);
170 return true;
171 }
172
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 case START_ACTIVITY_AND_WAIT_TRANSACTION:
174 {
175 data.enforceInterface(IActivityManager.descriptor);
176 IBinder b = data.readStrongBinder();
177 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800178 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800179 Intent intent = Intent.CREATOR.createFromParcel(data);
180 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800181 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800182 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800183 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700184 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700185 String profileFile = data.readString();
186 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700187 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700188 Bundle options = data.readInt() != 0
189 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700190 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800191 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700192 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700193 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800194 reply.writeNoException();
195 result.writeToParcel(reply, 0);
196 return true;
197 }
198
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700199 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
200 {
201 data.enforceInterface(IActivityManager.descriptor);
202 IBinder b = data.readStrongBinder();
203 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800204 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700205 Intent intent = Intent.CREATOR.createFromParcel(data);
206 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700207 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700208 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700209 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700210 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700211 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700212 Bundle options = data.readInt() != 0
213 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700214 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800215 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700216 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700217 reply.writeNoException();
218 reply.writeInt(result);
219 return true;
220 }
221
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700222 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700223 {
224 data.enforceInterface(IActivityManager.descriptor);
225 IBinder b = data.readStrongBinder();
226 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700227 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700228 Intent fillInIntent = null;
229 if (data.readInt() != 0) {
230 fillInIntent = Intent.CREATOR.createFromParcel(data);
231 }
232 String resolvedType = data.readString();
233 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700234 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700235 int requestCode = data.readInt();
236 int flagsMask = data.readInt();
237 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700238 Bundle options = data.readInt() != 0
239 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700240 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700241 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700242 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700243 reply.writeNoException();
244 reply.writeInt(result);
245 return true;
246 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700247
Dianne Hackborn91097de2014-04-04 18:02:06 -0700248 case START_VOICE_ACTIVITY_TRANSACTION:
249 {
250 data.enforceInterface(IActivityManager.descriptor);
251 String callingPackage = data.readString();
252 int callingPid = data.readInt();
253 int callingUid = data.readInt();
254 Intent intent = Intent.CREATOR.createFromParcel(data);
255 String resolvedType = data.readString();
256 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
257 data.readStrongBinder());
258 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
259 data.readStrongBinder());
260 int startFlags = data.readInt();
261 String profileFile = data.readString();
262 ParcelFileDescriptor profileFd = data.readInt() != 0
263 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
264 Bundle options = data.readInt() != 0
265 ? Bundle.CREATOR.createFromParcel(data) : null;
266 int userId = data.readInt();
267 int result = startVoiceActivity(callingPackage, callingPid, callingUid,
268 intent, resolvedType, session, interactor, startFlags,
269 profileFile, profileFd, options, userId);
270 reply.writeNoException();
271 reply.writeInt(result);
272 return true;
273 }
274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800275 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
276 {
277 data.enforceInterface(IActivityManager.descriptor);
278 IBinder callingActivity = data.readStrongBinder();
279 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700280 Bundle options = data.readInt() != 0
281 ? Bundle.CREATOR.createFromParcel(data) : null;
282 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800283 reply.writeNoException();
284 reply.writeInt(result ? 1 : 0);
285 return true;
286 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700287
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800288 case FINISH_ACTIVITY_TRANSACTION: {
289 data.enforceInterface(IActivityManager.descriptor);
290 IBinder token = data.readStrongBinder();
291 Intent resultData = null;
292 int resultCode = data.readInt();
293 if (data.readInt() != 0) {
294 resultData = Intent.CREATOR.createFromParcel(data);
295 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700296 boolean finishTask = (data.readInt() != 0);
297 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800298 reply.writeNoException();
299 reply.writeInt(res ? 1 : 0);
300 return true;
301 }
302
303 case FINISH_SUB_ACTIVITY_TRANSACTION: {
304 data.enforceInterface(IActivityManager.descriptor);
305 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700306 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800307 int requestCode = data.readInt();
308 finishSubActivity(token, resultWho, requestCode);
309 reply.writeNoException();
310 return true;
311 }
312
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700313 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
314 data.enforceInterface(IActivityManager.descriptor);
315 IBinder token = data.readStrongBinder();
316 boolean res = finishActivityAffinity(token);
317 reply.writeNoException();
318 reply.writeInt(res ? 1 : 0);
319 return true;
320 }
321
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800322 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
323 data.enforceInterface(IActivityManager.descriptor);
324 IBinder token = data.readStrongBinder();
325 boolean res = willActivityBeVisible(token);
326 reply.writeNoException();
327 reply.writeInt(res ? 1 : 0);
328 return true;
329 }
330
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800331 case REGISTER_RECEIVER_TRANSACTION:
332 {
333 data.enforceInterface(IActivityManager.descriptor);
334 IBinder b = data.readStrongBinder();
335 IApplicationThread app =
336 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700337 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800338 b = data.readStrongBinder();
339 IIntentReceiver rec
340 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
341 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
342 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700343 int userId = data.readInt();
344 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800345 reply.writeNoException();
346 if (intent != null) {
347 reply.writeInt(1);
348 intent.writeToParcel(reply, 0);
349 } else {
350 reply.writeInt(0);
351 }
352 return true;
353 }
354
355 case UNREGISTER_RECEIVER_TRANSACTION:
356 {
357 data.enforceInterface(IActivityManager.descriptor);
358 IBinder b = data.readStrongBinder();
359 if (b == null) {
360 return true;
361 }
362 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
363 unregisterReceiver(rec);
364 reply.writeNoException();
365 return true;
366 }
367
368 case BROADCAST_INTENT_TRANSACTION:
369 {
370 data.enforceInterface(IActivityManager.descriptor);
371 IBinder b = data.readStrongBinder();
372 IApplicationThread app =
373 b != null ? ApplicationThreadNative.asInterface(b) : null;
374 Intent intent = Intent.CREATOR.createFromParcel(data);
375 String resolvedType = data.readString();
376 b = data.readStrongBinder();
377 IIntentReceiver resultTo =
378 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
379 int resultCode = data.readInt();
380 String resultData = data.readString();
381 Bundle resultExtras = data.readBundle();
382 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800383 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 boolean serialized = data.readInt() != 0;
385 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700386 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800388 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700389 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 reply.writeNoException();
391 reply.writeInt(res);
392 return true;
393 }
394
395 case UNBROADCAST_INTENT_TRANSACTION:
396 {
397 data.enforceInterface(IActivityManager.descriptor);
398 IBinder b = data.readStrongBinder();
399 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
400 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700401 int userId = data.readInt();
402 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800403 reply.writeNoException();
404 return true;
405 }
406
407 case FINISH_RECEIVER_TRANSACTION: {
408 data.enforceInterface(IActivityManager.descriptor);
409 IBinder who = data.readStrongBinder();
410 int resultCode = data.readInt();
411 String resultData = data.readString();
412 Bundle resultExtras = data.readBundle();
413 boolean resultAbort = data.readInt() != 0;
414 if (who != null) {
415 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
416 }
417 reply.writeNoException();
418 return true;
419 }
420
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800421 case ATTACH_APPLICATION_TRANSACTION: {
422 data.enforceInterface(IActivityManager.descriptor);
423 IApplicationThread app = ApplicationThreadNative.asInterface(
424 data.readStrongBinder());
425 if (app != null) {
426 attachApplication(app);
427 }
428 reply.writeNoException();
429 return true;
430 }
431
432 case ACTIVITY_IDLE_TRANSACTION: {
433 data.enforceInterface(IActivityManager.descriptor);
434 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700435 Configuration config = null;
436 if (data.readInt() != 0) {
437 config = Configuration.CREATOR.createFromParcel(data);
438 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700439 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700441 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800442 }
443 reply.writeNoException();
444 return true;
445 }
446
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700447 case ACTIVITY_RESUMED_TRANSACTION: {
448 data.enforceInterface(IActivityManager.descriptor);
449 IBinder token = data.readStrongBinder();
450 activityResumed(token);
451 reply.writeNoException();
452 return true;
453 }
454
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800455 case ACTIVITY_PAUSED_TRANSACTION: {
456 data.enforceInterface(IActivityManager.descriptor);
457 IBinder token = data.readStrongBinder();
Craig Mautnera0026042014-04-23 11:45:37 -0700458 PersistableBundle persistentState = data.readPersistableBundle();
459 activityPaused(token, persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800460 reply.writeNoException();
461 return true;
462 }
463
464 case ACTIVITY_STOPPED_TRANSACTION: {
465 data.enforceInterface(IActivityManager.descriptor);
466 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800467 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700468 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800469 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700470 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800471 reply.writeNoException();
472 return true;
473 }
474
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800475 case ACTIVITY_SLEPT_TRANSACTION: {
476 data.enforceInterface(IActivityManager.descriptor);
477 IBinder token = data.readStrongBinder();
478 activitySlept(token);
479 reply.writeNoException();
480 return true;
481 }
482
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800483 case ACTIVITY_DESTROYED_TRANSACTION: {
484 data.enforceInterface(IActivityManager.descriptor);
485 IBinder token = data.readStrongBinder();
486 activityDestroyed(token);
487 reply.writeNoException();
488 return true;
489 }
490
491 case GET_CALLING_PACKAGE_TRANSACTION: {
492 data.enforceInterface(IActivityManager.descriptor);
493 IBinder token = data.readStrongBinder();
494 String res = token != null ? getCallingPackage(token) : null;
495 reply.writeNoException();
496 reply.writeString(res);
497 return true;
498 }
499
500 case GET_CALLING_ACTIVITY_TRANSACTION: {
501 data.enforceInterface(IActivityManager.descriptor);
502 IBinder token = data.readStrongBinder();
503 ComponentName cn = getCallingActivity(token);
504 reply.writeNoException();
505 ComponentName.writeToParcel(cn, reply);
506 return true;
507 }
508
509 case GET_TASKS_TRANSACTION: {
510 data.enforceInterface(IActivityManager.descriptor);
511 int maxNum = data.readInt();
512 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700513 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800514 reply.writeNoException();
515 int N = list != null ? list.size() : -1;
516 reply.writeInt(N);
517 int i;
518 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700519 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800520 info.writeToParcel(reply, 0);
521 }
522 return true;
523 }
524
525 case GET_RECENT_TASKS_TRANSACTION: {
526 data.enforceInterface(IActivityManager.descriptor);
527 int maxNum = data.readInt();
528 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700529 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800530 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700531 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800532 reply.writeNoException();
533 reply.writeTypedList(list);
534 return true;
535 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700536
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700537 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800538 data.enforceInterface(IActivityManager.descriptor);
539 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700540 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800541 reply.writeNoException();
542 if (bm != null) {
543 reply.writeInt(1);
544 bm.writeToParcel(reply, 0);
545 } else {
546 reply.writeInt(0);
547 }
548 return true;
549 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700550
551 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
552 data.enforceInterface(IActivityManager.descriptor);
553 int id = data.readInt();
554 Bitmap bm = getTaskTopThumbnail(id);
555 reply.writeNoException();
556 if (bm != null) {
557 reply.writeInt(1);
558 bm.writeToParcel(reply, 0);
559 } else {
560 reply.writeInt(0);
561 }
562 return true;
563 }
564
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800565 case GET_SERVICES_TRANSACTION: {
566 data.enforceInterface(IActivityManager.descriptor);
567 int maxNum = data.readInt();
568 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700569 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800570 reply.writeNoException();
571 int N = list != null ? list.size() : -1;
572 reply.writeInt(N);
573 int i;
574 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700575 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800576 info.writeToParcel(reply, 0);
577 }
578 return true;
579 }
580
581 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
582 data.enforceInterface(IActivityManager.descriptor);
583 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
584 reply.writeNoException();
585 reply.writeTypedList(list);
586 return true;
587 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700588
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800589 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
590 data.enforceInterface(IActivityManager.descriptor);
591 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
592 reply.writeNoException();
593 reply.writeTypedList(list);
594 return true;
595 }
596
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700597 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
598 data.enforceInterface(IActivityManager.descriptor);
599 List<ApplicationInfo> list = getRunningExternalApplications();
600 reply.writeNoException();
601 reply.writeTypedList(list);
602 return true;
603 }
604
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800605 case MOVE_TASK_TO_FRONT_TRANSACTION: {
606 data.enforceInterface(IActivityManager.descriptor);
607 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800608 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700609 Bundle options = data.readInt() != 0
610 ? Bundle.CREATOR.createFromParcel(data) : null;
611 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800612 reply.writeNoException();
613 return true;
614 }
615
616 case MOVE_TASK_TO_BACK_TRANSACTION: {
617 data.enforceInterface(IActivityManager.descriptor);
618 int task = data.readInt();
619 moveTaskToBack(task);
620 reply.writeNoException();
621 return true;
622 }
623
624 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
625 data.enforceInterface(IActivityManager.descriptor);
626 IBinder token = data.readStrongBinder();
627 boolean nonRoot = data.readInt() != 0;
628 boolean res = moveActivityTaskToBack(token, nonRoot);
629 reply.writeNoException();
630 reply.writeInt(res ? 1 : 0);
631 return true;
632 }
633
634 case MOVE_TASK_BACKWARDS_TRANSACTION: {
635 data.enforceInterface(IActivityManager.descriptor);
636 int task = data.readInt();
637 moveTaskBackwards(task);
638 reply.writeNoException();
639 return true;
640 }
641
Craig Mautnerc00204b2013-03-05 15:02:14 -0800642 case MOVE_TASK_TO_STACK_TRANSACTION: {
643 data.enforceInterface(IActivityManager.descriptor);
644 int taskId = data.readInt();
645 int stackId = data.readInt();
646 boolean toTop = data.readInt() != 0;
647 moveTaskToStack(taskId, stackId, toTop);
648 reply.writeNoException();
649 return true;
650 }
651
652 case RESIZE_STACK_TRANSACTION: {
653 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800654 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800655 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800656 Rect r = Rect.CREATOR.createFromParcel(data);
657 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800658 reply.writeNoException();
659 return true;
660 }
661
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800662 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700663 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800664 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700665 reply.writeNoException();
666 reply.writeTypedList(list);
667 return true;
668 }
669
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800670 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700671 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800672 int stackId = data.readInt();
673 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700674 reply.writeNoException();
675 if (info != null) {
676 reply.writeInt(1);
677 info.writeToParcel(reply, 0);
678 } else {
679 reply.writeInt(0);
680 }
681 return true;
682 }
683
Winson Chung303e1ff2014-03-07 15:06:19 -0800684 case IS_IN_HOME_STACK_TRANSACTION: {
685 data.enforceInterface(IActivityManager.descriptor);
686 int taskId = data.readInt();
687 boolean isInHomeStack = isInHomeStack(taskId);
688 reply.writeNoException();
689 reply.writeInt(isInHomeStack ? 1 : 0);
690 return true;
691 }
692
Craig Mautnercf910b02013-04-23 11:23:27 -0700693 case SET_FOCUSED_STACK_TRANSACTION: {
694 data.enforceInterface(IActivityManager.descriptor);
695 int stackId = data.readInt();
696 setFocusedStack(stackId);
697 reply.writeNoException();
698 return true;
699 }
700
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
702 data.enforceInterface(IActivityManager.descriptor);
703 IBinder token = data.readStrongBinder();
704 boolean onlyRoot = data.readInt() != 0;
705 int res = token != null
706 ? getTaskForActivity(token, onlyRoot) : -1;
707 reply.writeNoException();
708 reply.writeInt(res);
709 return true;
710 }
711
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800712 case GET_CONTENT_PROVIDER_TRANSACTION: {
713 data.enforceInterface(IActivityManager.descriptor);
714 IBinder b = data.readStrongBinder();
715 IApplicationThread app = ApplicationThreadNative.asInterface(b);
716 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700717 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700718 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700719 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800720 reply.writeNoException();
721 if (cph != null) {
722 reply.writeInt(1);
723 cph.writeToParcel(reply, 0);
724 } else {
725 reply.writeInt(0);
726 }
727 return true;
728 }
729
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800730 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
731 data.enforceInterface(IActivityManager.descriptor);
732 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700733 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800734 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700735 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800736 reply.writeNoException();
737 if (cph != null) {
738 reply.writeInt(1);
739 cph.writeToParcel(reply, 0);
740 } else {
741 reply.writeInt(0);
742 }
743 return true;
744 }
745
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800746 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
747 data.enforceInterface(IActivityManager.descriptor);
748 IBinder b = data.readStrongBinder();
749 IApplicationThread app = ApplicationThreadNative.asInterface(b);
750 ArrayList<ContentProviderHolder> providers =
751 data.createTypedArrayList(ContentProviderHolder.CREATOR);
752 publishContentProviders(app, providers);
753 reply.writeNoException();
754 return true;
755 }
756
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700757 case REF_CONTENT_PROVIDER_TRANSACTION: {
758 data.enforceInterface(IActivityManager.descriptor);
759 IBinder b = data.readStrongBinder();
760 int stable = data.readInt();
761 int unstable = data.readInt();
762 boolean res = refContentProvider(b, stable, unstable);
763 reply.writeNoException();
764 reply.writeInt(res ? 1 : 0);
765 return true;
766 }
767
768 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 IBinder b = data.readStrongBinder();
771 unstableProviderDied(b);
772 reply.writeNoException();
773 return true;
774 }
775
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700776 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
777 data.enforceInterface(IActivityManager.descriptor);
778 IBinder b = data.readStrongBinder();
779 appNotRespondingViaProvider(b);
780 reply.writeNoException();
781 return true;
782 }
783
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800784 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
785 data.enforceInterface(IActivityManager.descriptor);
786 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700787 boolean stable = data.readInt() != 0;
788 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800789 reply.writeNoException();
790 return true;
791 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800792
793 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
794 data.enforceInterface(IActivityManager.descriptor);
795 String name = data.readString();
796 IBinder token = data.readStrongBinder();
797 removeContentProviderExternal(name, token);
798 reply.writeNoException();
799 return true;
800 }
801
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700802 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
803 data.enforceInterface(IActivityManager.descriptor);
804 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
805 PendingIntent pi = getRunningServiceControlPanel(comp);
806 reply.writeNoException();
807 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
808 return true;
809 }
810
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800811 case START_SERVICE_TRANSACTION: {
812 data.enforceInterface(IActivityManager.descriptor);
813 IBinder b = data.readStrongBinder();
814 IApplicationThread app = ApplicationThreadNative.asInterface(b);
815 Intent service = Intent.CREATOR.createFromParcel(data);
816 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700817 int userId = data.readInt();
818 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800819 reply.writeNoException();
820 ComponentName.writeToParcel(cn, reply);
821 return true;
822 }
823
824 case STOP_SERVICE_TRANSACTION: {
825 data.enforceInterface(IActivityManager.descriptor);
826 IBinder b = data.readStrongBinder();
827 IApplicationThread app = ApplicationThreadNative.asInterface(b);
828 Intent service = Intent.CREATOR.createFromParcel(data);
829 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700830 int userId = data.readInt();
831 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800832 reply.writeNoException();
833 reply.writeInt(res);
834 return true;
835 }
836
837 case STOP_SERVICE_TOKEN_TRANSACTION: {
838 data.enforceInterface(IActivityManager.descriptor);
839 ComponentName className = ComponentName.readFromParcel(data);
840 IBinder token = data.readStrongBinder();
841 int startId = data.readInt();
842 boolean res = stopServiceToken(className, token, startId);
843 reply.writeNoException();
844 reply.writeInt(res ? 1 : 0);
845 return true;
846 }
847
848 case SET_SERVICE_FOREGROUND_TRANSACTION: {
849 data.enforceInterface(IActivityManager.descriptor);
850 ComponentName className = ComponentName.readFromParcel(data);
851 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700852 int id = data.readInt();
853 Notification notification = null;
854 if (data.readInt() != 0) {
855 notification = Notification.CREATOR.createFromParcel(data);
856 }
857 boolean removeNotification = data.readInt() != 0;
858 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800859 reply.writeNoException();
860 return true;
861 }
862
863 case BIND_SERVICE_TRANSACTION: {
864 data.enforceInterface(IActivityManager.descriptor);
865 IBinder b = data.readStrongBinder();
866 IApplicationThread app = ApplicationThreadNative.asInterface(b);
867 IBinder token = data.readStrongBinder();
868 Intent service = Intent.CREATOR.createFromParcel(data);
869 String resolvedType = data.readString();
870 b = data.readStrongBinder();
871 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800872 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800874 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800875 reply.writeNoException();
876 reply.writeInt(res);
877 return true;
878 }
879
880 case UNBIND_SERVICE_TRANSACTION: {
881 data.enforceInterface(IActivityManager.descriptor);
882 IBinder b = data.readStrongBinder();
883 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
884 boolean res = unbindService(conn);
885 reply.writeNoException();
886 reply.writeInt(res ? 1 : 0);
887 return true;
888 }
889
890 case PUBLISH_SERVICE_TRANSACTION: {
891 data.enforceInterface(IActivityManager.descriptor);
892 IBinder token = data.readStrongBinder();
893 Intent intent = Intent.CREATOR.createFromParcel(data);
894 IBinder service = data.readStrongBinder();
895 publishService(token, intent, service);
896 reply.writeNoException();
897 return true;
898 }
899
900 case UNBIND_FINISHED_TRANSACTION: {
901 data.enforceInterface(IActivityManager.descriptor);
902 IBinder token = data.readStrongBinder();
903 Intent intent = Intent.CREATOR.createFromParcel(data);
904 boolean doRebind = data.readInt() != 0;
905 unbindFinished(token, intent, doRebind);
906 reply.writeNoException();
907 return true;
908 }
909
910 case SERVICE_DONE_EXECUTING_TRANSACTION: {
911 data.enforceInterface(IActivityManager.descriptor);
912 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700913 int type = data.readInt();
914 int startId = data.readInt();
915 int res = data.readInt();
916 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 reply.writeNoException();
918 return true;
919 }
920
921 case START_INSTRUMENTATION_TRANSACTION: {
922 data.enforceInterface(IActivityManager.descriptor);
923 ComponentName className = ComponentName.readFromParcel(data);
924 String profileFile = data.readString();
925 int fl = data.readInt();
926 Bundle arguments = data.readBundle();
927 IBinder b = data.readStrongBinder();
928 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800929 b = data.readStrongBinder();
930 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700931 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800932 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800933 reply.writeNoException();
934 reply.writeInt(res ? 1 : 0);
935 return true;
936 }
937
938
939 case FINISH_INSTRUMENTATION_TRANSACTION: {
940 data.enforceInterface(IActivityManager.descriptor);
941 IBinder b = data.readStrongBinder();
942 IApplicationThread app = ApplicationThreadNative.asInterface(b);
943 int resultCode = data.readInt();
944 Bundle results = data.readBundle();
945 finishInstrumentation(app, resultCode, results);
946 reply.writeNoException();
947 return true;
948 }
949
950 case GET_CONFIGURATION_TRANSACTION: {
951 data.enforceInterface(IActivityManager.descriptor);
952 Configuration config = getConfiguration();
953 reply.writeNoException();
954 config.writeToParcel(reply, 0);
955 return true;
956 }
957
958 case UPDATE_CONFIGURATION_TRANSACTION: {
959 data.enforceInterface(IActivityManager.descriptor);
960 Configuration config = Configuration.CREATOR.createFromParcel(data);
961 updateConfiguration(config);
962 reply.writeNoException();
963 return true;
964 }
965
966 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
967 data.enforceInterface(IActivityManager.descriptor);
968 IBinder token = data.readStrongBinder();
969 int requestedOrientation = data.readInt();
970 setRequestedOrientation(token, requestedOrientation);
971 reply.writeNoException();
972 return true;
973 }
974
975 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
976 data.enforceInterface(IActivityManager.descriptor);
977 IBinder token = data.readStrongBinder();
978 int req = getRequestedOrientation(token);
979 reply.writeNoException();
980 reply.writeInt(req);
981 return true;
982 }
983
984 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
985 data.enforceInterface(IActivityManager.descriptor);
986 IBinder token = data.readStrongBinder();
987 ComponentName cn = getActivityClassForToken(token);
988 reply.writeNoException();
989 ComponentName.writeToParcel(cn, reply);
990 return true;
991 }
992
993 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
994 data.enforceInterface(IActivityManager.descriptor);
995 IBinder token = data.readStrongBinder();
996 reply.writeNoException();
997 reply.writeString(getPackageForToken(token));
998 return true;
999 }
1000
1001 case GET_INTENT_SENDER_TRANSACTION: {
1002 data.enforceInterface(IActivityManager.descriptor);
1003 int type = data.readInt();
1004 String packageName = data.readString();
1005 IBinder token = data.readStrongBinder();
1006 String resultWho = data.readString();
1007 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001008 Intent[] requestIntents;
1009 String[] requestResolvedTypes;
1010 if (data.readInt() != 0) {
1011 requestIntents = data.createTypedArray(Intent.CREATOR);
1012 requestResolvedTypes = data.createStringArray();
1013 } else {
1014 requestIntents = null;
1015 requestResolvedTypes = null;
1016 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001017 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001018 Bundle options = data.readInt() != 0
1019 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001020 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001021 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001022 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001023 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001024 reply.writeNoException();
1025 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1026 return true;
1027 }
1028
1029 case CANCEL_INTENT_SENDER_TRANSACTION: {
1030 data.enforceInterface(IActivityManager.descriptor);
1031 IIntentSender r = IIntentSender.Stub.asInterface(
1032 data.readStrongBinder());
1033 cancelIntentSender(r);
1034 reply.writeNoException();
1035 return true;
1036 }
1037
1038 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1039 data.enforceInterface(IActivityManager.descriptor);
1040 IIntentSender r = IIntentSender.Stub.asInterface(
1041 data.readStrongBinder());
1042 String res = getPackageForIntentSender(r);
1043 reply.writeNoException();
1044 reply.writeString(res);
1045 return true;
1046 }
1047
Christopher Tatec4a07d12012-04-06 14:19:13 -07001048 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1049 data.enforceInterface(IActivityManager.descriptor);
1050 IIntentSender r = IIntentSender.Stub.asInterface(
1051 data.readStrongBinder());
1052 int res = getUidForIntentSender(r);
1053 reply.writeNoException();
1054 reply.writeInt(res);
1055 return true;
1056 }
1057
Dianne Hackborn41203752012-08-31 14:05:51 -07001058 case HANDLE_INCOMING_USER_TRANSACTION: {
1059 data.enforceInterface(IActivityManager.descriptor);
1060 int callingPid = data.readInt();
1061 int callingUid = data.readInt();
1062 int userId = data.readInt();
1063 boolean allowAll = data.readInt() != 0 ;
1064 boolean requireFull = data.readInt() != 0;
1065 String name = data.readString();
1066 String callerPackage = data.readString();
1067 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1068 requireFull, name, callerPackage);
1069 reply.writeNoException();
1070 reply.writeInt(res);
1071 return true;
1072 }
1073
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001074 case SET_PROCESS_LIMIT_TRANSACTION: {
1075 data.enforceInterface(IActivityManager.descriptor);
1076 int max = data.readInt();
1077 setProcessLimit(max);
1078 reply.writeNoException();
1079 return true;
1080 }
1081
1082 case GET_PROCESS_LIMIT_TRANSACTION: {
1083 data.enforceInterface(IActivityManager.descriptor);
1084 int limit = getProcessLimit();
1085 reply.writeNoException();
1086 reply.writeInt(limit);
1087 return true;
1088 }
1089
1090 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1091 data.enforceInterface(IActivityManager.descriptor);
1092 IBinder token = data.readStrongBinder();
1093 int pid = data.readInt();
1094 boolean isForeground = data.readInt() != 0;
1095 setProcessForeground(token, pid, isForeground);
1096 reply.writeNoException();
1097 return true;
1098 }
1099
1100 case CHECK_PERMISSION_TRANSACTION: {
1101 data.enforceInterface(IActivityManager.descriptor);
1102 String perm = data.readString();
1103 int pid = data.readInt();
1104 int uid = data.readInt();
1105 int res = checkPermission(perm, pid, uid);
1106 reply.writeNoException();
1107 reply.writeInt(res);
1108 return true;
1109 }
1110
1111 case CHECK_URI_PERMISSION_TRANSACTION: {
1112 data.enforceInterface(IActivityManager.descriptor);
1113 Uri uri = Uri.CREATOR.createFromParcel(data);
1114 int pid = data.readInt();
1115 int uid = data.readInt();
1116 int mode = data.readInt();
1117 int res = checkUriPermission(uri, pid, uid, mode);
1118 reply.writeNoException();
1119 reply.writeInt(res);
1120 return true;
1121 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001122
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001123 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001124 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001125 String packageName = data.readString();
1126 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1127 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001128 int userId = data.readInt();
1129 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001130 reply.writeNoException();
1131 reply.writeInt(res ? 1 : 0);
1132 return true;
1133 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001134
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001135 case GRANT_URI_PERMISSION_TRANSACTION: {
1136 data.enforceInterface(IActivityManager.descriptor);
1137 IBinder b = data.readStrongBinder();
1138 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1139 String targetPkg = data.readString();
1140 Uri uri = Uri.CREATOR.createFromParcel(data);
1141 int mode = data.readInt();
1142 grantUriPermission(app, targetPkg, uri, mode);
1143 reply.writeNoException();
1144 return true;
1145 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001146
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147 case REVOKE_URI_PERMISSION_TRANSACTION: {
1148 data.enforceInterface(IActivityManager.descriptor);
1149 IBinder b = data.readStrongBinder();
1150 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1151 Uri uri = Uri.CREATOR.createFromParcel(data);
1152 int mode = data.readInt();
1153 revokeUriPermission(app, uri, mode);
1154 reply.writeNoException();
1155 return true;
1156 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001157
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001158 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1159 data.enforceInterface(IActivityManager.descriptor);
1160 Uri uri = Uri.CREATOR.createFromParcel(data);
1161 int mode = data.readInt();
1162 takePersistableUriPermission(uri, mode);
1163 reply.writeNoException();
1164 return true;
1165 }
1166
1167 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1168 data.enforceInterface(IActivityManager.descriptor);
1169 Uri uri = Uri.CREATOR.createFromParcel(data);
1170 int mode = data.readInt();
1171 releasePersistableUriPermission(uri, mode);
1172 reply.writeNoException();
1173 return true;
1174 }
1175
1176 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1177 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001178 final String packageName = data.readString();
1179 final boolean incoming = data.readInt() != 0;
1180 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1181 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001182 reply.writeNoException();
1183 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1184 return true;
1185 }
1186
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001187 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1188 data.enforceInterface(IActivityManager.descriptor);
1189 IBinder b = data.readStrongBinder();
1190 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1191 boolean waiting = data.readInt() != 0;
1192 showWaitingForDebugger(app, waiting);
1193 reply.writeNoException();
1194 return true;
1195 }
1196
1197 case GET_MEMORY_INFO_TRANSACTION: {
1198 data.enforceInterface(IActivityManager.descriptor);
1199 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1200 getMemoryInfo(mi);
1201 reply.writeNoException();
1202 mi.writeToParcel(reply, 0);
1203 return true;
1204 }
1205
1206 case UNHANDLED_BACK_TRANSACTION: {
1207 data.enforceInterface(IActivityManager.descriptor);
1208 unhandledBack();
1209 reply.writeNoException();
1210 return true;
1211 }
1212
1213 case OPEN_CONTENT_URI_TRANSACTION: {
1214 data.enforceInterface(IActivityManager.descriptor);
1215 Uri uri = Uri.parse(data.readString());
1216 ParcelFileDescriptor pfd = openContentUri(uri);
1217 reply.writeNoException();
1218 if (pfd != null) {
1219 reply.writeInt(1);
1220 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1221 } else {
1222 reply.writeInt(0);
1223 }
1224 return true;
1225 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001226
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001227 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1228 data.enforceInterface(IActivityManager.descriptor);
1229 setLockScreenShown(data.readInt() != 0);
1230 reply.writeNoException();
1231 return true;
1232 }
1233
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001234 case SET_DEBUG_APP_TRANSACTION: {
1235 data.enforceInterface(IActivityManager.descriptor);
1236 String pn = data.readString();
1237 boolean wfd = data.readInt() != 0;
1238 boolean per = data.readInt() != 0;
1239 setDebugApp(pn, wfd, per);
1240 reply.writeNoException();
1241 return true;
1242 }
1243
1244 case SET_ALWAYS_FINISH_TRANSACTION: {
1245 data.enforceInterface(IActivityManager.descriptor);
1246 boolean enabled = data.readInt() != 0;
1247 setAlwaysFinish(enabled);
1248 reply.writeNoException();
1249 return true;
1250 }
1251
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001252 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001254 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001255 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001256 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001257 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001258 return true;
1259 }
1260
1261 case ENTER_SAFE_MODE_TRANSACTION: {
1262 data.enforceInterface(IActivityManager.descriptor);
1263 enterSafeMode();
1264 reply.writeNoException();
1265 return true;
1266 }
1267
1268 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1269 data.enforceInterface(IActivityManager.descriptor);
1270 IIntentSender is = IIntentSender.Stub.asInterface(
1271 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001272 int sourceUid = data.readInt();
1273 String sourcePkg = data.readString();
1274 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001275 reply.writeNoException();
1276 return true;
1277 }
1278
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001279 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001280 data.enforceInterface(IActivityManager.descriptor);
1281 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001282 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001283 boolean secure = data.readInt() != 0;
1284 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001285 reply.writeNoException();
1286 reply.writeInt(res ? 1 : 0);
1287 return true;
1288 }
1289
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001290 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1291 data.enforceInterface(IActivityManager.descriptor);
1292 String reason = data.readString();
1293 boolean res = killProcessesBelowForeground(reason);
1294 reply.writeNoException();
1295 reply.writeInt(res ? 1 : 0);
1296 return true;
1297 }
1298
Dan Egnor60d87622009-12-16 16:32:58 -08001299 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1300 data.enforceInterface(IActivityManager.descriptor);
1301 IBinder app = data.readStrongBinder();
1302 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1303 handleApplicationCrash(app, ci);
1304 reply.writeNoException();
1305 return true;
1306 }
1307
1308 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001309 data.enforceInterface(IActivityManager.descriptor);
1310 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001311 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001312 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001313 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001314 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001315 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001316 return true;
1317 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001318
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001319 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1320 data.enforceInterface(IActivityManager.descriptor);
1321 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001322 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001323 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1324 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001325 reply.writeNoException();
1326 return true;
1327 }
1328
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001329 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1330 data.enforceInterface(IActivityManager.descriptor);
1331 int sig = data.readInt();
1332 signalPersistentProcesses(sig);
1333 reply.writeNoException();
1334 return true;
1335 }
1336
Dianne Hackborn03abb812010-01-04 18:43:19 -08001337 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1338 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001339 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001340 int userId = data.readInt();
1341 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001342 reply.writeNoException();
1343 return true;
1344 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001345
1346 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1347 data.enforceInterface(IActivityManager.descriptor);
1348 killAllBackgroundProcesses();
1349 reply.writeNoException();
1350 return true;
1351 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001352
Dianne Hackborn03abb812010-01-04 18:43:19 -08001353 case FORCE_STOP_PACKAGE_TRANSACTION: {
1354 data.enforceInterface(IActivityManager.descriptor);
1355 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001356 int userId = data.readInt();
1357 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001358 reply.writeNoException();
1359 return true;
1360 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001361
1362 case GET_MY_MEMORY_STATE_TRANSACTION: {
1363 data.enforceInterface(IActivityManager.descriptor);
1364 ActivityManager.RunningAppProcessInfo info =
1365 new ActivityManager.RunningAppProcessInfo();
1366 getMyMemoryState(info);
1367 reply.writeNoException();
1368 info.writeToParcel(reply, 0);
1369 return true;
1370 }
1371
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001372 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
1374 ConfigurationInfo config = getDeviceConfigurationInfo();
1375 reply.writeNoException();
1376 config.writeToParcel(reply, 0);
1377 return true;
1378 }
1379
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001380 case PROFILE_CONTROL_TRANSACTION: {
1381 data.enforceInterface(IActivityManager.descriptor);
1382 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001383 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001384 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001385 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001386 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001387 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001388 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001389 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001390 reply.writeNoException();
1391 reply.writeInt(res ? 1 : 0);
1392 return true;
1393 }
1394
Dianne Hackborn55280a92009-05-07 15:53:46 -07001395 case SHUTDOWN_TRANSACTION: {
1396 data.enforceInterface(IActivityManager.descriptor);
1397 boolean res = shutdown(data.readInt());
1398 reply.writeNoException();
1399 reply.writeInt(res ? 1 : 0);
1400 return true;
1401 }
1402
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001403 case STOP_APP_SWITCHES_TRANSACTION: {
1404 data.enforceInterface(IActivityManager.descriptor);
1405 stopAppSwitches();
1406 reply.writeNoException();
1407 return true;
1408 }
1409
1410 case RESUME_APP_SWITCHES_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 resumeAppSwitches();
1413 reply.writeNoException();
1414 return true;
1415 }
1416
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001417 case PEEK_SERVICE_TRANSACTION: {
1418 data.enforceInterface(IActivityManager.descriptor);
1419 Intent service = Intent.CREATOR.createFromParcel(data);
1420 String resolvedType = data.readString();
1421 IBinder binder = peekService(service, resolvedType);
1422 reply.writeNoException();
1423 reply.writeStrongBinder(binder);
1424 return true;
1425 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001426
1427 case START_BACKUP_AGENT_TRANSACTION: {
1428 data.enforceInterface(IActivityManager.descriptor);
1429 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1430 int backupRestoreMode = data.readInt();
1431 boolean success = bindBackupAgent(info, backupRestoreMode);
1432 reply.writeNoException();
1433 reply.writeInt(success ? 1 : 0);
1434 return true;
1435 }
1436
1437 case BACKUP_AGENT_CREATED_TRANSACTION: {
1438 data.enforceInterface(IActivityManager.descriptor);
1439 String packageName = data.readString();
1440 IBinder agent = data.readStrongBinder();
1441 backupAgentCreated(packageName, agent);
1442 reply.writeNoException();
1443 return true;
1444 }
1445
1446 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
1448 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1449 unbindBackupAgent(info);
1450 reply.writeNoException();
1451 return true;
1452 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001453
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001454 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001455 data.enforceInterface(IActivityManager.descriptor);
1456 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001457 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001458 String reason = data.readString();
1459 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001460 reply.writeNoException();
1461 return true;
1462 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001463
1464 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1465 data.enforceInterface(IActivityManager.descriptor);
1466 String reason = data.readString();
1467 closeSystemDialogs(reason);
1468 reply.writeNoException();
1469 return true;
1470 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001471
1472 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1473 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001474 int[] pids = data.createIntArray();
1475 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001476 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001477 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001478 return true;
1479 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001480
1481 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1482 data.enforceInterface(IActivityManager.descriptor);
1483 String processName = data.readString();
1484 int uid = data.readInt();
1485 killApplicationProcess(processName, uid);
1486 reply.writeNoException();
1487 return true;
1488 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001489
1490 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1491 data.enforceInterface(IActivityManager.descriptor);
1492 IBinder token = data.readStrongBinder();
1493 String packageName = data.readString();
1494 int enterAnim = data.readInt();
1495 int exitAnim = data.readInt();
1496 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001497 reply.writeNoException();
1498 return true;
1499 }
1500
1501 case IS_USER_A_MONKEY_TRANSACTION: {
1502 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001503 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001504 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001505 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001506 return true;
1507 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001508
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001509 case SET_USER_IS_MONKEY_TRANSACTION: {
1510 data.enforceInterface(IActivityManager.descriptor);
1511 final boolean monkey = (data.readInt() == 1);
1512 setUserIsMonkey(monkey);
1513 reply.writeNoException();
1514 return true;
1515 }
1516
Dianne Hackborn860755f2010-06-03 18:47:52 -07001517 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1518 data.enforceInterface(IActivityManager.descriptor);
1519 finishHeavyWeightApp();
1520 reply.writeNoException();
1521 return true;
1522 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001523
1524 case IS_IMMERSIVE_TRANSACTION: {
1525 data.enforceInterface(IActivityManager.descriptor);
1526 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001527 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001528 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001529 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001530 return true;
1531 }
1532
Craig Mautner5eda9b32013-07-02 11:58:16 -07001533 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001534 data.enforceInterface(IActivityManager.descriptor);
1535 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001536 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001537 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001538 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001539 return true;
1540 }
1541
1542 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1543 data.enforceInterface(IActivityManager.descriptor);
1544 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001545 final Bundle bundle;
1546 if (data.readInt() == 0) {
1547 bundle = null;
1548 } else {
1549 bundle = data.readBundle();
1550 }
1551 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1552 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001553 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001554 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001555 return true;
1556 }
1557
Craig Mautner233ceee2014-05-09 17:05:11 -07001558 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1559 data.enforceInterface(IActivityManager.descriptor);
1560 IBinder token = data.readStrongBinder();
1561 final ActivityOptions options = getActivityOptions(token);
1562 reply.writeNoException();
1563 reply.writeBundle(options == null ? null : options.toBundle());
1564 return true;
1565 }
1566
Daniel Sandler69a48172010-06-23 16:29:36 -04001567 case SET_IMMERSIVE_TRANSACTION: {
1568 data.enforceInterface(IActivityManager.descriptor);
1569 IBinder token = data.readStrongBinder();
1570 boolean imm = data.readInt() == 1;
1571 setImmersive(token, imm);
1572 reply.writeNoException();
1573 return true;
1574 }
1575
1576 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1577 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001578 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001579 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001580 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001581 return true;
1582 }
1583
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001584 case CRASH_APPLICATION_TRANSACTION: {
1585 data.enforceInterface(IActivityManager.descriptor);
1586 int uid = data.readInt();
1587 int initialPid = data.readInt();
1588 String packageName = data.readString();
1589 String message = data.readString();
1590 crashApplication(uid, initialPid, packageName, message);
1591 reply.writeNoException();
1592 return true;
1593 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001594
1595 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1596 data.enforceInterface(IActivityManager.descriptor);
1597 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001598 int userId = data.readInt();
1599 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001600 reply.writeNoException();
1601 reply.writeString(type);
1602 return true;
1603 }
1604
Dianne Hackborn7e269642010-08-25 19:50:20 -07001605 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1606 data.enforceInterface(IActivityManager.descriptor);
1607 String name = data.readString();
1608 IBinder perm = newUriPermissionOwner(name);
1609 reply.writeNoException();
1610 reply.writeStrongBinder(perm);
1611 return true;
1612 }
1613
1614 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1615 data.enforceInterface(IActivityManager.descriptor);
1616 IBinder owner = data.readStrongBinder();
1617 int fromUid = data.readInt();
1618 String targetPkg = data.readString();
1619 Uri uri = Uri.CREATOR.createFromParcel(data);
1620 int mode = data.readInt();
1621 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1622 reply.writeNoException();
1623 return true;
1624 }
1625
1626 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1627 data.enforceInterface(IActivityManager.descriptor);
1628 IBinder owner = data.readStrongBinder();
1629 Uri uri = null;
1630 if (data.readInt() != 0) {
1631 Uri.CREATOR.createFromParcel(data);
1632 }
1633 int mode = data.readInt();
1634 revokeUriPermissionFromOwner(owner, uri, mode);
1635 reply.writeNoException();
1636 return true;
1637 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001638
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001639 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1640 data.enforceInterface(IActivityManager.descriptor);
1641 int callingUid = data.readInt();
1642 String targetPkg = data.readString();
1643 Uri uri = Uri.CREATOR.createFromParcel(data);
1644 int modeFlags = data.readInt();
1645 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1646 reply.writeNoException();
1647 reply.writeInt(res);
1648 return true;
1649 }
1650
Andy McFadden824c5102010-07-09 16:26:57 -07001651 case DUMP_HEAP_TRANSACTION: {
1652 data.enforceInterface(IActivityManager.descriptor);
1653 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001654 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001655 boolean managed = data.readInt() != 0;
1656 String path = data.readString();
1657 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001658 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001659 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001660 reply.writeNoException();
1661 reply.writeInt(res ? 1 : 0);
1662 return true;
1663 }
1664
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001665 case START_ACTIVITIES_TRANSACTION:
1666 {
1667 data.enforceInterface(IActivityManager.descriptor);
1668 IBinder b = data.readStrongBinder();
1669 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001670 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001671 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1672 String[] resolvedTypes = data.createStringArray();
1673 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001674 Bundle options = data.readInt() != 0
1675 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001676 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001677 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001678 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001679 reply.writeNoException();
1680 reply.writeInt(result);
1681 return true;
1682 }
1683
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001684 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1685 {
1686 data.enforceInterface(IActivityManager.descriptor);
1687 int mode = getFrontActivityScreenCompatMode();
1688 reply.writeNoException();
1689 reply.writeInt(mode);
1690 return true;
1691 }
1692
1693 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1694 {
1695 data.enforceInterface(IActivityManager.descriptor);
1696 int mode = data.readInt();
1697 setFrontActivityScreenCompatMode(mode);
1698 reply.writeNoException();
1699 reply.writeInt(mode);
1700 return true;
1701 }
1702
1703 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1704 {
1705 data.enforceInterface(IActivityManager.descriptor);
1706 String pkg = data.readString();
1707 int mode = getPackageScreenCompatMode(pkg);
1708 reply.writeNoException();
1709 reply.writeInt(mode);
1710 return true;
1711 }
1712
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001713 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1714 {
1715 data.enforceInterface(IActivityManager.descriptor);
1716 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001717 int mode = data.readInt();
1718 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001719 reply.writeNoException();
1720 return true;
1721 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001722
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001723 case SWITCH_USER_TRANSACTION: {
1724 data.enforceInterface(IActivityManager.descriptor);
1725 int userid = data.readInt();
1726 boolean result = switchUser(userid);
1727 reply.writeNoException();
1728 reply.writeInt(result ? 1 : 0);
1729 return true;
1730 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001731
Kenny Guy08488bf2014-02-21 17:40:37 +00001732 case START_USER_IN_BACKGROUND_TRANSACTION: {
1733 data.enforceInterface(IActivityManager.descriptor);
1734 int userid = data.readInt();
1735 boolean result = startUserInBackground(userid);
1736 reply.writeNoException();
1737 reply.writeInt(result ? 1 : 0);
1738 return true;
1739 }
1740
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001741 case STOP_USER_TRANSACTION: {
1742 data.enforceInterface(IActivityManager.descriptor);
1743 int userid = data.readInt();
1744 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1745 data.readStrongBinder());
1746 int result = stopUser(userid, callback);
1747 reply.writeNoException();
1748 reply.writeInt(result);
1749 return true;
1750 }
1751
Amith Yamasani52f1d752012-03-28 18:19:29 -07001752 case GET_CURRENT_USER_TRANSACTION: {
1753 data.enforceInterface(IActivityManager.descriptor);
1754 UserInfo userInfo = getCurrentUser();
1755 reply.writeNoException();
1756 userInfo.writeToParcel(reply, 0);
1757 return true;
1758 }
1759
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001760 case IS_USER_RUNNING_TRANSACTION: {
1761 data.enforceInterface(IActivityManager.descriptor);
1762 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001763 boolean orStopping = data.readInt() != 0;
1764 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001765 reply.writeNoException();
1766 reply.writeInt(result ? 1 : 0);
1767 return true;
1768 }
1769
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001770 case GET_RUNNING_USER_IDS_TRANSACTION: {
1771 data.enforceInterface(IActivityManager.descriptor);
1772 int[] result = getRunningUserIds();
1773 reply.writeNoException();
1774 reply.writeIntArray(result);
1775 return true;
1776 }
1777
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001778 case REMOVE_SUB_TASK_TRANSACTION:
1779 {
1780 data.enforceInterface(IActivityManager.descriptor);
1781 int taskId = data.readInt();
1782 int subTaskIndex = data.readInt();
1783 boolean result = removeSubTask(taskId, subTaskIndex);
1784 reply.writeNoException();
1785 reply.writeInt(result ? 1 : 0);
1786 return true;
1787 }
1788
1789 case REMOVE_TASK_TRANSACTION:
1790 {
1791 data.enforceInterface(IActivityManager.descriptor);
1792 int taskId = data.readInt();
1793 int fl = data.readInt();
1794 boolean result = removeTask(taskId, fl);
1795 reply.writeNoException();
1796 reply.writeInt(result ? 1 : 0);
1797 return true;
1798 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001799
Jeff Sharkeya4620792011-05-20 15:29:23 -07001800 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1801 data.enforceInterface(IActivityManager.descriptor);
1802 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1803 data.readStrongBinder());
1804 registerProcessObserver(observer);
1805 return true;
1806 }
1807
1808 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1809 data.enforceInterface(IActivityManager.descriptor);
1810 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1811 data.readStrongBinder());
1812 unregisterProcessObserver(observer);
1813 return true;
1814 }
1815
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001816 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1817 {
1818 data.enforceInterface(IActivityManager.descriptor);
1819 String pkg = data.readString();
1820 boolean ask = getPackageAskScreenCompat(pkg);
1821 reply.writeNoException();
1822 reply.writeInt(ask ? 1 : 0);
1823 return true;
1824 }
1825
1826 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1827 {
1828 data.enforceInterface(IActivityManager.descriptor);
1829 String pkg = data.readString();
1830 boolean ask = data.readInt() != 0;
1831 setPackageAskScreenCompat(pkg, ask);
1832 reply.writeNoException();
1833 return true;
1834 }
1835
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001836 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1837 data.enforceInterface(IActivityManager.descriptor);
1838 IIntentSender r = IIntentSender.Stub.asInterface(
1839 data.readStrongBinder());
1840 boolean res = isIntentSenderTargetedToPackage(r);
1841 reply.writeNoException();
1842 reply.writeInt(res ? 1 : 0);
1843 return true;
1844 }
1845
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001846 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1847 data.enforceInterface(IActivityManager.descriptor);
1848 IIntentSender r = IIntentSender.Stub.asInterface(
1849 data.readStrongBinder());
1850 boolean res = isIntentSenderAnActivity(r);
1851 reply.writeNoException();
1852 reply.writeInt(res ? 1 : 0);
1853 return true;
1854 }
1855
Dianne Hackborn81038902012-11-26 17:04:09 -08001856 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1857 data.enforceInterface(IActivityManager.descriptor);
1858 IIntentSender r = IIntentSender.Stub.asInterface(
1859 data.readStrongBinder());
1860 Intent intent = getIntentForIntentSender(r);
1861 reply.writeNoException();
1862 if (intent != null) {
1863 reply.writeInt(1);
1864 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1865 } else {
1866 reply.writeInt(0);
1867 }
1868 return true;
1869 }
1870
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001871 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1872 data.enforceInterface(IActivityManager.descriptor);
1873 IIntentSender r = IIntentSender.Stub.asInterface(
1874 data.readStrongBinder());
1875 String prefix = data.readString();
1876 String tag = getTagForIntentSender(r, prefix);
1877 reply.writeNoException();
1878 reply.writeString(tag);
1879 return true;
1880 }
1881
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001882 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1883 data.enforceInterface(IActivityManager.descriptor);
1884 Configuration config = Configuration.CREATOR.createFromParcel(data);
1885 updatePersistentConfiguration(config);
1886 reply.writeNoException();
1887 return true;
1888 }
1889
Dianne Hackbornb437e092011-08-05 17:50:29 -07001890 case GET_PROCESS_PSS_TRANSACTION: {
1891 data.enforceInterface(IActivityManager.descriptor);
1892 int[] pids = data.createIntArray();
1893 long[] pss = getProcessPss(pids);
1894 reply.writeNoException();
1895 reply.writeLongArray(pss);
1896 return true;
1897 }
1898
Dianne Hackborn661cd522011-08-22 00:26:20 -07001899 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1900 data.enforceInterface(IActivityManager.descriptor);
1901 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1902 boolean always = data.readInt() != 0;
1903 showBootMessage(msg, always);
1904 reply.writeNoException();
1905 return true;
1906 }
1907
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001908 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1909 data.enforceInterface(IActivityManager.descriptor);
1910 dismissKeyguardOnNextActivity();
1911 reply.writeNoException();
1912 return true;
1913 }
1914
Adam Powelldd8fab22012-03-22 17:47:27 -07001915 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1916 data.enforceInterface(IActivityManager.descriptor);
1917 IBinder token = data.readStrongBinder();
1918 String destAffinity = data.readString();
1919 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1920 reply.writeNoException();
1921 reply.writeInt(res ? 1 : 0);
1922 return true;
1923 }
1924
1925 case NAVIGATE_UP_TO_TRANSACTION: {
1926 data.enforceInterface(IActivityManager.descriptor);
1927 IBinder token = data.readStrongBinder();
1928 Intent target = Intent.CREATOR.createFromParcel(data);
1929 int resultCode = data.readInt();
1930 Intent resultData = null;
1931 if (data.readInt() != 0) {
1932 resultData = Intent.CREATOR.createFromParcel(data);
1933 }
1934 boolean res = navigateUpTo(token, target, resultCode, resultData);
1935 reply.writeNoException();
1936 reply.writeInt(res ? 1 : 0);
1937 return true;
1938 }
1939
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001940 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1941 data.enforceInterface(IActivityManager.descriptor);
1942 IBinder token = data.readStrongBinder();
1943 int res = getLaunchedFromUid(token);
1944 reply.writeNoException();
1945 reply.writeInt(res);
1946 return true;
1947 }
1948
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001949 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1950 data.enforceInterface(IActivityManager.descriptor);
1951 IBinder token = data.readStrongBinder();
1952 String res = getLaunchedFromPackage(token);
1953 reply.writeNoException();
1954 reply.writeString(res);
1955 return true;
1956 }
1957
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001958 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1959 data.enforceInterface(IActivityManager.descriptor);
1960 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1961 data.readStrongBinder());
1962 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001963 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001964 return true;
1965 }
1966
1967 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1968 data.enforceInterface(IActivityManager.descriptor);
1969 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1970 data.readStrongBinder());
1971 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001972 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001973 return true;
1974 }
1975
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001976 case REQUEST_BUG_REPORT_TRANSACTION: {
1977 data.enforceInterface(IActivityManager.descriptor);
1978 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001979 reply.writeNoException();
1980 return true;
1981 }
1982
1983 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1984 data.enforceInterface(IActivityManager.descriptor);
1985 int pid = data.readInt();
1986 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07001987 String reason = data.readString();
1988 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001989 reply.writeNoException();
1990 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001991 return true;
1992 }
1993
Adam Skorydfc7fd72013-08-05 19:23:41 -07001994 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001995 data.enforceInterface(IActivityManager.descriptor);
1996 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07001997 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001998 reply.writeNoException();
1999 reply.writeBundle(res);
2000 return true;
2001 }
2002
Adam Skorydfc7fd72013-08-05 19:23:41 -07002003 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002004 data.enforceInterface(IActivityManager.descriptor);
2005 IBinder token = data.readStrongBinder();
2006 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002007 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002008 reply.writeNoException();
2009 return true;
2010 }
2011
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002012 case KILL_UID_TRANSACTION: {
2013 data.enforceInterface(IActivityManager.descriptor);
2014 int uid = data.readInt();
2015 String reason = data.readString();
2016 killUid(uid, reason);
2017 reply.writeNoException();
2018 return true;
2019 }
2020
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002021 case HANG_TRANSACTION: {
2022 data.enforceInterface(IActivityManager.descriptor);
2023 IBinder who = data.readStrongBinder();
2024 boolean allowRestart = data.readInt() != 0;
2025 hang(who, allowRestart);
2026 reply.writeNoException();
2027 return true;
2028 }
2029
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002030 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2031 data.enforceInterface(IActivityManager.descriptor);
2032 IBinder token = data.readStrongBinder();
2033 reportActivityFullyDrawn(token);
2034 reply.writeNoException();
2035 return true;
2036 }
2037
Craig Mautner5eda9b32013-07-02 11:58:16 -07002038 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2039 data.enforceInterface(IActivityManager.descriptor);
2040 IBinder token = data.readStrongBinder();
2041 notifyActivityDrawn(token);
2042 reply.writeNoException();
2043 return true;
2044 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002045
2046 case RESTART_TRANSACTION: {
2047 data.enforceInterface(IActivityManager.descriptor);
2048 restart();
2049 reply.writeNoException();
2050 return true;
2051 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002052
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002053 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2054 data.enforceInterface(IActivityManager.descriptor);
2055 performIdleMaintenance();
2056 reply.writeNoException();
2057 return true;
2058 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002059
2060 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2061 data.enforceInterface(IActivityManager.descriptor);
2062 IBinder parentActivityToken = data.readStrongBinder();
2063 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002064 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002065 IActivityContainer activityContainer =
2066 createActivityContainer(parentActivityToken, callback);
2067 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002068 if (activityContainer != null) {
2069 reply.writeInt(1);
2070 reply.writeStrongBinder(activityContainer.asBinder());
2071 } else {
2072 reply.writeInt(0);
2073 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002074 return true;
2075 }
2076
Craig Mautner95da1082014-02-24 17:54:35 -08002077 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2078 data.enforceInterface(IActivityManager.descriptor);
2079 IActivityContainer activityContainer =
2080 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2081 deleteActivityContainer(activityContainer);
2082 reply.writeNoException();
2083 return true;
2084 }
2085
Craig Mautnere0a38842013-12-16 16:14:02 -08002086 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2087 data.enforceInterface(IActivityManager.descriptor);
2088 IBinder activityToken = data.readStrongBinder();
2089 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2090 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002091 if (activityContainer != null) {
2092 reply.writeInt(1);
2093 reply.writeStrongBinder(activityContainer.asBinder());
2094 } else {
2095 reply.writeInt(0);
2096 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002097 return true;
2098 }
2099
Craig Mautner4a1cb222013-12-04 16:14:06 -08002100 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2101 data.enforceInterface(IActivityManager.descriptor);
2102 IBinder homeActivityToken = getHomeActivityToken();
2103 reply.writeNoException();
2104 reply.writeStrongBinder(homeActivityToken);
2105 return true;
2106 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002107
2108 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2109 data.enforceInterface(IActivityManager.descriptor);
2110 final int taskId = data.readInt();
2111 startLockTaskMode(taskId);
2112 reply.writeNoException();
2113 return true;
2114 }
2115
2116 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2117 data.enforceInterface(IActivityManager.descriptor);
2118 IBinder token = data.readStrongBinder();
2119 startLockTaskMode(token);
2120 reply.writeNoException();
2121 return true;
2122 }
2123
2124 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2125 data.enforceInterface(IActivityManager.descriptor);
2126 stopLockTaskMode();
2127 reply.writeNoException();
2128 return true;
2129 }
2130
2131 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2132 data.enforceInterface(IActivityManager.descriptor);
2133 final boolean isInLockTaskMode = isInLockTaskMode();
2134 reply.writeNoException();
2135 reply.writeInt(isInLockTaskMode ? 1 : 0);
2136 return true;
2137 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002138
Winson Chung03a9bae2014-05-02 09:56:12 -07002139 case SET_RECENTS_ACTIVITY_VALUES_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002140 data.enforceInterface(IActivityManager.descriptor);
2141 IBinder token = data.readStrongBinder();
Winson Chung03a9bae2014-05-02 09:56:12 -07002142 ActivityManager.RecentsActivityValues values =
2143 ActivityManager.RecentsActivityValues.CREATOR.createFromParcel(data);
2144 setRecentsActivityValues(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002145 reply.writeNoException();
2146 return true;
2147 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002148 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002149
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002150 return super.onTransact(code, data, reply, flags);
2151 }
2152
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002153 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002154 return this;
2155 }
2156
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002157 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2158 protected IActivityManager create() {
2159 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002160 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002161 Log.v("ActivityManager", "default service binder = " + b);
2162 }
2163 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002164 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002165 Log.v("ActivityManager", "default service = " + am);
2166 }
2167 return am;
2168 }
2169 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002170}
2171
2172class ActivityManagerProxy implements IActivityManager
2173{
2174 public ActivityManagerProxy(IBinder remote)
2175 {
2176 mRemote = remote;
2177 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002178
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002179 public IBinder asBinder()
2180 {
2181 return mRemote;
2182 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002183
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002184 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002185 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2186 int startFlags, String profileFile,
2187 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002188 Parcel data = Parcel.obtain();
2189 Parcel reply = Parcel.obtain();
2190 data.writeInterfaceToken(IActivityManager.descriptor);
2191 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002192 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002193 intent.writeToParcel(data, 0);
2194 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002195 data.writeStrongBinder(resultTo);
2196 data.writeString(resultWho);
2197 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002198 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002199 data.writeString(profileFile);
2200 if (profileFd != null) {
2201 data.writeInt(1);
2202 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2203 } else {
2204 data.writeInt(0);
2205 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002206 if (options != null) {
2207 data.writeInt(1);
2208 options.writeToParcel(data, 0);
2209 } else {
2210 data.writeInt(0);
2211 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002212 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2213 reply.readException();
2214 int result = reply.readInt();
2215 reply.recycle();
2216 data.recycle();
2217 return result;
2218 }
Amith Yamasani82644082012-08-03 13:09:11 -07002219
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002220 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002221 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2222 int startFlags, String profileFile,
2223 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2224 Parcel data = Parcel.obtain();
2225 Parcel reply = Parcel.obtain();
2226 data.writeInterfaceToken(IActivityManager.descriptor);
2227 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002228 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002229 intent.writeToParcel(data, 0);
2230 data.writeString(resolvedType);
2231 data.writeStrongBinder(resultTo);
2232 data.writeString(resultWho);
2233 data.writeInt(requestCode);
2234 data.writeInt(startFlags);
2235 data.writeString(profileFile);
2236 if (profileFd != null) {
2237 data.writeInt(1);
2238 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2239 } else {
2240 data.writeInt(0);
2241 }
2242 if (options != null) {
2243 data.writeInt(1);
2244 options.writeToParcel(data, 0);
2245 } else {
2246 data.writeInt(0);
2247 }
2248 data.writeInt(userId);
2249 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2250 reply.readException();
2251 int result = reply.readInt();
2252 reply.recycle();
2253 data.recycle();
2254 return result;
2255 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002256 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2257 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002258 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002259 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002260 Parcel data = Parcel.obtain();
2261 Parcel reply = Parcel.obtain();
2262 data.writeInterfaceToken(IActivityManager.descriptor);
2263 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002264 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002265 intent.writeToParcel(data, 0);
2266 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002267 data.writeStrongBinder(resultTo);
2268 data.writeString(resultWho);
2269 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002270 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002271 data.writeString(profileFile);
2272 if (profileFd != null) {
2273 data.writeInt(1);
2274 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2275 } else {
2276 data.writeInt(0);
2277 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002278 if (options != null) {
2279 data.writeInt(1);
2280 options.writeToParcel(data, 0);
2281 } else {
2282 data.writeInt(0);
2283 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002284 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002285 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2286 reply.readException();
2287 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2288 reply.recycle();
2289 data.recycle();
2290 return result;
2291 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002292 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2293 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002294 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002295 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002296 Parcel data = Parcel.obtain();
2297 Parcel reply = Parcel.obtain();
2298 data.writeInterfaceToken(IActivityManager.descriptor);
2299 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002300 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002301 intent.writeToParcel(data, 0);
2302 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002303 data.writeStrongBinder(resultTo);
2304 data.writeString(resultWho);
2305 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002306 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002307 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002308 if (options != null) {
2309 data.writeInt(1);
2310 options.writeToParcel(data, 0);
2311 } else {
2312 data.writeInt(0);
2313 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002314 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002315 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2316 reply.readException();
2317 int result = reply.readInt();
2318 reply.recycle();
2319 data.recycle();
2320 return result;
2321 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002322 public int startActivityIntentSender(IApplicationThread caller,
2323 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002324 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002325 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002326 Parcel data = Parcel.obtain();
2327 Parcel reply = Parcel.obtain();
2328 data.writeInterfaceToken(IActivityManager.descriptor);
2329 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2330 intent.writeToParcel(data, 0);
2331 if (fillInIntent != null) {
2332 data.writeInt(1);
2333 fillInIntent.writeToParcel(data, 0);
2334 } else {
2335 data.writeInt(0);
2336 }
2337 data.writeString(resolvedType);
2338 data.writeStrongBinder(resultTo);
2339 data.writeString(resultWho);
2340 data.writeInt(requestCode);
2341 data.writeInt(flagsMask);
2342 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002343 if (options != null) {
2344 data.writeInt(1);
2345 options.writeToParcel(data, 0);
2346 } else {
2347 data.writeInt(0);
2348 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002349 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002350 reply.readException();
2351 int result = reply.readInt();
2352 reply.recycle();
2353 data.recycle();
2354 return result;
2355 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002356 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2357 Intent intent, String resolvedType, IVoiceInteractionSession session,
2358 IVoiceInteractor interactor, int startFlags, String profileFile,
2359 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2360 Parcel data = Parcel.obtain();
2361 Parcel reply = Parcel.obtain();
2362 data.writeInterfaceToken(IActivityManager.descriptor);
2363 data.writeString(callingPackage);
2364 data.writeInt(callingPid);
2365 data.writeInt(callingUid);
2366 intent.writeToParcel(data, 0);
2367 data.writeString(resolvedType);
2368 data.writeStrongBinder(session.asBinder());
2369 data.writeStrongBinder(interactor.asBinder());
2370 data.writeInt(startFlags);
2371 data.writeString(profileFile);
2372 if (profileFd != null) {
2373 data.writeInt(1);
2374 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2375 } else {
2376 data.writeInt(0);
2377 }
2378 if (options != null) {
2379 data.writeInt(1);
2380 options.writeToParcel(data, 0);
2381 } else {
2382 data.writeInt(0);
2383 }
2384 data.writeInt(userId);
2385 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2386 reply.readException();
2387 int result = reply.readInt();
2388 reply.recycle();
2389 data.recycle();
2390 return result;
2391 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002392 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002393 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002394 Parcel data = Parcel.obtain();
2395 Parcel reply = Parcel.obtain();
2396 data.writeInterfaceToken(IActivityManager.descriptor);
2397 data.writeStrongBinder(callingActivity);
2398 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002399 if (options != null) {
2400 data.writeInt(1);
2401 options.writeToParcel(data, 0);
2402 } else {
2403 data.writeInt(0);
2404 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002405 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2406 reply.readException();
2407 int result = reply.readInt();
2408 reply.recycle();
2409 data.recycle();
2410 return result != 0;
2411 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002412 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002413 throws RemoteException {
2414 Parcel data = Parcel.obtain();
2415 Parcel reply = Parcel.obtain();
2416 data.writeInterfaceToken(IActivityManager.descriptor);
2417 data.writeStrongBinder(token);
2418 data.writeInt(resultCode);
2419 if (resultData != null) {
2420 data.writeInt(1);
2421 resultData.writeToParcel(data, 0);
2422 } else {
2423 data.writeInt(0);
2424 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002425 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002426 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2427 reply.readException();
2428 boolean res = reply.readInt() != 0;
2429 data.recycle();
2430 reply.recycle();
2431 return res;
2432 }
2433 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2434 {
2435 Parcel data = Parcel.obtain();
2436 Parcel reply = Parcel.obtain();
2437 data.writeInterfaceToken(IActivityManager.descriptor);
2438 data.writeStrongBinder(token);
2439 data.writeString(resultWho);
2440 data.writeInt(requestCode);
2441 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2442 reply.readException();
2443 data.recycle();
2444 reply.recycle();
2445 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002446 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2447 Parcel data = Parcel.obtain();
2448 Parcel reply = Parcel.obtain();
2449 data.writeInterfaceToken(IActivityManager.descriptor);
2450 data.writeStrongBinder(token);
2451 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2452 reply.readException();
2453 boolean res = reply.readInt() != 0;
2454 data.recycle();
2455 reply.recycle();
2456 return res;
2457 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002458 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2459 Parcel data = Parcel.obtain();
2460 Parcel reply = Parcel.obtain();
2461 data.writeInterfaceToken(IActivityManager.descriptor);
2462 data.writeStrongBinder(token);
2463 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2464 reply.readException();
2465 boolean res = reply.readInt() != 0;
2466 data.recycle();
2467 reply.recycle();
2468 return res;
2469 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002470 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002471 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002472 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002473 {
2474 Parcel data = Parcel.obtain();
2475 Parcel reply = Parcel.obtain();
2476 data.writeInterfaceToken(IActivityManager.descriptor);
2477 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002478 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002479 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2480 filter.writeToParcel(data, 0);
2481 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002482 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002483 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2484 reply.readException();
2485 Intent intent = null;
2486 int haveIntent = reply.readInt();
2487 if (haveIntent != 0) {
2488 intent = Intent.CREATOR.createFromParcel(reply);
2489 }
2490 reply.recycle();
2491 data.recycle();
2492 return intent;
2493 }
2494 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2495 {
2496 Parcel data = Parcel.obtain();
2497 Parcel reply = Parcel.obtain();
2498 data.writeInterfaceToken(IActivityManager.descriptor);
2499 data.writeStrongBinder(receiver.asBinder());
2500 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2501 reply.readException();
2502 data.recycle();
2503 reply.recycle();
2504 }
2505 public int broadcastIntent(IApplicationThread caller,
2506 Intent intent, String resolvedType, IIntentReceiver resultTo,
2507 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002508 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002509 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002510 {
2511 Parcel data = Parcel.obtain();
2512 Parcel reply = Parcel.obtain();
2513 data.writeInterfaceToken(IActivityManager.descriptor);
2514 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2515 intent.writeToParcel(data, 0);
2516 data.writeString(resolvedType);
2517 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2518 data.writeInt(resultCode);
2519 data.writeString(resultData);
2520 data.writeBundle(map);
2521 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002522 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002523 data.writeInt(serialized ? 1 : 0);
2524 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002525 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002526 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2527 reply.readException();
2528 int res = reply.readInt();
2529 reply.recycle();
2530 data.recycle();
2531 return res;
2532 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002533 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2534 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002535 {
2536 Parcel data = Parcel.obtain();
2537 Parcel reply = Parcel.obtain();
2538 data.writeInterfaceToken(IActivityManager.descriptor);
2539 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2540 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002541 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002542 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2543 reply.readException();
2544 data.recycle();
2545 reply.recycle();
2546 }
2547 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2548 {
2549 Parcel data = Parcel.obtain();
2550 Parcel reply = Parcel.obtain();
2551 data.writeInterfaceToken(IActivityManager.descriptor);
2552 data.writeStrongBinder(who);
2553 data.writeInt(resultCode);
2554 data.writeString(resultData);
2555 data.writeBundle(map);
2556 data.writeInt(abortBroadcast ? 1 : 0);
2557 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2558 reply.readException();
2559 data.recycle();
2560 reply.recycle();
2561 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002562 public void attachApplication(IApplicationThread app) throws RemoteException
2563 {
2564 Parcel data = Parcel.obtain();
2565 Parcel reply = Parcel.obtain();
2566 data.writeInterfaceToken(IActivityManager.descriptor);
2567 data.writeStrongBinder(app.asBinder());
2568 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2569 reply.readException();
2570 data.recycle();
2571 reply.recycle();
2572 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002573 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2574 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002575 {
2576 Parcel data = Parcel.obtain();
2577 Parcel reply = Parcel.obtain();
2578 data.writeInterfaceToken(IActivityManager.descriptor);
2579 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002580 if (config != null) {
2581 data.writeInt(1);
2582 config.writeToParcel(data, 0);
2583 } else {
2584 data.writeInt(0);
2585 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002586 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002587 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2588 reply.readException();
2589 data.recycle();
2590 reply.recycle();
2591 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002592 public void activityResumed(IBinder token) throws RemoteException
2593 {
2594 Parcel data = Parcel.obtain();
2595 Parcel reply = Parcel.obtain();
2596 data.writeInterfaceToken(IActivityManager.descriptor);
2597 data.writeStrongBinder(token);
2598 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2599 reply.readException();
2600 data.recycle();
2601 reply.recycle();
2602 }
Craig Mautnera0026042014-04-23 11:45:37 -07002603 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002604 {
2605 Parcel data = Parcel.obtain();
2606 Parcel reply = Parcel.obtain();
2607 data.writeInterfaceToken(IActivityManager.descriptor);
2608 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002609 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002610 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2611 reply.readException();
2612 data.recycle();
2613 reply.recycle();
2614 }
2615 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002616 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002617 {
2618 Parcel data = Parcel.obtain();
2619 Parcel reply = Parcel.obtain();
2620 data.writeInterfaceToken(IActivityManager.descriptor);
2621 data.writeStrongBinder(token);
2622 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002623 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002624 TextUtils.writeToParcel(description, data, 0);
2625 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2626 reply.readException();
2627 data.recycle();
2628 reply.recycle();
2629 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002630 public void activitySlept(IBinder token) throws RemoteException
2631 {
2632 Parcel data = Parcel.obtain();
2633 Parcel reply = Parcel.obtain();
2634 data.writeInterfaceToken(IActivityManager.descriptor);
2635 data.writeStrongBinder(token);
2636 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2637 reply.readException();
2638 data.recycle();
2639 reply.recycle();
2640 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002641 public void activityDestroyed(IBinder token) throws RemoteException
2642 {
2643 Parcel data = Parcel.obtain();
2644 Parcel reply = Parcel.obtain();
2645 data.writeInterfaceToken(IActivityManager.descriptor);
2646 data.writeStrongBinder(token);
2647 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2648 reply.readException();
2649 data.recycle();
2650 reply.recycle();
2651 }
2652 public String getCallingPackage(IBinder token) throws RemoteException
2653 {
2654 Parcel data = Parcel.obtain();
2655 Parcel reply = Parcel.obtain();
2656 data.writeInterfaceToken(IActivityManager.descriptor);
2657 data.writeStrongBinder(token);
2658 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2659 reply.readException();
2660 String res = reply.readString();
2661 data.recycle();
2662 reply.recycle();
2663 return res;
2664 }
2665 public ComponentName getCallingActivity(IBinder token)
2666 throws RemoteException {
2667 Parcel data = Parcel.obtain();
2668 Parcel reply = Parcel.obtain();
2669 data.writeInterfaceToken(IActivityManager.descriptor);
2670 data.writeStrongBinder(token);
2671 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2672 reply.readException();
2673 ComponentName res = ComponentName.readFromParcel(reply);
2674 data.recycle();
2675 reply.recycle();
2676 return res;
2677 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002678 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002679 Parcel data = Parcel.obtain();
2680 Parcel reply = Parcel.obtain();
2681 data.writeInterfaceToken(IActivityManager.descriptor);
2682 data.writeInt(maxNum);
2683 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002684 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2685 reply.readException();
2686 ArrayList list = null;
2687 int N = reply.readInt();
2688 if (N >= 0) {
2689 list = new ArrayList();
2690 while (N > 0) {
2691 ActivityManager.RunningTaskInfo info =
2692 ActivityManager.RunningTaskInfo.CREATOR
2693 .createFromParcel(reply);
2694 list.add(info);
2695 N--;
2696 }
2697 }
2698 data.recycle();
2699 reply.recycle();
2700 return list;
2701 }
2702 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002703 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002704 Parcel data = Parcel.obtain();
2705 Parcel reply = Parcel.obtain();
2706 data.writeInterfaceToken(IActivityManager.descriptor);
2707 data.writeInt(maxNum);
2708 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002709 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002710 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2711 reply.readException();
2712 ArrayList<ActivityManager.RecentTaskInfo> list
2713 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2714 data.recycle();
2715 reply.recycle();
2716 return list;
2717 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002718 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002719 Parcel data = Parcel.obtain();
2720 Parcel reply = Parcel.obtain();
2721 data.writeInterfaceToken(IActivityManager.descriptor);
2722 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002723 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002724 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002725 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002726 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002727 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002728 }
2729 data.recycle();
2730 reply.recycle();
2731 return bm;
2732 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002733 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2734 Parcel data = Parcel.obtain();
2735 Parcel reply = Parcel.obtain();
2736 data.writeInterfaceToken(IActivityManager.descriptor);
2737 data.writeInt(id);
2738 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2739 reply.readException();
2740 Bitmap bm = null;
2741 if (reply.readInt() != 0) {
2742 bm = Bitmap.CREATOR.createFromParcel(reply);
2743 }
2744 data.recycle();
2745 reply.recycle();
2746 return bm;
2747 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002748 public List getServices(int maxNum, int flags) throws RemoteException {
2749 Parcel data = Parcel.obtain();
2750 Parcel reply = Parcel.obtain();
2751 data.writeInterfaceToken(IActivityManager.descriptor);
2752 data.writeInt(maxNum);
2753 data.writeInt(flags);
2754 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2755 reply.readException();
2756 ArrayList list = null;
2757 int N = reply.readInt();
2758 if (N >= 0) {
2759 list = new ArrayList();
2760 while (N > 0) {
2761 ActivityManager.RunningServiceInfo info =
2762 ActivityManager.RunningServiceInfo.CREATOR
2763 .createFromParcel(reply);
2764 list.add(info);
2765 N--;
2766 }
2767 }
2768 data.recycle();
2769 reply.recycle();
2770 return list;
2771 }
2772 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2773 throws RemoteException {
2774 Parcel data = Parcel.obtain();
2775 Parcel reply = Parcel.obtain();
2776 data.writeInterfaceToken(IActivityManager.descriptor);
2777 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2778 reply.readException();
2779 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2780 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2781 data.recycle();
2782 reply.recycle();
2783 return list;
2784 }
2785 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2786 throws RemoteException {
2787 Parcel data = Parcel.obtain();
2788 Parcel reply = Parcel.obtain();
2789 data.writeInterfaceToken(IActivityManager.descriptor);
2790 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2791 reply.readException();
2792 ArrayList<ActivityManager.RunningAppProcessInfo> list
2793 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2794 data.recycle();
2795 reply.recycle();
2796 return list;
2797 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002798 public List<ApplicationInfo> getRunningExternalApplications()
2799 throws RemoteException {
2800 Parcel data = Parcel.obtain();
2801 Parcel reply = Parcel.obtain();
2802 data.writeInterfaceToken(IActivityManager.descriptor);
2803 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2804 reply.readException();
2805 ArrayList<ApplicationInfo> list
2806 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2807 data.recycle();
2808 reply.recycle();
2809 return list;
2810 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002811 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002812 {
2813 Parcel data = Parcel.obtain();
2814 Parcel reply = Parcel.obtain();
2815 data.writeInterfaceToken(IActivityManager.descriptor);
2816 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002817 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002818 if (options != null) {
2819 data.writeInt(1);
2820 options.writeToParcel(data, 0);
2821 } else {
2822 data.writeInt(0);
2823 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002824 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2825 reply.readException();
2826 data.recycle();
2827 reply.recycle();
2828 }
2829 public void moveTaskToBack(int task) throws RemoteException
2830 {
2831 Parcel data = Parcel.obtain();
2832 Parcel reply = Parcel.obtain();
2833 data.writeInterfaceToken(IActivityManager.descriptor);
2834 data.writeInt(task);
2835 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2836 reply.readException();
2837 data.recycle();
2838 reply.recycle();
2839 }
2840 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2841 throws RemoteException {
2842 Parcel data = Parcel.obtain();
2843 Parcel reply = Parcel.obtain();
2844 data.writeInterfaceToken(IActivityManager.descriptor);
2845 data.writeStrongBinder(token);
2846 data.writeInt(nonRoot ? 1 : 0);
2847 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2848 reply.readException();
2849 boolean res = reply.readInt() != 0;
2850 data.recycle();
2851 reply.recycle();
2852 return res;
2853 }
2854 public void moveTaskBackwards(int task) throws RemoteException
2855 {
2856 Parcel data = Parcel.obtain();
2857 Parcel reply = Parcel.obtain();
2858 data.writeInterfaceToken(IActivityManager.descriptor);
2859 data.writeInt(task);
2860 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2861 reply.readException();
2862 data.recycle();
2863 reply.recycle();
2864 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002865 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002866 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2867 {
2868 Parcel data = Parcel.obtain();
2869 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002870 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002871 data.writeInt(taskId);
2872 data.writeInt(stackId);
2873 data.writeInt(toTop ? 1 : 0);
2874 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2875 reply.readException();
2876 data.recycle();
2877 reply.recycle();
2878 }
2879 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002880 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002881 {
2882 Parcel data = Parcel.obtain();
2883 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002884 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002885 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002886 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002887 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002888 reply.readException();
2889 data.recycle();
2890 reply.recycle();
2891 }
Craig Mautner967212c2013-04-13 21:10:58 -07002892 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002893 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002894 {
2895 Parcel data = Parcel.obtain();
2896 Parcel reply = Parcel.obtain();
2897 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002898 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002899 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002900 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002901 data.recycle();
2902 reply.recycle();
2903 return list;
2904 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002905 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002906 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002907 {
2908 Parcel data = Parcel.obtain();
2909 Parcel reply = Parcel.obtain();
2910 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002911 data.writeInt(stackId);
2912 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002913 reply.readException();
2914 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002915 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002916 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002917 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002918 }
2919 data.recycle();
2920 reply.recycle();
2921 return info;
2922 }
2923 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08002924 public boolean isInHomeStack(int taskId) throws RemoteException {
2925 Parcel data = Parcel.obtain();
2926 Parcel reply = Parcel.obtain();
2927 data.writeInterfaceToken(IActivityManager.descriptor);
2928 data.writeInt(taskId);
2929 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
2930 reply.readException();
2931 boolean isInHomeStack = reply.readInt() > 0;
2932 data.recycle();
2933 reply.recycle();
2934 return isInHomeStack;
2935 }
2936 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002937 public void setFocusedStack(int stackId) throws RemoteException
2938 {
2939 Parcel data = Parcel.obtain();
2940 Parcel reply = Parcel.obtain();
2941 data.writeInterfaceToken(IActivityManager.descriptor);
2942 data.writeInt(stackId);
2943 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2944 reply.readException();
2945 data.recycle();
2946 reply.recycle();
2947 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002948 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2949 {
2950 Parcel data = Parcel.obtain();
2951 Parcel reply = Parcel.obtain();
2952 data.writeInterfaceToken(IActivityManager.descriptor);
2953 data.writeStrongBinder(token);
2954 data.writeInt(onlyRoot ? 1 : 0);
2955 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2956 reply.readException();
2957 int res = reply.readInt();
2958 data.recycle();
2959 reply.recycle();
2960 return res;
2961 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002962 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002963 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002964 Parcel data = Parcel.obtain();
2965 Parcel reply = Parcel.obtain();
2966 data.writeInterfaceToken(IActivityManager.descriptor);
2967 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2968 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002969 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002970 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002971 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2972 reply.readException();
2973 int res = reply.readInt();
2974 ContentProviderHolder cph = null;
2975 if (res != 0) {
2976 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2977 }
2978 data.recycle();
2979 reply.recycle();
2980 return cph;
2981 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002982 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2983 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002984 Parcel data = Parcel.obtain();
2985 Parcel reply = Parcel.obtain();
2986 data.writeInterfaceToken(IActivityManager.descriptor);
2987 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002988 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002989 data.writeStrongBinder(token);
2990 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2991 reply.readException();
2992 int res = reply.readInt();
2993 ContentProviderHolder cph = null;
2994 if (res != 0) {
2995 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2996 }
2997 data.recycle();
2998 reply.recycle();
2999 return cph;
3000 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003001 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003002 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003003 {
3004 Parcel data = Parcel.obtain();
3005 Parcel reply = Parcel.obtain();
3006 data.writeInterfaceToken(IActivityManager.descriptor);
3007 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3008 data.writeTypedList(providers);
3009 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3010 reply.readException();
3011 data.recycle();
3012 reply.recycle();
3013 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003014 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3015 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003016 Parcel data = Parcel.obtain();
3017 Parcel reply = Parcel.obtain();
3018 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003019 data.writeStrongBinder(connection);
3020 data.writeInt(stable);
3021 data.writeInt(unstable);
3022 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3023 reply.readException();
3024 boolean res = reply.readInt() != 0;
3025 data.recycle();
3026 reply.recycle();
3027 return res;
3028 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003029
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003030 public void unstableProviderDied(IBinder connection) throws RemoteException {
3031 Parcel data = Parcel.obtain();
3032 Parcel reply = Parcel.obtain();
3033 data.writeInterfaceToken(IActivityManager.descriptor);
3034 data.writeStrongBinder(connection);
3035 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3036 reply.readException();
3037 data.recycle();
3038 reply.recycle();
3039 }
3040
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003041 @Override
3042 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3043 Parcel data = Parcel.obtain();
3044 Parcel reply = Parcel.obtain();
3045 data.writeInterfaceToken(IActivityManager.descriptor);
3046 data.writeStrongBinder(connection);
3047 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3048 reply.readException();
3049 data.recycle();
3050 reply.recycle();
3051 }
3052
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003053 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3054 Parcel data = Parcel.obtain();
3055 Parcel reply = Parcel.obtain();
3056 data.writeInterfaceToken(IActivityManager.descriptor);
3057 data.writeStrongBinder(connection);
3058 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003059 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3060 reply.readException();
3061 data.recycle();
3062 reply.recycle();
3063 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003064
3065 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3066 Parcel data = Parcel.obtain();
3067 Parcel reply = Parcel.obtain();
3068 data.writeInterfaceToken(IActivityManager.descriptor);
3069 data.writeString(name);
3070 data.writeStrongBinder(token);
3071 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3072 reply.readException();
3073 data.recycle();
3074 reply.recycle();
3075 }
3076
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003077 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3078 throws RemoteException
3079 {
3080 Parcel data = Parcel.obtain();
3081 Parcel reply = Parcel.obtain();
3082 data.writeInterfaceToken(IActivityManager.descriptor);
3083 service.writeToParcel(data, 0);
3084 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3085 reply.readException();
3086 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3087 data.recycle();
3088 reply.recycle();
3089 return res;
3090 }
3091
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003092 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003093 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003094 {
3095 Parcel data = Parcel.obtain();
3096 Parcel reply = Parcel.obtain();
3097 data.writeInterfaceToken(IActivityManager.descriptor);
3098 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3099 service.writeToParcel(data, 0);
3100 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003101 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003102 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3103 reply.readException();
3104 ComponentName res = ComponentName.readFromParcel(reply);
3105 data.recycle();
3106 reply.recycle();
3107 return res;
3108 }
3109 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003110 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003111 {
3112 Parcel data = Parcel.obtain();
3113 Parcel reply = Parcel.obtain();
3114 data.writeInterfaceToken(IActivityManager.descriptor);
3115 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3116 service.writeToParcel(data, 0);
3117 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003118 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003119 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3120 reply.readException();
3121 int res = reply.readInt();
3122 reply.recycle();
3123 data.recycle();
3124 return res;
3125 }
3126 public boolean stopServiceToken(ComponentName className, IBinder token,
3127 int startId) throws RemoteException {
3128 Parcel data = Parcel.obtain();
3129 Parcel reply = Parcel.obtain();
3130 data.writeInterfaceToken(IActivityManager.descriptor);
3131 ComponentName.writeToParcel(className, data);
3132 data.writeStrongBinder(token);
3133 data.writeInt(startId);
3134 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3135 reply.readException();
3136 boolean res = reply.readInt() != 0;
3137 data.recycle();
3138 reply.recycle();
3139 return res;
3140 }
3141 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003142 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003143 Parcel data = Parcel.obtain();
3144 Parcel reply = Parcel.obtain();
3145 data.writeInterfaceToken(IActivityManager.descriptor);
3146 ComponentName.writeToParcel(className, data);
3147 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003148 data.writeInt(id);
3149 if (notification != null) {
3150 data.writeInt(1);
3151 notification.writeToParcel(data, 0);
3152 } else {
3153 data.writeInt(0);
3154 }
3155 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003156 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3157 reply.readException();
3158 data.recycle();
3159 reply.recycle();
3160 }
3161 public int bindService(IApplicationThread caller, IBinder token,
3162 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003163 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003164 Parcel data = Parcel.obtain();
3165 Parcel reply = Parcel.obtain();
3166 data.writeInterfaceToken(IActivityManager.descriptor);
3167 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3168 data.writeStrongBinder(token);
3169 service.writeToParcel(data, 0);
3170 data.writeString(resolvedType);
3171 data.writeStrongBinder(connection.asBinder());
3172 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003173 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003174 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3175 reply.readException();
3176 int res = reply.readInt();
3177 data.recycle();
3178 reply.recycle();
3179 return res;
3180 }
3181 public boolean unbindService(IServiceConnection connection) throws RemoteException
3182 {
3183 Parcel data = Parcel.obtain();
3184 Parcel reply = Parcel.obtain();
3185 data.writeInterfaceToken(IActivityManager.descriptor);
3186 data.writeStrongBinder(connection.asBinder());
3187 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3188 reply.readException();
3189 boolean res = reply.readInt() != 0;
3190 data.recycle();
3191 reply.recycle();
3192 return res;
3193 }
3194
3195 public void publishService(IBinder token,
3196 Intent intent, IBinder service) throws RemoteException {
3197 Parcel data = Parcel.obtain();
3198 Parcel reply = Parcel.obtain();
3199 data.writeInterfaceToken(IActivityManager.descriptor);
3200 data.writeStrongBinder(token);
3201 intent.writeToParcel(data, 0);
3202 data.writeStrongBinder(service);
3203 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3204 reply.readException();
3205 data.recycle();
3206 reply.recycle();
3207 }
3208
3209 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3210 throws RemoteException {
3211 Parcel data = Parcel.obtain();
3212 Parcel reply = Parcel.obtain();
3213 data.writeInterfaceToken(IActivityManager.descriptor);
3214 data.writeStrongBinder(token);
3215 intent.writeToParcel(data, 0);
3216 data.writeInt(doRebind ? 1 : 0);
3217 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3218 reply.readException();
3219 data.recycle();
3220 reply.recycle();
3221 }
3222
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003223 public void serviceDoneExecuting(IBinder token, int type, int startId,
3224 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003225 Parcel data = Parcel.obtain();
3226 Parcel reply = Parcel.obtain();
3227 data.writeInterfaceToken(IActivityManager.descriptor);
3228 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003229 data.writeInt(type);
3230 data.writeInt(startId);
3231 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003232 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3233 reply.readException();
3234 data.recycle();
3235 reply.recycle();
3236 }
3237
3238 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3239 Parcel data = Parcel.obtain();
3240 Parcel reply = Parcel.obtain();
3241 data.writeInterfaceToken(IActivityManager.descriptor);
3242 service.writeToParcel(data, 0);
3243 data.writeString(resolvedType);
3244 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3245 reply.readException();
3246 IBinder binder = reply.readStrongBinder();
3247 reply.recycle();
3248 data.recycle();
3249 return binder;
3250 }
3251
Christopher Tate181fafa2009-05-14 11:12:14 -07003252 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3253 throws RemoteException {
3254 Parcel data = Parcel.obtain();
3255 Parcel reply = Parcel.obtain();
3256 data.writeInterfaceToken(IActivityManager.descriptor);
3257 app.writeToParcel(data, 0);
3258 data.writeInt(backupRestoreMode);
3259 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3260 reply.readException();
3261 boolean success = reply.readInt() != 0;
3262 reply.recycle();
3263 data.recycle();
3264 return success;
3265 }
3266
Christopher Tate346acb12012-10-15 19:20:25 -07003267 public void clearPendingBackup() throws RemoteException {
3268 Parcel data = Parcel.obtain();
3269 Parcel reply = Parcel.obtain();
3270 data.writeInterfaceToken(IActivityManager.descriptor);
3271 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3272 reply.recycle();
3273 data.recycle();
3274 }
3275
Christopher Tate181fafa2009-05-14 11:12:14 -07003276 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3277 Parcel data = Parcel.obtain();
3278 Parcel reply = Parcel.obtain();
3279 data.writeInterfaceToken(IActivityManager.descriptor);
3280 data.writeString(packageName);
3281 data.writeStrongBinder(agent);
3282 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3283 reply.recycle();
3284 data.recycle();
3285 }
3286
3287 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3288 Parcel data = Parcel.obtain();
3289 Parcel reply = Parcel.obtain();
3290 data.writeInterfaceToken(IActivityManager.descriptor);
3291 app.writeToParcel(data, 0);
3292 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3293 reply.readException();
3294 reply.recycle();
3295 data.recycle();
3296 }
3297
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003298 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003299 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3300 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003301 Parcel data = Parcel.obtain();
3302 Parcel reply = Parcel.obtain();
3303 data.writeInterfaceToken(IActivityManager.descriptor);
3304 ComponentName.writeToParcel(className, data);
3305 data.writeString(profileFile);
3306 data.writeInt(flags);
3307 data.writeBundle(arguments);
3308 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003309 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003310 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003311 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3312 reply.readException();
3313 boolean res = reply.readInt() != 0;
3314 reply.recycle();
3315 data.recycle();
3316 return res;
3317 }
3318
3319 public void finishInstrumentation(IApplicationThread target,
3320 int resultCode, Bundle results) throws RemoteException {
3321 Parcel data = Parcel.obtain();
3322 Parcel reply = Parcel.obtain();
3323 data.writeInterfaceToken(IActivityManager.descriptor);
3324 data.writeStrongBinder(target != null ? target.asBinder() : null);
3325 data.writeInt(resultCode);
3326 data.writeBundle(results);
3327 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3328 reply.readException();
3329 data.recycle();
3330 reply.recycle();
3331 }
3332 public Configuration getConfiguration() throws RemoteException
3333 {
3334 Parcel data = Parcel.obtain();
3335 Parcel reply = Parcel.obtain();
3336 data.writeInterfaceToken(IActivityManager.descriptor);
3337 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3338 reply.readException();
3339 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3340 reply.recycle();
3341 data.recycle();
3342 return res;
3343 }
3344 public void updateConfiguration(Configuration values) throws RemoteException
3345 {
3346 Parcel data = Parcel.obtain();
3347 Parcel reply = Parcel.obtain();
3348 data.writeInterfaceToken(IActivityManager.descriptor);
3349 values.writeToParcel(data, 0);
3350 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3351 reply.readException();
3352 data.recycle();
3353 reply.recycle();
3354 }
3355 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3356 throws RemoteException {
3357 Parcel data = Parcel.obtain();
3358 Parcel reply = Parcel.obtain();
3359 data.writeInterfaceToken(IActivityManager.descriptor);
3360 data.writeStrongBinder(token);
3361 data.writeInt(requestedOrientation);
3362 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3363 reply.readException();
3364 data.recycle();
3365 reply.recycle();
3366 }
3367 public int getRequestedOrientation(IBinder token) throws RemoteException {
3368 Parcel data = Parcel.obtain();
3369 Parcel reply = Parcel.obtain();
3370 data.writeInterfaceToken(IActivityManager.descriptor);
3371 data.writeStrongBinder(token);
3372 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3373 reply.readException();
3374 int res = reply.readInt();
3375 data.recycle();
3376 reply.recycle();
3377 return res;
3378 }
3379 public ComponentName getActivityClassForToken(IBinder token)
3380 throws RemoteException {
3381 Parcel data = Parcel.obtain();
3382 Parcel reply = Parcel.obtain();
3383 data.writeInterfaceToken(IActivityManager.descriptor);
3384 data.writeStrongBinder(token);
3385 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3386 reply.readException();
3387 ComponentName res = ComponentName.readFromParcel(reply);
3388 data.recycle();
3389 reply.recycle();
3390 return res;
3391 }
3392 public String getPackageForToken(IBinder token) throws RemoteException
3393 {
3394 Parcel data = Parcel.obtain();
3395 Parcel reply = Parcel.obtain();
3396 data.writeInterfaceToken(IActivityManager.descriptor);
3397 data.writeStrongBinder(token);
3398 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3399 reply.readException();
3400 String res = reply.readString();
3401 data.recycle();
3402 reply.recycle();
3403 return res;
3404 }
3405 public IIntentSender getIntentSender(int type,
3406 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003407 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003408 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003409 Parcel data = Parcel.obtain();
3410 Parcel reply = Parcel.obtain();
3411 data.writeInterfaceToken(IActivityManager.descriptor);
3412 data.writeInt(type);
3413 data.writeString(packageName);
3414 data.writeStrongBinder(token);
3415 data.writeString(resultWho);
3416 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003417 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003418 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003419 data.writeTypedArray(intents, 0);
3420 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003421 } else {
3422 data.writeInt(0);
3423 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003424 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003425 if (options != null) {
3426 data.writeInt(1);
3427 options.writeToParcel(data, 0);
3428 } else {
3429 data.writeInt(0);
3430 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003431 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003432 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3433 reply.readException();
3434 IIntentSender res = IIntentSender.Stub.asInterface(
3435 reply.readStrongBinder());
3436 data.recycle();
3437 reply.recycle();
3438 return res;
3439 }
3440 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3441 Parcel data = Parcel.obtain();
3442 Parcel reply = Parcel.obtain();
3443 data.writeInterfaceToken(IActivityManager.descriptor);
3444 data.writeStrongBinder(sender.asBinder());
3445 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3446 reply.readException();
3447 data.recycle();
3448 reply.recycle();
3449 }
3450 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3451 Parcel data = Parcel.obtain();
3452 Parcel reply = Parcel.obtain();
3453 data.writeInterfaceToken(IActivityManager.descriptor);
3454 data.writeStrongBinder(sender.asBinder());
3455 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3456 reply.readException();
3457 String res = reply.readString();
3458 data.recycle();
3459 reply.recycle();
3460 return res;
3461 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003462 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3463 Parcel data = Parcel.obtain();
3464 Parcel reply = Parcel.obtain();
3465 data.writeInterfaceToken(IActivityManager.descriptor);
3466 data.writeStrongBinder(sender.asBinder());
3467 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3468 reply.readException();
3469 int res = reply.readInt();
3470 data.recycle();
3471 reply.recycle();
3472 return res;
3473 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003474 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3475 boolean requireFull, String name, String callerPackage) throws RemoteException {
3476 Parcel data = Parcel.obtain();
3477 Parcel reply = Parcel.obtain();
3478 data.writeInterfaceToken(IActivityManager.descriptor);
3479 data.writeInt(callingPid);
3480 data.writeInt(callingUid);
3481 data.writeInt(userId);
3482 data.writeInt(allowAll ? 1 : 0);
3483 data.writeInt(requireFull ? 1 : 0);
3484 data.writeString(name);
3485 data.writeString(callerPackage);
3486 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3487 reply.readException();
3488 int res = reply.readInt();
3489 data.recycle();
3490 reply.recycle();
3491 return res;
3492 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003493 public void setProcessLimit(int max) throws RemoteException
3494 {
3495 Parcel data = Parcel.obtain();
3496 Parcel reply = Parcel.obtain();
3497 data.writeInterfaceToken(IActivityManager.descriptor);
3498 data.writeInt(max);
3499 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3500 reply.readException();
3501 data.recycle();
3502 reply.recycle();
3503 }
3504 public int getProcessLimit() throws RemoteException
3505 {
3506 Parcel data = Parcel.obtain();
3507 Parcel reply = Parcel.obtain();
3508 data.writeInterfaceToken(IActivityManager.descriptor);
3509 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3510 reply.readException();
3511 int res = reply.readInt();
3512 data.recycle();
3513 reply.recycle();
3514 return res;
3515 }
3516 public void setProcessForeground(IBinder token, int pid,
3517 boolean isForeground) throws RemoteException {
3518 Parcel data = Parcel.obtain();
3519 Parcel reply = Parcel.obtain();
3520 data.writeInterfaceToken(IActivityManager.descriptor);
3521 data.writeStrongBinder(token);
3522 data.writeInt(pid);
3523 data.writeInt(isForeground ? 1 : 0);
3524 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3525 reply.readException();
3526 data.recycle();
3527 reply.recycle();
3528 }
3529 public int checkPermission(String permission, int pid, int uid)
3530 throws RemoteException {
3531 Parcel data = Parcel.obtain();
3532 Parcel reply = Parcel.obtain();
3533 data.writeInterfaceToken(IActivityManager.descriptor);
3534 data.writeString(permission);
3535 data.writeInt(pid);
3536 data.writeInt(uid);
3537 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3538 reply.readException();
3539 int res = reply.readInt();
3540 data.recycle();
3541 reply.recycle();
3542 return res;
3543 }
3544 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003545 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003546 Parcel data = Parcel.obtain();
3547 Parcel reply = Parcel.obtain();
3548 data.writeInterfaceToken(IActivityManager.descriptor);
3549 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003550 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003551 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003552 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3553 reply.readException();
3554 boolean res = reply.readInt() != 0;
3555 data.recycle();
3556 reply.recycle();
3557 return res;
3558 }
3559 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3560 throws RemoteException {
3561 Parcel data = Parcel.obtain();
3562 Parcel reply = Parcel.obtain();
3563 data.writeInterfaceToken(IActivityManager.descriptor);
3564 uri.writeToParcel(data, 0);
3565 data.writeInt(pid);
3566 data.writeInt(uid);
3567 data.writeInt(mode);
3568 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3569 reply.readException();
3570 int res = reply.readInt();
3571 data.recycle();
3572 reply.recycle();
3573 return res;
3574 }
3575 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3576 Uri uri, int mode) throws RemoteException {
3577 Parcel data = Parcel.obtain();
3578 Parcel reply = Parcel.obtain();
3579 data.writeInterfaceToken(IActivityManager.descriptor);
3580 data.writeStrongBinder(caller.asBinder());
3581 data.writeString(targetPkg);
3582 uri.writeToParcel(data, 0);
3583 data.writeInt(mode);
3584 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3585 reply.readException();
3586 data.recycle();
3587 reply.recycle();
3588 }
3589 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3590 int mode) throws RemoteException {
3591 Parcel data = Parcel.obtain();
3592 Parcel reply = Parcel.obtain();
3593 data.writeInterfaceToken(IActivityManager.descriptor);
3594 data.writeStrongBinder(caller.asBinder());
3595 uri.writeToParcel(data, 0);
3596 data.writeInt(mode);
3597 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3598 reply.readException();
3599 data.recycle();
3600 reply.recycle();
3601 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003602
3603 @Override
3604 public void takePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3605 Parcel data = Parcel.obtain();
3606 Parcel reply = Parcel.obtain();
3607 data.writeInterfaceToken(IActivityManager.descriptor);
3608 uri.writeToParcel(data, 0);
3609 data.writeInt(mode);
3610 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3611 reply.readException();
3612 data.recycle();
3613 reply.recycle();
3614 }
3615
3616 @Override
3617 public void releasePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3618 Parcel data = Parcel.obtain();
3619 Parcel reply = Parcel.obtain();
3620 data.writeInterfaceToken(IActivityManager.descriptor);
3621 uri.writeToParcel(data, 0);
3622 data.writeInt(mode);
3623 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3624 reply.readException();
3625 data.recycle();
3626 reply.recycle();
3627 }
3628
3629 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003630 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3631 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003632 Parcel data = Parcel.obtain();
3633 Parcel reply = Parcel.obtain();
3634 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003635 data.writeString(packageName);
3636 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003637 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3638 reply.readException();
3639 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3640 reply);
3641 data.recycle();
3642 reply.recycle();
3643 return perms;
3644 }
3645
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003646 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3647 throws RemoteException {
3648 Parcel data = Parcel.obtain();
3649 Parcel reply = Parcel.obtain();
3650 data.writeInterfaceToken(IActivityManager.descriptor);
3651 data.writeStrongBinder(who.asBinder());
3652 data.writeInt(waiting ? 1 : 0);
3653 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3654 reply.readException();
3655 data.recycle();
3656 reply.recycle();
3657 }
3658 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3659 Parcel data = Parcel.obtain();
3660 Parcel reply = Parcel.obtain();
3661 data.writeInterfaceToken(IActivityManager.descriptor);
3662 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3663 reply.readException();
3664 outInfo.readFromParcel(reply);
3665 data.recycle();
3666 reply.recycle();
3667 }
3668 public void unhandledBack() throws RemoteException
3669 {
3670 Parcel data = Parcel.obtain();
3671 Parcel reply = Parcel.obtain();
3672 data.writeInterfaceToken(IActivityManager.descriptor);
3673 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3674 reply.readException();
3675 data.recycle();
3676 reply.recycle();
3677 }
3678 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3679 {
3680 Parcel data = Parcel.obtain();
3681 Parcel reply = Parcel.obtain();
3682 data.writeInterfaceToken(IActivityManager.descriptor);
3683 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3684 reply.readException();
3685 ParcelFileDescriptor pfd = null;
3686 if (reply.readInt() != 0) {
3687 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3688 }
3689 data.recycle();
3690 reply.recycle();
3691 return pfd;
3692 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003693 public void setLockScreenShown(boolean shown) throws RemoteException
3694 {
3695 Parcel data = Parcel.obtain();
3696 Parcel reply = Parcel.obtain();
3697 data.writeInterfaceToken(IActivityManager.descriptor);
3698 data.writeInt(shown ? 1 : 0);
3699 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3700 reply.readException();
3701 data.recycle();
3702 reply.recycle();
3703 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003704 public void setDebugApp(
3705 String packageName, boolean waitForDebugger, boolean persistent)
3706 throws RemoteException
3707 {
3708 Parcel data = Parcel.obtain();
3709 Parcel reply = Parcel.obtain();
3710 data.writeInterfaceToken(IActivityManager.descriptor);
3711 data.writeString(packageName);
3712 data.writeInt(waitForDebugger ? 1 : 0);
3713 data.writeInt(persistent ? 1 : 0);
3714 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3715 reply.readException();
3716 data.recycle();
3717 reply.recycle();
3718 }
3719 public void setAlwaysFinish(boolean enabled) throws RemoteException
3720 {
3721 Parcel data = Parcel.obtain();
3722 Parcel reply = Parcel.obtain();
3723 data.writeInterfaceToken(IActivityManager.descriptor);
3724 data.writeInt(enabled ? 1 : 0);
3725 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3726 reply.readException();
3727 data.recycle();
3728 reply.recycle();
3729 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003730 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003731 {
3732 Parcel data = Parcel.obtain();
3733 Parcel reply = Parcel.obtain();
3734 data.writeInterfaceToken(IActivityManager.descriptor);
3735 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003736 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003737 reply.readException();
3738 data.recycle();
3739 reply.recycle();
3740 }
3741 public void enterSafeMode() throws RemoteException {
3742 Parcel data = Parcel.obtain();
3743 data.writeInterfaceToken(IActivityManager.descriptor);
3744 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3745 data.recycle();
3746 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003747 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3748 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003749 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003750 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003751 data.writeStrongBinder(sender.asBinder());
3752 data.writeInt(sourceUid);
3753 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003754 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3755 data.recycle();
3756 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003757 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003758 Parcel data = Parcel.obtain();
3759 Parcel reply = Parcel.obtain();
3760 data.writeInterfaceToken(IActivityManager.descriptor);
3761 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003762 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003763 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003764 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003765 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003766 boolean res = reply.readInt() != 0;
3767 data.recycle();
3768 reply.recycle();
3769 return res;
3770 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003771 @Override
3772 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3773 Parcel data = Parcel.obtain();
3774 Parcel reply = Parcel.obtain();
3775 data.writeInterfaceToken(IActivityManager.descriptor);
3776 data.writeString(reason);
3777 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3778 boolean res = reply.readInt() != 0;
3779 data.recycle();
3780 reply.recycle();
3781 return res;
3782 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003783 public boolean testIsSystemReady()
3784 {
3785 /* this base class version is never called */
3786 return true;
3787 }
Dan Egnor60d87622009-12-16 16:32:58 -08003788 public void handleApplicationCrash(IBinder app,
3789 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3790 {
3791 Parcel data = Parcel.obtain();
3792 Parcel reply = Parcel.obtain();
3793 data.writeInterfaceToken(IActivityManager.descriptor);
3794 data.writeStrongBinder(app);
3795 crashInfo.writeToParcel(data, 0);
3796 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3797 reply.readException();
3798 reply.recycle();
3799 data.recycle();
3800 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003801
Dan Egnor60d87622009-12-16 16:32:58 -08003802 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003803 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003804 {
3805 Parcel data = Parcel.obtain();
3806 Parcel reply = Parcel.obtain();
3807 data.writeInterfaceToken(IActivityManager.descriptor);
3808 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003809 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003810 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003811 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003812 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003813 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003814 reply.recycle();
3815 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003816 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003817 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003818
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003819 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003820 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003821 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003822 {
3823 Parcel data = Parcel.obtain();
3824 Parcel reply = Parcel.obtain();
3825 data.writeInterfaceToken(IActivityManager.descriptor);
3826 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003827 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003828 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003829 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3830 reply.readException();
3831 reply.recycle();
3832 data.recycle();
3833 }
3834
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003835 public void signalPersistentProcesses(int sig) throws RemoteException {
3836 Parcel data = Parcel.obtain();
3837 Parcel reply = Parcel.obtain();
3838 data.writeInterfaceToken(IActivityManager.descriptor);
3839 data.writeInt(sig);
3840 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3841 reply.readException();
3842 data.recycle();
3843 reply.recycle();
3844 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003845
Dianne Hackborn1676c852012-09-10 14:52:30 -07003846 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003847 Parcel data = Parcel.obtain();
3848 Parcel reply = Parcel.obtain();
3849 data.writeInterfaceToken(IActivityManager.descriptor);
3850 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003851 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003852 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3853 reply.readException();
3854 data.recycle();
3855 reply.recycle();
3856 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003857
3858 public void killAllBackgroundProcesses() throws RemoteException {
3859 Parcel data = Parcel.obtain();
3860 Parcel reply = Parcel.obtain();
3861 data.writeInterfaceToken(IActivityManager.descriptor);
3862 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3863 reply.readException();
3864 data.recycle();
3865 reply.recycle();
3866 }
3867
Dianne Hackborn1676c852012-09-10 14:52:30 -07003868 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003869 Parcel data = Parcel.obtain();
3870 Parcel reply = Parcel.obtain();
3871 data.writeInterfaceToken(IActivityManager.descriptor);
3872 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003873 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003874 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003875 reply.readException();
3876 data.recycle();
3877 reply.recycle();
3878 }
3879
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003880 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3881 throws RemoteException
3882 {
3883 Parcel data = Parcel.obtain();
3884 Parcel reply = Parcel.obtain();
3885 data.writeInterfaceToken(IActivityManager.descriptor);
3886 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3887 reply.readException();
3888 outInfo.readFromParcel(reply);
3889 reply.recycle();
3890 data.recycle();
3891 }
3892
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003893 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3894 {
3895 Parcel data = Parcel.obtain();
3896 Parcel reply = Parcel.obtain();
3897 data.writeInterfaceToken(IActivityManager.descriptor);
3898 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3899 reply.readException();
3900 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3901 reply.recycle();
3902 data.recycle();
3903 return res;
3904 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003905
Dianne Hackborn1676c852012-09-10 14:52:30 -07003906 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003907 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003908 {
3909 Parcel data = Parcel.obtain();
3910 Parcel reply = Parcel.obtain();
3911 data.writeInterfaceToken(IActivityManager.descriptor);
3912 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003913 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003914 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003915 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003916 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003917 if (fd != null) {
3918 data.writeInt(1);
3919 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3920 } else {
3921 data.writeInt(0);
3922 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003923 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3924 reply.readException();
3925 boolean res = reply.readInt() != 0;
3926 reply.recycle();
3927 data.recycle();
3928 return res;
3929 }
3930
Dianne Hackborn55280a92009-05-07 15:53:46 -07003931 public boolean shutdown(int timeout) throws RemoteException
3932 {
3933 Parcel data = Parcel.obtain();
3934 Parcel reply = Parcel.obtain();
3935 data.writeInterfaceToken(IActivityManager.descriptor);
3936 data.writeInt(timeout);
3937 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3938 reply.readException();
3939 boolean res = reply.readInt() != 0;
3940 reply.recycle();
3941 data.recycle();
3942 return res;
3943 }
3944
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003945 public void stopAppSwitches() throws RemoteException {
3946 Parcel data = Parcel.obtain();
3947 Parcel reply = Parcel.obtain();
3948 data.writeInterfaceToken(IActivityManager.descriptor);
3949 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3950 reply.readException();
3951 reply.recycle();
3952 data.recycle();
3953 }
3954
3955 public void resumeAppSwitches() throws RemoteException {
3956 Parcel data = Parcel.obtain();
3957 Parcel reply = Parcel.obtain();
3958 data.writeInterfaceToken(IActivityManager.descriptor);
3959 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3960 reply.readException();
3961 reply.recycle();
3962 data.recycle();
3963 }
3964
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003965 public void killApplicationWithAppId(String pkg, int appid, String reason)
3966 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003967 Parcel data = Parcel.obtain();
3968 Parcel reply = Parcel.obtain();
3969 data.writeInterfaceToken(IActivityManager.descriptor);
3970 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003971 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003972 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003973 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003974 reply.readException();
3975 data.recycle();
3976 reply.recycle();
3977 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003978
3979 public void closeSystemDialogs(String reason) throws RemoteException {
3980 Parcel data = Parcel.obtain();
3981 Parcel reply = Parcel.obtain();
3982 data.writeInterfaceToken(IActivityManager.descriptor);
3983 data.writeString(reason);
3984 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3985 reply.readException();
3986 data.recycle();
3987 reply.recycle();
3988 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003989
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003990 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003991 throws RemoteException {
3992 Parcel data = Parcel.obtain();
3993 Parcel reply = Parcel.obtain();
3994 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003995 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003996 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3997 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003998 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003999 data.recycle();
4000 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004001 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004002 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004003
4004 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4005 Parcel data = Parcel.obtain();
4006 Parcel reply = Parcel.obtain();
4007 data.writeInterfaceToken(IActivityManager.descriptor);
4008 data.writeString(processName);
4009 data.writeInt(uid);
4010 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4011 reply.readException();
4012 data.recycle();
4013 reply.recycle();
4014 }
4015
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004016 public void overridePendingTransition(IBinder token, String packageName,
4017 int enterAnim, int exitAnim) throws RemoteException {
4018 Parcel data = Parcel.obtain();
4019 Parcel reply = Parcel.obtain();
4020 data.writeInterfaceToken(IActivityManager.descriptor);
4021 data.writeStrongBinder(token);
4022 data.writeString(packageName);
4023 data.writeInt(enterAnim);
4024 data.writeInt(exitAnim);
4025 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4026 reply.readException();
4027 data.recycle();
4028 reply.recycle();
4029 }
4030
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004031 public boolean isUserAMonkey() throws RemoteException {
4032 Parcel data = Parcel.obtain();
4033 Parcel reply = Parcel.obtain();
4034 data.writeInterfaceToken(IActivityManager.descriptor);
4035 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4036 reply.readException();
4037 boolean res = reply.readInt() != 0;
4038 data.recycle();
4039 reply.recycle();
4040 return res;
4041 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004042
4043 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4044 Parcel data = Parcel.obtain();
4045 Parcel reply = Parcel.obtain();
4046 data.writeInterfaceToken(IActivityManager.descriptor);
4047 data.writeInt(monkey ? 1 : 0);
4048 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4049 reply.readException();
4050 data.recycle();
4051 reply.recycle();
4052 }
4053
Dianne Hackborn860755f2010-06-03 18:47:52 -07004054 public void finishHeavyWeightApp() throws RemoteException {
4055 Parcel data = Parcel.obtain();
4056 Parcel reply = Parcel.obtain();
4057 data.writeInterfaceToken(IActivityManager.descriptor);
4058 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4059 reply.readException();
4060 data.recycle();
4061 reply.recycle();
4062 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004063
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004064 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004065 throws RemoteException {
4066 Parcel data = Parcel.obtain();
4067 Parcel reply = Parcel.obtain();
4068 data.writeInterfaceToken(IActivityManager.descriptor);
4069 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004070 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4071 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004072 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004073 data.recycle();
4074 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004075 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004076 }
4077
Craig Mautner233ceee2014-05-09 17:05:11 -07004078 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004079 throws RemoteException {
4080 Parcel data = Parcel.obtain();
4081 Parcel reply = Parcel.obtain();
4082 data.writeInterfaceToken(IActivityManager.descriptor);
4083 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004084 if (options == null) {
4085 data.writeInt(0);
4086 } else {
4087 data.writeInt(1);
4088 data.writeBundle(options.toBundle());
4089 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004090 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004091 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004092 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004093 data.recycle();
4094 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004095 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004096 }
4097
Craig Mautner233ceee2014-05-09 17:05:11 -07004098 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4099 Parcel data = Parcel.obtain();
4100 Parcel reply = Parcel.obtain();
4101 data.writeInterfaceToken(IActivityManager.descriptor);
4102 data.writeStrongBinder(token);
4103 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4104 reply.readException();
4105 Bundle bundle = reply.readBundle();
4106 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4107 data.recycle();
4108 reply.recycle();
4109 return options;
4110 }
4111
Daniel Sandler69a48172010-06-23 16:29:36 -04004112 public void setImmersive(IBinder token, boolean immersive)
4113 throws RemoteException {
4114 Parcel data = Parcel.obtain();
4115 Parcel reply = Parcel.obtain();
4116 data.writeInterfaceToken(IActivityManager.descriptor);
4117 data.writeStrongBinder(token);
4118 data.writeInt(immersive ? 1 : 0);
4119 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4120 reply.readException();
4121 data.recycle();
4122 reply.recycle();
4123 }
4124
4125 public boolean isImmersive(IBinder token)
4126 throws RemoteException {
4127 Parcel data = Parcel.obtain();
4128 Parcel reply = Parcel.obtain();
4129 data.writeInterfaceToken(IActivityManager.descriptor);
4130 data.writeStrongBinder(token);
4131 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004132 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004133 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004134 data.recycle();
4135 reply.recycle();
4136 return res;
4137 }
4138
4139 public boolean isTopActivityImmersive()
4140 throws RemoteException {
4141 Parcel data = Parcel.obtain();
4142 Parcel reply = Parcel.obtain();
4143 data.writeInterfaceToken(IActivityManager.descriptor);
4144 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004145 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004146 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004147 data.recycle();
4148 reply.recycle();
4149 return res;
4150 }
4151
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004152 public void crashApplication(int uid, int initialPid, String packageName,
4153 String message) throws RemoteException {
4154 Parcel data = Parcel.obtain();
4155 Parcel reply = Parcel.obtain();
4156 data.writeInterfaceToken(IActivityManager.descriptor);
4157 data.writeInt(uid);
4158 data.writeInt(initialPid);
4159 data.writeString(packageName);
4160 data.writeString(message);
4161 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4162 reply.readException();
4163 data.recycle();
4164 reply.recycle();
4165 }
Andy McFadden824c5102010-07-09 16:26:57 -07004166
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004167 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004168 Parcel data = Parcel.obtain();
4169 Parcel reply = Parcel.obtain();
4170 data.writeInterfaceToken(IActivityManager.descriptor);
4171 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004172 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004173 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4174 reply.readException();
4175 String res = reply.readString();
4176 data.recycle();
4177 reply.recycle();
4178 return res;
4179 }
4180
Dianne Hackborn7e269642010-08-25 19:50:20 -07004181 public IBinder newUriPermissionOwner(String name)
4182 throws RemoteException {
4183 Parcel data = Parcel.obtain();
4184 Parcel reply = Parcel.obtain();
4185 data.writeInterfaceToken(IActivityManager.descriptor);
4186 data.writeString(name);
4187 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4188 reply.readException();
4189 IBinder res = reply.readStrongBinder();
4190 data.recycle();
4191 reply.recycle();
4192 return res;
4193 }
4194
4195 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
4196 Uri uri, int mode) throws RemoteException {
4197 Parcel data = Parcel.obtain();
4198 Parcel reply = Parcel.obtain();
4199 data.writeInterfaceToken(IActivityManager.descriptor);
4200 data.writeStrongBinder(owner);
4201 data.writeInt(fromUid);
4202 data.writeString(targetPkg);
4203 uri.writeToParcel(data, 0);
4204 data.writeInt(mode);
4205 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4206 reply.readException();
4207 data.recycle();
4208 reply.recycle();
4209 }
4210
4211 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
4212 int mode) throws RemoteException {
4213 Parcel data = Parcel.obtain();
4214 Parcel reply = Parcel.obtain();
4215 data.writeInterfaceToken(IActivityManager.descriptor);
4216 data.writeStrongBinder(owner);
4217 if (uri != null) {
4218 data.writeInt(1);
4219 uri.writeToParcel(data, 0);
4220 } else {
4221 data.writeInt(0);
4222 }
4223 data.writeInt(mode);
4224 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4225 reply.readException();
4226 data.recycle();
4227 reply.recycle();
4228 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004229
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004230 public int checkGrantUriPermission(int callingUid, String targetPkg,
4231 Uri uri, int modeFlags) throws RemoteException {
4232 Parcel data = Parcel.obtain();
4233 Parcel reply = Parcel.obtain();
4234 data.writeInterfaceToken(IActivityManager.descriptor);
4235 data.writeInt(callingUid);
4236 data.writeString(targetPkg);
4237 uri.writeToParcel(data, 0);
4238 data.writeInt(modeFlags);
4239 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4240 reply.readException();
4241 int res = reply.readInt();
4242 data.recycle();
4243 reply.recycle();
4244 return res;
4245 }
4246
Dianne Hackborn1676c852012-09-10 14:52:30 -07004247 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004248 String path, ParcelFileDescriptor fd) throws RemoteException {
4249 Parcel data = Parcel.obtain();
4250 Parcel reply = Parcel.obtain();
4251 data.writeInterfaceToken(IActivityManager.descriptor);
4252 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004253 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004254 data.writeInt(managed ? 1 : 0);
4255 data.writeString(path);
4256 if (fd != null) {
4257 data.writeInt(1);
4258 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4259 } else {
4260 data.writeInt(0);
4261 }
4262 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4263 reply.readException();
4264 boolean res = reply.readInt() != 0;
4265 reply.recycle();
4266 data.recycle();
4267 return res;
4268 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004269
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004270 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004271 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004272 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004273 Parcel data = Parcel.obtain();
4274 Parcel reply = Parcel.obtain();
4275 data.writeInterfaceToken(IActivityManager.descriptor);
4276 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004277 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004278 data.writeTypedArray(intents, 0);
4279 data.writeStringArray(resolvedTypes);
4280 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004281 if (options != null) {
4282 data.writeInt(1);
4283 options.writeToParcel(data, 0);
4284 } else {
4285 data.writeInt(0);
4286 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004287 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004288 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4289 reply.readException();
4290 int result = reply.readInt();
4291 reply.recycle();
4292 data.recycle();
4293 return result;
4294 }
4295
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004296 public int getFrontActivityScreenCompatMode() throws RemoteException {
4297 Parcel data = Parcel.obtain();
4298 Parcel reply = Parcel.obtain();
4299 data.writeInterfaceToken(IActivityManager.descriptor);
4300 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4301 reply.readException();
4302 int mode = reply.readInt();
4303 reply.recycle();
4304 data.recycle();
4305 return mode;
4306 }
4307
4308 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4309 Parcel data = Parcel.obtain();
4310 Parcel reply = Parcel.obtain();
4311 data.writeInterfaceToken(IActivityManager.descriptor);
4312 data.writeInt(mode);
4313 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4314 reply.readException();
4315 reply.recycle();
4316 data.recycle();
4317 }
4318
4319 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4320 Parcel data = Parcel.obtain();
4321 Parcel reply = Parcel.obtain();
4322 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004323 data.writeString(packageName);
4324 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004325 reply.readException();
4326 int mode = reply.readInt();
4327 reply.recycle();
4328 data.recycle();
4329 return mode;
4330 }
4331
4332 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004333 throws RemoteException {
4334 Parcel data = Parcel.obtain();
4335 Parcel reply = Parcel.obtain();
4336 data.writeInterfaceToken(IActivityManager.descriptor);
4337 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004338 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004339 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4340 reply.readException();
4341 reply.recycle();
4342 data.recycle();
4343 }
4344
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004345 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4346 Parcel data = Parcel.obtain();
4347 Parcel reply = Parcel.obtain();
4348 data.writeInterfaceToken(IActivityManager.descriptor);
4349 data.writeString(packageName);
4350 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4351 reply.readException();
4352 boolean ask = reply.readInt() != 0;
4353 reply.recycle();
4354 data.recycle();
4355 return ask;
4356 }
4357
4358 public void setPackageAskScreenCompat(String packageName, boolean ask)
4359 throws RemoteException {
4360 Parcel data = Parcel.obtain();
4361 Parcel reply = Parcel.obtain();
4362 data.writeInterfaceToken(IActivityManager.descriptor);
4363 data.writeString(packageName);
4364 data.writeInt(ask ? 1 : 0);
4365 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4366 reply.readException();
4367 reply.recycle();
4368 data.recycle();
4369 }
4370
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004371 public boolean switchUser(int userid) throws RemoteException {
4372 Parcel data = Parcel.obtain();
4373 Parcel reply = Parcel.obtain();
4374 data.writeInterfaceToken(IActivityManager.descriptor);
4375 data.writeInt(userid);
4376 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4377 reply.readException();
4378 boolean result = reply.readInt() != 0;
4379 reply.recycle();
4380 data.recycle();
4381 return result;
4382 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004383
Kenny Guy08488bf2014-02-21 17:40:37 +00004384 public boolean startUserInBackground(int userid) throws RemoteException {
4385 Parcel data = Parcel.obtain();
4386 Parcel reply = Parcel.obtain();
4387 data.writeInterfaceToken(IActivityManager.descriptor);
4388 data.writeInt(userid);
4389 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4390 reply.readException();
4391 boolean result = reply.readInt() != 0;
4392 reply.recycle();
4393 data.recycle();
4394 return result;
4395 }
4396
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004397 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4398 Parcel data = Parcel.obtain();
4399 Parcel reply = Parcel.obtain();
4400 data.writeInterfaceToken(IActivityManager.descriptor);
4401 data.writeInt(userid);
4402 data.writeStrongInterface(callback);
4403 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4404 reply.readException();
4405 int result = reply.readInt();
4406 reply.recycle();
4407 data.recycle();
4408 return result;
4409 }
4410
Amith Yamasani52f1d752012-03-28 18:19:29 -07004411 public UserInfo getCurrentUser() throws RemoteException {
4412 Parcel data = Parcel.obtain();
4413 Parcel reply = Parcel.obtain();
4414 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004415 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004416 reply.readException();
4417 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4418 reply.recycle();
4419 data.recycle();
4420 return userInfo;
4421 }
4422
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004423 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004424 Parcel data = Parcel.obtain();
4425 Parcel reply = Parcel.obtain();
4426 data.writeInterfaceToken(IActivityManager.descriptor);
4427 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004428 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004429 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4430 reply.readException();
4431 boolean result = reply.readInt() != 0;
4432 reply.recycle();
4433 data.recycle();
4434 return result;
4435 }
4436
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004437 public int[] getRunningUserIds() throws RemoteException {
4438 Parcel data = Parcel.obtain();
4439 Parcel reply = Parcel.obtain();
4440 data.writeInterfaceToken(IActivityManager.descriptor);
4441 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4442 reply.readException();
4443 int[] result = reply.createIntArray();
4444 reply.recycle();
4445 data.recycle();
4446 return result;
4447 }
4448
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004449 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4450 Parcel data = Parcel.obtain();
4451 Parcel reply = Parcel.obtain();
4452 data.writeInterfaceToken(IActivityManager.descriptor);
4453 data.writeInt(taskId);
4454 data.writeInt(subTaskIndex);
4455 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4456 reply.readException();
4457 boolean result = reply.readInt() != 0;
4458 reply.recycle();
4459 data.recycle();
4460 return result;
4461 }
4462
4463 public boolean removeTask(int taskId, int flags) throws RemoteException {
4464 Parcel data = Parcel.obtain();
4465 Parcel reply = Parcel.obtain();
4466 data.writeInterfaceToken(IActivityManager.descriptor);
4467 data.writeInt(taskId);
4468 data.writeInt(flags);
4469 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4470 reply.readException();
4471 boolean result = reply.readInt() != 0;
4472 reply.recycle();
4473 data.recycle();
4474 return result;
4475 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004476
Jeff Sharkeya4620792011-05-20 15:29:23 -07004477 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4478 Parcel data = Parcel.obtain();
4479 Parcel reply = Parcel.obtain();
4480 data.writeInterfaceToken(IActivityManager.descriptor);
4481 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4482 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4483 reply.readException();
4484 data.recycle();
4485 reply.recycle();
4486 }
4487
4488 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4489 Parcel data = Parcel.obtain();
4490 Parcel reply = Parcel.obtain();
4491 data.writeInterfaceToken(IActivityManager.descriptor);
4492 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4493 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4494 reply.readException();
4495 data.recycle();
4496 reply.recycle();
4497 }
4498
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004499 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4500 Parcel data = Parcel.obtain();
4501 Parcel reply = Parcel.obtain();
4502 data.writeInterfaceToken(IActivityManager.descriptor);
4503 data.writeStrongBinder(sender.asBinder());
4504 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4505 reply.readException();
4506 boolean res = reply.readInt() != 0;
4507 data.recycle();
4508 reply.recycle();
4509 return res;
4510 }
4511
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004512 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4513 Parcel data = Parcel.obtain();
4514 Parcel reply = Parcel.obtain();
4515 data.writeInterfaceToken(IActivityManager.descriptor);
4516 data.writeStrongBinder(sender.asBinder());
4517 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4518 reply.readException();
4519 boolean res = reply.readInt() != 0;
4520 data.recycle();
4521 reply.recycle();
4522 return res;
4523 }
4524
Dianne Hackborn81038902012-11-26 17:04:09 -08004525 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4526 Parcel data = Parcel.obtain();
4527 Parcel reply = Parcel.obtain();
4528 data.writeInterfaceToken(IActivityManager.descriptor);
4529 data.writeStrongBinder(sender.asBinder());
4530 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4531 reply.readException();
4532 Intent res = reply.readInt() != 0
4533 ? Intent.CREATOR.createFromParcel(reply) : null;
4534 data.recycle();
4535 reply.recycle();
4536 return res;
4537 }
4538
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004539 public String getTagForIntentSender(IIntentSender sender, String prefix)
4540 throws RemoteException {
4541 Parcel data = Parcel.obtain();
4542 Parcel reply = Parcel.obtain();
4543 data.writeInterfaceToken(IActivityManager.descriptor);
4544 data.writeStrongBinder(sender.asBinder());
4545 data.writeString(prefix);
4546 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4547 reply.readException();
4548 String res = reply.readString();
4549 data.recycle();
4550 reply.recycle();
4551 return res;
4552 }
4553
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004554 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4555 {
4556 Parcel data = Parcel.obtain();
4557 Parcel reply = Parcel.obtain();
4558 data.writeInterfaceToken(IActivityManager.descriptor);
4559 values.writeToParcel(data, 0);
4560 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4561 reply.readException();
4562 data.recycle();
4563 reply.recycle();
4564 }
4565
Dianne Hackbornb437e092011-08-05 17:50:29 -07004566 public long[] getProcessPss(int[] pids) throws RemoteException {
4567 Parcel data = Parcel.obtain();
4568 Parcel reply = Parcel.obtain();
4569 data.writeInterfaceToken(IActivityManager.descriptor);
4570 data.writeIntArray(pids);
4571 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4572 reply.readException();
4573 long[] res = reply.createLongArray();
4574 data.recycle();
4575 reply.recycle();
4576 return res;
4577 }
4578
Dianne Hackborn661cd522011-08-22 00:26:20 -07004579 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4580 Parcel data = Parcel.obtain();
4581 Parcel reply = Parcel.obtain();
4582 data.writeInterfaceToken(IActivityManager.descriptor);
4583 TextUtils.writeToParcel(msg, data, 0);
4584 data.writeInt(always ? 1 : 0);
4585 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4586 reply.readException();
4587 data.recycle();
4588 reply.recycle();
4589 }
4590
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004591 public void dismissKeyguardOnNextActivity() throws RemoteException {
4592 Parcel data = Parcel.obtain();
4593 Parcel reply = Parcel.obtain();
4594 data.writeInterfaceToken(IActivityManager.descriptor);
4595 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4596 reply.readException();
4597 data.recycle();
4598 reply.recycle();
4599 }
4600
Adam Powelldd8fab22012-03-22 17:47:27 -07004601 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4602 throws RemoteException {
4603 Parcel data = Parcel.obtain();
4604 Parcel reply = Parcel.obtain();
4605 data.writeInterfaceToken(IActivityManager.descriptor);
4606 data.writeStrongBinder(token);
4607 data.writeString(destAffinity);
4608 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4609 reply.readException();
4610 boolean result = reply.readInt() != 0;
4611 data.recycle();
4612 reply.recycle();
4613 return result;
4614 }
4615
4616 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4617 throws RemoteException {
4618 Parcel data = Parcel.obtain();
4619 Parcel reply = Parcel.obtain();
4620 data.writeInterfaceToken(IActivityManager.descriptor);
4621 data.writeStrongBinder(token);
4622 target.writeToParcel(data, 0);
4623 data.writeInt(resultCode);
4624 if (resultData != null) {
4625 data.writeInt(1);
4626 resultData.writeToParcel(data, 0);
4627 } else {
4628 data.writeInt(0);
4629 }
4630 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4631 reply.readException();
4632 boolean result = reply.readInt() != 0;
4633 data.recycle();
4634 reply.recycle();
4635 return result;
4636 }
4637
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004638 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4639 Parcel data = Parcel.obtain();
4640 Parcel reply = Parcel.obtain();
4641 data.writeInterfaceToken(IActivityManager.descriptor);
4642 data.writeStrongBinder(activityToken);
4643 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4644 reply.readException();
4645 int result = reply.readInt();
4646 data.recycle();
4647 reply.recycle();
4648 return result;
4649 }
4650
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004651 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4652 Parcel data = Parcel.obtain();
4653 Parcel reply = Parcel.obtain();
4654 data.writeInterfaceToken(IActivityManager.descriptor);
4655 data.writeStrongBinder(activityToken);
4656 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4657 reply.readException();
4658 String result = reply.readString();
4659 data.recycle();
4660 reply.recycle();
4661 return result;
4662 }
4663
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004664 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4665 Parcel data = Parcel.obtain();
4666 Parcel reply = Parcel.obtain();
4667 data.writeInterfaceToken(IActivityManager.descriptor);
4668 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4669 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4670 reply.readException();
4671 data.recycle();
4672 reply.recycle();
4673 }
4674
4675 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4676 Parcel data = Parcel.obtain();
4677 Parcel reply = Parcel.obtain();
4678 data.writeInterfaceToken(IActivityManager.descriptor);
4679 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4680 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4681 reply.readException();
4682 data.recycle();
4683 reply.recycle();
4684 }
4685
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004686 public void requestBugReport() throws RemoteException {
4687 Parcel data = Parcel.obtain();
4688 Parcel reply = Parcel.obtain();
4689 data.writeInterfaceToken(IActivityManager.descriptor);
4690 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4691 reply.readException();
4692 data.recycle();
4693 reply.recycle();
4694 }
4695
Jeff Brownbd181bb2013-09-10 16:44:24 -07004696 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4697 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004698 Parcel data = Parcel.obtain();
4699 Parcel reply = Parcel.obtain();
4700 data.writeInterfaceToken(IActivityManager.descriptor);
4701 data.writeInt(pid);
4702 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004703 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004704 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4705 reply.readException();
4706 long res = reply.readInt();
4707 data.recycle();
4708 reply.recycle();
4709 return res;
4710 }
4711
Adam Skorydfc7fd72013-08-05 19:23:41 -07004712 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004713 Parcel data = Parcel.obtain();
4714 Parcel reply = Parcel.obtain();
4715 data.writeInterfaceToken(IActivityManager.descriptor);
4716 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004717 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004718 reply.readException();
4719 Bundle res = reply.readBundle();
4720 data.recycle();
4721 reply.recycle();
4722 return res;
4723 }
4724
Adam Skory7140a252013-09-11 12:04:58 +01004725 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004726 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004727 Parcel data = Parcel.obtain();
4728 Parcel reply = Parcel.obtain();
4729 data.writeInterfaceToken(IActivityManager.descriptor);
4730 data.writeStrongBinder(token);
4731 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004732 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004733 reply.readException();
4734 data.recycle();
4735 reply.recycle();
4736 }
4737
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004738 public void killUid(int uid, String reason) throws RemoteException {
4739 Parcel data = Parcel.obtain();
4740 Parcel reply = Parcel.obtain();
4741 data.writeInterfaceToken(IActivityManager.descriptor);
4742 data.writeInt(uid);
4743 data.writeString(reason);
4744 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4745 reply.readException();
4746 data.recycle();
4747 reply.recycle();
4748 }
4749
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004750 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4751 Parcel data = Parcel.obtain();
4752 Parcel reply = Parcel.obtain();
4753 data.writeInterfaceToken(IActivityManager.descriptor);
4754 data.writeStrongBinder(who);
4755 data.writeInt(allowRestart ? 1 : 0);
4756 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4757 reply.readException();
4758 data.recycle();
4759 reply.recycle();
4760 }
4761
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004762 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4763 Parcel data = Parcel.obtain();
4764 Parcel reply = Parcel.obtain();
4765 data.writeInterfaceToken(IActivityManager.descriptor);
4766 data.writeStrongBinder(token);
4767 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4768 reply.readException();
4769 data.recycle();
4770 reply.recycle();
4771 }
4772
Craig Mautner5eda9b32013-07-02 11:58:16 -07004773 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4774 Parcel data = Parcel.obtain();
4775 Parcel reply = Parcel.obtain();
4776 data.writeInterfaceToken(IActivityManager.descriptor);
4777 data.writeStrongBinder(token);
4778 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4779 reply.readException();
4780 data.recycle();
4781 reply.recycle();
4782 }
4783
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004784 public void restart() throws RemoteException {
4785 Parcel data = Parcel.obtain();
4786 Parcel reply = Parcel.obtain();
4787 data.writeInterfaceToken(IActivityManager.descriptor);
4788 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4789 reply.readException();
4790 data.recycle();
4791 reply.recycle();
4792 }
4793
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004794 public void performIdleMaintenance() throws RemoteException {
4795 Parcel data = Parcel.obtain();
4796 Parcel reply = Parcel.obtain();
4797 data.writeInterfaceToken(IActivityManager.descriptor);
4798 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4799 reply.readException();
4800 data.recycle();
4801 reply.recycle();
4802 }
4803
Craig Mautner4a1cb222013-12-04 16:14:06 -08004804 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4805 IActivityContainerCallback callback) throws RemoteException {
4806 Parcel data = Parcel.obtain();
4807 Parcel reply = Parcel.obtain();
4808 data.writeInterfaceToken(IActivityManager.descriptor);
4809 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07004810 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08004811 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4812 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004813 final int result = reply.readInt();
4814 final IActivityContainer res;
4815 if (result == 1) {
4816 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4817 } else {
4818 res = null;
4819 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004820 data.recycle();
4821 reply.recycle();
4822 return res;
4823 }
4824
Craig Mautner95da1082014-02-24 17:54:35 -08004825 public void deleteActivityContainer(IActivityContainer activityContainer)
4826 throws RemoteException {
4827 Parcel data = Parcel.obtain();
4828 Parcel reply = Parcel.obtain();
4829 data.writeInterfaceToken(IActivityManager.descriptor);
4830 data.writeStrongBinder(activityContainer.asBinder());
4831 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4832 reply.readException();
4833 data.recycle();
4834 reply.recycle();
4835 }
4836
Craig Mautnere0a38842013-12-16 16:14:02 -08004837 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4838 throws RemoteException {
4839 Parcel data = Parcel.obtain();
4840 Parcel reply = Parcel.obtain();
4841 data.writeInterfaceToken(IActivityManager.descriptor);
4842 data.writeStrongBinder(activityToken);
4843 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4844 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004845 final int result = reply.readInt();
4846 final IActivityContainer res;
4847 if (result == 1) {
4848 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4849 } else {
4850 res = null;
4851 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004852 data.recycle();
4853 reply.recycle();
4854 return res;
4855 }
4856
Craig Mautner4a1cb222013-12-04 16:14:06 -08004857 public IBinder getHomeActivityToken() throws RemoteException {
4858 Parcel data = Parcel.obtain();
4859 Parcel reply = Parcel.obtain();
4860 data.writeInterfaceToken(IActivityManager.descriptor);
4861 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4862 reply.readException();
4863 IBinder res = reply.readStrongBinder();
4864 data.recycle();
4865 reply.recycle();
4866 return res;
4867 }
4868
Craig Mautneraea74a52014-03-08 14:23:10 -08004869 @Override
4870 public void startLockTaskMode(int taskId) throws RemoteException {
4871 Parcel data = Parcel.obtain();
4872 Parcel reply = Parcel.obtain();
4873 data.writeInterfaceToken(IActivityManager.descriptor);
4874 data.writeInt(taskId);
4875 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
4876 reply.readException();
4877 data.recycle();
4878 reply.recycle();
4879 }
4880
4881 @Override
4882 public void startLockTaskMode(IBinder token) throws RemoteException {
4883 Parcel data = Parcel.obtain();
4884 Parcel reply = Parcel.obtain();
4885 data.writeInterfaceToken(IActivityManager.descriptor);
4886 data.writeStrongBinder(token);
4887 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
4888 reply.readException();
4889 data.recycle();
4890 reply.recycle();
4891 }
4892
4893 @Override
4894 public void stopLockTaskMode() throws RemoteException {
4895 Parcel data = Parcel.obtain();
4896 Parcel reply = Parcel.obtain();
4897 data.writeInterfaceToken(IActivityManager.descriptor);
4898 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4899 reply.readException();
4900 data.recycle();
4901 reply.recycle();
4902 }
4903
4904 @Override
4905 public boolean isInLockTaskMode() throws RemoteException {
4906 Parcel data = Parcel.obtain();
4907 Parcel reply = Parcel.obtain();
4908 data.writeInterfaceToken(IActivityManager.descriptor);
4909 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4910 reply.readException();
4911 boolean isInLockTaskMode = reply.readInt() == 1;
4912 data.recycle();
4913 reply.recycle();
4914 return isInLockTaskMode;
4915 }
4916
Craig Mautner688b5102014-03-27 16:55:03 -07004917 @Override
Winson Chung03a9bae2014-05-02 09:56:12 -07004918 public void setRecentsActivityValues(IBinder token, ActivityManager.RecentsActivityValues values)
4919 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07004920 Parcel data = Parcel.obtain();
4921 Parcel reply = Parcel.obtain();
4922 data.writeInterfaceToken(IActivityManager.descriptor);
4923 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07004924 values.writeToParcel(data, 0);
4925 mRemote.transact(SET_RECENTS_ACTIVITY_VALUES_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07004926 reply.readException();
4927 data.recycle();
4928 reply.recycle();
4929 }
4930
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004931 private IBinder mRemote;
4932}