blob: 263a67588e824c51ad026af257971ab5f3c08376 [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;
43import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070045import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070046import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080049import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070050import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import java.util.ArrayList;
53import java.util.List;
54
55/** {@hide} */
56public abstract class ActivityManagerNative extends Binder implements IActivityManager
57{
58 /**
59 * Cast a Binder object into an activity manager interface, generating
60 * a proxy if needed.
61 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080062 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080063 if (obj == null) {
64 return null;
65 }
66 IActivityManager in =
67 (IActivityManager)obj.queryLocalInterface(descriptor);
68 if (in != null) {
69 return in;
70 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080071
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072 return new ActivityManagerProxy(obj);
73 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 /**
76 * Retrieve the system's default/global activity manager.
77 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080078 static public IActivityManager getDefault() {
79 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 }
81
82 /**
83 * Convenience for checking whether the system is ready. For internal use only.
84 */
85 static public boolean isSystemReady() {
86 if (!sSystemReady) {
87 sSystemReady = getDefault().testIsSystemReady();
88 }
89 return sSystemReady;
90 }
91 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080092
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 /**
94 * Convenience for sending a sticky broadcast. For internal use only.
95 * If you don't care about permission, use null.
96 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070097 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080098 try {
99 getDefault().broadcastIntent(
100 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800101 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 } catch (RemoteException ex) {
103 }
104 }
105
Dianne Hackborn099bc622014-01-22 13:39:16 -0800106 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800108 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 } catch (RemoteException ex) {
110 }
111 }
112
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800113 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800114 attachInterface(this, descriptor);
115 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700116
117 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
119 throws RemoteException {
120 switch (code) {
121 case START_ACTIVITY_TRANSACTION:
122 {
123 data.enforceInterface(IActivityManager.descriptor);
124 IBinder b = data.readStrongBinder();
125 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800126 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800127 Intent intent = Intent.CREATOR.createFromParcel(data);
128 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800130 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700132 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700133 String profileFile = data.readString();
134 ParcelFileDescriptor profileFd = data.readInt() != 0
135 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700136 Bundle options = data.readInt() != 0
137 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800138 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700139 resultTo, resultWho, requestCode, startFlags,
140 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800141 reply.writeNoException();
142 reply.writeInt(result);
143 return true;
144 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700145
Amith Yamasani82644082012-08-03 13:09:11 -0700146 case START_ACTIVITY_AS_USER_TRANSACTION:
147 {
148 data.enforceInterface(IActivityManager.descriptor);
149 IBinder b = data.readStrongBinder();
150 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800151 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700152 Intent intent = Intent.CREATOR.createFromParcel(data);
153 String resolvedType = data.readString();
154 IBinder resultTo = data.readStrongBinder();
155 String resultWho = data.readString();
156 int requestCode = data.readInt();
157 int startFlags = data.readInt();
158 String profileFile = data.readString();
159 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700160 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
163 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800164 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700165 resultTo, resultWho, requestCode, startFlags,
166 profileFile, profileFd, options, userId);
167 reply.writeNoException();
168 reply.writeInt(result);
169 return true;
170 }
171
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800172 case START_ACTIVITY_AND_WAIT_TRANSACTION:
173 {
174 data.enforceInterface(IActivityManager.descriptor);
175 IBinder b = data.readStrongBinder();
176 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800177 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800178 Intent intent = Intent.CREATOR.createFromParcel(data);
179 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800180 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800181 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800182 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700183 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700184 String profileFile = data.readString();
185 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700186 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700187 Bundle options = data.readInt() != 0
188 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700189 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800190 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700191 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700192 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800193 reply.writeNoException();
194 result.writeToParcel(reply, 0);
195 return true;
196 }
197
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700198 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
199 {
200 data.enforceInterface(IActivityManager.descriptor);
201 IBinder b = data.readStrongBinder();
202 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800203 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700204 Intent intent = Intent.CREATOR.createFromParcel(data);
205 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700206 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700207 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700208 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700209 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700210 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700211 Bundle options = data.readInt() != 0
212 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700213 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800214 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700215 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700216 reply.writeNoException();
217 reply.writeInt(result);
218 return true;
219 }
220
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700221 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700222 {
223 data.enforceInterface(IActivityManager.descriptor);
224 IBinder b = data.readStrongBinder();
225 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700226 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700227 Intent fillInIntent = null;
228 if (data.readInt() != 0) {
229 fillInIntent = Intent.CREATOR.createFromParcel(data);
230 }
231 String resolvedType = data.readString();
232 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700233 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700234 int requestCode = data.readInt();
235 int flagsMask = data.readInt();
236 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700237 Bundle options = data.readInt() != 0
238 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700239 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700240 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700241 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700242 reply.writeNoException();
243 reply.writeInt(result);
244 return true;
245 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700246
Dianne Hackborn91097de2014-04-04 18:02:06 -0700247 case START_VOICE_ACTIVITY_TRANSACTION:
248 {
249 data.enforceInterface(IActivityManager.descriptor);
250 String callingPackage = data.readString();
251 int callingPid = data.readInt();
252 int callingUid = data.readInt();
253 Intent intent = Intent.CREATOR.createFromParcel(data);
254 String resolvedType = data.readString();
255 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
256 data.readStrongBinder());
257 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
258 data.readStrongBinder());
259 int startFlags = data.readInt();
260 String profileFile = data.readString();
261 ParcelFileDescriptor profileFd = data.readInt() != 0
262 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
263 Bundle options = data.readInt() != 0
264 ? Bundle.CREATOR.createFromParcel(data) : null;
265 int userId = data.readInt();
266 int result = startVoiceActivity(callingPackage, callingPid, callingUid,
267 intent, resolvedType, session, interactor, startFlags,
268 profileFile, profileFd, options, userId);
269 reply.writeNoException();
270 reply.writeInt(result);
271 return true;
272 }
273
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800274 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
275 {
276 data.enforceInterface(IActivityManager.descriptor);
277 IBinder callingActivity = data.readStrongBinder();
278 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700279 Bundle options = data.readInt() != 0
280 ? Bundle.CREATOR.createFromParcel(data) : null;
281 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800282 reply.writeNoException();
283 reply.writeInt(result ? 1 : 0);
284 return true;
285 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700286
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800287 case FINISH_ACTIVITY_TRANSACTION: {
288 data.enforceInterface(IActivityManager.descriptor);
289 IBinder token = data.readStrongBinder();
290 Intent resultData = null;
291 int resultCode = data.readInt();
292 if (data.readInt() != 0) {
293 resultData = Intent.CREATOR.createFromParcel(data);
294 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700295 boolean finishTask = (data.readInt() != 0);
296 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800297 reply.writeNoException();
298 reply.writeInt(res ? 1 : 0);
299 return true;
300 }
301
302 case FINISH_SUB_ACTIVITY_TRANSACTION: {
303 data.enforceInterface(IActivityManager.descriptor);
304 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700305 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800306 int requestCode = data.readInt();
307 finishSubActivity(token, resultWho, requestCode);
308 reply.writeNoException();
309 return true;
310 }
311
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700312 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
313 data.enforceInterface(IActivityManager.descriptor);
314 IBinder token = data.readStrongBinder();
315 boolean res = finishActivityAffinity(token);
316 reply.writeNoException();
317 reply.writeInt(res ? 1 : 0);
318 return true;
319 }
320
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800321 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
322 data.enforceInterface(IActivityManager.descriptor);
323 IBinder token = data.readStrongBinder();
324 boolean res = willActivityBeVisible(token);
325 reply.writeNoException();
326 reply.writeInt(res ? 1 : 0);
327 return true;
328 }
329
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800330 case REGISTER_RECEIVER_TRANSACTION:
331 {
332 data.enforceInterface(IActivityManager.descriptor);
333 IBinder b = data.readStrongBinder();
334 IApplicationThread app =
335 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700336 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800337 b = data.readStrongBinder();
338 IIntentReceiver rec
339 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
340 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
341 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700342 int userId = data.readInt();
343 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800344 reply.writeNoException();
345 if (intent != null) {
346 reply.writeInt(1);
347 intent.writeToParcel(reply, 0);
348 } else {
349 reply.writeInt(0);
350 }
351 return true;
352 }
353
354 case UNREGISTER_RECEIVER_TRANSACTION:
355 {
356 data.enforceInterface(IActivityManager.descriptor);
357 IBinder b = data.readStrongBinder();
358 if (b == null) {
359 return true;
360 }
361 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
362 unregisterReceiver(rec);
363 reply.writeNoException();
364 return true;
365 }
366
367 case BROADCAST_INTENT_TRANSACTION:
368 {
369 data.enforceInterface(IActivityManager.descriptor);
370 IBinder b = data.readStrongBinder();
371 IApplicationThread app =
372 b != null ? ApplicationThreadNative.asInterface(b) : null;
373 Intent intent = Intent.CREATOR.createFromParcel(data);
374 String resolvedType = data.readString();
375 b = data.readStrongBinder();
376 IIntentReceiver resultTo =
377 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
378 int resultCode = data.readInt();
379 String resultData = data.readString();
380 Bundle resultExtras = data.readBundle();
381 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800382 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800383 boolean serialized = data.readInt() != 0;
384 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700385 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800387 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700388 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800389 reply.writeNoException();
390 reply.writeInt(res);
391 return true;
392 }
393
394 case UNBROADCAST_INTENT_TRANSACTION:
395 {
396 data.enforceInterface(IActivityManager.descriptor);
397 IBinder b = data.readStrongBinder();
398 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
399 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700400 int userId = data.readInt();
401 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800402 reply.writeNoException();
403 return true;
404 }
405
406 case FINISH_RECEIVER_TRANSACTION: {
407 data.enforceInterface(IActivityManager.descriptor);
408 IBinder who = data.readStrongBinder();
409 int resultCode = data.readInt();
410 String resultData = data.readString();
411 Bundle resultExtras = data.readBundle();
412 boolean resultAbort = data.readInt() != 0;
413 if (who != null) {
414 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
415 }
416 reply.writeNoException();
417 return true;
418 }
419
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800420 case ATTACH_APPLICATION_TRANSACTION: {
421 data.enforceInterface(IActivityManager.descriptor);
422 IApplicationThread app = ApplicationThreadNative.asInterface(
423 data.readStrongBinder());
424 if (app != null) {
425 attachApplication(app);
426 }
427 reply.writeNoException();
428 return true;
429 }
430
431 case ACTIVITY_IDLE_TRANSACTION: {
432 data.enforceInterface(IActivityManager.descriptor);
433 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700434 Configuration config = null;
435 if (data.readInt() != 0) {
436 config = Configuration.CREATOR.createFromParcel(data);
437 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700438 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800439 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700440 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800441 }
442 reply.writeNoException();
443 return true;
444 }
445
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700446 case ACTIVITY_RESUMED_TRANSACTION: {
447 data.enforceInterface(IActivityManager.descriptor);
448 IBinder token = data.readStrongBinder();
449 activityResumed(token);
450 reply.writeNoException();
451 return true;
452 }
453
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800454 case ACTIVITY_PAUSED_TRANSACTION: {
455 data.enforceInterface(IActivityManager.descriptor);
456 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800457 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800458 reply.writeNoException();
459 return true;
460 }
461
462 case ACTIVITY_STOPPED_TRANSACTION: {
463 data.enforceInterface(IActivityManager.descriptor);
464 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800465 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800466 Bitmap thumbnail = data.readInt() != 0
467 ? Bitmap.CREATOR.createFromParcel(data) : null;
468 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800469 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 reply.writeNoException();
471 return true;
472 }
473
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800474 case ACTIVITY_SLEPT_TRANSACTION: {
475 data.enforceInterface(IActivityManager.descriptor);
476 IBinder token = data.readStrongBinder();
477 activitySlept(token);
478 reply.writeNoException();
479 return true;
480 }
481
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800482 case ACTIVITY_DESTROYED_TRANSACTION: {
483 data.enforceInterface(IActivityManager.descriptor);
484 IBinder token = data.readStrongBinder();
485 activityDestroyed(token);
486 reply.writeNoException();
487 return true;
488 }
489
490 case GET_CALLING_PACKAGE_TRANSACTION: {
491 data.enforceInterface(IActivityManager.descriptor);
492 IBinder token = data.readStrongBinder();
493 String res = token != null ? getCallingPackage(token) : null;
494 reply.writeNoException();
495 reply.writeString(res);
496 return true;
497 }
498
499 case GET_CALLING_ACTIVITY_TRANSACTION: {
500 data.enforceInterface(IActivityManager.descriptor);
501 IBinder token = data.readStrongBinder();
502 ComponentName cn = getCallingActivity(token);
503 reply.writeNoException();
504 ComponentName.writeToParcel(cn, reply);
505 return true;
506 }
507
508 case GET_TASKS_TRANSACTION: {
509 data.enforceInterface(IActivityManager.descriptor);
510 int maxNum = data.readInt();
511 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700512 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800513 reply.writeNoException();
514 int N = list != null ? list.size() : -1;
515 reply.writeInt(N);
516 int i;
517 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700518 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800519 info.writeToParcel(reply, 0);
520 }
521 return true;
522 }
523
524 case GET_RECENT_TASKS_TRANSACTION: {
525 data.enforceInterface(IActivityManager.descriptor);
526 int maxNum = data.readInt();
527 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700528 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800529 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700530 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800531 reply.writeNoException();
532 reply.writeTypedList(list);
533 return true;
534 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700535
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700536 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800537 data.enforceInterface(IActivityManager.descriptor);
538 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700539 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800540 reply.writeNoException();
541 if (bm != null) {
542 reply.writeInt(1);
543 bm.writeToParcel(reply, 0);
544 } else {
545 reply.writeInt(0);
546 }
547 return true;
548 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700549
550 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
551 data.enforceInterface(IActivityManager.descriptor);
552 int id = data.readInt();
553 Bitmap bm = getTaskTopThumbnail(id);
554 reply.writeNoException();
555 if (bm != null) {
556 reply.writeInt(1);
557 bm.writeToParcel(reply, 0);
558 } else {
559 reply.writeInt(0);
560 }
561 return true;
562 }
563
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800564 case GET_SERVICES_TRANSACTION: {
565 data.enforceInterface(IActivityManager.descriptor);
566 int maxNum = data.readInt();
567 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700568 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800569 reply.writeNoException();
570 int N = list != null ? list.size() : -1;
571 reply.writeInt(N);
572 int i;
573 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700574 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800575 info.writeToParcel(reply, 0);
576 }
577 return true;
578 }
579
580 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
581 data.enforceInterface(IActivityManager.descriptor);
582 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
583 reply.writeNoException();
584 reply.writeTypedList(list);
585 return true;
586 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700587
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800588 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
589 data.enforceInterface(IActivityManager.descriptor);
590 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
591 reply.writeNoException();
592 reply.writeTypedList(list);
593 return true;
594 }
595
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700596 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
597 data.enforceInterface(IActivityManager.descriptor);
598 List<ApplicationInfo> list = getRunningExternalApplications();
599 reply.writeNoException();
600 reply.writeTypedList(list);
601 return true;
602 }
603
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800604 case MOVE_TASK_TO_FRONT_TRANSACTION: {
605 data.enforceInterface(IActivityManager.descriptor);
606 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800607 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700608 Bundle options = data.readInt() != 0
609 ? Bundle.CREATOR.createFromParcel(data) : null;
610 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800611 reply.writeNoException();
612 return true;
613 }
614
615 case MOVE_TASK_TO_BACK_TRANSACTION: {
616 data.enforceInterface(IActivityManager.descriptor);
617 int task = data.readInt();
618 moveTaskToBack(task);
619 reply.writeNoException();
620 return true;
621 }
622
623 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
624 data.enforceInterface(IActivityManager.descriptor);
625 IBinder token = data.readStrongBinder();
626 boolean nonRoot = data.readInt() != 0;
627 boolean res = moveActivityTaskToBack(token, nonRoot);
628 reply.writeNoException();
629 reply.writeInt(res ? 1 : 0);
630 return true;
631 }
632
633 case MOVE_TASK_BACKWARDS_TRANSACTION: {
634 data.enforceInterface(IActivityManager.descriptor);
635 int task = data.readInt();
636 moveTaskBackwards(task);
637 reply.writeNoException();
638 return true;
639 }
640
Craig Mautnerc00204b2013-03-05 15:02:14 -0800641 case MOVE_TASK_TO_STACK_TRANSACTION: {
642 data.enforceInterface(IActivityManager.descriptor);
643 int taskId = data.readInt();
644 int stackId = data.readInt();
645 boolean toTop = data.readInt() != 0;
646 moveTaskToStack(taskId, stackId, toTop);
647 reply.writeNoException();
648 return true;
649 }
650
651 case RESIZE_STACK_TRANSACTION: {
652 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800653 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800654 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800655 Rect r = Rect.CREATOR.createFromParcel(data);
656 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800657 reply.writeNoException();
658 return true;
659 }
660
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800661 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700662 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800663 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700664 reply.writeNoException();
665 reply.writeTypedList(list);
666 return true;
667 }
668
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800669 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700670 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800671 int stackId = data.readInt();
672 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700673 reply.writeNoException();
674 if (info != null) {
675 reply.writeInt(1);
676 info.writeToParcel(reply, 0);
677 } else {
678 reply.writeInt(0);
679 }
680 return true;
681 }
682
Winson Chung303e1ff2014-03-07 15:06:19 -0800683 case IS_IN_HOME_STACK_TRANSACTION: {
684 data.enforceInterface(IActivityManager.descriptor);
685 int taskId = data.readInt();
686 boolean isInHomeStack = isInHomeStack(taskId);
687 reply.writeNoException();
688 reply.writeInt(isInHomeStack ? 1 : 0);
689 return true;
690 }
691
Craig Mautnercf910b02013-04-23 11:23:27 -0700692 case SET_FOCUSED_STACK_TRANSACTION: {
693 data.enforceInterface(IActivityManager.descriptor);
694 int stackId = data.readInt();
695 setFocusedStack(stackId);
696 reply.writeNoException();
697 return true;
698 }
699
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800700 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
701 data.enforceInterface(IActivityManager.descriptor);
702 IBinder token = data.readStrongBinder();
703 boolean onlyRoot = data.readInt() != 0;
704 int res = token != null
705 ? getTaskForActivity(token, onlyRoot) : -1;
706 reply.writeNoException();
707 reply.writeInt(res);
708 return true;
709 }
710
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800711 case GET_CONTENT_PROVIDER_TRANSACTION: {
712 data.enforceInterface(IActivityManager.descriptor);
713 IBinder b = data.readStrongBinder();
714 IApplicationThread app = ApplicationThreadNative.asInterface(b);
715 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700716 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700717 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700718 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800719 reply.writeNoException();
720 if (cph != null) {
721 reply.writeInt(1);
722 cph.writeToParcel(reply, 0);
723 } else {
724 reply.writeInt(0);
725 }
726 return true;
727 }
728
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800729 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
730 data.enforceInterface(IActivityManager.descriptor);
731 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700732 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800733 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700734 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800735 reply.writeNoException();
736 if (cph != null) {
737 reply.writeInt(1);
738 cph.writeToParcel(reply, 0);
739 } else {
740 reply.writeInt(0);
741 }
742 return true;
743 }
744
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800745 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
746 data.enforceInterface(IActivityManager.descriptor);
747 IBinder b = data.readStrongBinder();
748 IApplicationThread app = ApplicationThreadNative.asInterface(b);
749 ArrayList<ContentProviderHolder> providers =
750 data.createTypedArrayList(ContentProviderHolder.CREATOR);
751 publishContentProviders(app, providers);
752 reply.writeNoException();
753 return true;
754 }
755
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700756 case REF_CONTENT_PROVIDER_TRANSACTION: {
757 data.enforceInterface(IActivityManager.descriptor);
758 IBinder b = data.readStrongBinder();
759 int stable = data.readInt();
760 int unstable = data.readInt();
761 boolean res = refContentProvider(b, stable, unstable);
762 reply.writeNoException();
763 reply.writeInt(res ? 1 : 0);
764 return true;
765 }
766
767 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
768 data.enforceInterface(IActivityManager.descriptor);
769 IBinder b = data.readStrongBinder();
770 unstableProviderDied(b);
771 reply.writeNoException();
772 return true;
773 }
774
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700775 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
776 data.enforceInterface(IActivityManager.descriptor);
777 IBinder b = data.readStrongBinder();
778 appNotRespondingViaProvider(b);
779 reply.writeNoException();
780 return true;
781 }
782
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800783 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
784 data.enforceInterface(IActivityManager.descriptor);
785 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700786 boolean stable = data.readInt() != 0;
787 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800788 reply.writeNoException();
789 return true;
790 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800791
792 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
793 data.enforceInterface(IActivityManager.descriptor);
794 String name = data.readString();
795 IBinder token = data.readStrongBinder();
796 removeContentProviderExternal(name, token);
797 reply.writeNoException();
798 return true;
799 }
800
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700801 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
802 data.enforceInterface(IActivityManager.descriptor);
803 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
804 PendingIntent pi = getRunningServiceControlPanel(comp);
805 reply.writeNoException();
806 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
807 return true;
808 }
809
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800810 case START_SERVICE_TRANSACTION: {
811 data.enforceInterface(IActivityManager.descriptor);
812 IBinder b = data.readStrongBinder();
813 IApplicationThread app = ApplicationThreadNative.asInterface(b);
814 Intent service = Intent.CREATOR.createFromParcel(data);
815 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700816 int userId = data.readInt();
817 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800818 reply.writeNoException();
819 ComponentName.writeToParcel(cn, reply);
820 return true;
821 }
822
823 case STOP_SERVICE_TRANSACTION: {
824 data.enforceInterface(IActivityManager.descriptor);
825 IBinder b = data.readStrongBinder();
826 IApplicationThread app = ApplicationThreadNative.asInterface(b);
827 Intent service = Intent.CREATOR.createFromParcel(data);
828 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700829 int userId = data.readInt();
830 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800831 reply.writeNoException();
832 reply.writeInt(res);
833 return true;
834 }
835
836 case STOP_SERVICE_TOKEN_TRANSACTION: {
837 data.enforceInterface(IActivityManager.descriptor);
838 ComponentName className = ComponentName.readFromParcel(data);
839 IBinder token = data.readStrongBinder();
840 int startId = data.readInt();
841 boolean res = stopServiceToken(className, token, startId);
842 reply.writeNoException();
843 reply.writeInt(res ? 1 : 0);
844 return true;
845 }
846
847 case SET_SERVICE_FOREGROUND_TRANSACTION: {
848 data.enforceInterface(IActivityManager.descriptor);
849 ComponentName className = ComponentName.readFromParcel(data);
850 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700851 int id = data.readInt();
852 Notification notification = null;
853 if (data.readInt() != 0) {
854 notification = Notification.CREATOR.createFromParcel(data);
855 }
856 boolean removeNotification = data.readInt() != 0;
857 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800858 reply.writeNoException();
859 return true;
860 }
861
862 case BIND_SERVICE_TRANSACTION: {
863 data.enforceInterface(IActivityManager.descriptor);
864 IBinder b = data.readStrongBinder();
865 IApplicationThread app = ApplicationThreadNative.asInterface(b);
866 IBinder token = data.readStrongBinder();
867 Intent service = Intent.CREATOR.createFromParcel(data);
868 String resolvedType = data.readString();
869 b = data.readStrongBinder();
870 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800871 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800872 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800873 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800874 reply.writeNoException();
875 reply.writeInt(res);
876 return true;
877 }
878
879 case UNBIND_SERVICE_TRANSACTION: {
880 data.enforceInterface(IActivityManager.descriptor);
881 IBinder b = data.readStrongBinder();
882 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
883 boolean res = unbindService(conn);
884 reply.writeNoException();
885 reply.writeInt(res ? 1 : 0);
886 return true;
887 }
888
889 case PUBLISH_SERVICE_TRANSACTION: {
890 data.enforceInterface(IActivityManager.descriptor);
891 IBinder token = data.readStrongBinder();
892 Intent intent = Intent.CREATOR.createFromParcel(data);
893 IBinder service = data.readStrongBinder();
894 publishService(token, intent, service);
895 reply.writeNoException();
896 return true;
897 }
898
899 case UNBIND_FINISHED_TRANSACTION: {
900 data.enforceInterface(IActivityManager.descriptor);
901 IBinder token = data.readStrongBinder();
902 Intent intent = Intent.CREATOR.createFromParcel(data);
903 boolean doRebind = data.readInt() != 0;
904 unbindFinished(token, intent, doRebind);
905 reply.writeNoException();
906 return true;
907 }
908
909 case SERVICE_DONE_EXECUTING_TRANSACTION: {
910 data.enforceInterface(IActivityManager.descriptor);
911 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700912 int type = data.readInt();
913 int startId = data.readInt();
914 int res = data.readInt();
915 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800916 reply.writeNoException();
917 return true;
918 }
919
920 case START_INSTRUMENTATION_TRANSACTION: {
921 data.enforceInterface(IActivityManager.descriptor);
922 ComponentName className = ComponentName.readFromParcel(data);
923 String profileFile = data.readString();
924 int fl = data.readInt();
925 Bundle arguments = data.readBundle();
926 IBinder b = data.readStrongBinder();
927 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800928 b = data.readStrongBinder();
929 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700930 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800931 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800932 reply.writeNoException();
933 reply.writeInt(res ? 1 : 0);
934 return true;
935 }
936
937
938 case FINISH_INSTRUMENTATION_TRANSACTION: {
939 data.enforceInterface(IActivityManager.descriptor);
940 IBinder b = data.readStrongBinder();
941 IApplicationThread app = ApplicationThreadNative.asInterface(b);
942 int resultCode = data.readInt();
943 Bundle results = data.readBundle();
944 finishInstrumentation(app, resultCode, results);
945 reply.writeNoException();
946 return true;
947 }
948
949 case GET_CONFIGURATION_TRANSACTION: {
950 data.enforceInterface(IActivityManager.descriptor);
951 Configuration config = getConfiguration();
952 reply.writeNoException();
953 config.writeToParcel(reply, 0);
954 return true;
955 }
956
957 case UPDATE_CONFIGURATION_TRANSACTION: {
958 data.enforceInterface(IActivityManager.descriptor);
959 Configuration config = Configuration.CREATOR.createFromParcel(data);
960 updateConfiguration(config);
961 reply.writeNoException();
962 return true;
963 }
964
965 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
966 data.enforceInterface(IActivityManager.descriptor);
967 IBinder token = data.readStrongBinder();
968 int requestedOrientation = data.readInt();
969 setRequestedOrientation(token, requestedOrientation);
970 reply.writeNoException();
971 return true;
972 }
973
974 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
975 data.enforceInterface(IActivityManager.descriptor);
976 IBinder token = data.readStrongBinder();
977 int req = getRequestedOrientation(token);
978 reply.writeNoException();
979 reply.writeInt(req);
980 return true;
981 }
982
983 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
984 data.enforceInterface(IActivityManager.descriptor);
985 IBinder token = data.readStrongBinder();
986 ComponentName cn = getActivityClassForToken(token);
987 reply.writeNoException();
988 ComponentName.writeToParcel(cn, reply);
989 return true;
990 }
991
992 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
993 data.enforceInterface(IActivityManager.descriptor);
994 IBinder token = data.readStrongBinder();
995 reply.writeNoException();
996 reply.writeString(getPackageForToken(token));
997 return true;
998 }
999
1000 case GET_INTENT_SENDER_TRANSACTION: {
1001 data.enforceInterface(IActivityManager.descriptor);
1002 int type = data.readInt();
1003 String packageName = data.readString();
1004 IBinder token = data.readStrongBinder();
1005 String resultWho = data.readString();
1006 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001007 Intent[] requestIntents;
1008 String[] requestResolvedTypes;
1009 if (data.readInt() != 0) {
1010 requestIntents = data.createTypedArray(Intent.CREATOR);
1011 requestResolvedTypes = data.createStringArray();
1012 } else {
1013 requestIntents = null;
1014 requestResolvedTypes = null;
1015 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001016 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001017 Bundle options = data.readInt() != 0
1018 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001019 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001020 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001021 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001022 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001023 reply.writeNoException();
1024 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1025 return true;
1026 }
1027
1028 case CANCEL_INTENT_SENDER_TRANSACTION: {
1029 data.enforceInterface(IActivityManager.descriptor);
1030 IIntentSender r = IIntentSender.Stub.asInterface(
1031 data.readStrongBinder());
1032 cancelIntentSender(r);
1033 reply.writeNoException();
1034 return true;
1035 }
1036
1037 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1038 data.enforceInterface(IActivityManager.descriptor);
1039 IIntentSender r = IIntentSender.Stub.asInterface(
1040 data.readStrongBinder());
1041 String res = getPackageForIntentSender(r);
1042 reply.writeNoException();
1043 reply.writeString(res);
1044 return true;
1045 }
1046
Christopher Tatec4a07d12012-04-06 14:19:13 -07001047 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1048 data.enforceInterface(IActivityManager.descriptor);
1049 IIntentSender r = IIntentSender.Stub.asInterface(
1050 data.readStrongBinder());
1051 int res = getUidForIntentSender(r);
1052 reply.writeNoException();
1053 reply.writeInt(res);
1054 return true;
1055 }
1056
Dianne Hackborn41203752012-08-31 14:05:51 -07001057 case HANDLE_INCOMING_USER_TRANSACTION: {
1058 data.enforceInterface(IActivityManager.descriptor);
1059 int callingPid = data.readInt();
1060 int callingUid = data.readInt();
1061 int userId = data.readInt();
1062 boolean allowAll = data.readInt() != 0 ;
1063 boolean requireFull = data.readInt() != 0;
1064 String name = data.readString();
1065 String callerPackage = data.readString();
1066 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1067 requireFull, name, callerPackage);
1068 reply.writeNoException();
1069 reply.writeInt(res);
1070 return true;
1071 }
1072
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001073 case SET_PROCESS_LIMIT_TRANSACTION: {
1074 data.enforceInterface(IActivityManager.descriptor);
1075 int max = data.readInt();
1076 setProcessLimit(max);
1077 reply.writeNoException();
1078 return true;
1079 }
1080
1081 case GET_PROCESS_LIMIT_TRANSACTION: {
1082 data.enforceInterface(IActivityManager.descriptor);
1083 int limit = getProcessLimit();
1084 reply.writeNoException();
1085 reply.writeInt(limit);
1086 return true;
1087 }
1088
1089 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1090 data.enforceInterface(IActivityManager.descriptor);
1091 IBinder token = data.readStrongBinder();
1092 int pid = data.readInt();
1093 boolean isForeground = data.readInt() != 0;
1094 setProcessForeground(token, pid, isForeground);
1095 reply.writeNoException();
1096 return true;
1097 }
1098
1099 case CHECK_PERMISSION_TRANSACTION: {
1100 data.enforceInterface(IActivityManager.descriptor);
1101 String perm = data.readString();
1102 int pid = data.readInt();
1103 int uid = data.readInt();
1104 int res = checkPermission(perm, pid, uid);
1105 reply.writeNoException();
1106 reply.writeInt(res);
1107 return true;
1108 }
1109
1110 case CHECK_URI_PERMISSION_TRANSACTION: {
1111 data.enforceInterface(IActivityManager.descriptor);
1112 Uri uri = Uri.CREATOR.createFromParcel(data);
1113 int pid = data.readInt();
1114 int uid = data.readInt();
1115 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001116 int userId = data.readInt();
1117 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001118 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();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001142 int userId = data.readInt();
1143 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001144 reply.writeNoException();
1145 return true;
1146 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001147
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001148 case REVOKE_URI_PERMISSION_TRANSACTION: {
1149 data.enforceInterface(IActivityManager.descriptor);
1150 IBinder b = data.readStrongBinder();
1151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1152 Uri uri = Uri.CREATOR.createFromParcel(data);
1153 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001154 int userId = data.readInt();
1155 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001156 reply.writeNoException();
1157 return true;
1158 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001159
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001160 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 Uri uri = Uri.CREATOR.createFromParcel(data);
1163 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001164 int userId = data.readInt();
1165 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001166 reply.writeNoException();
1167 return true;
1168 }
1169
1170 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1171 data.enforceInterface(IActivityManager.descriptor);
1172 Uri uri = Uri.CREATOR.createFromParcel(data);
1173 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001174 int userId = data.readInt();
1175 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001176 reply.writeNoException();
1177 return true;
1178 }
1179
1180 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1181 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001182 final String packageName = data.readString();
1183 final boolean incoming = data.readInt() != 0;
1184 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1185 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001186 reply.writeNoException();
1187 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1188 return true;
1189 }
1190
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001191 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1192 data.enforceInterface(IActivityManager.descriptor);
1193 IBinder b = data.readStrongBinder();
1194 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1195 boolean waiting = data.readInt() != 0;
1196 showWaitingForDebugger(app, waiting);
1197 reply.writeNoException();
1198 return true;
1199 }
1200
1201 case GET_MEMORY_INFO_TRANSACTION: {
1202 data.enforceInterface(IActivityManager.descriptor);
1203 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1204 getMemoryInfo(mi);
1205 reply.writeNoException();
1206 mi.writeToParcel(reply, 0);
1207 return true;
1208 }
1209
1210 case UNHANDLED_BACK_TRANSACTION: {
1211 data.enforceInterface(IActivityManager.descriptor);
1212 unhandledBack();
1213 reply.writeNoException();
1214 return true;
1215 }
1216
1217 case OPEN_CONTENT_URI_TRANSACTION: {
1218 data.enforceInterface(IActivityManager.descriptor);
1219 Uri uri = Uri.parse(data.readString());
1220 ParcelFileDescriptor pfd = openContentUri(uri);
1221 reply.writeNoException();
1222 if (pfd != null) {
1223 reply.writeInt(1);
1224 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1225 } else {
1226 reply.writeInt(0);
1227 }
1228 return true;
1229 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001230
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001231 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1232 data.enforceInterface(IActivityManager.descriptor);
1233 setLockScreenShown(data.readInt() != 0);
1234 reply.writeNoException();
1235 return true;
1236 }
1237
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001238 case SET_DEBUG_APP_TRANSACTION: {
1239 data.enforceInterface(IActivityManager.descriptor);
1240 String pn = data.readString();
1241 boolean wfd = data.readInt() != 0;
1242 boolean per = data.readInt() != 0;
1243 setDebugApp(pn, wfd, per);
1244 reply.writeNoException();
1245 return true;
1246 }
1247
1248 case SET_ALWAYS_FINISH_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 boolean enabled = data.readInt() != 0;
1251 setAlwaysFinish(enabled);
1252 reply.writeNoException();
1253 return true;
1254 }
1255
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001256 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001257 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001258 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001259 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001260 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001261 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001262 return true;
1263 }
1264
1265 case ENTER_SAFE_MODE_TRANSACTION: {
1266 data.enforceInterface(IActivityManager.descriptor);
1267 enterSafeMode();
1268 reply.writeNoException();
1269 return true;
1270 }
1271
1272 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1273 data.enforceInterface(IActivityManager.descriptor);
1274 IIntentSender is = IIntentSender.Stub.asInterface(
1275 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001276 int sourceUid = data.readInt();
1277 String sourcePkg = data.readString();
1278 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001279 reply.writeNoException();
1280 return true;
1281 }
1282
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001283 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001284 data.enforceInterface(IActivityManager.descriptor);
1285 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001286 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001287 boolean secure = data.readInt() != 0;
1288 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001289 reply.writeNoException();
1290 reply.writeInt(res ? 1 : 0);
1291 return true;
1292 }
1293
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001294 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1295 data.enforceInterface(IActivityManager.descriptor);
1296 String reason = data.readString();
1297 boolean res = killProcessesBelowForeground(reason);
1298 reply.writeNoException();
1299 reply.writeInt(res ? 1 : 0);
1300 return true;
1301 }
1302
Dan Egnor60d87622009-12-16 16:32:58 -08001303 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1304 data.enforceInterface(IActivityManager.descriptor);
1305 IBinder app = data.readStrongBinder();
1306 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1307 handleApplicationCrash(app, ci);
1308 reply.writeNoException();
1309 return true;
1310 }
1311
1312 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001313 data.enforceInterface(IActivityManager.descriptor);
1314 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001315 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001316 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001317 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001318 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001319 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001320 return true;
1321 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001322
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001323 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1324 data.enforceInterface(IActivityManager.descriptor);
1325 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001326 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001327 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1328 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001329 reply.writeNoException();
1330 return true;
1331 }
1332
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001333 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1334 data.enforceInterface(IActivityManager.descriptor);
1335 int sig = data.readInt();
1336 signalPersistentProcesses(sig);
1337 reply.writeNoException();
1338 return true;
1339 }
1340
Dianne Hackborn03abb812010-01-04 18:43:19 -08001341 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1342 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001343 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001344 int userId = data.readInt();
1345 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001346 reply.writeNoException();
1347 return true;
1348 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001349
1350 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1351 data.enforceInterface(IActivityManager.descriptor);
1352 killAllBackgroundProcesses();
1353 reply.writeNoException();
1354 return true;
1355 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001356
Dianne Hackborn03abb812010-01-04 18:43:19 -08001357 case FORCE_STOP_PACKAGE_TRANSACTION: {
1358 data.enforceInterface(IActivityManager.descriptor);
1359 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001360 int userId = data.readInt();
1361 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001362 reply.writeNoException();
1363 return true;
1364 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001365
1366 case GET_MY_MEMORY_STATE_TRANSACTION: {
1367 data.enforceInterface(IActivityManager.descriptor);
1368 ActivityManager.RunningAppProcessInfo info =
1369 new ActivityManager.RunningAppProcessInfo();
1370 getMyMemoryState(info);
1371 reply.writeNoException();
1372 info.writeToParcel(reply, 0);
1373 return true;
1374 }
1375
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001376 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1377 data.enforceInterface(IActivityManager.descriptor);
1378 ConfigurationInfo config = getDeviceConfigurationInfo();
1379 reply.writeNoException();
1380 config.writeToParcel(reply, 0);
1381 return true;
1382 }
1383
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001384 case PROFILE_CONTROL_TRANSACTION: {
1385 data.enforceInterface(IActivityManager.descriptor);
1386 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001387 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001388 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001389 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001390 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001391 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001392 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001393 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001394 reply.writeNoException();
1395 reply.writeInt(res ? 1 : 0);
1396 return true;
1397 }
1398
Dianne Hackborn55280a92009-05-07 15:53:46 -07001399 case SHUTDOWN_TRANSACTION: {
1400 data.enforceInterface(IActivityManager.descriptor);
1401 boolean res = shutdown(data.readInt());
1402 reply.writeNoException();
1403 reply.writeInt(res ? 1 : 0);
1404 return true;
1405 }
1406
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001407 case STOP_APP_SWITCHES_TRANSACTION: {
1408 data.enforceInterface(IActivityManager.descriptor);
1409 stopAppSwitches();
1410 reply.writeNoException();
1411 return true;
1412 }
1413
1414 case RESUME_APP_SWITCHES_TRANSACTION: {
1415 data.enforceInterface(IActivityManager.descriptor);
1416 resumeAppSwitches();
1417 reply.writeNoException();
1418 return true;
1419 }
1420
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001421 case PEEK_SERVICE_TRANSACTION: {
1422 data.enforceInterface(IActivityManager.descriptor);
1423 Intent service = Intent.CREATOR.createFromParcel(data);
1424 String resolvedType = data.readString();
1425 IBinder binder = peekService(service, resolvedType);
1426 reply.writeNoException();
1427 reply.writeStrongBinder(binder);
1428 return true;
1429 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001430
1431 case START_BACKUP_AGENT_TRANSACTION: {
1432 data.enforceInterface(IActivityManager.descriptor);
1433 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1434 int backupRestoreMode = data.readInt();
1435 boolean success = bindBackupAgent(info, backupRestoreMode);
1436 reply.writeNoException();
1437 reply.writeInt(success ? 1 : 0);
1438 return true;
1439 }
1440
1441 case BACKUP_AGENT_CREATED_TRANSACTION: {
1442 data.enforceInterface(IActivityManager.descriptor);
1443 String packageName = data.readString();
1444 IBinder agent = data.readStrongBinder();
1445 backupAgentCreated(packageName, agent);
1446 reply.writeNoException();
1447 return true;
1448 }
1449
1450 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1451 data.enforceInterface(IActivityManager.descriptor);
1452 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1453 unbindBackupAgent(info);
1454 reply.writeNoException();
1455 return true;
1456 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001457
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001458 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001459 data.enforceInterface(IActivityManager.descriptor);
1460 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001461 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001462 String reason = data.readString();
1463 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001464 reply.writeNoException();
1465 return true;
1466 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001467
1468 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1469 data.enforceInterface(IActivityManager.descriptor);
1470 String reason = data.readString();
1471 closeSystemDialogs(reason);
1472 reply.writeNoException();
1473 return true;
1474 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001475
1476 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1477 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001478 int[] pids = data.createIntArray();
1479 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001480 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001481 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001482 return true;
1483 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001484
1485 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 String processName = data.readString();
1488 int uid = data.readInt();
1489 killApplicationProcess(processName, uid);
1490 reply.writeNoException();
1491 return true;
1492 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001493
1494 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1495 data.enforceInterface(IActivityManager.descriptor);
1496 IBinder token = data.readStrongBinder();
1497 String packageName = data.readString();
1498 int enterAnim = data.readInt();
1499 int exitAnim = data.readInt();
1500 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001501 reply.writeNoException();
1502 return true;
1503 }
1504
1505 case IS_USER_A_MONKEY_TRANSACTION: {
1506 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001507 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001508 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001509 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001510 return true;
1511 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001512
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001513 case SET_USER_IS_MONKEY_TRANSACTION: {
1514 data.enforceInterface(IActivityManager.descriptor);
1515 final boolean monkey = (data.readInt() == 1);
1516 setUserIsMonkey(monkey);
1517 reply.writeNoException();
1518 return true;
1519 }
1520
Dianne Hackborn860755f2010-06-03 18:47:52 -07001521 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1522 data.enforceInterface(IActivityManager.descriptor);
1523 finishHeavyWeightApp();
1524 reply.writeNoException();
1525 return true;
1526 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001527
1528 case IS_IMMERSIVE_TRANSACTION: {
1529 data.enforceInterface(IActivityManager.descriptor);
1530 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001531 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001532 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001533 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001534 return true;
1535 }
1536
Craig Mautner5eda9b32013-07-02 11:58:16 -07001537 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001538 data.enforceInterface(IActivityManager.descriptor);
1539 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001540 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001541 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001542 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001543 return true;
1544 }
1545
1546 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1547 data.enforceInterface(IActivityManager.descriptor);
1548 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001549 boolean converted = convertToTranslucent(token);
Craig Mautner4addfc52013-06-25 08:05:45 -07001550 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001551 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001552 return true;
1553 }
1554
Daniel Sandler69a48172010-06-23 16:29:36 -04001555 case SET_IMMERSIVE_TRANSACTION: {
1556 data.enforceInterface(IActivityManager.descriptor);
1557 IBinder token = data.readStrongBinder();
1558 boolean imm = data.readInt() == 1;
1559 setImmersive(token, imm);
1560 reply.writeNoException();
1561 return true;
1562 }
1563
1564 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1565 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001566 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001567 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001568 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001569 return true;
1570 }
1571
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001572 case CRASH_APPLICATION_TRANSACTION: {
1573 data.enforceInterface(IActivityManager.descriptor);
1574 int uid = data.readInt();
1575 int initialPid = data.readInt();
1576 String packageName = data.readString();
1577 String message = data.readString();
1578 crashApplication(uid, initialPid, packageName, message);
1579 reply.writeNoException();
1580 return true;
1581 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001582
1583 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001586 int userId = data.readInt();
1587 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001588 reply.writeNoException();
1589 reply.writeString(type);
1590 return true;
1591 }
1592
Dianne Hackborn7e269642010-08-25 19:50:20 -07001593 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1594 data.enforceInterface(IActivityManager.descriptor);
1595 String name = data.readString();
1596 IBinder perm = newUriPermissionOwner(name);
1597 reply.writeNoException();
1598 reply.writeStrongBinder(perm);
1599 return true;
1600 }
1601
1602 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1603 data.enforceInterface(IActivityManager.descriptor);
1604 IBinder owner = data.readStrongBinder();
1605 int fromUid = data.readInt();
1606 String targetPkg = data.readString();
1607 Uri uri = Uri.CREATOR.createFromParcel(data);
1608 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001609 int userId = data.readInt();
1610 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001611 reply.writeNoException();
1612 return true;
1613 }
1614
1615 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1616 data.enforceInterface(IActivityManager.descriptor);
1617 IBinder owner = data.readStrongBinder();
1618 Uri uri = null;
1619 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001620 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001621 }
1622 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001623 int userId = data.readInt();
1624 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001625 reply.writeNoException();
1626 return true;
1627 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001628
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001629 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1630 data.enforceInterface(IActivityManager.descriptor);
1631 int callingUid = data.readInt();
1632 String targetPkg = data.readString();
1633 Uri uri = Uri.CREATOR.createFromParcel(data);
1634 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001635 int userId = data.readInt();
1636 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001637 reply.writeNoException();
1638 reply.writeInt(res);
1639 return true;
1640 }
1641
Andy McFadden824c5102010-07-09 16:26:57 -07001642 case DUMP_HEAP_TRANSACTION: {
1643 data.enforceInterface(IActivityManager.descriptor);
1644 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001645 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001646 boolean managed = data.readInt() != 0;
1647 String path = data.readString();
1648 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001649 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001650 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001651 reply.writeNoException();
1652 reply.writeInt(res ? 1 : 0);
1653 return true;
1654 }
1655
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001656 case START_ACTIVITIES_TRANSACTION:
1657 {
1658 data.enforceInterface(IActivityManager.descriptor);
1659 IBinder b = data.readStrongBinder();
1660 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001661 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001662 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1663 String[] resolvedTypes = data.createStringArray();
1664 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001665 Bundle options = data.readInt() != 0
1666 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001667 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001668 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001669 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001670 reply.writeNoException();
1671 reply.writeInt(result);
1672 return true;
1673 }
1674
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001675 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1676 {
1677 data.enforceInterface(IActivityManager.descriptor);
1678 int mode = getFrontActivityScreenCompatMode();
1679 reply.writeNoException();
1680 reply.writeInt(mode);
1681 return true;
1682 }
1683
1684 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1685 {
1686 data.enforceInterface(IActivityManager.descriptor);
1687 int mode = data.readInt();
1688 setFrontActivityScreenCompatMode(mode);
1689 reply.writeNoException();
1690 reply.writeInt(mode);
1691 return true;
1692 }
1693
1694 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1695 {
1696 data.enforceInterface(IActivityManager.descriptor);
1697 String pkg = data.readString();
1698 int mode = getPackageScreenCompatMode(pkg);
1699 reply.writeNoException();
1700 reply.writeInt(mode);
1701 return true;
1702 }
1703
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001704 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1705 {
1706 data.enforceInterface(IActivityManager.descriptor);
1707 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001708 int mode = data.readInt();
1709 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001710 reply.writeNoException();
1711 return true;
1712 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001713
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001714 case SWITCH_USER_TRANSACTION: {
1715 data.enforceInterface(IActivityManager.descriptor);
1716 int userid = data.readInt();
1717 boolean result = switchUser(userid);
1718 reply.writeNoException();
1719 reply.writeInt(result ? 1 : 0);
1720 return true;
1721 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001722
Kenny Guy08488bf2014-02-21 17:40:37 +00001723 case START_USER_IN_BACKGROUND_TRANSACTION: {
1724 data.enforceInterface(IActivityManager.descriptor);
1725 int userid = data.readInt();
1726 boolean result = startUserInBackground(userid);
1727 reply.writeNoException();
1728 reply.writeInt(result ? 1 : 0);
1729 return true;
1730 }
1731
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001732 case STOP_USER_TRANSACTION: {
1733 data.enforceInterface(IActivityManager.descriptor);
1734 int userid = data.readInt();
1735 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1736 data.readStrongBinder());
1737 int result = stopUser(userid, callback);
1738 reply.writeNoException();
1739 reply.writeInt(result);
1740 return true;
1741 }
1742
Amith Yamasani52f1d752012-03-28 18:19:29 -07001743 case GET_CURRENT_USER_TRANSACTION: {
1744 data.enforceInterface(IActivityManager.descriptor);
1745 UserInfo userInfo = getCurrentUser();
1746 reply.writeNoException();
1747 userInfo.writeToParcel(reply, 0);
1748 return true;
1749 }
1750
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001751 case IS_USER_RUNNING_TRANSACTION: {
1752 data.enforceInterface(IActivityManager.descriptor);
1753 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001754 boolean orStopping = data.readInt() != 0;
1755 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001756 reply.writeNoException();
1757 reply.writeInt(result ? 1 : 0);
1758 return true;
1759 }
1760
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001761 case GET_RUNNING_USER_IDS_TRANSACTION: {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 int[] result = getRunningUserIds();
1764 reply.writeNoException();
1765 reply.writeIntArray(result);
1766 return true;
1767 }
1768
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001769 case REMOVE_SUB_TASK_TRANSACTION:
1770 {
1771 data.enforceInterface(IActivityManager.descriptor);
1772 int taskId = data.readInt();
1773 int subTaskIndex = data.readInt();
1774 boolean result = removeSubTask(taskId, subTaskIndex);
1775 reply.writeNoException();
1776 reply.writeInt(result ? 1 : 0);
1777 return true;
1778 }
1779
1780 case REMOVE_TASK_TRANSACTION:
1781 {
1782 data.enforceInterface(IActivityManager.descriptor);
1783 int taskId = data.readInt();
1784 int fl = data.readInt();
1785 boolean result = removeTask(taskId, fl);
1786 reply.writeNoException();
1787 reply.writeInt(result ? 1 : 0);
1788 return true;
1789 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001790
Jeff Sharkeya4620792011-05-20 15:29:23 -07001791 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1792 data.enforceInterface(IActivityManager.descriptor);
1793 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1794 data.readStrongBinder());
1795 registerProcessObserver(observer);
1796 return true;
1797 }
1798
1799 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1800 data.enforceInterface(IActivityManager.descriptor);
1801 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1802 data.readStrongBinder());
1803 unregisterProcessObserver(observer);
1804 return true;
1805 }
1806
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001807 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1808 {
1809 data.enforceInterface(IActivityManager.descriptor);
1810 String pkg = data.readString();
1811 boolean ask = getPackageAskScreenCompat(pkg);
1812 reply.writeNoException();
1813 reply.writeInt(ask ? 1 : 0);
1814 return true;
1815 }
1816
1817 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1818 {
1819 data.enforceInterface(IActivityManager.descriptor);
1820 String pkg = data.readString();
1821 boolean ask = data.readInt() != 0;
1822 setPackageAskScreenCompat(pkg, ask);
1823 reply.writeNoException();
1824 return true;
1825 }
1826
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001827 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1828 data.enforceInterface(IActivityManager.descriptor);
1829 IIntentSender r = IIntentSender.Stub.asInterface(
1830 data.readStrongBinder());
1831 boolean res = isIntentSenderTargetedToPackage(r);
1832 reply.writeNoException();
1833 reply.writeInt(res ? 1 : 0);
1834 return true;
1835 }
1836
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001837 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1838 data.enforceInterface(IActivityManager.descriptor);
1839 IIntentSender r = IIntentSender.Stub.asInterface(
1840 data.readStrongBinder());
1841 boolean res = isIntentSenderAnActivity(r);
1842 reply.writeNoException();
1843 reply.writeInt(res ? 1 : 0);
1844 return true;
1845 }
1846
Dianne Hackborn81038902012-11-26 17:04:09 -08001847 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1848 data.enforceInterface(IActivityManager.descriptor);
1849 IIntentSender r = IIntentSender.Stub.asInterface(
1850 data.readStrongBinder());
1851 Intent intent = getIntentForIntentSender(r);
1852 reply.writeNoException();
1853 if (intent != null) {
1854 reply.writeInt(1);
1855 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1856 } else {
1857 reply.writeInt(0);
1858 }
1859 return true;
1860 }
1861
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001862 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1863 data.enforceInterface(IActivityManager.descriptor);
1864 IIntentSender r = IIntentSender.Stub.asInterface(
1865 data.readStrongBinder());
1866 String prefix = data.readString();
1867 String tag = getTagForIntentSender(r, prefix);
1868 reply.writeNoException();
1869 reply.writeString(tag);
1870 return true;
1871 }
1872
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001873 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1874 data.enforceInterface(IActivityManager.descriptor);
1875 Configuration config = Configuration.CREATOR.createFromParcel(data);
1876 updatePersistentConfiguration(config);
1877 reply.writeNoException();
1878 return true;
1879 }
1880
Dianne Hackbornb437e092011-08-05 17:50:29 -07001881 case GET_PROCESS_PSS_TRANSACTION: {
1882 data.enforceInterface(IActivityManager.descriptor);
1883 int[] pids = data.createIntArray();
1884 long[] pss = getProcessPss(pids);
1885 reply.writeNoException();
1886 reply.writeLongArray(pss);
1887 return true;
1888 }
1889
Dianne Hackborn661cd522011-08-22 00:26:20 -07001890 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1891 data.enforceInterface(IActivityManager.descriptor);
1892 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1893 boolean always = data.readInt() != 0;
1894 showBootMessage(msg, always);
1895 reply.writeNoException();
1896 return true;
1897 }
1898
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001899 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1900 data.enforceInterface(IActivityManager.descriptor);
1901 dismissKeyguardOnNextActivity();
1902 reply.writeNoException();
1903 return true;
1904 }
1905
Adam Powelldd8fab22012-03-22 17:47:27 -07001906 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1907 data.enforceInterface(IActivityManager.descriptor);
1908 IBinder token = data.readStrongBinder();
1909 String destAffinity = data.readString();
1910 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1911 reply.writeNoException();
1912 reply.writeInt(res ? 1 : 0);
1913 return true;
1914 }
1915
1916 case NAVIGATE_UP_TO_TRANSACTION: {
1917 data.enforceInterface(IActivityManager.descriptor);
1918 IBinder token = data.readStrongBinder();
1919 Intent target = Intent.CREATOR.createFromParcel(data);
1920 int resultCode = data.readInt();
1921 Intent resultData = null;
1922 if (data.readInt() != 0) {
1923 resultData = Intent.CREATOR.createFromParcel(data);
1924 }
1925 boolean res = navigateUpTo(token, target, resultCode, resultData);
1926 reply.writeNoException();
1927 reply.writeInt(res ? 1 : 0);
1928 return true;
1929 }
1930
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001931 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1932 data.enforceInterface(IActivityManager.descriptor);
1933 IBinder token = data.readStrongBinder();
1934 int res = getLaunchedFromUid(token);
1935 reply.writeNoException();
1936 reply.writeInt(res);
1937 return true;
1938 }
1939
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001940 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1941 data.enforceInterface(IActivityManager.descriptor);
1942 IBinder token = data.readStrongBinder();
1943 String res = getLaunchedFromPackage(token);
1944 reply.writeNoException();
1945 reply.writeString(res);
1946 return true;
1947 }
1948
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001949 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1950 data.enforceInterface(IActivityManager.descriptor);
1951 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1952 data.readStrongBinder());
1953 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001954 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001955 return true;
1956 }
1957
1958 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1959 data.enforceInterface(IActivityManager.descriptor);
1960 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1961 data.readStrongBinder());
1962 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001963 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001964 return true;
1965 }
1966
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001967 case REQUEST_BUG_REPORT_TRANSACTION: {
1968 data.enforceInterface(IActivityManager.descriptor);
1969 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001970 reply.writeNoException();
1971 return true;
1972 }
1973
1974 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1975 data.enforceInterface(IActivityManager.descriptor);
1976 int pid = data.readInt();
1977 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07001978 String reason = data.readString();
1979 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001980 reply.writeNoException();
1981 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001982 return true;
1983 }
1984
Adam Skorydfc7fd72013-08-05 19:23:41 -07001985 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001986 data.enforceInterface(IActivityManager.descriptor);
1987 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07001988 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001989 reply.writeNoException();
1990 reply.writeBundle(res);
1991 return true;
1992 }
1993
Adam Skorydfc7fd72013-08-05 19:23:41 -07001994 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001995 data.enforceInterface(IActivityManager.descriptor);
1996 IBinder token = data.readStrongBinder();
1997 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01001998 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001999 reply.writeNoException();
2000 return true;
2001 }
2002
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002003 case KILL_UID_TRANSACTION: {
2004 data.enforceInterface(IActivityManager.descriptor);
2005 int uid = data.readInt();
2006 String reason = data.readString();
2007 killUid(uid, reason);
2008 reply.writeNoException();
2009 return true;
2010 }
2011
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002012 case HANG_TRANSACTION: {
2013 data.enforceInterface(IActivityManager.descriptor);
2014 IBinder who = data.readStrongBinder();
2015 boolean allowRestart = data.readInt() != 0;
2016 hang(who, allowRestart);
2017 reply.writeNoException();
2018 return true;
2019 }
2020
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002021 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2022 data.enforceInterface(IActivityManager.descriptor);
2023 IBinder token = data.readStrongBinder();
2024 reportActivityFullyDrawn(token);
2025 reply.writeNoException();
2026 return true;
2027 }
2028
Craig Mautner5eda9b32013-07-02 11:58:16 -07002029 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2030 data.enforceInterface(IActivityManager.descriptor);
2031 IBinder token = data.readStrongBinder();
2032 notifyActivityDrawn(token);
2033 reply.writeNoException();
2034 return true;
2035 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002036
2037 case RESTART_TRANSACTION: {
2038 data.enforceInterface(IActivityManager.descriptor);
2039 restart();
2040 reply.writeNoException();
2041 return true;
2042 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002043
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002044 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2045 data.enforceInterface(IActivityManager.descriptor);
2046 performIdleMaintenance();
2047 reply.writeNoException();
2048 return true;
2049 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002050
2051 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2052 data.enforceInterface(IActivityManager.descriptor);
2053 IBinder parentActivityToken = data.readStrongBinder();
2054 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002055 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002056 IActivityContainer activityContainer =
2057 createActivityContainer(parentActivityToken, callback);
2058 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002059 if (activityContainer != null) {
2060 reply.writeInt(1);
2061 reply.writeStrongBinder(activityContainer.asBinder());
2062 } else {
2063 reply.writeInt(0);
2064 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002065 return true;
2066 }
2067
Craig Mautner95da1082014-02-24 17:54:35 -08002068 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2069 data.enforceInterface(IActivityManager.descriptor);
2070 IActivityContainer activityContainer =
2071 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2072 deleteActivityContainer(activityContainer);
2073 reply.writeNoException();
2074 return true;
2075 }
2076
Craig Mautnere0a38842013-12-16 16:14:02 -08002077 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2078 data.enforceInterface(IActivityManager.descriptor);
2079 IBinder activityToken = data.readStrongBinder();
2080 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2081 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002082 if (activityContainer != null) {
2083 reply.writeInt(1);
2084 reply.writeStrongBinder(activityContainer.asBinder());
2085 } else {
2086 reply.writeInt(0);
2087 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002088 return true;
2089 }
2090
Craig Mautner4a1cb222013-12-04 16:14:06 -08002091 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2092 data.enforceInterface(IActivityManager.descriptor);
2093 IBinder homeActivityToken = getHomeActivityToken();
2094 reply.writeNoException();
2095 reply.writeStrongBinder(homeActivityToken);
2096 return true;
2097 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002098
2099 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2100 data.enforceInterface(IActivityManager.descriptor);
2101 final int taskId = data.readInt();
2102 startLockTaskMode(taskId);
2103 reply.writeNoException();
2104 return true;
2105 }
2106
2107 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2108 data.enforceInterface(IActivityManager.descriptor);
2109 IBinder token = data.readStrongBinder();
2110 startLockTaskMode(token);
2111 reply.writeNoException();
2112 return true;
2113 }
2114
2115 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2116 data.enforceInterface(IActivityManager.descriptor);
2117 stopLockTaskMode();
2118 reply.writeNoException();
2119 return true;
2120 }
2121
2122 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2123 data.enforceInterface(IActivityManager.descriptor);
2124 final boolean isInLockTaskMode = isInLockTaskMode();
2125 reply.writeNoException();
2126 reply.writeInt(isInLockTaskMode ? 1 : 0);
2127 return true;
2128 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002129
Winson Chung03a9bae2014-05-02 09:56:12 -07002130 case SET_RECENTS_ACTIVITY_VALUES_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002131 data.enforceInterface(IActivityManager.descriptor);
2132 IBinder token = data.readStrongBinder();
Winson Chung03a9bae2014-05-02 09:56:12 -07002133 ActivityManager.RecentsActivityValues values =
2134 ActivityManager.RecentsActivityValues.CREATOR.createFromParcel(data);
2135 setRecentsActivityValues(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002136 reply.writeNoException();
2137 return true;
2138 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002139 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002140
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002141 return super.onTransact(code, data, reply, flags);
2142 }
2143
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002144 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002145 return this;
2146 }
2147
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002148 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2149 protected IActivityManager create() {
2150 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002151 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002152 Log.v("ActivityManager", "default service binder = " + b);
2153 }
2154 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002155 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002156 Log.v("ActivityManager", "default service = " + am);
2157 }
2158 return am;
2159 }
2160 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002161}
2162
2163class ActivityManagerProxy implements IActivityManager
2164{
2165 public ActivityManagerProxy(IBinder remote)
2166 {
2167 mRemote = remote;
2168 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002169
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002170 public IBinder asBinder()
2171 {
2172 return mRemote;
2173 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002174
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002175 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002176 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2177 int startFlags, String profileFile,
2178 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002179 Parcel data = Parcel.obtain();
2180 Parcel reply = Parcel.obtain();
2181 data.writeInterfaceToken(IActivityManager.descriptor);
2182 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002183 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002184 intent.writeToParcel(data, 0);
2185 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002186 data.writeStrongBinder(resultTo);
2187 data.writeString(resultWho);
2188 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002189 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002190 data.writeString(profileFile);
2191 if (profileFd != null) {
2192 data.writeInt(1);
2193 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2194 } else {
2195 data.writeInt(0);
2196 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002197 if (options != null) {
2198 data.writeInt(1);
2199 options.writeToParcel(data, 0);
2200 } else {
2201 data.writeInt(0);
2202 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002203 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2204 reply.readException();
2205 int result = reply.readInt();
2206 reply.recycle();
2207 data.recycle();
2208 return result;
2209 }
Amith Yamasani82644082012-08-03 13:09:11 -07002210
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002211 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002212 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2213 int startFlags, String profileFile,
2214 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2215 Parcel data = Parcel.obtain();
2216 Parcel reply = Parcel.obtain();
2217 data.writeInterfaceToken(IActivityManager.descriptor);
2218 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002219 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002220 intent.writeToParcel(data, 0);
2221 data.writeString(resolvedType);
2222 data.writeStrongBinder(resultTo);
2223 data.writeString(resultWho);
2224 data.writeInt(requestCode);
2225 data.writeInt(startFlags);
2226 data.writeString(profileFile);
2227 if (profileFd != null) {
2228 data.writeInt(1);
2229 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2230 } else {
2231 data.writeInt(0);
2232 }
2233 if (options != null) {
2234 data.writeInt(1);
2235 options.writeToParcel(data, 0);
2236 } else {
2237 data.writeInt(0);
2238 }
2239 data.writeInt(userId);
2240 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2241 reply.readException();
2242 int result = reply.readInt();
2243 reply.recycle();
2244 data.recycle();
2245 return result;
2246 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002247 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2248 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002249 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002250 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002251 Parcel data = Parcel.obtain();
2252 Parcel reply = Parcel.obtain();
2253 data.writeInterfaceToken(IActivityManager.descriptor);
2254 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002255 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002256 intent.writeToParcel(data, 0);
2257 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002258 data.writeStrongBinder(resultTo);
2259 data.writeString(resultWho);
2260 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002261 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002262 data.writeString(profileFile);
2263 if (profileFd != null) {
2264 data.writeInt(1);
2265 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2266 } else {
2267 data.writeInt(0);
2268 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002269 if (options != null) {
2270 data.writeInt(1);
2271 options.writeToParcel(data, 0);
2272 } else {
2273 data.writeInt(0);
2274 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002275 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002276 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2277 reply.readException();
2278 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2279 reply.recycle();
2280 data.recycle();
2281 return result;
2282 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002283 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2284 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002285 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002286 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002287 Parcel data = Parcel.obtain();
2288 Parcel reply = Parcel.obtain();
2289 data.writeInterfaceToken(IActivityManager.descriptor);
2290 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002291 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002292 intent.writeToParcel(data, 0);
2293 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002294 data.writeStrongBinder(resultTo);
2295 data.writeString(resultWho);
2296 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002297 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002298 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002299 if (options != null) {
2300 data.writeInt(1);
2301 options.writeToParcel(data, 0);
2302 } else {
2303 data.writeInt(0);
2304 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002305 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002306 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2307 reply.readException();
2308 int result = reply.readInt();
2309 reply.recycle();
2310 data.recycle();
2311 return result;
2312 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002313 public int startActivityIntentSender(IApplicationThread caller,
2314 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002315 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002316 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002317 Parcel data = Parcel.obtain();
2318 Parcel reply = Parcel.obtain();
2319 data.writeInterfaceToken(IActivityManager.descriptor);
2320 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2321 intent.writeToParcel(data, 0);
2322 if (fillInIntent != null) {
2323 data.writeInt(1);
2324 fillInIntent.writeToParcel(data, 0);
2325 } else {
2326 data.writeInt(0);
2327 }
2328 data.writeString(resolvedType);
2329 data.writeStrongBinder(resultTo);
2330 data.writeString(resultWho);
2331 data.writeInt(requestCode);
2332 data.writeInt(flagsMask);
2333 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002334 if (options != null) {
2335 data.writeInt(1);
2336 options.writeToParcel(data, 0);
2337 } else {
2338 data.writeInt(0);
2339 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002340 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002341 reply.readException();
2342 int result = reply.readInt();
2343 reply.recycle();
2344 data.recycle();
2345 return result;
2346 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002347 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2348 Intent intent, String resolvedType, IVoiceInteractionSession session,
2349 IVoiceInteractor interactor, int startFlags, String profileFile,
2350 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2351 Parcel data = Parcel.obtain();
2352 Parcel reply = Parcel.obtain();
2353 data.writeInterfaceToken(IActivityManager.descriptor);
2354 data.writeString(callingPackage);
2355 data.writeInt(callingPid);
2356 data.writeInt(callingUid);
2357 intent.writeToParcel(data, 0);
2358 data.writeString(resolvedType);
2359 data.writeStrongBinder(session.asBinder());
2360 data.writeStrongBinder(interactor.asBinder());
2361 data.writeInt(startFlags);
2362 data.writeString(profileFile);
2363 if (profileFd != null) {
2364 data.writeInt(1);
2365 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2366 } else {
2367 data.writeInt(0);
2368 }
2369 if (options != null) {
2370 data.writeInt(1);
2371 options.writeToParcel(data, 0);
2372 } else {
2373 data.writeInt(0);
2374 }
2375 data.writeInt(userId);
2376 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2377 reply.readException();
2378 int result = reply.readInt();
2379 reply.recycle();
2380 data.recycle();
2381 return result;
2382 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002383 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002384 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002385 Parcel data = Parcel.obtain();
2386 Parcel reply = Parcel.obtain();
2387 data.writeInterfaceToken(IActivityManager.descriptor);
2388 data.writeStrongBinder(callingActivity);
2389 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002390 if (options != null) {
2391 data.writeInt(1);
2392 options.writeToParcel(data, 0);
2393 } else {
2394 data.writeInt(0);
2395 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002396 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2397 reply.readException();
2398 int result = reply.readInt();
2399 reply.recycle();
2400 data.recycle();
2401 return result != 0;
2402 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002403 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002404 throws RemoteException {
2405 Parcel data = Parcel.obtain();
2406 Parcel reply = Parcel.obtain();
2407 data.writeInterfaceToken(IActivityManager.descriptor);
2408 data.writeStrongBinder(token);
2409 data.writeInt(resultCode);
2410 if (resultData != null) {
2411 data.writeInt(1);
2412 resultData.writeToParcel(data, 0);
2413 } else {
2414 data.writeInt(0);
2415 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002416 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002417 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2418 reply.readException();
2419 boolean res = reply.readInt() != 0;
2420 data.recycle();
2421 reply.recycle();
2422 return res;
2423 }
2424 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2425 {
2426 Parcel data = Parcel.obtain();
2427 Parcel reply = Parcel.obtain();
2428 data.writeInterfaceToken(IActivityManager.descriptor);
2429 data.writeStrongBinder(token);
2430 data.writeString(resultWho);
2431 data.writeInt(requestCode);
2432 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2433 reply.readException();
2434 data.recycle();
2435 reply.recycle();
2436 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002437 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2438 Parcel data = Parcel.obtain();
2439 Parcel reply = Parcel.obtain();
2440 data.writeInterfaceToken(IActivityManager.descriptor);
2441 data.writeStrongBinder(token);
2442 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2443 reply.readException();
2444 boolean res = reply.readInt() != 0;
2445 data.recycle();
2446 reply.recycle();
2447 return res;
2448 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002449 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2450 Parcel data = Parcel.obtain();
2451 Parcel reply = Parcel.obtain();
2452 data.writeInterfaceToken(IActivityManager.descriptor);
2453 data.writeStrongBinder(token);
2454 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2455 reply.readException();
2456 boolean res = reply.readInt() != 0;
2457 data.recycle();
2458 reply.recycle();
2459 return res;
2460 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002461 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002462 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002463 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002464 {
2465 Parcel data = Parcel.obtain();
2466 Parcel reply = Parcel.obtain();
2467 data.writeInterfaceToken(IActivityManager.descriptor);
2468 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002469 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002470 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2471 filter.writeToParcel(data, 0);
2472 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002473 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002474 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2475 reply.readException();
2476 Intent intent = null;
2477 int haveIntent = reply.readInt();
2478 if (haveIntent != 0) {
2479 intent = Intent.CREATOR.createFromParcel(reply);
2480 }
2481 reply.recycle();
2482 data.recycle();
2483 return intent;
2484 }
2485 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2486 {
2487 Parcel data = Parcel.obtain();
2488 Parcel reply = Parcel.obtain();
2489 data.writeInterfaceToken(IActivityManager.descriptor);
2490 data.writeStrongBinder(receiver.asBinder());
2491 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2492 reply.readException();
2493 data.recycle();
2494 reply.recycle();
2495 }
2496 public int broadcastIntent(IApplicationThread caller,
2497 Intent intent, String resolvedType, IIntentReceiver resultTo,
2498 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002499 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002500 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002501 {
2502 Parcel data = Parcel.obtain();
2503 Parcel reply = Parcel.obtain();
2504 data.writeInterfaceToken(IActivityManager.descriptor);
2505 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2506 intent.writeToParcel(data, 0);
2507 data.writeString(resolvedType);
2508 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2509 data.writeInt(resultCode);
2510 data.writeString(resultData);
2511 data.writeBundle(map);
2512 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002513 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002514 data.writeInt(serialized ? 1 : 0);
2515 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002516 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002517 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2518 reply.readException();
2519 int res = reply.readInt();
2520 reply.recycle();
2521 data.recycle();
2522 return res;
2523 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002524 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2525 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002526 {
2527 Parcel data = Parcel.obtain();
2528 Parcel reply = Parcel.obtain();
2529 data.writeInterfaceToken(IActivityManager.descriptor);
2530 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2531 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002532 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002533 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2534 reply.readException();
2535 data.recycle();
2536 reply.recycle();
2537 }
2538 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2539 {
2540 Parcel data = Parcel.obtain();
2541 Parcel reply = Parcel.obtain();
2542 data.writeInterfaceToken(IActivityManager.descriptor);
2543 data.writeStrongBinder(who);
2544 data.writeInt(resultCode);
2545 data.writeString(resultData);
2546 data.writeBundle(map);
2547 data.writeInt(abortBroadcast ? 1 : 0);
2548 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2549 reply.readException();
2550 data.recycle();
2551 reply.recycle();
2552 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002553 public void attachApplication(IApplicationThread app) throws RemoteException
2554 {
2555 Parcel data = Parcel.obtain();
2556 Parcel reply = Parcel.obtain();
2557 data.writeInterfaceToken(IActivityManager.descriptor);
2558 data.writeStrongBinder(app.asBinder());
2559 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2560 reply.readException();
2561 data.recycle();
2562 reply.recycle();
2563 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002564 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2565 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002566 {
2567 Parcel data = Parcel.obtain();
2568 Parcel reply = Parcel.obtain();
2569 data.writeInterfaceToken(IActivityManager.descriptor);
2570 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002571 if (config != null) {
2572 data.writeInt(1);
2573 config.writeToParcel(data, 0);
2574 } else {
2575 data.writeInt(0);
2576 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002577 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002578 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2579 reply.readException();
2580 data.recycle();
2581 reply.recycle();
2582 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002583 public void activityResumed(IBinder token) throws RemoteException
2584 {
2585 Parcel data = Parcel.obtain();
2586 Parcel reply = Parcel.obtain();
2587 data.writeInterfaceToken(IActivityManager.descriptor);
2588 data.writeStrongBinder(token);
2589 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2590 reply.readException();
2591 data.recycle();
2592 reply.recycle();
2593 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002594 public void activityPaused(IBinder token) throws RemoteException
2595 {
2596 Parcel data = Parcel.obtain();
2597 Parcel reply = Parcel.obtain();
2598 data.writeInterfaceToken(IActivityManager.descriptor);
2599 data.writeStrongBinder(token);
2600 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2601 reply.readException();
2602 data.recycle();
2603 reply.recycle();
2604 }
2605 public void activityStopped(IBinder token, Bundle state,
2606 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002607 {
2608 Parcel data = Parcel.obtain();
2609 Parcel reply = Parcel.obtain();
2610 data.writeInterfaceToken(IActivityManager.descriptor);
2611 data.writeStrongBinder(token);
2612 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002613 if (thumbnail != null) {
2614 data.writeInt(1);
2615 thumbnail.writeToParcel(data, 0);
2616 } else {
2617 data.writeInt(0);
2618 }
2619 TextUtils.writeToParcel(description, data, 0);
2620 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2621 reply.readException();
2622 data.recycle();
2623 reply.recycle();
2624 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002625 public void activitySlept(IBinder token) throws RemoteException
2626 {
2627 Parcel data = Parcel.obtain();
2628 Parcel reply = Parcel.obtain();
2629 data.writeInterfaceToken(IActivityManager.descriptor);
2630 data.writeStrongBinder(token);
2631 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2632 reply.readException();
2633 data.recycle();
2634 reply.recycle();
2635 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002636 public void activityDestroyed(IBinder token) throws RemoteException
2637 {
2638 Parcel data = Parcel.obtain();
2639 Parcel reply = Parcel.obtain();
2640 data.writeInterfaceToken(IActivityManager.descriptor);
2641 data.writeStrongBinder(token);
2642 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2643 reply.readException();
2644 data.recycle();
2645 reply.recycle();
2646 }
2647 public String getCallingPackage(IBinder token) throws RemoteException
2648 {
2649 Parcel data = Parcel.obtain();
2650 Parcel reply = Parcel.obtain();
2651 data.writeInterfaceToken(IActivityManager.descriptor);
2652 data.writeStrongBinder(token);
2653 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2654 reply.readException();
2655 String res = reply.readString();
2656 data.recycle();
2657 reply.recycle();
2658 return res;
2659 }
2660 public ComponentName getCallingActivity(IBinder token)
2661 throws RemoteException {
2662 Parcel data = Parcel.obtain();
2663 Parcel reply = Parcel.obtain();
2664 data.writeInterfaceToken(IActivityManager.descriptor);
2665 data.writeStrongBinder(token);
2666 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2667 reply.readException();
2668 ComponentName res = ComponentName.readFromParcel(reply);
2669 data.recycle();
2670 reply.recycle();
2671 return res;
2672 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002673 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002674 Parcel data = Parcel.obtain();
2675 Parcel reply = Parcel.obtain();
2676 data.writeInterfaceToken(IActivityManager.descriptor);
2677 data.writeInt(maxNum);
2678 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002679 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2680 reply.readException();
2681 ArrayList list = null;
2682 int N = reply.readInt();
2683 if (N >= 0) {
2684 list = new ArrayList();
2685 while (N > 0) {
2686 ActivityManager.RunningTaskInfo info =
2687 ActivityManager.RunningTaskInfo.CREATOR
2688 .createFromParcel(reply);
2689 list.add(info);
2690 N--;
2691 }
2692 }
2693 data.recycle();
2694 reply.recycle();
2695 return list;
2696 }
2697 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002698 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002699 Parcel data = Parcel.obtain();
2700 Parcel reply = Parcel.obtain();
2701 data.writeInterfaceToken(IActivityManager.descriptor);
2702 data.writeInt(maxNum);
2703 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002704 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002705 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2706 reply.readException();
2707 ArrayList<ActivityManager.RecentTaskInfo> list
2708 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2709 data.recycle();
2710 reply.recycle();
2711 return list;
2712 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002713 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002714 Parcel data = Parcel.obtain();
2715 Parcel reply = Parcel.obtain();
2716 data.writeInterfaceToken(IActivityManager.descriptor);
2717 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002718 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002719 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002720 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002721 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002722 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002723 }
2724 data.recycle();
2725 reply.recycle();
2726 return bm;
2727 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002728 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2729 Parcel data = Parcel.obtain();
2730 Parcel reply = Parcel.obtain();
2731 data.writeInterfaceToken(IActivityManager.descriptor);
2732 data.writeInt(id);
2733 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2734 reply.readException();
2735 Bitmap bm = null;
2736 if (reply.readInt() != 0) {
2737 bm = Bitmap.CREATOR.createFromParcel(reply);
2738 }
2739 data.recycle();
2740 reply.recycle();
2741 return bm;
2742 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002743 public List getServices(int maxNum, int flags) throws RemoteException {
2744 Parcel data = Parcel.obtain();
2745 Parcel reply = Parcel.obtain();
2746 data.writeInterfaceToken(IActivityManager.descriptor);
2747 data.writeInt(maxNum);
2748 data.writeInt(flags);
2749 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2750 reply.readException();
2751 ArrayList list = null;
2752 int N = reply.readInt();
2753 if (N >= 0) {
2754 list = new ArrayList();
2755 while (N > 0) {
2756 ActivityManager.RunningServiceInfo info =
2757 ActivityManager.RunningServiceInfo.CREATOR
2758 .createFromParcel(reply);
2759 list.add(info);
2760 N--;
2761 }
2762 }
2763 data.recycle();
2764 reply.recycle();
2765 return list;
2766 }
2767 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2768 throws RemoteException {
2769 Parcel data = Parcel.obtain();
2770 Parcel reply = Parcel.obtain();
2771 data.writeInterfaceToken(IActivityManager.descriptor);
2772 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2773 reply.readException();
2774 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2775 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2776 data.recycle();
2777 reply.recycle();
2778 return list;
2779 }
2780 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2781 throws RemoteException {
2782 Parcel data = Parcel.obtain();
2783 Parcel reply = Parcel.obtain();
2784 data.writeInterfaceToken(IActivityManager.descriptor);
2785 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2786 reply.readException();
2787 ArrayList<ActivityManager.RunningAppProcessInfo> list
2788 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2789 data.recycle();
2790 reply.recycle();
2791 return list;
2792 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002793 public List<ApplicationInfo> getRunningExternalApplications()
2794 throws RemoteException {
2795 Parcel data = Parcel.obtain();
2796 Parcel reply = Parcel.obtain();
2797 data.writeInterfaceToken(IActivityManager.descriptor);
2798 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2799 reply.readException();
2800 ArrayList<ApplicationInfo> list
2801 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2802 data.recycle();
2803 reply.recycle();
2804 return list;
2805 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002806 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002807 {
2808 Parcel data = Parcel.obtain();
2809 Parcel reply = Parcel.obtain();
2810 data.writeInterfaceToken(IActivityManager.descriptor);
2811 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002812 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002813 if (options != null) {
2814 data.writeInt(1);
2815 options.writeToParcel(data, 0);
2816 } else {
2817 data.writeInt(0);
2818 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002819 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2820 reply.readException();
2821 data.recycle();
2822 reply.recycle();
2823 }
2824 public void moveTaskToBack(int task) throws RemoteException
2825 {
2826 Parcel data = Parcel.obtain();
2827 Parcel reply = Parcel.obtain();
2828 data.writeInterfaceToken(IActivityManager.descriptor);
2829 data.writeInt(task);
2830 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2831 reply.readException();
2832 data.recycle();
2833 reply.recycle();
2834 }
2835 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2836 throws RemoteException {
2837 Parcel data = Parcel.obtain();
2838 Parcel reply = Parcel.obtain();
2839 data.writeInterfaceToken(IActivityManager.descriptor);
2840 data.writeStrongBinder(token);
2841 data.writeInt(nonRoot ? 1 : 0);
2842 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2843 reply.readException();
2844 boolean res = reply.readInt() != 0;
2845 data.recycle();
2846 reply.recycle();
2847 return res;
2848 }
2849 public void moveTaskBackwards(int task) throws RemoteException
2850 {
2851 Parcel data = Parcel.obtain();
2852 Parcel reply = Parcel.obtain();
2853 data.writeInterfaceToken(IActivityManager.descriptor);
2854 data.writeInt(task);
2855 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2856 reply.readException();
2857 data.recycle();
2858 reply.recycle();
2859 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002860 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002861 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2862 {
2863 Parcel data = Parcel.obtain();
2864 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002865 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002866 data.writeInt(taskId);
2867 data.writeInt(stackId);
2868 data.writeInt(toTop ? 1 : 0);
2869 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2870 reply.readException();
2871 data.recycle();
2872 reply.recycle();
2873 }
2874 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002875 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002876 {
2877 Parcel data = Parcel.obtain();
2878 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002879 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002880 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002881 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002882 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002883 reply.readException();
2884 data.recycle();
2885 reply.recycle();
2886 }
Craig Mautner967212c2013-04-13 21:10:58 -07002887 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002888 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002889 {
2890 Parcel data = Parcel.obtain();
2891 Parcel reply = Parcel.obtain();
2892 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002893 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002894 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002895 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002896 data.recycle();
2897 reply.recycle();
2898 return list;
2899 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002900 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002901 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002902 {
2903 Parcel data = Parcel.obtain();
2904 Parcel reply = Parcel.obtain();
2905 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002906 data.writeInt(stackId);
2907 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002908 reply.readException();
2909 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002910 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002911 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002912 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002913 }
2914 data.recycle();
2915 reply.recycle();
2916 return info;
2917 }
2918 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08002919 public boolean isInHomeStack(int taskId) throws RemoteException {
2920 Parcel data = Parcel.obtain();
2921 Parcel reply = Parcel.obtain();
2922 data.writeInterfaceToken(IActivityManager.descriptor);
2923 data.writeInt(taskId);
2924 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
2925 reply.readException();
2926 boolean isInHomeStack = reply.readInt() > 0;
2927 data.recycle();
2928 reply.recycle();
2929 return isInHomeStack;
2930 }
2931 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002932 public void setFocusedStack(int stackId) throws RemoteException
2933 {
2934 Parcel data = Parcel.obtain();
2935 Parcel reply = Parcel.obtain();
2936 data.writeInterfaceToken(IActivityManager.descriptor);
2937 data.writeInt(stackId);
2938 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2939 reply.readException();
2940 data.recycle();
2941 reply.recycle();
2942 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002943 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2944 {
2945 Parcel data = Parcel.obtain();
2946 Parcel reply = Parcel.obtain();
2947 data.writeInterfaceToken(IActivityManager.descriptor);
2948 data.writeStrongBinder(token);
2949 data.writeInt(onlyRoot ? 1 : 0);
2950 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2951 reply.readException();
2952 int res = reply.readInt();
2953 data.recycle();
2954 reply.recycle();
2955 return res;
2956 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002957 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002958 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002959 Parcel data = Parcel.obtain();
2960 Parcel reply = Parcel.obtain();
2961 data.writeInterfaceToken(IActivityManager.descriptor);
2962 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2963 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002964 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002965 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002966 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2967 reply.readException();
2968 int res = reply.readInt();
2969 ContentProviderHolder cph = null;
2970 if (res != 0) {
2971 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2972 }
2973 data.recycle();
2974 reply.recycle();
2975 return cph;
2976 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002977 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2978 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002979 Parcel data = Parcel.obtain();
2980 Parcel reply = Parcel.obtain();
2981 data.writeInterfaceToken(IActivityManager.descriptor);
2982 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002983 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002984 data.writeStrongBinder(token);
2985 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2986 reply.readException();
2987 int res = reply.readInt();
2988 ContentProviderHolder cph = null;
2989 if (res != 0) {
2990 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2991 }
2992 data.recycle();
2993 reply.recycle();
2994 return cph;
2995 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002996 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002997 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002998 {
2999 Parcel data = Parcel.obtain();
3000 Parcel reply = Parcel.obtain();
3001 data.writeInterfaceToken(IActivityManager.descriptor);
3002 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3003 data.writeTypedList(providers);
3004 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3005 reply.readException();
3006 data.recycle();
3007 reply.recycle();
3008 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003009 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3010 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003011 Parcel data = Parcel.obtain();
3012 Parcel reply = Parcel.obtain();
3013 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003014 data.writeStrongBinder(connection);
3015 data.writeInt(stable);
3016 data.writeInt(unstable);
3017 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3018 reply.readException();
3019 boolean res = reply.readInt() != 0;
3020 data.recycle();
3021 reply.recycle();
3022 return res;
3023 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003024
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003025 public void unstableProviderDied(IBinder connection) throws RemoteException {
3026 Parcel data = Parcel.obtain();
3027 Parcel reply = Parcel.obtain();
3028 data.writeInterfaceToken(IActivityManager.descriptor);
3029 data.writeStrongBinder(connection);
3030 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3031 reply.readException();
3032 data.recycle();
3033 reply.recycle();
3034 }
3035
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003036 @Override
3037 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3038 Parcel data = Parcel.obtain();
3039 Parcel reply = Parcel.obtain();
3040 data.writeInterfaceToken(IActivityManager.descriptor);
3041 data.writeStrongBinder(connection);
3042 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3043 reply.readException();
3044 data.recycle();
3045 reply.recycle();
3046 }
3047
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003048 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3049 Parcel data = Parcel.obtain();
3050 Parcel reply = Parcel.obtain();
3051 data.writeInterfaceToken(IActivityManager.descriptor);
3052 data.writeStrongBinder(connection);
3053 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003054 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3055 reply.readException();
3056 data.recycle();
3057 reply.recycle();
3058 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003059
3060 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3061 Parcel data = Parcel.obtain();
3062 Parcel reply = Parcel.obtain();
3063 data.writeInterfaceToken(IActivityManager.descriptor);
3064 data.writeString(name);
3065 data.writeStrongBinder(token);
3066 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3067 reply.readException();
3068 data.recycle();
3069 reply.recycle();
3070 }
3071
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003072 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3073 throws RemoteException
3074 {
3075 Parcel data = Parcel.obtain();
3076 Parcel reply = Parcel.obtain();
3077 data.writeInterfaceToken(IActivityManager.descriptor);
3078 service.writeToParcel(data, 0);
3079 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3080 reply.readException();
3081 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3082 data.recycle();
3083 reply.recycle();
3084 return res;
3085 }
3086
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003087 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003088 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003089 {
3090 Parcel data = Parcel.obtain();
3091 Parcel reply = Parcel.obtain();
3092 data.writeInterfaceToken(IActivityManager.descriptor);
3093 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3094 service.writeToParcel(data, 0);
3095 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003096 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003097 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3098 reply.readException();
3099 ComponentName res = ComponentName.readFromParcel(reply);
3100 data.recycle();
3101 reply.recycle();
3102 return res;
3103 }
3104 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003105 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003106 {
3107 Parcel data = Parcel.obtain();
3108 Parcel reply = Parcel.obtain();
3109 data.writeInterfaceToken(IActivityManager.descriptor);
3110 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3111 service.writeToParcel(data, 0);
3112 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003113 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003114 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3115 reply.readException();
3116 int res = reply.readInt();
3117 reply.recycle();
3118 data.recycle();
3119 return res;
3120 }
3121 public boolean stopServiceToken(ComponentName className, IBinder token,
3122 int startId) throws RemoteException {
3123 Parcel data = Parcel.obtain();
3124 Parcel reply = Parcel.obtain();
3125 data.writeInterfaceToken(IActivityManager.descriptor);
3126 ComponentName.writeToParcel(className, data);
3127 data.writeStrongBinder(token);
3128 data.writeInt(startId);
3129 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3130 reply.readException();
3131 boolean res = reply.readInt() != 0;
3132 data.recycle();
3133 reply.recycle();
3134 return res;
3135 }
3136 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003137 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003138 Parcel data = Parcel.obtain();
3139 Parcel reply = Parcel.obtain();
3140 data.writeInterfaceToken(IActivityManager.descriptor);
3141 ComponentName.writeToParcel(className, data);
3142 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003143 data.writeInt(id);
3144 if (notification != null) {
3145 data.writeInt(1);
3146 notification.writeToParcel(data, 0);
3147 } else {
3148 data.writeInt(0);
3149 }
3150 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003151 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3152 reply.readException();
3153 data.recycle();
3154 reply.recycle();
3155 }
3156 public int bindService(IApplicationThread caller, IBinder token,
3157 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003158 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003159 Parcel data = Parcel.obtain();
3160 Parcel reply = Parcel.obtain();
3161 data.writeInterfaceToken(IActivityManager.descriptor);
3162 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3163 data.writeStrongBinder(token);
3164 service.writeToParcel(data, 0);
3165 data.writeString(resolvedType);
3166 data.writeStrongBinder(connection.asBinder());
3167 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003168 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003169 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3170 reply.readException();
3171 int res = reply.readInt();
3172 data.recycle();
3173 reply.recycle();
3174 return res;
3175 }
3176 public boolean unbindService(IServiceConnection connection) throws RemoteException
3177 {
3178 Parcel data = Parcel.obtain();
3179 Parcel reply = Parcel.obtain();
3180 data.writeInterfaceToken(IActivityManager.descriptor);
3181 data.writeStrongBinder(connection.asBinder());
3182 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3183 reply.readException();
3184 boolean res = reply.readInt() != 0;
3185 data.recycle();
3186 reply.recycle();
3187 return res;
3188 }
3189
3190 public void publishService(IBinder token,
3191 Intent intent, IBinder service) throws RemoteException {
3192 Parcel data = Parcel.obtain();
3193 Parcel reply = Parcel.obtain();
3194 data.writeInterfaceToken(IActivityManager.descriptor);
3195 data.writeStrongBinder(token);
3196 intent.writeToParcel(data, 0);
3197 data.writeStrongBinder(service);
3198 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3199 reply.readException();
3200 data.recycle();
3201 reply.recycle();
3202 }
3203
3204 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3205 throws RemoteException {
3206 Parcel data = Parcel.obtain();
3207 Parcel reply = Parcel.obtain();
3208 data.writeInterfaceToken(IActivityManager.descriptor);
3209 data.writeStrongBinder(token);
3210 intent.writeToParcel(data, 0);
3211 data.writeInt(doRebind ? 1 : 0);
3212 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3213 reply.readException();
3214 data.recycle();
3215 reply.recycle();
3216 }
3217
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003218 public void serviceDoneExecuting(IBinder token, int type, int startId,
3219 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003220 Parcel data = Parcel.obtain();
3221 Parcel reply = Parcel.obtain();
3222 data.writeInterfaceToken(IActivityManager.descriptor);
3223 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003224 data.writeInt(type);
3225 data.writeInt(startId);
3226 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003227 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3228 reply.readException();
3229 data.recycle();
3230 reply.recycle();
3231 }
3232
3233 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3234 Parcel data = Parcel.obtain();
3235 Parcel reply = Parcel.obtain();
3236 data.writeInterfaceToken(IActivityManager.descriptor);
3237 service.writeToParcel(data, 0);
3238 data.writeString(resolvedType);
3239 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3240 reply.readException();
3241 IBinder binder = reply.readStrongBinder();
3242 reply.recycle();
3243 data.recycle();
3244 return binder;
3245 }
3246
Christopher Tate181fafa2009-05-14 11:12:14 -07003247 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3248 throws RemoteException {
3249 Parcel data = Parcel.obtain();
3250 Parcel reply = Parcel.obtain();
3251 data.writeInterfaceToken(IActivityManager.descriptor);
3252 app.writeToParcel(data, 0);
3253 data.writeInt(backupRestoreMode);
3254 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3255 reply.readException();
3256 boolean success = reply.readInt() != 0;
3257 reply.recycle();
3258 data.recycle();
3259 return success;
3260 }
3261
Christopher Tate346acb12012-10-15 19:20:25 -07003262 public void clearPendingBackup() throws RemoteException {
3263 Parcel data = Parcel.obtain();
3264 Parcel reply = Parcel.obtain();
3265 data.writeInterfaceToken(IActivityManager.descriptor);
3266 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3267 reply.recycle();
3268 data.recycle();
3269 }
3270
Christopher Tate181fafa2009-05-14 11:12:14 -07003271 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3272 Parcel data = Parcel.obtain();
3273 Parcel reply = Parcel.obtain();
3274 data.writeInterfaceToken(IActivityManager.descriptor);
3275 data.writeString(packageName);
3276 data.writeStrongBinder(agent);
3277 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3278 reply.recycle();
3279 data.recycle();
3280 }
3281
3282 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3283 Parcel data = Parcel.obtain();
3284 Parcel reply = Parcel.obtain();
3285 data.writeInterfaceToken(IActivityManager.descriptor);
3286 app.writeToParcel(data, 0);
3287 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3288 reply.readException();
3289 reply.recycle();
3290 data.recycle();
3291 }
3292
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003293 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003294 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3295 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003296 Parcel data = Parcel.obtain();
3297 Parcel reply = Parcel.obtain();
3298 data.writeInterfaceToken(IActivityManager.descriptor);
3299 ComponentName.writeToParcel(className, data);
3300 data.writeString(profileFile);
3301 data.writeInt(flags);
3302 data.writeBundle(arguments);
3303 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003304 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003305 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003306 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3307 reply.readException();
3308 boolean res = reply.readInt() != 0;
3309 reply.recycle();
3310 data.recycle();
3311 return res;
3312 }
3313
3314 public void finishInstrumentation(IApplicationThread target,
3315 int resultCode, Bundle results) throws RemoteException {
3316 Parcel data = Parcel.obtain();
3317 Parcel reply = Parcel.obtain();
3318 data.writeInterfaceToken(IActivityManager.descriptor);
3319 data.writeStrongBinder(target != null ? target.asBinder() : null);
3320 data.writeInt(resultCode);
3321 data.writeBundle(results);
3322 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3323 reply.readException();
3324 data.recycle();
3325 reply.recycle();
3326 }
3327 public Configuration getConfiguration() throws RemoteException
3328 {
3329 Parcel data = Parcel.obtain();
3330 Parcel reply = Parcel.obtain();
3331 data.writeInterfaceToken(IActivityManager.descriptor);
3332 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3333 reply.readException();
3334 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3335 reply.recycle();
3336 data.recycle();
3337 return res;
3338 }
3339 public void updateConfiguration(Configuration values) throws RemoteException
3340 {
3341 Parcel data = Parcel.obtain();
3342 Parcel reply = Parcel.obtain();
3343 data.writeInterfaceToken(IActivityManager.descriptor);
3344 values.writeToParcel(data, 0);
3345 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3346 reply.readException();
3347 data.recycle();
3348 reply.recycle();
3349 }
3350 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3351 throws RemoteException {
3352 Parcel data = Parcel.obtain();
3353 Parcel reply = Parcel.obtain();
3354 data.writeInterfaceToken(IActivityManager.descriptor);
3355 data.writeStrongBinder(token);
3356 data.writeInt(requestedOrientation);
3357 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3358 reply.readException();
3359 data.recycle();
3360 reply.recycle();
3361 }
3362 public int getRequestedOrientation(IBinder token) throws RemoteException {
3363 Parcel data = Parcel.obtain();
3364 Parcel reply = Parcel.obtain();
3365 data.writeInterfaceToken(IActivityManager.descriptor);
3366 data.writeStrongBinder(token);
3367 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3368 reply.readException();
3369 int res = reply.readInt();
3370 data.recycle();
3371 reply.recycle();
3372 return res;
3373 }
3374 public ComponentName getActivityClassForToken(IBinder token)
3375 throws RemoteException {
3376 Parcel data = Parcel.obtain();
3377 Parcel reply = Parcel.obtain();
3378 data.writeInterfaceToken(IActivityManager.descriptor);
3379 data.writeStrongBinder(token);
3380 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3381 reply.readException();
3382 ComponentName res = ComponentName.readFromParcel(reply);
3383 data.recycle();
3384 reply.recycle();
3385 return res;
3386 }
3387 public String getPackageForToken(IBinder token) throws RemoteException
3388 {
3389 Parcel data = Parcel.obtain();
3390 Parcel reply = Parcel.obtain();
3391 data.writeInterfaceToken(IActivityManager.descriptor);
3392 data.writeStrongBinder(token);
3393 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3394 reply.readException();
3395 String res = reply.readString();
3396 data.recycle();
3397 reply.recycle();
3398 return res;
3399 }
3400 public IIntentSender getIntentSender(int type,
3401 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003402 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003403 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003404 Parcel data = Parcel.obtain();
3405 Parcel reply = Parcel.obtain();
3406 data.writeInterfaceToken(IActivityManager.descriptor);
3407 data.writeInt(type);
3408 data.writeString(packageName);
3409 data.writeStrongBinder(token);
3410 data.writeString(resultWho);
3411 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003412 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003413 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003414 data.writeTypedArray(intents, 0);
3415 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003416 } else {
3417 data.writeInt(0);
3418 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003419 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003420 if (options != null) {
3421 data.writeInt(1);
3422 options.writeToParcel(data, 0);
3423 } else {
3424 data.writeInt(0);
3425 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003426 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003427 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3428 reply.readException();
3429 IIntentSender res = IIntentSender.Stub.asInterface(
3430 reply.readStrongBinder());
3431 data.recycle();
3432 reply.recycle();
3433 return res;
3434 }
3435 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3436 Parcel data = Parcel.obtain();
3437 Parcel reply = Parcel.obtain();
3438 data.writeInterfaceToken(IActivityManager.descriptor);
3439 data.writeStrongBinder(sender.asBinder());
3440 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3441 reply.readException();
3442 data.recycle();
3443 reply.recycle();
3444 }
3445 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3446 Parcel data = Parcel.obtain();
3447 Parcel reply = Parcel.obtain();
3448 data.writeInterfaceToken(IActivityManager.descriptor);
3449 data.writeStrongBinder(sender.asBinder());
3450 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3451 reply.readException();
3452 String res = reply.readString();
3453 data.recycle();
3454 reply.recycle();
3455 return res;
3456 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003457 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3458 Parcel data = Parcel.obtain();
3459 Parcel reply = Parcel.obtain();
3460 data.writeInterfaceToken(IActivityManager.descriptor);
3461 data.writeStrongBinder(sender.asBinder());
3462 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3463 reply.readException();
3464 int res = reply.readInt();
3465 data.recycle();
3466 reply.recycle();
3467 return res;
3468 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003469 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3470 boolean requireFull, String name, String callerPackage) throws RemoteException {
3471 Parcel data = Parcel.obtain();
3472 Parcel reply = Parcel.obtain();
3473 data.writeInterfaceToken(IActivityManager.descriptor);
3474 data.writeInt(callingPid);
3475 data.writeInt(callingUid);
3476 data.writeInt(userId);
3477 data.writeInt(allowAll ? 1 : 0);
3478 data.writeInt(requireFull ? 1 : 0);
3479 data.writeString(name);
3480 data.writeString(callerPackage);
3481 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3482 reply.readException();
3483 int res = reply.readInt();
3484 data.recycle();
3485 reply.recycle();
3486 return res;
3487 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003488 public void setProcessLimit(int max) throws RemoteException
3489 {
3490 Parcel data = Parcel.obtain();
3491 Parcel reply = Parcel.obtain();
3492 data.writeInterfaceToken(IActivityManager.descriptor);
3493 data.writeInt(max);
3494 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3495 reply.readException();
3496 data.recycle();
3497 reply.recycle();
3498 }
3499 public int getProcessLimit() throws RemoteException
3500 {
3501 Parcel data = Parcel.obtain();
3502 Parcel reply = Parcel.obtain();
3503 data.writeInterfaceToken(IActivityManager.descriptor);
3504 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3505 reply.readException();
3506 int res = reply.readInt();
3507 data.recycle();
3508 reply.recycle();
3509 return res;
3510 }
3511 public void setProcessForeground(IBinder token, int pid,
3512 boolean isForeground) throws RemoteException {
3513 Parcel data = Parcel.obtain();
3514 Parcel reply = Parcel.obtain();
3515 data.writeInterfaceToken(IActivityManager.descriptor);
3516 data.writeStrongBinder(token);
3517 data.writeInt(pid);
3518 data.writeInt(isForeground ? 1 : 0);
3519 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3520 reply.readException();
3521 data.recycle();
3522 reply.recycle();
3523 }
3524 public int checkPermission(String permission, int pid, int uid)
3525 throws RemoteException {
3526 Parcel data = Parcel.obtain();
3527 Parcel reply = Parcel.obtain();
3528 data.writeInterfaceToken(IActivityManager.descriptor);
3529 data.writeString(permission);
3530 data.writeInt(pid);
3531 data.writeInt(uid);
3532 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3533 reply.readException();
3534 int res = reply.readInt();
3535 data.recycle();
3536 reply.recycle();
3537 return res;
3538 }
3539 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003540 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003541 Parcel data = Parcel.obtain();
3542 Parcel reply = Parcel.obtain();
3543 data.writeInterfaceToken(IActivityManager.descriptor);
3544 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003545 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003546 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003547 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3548 reply.readException();
3549 boolean res = reply.readInt() != 0;
3550 data.recycle();
3551 reply.recycle();
3552 return res;
3553 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003554 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003555 throws RemoteException {
3556 Parcel data = Parcel.obtain();
3557 Parcel reply = Parcel.obtain();
3558 data.writeInterfaceToken(IActivityManager.descriptor);
3559 uri.writeToParcel(data, 0);
3560 data.writeInt(pid);
3561 data.writeInt(uid);
3562 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003563 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003564 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3565 reply.readException();
3566 int res = reply.readInt();
3567 data.recycle();
3568 reply.recycle();
3569 return res;
3570 }
3571 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003572 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003573 Parcel data = Parcel.obtain();
3574 Parcel reply = Parcel.obtain();
3575 data.writeInterfaceToken(IActivityManager.descriptor);
3576 data.writeStrongBinder(caller.asBinder());
3577 data.writeString(targetPkg);
3578 uri.writeToParcel(data, 0);
3579 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003580 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003581 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3582 reply.readException();
3583 data.recycle();
3584 reply.recycle();
3585 }
3586 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003587 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003588 Parcel data = Parcel.obtain();
3589 Parcel reply = Parcel.obtain();
3590 data.writeInterfaceToken(IActivityManager.descriptor);
3591 data.writeStrongBinder(caller.asBinder());
3592 uri.writeToParcel(data, 0);
3593 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003594 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003595 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3596 reply.readException();
3597 data.recycle();
3598 reply.recycle();
3599 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003600
3601 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003602 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3603 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003604 Parcel data = Parcel.obtain();
3605 Parcel reply = Parcel.obtain();
3606 data.writeInterfaceToken(IActivityManager.descriptor);
3607 uri.writeToParcel(data, 0);
3608 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003609 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003610 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3611 reply.readException();
3612 data.recycle();
3613 reply.recycle();
3614 }
3615
3616 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003617 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3618 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003619 Parcel data = Parcel.obtain();
3620 Parcel reply = Parcel.obtain();
3621 data.writeInterfaceToken(IActivityManager.descriptor);
3622 uri.writeToParcel(data, 0);
3623 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003624 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003625 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3626 reply.readException();
3627 data.recycle();
3628 reply.recycle();
3629 }
3630
3631 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003632 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3633 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003634 Parcel data = Parcel.obtain();
3635 Parcel reply = Parcel.obtain();
3636 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003637 data.writeString(packageName);
3638 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003639 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3640 reply.readException();
3641 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3642 reply);
3643 data.recycle();
3644 reply.recycle();
3645 return perms;
3646 }
3647
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003648 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3649 throws RemoteException {
3650 Parcel data = Parcel.obtain();
3651 Parcel reply = Parcel.obtain();
3652 data.writeInterfaceToken(IActivityManager.descriptor);
3653 data.writeStrongBinder(who.asBinder());
3654 data.writeInt(waiting ? 1 : 0);
3655 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3656 reply.readException();
3657 data.recycle();
3658 reply.recycle();
3659 }
3660 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3661 Parcel data = Parcel.obtain();
3662 Parcel reply = Parcel.obtain();
3663 data.writeInterfaceToken(IActivityManager.descriptor);
3664 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3665 reply.readException();
3666 outInfo.readFromParcel(reply);
3667 data.recycle();
3668 reply.recycle();
3669 }
3670 public void unhandledBack() throws RemoteException
3671 {
3672 Parcel data = Parcel.obtain();
3673 Parcel reply = Parcel.obtain();
3674 data.writeInterfaceToken(IActivityManager.descriptor);
3675 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3676 reply.readException();
3677 data.recycle();
3678 reply.recycle();
3679 }
3680 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3681 {
3682 Parcel data = Parcel.obtain();
3683 Parcel reply = Parcel.obtain();
3684 data.writeInterfaceToken(IActivityManager.descriptor);
3685 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3686 reply.readException();
3687 ParcelFileDescriptor pfd = null;
3688 if (reply.readInt() != 0) {
3689 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3690 }
3691 data.recycle();
3692 reply.recycle();
3693 return pfd;
3694 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003695 public void setLockScreenShown(boolean shown) throws RemoteException
3696 {
3697 Parcel data = Parcel.obtain();
3698 Parcel reply = Parcel.obtain();
3699 data.writeInterfaceToken(IActivityManager.descriptor);
3700 data.writeInt(shown ? 1 : 0);
3701 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3702 reply.readException();
3703 data.recycle();
3704 reply.recycle();
3705 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003706 public void setDebugApp(
3707 String packageName, boolean waitForDebugger, boolean persistent)
3708 throws RemoteException
3709 {
3710 Parcel data = Parcel.obtain();
3711 Parcel reply = Parcel.obtain();
3712 data.writeInterfaceToken(IActivityManager.descriptor);
3713 data.writeString(packageName);
3714 data.writeInt(waitForDebugger ? 1 : 0);
3715 data.writeInt(persistent ? 1 : 0);
3716 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3717 reply.readException();
3718 data.recycle();
3719 reply.recycle();
3720 }
3721 public void setAlwaysFinish(boolean enabled) throws RemoteException
3722 {
3723 Parcel data = Parcel.obtain();
3724 Parcel reply = Parcel.obtain();
3725 data.writeInterfaceToken(IActivityManager.descriptor);
3726 data.writeInt(enabled ? 1 : 0);
3727 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3728 reply.readException();
3729 data.recycle();
3730 reply.recycle();
3731 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003732 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003733 {
3734 Parcel data = Parcel.obtain();
3735 Parcel reply = Parcel.obtain();
3736 data.writeInterfaceToken(IActivityManager.descriptor);
3737 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003738 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003739 reply.readException();
3740 data.recycle();
3741 reply.recycle();
3742 }
3743 public void enterSafeMode() throws RemoteException {
3744 Parcel data = Parcel.obtain();
3745 data.writeInterfaceToken(IActivityManager.descriptor);
3746 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3747 data.recycle();
3748 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003749 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3750 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003751 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003752 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003753 data.writeStrongBinder(sender.asBinder());
3754 data.writeInt(sourceUid);
3755 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003756 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3757 data.recycle();
3758 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003759 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003760 Parcel data = Parcel.obtain();
3761 Parcel reply = Parcel.obtain();
3762 data.writeInterfaceToken(IActivityManager.descriptor);
3763 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003764 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003765 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003766 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003767 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003768 boolean res = reply.readInt() != 0;
3769 data.recycle();
3770 reply.recycle();
3771 return res;
3772 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003773 @Override
3774 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3775 Parcel data = Parcel.obtain();
3776 Parcel reply = Parcel.obtain();
3777 data.writeInterfaceToken(IActivityManager.descriptor);
3778 data.writeString(reason);
3779 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3780 boolean res = reply.readInt() != 0;
3781 data.recycle();
3782 reply.recycle();
3783 return res;
3784 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003785 public boolean testIsSystemReady()
3786 {
3787 /* this base class version is never called */
3788 return true;
3789 }
Dan Egnor60d87622009-12-16 16:32:58 -08003790 public void handleApplicationCrash(IBinder app,
3791 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3792 {
3793 Parcel data = Parcel.obtain();
3794 Parcel reply = Parcel.obtain();
3795 data.writeInterfaceToken(IActivityManager.descriptor);
3796 data.writeStrongBinder(app);
3797 crashInfo.writeToParcel(data, 0);
3798 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3799 reply.readException();
3800 reply.recycle();
3801 data.recycle();
3802 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003803
Dan Egnor60d87622009-12-16 16:32:58 -08003804 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003805 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003806 {
3807 Parcel data = Parcel.obtain();
3808 Parcel reply = Parcel.obtain();
3809 data.writeInterfaceToken(IActivityManager.descriptor);
3810 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003811 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003812 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003813 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003814 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003815 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003816 reply.recycle();
3817 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003818 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003819 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003820
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003821 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003822 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003823 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003824 {
3825 Parcel data = Parcel.obtain();
3826 Parcel reply = Parcel.obtain();
3827 data.writeInterfaceToken(IActivityManager.descriptor);
3828 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003829 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003830 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003831 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3832 reply.readException();
3833 reply.recycle();
3834 data.recycle();
3835 }
3836
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003837 public void signalPersistentProcesses(int sig) throws RemoteException {
3838 Parcel data = Parcel.obtain();
3839 Parcel reply = Parcel.obtain();
3840 data.writeInterfaceToken(IActivityManager.descriptor);
3841 data.writeInt(sig);
3842 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3843 reply.readException();
3844 data.recycle();
3845 reply.recycle();
3846 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003847
Dianne Hackborn1676c852012-09-10 14:52:30 -07003848 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003849 Parcel data = Parcel.obtain();
3850 Parcel reply = Parcel.obtain();
3851 data.writeInterfaceToken(IActivityManager.descriptor);
3852 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003853 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003854 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3855 reply.readException();
3856 data.recycle();
3857 reply.recycle();
3858 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003859
3860 public void killAllBackgroundProcesses() throws RemoteException {
3861 Parcel data = Parcel.obtain();
3862 Parcel reply = Parcel.obtain();
3863 data.writeInterfaceToken(IActivityManager.descriptor);
3864 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3865 reply.readException();
3866 data.recycle();
3867 reply.recycle();
3868 }
3869
Dianne Hackborn1676c852012-09-10 14:52:30 -07003870 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003871 Parcel data = Parcel.obtain();
3872 Parcel reply = Parcel.obtain();
3873 data.writeInterfaceToken(IActivityManager.descriptor);
3874 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003875 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003876 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003877 reply.readException();
3878 data.recycle();
3879 reply.recycle();
3880 }
3881
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003882 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3883 throws RemoteException
3884 {
3885 Parcel data = Parcel.obtain();
3886 Parcel reply = Parcel.obtain();
3887 data.writeInterfaceToken(IActivityManager.descriptor);
3888 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3889 reply.readException();
3890 outInfo.readFromParcel(reply);
3891 reply.recycle();
3892 data.recycle();
3893 }
3894
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003895 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3896 {
3897 Parcel data = Parcel.obtain();
3898 Parcel reply = Parcel.obtain();
3899 data.writeInterfaceToken(IActivityManager.descriptor);
3900 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3901 reply.readException();
3902 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3903 reply.recycle();
3904 data.recycle();
3905 return res;
3906 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003907
Dianne Hackborn1676c852012-09-10 14:52:30 -07003908 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003909 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003910 {
3911 Parcel data = Parcel.obtain();
3912 Parcel reply = Parcel.obtain();
3913 data.writeInterfaceToken(IActivityManager.descriptor);
3914 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003915 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003916 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003917 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003918 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003919 if (fd != null) {
3920 data.writeInt(1);
3921 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3922 } else {
3923 data.writeInt(0);
3924 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003925 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3926 reply.readException();
3927 boolean res = reply.readInt() != 0;
3928 reply.recycle();
3929 data.recycle();
3930 return res;
3931 }
3932
Dianne Hackborn55280a92009-05-07 15:53:46 -07003933 public boolean shutdown(int timeout) throws RemoteException
3934 {
3935 Parcel data = Parcel.obtain();
3936 Parcel reply = Parcel.obtain();
3937 data.writeInterfaceToken(IActivityManager.descriptor);
3938 data.writeInt(timeout);
3939 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3940 reply.readException();
3941 boolean res = reply.readInt() != 0;
3942 reply.recycle();
3943 data.recycle();
3944 return res;
3945 }
3946
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003947 public void stopAppSwitches() throws RemoteException {
3948 Parcel data = Parcel.obtain();
3949 Parcel reply = Parcel.obtain();
3950 data.writeInterfaceToken(IActivityManager.descriptor);
3951 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3952 reply.readException();
3953 reply.recycle();
3954 data.recycle();
3955 }
3956
3957 public void resumeAppSwitches() throws RemoteException {
3958 Parcel data = Parcel.obtain();
3959 Parcel reply = Parcel.obtain();
3960 data.writeInterfaceToken(IActivityManager.descriptor);
3961 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3962 reply.readException();
3963 reply.recycle();
3964 data.recycle();
3965 }
3966
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003967 public void killApplicationWithAppId(String pkg, int appid, String reason)
3968 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003969 Parcel data = Parcel.obtain();
3970 Parcel reply = Parcel.obtain();
3971 data.writeInterfaceToken(IActivityManager.descriptor);
3972 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003973 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003974 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003975 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003976 reply.readException();
3977 data.recycle();
3978 reply.recycle();
3979 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003980
3981 public void closeSystemDialogs(String reason) throws RemoteException {
3982 Parcel data = Parcel.obtain();
3983 Parcel reply = Parcel.obtain();
3984 data.writeInterfaceToken(IActivityManager.descriptor);
3985 data.writeString(reason);
3986 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3987 reply.readException();
3988 data.recycle();
3989 reply.recycle();
3990 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003991
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003992 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003993 throws RemoteException {
3994 Parcel data = Parcel.obtain();
3995 Parcel reply = Parcel.obtain();
3996 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003997 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003998 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3999 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004000 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004001 data.recycle();
4002 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004003 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004004 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004005
4006 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4007 Parcel data = Parcel.obtain();
4008 Parcel reply = Parcel.obtain();
4009 data.writeInterfaceToken(IActivityManager.descriptor);
4010 data.writeString(processName);
4011 data.writeInt(uid);
4012 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4013 reply.readException();
4014 data.recycle();
4015 reply.recycle();
4016 }
4017
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004018 public void overridePendingTransition(IBinder token, String packageName,
4019 int enterAnim, int exitAnim) throws RemoteException {
4020 Parcel data = Parcel.obtain();
4021 Parcel reply = Parcel.obtain();
4022 data.writeInterfaceToken(IActivityManager.descriptor);
4023 data.writeStrongBinder(token);
4024 data.writeString(packageName);
4025 data.writeInt(enterAnim);
4026 data.writeInt(exitAnim);
4027 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4028 reply.readException();
4029 data.recycle();
4030 reply.recycle();
4031 }
4032
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004033 public boolean isUserAMonkey() throws RemoteException {
4034 Parcel data = Parcel.obtain();
4035 Parcel reply = Parcel.obtain();
4036 data.writeInterfaceToken(IActivityManager.descriptor);
4037 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4038 reply.readException();
4039 boolean res = reply.readInt() != 0;
4040 data.recycle();
4041 reply.recycle();
4042 return res;
4043 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004044
4045 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4046 Parcel data = Parcel.obtain();
4047 Parcel reply = Parcel.obtain();
4048 data.writeInterfaceToken(IActivityManager.descriptor);
4049 data.writeInt(monkey ? 1 : 0);
4050 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4051 reply.readException();
4052 data.recycle();
4053 reply.recycle();
4054 }
4055
Dianne Hackborn860755f2010-06-03 18:47:52 -07004056 public void finishHeavyWeightApp() throws RemoteException {
4057 Parcel data = Parcel.obtain();
4058 Parcel reply = Parcel.obtain();
4059 data.writeInterfaceToken(IActivityManager.descriptor);
4060 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4061 reply.readException();
4062 data.recycle();
4063 reply.recycle();
4064 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004065
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004066 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004067 throws RemoteException {
4068 Parcel data = Parcel.obtain();
4069 Parcel reply = Parcel.obtain();
4070 data.writeInterfaceToken(IActivityManager.descriptor);
4071 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004072 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4073 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004074 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004075 data.recycle();
4076 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004077 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004078 }
4079
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004080 public boolean convertToTranslucent(IBinder token)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004081 throws RemoteException {
4082 Parcel data = Parcel.obtain();
4083 Parcel reply = Parcel.obtain();
4084 data.writeInterfaceToken(IActivityManager.descriptor);
4085 data.writeStrongBinder(token);
4086 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004087 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004088 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004089 data.recycle();
4090 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004091 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004092 }
4093
Daniel Sandler69a48172010-06-23 16:29:36 -04004094 public void setImmersive(IBinder token, boolean immersive)
4095 throws RemoteException {
4096 Parcel data = Parcel.obtain();
4097 Parcel reply = Parcel.obtain();
4098 data.writeInterfaceToken(IActivityManager.descriptor);
4099 data.writeStrongBinder(token);
4100 data.writeInt(immersive ? 1 : 0);
4101 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4102 reply.readException();
4103 data.recycle();
4104 reply.recycle();
4105 }
4106
4107 public boolean isImmersive(IBinder token)
4108 throws RemoteException {
4109 Parcel data = Parcel.obtain();
4110 Parcel reply = Parcel.obtain();
4111 data.writeInterfaceToken(IActivityManager.descriptor);
4112 data.writeStrongBinder(token);
4113 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004114 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004115 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004116 data.recycle();
4117 reply.recycle();
4118 return res;
4119 }
4120
4121 public boolean isTopActivityImmersive()
4122 throws RemoteException {
4123 Parcel data = Parcel.obtain();
4124 Parcel reply = Parcel.obtain();
4125 data.writeInterfaceToken(IActivityManager.descriptor);
4126 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004127 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004128 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004129 data.recycle();
4130 reply.recycle();
4131 return res;
4132 }
4133
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004134 public void crashApplication(int uid, int initialPid, String packageName,
4135 String message) throws RemoteException {
4136 Parcel data = Parcel.obtain();
4137 Parcel reply = Parcel.obtain();
4138 data.writeInterfaceToken(IActivityManager.descriptor);
4139 data.writeInt(uid);
4140 data.writeInt(initialPid);
4141 data.writeString(packageName);
4142 data.writeString(message);
4143 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4144 reply.readException();
4145 data.recycle();
4146 reply.recycle();
4147 }
Andy McFadden824c5102010-07-09 16:26:57 -07004148
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004149 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004150 Parcel data = Parcel.obtain();
4151 Parcel reply = Parcel.obtain();
4152 data.writeInterfaceToken(IActivityManager.descriptor);
4153 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004154 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004155 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4156 reply.readException();
4157 String res = reply.readString();
4158 data.recycle();
4159 reply.recycle();
4160 return res;
4161 }
4162
Dianne Hackborn7e269642010-08-25 19:50:20 -07004163 public IBinder newUriPermissionOwner(String name)
4164 throws RemoteException {
4165 Parcel data = Parcel.obtain();
4166 Parcel reply = Parcel.obtain();
4167 data.writeInterfaceToken(IActivityManager.descriptor);
4168 data.writeString(name);
4169 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4170 reply.readException();
4171 IBinder res = reply.readStrongBinder();
4172 data.recycle();
4173 reply.recycle();
4174 return res;
4175 }
4176
4177 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004178 Uri uri, int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004179 Parcel data = Parcel.obtain();
4180 Parcel reply = Parcel.obtain();
4181 data.writeInterfaceToken(IActivityManager.descriptor);
4182 data.writeStrongBinder(owner);
4183 data.writeInt(fromUid);
4184 data.writeString(targetPkg);
4185 uri.writeToParcel(data, 0);
4186 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004187 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004188 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4189 reply.readException();
4190 data.recycle();
4191 reply.recycle();
4192 }
4193
4194 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004195 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004196 Parcel data = Parcel.obtain();
4197 Parcel reply = Parcel.obtain();
4198 data.writeInterfaceToken(IActivityManager.descriptor);
4199 data.writeStrongBinder(owner);
4200 if (uri != null) {
4201 data.writeInt(1);
4202 uri.writeToParcel(data, 0);
4203 } else {
4204 data.writeInt(0);
4205 }
4206 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004207 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004208 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4209 reply.readException();
4210 data.recycle();
4211 reply.recycle();
4212 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004213
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004214 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004215 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004216 Parcel data = Parcel.obtain();
4217 Parcel reply = Parcel.obtain();
4218 data.writeInterfaceToken(IActivityManager.descriptor);
4219 data.writeInt(callingUid);
4220 data.writeString(targetPkg);
4221 uri.writeToParcel(data, 0);
4222 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004223 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004224 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4225 reply.readException();
4226 int res = reply.readInt();
4227 data.recycle();
4228 reply.recycle();
4229 return res;
4230 }
4231
Dianne Hackborn1676c852012-09-10 14:52:30 -07004232 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004233 String path, ParcelFileDescriptor fd) throws RemoteException {
4234 Parcel data = Parcel.obtain();
4235 Parcel reply = Parcel.obtain();
4236 data.writeInterfaceToken(IActivityManager.descriptor);
4237 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004238 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004239 data.writeInt(managed ? 1 : 0);
4240 data.writeString(path);
4241 if (fd != null) {
4242 data.writeInt(1);
4243 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4244 } else {
4245 data.writeInt(0);
4246 }
4247 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4248 reply.readException();
4249 boolean res = reply.readInt() != 0;
4250 reply.recycle();
4251 data.recycle();
4252 return res;
4253 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004254
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004255 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004256 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004257 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004258 Parcel data = Parcel.obtain();
4259 Parcel reply = Parcel.obtain();
4260 data.writeInterfaceToken(IActivityManager.descriptor);
4261 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004262 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004263 data.writeTypedArray(intents, 0);
4264 data.writeStringArray(resolvedTypes);
4265 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004266 if (options != null) {
4267 data.writeInt(1);
4268 options.writeToParcel(data, 0);
4269 } else {
4270 data.writeInt(0);
4271 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004272 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004273 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4274 reply.readException();
4275 int result = reply.readInt();
4276 reply.recycle();
4277 data.recycle();
4278 return result;
4279 }
4280
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004281 public int getFrontActivityScreenCompatMode() throws RemoteException {
4282 Parcel data = Parcel.obtain();
4283 Parcel reply = Parcel.obtain();
4284 data.writeInterfaceToken(IActivityManager.descriptor);
4285 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4286 reply.readException();
4287 int mode = reply.readInt();
4288 reply.recycle();
4289 data.recycle();
4290 return mode;
4291 }
4292
4293 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4294 Parcel data = Parcel.obtain();
4295 Parcel reply = Parcel.obtain();
4296 data.writeInterfaceToken(IActivityManager.descriptor);
4297 data.writeInt(mode);
4298 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4299 reply.readException();
4300 reply.recycle();
4301 data.recycle();
4302 }
4303
4304 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4305 Parcel data = Parcel.obtain();
4306 Parcel reply = Parcel.obtain();
4307 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004308 data.writeString(packageName);
4309 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004310 reply.readException();
4311 int mode = reply.readInt();
4312 reply.recycle();
4313 data.recycle();
4314 return mode;
4315 }
4316
4317 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004318 throws RemoteException {
4319 Parcel data = Parcel.obtain();
4320 Parcel reply = Parcel.obtain();
4321 data.writeInterfaceToken(IActivityManager.descriptor);
4322 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004323 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004324 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4325 reply.readException();
4326 reply.recycle();
4327 data.recycle();
4328 }
4329
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004330 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4331 Parcel data = Parcel.obtain();
4332 Parcel reply = Parcel.obtain();
4333 data.writeInterfaceToken(IActivityManager.descriptor);
4334 data.writeString(packageName);
4335 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4336 reply.readException();
4337 boolean ask = reply.readInt() != 0;
4338 reply.recycle();
4339 data.recycle();
4340 return ask;
4341 }
4342
4343 public void setPackageAskScreenCompat(String packageName, boolean ask)
4344 throws RemoteException {
4345 Parcel data = Parcel.obtain();
4346 Parcel reply = Parcel.obtain();
4347 data.writeInterfaceToken(IActivityManager.descriptor);
4348 data.writeString(packageName);
4349 data.writeInt(ask ? 1 : 0);
4350 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4351 reply.readException();
4352 reply.recycle();
4353 data.recycle();
4354 }
4355
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004356 public boolean switchUser(int userid) throws RemoteException {
4357 Parcel data = Parcel.obtain();
4358 Parcel reply = Parcel.obtain();
4359 data.writeInterfaceToken(IActivityManager.descriptor);
4360 data.writeInt(userid);
4361 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4362 reply.readException();
4363 boolean result = reply.readInt() != 0;
4364 reply.recycle();
4365 data.recycle();
4366 return result;
4367 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004368
Kenny Guy08488bf2014-02-21 17:40:37 +00004369 public boolean startUserInBackground(int userid) throws RemoteException {
4370 Parcel data = Parcel.obtain();
4371 Parcel reply = Parcel.obtain();
4372 data.writeInterfaceToken(IActivityManager.descriptor);
4373 data.writeInt(userid);
4374 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4375 reply.readException();
4376 boolean result = reply.readInt() != 0;
4377 reply.recycle();
4378 data.recycle();
4379 return result;
4380 }
4381
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004382 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4383 Parcel data = Parcel.obtain();
4384 Parcel reply = Parcel.obtain();
4385 data.writeInterfaceToken(IActivityManager.descriptor);
4386 data.writeInt(userid);
4387 data.writeStrongInterface(callback);
4388 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4389 reply.readException();
4390 int result = reply.readInt();
4391 reply.recycle();
4392 data.recycle();
4393 return result;
4394 }
4395
Amith Yamasani52f1d752012-03-28 18:19:29 -07004396 public UserInfo getCurrentUser() throws RemoteException {
4397 Parcel data = Parcel.obtain();
4398 Parcel reply = Parcel.obtain();
4399 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004400 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004401 reply.readException();
4402 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4403 reply.recycle();
4404 data.recycle();
4405 return userInfo;
4406 }
4407
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004408 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004409 Parcel data = Parcel.obtain();
4410 Parcel reply = Parcel.obtain();
4411 data.writeInterfaceToken(IActivityManager.descriptor);
4412 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004413 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004414 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4415 reply.readException();
4416 boolean result = reply.readInt() != 0;
4417 reply.recycle();
4418 data.recycle();
4419 return result;
4420 }
4421
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004422 public int[] getRunningUserIds() throws RemoteException {
4423 Parcel data = Parcel.obtain();
4424 Parcel reply = Parcel.obtain();
4425 data.writeInterfaceToken(IActivityManager.descriptor);
4426 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4427 reply.readException();
4428 int[] result = reply.createIntArray();
4429 reply.recycle();
4430 data.recycle();
4431 return result;
4432 }
4433
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004434 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4435 Parcel data = Parcel.obtain();
4436 Parcel reply = Parcel.obtain();
4437 data.writeInterfaceToken(IActivityManager.descriptor);
4438 data.writeInt(taskId);
4439 data.writeInt(subTaskIndex);
4440 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4441 reply.readException();
4442 boolean result = reply.readInt() != 0;
4443 reply.recycle();
4444 data.recycle();
4445 return result;
4446 }
4447
4448 public boolean removeTask(int taskId, int flags) throws RemoteException {
4449 Parcel data = Parcel.obtain();
4450 Parcel reply = Parcel.obtain();
4451 data.writeInterfaceToken(IActivityManager.descriptor);
4452 data.writeInt(taskId);
4453 data.writeInt(flags);
4454 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4455 reply.readException();
4456 boolean result = reply.readInt() != 0;
4457 reply.recycle();
4458 data.recycle();
4459 return result;
4460 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004461
Jeff Sharkeya4620792011-05-20 15:29:23 -07004462 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4463 Parcel data = Parcel.obtain();
4464 Parcel reply = Parcel.obtain();
4465 data.writeInterfaceToken(IActivityManager.descriptor);
4466 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4467 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4468 reply.readException();
4469 data.recycle();
4470 reply.recycle();
4471 }
4472
4473 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4474 Parcel data = Parcel.obtain();
4475 Parcel reply = Parcel.obtain();
4476 data.writeInterfaceToken(IActivityManager.descriptor);
4477 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4478 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4479 reply.readException();
4480 data.recycle();
4481 reply.recycle();
4482 }
4483
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004484 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4485 Parcel data = Parcel.obtain();
4486 Parcel reply = Parcel.obtain();
4487 data.writeInterfaceToken(IActivityManager.descriptor);
4488 data.writeStrongBinder(sender.asBinder());
4489 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4490 reply.readException();
4491 boolean res = reply.readInt() != 0;
4492 data.recycle();
4493 reply.recycle();
4494 return res;
4495 }
4496
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004497 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4498 Parcel data = Parcel.obtain();
4499 Parcel reply = Parcel.obtain();
4500 data.writeInterfaceToken(IActivityManager.descriptor);
4501 data.writeStrongBinder(sender.asBinder());
4502 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4503 reply.readException();
4504 boolean res = reply.readInt() != 0;
4505 data.recycle();
4506 reply.recycle();
4507 return res;
4508 }
4509
Dianne Hackborn81038902012-11-26 17:04:09 -08004510 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4511 Parcel data = Parcel.obtain();
4512 Parcel reply = Parcel.obtain();
4513 data.writeInterfaceToken(IActivityManager.descriptor);
4514 data.writeStrongBinder(sender.asBinder());
4515 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4516 reply.readException();
4517 Intent res = reply.readInt() != 0
4518 ? Intent.CREATOR.createFromParcel(reply) : null;
4519 data.recycle();
4520 reply.recycle();
4521 return res;
4522 }
4523
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004524 public String getTagForIntentSender(IIntentSender sender, String prefix)
4525 throws RemoteException {
4526 Parcel data = Parcel.obtain();
4527 Parcel reply = Parcel.obtain();
4528 data.writeInterfaceToken(IActivityManager.descriptor);
4529 data.writeStrongBinder(sender.asBinder());
4530 data.writeString(prefix);
4531 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4532 reply.readException();
4533 String res = reply.readString();
4534 data.recycle();
4535 reply.recycle();
4536 return res;
4537 }
4538
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004539 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4540 {
4541 Parcel data = Parcel.obtain();
4542 Parcel reply = Parcel.obtain();
4543 data.writeInterfaceToken(IActivityManager.descriptor);
4544 values.writeToParcel(data, 0);
4545 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4546 reply.readException();
4547 data.recycle();
4548 reply.recycle();
4549 }
4550
Dianne Hackbornb437e092011-08-05 17:50:29 -07004551 public long[] getProcessPss(int[] pids) throws RemoteException {
4552 Parcel data = Parcel.obtain();
4553 Parcel reply = Parcel.obtain();
4554 data.writeInterfaceToken(IActivityManager.descriptor);
4555 data.writeIntArray(pids);
4556 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4557 reply.readException();
4558 long[] res = reply.createLongArray();
4559 data.recycle();
4560 reply.recycle();
4561 return res;
4562 }
4563
Dianne Hackborn661cd522011-08-22 00:26:20 -07004564 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4565 Parcel data = Parcel.obtain();
4566 Parcel reply = Parcel.obtain();
4567 data.writeInterfaceToken(IActivityManager.descriptor);
4568 TextUtils.writeToParcel(msg, data, 0);
4569 data.writeInt(always ? 1 : 0);
4570 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4571 reply.readException();
4572 data.recycle();
4573 reply.recycle();
4574 }
4575
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004576 public void dismissKeyguardOnNextActivity() throws RemoteException {
4577 Parcel data = Parcel.obtain();
4578 Parcel reply = Parcel.obtain();
4579 data.writeInterfaceToken(IActivityManager.descriptor);
4580 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4581 reply.readException();
4582 data.recycle();
4583 reply.recycle();
4584 }
4585
Adam Powelldd8fab22012-03-22 17:47:27 -07004586 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4587 throws RemoteException {
4588 Parcel data = Parcel.obtain();
4589 Parcel reply = Parcel.obtain();
4590 data.writeInterfaceToken(IActivityManager.descriptor);
4591 data.writeStrongBinder(token);
4592 data.writeString(destAffinity);
4593 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4594 reply.readException();
4595 boolean result = reply.readInt() != 0;
4596 data.recycle();
4597 reply.recycle();
4598 return result;
4599 }
4600
4601 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4602 throws RemoteException {
4603 Parcel data = Parcel.obtain();
4604 Parcel reply = Parcel.obtain();
4605 data.writeInterfaceToken(IActivityManager.descriptor);
4606 data.writeStrongBinder(token);
4607 target.writeToParcel(data, 0);
4608 data.writeInt(resultCode);
4609 if (resultData != null) {
4610 data.writeInt(1);
4611 resultData.writeToParcel(data, 0);
4612 } else {
4613 data.writeInt(0);
4614 }
4615 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4616 reply.readException();
4617 boolean result = reply.readInt() != 0;
4618 data.recycle();
4619 reply.recycle();
4620 return result;
4621 }
4622
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004623 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4624 Parcel data = Parcel.obtain();
4625 Parcel reply = Parcel.obtain();
4626 data.writeInterfaceToken(IActivityManager.descriptor);
4627 data.writeStrongBinder(activityToken);
4628 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4629 reply.readException();
4630 int result = reply.readInt();
4631 data.recycle();
4632 reply.recycle();
4633 return result;
4634 }
4635
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004636 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4637 Parcel data = Parcel.obtain();
4638 Parcel reply = Parcel.obtain();
4639 data.writeInterfaceToken(IActivityManager.descriptor);
4640 data.writeStrongBinder(activityToken);
4641 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4642 reply.readException();
4643 String result = reply.readString();
4644 data.recycle();
4645 reply.recycle();
4646 return result;
4647 }
4648
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004649 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4650 Parcel data = Parcel.obtain();
4651 Parcel reply = Parcel.obtain();
4652 data.writeInterfaceToken(IActivityManager.descriptor);
4653 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4654 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4655 reply.readException();
4656 data.recycle();
4657 reply.recycle();
4658 }
4659
4660 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4661 Parcel data = Parcel.obtain();
4662 Parcel reply = Parcel.obtain();
4663 data.writeInterfaceToken(IActivityManager.descriptor);
4664 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4665 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4666 reply.readException();
4667 data.recycle();
4668 reply.recycle();
4669 }
4670
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004671 public void requestBugReport() throws RemoteException {
4672 Parcel data = Parcel.obtain();
4673 Parcel reply = Parcel.obtain();
4674 data.writeInterfaceToken(IActivityManager.descriptor);
4675 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4676 reply.readException();
4677 data.recycle();
4678 reply.recycle();
4679 }
4680
Jeff Brownbd181bb2013-09-10 16:44:24 -07004681 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4682 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004683 Parcel data = Parcel.obtain();
4684 Parcel reply = Parcel.obtain();
4685 data.writeInterfaceToken(IActivityManager.descriptor);
4686 data.writeInt(pid);
4687 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004688 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004689 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4690 reply.readException();
4691 long res = reply.readInt();
4692 data.recycle();
4693 reply.recycle();
4694 return res;
4695 }
4696
Adam Skorydfc7fd72013-08-05 19:23:41 -07004697 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004698 Parcel data = Parcel.obtain();
4699 Parcel reply = Parcel.obtain();
4700 data.writeInterfaceToken(IActivityManager.descriptor);
4701 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004702 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004703 reply.readException();
4704 Bundle res = reply.readBundle();
4705 data.recycle();
4706 reply.recycle();
4707 return res;
4708 }
4709
Adam Skory7140a252013-09-11 12:04:58 +01004710 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004711 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004712 Parcel data = Parcel.obtain();
4713 Parcel reply = Parcel.obtain();
4714 data.writeInterfaceToken(IActivityManager.descriptor);
4715 data.writeStrongBinder(token);
4716 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004717 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004718 reply.readException();
4719 data.recycle();
4720 reply.recycle();
4721 }
4722
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004723 public void killUid(int uid, String reason) throws RemoteException {
4724 Parcel data = Parcel.obtain();
4725 Parcel reply = Parcel.obtain();
4726 data.writeInterfaceToken(IActivityManager.descriptor);
4727 data.writeInt(uid);
4728 data.writeString(reason);
4729 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4730 reply.readException();
4731 data.recycle();
4732 reply.recycle();
4733 }
4734
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004735 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4736 Parcel data = Parcel.obtain();
4737 Parcel reply = Parcel.obtain();
4738 data.writeInterfaceToken(IActivityManager.descriptor);
4739 data.writeStrongBinder(who);
4740 data.writeInt(allowRestart ? 1 : 0);
4741 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4742 reply.readException();
4743 data.recycle();
4744 reply.recycle();
4745 }
4746
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004747 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4748 Parcel data = Parcel.obtain();
4749 Parcel reply = Parcel.obtain();
4750 data.writeInterfaceToken(IActivityManager.descriptor);
4751 data.writeStrongBinder(token);
4752 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4753 reply.readException();
4754 data.recycle();
4755 reply.recycle();
4756 }
4757
Craig Mautner5eda9b32013-07-02 11:58:16 -07004758 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4759 Parcel data = Parcel.obtain();
4760 Parcel reply = Parcel.obtain();
4761 data.writeInterfaceToken(IActivityManager.descriptor);
4762 data.writeStrongBinder(token);
4763 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4764 reply.readException();
4765 data.recycle();
4766 reply.recycle();
4767 }
4768
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004769 public void restart() throws RemoteException {
4770 Parcel data = Parcel.obtain();
4771 Parcel reply = Parcel.obtain();
4772 data.writeInterfaceToken(IActivityManager.descriptor);
4773 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4774 reply.readException();
4775 data.recycle();
4776 reply.recycle();
4777 }
4778
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004779 public void performIdleMaintenance() throws RemoteException {
4780 Parcel data = Parcel.obtain();
4781 Parcel reply = Parcel.obtain();
4782 data.writeInterfaceToken(IActivityManager.descriptor);
4783 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4784 reply.readException();
4785 data.recycle();
4786 reply.recycle();
4787 }
4788
Craig Mautner4a1cb222013-12-04 16:14:06 -08004789 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4790 IActivityContainerCallback callback) throws RemoteException {
4791 Parcel data = Parcel.obtain();
4792 Parcel reply = Parcel.obtain();
4793 data.writeInterfaceToken(IActivityManager.descriptor);
4794 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07004795 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08004796 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4797 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004798 final int result = reply.readInt();
4799 final IActivityContainer res;
4800 if (result == 1) {
4801 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4802 } else {
4803 res = null;
4804 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004805 data.recycle();
4806 reply.recycle();
4807 return res;
4808 }
4809
Craig Mautner95da1082014-02-24 17:54:35 -08004810 public void deleteActivityContainer(IActivityContainer activityContainer)
4811 throws RemoteException {
4812 Parcel data = Parcel.obtain();
4813 Parcel reply = Parcel.obtain();
4814 data.writeInterfaceToken(IActivityManager.descriptor);
4815 data.writeStrongBinder(activityContainer.asBinder());
4816 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4817 reply.readException();
4818 data.recycle();
4819 reply.recycle();
4820 }
4821
Craig Mautnere0a38842013-12-16 16:14:02 -08004822 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4823 throws RemoteException {
4824 Parcel data = Parcel.obtain();
4825 Parcel reply = Parcel.obtain();
4826 data.writeInterfaceToken(IActivityManager.descriptor);
4827 data.writeStrongBinder(activityToken);
4828 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4829 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004830 final int result = reply.readInt();
4831 final IActivityContainer res;
4832 if (result == 1) {
4833 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4834 } else {
4835 res = null;
4836 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004837 data.recycle();
4838 reply.recycle();
4839 return res;
4840 }
4841
Craig Mautner4a1cb222013-12-04 16:14:06 -08004842 public IBinder getHomeActivityToken() throws RemoteException {
4843 Parcel data = Parcel.obtain();
4844 Parcel reply = Parcel.obtain();
4845 data.writeInterfaceToken(IActivityManager.descriptor);
4846 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4847 reply.readException();
4848 IBinder res = reply.readStrongBinder();
4849 data.recycle();
4850 reply.recycle();
4851 return res;
4852 }
4853
Craig Mautneraea74a52014-03-08 14:23:10 -08004854 @Override
4855 public void startLockTaskMode(int taskId) throws RemoteException {
4856 Parcel data = Parcel.obtain();
4857 Parcel reply = Parcel.obtain();
4858 data.writeInterfaceToken(IActivityManager.descriptor);
4859 data.writeInt(taskId);
4860 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
4861 reply.readException();
4862 data.recycle();
4863 reply.recycle();
4864 }
4865
4866 @Override
4867 public void startLockTaskMode(IBinder token) throws RemoteException {
4868 Parcel data = Parcel.obtain();
4869 Parcel reply = Parcel.obtain();
4870 data.writeInterfaceToken(IActivityManager.descriptor);
4871 data.writeStrongBinder(token);
4872 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
4873 reply.readException();
4874 data.recycle();
4875 reply.recycle();
4876 }
4877
4878 @Override
4879 public void stopLockTaskMode() throws RemoteException {
4880 Parcel data = Parcel.obtain();
4881 Parcel reply = Parcel.obtain();
4882 data.writeInterfaceToken(IActivityManager.descriptor);
4883 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4884 reply.readException();
4885 data.recycle();
4886 reply.recycle();
4887 }
4888
4889 @Override
4890 public boolean isInLockTaskMode() throws RemoteException {
4891 Parcel data = Parcel.obtain();
4892 Parcel reply = Parcel.obtain();
4893 data.writeInterfaceToken(IActivityManager.descriptor);
4894 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4895 reply.readException();
4896 boolean isInLockTaskMode = reply.readInt() == 1;
4897 data.recycle();
4898 reply.recycle();
4899 return isInLockTaskMode;
4900 }
4901
Craig Mautner688b5102014-03-27 16:55:03 -07004902 @Override
Winson Chung03a9bae2014-05-02 09:56:12 -07004903 public void setRecentsActivityValues(IBinder token, ActivityManager.RecentsActivityValues values)
4904 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07004905 Parcel data = Parcel.obtain();
4906 Parcel reply = Parcel.obtain();
4907 data.writeInterfaceToken(IActivityManager.descriptor);
4908 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07004909 values.writeToParcel(data, 0);
4910 mRemote.transact(SET_RECENTS_ACTIVITY_VALUES_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07004911 reply.readException();
4912 data.recycle();
4913 reply.recycle();
4914 }
4915
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004916 private IBinder mRemote;
4917}