blob: 0f65454c264f1d0bf23494b71dfd3d9b91443f88 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070021import android.content.IIntentReceiver;
22import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.Intent;
24import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070025import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070026import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070027import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.pm.ConfigurationInfo;
29import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070030import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070031import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.content.res.Configuration;
33import android.graphics.Bitmap;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080034import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.net.Uri;
36import android.os.Binder;
37import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070038import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039import android.os.IBinder;
40import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070041import android.os.ParcelFileDescriptor;
42import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070043import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070046import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070047import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080050import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070051import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053import java.util.ArrayList;
54import java.util.List;
55
56/** {@hide} */
57public abstract class ActivityManagerNative extends Binder implements IActivityManager
58{
59 /**
60 * Cast a Binder object into an activity manager interface, generating
61 * a proxy if needed.
62 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080063 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080064 if (obj == null) {
65 return null;
66 }
67 IActivityManager in =
68 (IActivityManager)obj.queryLocalInterface(descriptor);
69 if (in != null) {
70 return in;
71 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080072
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073 return new ActivityManagerProxy(obj);
74 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080075
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076 /**
77 * Retrieve the system's default/global activity manager.
78 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079 static public IActivityManager getDefault() {
80 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080081 }
82
83 /**
84 * Convenience for checking whether the system is ready. For internal use only.
85 */
86 static public boolean isSystemReady() {
87 if (!sSystemReady) {
88 sSystemReady = getDefault().testIsSystemReady();
89 }
90 return sSystemReady;
91 }
92 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080093
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080094 /**
95 * Convenience for sending a sticky broadcast. For internal use only.
96 * If you don't care about permission, use null.
97 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099 try {
100 getDefault().broadcastIntent(
101 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800102 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800103 } catch (RemoteException ex) {
104 }
105 }
106
Dianne Hackborn099bc622014-01-22 13:39:16 -0800107 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800109 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 } catch (RemoteException ex) {
111 }
112 }
113
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800114 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800115 attachInterface(this, descriptor);
116 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700117
118 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800119 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
120 throws RemoteException {
121 switch (code) {
122 case START_ACTIVITY_TRANSACTION:
123 {
124 data.enforceInterface(IActivityManager.descriptor);
125 IBinder b = data.readStrongBinder();
126 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800127 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800128 Intent intent = Intent.CREATOR.createFromParcel(data);
129 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800131 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700133 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700134 String profileFile = data.readString();
135 ParcelFileDescriptor profileFd = data.readInt() != 0
136 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700137 Bundle options = data.readInt() != 0
138 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800139 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700140 resultTo, resultWho, requestCode, startFlags,
141 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 reply.writeNoException();
143 reply.writeInt(result);
144 return true;
145 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700146
Amith Yamasani82644082012-08-03 13:09:11 -0700147 case START_ACTIVITY_AS_USER_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
155 IBinder resultTo = data.readStrongBinder();
156 String resultWho = data.readString();
157 int requestCode = data.readInt();
158 int startFlags = data.readInt();
159 String profileFile = data.readString();
160 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700161 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700162 Bundle options = data.readInt() != 0
163 ? Bundle.CREATOR.createFromParcel(data) : null;
164 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800165 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700166 resultTo, resultWho, requestCode, startFlags,
167 profileFile, profileFd, options, userId);
168 reply.writeNoException();
169 reply.writeInt(result);
170 return true;
171 }
172
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 case START_ACTIVITY_AND_WAIT_TRANSACTION:
174 {
175 data.enforceInterface(IActivityManager.descriptor);
176 IBinder b = data.readStrongBinder();
177 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800178 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800179 Intent intent = Intent.CREATOR.createFromParcel(data);
180 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800181 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800182 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800183 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700184 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700185 String profileFile = data.readString();
186 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700187 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700188 Bundle options = data.readInt() != 0
189 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700190 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800191 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700192 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700193 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800194 reply.writeNoException();
195 result.writeToParcel(reply, 0);
196 return true;
197 }
198
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700199 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
200 {
201 data.enforceInterface(IActivityManager.descriptor);
202 IBinder b = data.readStrongBinder();
203 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800204 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700205 Intent intent = Intent.CREATOR.createFromParcel(data);
206 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700207 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700208 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700209 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700210 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700211 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700212 Bundle options = data.readInt() != 0
213 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700214 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800215 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700216 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700217 reply.writeNoException();
218 reply.writeInt(result);
219 return true;
220 }
221
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700222 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700223 {
224 data.enforceInterface(IActivityManager.descriptor);
225 IBinder b = data.readStrongBinder();
226 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700227 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700228 Intent fillInIntent = null;
229 if (data.readInt() != 0) {
230 fillInIntent = Intent.CREATOR.createFromParcel(data);
231 }
232 String resolvedType = data.readString();
233 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700234 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700235 int requestCode = data.readInt();
236 int flagsMask = data.readInt();
237 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700238 Bundle options = data.readInt() != 0
239 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700240 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700241 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700242 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700243 reply.writeNoException();
244 reply.writeInt(result);
245 return true;
246 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700247
Dianne Hackborn91097de2014-04-04 18:02:06 -0700248 case START_VOICE_ACTIVITY_TRANSACTION:
249 {
250 data.enforceInterface(IActivityManager.descriptor);
251 String callingPackage = data.readString();
252 int callingPid = data.readInt();
253 int callingUid = data.readInt();
254 Intent intent = Intent.CREATOR.createFromParcel(data);
255 String resolvedType = data.readString();
256 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
257 data.readStrongBinder());
258 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
259 data.readStrongBinder());
260 int startFlags = data.readInt();
261 String profileFile = data.readString();
262 ParcelFileDescriptor profileFd = data.readInt() != 0
263 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
264 Bundle options = data.readInt() != 0
265 ? Bundle.CREATOR.createFromParcel(data) : null;
266 int userId = data.readInt();
267 int result = startVoiceActivity(callingPackage, callingPid, callingUid,
268 intent, resolvedType, session, interactor, startFlags,
269 profileFile, profileFd, options, userId);
270 reply.writeNoException();
271 reply.writeInt(result);
272 return true;
273 }
274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800275 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
276 {
277 data.enforceInterface(IActivityManager.descriptor);
278 IBinder callingActivity = data.readStrongBinder();
279 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700280 Bundle options = data.readInt() != 0
281 ? Bundle.CREATOR.createFromParcel(data) : null;
282 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800283 reply.writeNoException();
284 reply.writeInt(result ? 1 : 0);
285 return true;
286 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700287
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800288 case FINISH_ACTIVITY_TRANSACTION: {
289 data.enforceInterface(IActivityManager.descriptor);
290 IBinder token = data.readStrongBinder();
291 Intent resultData = null;
292 int resultCode = data.readInt();
293 if (data.readInt() != 0) {
294 resultData = Intent.CREATOR.createFromParcel(data);
295 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700296 boolean finishTask = (data.readInt() != 0);
297 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800298 reply.writeNoException();
299 reply.writeInt(res ? 1 : 0);
300 return true;
301 }
302
303 case FINISH_SUB_ACTIVITY_TRANSACTION: {
304 data.enforceInterface(IActivityManager.descriptor);
305 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700306 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800307 int requestCode = data.readInt();
308 finishSubActivity(token, resultWho, requestCode);
309 reply.writeNoException();
310 return true;
311 }
312
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700313 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
314 data.enforceInterface(IActivityManager.descriptor);
315 IBinder token = data.readStrongBinder();
316 boolean res = finishActivityAffinity(token);
317 reply.writeNoException();
318 reply.writeInt(res ? 1 : 0);
319 return true;
320 }
321
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800322 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
323 data.enforceInterface(IActivityManager.descriptor);
324 IBinder token = data.readStrongBinder();
325 boolean res = willActivityBeVisible(token);
326 reply.writeNoException();
327 reply.writeInt(res ? 1 : 0);
328 return true;
329 }
330
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800331 case REGISTER_RECEIVER_TRANSACTION:
332 {
333 data.enforceInterface(IActivityManager.descriptor);
334 IBinder b = data.readStrongBinder();
335 IApplicationThread app =
336 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700337 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800338 b = data.readStrongBinder();
339 IIntentReceiver rec
340 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
341 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
342 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700343 int userId = data.readInt();
344 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800345 reply.writeNoException();
346 if (intent != null) {
347 reply.writeInt(1);
348 intent.writeToParcel(reply, 0);
349 } else {
350 reply.writeInt(0);
351 }
352 return true;
353 }
354
355 case UNREGISTER_RECEIVER_TRANSACTION:
356 {
357 data.enforceInterface(IActivityManager.descriptor);
358 IBinder b = data.readStrongBinder();
359 if (b == null) {
360 return true;
361 }
362 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
363 unregisterReceiver(rec);
364 reply.writeNoException();
365 return true;
366 }
367
368 case BROADCAST_INTENT_TRANSACTION:
369 {
370 data.enforceInterface(IActivityManager.descriptor);
371 IBinder b = data.readStrongBinder();
372 IApplicationThread app =
373 b != null ? ApplicationThreadNative.asInterface(b) : null;
374 Intent intent = Intent.CREATOR.createFromParcel(data);
375 String resolvedType = data.readString();
376 b = data.readStrongBinder();
377 IIntentReceiver resultTo =
378 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
379 int resultCode = data.readInt();
380 String resultData = data.readString();
381 Bundle resultExtras = data.readBundle();
382 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800383 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 boolean serialized = data.readInt() != 0;
385 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700386 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800388 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700389 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 reply.writeNoException();
391 reply.writeInt(res);
392 return true;
393 }
394
395 case UNBROADCAST_INTENT_TRANSACTION:
396 {
397 data.enforceInterface(IActivityManager.descriptor);
398 IBinder b = data.readStrongBinder();
399 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
400 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700401 int userId = data.readInt();
402 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800403 reply.writeNoException();
404 return true;
405 }
406
407 case FINISH_RECEIVER_TRANSACTION: {
408 data.enforceInterface(IActivityManager.descriptor);
409 IBinder who = data.readStrongBinder();
410 int resultCode = data.readInt();
411 String resultData = data.readString();
412 Bundle resultExtras = data.readBundle();
413 boolean resultAbort = data.readInt() != 0;
414 if (who != null) {
415 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
416 }
417 reply.writeNoException();
418 return true;
419 }
420
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800421 case ATTACH_APPLICATION_TRANSACTION: {
422 data.enforceInterface(IActivityManager.descriptor);
423 IApplicationThread app = ApplicationThreadNative.asInterface(
424 data.readStrongBinder());
425 if (app != null) {
426 attachApplication(app);
427 }
428 reply.writeNoException();
429 return true;
430 }
431
432 case ACTIVITY_IDLE_TRANSACTION: {
433 data.enforceInterface(IActivityManager.descriptor);
434 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700435 Configuration config = null;
436 if (data.readInt() != 0) {
437 config = Configuration.CREATOR.createFromParcel(data);
438 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700439 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700441 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800442 }
443 reply.writeNoException();
444 return true;
445 }
446
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700447 case ACTIVITY_RESUMED_TRANSACTION: {
448 data.enforceInterface(IActivityManager.descriptor);
449 IBinder token = data.readStrongBinder();
450 activityResumed(token);
451 reply.writeNoException();
452 return true;
453 }
454
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800455 case ACTIVITY_PAUSED_TRANSACTION: {
456 data.enforceInterface(IActivityManager.descriptor);
457 IBinder token = data.readStrongBinder();
Craig Mautnera0026042014-04-23 11:45:37 -0700458 PersistableBundle persistentState = data.readPersistableBundle();
459 activityPaused(token, persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800460 reply.writeNoException();
461 return true;
462 }
463
464 case ACTIVITY_STOPPED_TRANSACTION: {
465 data.enforceInterface(IActivityManager.descriptor);
466 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800467 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700468 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800469 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700470 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800471 reply.writeNoException();
472 return true;
473 }
474
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800475 case ACTIVITY_SLEPT_TRANSACTION: {
476 data.enforceInterface(IActivityManager.descriptor);
477 IBinder token = data.readStrongBinder();
478 activitySlept(token);
479 reply.writeNoException();
480 return true;
481 }
482
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800483 case ACTIVITY_DESTROYED_TRANSACTION: {
484 data.enforceInterface(IActivityManager.descriptor);
485 IBinder token = data.readStrongBinder();
486 activityDestroyed(token);
487 reply.writeNoException();
488 return true;
489 }
490
491 case GET_CALLING_PACKAGE_TRANSACTION: {
492 data.enforceInterface(IActivityManager.descriptor);
493 IBinder token = data.readStrongBinder();
494 String res = token != null ? getCallingPackage(token) : null;
495 reply.writeNoException();
496 reply.writeString(res);
497 return true;
498 }
499
500 case GET_CALLING_ACTIVITY_TRANSACTION: {
501 data.enforceInterface(IActivityManager.descriptor);
502 IBinder token = data.readStrongBinder();
503 ComponentName cn = getCallingActivity(token);
504 reply.writeNoException();
505 ComponentName.writeToParcel(cn, reply);
506 return true;
507 }
508
Winson Chung1147c402014-05-14 11:05:00 -0700509 case GET_APP_TASKS_TRANSACTION: {
510 data.enforceInterface(IActivityManager.descriptor);
511 List<IAppTask> list = getAppTasks();
512 reply.writeNoException();
513 int N = list != null ? list.size() : -1;
514 reply.writeInt(N);
515 int i;
516 for (i=0; i<N; i++) {
517 IAppTask task = list.get(i);
518 reply.writeStrongBinder(task.asBinder());
519 }
520 return true;
521 }
522
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800523 case GET_TASKS_TRANSACTION: {
524 data.enforceInterface(IActivityManager.descriptor);
525 int maxNum = data.readInt();
526 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700527 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800528 reply.writeNoException();
529 int N = list != null ? list.size() : -1;
530 reply.writeInt(N);
531 int i;
532 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700533 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800534 info.writeToParcel(reply, 0);
535 }
536 return true;
537 }
538
539 case GET_RECENT_TASKS_TRANSACTION: {
540 data.enforceInterface(IActivityManager.descriptor);
541 int maxNum = data.readInt();
542 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700543 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800544 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700545 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800546 reply.writeNoException();
547 reply.writeTypedList(list);
548 return true;
549 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700550
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700551 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800552 data.enforceInterface(IActivityManager.descriptor);
553 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700554 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800555 reply.writeNoException();
556 if (bm != null) {
557 reply.writeInt(1);
558 bm.writeToParcel(reply, 0);
559 } else {
560 reply.writeInt(0);
561 }
562 return true;
563 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700564
565 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
566 data.enforceInterface(IActivityManager.descriptor);
567 int id = data.readInt();
568 Bitmap bm = getTaskTopThumbnail(id);
569 reply.writeNoException();
570 if (bm != null) {
571 reply.writeInt(1);
572 bm.writeToParcel(reply, 0);
573 } else {
574 reply.writeInt(0);
575 }
576 return true;
577 }
578
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800579 case GET_SERVICES_TRANSACTION: {
580 data.enforceInterface(IActivityManager.descriptor);
581 int maxNum = data.readInt();
582 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700583 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800584 reply.writeNoException();
585 int N = list != null ? list.size() : -1;
586 reply.writeInt(N);
587 int i;
588 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700589 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800590 info.writeToParcel(reply, 0);
591 }
592 return true;
593 }
594
595 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
596 data.enforceInterface(IActivityManager.descriptor);
597 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
598 reply.writeNoException();
599 reply.writeTypedList(list);
600 return true;
601 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700602
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800603 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
604 data.enforceInterface(IActivityManager.descriptor);
605 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
606 reply.writeNoException();
607 reply.writeTypedList(list);
608 return true;
609 }
610
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700611 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
612 data.enforceInterface(IActivityManager.descriptor);
613 List<ApplicationInfo> list = getRunningExternalApplications();
614 reply.writeNoException();
615 reply.writeTypedList(list);
616 return true;
617 }
618
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800619 case MOVE_TASK_TO_FRONT_TRANSACTION: {
620 data.enforceInterface(IActivityManager.descriptor);
621 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800622 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700623 Bundle options = data.readInt() != 0
624 ? Bundle.CREATOR.createFromParcel(data) : null;
625 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800626 reply.writeNoException();
627 return true;
628 }
629
630 case MOVE_TASK_TO_BACK_TRANSACTION: {
631 data.enforceInterface(IActivityManager.descriptor);
632 int task = data.readInt();
633 moveTaskToBack(task);
634 reply.writeNoException();
635 return true;
636 }
637
638 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
639 data.enforceInterface(IActivityManager.descriptor);
640 IBinder token = data.readStrongBinder();
641 boolean nonRoot = data.readInt() != 0;
642 boolean res = moveActivityTaskToBack(token, nonRoot);
643 reply.writeNoException();
644 reply.writeInt(res ? 1 : 0);
645 return true;
646 }
647
648 case MOVE_TASK_BACKWARDS_TRANSACTION: {
649 data.enforceInterface(IActivityManager.descriptor);
650 int task = data.readInt();
651 moveTaskBackwards(task);
652 reply.writeNoException();
653 return true;
654 }
655
Craig Mautnerc00204b2013-03-05 15:02:14 -0800656 case MOVE_TASK_TO_STACK_TRANSACTION: {
657 data.enforceInterface(IActivityManager.descriptor);
658 int taskId = data.readInt();
659 int stackId = data.readInt();
660 boolean toTop = data.readInt() != 0;
661 moveTaskToStack(taskId, stackId, toTop);
662 reply.writeNoException();
663 return true;
664 }
665
666 case RESIZE_STACK_TRANSACTION: {
667 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800668 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800669 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800670 Rect r = Rect.CREATOR.createFromParcel(data);
671 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800672 reply.writeNoException();
673 return true;
674 }
675
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800676 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700677 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800678 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700679 reply.writeNoException();
680 reply.writeTypedList(list);
681 return true;
682 }
683
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800684 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700685 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800686 int stackId = data.readInt();
687 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700688 reply.writeNoException();
689 if (info != null) {
690 reply.writeInt(1);
691 info.writeToParcel(reply, 0);
692 } else {
693 reply.writeInt(0);
694 }
695 return true;
696 }
697
Winson Chung303e1ff2014-03-07 15:06:19 -0800698 case IS_IN_HOME_STACK_TRANSACTION: {
699 data.enforceInterface(IActivityManager.descriptor);
700 int taskId = data.readInt();
701 boolean isInHomeStack = isInHomeStack(taskId);
702 reply.writeNoException();
703 reply.writeInt(isInHomeStack ? 1 : 0);
704 return true;
705 }
706
Craig Mautnercf910b02013-04-23 11:23:27 -0700707 case SET_FOCUSED_STACK_TRANSACTION: {
708 data.enforceInterface(IActivityManager.descriptor);
709 int stackId = data.readInt();
710 setFocusedStack(stackId);
711 reply.writeNoException();
712 return true;
713 }
714
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800715 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
716 data.enforceInterface(IActivityManager.descriptor);
717 IBinder token = data.readStrongBinder();
718 boolean onlyRoot = data.readInt() != 0;
719 int res = token != null
720 ? getTaskForActivity(token, onlyRoot) : -1;
721 reply.writeNoException();
722 reply.writeInt(res);
723 return true;
724 }
725
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800726 case GET_CONTENT_PROVIDER_TRANSACTION: {
727 data.enforceInterface(IActivityManager.descriptor);
728 IBinder b = data.readStrongBinder();
729 IApplicationThread app = ApplicationThreadNative.asInterface(b);
730 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700731 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700732 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700733 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800734 reply.writeNoException();
735 if (cph != null) {
736 reply.writeInt(1);
737 cph.writeToParcel(reply, 0);
738 } else {
739 reply.writeInt(0);
740 }
741 return true;
742 }
743
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800744 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
745 data.enforceInterface(IActivityManager.descriptor);
746 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700747 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800748 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700749 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800750 reply.writeNoException();
751 if (cph != null) {
752 reply.writeInt(1);
753 cph.writeToParcel(reply, 0);
754 } else {
755 reply.writeInt(0);
756 }
757 return true;
758 }
759
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800760 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
761 data.enforceInterface(IActivityManager.descriptor);
762 IBinder b = data.readStrongBinder();
763 IApplicationThread app = ApplicationThreadNative.asInterface(b);
764 ArrayList<ContentProviderHolder> providers =
765 data.createTypedArrayList(ContentProviderHolder.CREATOR);
766 publishContentProviders(app, providers);
767 reply.writeNoException();
768 return true;
769 }
770
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700771 case REF_CONTENT_PROVIDER_TRANSACTION: {
772 data.enforceInterface(IActivityManager.descriptor);
773 IBinder b = data.readStrongBinder();
774 int stable = data.readInt();
775 int unstable = data.readInt();
776 boolean res = refContentProvider(b, stable, unstable);
777 reply.writeNoException();
778 reply.writeInt(res ? 1 : 0);
779 return true;
780 }
781
782 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
783 data.enforceInterface(IActivityManager.descriptor);
784 IBinder b = data.readStrongBinder();
785 unstableProviderDied(b);
786 reply.writeNoException();
787 return true;
788 }
789
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700790 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
791 data.enforceInterface(IActivityManager.descriptor);
792 IBinder b = data.readStrongBinder();
793 appNotRespondingViaProvider(b);
794 reply.writeNoException();
795 return true;
796 }
797
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800798 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
799 data.enforceInterface(IActivityManager.descriptor);
800 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700801 boolean stable = data.readInt() != 0;
802 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800803 reply.writeNoException();
804 return true;
805 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800806
807 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
808 data.enforceInterface(IActivityManager.descriptor);
809 String name = data.readString();
810 IBinder token = data.readStrongBinder();
811 removeContentProviderExternal(name, token);
812 reply.writeNoException();
813 return true;
814 }
815
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700816 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
817 data.enforceInterface(IActivityManager.descriptor);
818 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
819 PendingIntent pi = getRunningServiceControlPanel(comp);
820 reply.writeNoException();
821 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
822 return true;
823 }
824
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800825 case START_SERVICE_TRANSACTION: {
826 data.enforceInterface(IActivityManager.descriptor);
827 IBinder b = data.readStrongBinder();
828 IApplicationThread app = ApplicationThreadNative.asInterface(b);
829 Intent service = Intent.CREATOR.createFromParcel(data);
830 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700831 int userId = data.readInt();
832 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800833 reply.writeNoException();
834 ComponentName.writeToParcel(cn, reply);
835 return true;
836 }
837
838 case STOP_SERVICE_TRANSACTION: {
839 data.enforceInterface(IActivityManager.descriptor);
840 IBinder b = data.readStrongBinder();
841 IApplicationThread app = ApplicationThreadNative.asInterface(b);
842 Intent service = Intent.CREATOR.createFromParcel(data);
843 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700844 int userId = data.readInt();
845 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800846 reply.writeNoException();
847 reply.writeInt(res);
848 return true;
849 }
850
851 case STOP_SERVICE_TOKEN_TRANSACTION: {
852 data.enforceInterface(IActivityManager.descriptor);
853 ComponentName className = ComponentName.readFromParcel(data);
854 IBinder token = data.readStrongBinder();
855 int startId = data.readInt();
856 boolean res = stopServiceToken(className, token, startId);
857 reply.writeNoException();
858 reply.writeInt(res ? 1 : 0);
859 return true;
860 }
861
862 case SET_SERVICE_FOREGROUND_TRANSACTION: {
863 data.enforceInterface(IActivityManager.descriptor);
864 ComponentName className = ComponentName.readFromParcel(data);
865 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700866 int id = data.readInt();
867 Notification notification = null;
868 if (data.readInt() != 0) {
869 notification = Notification.CREATOR.createFromParcel(data);
870 }
871 boolean removeNotification = data.readInt() != 0;
872 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 reply.writeNoException();
874 return true;
875 }
876
877 case BIND_SERVICE_TRANSACTION: {
878 data.enforceInterface(IActivityManager.descriptor);
879 IBinder b = data.readStrongBinder();
880 IApplicationThread app = ApplicationThreadNative.asInterface(b);
881 IBinder token = data.readStrongBinder();
882 Intent service = Intent.CREATOR.createFromParcel(data);
883 String resolvedType = data.readString();
884 b = data.readStrongBinder();
885 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800886 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800887 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800888 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800889 reply.writeNoException();
890 reply.writeInt(res);
891 return true;
892 }
893
894 case UNBIND_SERVICE_TRANSACTION: {
895 data.enforceInterface(IActivityManager.descriptor);
896 IBinder b = data.readStrongBinder();
897 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
898 boolean res = unbindService(conn);
899 reply.writeNoException();
900 reply.writeInt(res ? 1 : 0);
901 return true;
902 }
903
904 case PUBLISH_SERVICE_TRANSACTION: {
905 data.enforceInterface(IActivityManager.descriptor);
906 IBinder token = data.readStrongBinder();
907 Intent intent = Intent.CREATOR.createFromParcel(data);
908 IBinder service = data.readStrongBinder();
909 publishService(token, intent, service);
910 reply.writeNoException();
911 return true;
912 }
913
914 case UNBIND_FINISHED_TRANSACTION: {
915 data.enforceInterface(IActivityManager.descriptor);
916 IBinder token = data.readStrongBinder();
917 Intent intent = Intent.CREATOR.createFromParcel(data);
918 boolean doRebind = data.readInt() != 0;
919 unbindFinished(token, intent, doRebind);
920 reply.writeNoException();
921 return true;
922 }
923
924 case SERVICE_DONE_EXECUTING_TRANSACTION: {
925 data.enforceInterface(IActivityManager.descriptor);
926 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700927 int type = data.readInt();
928 int startId = data.readInt();
929 int res = data.readInt();
930 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800931 reply.writeNoException();
932 return true;
933 }
934
935 case START_INSTRUMENTATION_TRANSACTION: {
936 data.enforceInterface(IActivityManager.descriptor);
937 ComponentName className = ComponentName.readFromParcel(data);
938 String profileFile = data.readString();
939 int fl = data.readInt();
940 Bundle arguments = data.readBundle();
941 IBinder b = data.readStrongBinder();
942 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800943 b = data.readStrongBinder();
944 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700945 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800946 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800947 reply.writeNoException();
948 reply.writeInt(res ? 1 : 0);
949 return true;
950 }
951
952
953 case FINISH_INSTRUMENTATION_TRANSACTION: {
954 data.enforceInterface(IActivityManager.descriptor);
955 IBinder b = data.readStrongBinder();
956 IApplicationThread app = ApplicationThreadNative.asInterface(b);
957 int resultCode = data.readInt();
958 Bundle results = data.readBundle();
959 finishInstrumentation(app, resultCode, results);
960 reply.writeNoException();
961 return true;
962 }
963
964 case GET_CONFIGURATION_TRANSACTION: {
965 data.enforceInterface(IActivityManager.descriptor);
966 Configuration config = getConfiguration();
967 reply.writeNoException();
968 config.writeToParcel(reply, 0);
969 return true;
970 }
971
972 case UPDATE_CONFIGURATION_TRANSACTION: {
973 data.enforceInterface(IActivityManager.descriptor);
974 Configuration config = Configuration.CREATOR.createFromParcel(data);
975 updateConfiguration(config);
976 reply.writeNoException();
977 return true;
978 }
979
980 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
981 data.enforceInterface(IActivityManager.descriptor);
982 IBinder token = data.readStrongBinder();
983 int requestedOrientation = data.readInt();
984 setRequestedOrientation(token, requestedOrientation);
985 reply.writeNoException();
986 return true;
987 }
988
989 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
990 data.enforceInterface(IActivityManager.descriptor);
991 IBinder token = data.readStrongBinder();
992 int req = getRequestedOrientation(token);
993 reply.writeNoException();
994 reply.writeInt(req);
995 return true;
996 }
997
998 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
999 data.enforceInterface(IActivityManager.descriptor);
1000 IBinder token = data.readStrongBinder();
1001 ComponentName cn = getActivityClassForToken(token);
1002 reply.writeNoException();
1003 ComponentName.writeToParcel(cn, reply);
1004 return true;
1005 }
1006
1007 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1008 data.enforceInterface(IActivityManager.descriptor);
1009 IBinder token = data.readStrongBinder();
1010 reply.writeNoException();
1011 reply.writeString(getPackageForToken(token));
1012 return true;
1013 }
1014
1015 case GET_INTENT_SENDER_TRANSACTION: {
1016 data.enforceInterface(IActivityManager.descriptor);
1017 int type = data.readInt();
1018 String packageName = data.readString();
1019 IBinder token = data.readStrongBinder();
1020 String resultWho = data.readString();
1021 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001022 Intent[] requestIntents;
1023 String[] requestResolvedTypes;
1024 if (data.readInt() != 0) {
1025 requestIntents = data.createTypedArray(Intent.CREATOR);
1026 requestResolvedTypes = data.createStringArray();
1027 } else {
1028 requestIntents = null;
1029 requestResolvedTypes = null;
1030 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001031 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001032 Bundle options = data.readInt() != 0
1033 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001034 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001035 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001036 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001037 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001038 reply.writeNoException();
1039 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1040 return true;
1041 }
1042
1043 case CANCEL_INTENT_SENDER_TRANSACTION: {
1044 data.enforceInterface(IActivityManager.descriptor);
1045 IIntentSender r = IIntentSender.Stub.asInterface(
1046 data.readStrongBinder());
1047 cancelIntentSender(r);
1048 reply.writeNoException();
1049 return true;
1050 }
1051
1052 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1053 data.enforceInterface(IActivityManager.descriptor);
1054 IIntentSender r = IIntentSender.Stub.asInterface(
1055 data.readStrongBinder());
1056 String res = getPackageForIntentSender(r);
1057 reply.writeNoException();
1058 reply.writeString(res);
1059 return true;
1060 }
1061
Christopher Tatec4a07d12012-04-06 14:19:13 -07001062 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1063 data.enforceInterface(IActivityManager.descriptor);
1064 IIntentSender r = IIntentSender.Stub.asInterface(
1065 data.readStrongBinder());
1066 int res = getUidForIntentSender(r);
1067 reply.writeNoException();
1068 reply.writeInt(res);
1069 return true;
1070 }
1071
Dianne Hackborn41203752012-08-31 14:05:51 -07001072 case HANDLE_INCOMING_USER_TRANSACTION: {
1073 data.enforceInterface(IActivityManager.descriptor);
1074 int callingPid = data.readInt();
1075 int callingUid = data.readInt();
1076 int userId = data.readInt();
1077 boolean allowAll = data.readInt() != 0 ;
1078 boolean requireFull = data.readInt() != 0;
1079 String name = data.readString();
1080 String callerPackage = data.readString();
1081 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1082 requireFull, name, callerPackage);
1083 reply.writeNoException();
1084 reply.writeInt(res);
1085 return true;
1086 }
1087
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001088 case SET_PROCESS_LIMIT_TRANSACTION: {
1089 data.enforceInterface(IActivityManager.descriptor);
1090 int max = data.readInt();
1091 setProcessLimit(max);
1092 reply.writeNoException();
1093 return true;
1094 }
1095
1096 case GET_PROCESS_LIMIT_TRANSACTION: {
1097 data.enforceInterface(IActivityManager.descriptor);
1098 int limit = getProcessLimit();
1099 reply.writeNoException();
1100 reply.writeInt(limit);
1101 return true;
1102 }
1103
1104 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1105 data.enforceInterface(IActivityManager.descriptor);
1106 IBinder token = data.readStrongBinder();
1107 int pid = data.readInt();
1108 boolean isForeground = data.readInt() != 0;
1109 setProcessForeground(token, pid, isForeground);
1110 reply.writeNoException();
1111 return true;
1112 }
1113
1114 case CHECK_PERMISSION_TRANSACTION: {
1115 data.enforceInterface(IActivityManager.descriptor);
1116 String perm = data.readString();
1117 int pid = data.readInt();
1118 int uid = data.readInt();
1119 int res = checkPermission(perm, pid, uid);
1120 reply.writeNoException();
1121 reply.writeInt(res);
1122 return true;
1123 }
1124
1125 case CHECK_URI_PERMISSION_TRANSACTION: {
1126 data.enforceInterface(IActivityManager.descriptor);
1127 Uri uri = Uri.CREATOR.createFromParcel(data);
1128 int pid = data.readInt();
1129 int uid = data.readInt();
1130 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001131 int userId = data.readInt();
1132 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001133 reply.writeNoException();
1134 reply.writeInt(res);
1135 return true;
1136 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001137
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001138 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001139 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001140 String packageName = data.readString();
1141 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1142 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001143 int userId = data.readInt();
1144 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001145 reply.writeNoException();
1146 reply.writeInt(res ? 1 : 0);
1147 return true;
1148 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001149
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001150 case GRANT_URI_PERMISSION_TRANSACTION: {
1151 data.enforceInterface(IActivityManager.descriptor);
1152 IBinder b = data.readStrongBinder();
1153 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1154 String targetPkg = data.readString();
1155 Uri uri = Uri.CREATOR.createFromParcel(data);
1156 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001157 int userId = data.readInt();
1158 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001159 reply.writeNoException();
1160 return true;
1161 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001162
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001163 case REVOKE_URI_PERMISSION_TRANSACTION: {
1164 data.enforceInterface(IActivityManager.descriptor);
1165 IBinder b = data.readStrongBinder();
1166 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1167 Uri uri = Uri.CREATOR.createFromParcel(data);
1168 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001169 int userId = data.readInt();
1170 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001171 reply.writeNoException();
1172 return true;
1173 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001174
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001175 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1176 data.enforceInterface(IActivityManager.descriptor);
1177 Uri uri = Uri.CREATOR.createFromParcel(data);
1178 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001179 int userId = data.readInt();
1180 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001181 reply.writeNoException();
1182 return true;
1183 }
1184
1185 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1186 data.enforceInterface(IActivityManager.descriptor);
1187 Uri uri = Uri.CREATOR.createFromParcel(data);
1188 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001189 int userId = data.readInt();
1190 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001191 reply.writeNoException();
1192 return true;
1193 }
1194
1195 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1196 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001197 final String packageName = data.readString();
1198 final boolean incoming = data.readInt() != 0;
1199 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1200 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001201 reply.writeNoException();
1202 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1203 return true;
1204 }
1205
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001206 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1207 data.enforceInterface(IActivityManager.descriptor);
1208 IBinder b = data.readStrongBinder();
1209 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1210 boolean waiting = data.readInt() != 0;
1211 showWaitingForDebugger(app, waiting);
1212 reply.writeNoException();
1213 return true;
1214 }
1215
1216 case GET_MEMORY_INFO_TRANSACTION: {
1217 data.enforceInterface(IActivityManager.descriptor);
1218 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1219 getMemoryInfo(mi);
1220 reply.writeNoException();
1221 mi.writeToParcel(reply, 0);
1222 return true;
1223 }
1224
1225 case UNHANDLED_BACK_TRANSACTION: {
1226 data.enforceInterface(IActivityManager.descriptor);
1227 unhandledBack();
1228 reply.writeNoException();
1229 return true;
1230 }
1231
1232 case OPEN_CONTENT_URI_TRANSACTION: {
1233 data.enforceInterface(IActivityManager.descriptor);
1234 Uri uri = Uri.parse(data.readString());
1235 ParcelFileDescriptor pfd = openContentUri(uri);
1236 reply.writeNoException();
1237 if (pfd != null) {
1238 reply.writeInt(1);
1239 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1240 } else {
1241 reply.writeInt(0);
1242 }
1243 return true;
1244 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001245
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001246 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1247 data.enforceInterface(IActivityManager.descriptor);
1248 setLockScreenShown(data.readInt() != 0);
1249 reply.writeNoException();
1250 return true;
1251 }
1252
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 case SET_DEBUG_APP_TRANSACTION: {
1254 data.enforceInterface(IActivityManager.descriptor);
1255 String pn = data.readString();
1256 boolean wfd = data.readInt() != 0;
1257 boolean per = data.readInt() != 0;
1258 setDebugApp(pn, wfd, per);
1259 reply.writeNoException();
1260 return true;
1261 }
1262
1263 case SET_ALWAYS_FINISH_TRANSACTION: {
1264 data.enforceInterface(IActivityManager.descriptor);
1265 boolean enabled = data.readInt() != 0;
1266 setAlwaysFinish(enabled);
1267 reply.writeNoException();
1268 return true;
1269 }
1270
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001271 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001272 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001273 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001274 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001275 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001276 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001277 return true;
1278 }
1279
1280 case ENTER_SAFE_MODE_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
1282 enterSafeMode();
1283 reply.writeNoException();
1284 return true;
1285 }
1286
1287 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1288 data.enforceInterface(IActivityManager.descriptor);
1289 IIntentSender is = IIntentSender.Stub.asInterface(
1290 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001291 int sourceUid = data.readInt();
1292 String sourcePkg = data.readString();
1293 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001294 reply.writeNoException();
1295 return true;
1296 }
1297
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001298 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001299 data.enforceInterface(IActivityManager.descriptor);
1300 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001301 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001302 boolean secure = data.readInt() != 0;
1303 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001304 reply.writeNoException();
1305 reply.writeInt(res ? 1 : 0);
1306 return true;
1307 }
1308
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001309 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1310 data.enforceInterface(IActivityManager.descriptor);
1311 String reason = data.readString();
1312 boolean res = killProcessesBelowForeground(reason);
1313 reply.writeNoException();
1314 reply.writeInt(res ? 1 : 0);
1315 return true;
1316 }
1317
Dan Egnor60d87622009-12-16 16:32:58 -08001318 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1319 data.enforceInterface(IActivityManager.descriptor);
1320 IBinder app = data.readStrongBinder();
1321 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1322 handleApplicationCrash(app, ci);
1323 reply.writeNoException();
1324 return true;
1325 }
1326
1327 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001328 data.enforceInterface(IActivityManager.descriptor);
1329 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001330 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001331 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001332 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001333 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001334 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001335 return true;
1336 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001337
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001338 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1339 data.enforceInterface(IActivityManager.descriptor);
1340 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001341 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001342 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1343 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001344 reply.writeNoException();
1345 return true;
1346 }
1347
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001348 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1349 data.enforceInterface(IActivityManager.descriptor);
1350 int sig = data.readInt();
1351 signalPersistentProcesses(sig);
1352 reply.writeNoException();
1353 return true;
1354 }
1355
Dianne Hackborn03abb812010-01-04 18:43:19 -08001356 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1357 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001358 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001359 int userId = data.readInt();
1360 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001361 reply.writeNoException();
1362 return true;
1363 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001364
1365 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1366 data.enforceInterface(IActivityManager.descriptor);
1367 killAllBackgroundProcesses();
1368 reply.writeNoException();
1369 return true;
1370 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001371
Dianne Hackborn03abb812010-01-04 18:43:19 -08001372 case FORCE_STOP_PACKAGE_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
1374 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001375 int userId = data.readInt();
1376 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001377 reply.writeNoException();
1378 return true;
1379 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001380
1381 case GET_MY_MEMORY_STATE_TRANSACTION: {
1382 data.enforceInterface(IActivityManager.descriptor);
1383 ActivityManager.RunningAppProcessInfo info =
1384 new ActivityManager.RunningAppProcessInfo();
1385 getMyMemoryState(info);
1386 reply.writeNoException();
1387 info.writeToParcel(reply, 0);
1388 return true;
1389 }
1390
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001391 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1392 data.enforceInterface(IActivityManager.descriptor);
1393 ConfigurationInfo config = getDeviceConfigurationInfo();
1394 reply.writeNoException();
1395 config.writeToParcel(reply, 0);
1396 return true;
1397 }
1398
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001399 case PROFILE_CONTROL_TRANSACTION: {
1400 data.enforceInterface(IActivityManager.descriptor);
1401 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001402 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001403 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001404 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001405 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001406 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001407 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001408 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001409 reply.writeNoException();
1410 reply.writeInt(res ? 1 : 0);
1411 return true;
1412 }
1413
Dianne Hackborn55280a92009-05-07 15:53:46 -07001414 case SHUTDOWN_TRANSACTION: {
1415 data.enforceInterface(IActivityManager.descriptor);
1416 boolean res = shutdown(data.readInt());
1417 reply.writeNoException();
1418 reply.writeInt(res ? 1 : 0);
1419 return true;
1420 }
1421
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001422 case STOP_APP_SWITCHES_TRANSACTION: {
1423 data.enforceInterface(IActivityManager.descriptor);
1424 stopAppSwitches();
1425 reply.writeNoException();
1426 return true;
1427 }
1428
1429 case RESUME_APP_SWITCHES_TRANSACTION: {
1430 data.enforceInterface(IActivityManager.descriptor);
1431 resumeAppSwitches();
1432 reply.writeNoException();
1433 return true;
1434 }
1435
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001436 case PEEK_SERVICE_TRANSACTION: {
1437 data.enforceInterface(IActivityManager.descriptor);
1438 Intent service = Intent.CREATOR.createFromParcel(data);
1439 String resolvedType = data.readString();
1440 IBinder binder = peekService(service, resolvedType);
1441 reply.writeNoException();
1442 reply.writeStrongBinder(binder);
1443 return true;
1444 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001445
1446 case START_BACKUP_AGENT_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
1448 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1449 int backupRestoreMode = data.readInt();
1450 boolean success = bindBackupAgent(info, backupRestoreMode);
1451 reply.writeNoException();
1452 reply.writeInt(success ? 1 : 0);
1453 return true;
1454 }
1455
1456 case BACKUP_AGENT_CREATED_TRANSACTION: {
1457 data.enforceInterface(IActivityManager.descriptor);
1458 String packageName = data.readString();
1459 IBinder agent = data.readStrongBinder();
1460 backupAgentCreated(packageName, agent);
1461 reply.writeNoException();
1462 return true;
1463 }
1464
1465 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1466 data.enforceInterface(IActivityManager.descriptor);
1467 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1468 unbindBackupAgent(info);
1469 reply.writeNoException();
1470 return true;
1471 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001472
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001473 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001474 data.enforceInterface(IActivityManager.descriptor);
1475 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001476 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001477 String reason = data.readString();
1478 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001479 reply.writeNoException();
1480 return true;
1481 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001482
1483 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1484 data.enforceInterface(IActivityManager.descriptor);
1485 String reason = data.readString();
1486 closeSystemDialogs(reason);
1487 reply.writeNoException();
1488 return true;
1489 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001490
1491 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1492 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001493 int[] pids = data.createIntArray();
1494 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001495 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001496 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001497 return true;
1498 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001499
1500 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1501 data.enforceInterface(IActivityManager.descriptor);
1502 String processName = data.readString();
1503 int uid = data.readInt();
1504 killApplicationProcess(processName, uid);
1505 reply.writeNoException();
1506 return true;
1507 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001508
1509 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1510 data.enforceInterface(IActivityManager.descriptor);
1511 IBinder token = data.readStrongBinder();
1512 String packageName = data.readString();
1513 int enterAnim = data.readInt();
1514 int exitAnim = data.readInt();
1515 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001516 reply.writeNoException();
1517 return true;
1518 }
1519
1520 case IS_USER_A_MONKEY_TRANSACTION: {
1521 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001522 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001523 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001524 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001525 return true;
1526 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001527
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001528 case SET_USER_IS_MONKEY_TRANSACTION: {
1529 data.enforceInterface(IActivityManager.descriptor);
1530 final boolean monkey = (data.readInt() == 1);
1531 setUserIsMonkey(monkey);
1532 reply.writeNoException();
1533 return true;
1534 }
1535
Dianne Hackborn860755f2010-06-03 18:47:52 -07001536 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1537 data.enforceInterface(IActivityManager.descriptor);
1538 finishHeavyWeightApp();
1539 reply.writeNoException();
1540 return true;
1541 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001542
1543 case IS_IMMERSIVE_TRANSACTION: {
1544 data.enforceInterface(IActivityManager.descriptor);
1545 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001546 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001547 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001548 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001549 return true;
1550 }
1551
Craig Mautner5eda9b32013-07-02 11:58:16 -07001552 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001553 data.enforceInterface(IActivityManager.descriptor);
1554 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001555 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001556 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001557 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001558 return true;
1559 }
1560
1561 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1562 data.enforceInterface(IActivityManager.descriptor);
1563 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001564 final Bundle bundle;
1565 if (data.readInt() == 0) {
1566 bundle = null;
1567 } else {
1568 bundle = data.readBundle();
1569 }
1570 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1571 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001572 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001573 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001574 return true;
1575 }
1576
Craig Mautner233ceee2014-05-09 17:05:11 -07001577 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 IBinder token = data.readStrongBinder();
1580 final ActivityOptions options = getActivityOptions(token);
1581 reply.writeNoException();
1582 reply.writeBundle(options == null ? null : options.toBundle());
1583 return true;
1584 }
1585
Daniel Sandler69a48172010-06-23 16:29:36 -04001586 case SET_IMMERSIVE_TRANSACTION: {
1587 data.enforceInterface(IActivityManager.descriptor);
1588 IBinder token = data.readStrongBinder();
1589 boolean imm = data.readInt() == 1;
1590 setImmersive(token, imm);
1591 reply.writeNoException();
1592 return true;
1593 }
1594
1595 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1596 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001597 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001598 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001599 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001600 return true;
1601 }
1602
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001603 case CRASH_APPLICATION_TRANSACTION: {
1604 data.enforceInterface(IActivityManager.descriptor);
1605 int uid = data.readInt();
1606 int initialPid = data.readInt();
1607 String packageName = data.readString();
1608 String message = data.readString();
1609 crashApplication(uid, initialPid, packageName, message);
1610 reply.writeNoException();
1611 return true;
1612 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001613
1614 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1615 data.enforceInterface(IActivityManager.descriptor);
1616 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001617 int userId = data.readInt();
1618 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001619 reply.writeNoException();
1620 reply.writeString(type);
1621 return true;
1622 }
1623
Dianne Hackborn7e269642010-08-25 19:50:20 -07001624 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1625 data.enforceInterface(IActivityManager.descriptor);
1626 String name = data.readString();
1627 IBinder perm = newUriPermissionOwner(name);
1628 reply.writeNoException();
1629 reply.writeStrongBinder(perm);
1630 return true;
1631 }
1632
1633 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1634 data.enforceInterface(IActivityManager.descriptor);
1635 IBinder owner = data.readStrongBinder();
1636 int fromUid = data.readInt();
1637 String targetPkg = data.readString();
1638 Uri uri = Uri.CREATOR.createFromParcel(data);
1639 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001640 int userId = data.readInt();
1641 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001642 reply.writeNoException();
1643 return true;
1644 }
1645
1646 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1647 data.enforceInterface(IActivityManager.descriptor);
1648 IBinder owner = data.readStrongBinder();
1649 Uri uri = null;
1650 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001651 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001652 }
1653 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001654 int userId = data.readInt();
1655 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001656 reply.writeNoException();
1657 return true;
1658 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001659
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001660 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1661 data.enforceInterface(IActivityManager.descriptor);
1662 int callingUid = data.readInt();
1663 String targetPkg = data.readString();
1664 Uri uri = Uri.CREATOR.createFromParcel(data);
1665 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001666 int userId = data.readInt();
1667 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001668 reply.writeNoException();
1669 reply.writeInt(res);
1670 return true;
1671 }
1672
Andy McFadden824c5102010-07-09 16:26:57 -07001673 case DUMP_HEAP_TRANSACTION: {
1674 data.enforceInterface(IActivityManager.descriptor);
1675 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001676 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001677 boolean managed = data.readInt() != 0;
1678 String path = data.readString();
1679 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001680 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001681 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001682 reply.writeNoException();
1683 reply.writeInt(res ? 1 : 0);
1684 return true;
1685 }
1686
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001687 case START_ACTIVITIES_TRANSACTION:
1688 {
1689 data.enforceInterface(IActivityManager.descriptor);
1690 IBinder b = data.readStrongBinder();
1691 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001692 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001693 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1694 String[] resolvedTypes = data.createStringArray();
1695 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001696 Bundle options = data.readInt() != 0
1697 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001698 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001699 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001700 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001701 reply.writeNoException();
1702 reply.writeInt(result);
1703 return true;
1704 }
1705
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001706 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1707 {
1708 data.enforceInterface(IActivityManager.descriptor);
1709 int mode = getFrontActivityScreenCompatMode();
1710 reply.writeNoException();
1711 reply.writeInt(mode);
1712 return true;
1713 }
1714
1715 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1716 {
1717 data.enforceInterface(IActivityManager.descriptor);
1718 int mode = data.readInt();
1719 setFrontActivityScreenCompatMode(mode);
1720 reply.writeNoException();
1721 reply.writeInt(mode);
1722 return true;
1723 }
1724
1725 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1726 {
1727 data.enforceInterface(IActivityManager.descriptor);
1728 String pkg = data.readString();
1729 int mode = getPackageScreenCompatMode(pkg);
1730 reply.writeNoException();
1731 reply.writeInt(mode);
1732 return true;
1733 }
1734
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001735 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1736 {
1737 data.enforceInterface(IActivityManager.descriptor);
1738 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001739 int mode = data.readInt();
1740 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001741 reply.writeNoException();
1742 return true;
1743 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001744
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001745 case SWITCH_USER_TRANSACTION: {
1746 data.enforceInterface(IActivityManager.descriptor);
1747 int userid = data.readInt();
1748 boolean result = switchUser(userid);
1749 reply.writeNoException();
1750 reply.writeInt(result ? 1 : 0);
1751 return true;
1752 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001753
Kenny Guy08488bf2014-02-21 17:40:37 +00001754 case START_USER_IN_BACKGROUND_TRANSACTION: {
1755 data.enforceInterface(IActivityManager.descriptor);
1756 int userid = data.readInt();
1757 boolean result = startUserInBackground(userid);
1758 reply.writeNoException();
1759 reply.writeInt(result ? 1 : 0);
1760 return true;
1761 }
1762
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001763 case STOP_USER_TRANSACTION: {
1764 data.enforceInterface(IActivityManager.descriptor);
1765 int userid = data.readInt();
1766 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1767 data.readStrongBinder());
1768 int result = stopUser(userid, callback);
1769 reply.writeNoException();
1770 reply.writeInt(result);
1771 return true;
1772 }
1773
Amith Yamasani52f1d752012-03-28 18:19:29 -07001774 case GET_CURRENT_USER_TRANSACTION: {
1775 data.enforceInterface(IActivityManager.descriptor);
1776 UserInfo userInfo = getCurrentUser();
1777 reply.writeNoException();
1778 userInfo.writeToParcel(reply, 0);
1779 return true;
1780 }
1781
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001782 case IS_USER_RUNNING_TRANSACTION: {
1783 data.enforceInterface(IActivityManager.descriptor);
1784 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001785 boolean orStopping = data.readInt() != 0;
1786 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001787 reply.writeNoException();
1788 reply.writeInt(result ? 1 : 0);
1789 return true;
1790 }
1791
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001792 case GET_RUNNING_USER_IDS_TRANSACTION: {
1793 data.enforceInterface(IActivityManager.descriptor);
1794 int[] result = getRunningUserIds();
1795 reply.writeNoException();
1796 reply.writeIntArray(result);
1797 return true;
1798 }
1799
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001800 case REMOVE_SUB_TASK_TRANSACTION:
1801 {
1802 data.enforceInterface(IActivityManager.descriptor);
1803 int taskId = data.readInt();
1804 int subTaskIndex = data.readInt();
1805 boolean result = removeSubTask(taskId, subTaskIndex);
1806 reply.writeNoException();
1807 reply.writeInt(result ? 1 : 0);
1808 return true;
1809 }
1810
1811 case REMOVE_TASK_TRANSACTION:
1812 {
1813 data.enforceInterface(IActivityManager.descriptor);
1814 int taskId = data.readInt();
1815 int fl = data.readInt();
1816 boolean result = removeTask(taskId, fl);
1817 reply.writeNoException();
1818 reply.writeInt(result ? 1 : 0);
1819 return true;
1820 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001821
Jeff Sharkeya4620792011-05-20 15:29:23 -07001822 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1823 data.enforceInterface(IActivityManager.descriptor);
1824 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1825 data.readStrongBinder());
1826 registerProcessObserver(observer);
1827 return true;
1828 }
1829
1830 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1831 data.enforceInterface(IActivityManager.descriptor);
1832 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1833 data.readStrongBinder());
1834 unregisterProcessObserver(observer);
1835 return true;
1836 }
1837
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001838 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1839 {
1840 data.enforceInterface(IActivityManager.descriptor);
1841 String pkg = data.readString();
1842 boolean ask = getPackageAskScreenCompat(pkg);
1843 reply.writeNoException();
1844 reply.writeInt(ask ? 1 : 0);
1845 return true;
1846 }
1847
1848 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1849 {
1850 data.enforceInterface(IActivityManager.descriptor);
1851 String pkg = data.readString();
1852 boolean ask = data.readInt() != 0;
1853 setPackageAskScreenCompat(pkg, ask);
1854 reply.writeNoException();
1855 return true;
1856 }
1857
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001858 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1859 data.enforceInterface(IActivityManager.descriptor);
1860 IIntentSender r = IIntentSender.Stub.asInterface(
1861 data.readStrongBinder());
1862 boolean res = isIntentSenderTargetedToPackage(r);
1863 reply.writeNoException();
1864 reply.writeInt(res ? 1 : 0);
1865 return true;
1866 }
1867
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001868 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1869 data.enforceInterface(IActivityManager.descriptor);
1870 IIntentSender r = IIntentSender.Stub.asInterface(
1871 data.readStrongBinder());
1872 boolean res = isIntentSenderAnActivity(r);
1873 reply.writeNoException();
1874 reply.writeInt(res ? 1 : 0);
1875 return true;
1876 }
1877
Dianne Hackborn81038902012-11-26 17:04:09 -08001878 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1879 data.enforceInterface(IActivityManager.descriptor);
1880 IIntentSender r = IIntentSender.Stub.asInterface(
1881 data.readStrongBinder());
1882 Intent intent = getIntentForIntentSender(r);
1883 reply.writeNoException();
1884 if (intent != null) {
1885 reply.writeInt(1);
1886 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1887 } else {
1888 reply.writeInt(0);
1889 }
1890 return true;
1891 }
1892
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001893 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1894 data.enforceInterface(IActivityManager.descriptor);
1895 IIntentSender r = IIntentSender.Stub.asInterface(
1896 data.readStrongBinder());
1897 String prefix = data.readString();
1898 String tag = getTagForIntentSender(r, prefix);
1899 reply.writeNoException();
1900 reply.writeString(tag);
1901 return true;
1902 }
1903
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001904 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1905 data.enforceInterface(IActivityManager.descriptor);
1906 Configuration config = Configuration.CREATOR.createFromParcel(data);
1907 updatePersistentConfiguration(config);
1908 reply.writeNoException();
1909 return true;
1910 }
1911
Dianne Hackbornb437e092011-08-05 17:50:29 -07001912 case GET_PROCESS_PSS_TRANSACTION: {
1913 data.enforceInterface(IActivityManager.descriptor);
1914 int[] pids = data.createIntArray();
1915 long[] pss = getProcessPss(pids);
1916 reply.writeNoException();
1917 reply.writeLongArray(pss);
1918 return true;
1919 }
1920
Dianne Hackborn661cd522011-08-22 00:26:20 -07001921 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1922 data.enforceInterface(IActivityManager.descriptor);
1923 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1924 boolean always = data.readInt() != 0;
1925 showBootMessage(msg, always);
1926 reply.writeNoException();
1927 return true;
1928 }
1929
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001930 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1931 data.enforceInterface(IActivityManager.descriptor);
1932 dismissKeyguardOnNextActivity();
1933 reply.writeNoException();
1934 return true;
1935 }
1936
Adam Powelldd8fab22012-03-22 17:47:27 -07001937 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1938 data.enforceInterface(IActivityManager.descriptor);
1939 IBinder token = data.readStrongBinder();
1940 String destAffinity = data.readString();
1941 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1942 reply.writeNoException();
1943 reply.writeInt(res ? 1 : 0);
1944 return true;
1945 }
1946
1947 case NAVIGATE_UP_TO_TRANSACTION: {
1948 data.enforceInterface(IActivityManager.descriptor);
1949 IBinder token = data.readStrongBinder();
1950 Intent target = Intent.CREATOR.createFromParcel(data);
1951 int resultCode = data.readInt();
1952 Intent resultData = null;
1953 if (data.readInt() != 0) {
1954 resultData = Intent.CREATOR.createFromParcel(data);
1955 }
1956 boolean res = navigateUpTo(token, target, resultCode, resultData);
1957 reply.writeNoException();
1958 reply.writeInt(res ? 1 : 0);
1959 return true;
1960 }
1961
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001962 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1963 data.enforceInterface(IActivityManager.descriptor);
1964 IBinder token = data.readStrongBinder();
1965 int res = getLaunchedFromUid(token);
1966 reply.writeNoException();
1967 reply.writeInt(res);
1968 return true;
1969 }
1970
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001971 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1972 data.enforceInterface(IActivityManager.descriptor);
1973 IBinder token = data.readStrongBinder();
1974 String res = getLaunchedFromPackage(token);
1975 reply.writeNoException();
1976 reply.writeString(res);
1977 return true;
1978 }
1979
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001980 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1981 data.enforceInterface(IActivityManager.descriptor);
1982 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1983 data.readStrongBinder());
1984 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001985 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001986 return true;
1987 }
1988
1989 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1990 data.enforceInterface(IActivityManager.descriptor);
1991 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1992 data.readStrongBinder());
1993 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001994 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001995 return true;
1996 }
1997
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001998 case REQUEST_BUG_REPORT_TRANSACTION: {
1999 data.enforceInterface(IActivityManager.descriptor);
2000 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002001 reply.writeNoException();
2002 return true;
2003 }
2004
2005 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2006 data.enforceInterface(IActivityManager.descriptor);
2007 int pid = data.readInt();
2008 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002009 String reason = data.readString();
2010 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002011 reply.writeNoException();
2012 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002013 return true;
2014 }
2015
Adam Skorydfc7fd72013-08-05 19:23:41 -07002016 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002017 data.enforceInterface(IActivityManager.descriptor);
2018 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002019 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002020 reply.writeNoException();
2021 reply.writeBundle(res);
2022 return true;
2023 }
2024
Adam Skorydfc7fd72013-08-05 19:23:41 -07002025 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002026 data.enforceInterface(IActivityManager.descriptor);
2027 IBinder token = data.readStrongBinder();
2028 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002029 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002030 reply.writeNoException();
2031 return true;
2032 }
2033
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002034 case KILL_UID_TRANSACTION: {
2035 data.enforceInterface(IActivityManager.descriptor);
2036 int uid = data.readInt();
2037 String reason = data.readString();
2038 killUid(uid, reason);
2039 reply.writeNoException();
2040 return true;
2041 }
2042
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002043 case HANG_TRANSACTION: {
2044 data.enforceInterface(IActivityManager.descriptor);
2045 IBinder who = data.readStrongBinder();
2046 boolean allowRestart = data.readInt() != 0;
2047 hang(who, allowRestart);
2048 reply.writeNoException();
2049 return true;
2050 }
2051
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002052 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2053 data.enforceInterface(IActivityManager.descriptor);
2054 IBinder token = data.readStrongBinder();
2055 reportActivityFullyDrawn(token);
2056 reply.writeNoException();
2057 return true;
2058 }
2059
Craig Mautner5eda9b32013-07-02 11:58:16 -07002060 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2061 data.enforceInterface(IActivityManager.descriptor);
2062 IBinder token = data.readStrongBinder();
2063 notifyActivityDrawn(token);
2064 reply.writeNoException();
2065 return true;
2066 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002067
2068 case RESTART_TRANSACTION: {
2069 data.enforceInterface(IActivityManager.descriptor);
2070 restart();
2071 reply.writeNoException();
2072 return true;
2073 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002074
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002075 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2076 data.enforceInterface(IActivityManager.descriptor);
2077 performIdleMaintenance();
2078 reply.writeNoException();
2079 return true;
2080 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002081
2082 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2083 data.enforceInterface(IActivityManager.descriptor);
2084 IBinder parentActivityToken = data.readStrongBinder();
2085 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002086 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002087 IActivityContainer activityContainer =
2088 createActivityContainer(parentActivityToken, callback);
2089 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002090 if (activityContainer != null) {
2091 reply.writeInt(1);
2092 reply.writeStrongBinder(activityContainer.asBinder());
2093 } else {
2094 reply.writeInt(0);
2095 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002096 return true;
2097 }
2098
Craig Mautner95da1082014-02-24 17:54:35 -08002099 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2100 data.enforceInterface(IActivityManager.descriptor);
2101 IActivityContainer activityContainer =
2102 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2103 deleteActivityContainer(activityContainer);
2104 reply.writeNoException();
2105 return true;
2106 }
2107
Craig Mautnere0a38842013-12-16 16:14:02 -08002108 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2109 data.enforceInterface(IActivityManager.descriptor);
2110 IBinder activityToken = data.readStrongBinder();
2111 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2112 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002113 if (activityContainer != null) {
2114 reply.writeInt(1);
2115 reply.writeStrongBinder(activityContainer.asBinder());
2116 } else {
2117 reply.writeInt(0);
2118 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002119 return true;
2120 }
2121
Craig Mautner4a1cb222013-12-04 16:14:06 -08002122 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2123 data.enforceInterface(IActivityManager.descriptor);
2124 IBinder homeActivityToken = getHomeActivityToken();
2125 reply.writeNoException();
2126 reply.writeStrongBinder(homeActivityToken);
2127 return true;
2128 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002129
2130 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2131 data.enforceInterface(IActivityManager.descriptor);
2132 final int taskId = data.readInt();
2133 startLockTaskMode(taskId);
2134 reply.writeNoException();
2135 return true;
2136 }
2137
2138 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2139 data.enforceInterface(IActivityManager.descriptor);
2140 IBinder token = data.readStrongBinder();
2141 startLockTaskMode(token);
2142 reply.writeNoException();
2143 return true;
2144 }
2145
2146 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2147 data.enforceInterface(IActivityManager.descriptor);
2148 stopLockTaskMode();
2149 reply.writeNoException();
2150 return true;
2151 }
2152
2153 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2154 data.enforceInterface(IActivityManager.descriptor);
2155 final boolean isInLockTaskMode = isInLockTaskMode();
2156 reply.writeNoException();
2157 reply.writeInt(isInLockTaskMode ? 1 : 0);
2158 return true;
2159 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002160
Winson Chunga449dc02014-05-16 11:15:04 -07002161 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002162 data.enforceInterface(IActivityManager.descriptor);
2163 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002164 ActivityManager.TaskDescription values =
2165 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2166 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002167 reply.writeNoException();
2168 return true;
2169 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002170 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002171
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002172 return super.onTransact(code, data, reply, flags);
2173 }
2174
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002175 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002176 return this;
2177 }
2178
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002179 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2180 protected IActivityManager create() {
2181 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002182 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002183 Log.v("ActivityManager", "default service binder = " + b);
2184 }
2185 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002186 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002187 Log.v("ActivityManager", "default service = " + am);
2188 }
2189 return am;
2190 }
2191 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002192}
2193
2194class ActivityManagerProxy implements IActivityManager
2195{
2196 public ActivityManagerProxy(IBinder remote)
2197 {
2198 mRemote = remote;
2199 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002200
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002201 public IBinder asBinder()
2202 {
2203 return mRemote;
2204 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002205
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002206 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002207 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2208 int startFlags, String profileFile,
2209 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002210 Parcel data = Parcel.obtain();
2211 Parcel reply = Parcel.obtain();
2212 data.writeInterfaceToken(IActivityManager.descriptor);
2213 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002214 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002215 intent.writeToParcel(data, 0);
2216 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002217 data.writeStrongBinder(resultTo);
2218 data.writeString(resultWho);
2219 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002220 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002221 data.writeString(profileFile);
2222 if (profileFd != null) {
2223 data.writeInt(1);
2224 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2225 } else {
2226 data.writeInt(0);
2227 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002228 if (options != null) {
2229 data.writeInt(1);
2230 options.writeToParcel(data, 0);
2231 } else {
2232 data.writeInt(0);
2233 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002234 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2235 reply.readException();
2236 int result = reply.readInt();
2237 reply.recycle();
2238 data.recycle();
2239 return result;
2240 }
Amith Yamasani82644082012-08-03 13:09:11 -07002241
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002242 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002243 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2244 int startFlags, String profileFile,
2245 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2246 Parcel data = Parcel.obtain();
2247 Parcel reply = Parcel.obtain();
2248 data.writeInterfaceToken(IActivityManager.descriptor);
2249 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002250 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002251 intent.writeToParcel(data, 0);
2252 data.writeString(resolvedType);
2253 data.writeStrongBinder(resultTo);
2254 data.writeString(resultWho);
2255 data.writeInt(requestCode);
2256 data.writeInt(startFlags);
2257 data.writeString(profileFile);
2258 if (profileFd != null) {
2259 data.writeInt(1);
2260 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2261 } else {
2262 data.writeInt(0);
2263 }
2264 if (options != null) {
2265 data.writeInt(1);
2266 options.writeToParcel(data, 0);
2267 } else {
2268 data.writeInt(0);
2269 }
2270 data.writeInt(userId);
2271 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2272 reply.readException();
2273 int result = reply.readInt();
2274 reply.recycle();
2275 data.recycle();
2276 return result;
2277 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002278 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2279 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002280 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002281 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002282 Parcel data = Parcel.obtain();
2283 Parcel reply = Parcel.obtain();
2284 data.writeInterfaceToken(IActivityManager.descriptor);
2285 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002286 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002287 intent.writeToParcel(data, 0);
2288 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002289 data.writeStrongBinder(resultTo);
2290 data.writeString(resultWho);
2291 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002292 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002293 data.writeString(profileFile);
2294 if (profileFd != null) {
2295 data.writeInt(1);
2296 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2297 } else {
2298 data.writeInt(0);
2299 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002300 if (options != null) {
2301 data.writeInt(1);
2302 options.writeToParcel(data, 0);
2303 } else {
2304 data.writeInt(0);
2305 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002306 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002307 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2308 reply.readException();
2309 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2310 reply.recycle();
2311 data.recycle();
2312 return result;
2313 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002314 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2315 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002316 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002317 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002318 Parcel data = Parcel.obtain();
2319 Parcel reply = Parcel.obtain();
2320 data.writeInterfaceToken(IActivityManager.descriptor);
2321 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002322 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002323 intent.writeToParcel(data, 0);
2324 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002325 data.writeStrongBinder(resultTo);
2326 data.writeString(resultWho);
2327 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002328 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002329 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002330 if (options != null) {
2331 data.writeInt(1);
2332 options.writeToParcel(data, 0);
2333 } else {
2334 data.writeInt(0);
2335 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002336 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002337 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2338 reply.readException();
2339 int result = reply.readInt();
2340 reply.recycle();
2341 data.recycle();
2342 return result;
2343 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002344 public int startActivityIntentSender(IApplicationThread caller,
2345 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002346 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002347 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002348 Parcel data = Parcel.obtain();
2349 Parcel reply = Parcel.obtain();
2350 data.writeInterfaceToken(IActivityManager.descriptor);
2351 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2352 intent.writeToParcel(data, 0);
2353 if (fillInIntent != null) {
2354 data.writeInt(1);
2355 fillInIntent.writeToParcel(data, 0);
2356 } else {
2357 data.writeInt(0);
2358 }
2359 data.writeString(resolvedType);
2360 data.writeStrongBinder(resultTo);
2361 data.writeString(resultWho);
2362 data.writeInt(requestCode);
2363 data.writeInt(flagsMask);
2364 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002365 if (options != null) {
2366 data.writeInt(1);
2367 options.writeToParcel(data, 0);
2368 } else {
2369 data.writeInt(0);
2370 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002371 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002372 reply.readException();
2373 int result = reply.readInt();
2374 reply.recycle();
2375 data.recycle();
2376 return result;
2377 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002378 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2379 Intent intent, String resolvedType, IVoiceInteractionSession session,
2380 IVoiceInteractor interactor, int startFlags, String profileFile,
2381 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2382 Parcel data = Parcel.obtain();
2383 Parcel reply = Parcel.obtain();
2384 data.writeInterfaceToken(IActivityManager.descriptor);
2385 data.writeString(callingPackage);
2386 data.writeInt(callingPid);
2387 data.writeInt(callingUid);
2388 intent.writeToParcel(data, 0);
2389 data.writeString(resolvedType);
2390 data.writeStrongBinder(session.asBinder());
2391 data.writeStrongBinder(interactor.asBinder());
2392 data.writeInt(startFlags);
2393 data.writeString(profileFile);
2394 if (profileFd != null) {
2395 data.writeInt(1);
2396 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2397 } else {
2398 data.writeInt(0);
2399 }
2400 if (options != null) {
2401 data.writeInt(1);
2402 options.writeToParcel(data, 0);
2403 } else {
2404 data.writeInt(0);
2405 }
2406 data.writeInt(userId);
2407 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2408 reply.readException();
2409 int result = reply.readInt();
2410 reply.recycle();
2411 data.recycle();
2412 return result;
2413 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002414 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002415 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002416 Parcel data = Parcel.obtain();
2417 Parcel reply = Parcel.obtain();
2418 data.writeInterfaceToken(IActivityManager.descriptor);
2419 data.writeStrongBinder(callingActivity);
2420 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002421 if (options != null) {
2422 data.writeInt(1);
2423 options.writeToParcel(data, 0);
2424 } else {
2425 data.writeInt(0);
2426 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002427 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2428 reply.readException();
2429 int result = reply.readInt();
2430 reply.recycle();
2431 data.recycle();
2432 return result != 0;
2433 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002434 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002435 throws RemoteException {
2436 Parcel data = Parcel.obtain();
2437 Parcel reply = Parcel.obtain();
2438 data.writeInterfaceToken(IActivityManager.descriptor);
2439 data.writeStrongBinder(token);
2440 data.writeInt(resultCode);
2441 if (resultData != null) {
2442 data.writeInt(1);
2443 resultData.writeToParcel(data, 0);
2444 } else {
2445 data.writeInt(0);
2446 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002447 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002448 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2449 reply.readException();
2450 boolean res = reply.readInt() != 0;
2451 data.recycle();
2452 reply.recycle();
2453 return res;
2454 }
2455 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2456 {
2457 Parcel data = Parcel.obtain();
2458 Parcel reply = Parcel.obtain();
2459 data.writeInterfaceToken(IActivityManager.descriptor);
2460 data.writeStrongBinder(token);
2461 data.writeString(resultWho);
2462 data.writeInt(requestCode);
2463 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2464 reply.readException();
2465 data.recycle();
2466 reply.recycle();
2467 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002468 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2469 Parcel data = Parcel.obtain();
2470 Parcel reply = Parcel.obtain();
2471 data.writeInterfaceToken(IActivityManager.descriptor);
2472 data.writeStrongBinder(token);
2473 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2474 reply.readException();
2475 boolean res = reply.readInt() != 0;
2476 data.recycle();
2477 reply.recycle();
2478 return res;
2479 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002480 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2481 Parcel data = Parcel.obtain();
2482 Parcel reply = Parcel.obtain();
2483 data.writeInterfaceToken(IActivityManager.descriptor);
2484 data.writeStrongBinder(token);
2485 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2486 reply.readException();
2487 boolean res = reply.readInt() != 0;
2488 data.recycle();
2489 reply.recycle();
2490 return res;
2491 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002492 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002493 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002494 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002495 {
2496 Parcel data = Parcel.obtain();
2497 Parcel reply = Parcel.obtain();
2498 data.writeInterfaceToken(IActivityManager.descriptor);
2499 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002500 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002501 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2502 filter.writeToParcel(data, 0);
2503 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002504 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002505 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2506 reply.readException();
2507 Intent intent = null;
2508 int haveIntent = reply.readInt();
2509 if (haveIntent != 0) {
2510 intent = Intent.CREATOR.createFromParcel(reply);
2511 }
2512 reply.recycle();
2513 data.recycle();
2514 return intent;
2515 }
2516 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2517 {
2518 Parcel data = Parcel.obtain();
2519 Parcel reply = Parcel.obtain();
2520 data.writeInterfaceToken(IActivityManager.descriptor);
2521 data.writeStrongBinder(receiver.asBinder());
2522 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2523 reply.readException();
2524 data.recycle();
2525 reply.recycle();
2526 }
2527 public int broadcastIntent(IApplicationThread caller,
2528 Intent intent, String resolvedType, IIntentReceiver resultTo,
2529 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002530 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002531 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002532 {
2533 Parcel data = Parcel.obtain();
2534 Parcel reply = Parcel.obtain();
2535 data.writeInterfaceToken(IActivityManager.descriptor);
2536 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2537 intent.writeToParcel(data, 0);
2538 data.writeString(resolvedType);
2539 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2540 data.writeInt(resultCode);
2541 data.writeString(resultData);
2542 data.writeBundle(map);
2543 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002544 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002545 data.writeInt(serialized ? 1 : 0);
2546 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002547 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002548 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2549 reply.readException();
2550 int res = reply.readInt();
2551 reply.recycle();
2552 data.recycle();
2553 return res;
2554 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002555 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2556 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002557 {
2558 Parcel data = Parcel.obtain();
2559 Parcel reply = Parcel.obtain();
2560 data.writeInterfaceToken(IActivityManager.descriptor);
2561 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2562 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002563 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002564 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2565 reply.readException();
2566 data.recycle();
2567 reply.recycle();
2568 }
2569 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2570 {
2571 Parcel data = Parcel.obtain();
2572 Parcel reply = Parcel.obtain();
2573 data.writeInterfaceToken(IActivityManager.descriptor);
2574 data.writeStrongBinder(who);
2575 data.writeInt(resultCode);
2576 data.writeString(resultData);
2577 data.writeBundle(map);
2578 data.writeInt(abortBroadcast ? 1 : 0);
2579 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2580 reply.readException();
2581 data.recycle();
2582 reply.recycle();
2583 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002584 public void attachApplication(IApplicationThread app) throws RemoteException
2585 {
2586 Parcel data = Parcel.obtain();
2587 Parcel reply = Parcel.obtain();
2588 data.writeInterfaceToken(IActivityManager.descriptor);
2589 data.writeStrongBinder(app.asBinder());
2590 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2591 reply.readException();
2592 data.recycle();
2593 reply.recycle();
2594 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002595 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2596 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002597 {
2598 Parcel data = Parcel.obtain();
2599 Parcel reply = Parcel.obtain();
2600 data.writeInterfaceToken(IActivityManager.descriptor);
2601 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002602 if (config != null) {
2603 data.writeInt(1);
2604 config.writeToParcel(data, 0);
2605 } else {
2606 data.writeInt(0);
2607 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002608 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002609 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2610 reply.readException();
2611 data.recycle();
2612 reply.recycle();
2613 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002614 public void activityResumed(IBinder token) throws RemoteException
2615 {
2616 Parcel data = Parcel.obtain();
2617 Parcel reply = Parcel.obtain();
2618 data.writeInterfaceToken(IActivityManager.descriptor);
2619 data.writeStrongBinder(token);
2620 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2621 reply.readException();
2622 data.recycle();
2623 reply.recycle();
2624 }
Craig Mautnera0026042014-04-23 11:45:37 -07002625 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002626 {
2627 Parcel data = Parcel.obtain();
2628 Parcel reply = Parcel.obtain();
2629 data.writeInterfaceToken(IActivityManager.descriptor);
2630 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002631 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002632 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2633 reply.readException();
2634 data.recycle();
2635 reply.recycle();
2636 }
2637 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002638 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002639 {
2640 Parcel data = Parcel.obtain();
2641 Parcel reply = Parcel.obtain();
2642 data.writeInterfaceToken(IActivityManager.descriptor);
2643 data.writeStrongBinder(token);
2644 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002645 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002646 TextUtils.writeToParcel(description, data, 0);
2647 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2648 reply.readException();
2649 data.recycle();
2650 reply.recycle();
2651 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002652 public void activitySlept(IBinder token) throws RemoteException
2653 {
2654 Parcel data = Parcel.obtain();
2655 Parcel reply = Parcel.obtain();
2656 data.writeInterfaceToken(IActivityManager.descriptor);
2657 data.writeStrongBinder(token);
2658 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2659 reply.readException();
2660 data.recycle();
2661 reply.recycle();
2662 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002663 public void activityDestroyed(IBinder token) throws RemoteException
2664 {
2665 Parcel data = Parcel.obtain();
2666 Parcel reply = Parcel.obtain();
2667 data.writeInterfaceToken(IActivityManager.descriptor);
2668 data.writeStrongBinder(token);
2669 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2670 reply.readException();
2671 data.recycle();
2672 reply.recycle();
2673 }
2674 public String getCallingPackage(IBinder token) throws RemoteException
2675 {
2676 Parcel data = Parcel.obtain();
2677 Parcel reply = Parcel.obtain();
2678 data.writeInterfaceToken(IActivityManager.descriptor);
2679 data.writeStrongBinder(token);
2680 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2681 reply.readException();
2682 String res = reply.readString();
2683 data.recycle();
2684 reply.recycle();
2685 return res;
2686 }
2687 public ComponentName getCallingActivity(IBinder token)
2688 throws RemoteException {
2689 Parcel data = Parcel.obtain();
2690 Parcel reply = Parcel.obtain();
2691 data.writeInterfaceToken(IActivityManager.descriptor);
2692 data.writeStrongBinder(token);
2693 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2694 reply.readException();
2695 ComponentName res = ComponentName.readFromParcel(reply);
2696 data.recycle();
2697 reply.recycle();
2698 return res;
2699 }
Winson Chung1147c402014-05-14 11:05:00 -07002700 public List<IAppTask> getAppTasks() throws RemoteException {
2701 Parcel data = Parcel.obtain();
2702 Parcel reply = Parcel.obtain();
2703 data.writeInterfaceToken(IActivityManager.descriptor);
2704 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2705 reply.readException();
2706 ArrayList<IAppTask> list = null;
2707 int N = reply.readInt();
2708 if (N >= 0) {
2709 list = new ArrayList<IAppTask>();
2710 while (N > 0) {
2711 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2712 list.add(task);
2713 N--;
2714 }
2715 }
2716 data.recycle();
2717 reply.recycle();
2718 return list;
2719 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002720 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002721 Parcel data = Parcel.obtain();
2722 Parcel reply = Parcel.obtain();
2723 data.writeInterfaceToken(IActivityManager.descriptor);
2724 data.writeInt(maxNum);
2725 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002726 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2727 reply.readException();
2728 ArrayList list = null;
2729 int N = reply.readInt();
2730 if (N >= 0) {
2731 list = new ArrayList();
2732 while (N > 0) {
2733 ActivityManager.RunningTaskInfo info =
2734 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002735 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002736 list.add(info);
2737 N--;
2738 }
2739 }
2740 data.recycle();
2741 reply.recycle();
2742 return list;
2743 }
2744 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002745 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002746 Parcel data = Parcel.obtain();
2747 Parcel reply = Parcel.obtain();
2748 data.writeInterfaceToken(IActivityManager.descriptor);
2749 data.writeInt(maxNum);
2750 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002751 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002752 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2753 reply.readException();
2754 ArrayList<ActivityManager.RecentTaskInfo> list
2755 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2756 data.recycle();
2757 reply.recycle();
2758 return list;
2759 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002760 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002761 Parcel data = Parcel.obtain();
2762 Parcel reply = Parcel.obtain();
2763 data.writeInterfaceToken(IActivityManager.descriptor);
2764 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002765 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002766 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002767 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002768 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002769 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002770 }
2771 data.recycle();
2772 reply.recycle();
2773 return bm;
2774 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002775 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2776 Parcel data = Parcel.obtain();
2777 Parcel reply = Parcel.obtain();
2778 data.writeInterfaceToken(IActivityManager.descriptor);
2779 data.writeInt(id);
2780 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2781 reply.readException();
2782 Bitmap bm = null;
2783 if (reply.readInt() != 0) {
2784 bm = Bitmap.CREATOR.createFromParcel(reply);
2785 }
2786 data.recycle();
2787 reply.recycle();
2788 return bm;
2789 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002790 public List getServices(int maxNum, int flags) throws RemoteException {
2791 Parcel data = Parcel.obtain();
2792 Parcel reply = Parcel.obtain();
2793 data.writeInterfaceToken(IActivityManager.descriptor);
2794 data.writeInt(maxNum);
2795 data.writeInt(flags);
2796 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2797 reply.readException();
2798 ArrayList list = null;
2799 int N = reply.readInt();
2800 if (N >= 0) {
2801 list = new ArrayList();
2802 while (N > 0) {
2803 ActivityManager.RunningServiceInfo info =
2804 ActivityManager.RunningServiceInfo.CREATOR
2805 .createFromParcel(reply);
2806 list.add(info);
2807 N--;
2808 }
2809 }
2810 data.recycle();
2811 reply.recycle();
2812 return list;
2813 }
2814 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2815 throws RemoteException {
2816 Parcel data = Parcel.obtain();
2817 Parcel reply = Parcel.obtain();
2818 data.writeInterfaceToken(IActivityManager.descriptor);
2819 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2820 reply.readException();
2821 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2822 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2823 data.recycle();
2824 reply.recycle();
2825 return list;
2826 }
2827 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2828 throws RemoteException {
2829 Parcel data = Parcel.obtain();
2830 Parcel reply = Parcel.obtain();
2831 data.writeInterfaceToken(IActivityManager.descriptor);
2832 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2833 reply.readException();
2834 ArrayList<ActivityManager.RunningAppProcessInfo> list
2835 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2836 data.recycle();
2837 reply.recycle();
2838 return list;
2839 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002840 public List<ApplicationInfo> getRunningExternalApplications()
2841 throws RemoteException {
2842 Parcel data = Parcel.obtain();
2843 Parcel reply = Parcel.obtain();
2844 data.writeInterfaceToken(IActivityManager.descriptor);
2845 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2846 reply.readException();
2847 ArrayList<ApplicationInfo> list
2848 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2849 data.recycle();
2850 reply.recycle();
2851 return list;
2852 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002853 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002854 {
2855 Parcel data = Parcel.obtain();
2856 Parcel reply = Parcel.obtain();
2857 data.writeInterfaceToken(IActivityManager.descriptor);
2858 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002859 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002860 if (options != null) {
2861 data.writeInt(1);
2862 options.writeToParcel(data, 0);
2863 } else {
2864 data.writeInt(0);
2865 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002866 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2867 reply.readException();
2868 data.recycle();
2869 reply.recycle();
2870 }
2871 public void moveTaskToBack(int task) throws RemoteException
2872 {
2873 Parcel data = Parcel.obtain();
2874 Parcel reply = Parcel.obtain();
2875 data.writeInterfaceToken(IActivityManager.descriptor);
2876 data.writeInt(task);
2877 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2878 reply.readException();
2879 data.recycle();
2880 reply.recycle();
2881 }
2882 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2883 throws RemoteException {
2884 Parcel data = Parcel.obtain();
2885 Parcel reply = Parcel.obtain();
2886 data.writeInterfaceToken(IActivityManager.descriptor);
2887 data.writeStrongBinder(token);
2888 data.writeInt(nonRoot ? 1 : 0);
2889 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2890 reply.readException();
2891 boolean res = reply.readInt() != 0;
2892 data.recycle();
2893 reply.recycle();
2894 return res;
2895 }
2896 public void moveTaskBackwards(int task) throws RemoteException
2897 {
2898 Parcel data = Parcel.obtain();
2899 Parcel reply = Parcel.obtain();
2900 data.writeInterfaceToken(IActivityManager.descriptor);
2901 data.writeInt(task);
2902 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2903 reply.readException();
2904 data.recycle();
2905 reply.recycle();
2906 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002907 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002908 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2909 {
2910 Parcel data = Parcel.obtain();
2911 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002912 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002913 data.writeInt(taskId);
2914 data.writeInt(stackId);
2915 data.writeInt(toTop ? 1 : 0);
2916 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2917 reply.readException();
2918 data.recycle();
2919 reply.recycle();
2920 }
2921 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002922 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002923 {
2924 Parcel data = Parcel.obtain();
2925 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002926 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002927 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002928 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002929 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002930 reply.readException();
2931 data.recycle();
2932 reply.recycle();
2933 }
Craig Mautner967212c2013-04-13 21:10:58 -07002934 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002935 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002936 {
2937 Parcel data = Parcel.obtain();
2938 Parcel reply = Parcel.obtain();
2939 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002940 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002941 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002942 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002943 data.recycle();
2944 reply.recycle();
2945 return list;
2946 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002947 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002948 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002949 {
2950 Parcel data = Parcel.obtain();
2951 Parcel reply = Parcel.obtain();
2952 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002953 data.writeInt(stackId);
2954 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002955 reply.readException();
2956 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002957 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002958 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002959 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002960 }
2961 data.recycle();
2962 reply.recycle();
2963 return info;
2964 }
2965 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08002966 public boolean isInHomeStack(int taskId) throws RemoteException {
2967 Parcel data = Parcel.obtain();
2968 Parcel reply = Parcel.obtain();
2969 data.writeInterfaceToken(IActivityManager.descriptor);
2970 data.writeInt(taskId);
2971 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
2972 reply.readException();
2973 boolean isInHomeStack = reply.readInt() > 0;
2974 data.recycle();
2975 reply.recycle();
2976 return isInHomeStack;
2977 }
2978 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002979 public void setFocusedStack(int stackId) throws RemoteException
2980 {
2981 Parcel data = Parcel.obtain();
2982 Parcel reply = Parcel.obtain();
2983 data.writeInterfaceToken(IActivityManager.descriptor);
2984 data.writeInt(stackId);
2985 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2986 reply.readException();
2987 data.recycle();
2988 reply.recycle();
2989 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002990 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2991 {
2992 Parcel data = Parcel.obtain();
2993 Parcel reply = Parcel.obtain();
2994 data.writeInterfaceToken(IActivityManager.descriptor);
2995 data.writeStrongBinder(token);
2996 data.writeInt(onlyRoot ? 1 : 0);
2997 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2998 reply.readException();
2999 int res = reply.readInt();
3000 data.recycle();
3001 reply.recycle();
3002 return res;
3003 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003004 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003005 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003006 Parcel data = Parcel.obtain();
3007 Parcel reply = Parcel.obtain();
3008 data.writeInterfaceToken(IActivityManager.descriptor);
3009 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3010 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003011 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003012 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003013 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3014 reply.readException();
3015 int res = reply.readInt();
3016 ContentProviderHolder cph = null;
3017 if (res != 0) {
3018 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3019 }
3020 data.recycle();
3021 reply.recycle();
3022 return cph;
3023 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003024 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3025 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003026 Parcel data = Parcel.obtain();
3027 Parcel reply = Parcel.obtain();
3028 data.writeInterfaceToken(IActivityManager.descriptor);
3029 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003030 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003031 data.writeStrongBinder(token);
3032 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3033 reply.readException();
3034 int res = reply.readInt();
3035 ContentProviderHolder cph = null;
3036 if (res != 0) {
3037 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3038 }
3039 data.recycle();
3040 reply.recycle();
3041 return cph;
3042 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003043 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003044 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003045 {
3046 Parcel data = Parcel.obtain();
3047 Parcel reply = Parcel.obtain();
3048 data.writeInterfaceToken(IActivityManager.descriptor);
3049 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3050 data.writeTypedList(providers);
3051 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3052 reply.readException();
3053 data.recycle();
3054 reply.recycle();
3055 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003056 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3057 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003058 Parcel data = Parcel.obtain();
3059 Parcel reply = Parcel.obtain();
3060 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003061 data.writeStrongBinder(connection);
3062 data.writeInt(stable);
3063 data.writeInt(unstable);
3064 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3065 reply.readException();
3066 boolean res = reply.readInt() != 0;
3067 data.recycle();
3068 reply.recycle();
3069 return res;
3070 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003071
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003072 public void unstableProviderDied(IBinder connection) throws RemoteException {
3073 Parcel data = Parcel.obtain();
3074 Parcel reply = Parcel.obtain();
3075 data.writeInterfaceToken(IActivityManager.descriptor);
3076 data.writeStrongBinder(connection);
3077 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3078 reply.readException();
3079 data.recycle();
3080 reply.recycle();
3081 }
3082
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003083 @Override
3084 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3085 Parcel data = Parcel.obtain();
3086 Parcel reply = Parcel.obtain();
3087 data.writeInterfaceToken(IActivityManager.descriptor);
3088 data.writeStrongBinder(connection);
3089 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3090 reply.readException();
3091 data.recycle();
3092 reply.recycle();
3093 }
3094
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003095 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3096 Parcel data = Parcel.obtain();
3097 Parcel reply = Parcel.obtain();
3098 data.writeInterfaceToken(IActivityManager.descriptor);
3099 data.writeStrongBinder(connection);
3100 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003101 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3102 reply.readException();
3103 data.recycle();
3104 reply.recycle();
3105 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003106
3107 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3108 Parcel data = Parcel.obtain();
3109 Parcel reply = Parcel.obtain();
3110 data.writeInterfaceToken(IActivityManager.descriptor);
3111 data.writeString(name);
3112 data.writeStrongBinder(token);
3113 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3114 reply.readException();
3115 data.recycle();
3116 reply.recycle();
3117 }
3118
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003119 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3120 throws RemoteException
3121 {
3122 Parcel data = Parcel.obtain();
3123 Parcel reply = Parcel.obtain();
3124 data.writeInterfaceToken(IActivityManager.descriptor);
3125 service.writeToParcel(data, 0);
3126 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3127 reply.readException();
3128 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3129 data.recycle();
3130 reply.recycle();
3131 return res;
3132 }
3133
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003134 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003135 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003136 {
3137 Parcel data = Parcel.obtain();
3138 Parcel reply = Parcel.obtain();
3139 data.writeInterfaceToken(IActivityManager.descriptor);
3140 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3141 service.writeToParcel(data, 0);
3142 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003143 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003144 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3145 reply.readException();
3146 ComponentName res = ComponentName.readFromParcel(reply);
3147 data.recycle();
3148 reply.recycle();
3149 return res;
3150 }
3151 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003152 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003153 {
3154 Parcel data = Parcel.obtain();
3155 Parcel reply = Parcel.obtain();
3156 data.writeInterfaceToken(IActivityManager.descriptor);
3157 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3158 service.writeToParcel(data, 0);
3159 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003160 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003161 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3162 reply.readException();
3163 int res = reply.readInt();
3164 reply.recycle();
3165 data.recycle();
3166 return res;
3167 }
3168 public boolean stopServiceToken(ComponentName className, IBinder token,
3169 int startId) throws RemoteException {
3170 Parcel data = Parcel.obtain();
3171 Parcel reply = Parcel.obtain();
3172 data.writeInterfaceToken(IActivityManager.descriptor);
3173 ComponentName.writeToParcel(className, data);
3174 data.writeStrongBinder(token);
3175 data.writeInt(startId);
3176 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3177 reply.readException();
3178 boolean res = reply.readInt() != 0;
3179 data.recycle();
3180 reply.recycle();
3181 return res;
3182 }
3183 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003184 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003185 Parcel data = Parcel.obtain();
3186 Parcel reply = Parcel.obtain();
3187 data.writeInterfaceToken(IActivityManager.descriptor);
3188 ComponentName.writeToParcel(className, data);
3189 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003190 data.writeInt(id);
3191 if (notification != null) {
3192 data.writeInt(1);
3193 notification.writeToParcel(data, 0);
3194 } else {
3195 data.writeInt(0);
3196 }
3197 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003198 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3199 reply.readException();
3200 data.recycle();
3201 reply.recycle();
3202 }
3203 public int bindService(IApplicationThread caller, IBinder token,
3204 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003205 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003206 Parcel data = Parcel.obtain();
3207 Parcel reply = Parcel.obtain();
3208 data.writeInterfaceToken(IActivityManager.descriptor);
3209 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3210 data.writeStrongBinder(token);
3211 service.writeToParcel(data, 0);
3212 data.writeString(resolvedType);
3213 data.writeStrongBinder(connection.asBinder());
3214 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003215 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003216 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3217 reply.readException();
3218 int res = reply.readInt();
3219 data.recycle();
3220 reply.recycle();
3221 return res;
3222 }
3223 public boolean unbindService(IServiceConnection connection) throws RemoteException
3224 {
3225 Parcel data = Parcel.obtain();
3226 Parcel reply = Parcel.obtain();
3227 data.writeInterfaceToken(IActivityManager.descriptor);
3228 data.writeStrongBinder(connection.asBinder());
3229 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3230 reply.readException();
3231 boolean res = reply.readInt() != 0;
3232 data.recycle();
3233 reply.recycle();
3234 return res;
3235 }
3236
3237 public void publishService(IBinder token,
3238 Intent intent, IBinder service) throws RemoteException {
3239 Parcel data = Parcel.obtain();
3240 Parcel reply = Parcel.obtain();
3241 data.writeInterfaceToken(IActivityManager.descriptor);
3242 data.writeStrongBinder(token);
3243 intent.writeToParcel(data, 0);
3244 data.writeStrongBinder(service);
3245 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3246 reply.readException();
3247 data.recycle();
3248 reply.recycle();
3249 }
3250
3251 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3252 throws RemoteException {
3253 Parcel data = Parcel.obtain();
3254 Parcel reply = Parcel.obtain();
3255 data.writeInterfaceToken(IActivityManager.descriptor);
3256 data.writeStrongBinder(token);
3257 intent.writeToParcel(data, 0);
3258 data.writeInt(doRebind ? 1 : 0);
3259 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3260 reply.readException();
3261 data.recycle();
3262 reply.recycle();
3263 }
3264
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003265 public void serviceDoneExecuting(IBinder token, int type, int startId,
3266 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003267 Parcel data = Parcel.obtain();
3268 Parcel reply = Parcel.obtain();
3269 data.writeInterfaceToken(IActivityManager.descriptor);
3270 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003271 data.writeInt(type);
3272 data.writeInt(startId);
3273 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003274 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3275 reply.readException();
3276 data.recycle();
3277 reply.recycle();
3278 }
3279
3280 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3281 Parcel data = Parcel.obtain();
3282 Parcel reply = Parcel.obtain();
3283 data.writeInterfaceToken(IActivityManager.descriptor);
3284 service.writeToParcel(data, 0);
3285 data.writeString(resolvedType);
3286 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3287 reply.readException();
3288 IBinder binder = reply.readStrongBinder();
3289 reply.recycle();
3290 data.recycle();
3291 return binder;
3292 }
3293
Christopher Tate181fafa2009-05-14 11:12:14 -07003294 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3295 throws RemoteException {
3296 Parcel data = Parcel.obtain();
3297 Parcel reply = Parcel.obtain();
3298 data.writeInterfaceToken(IActivityManager.descriptor);
3299 app.writeToParcel(data, 0);
3300 data.writeInt(backupRestoreMode);
3301 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3302 reply.readException();
3303 boolean success = reply.readInt() != 0;
3304 reply.recycle();
3305 data.recycle();
3306 return success;
3307 }
3308
Christopher Tate346acb12012-10-15 19:20:25 -07003309 public void clearPendingBackup() throws RemoteException {
3310 Parcel data = Parcel.obtain();
3311 Parcel reply = Parcel.obtain();
3312 data.writeInterfaceToken(IActivityManager.descriptor);
3313 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3314 reply.recycle();
3315 data.recycle();
3316 }
3317
Christopher Tate181fafa2009-05-14 11:12:14 -07003318 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3319 Parcel data = Parcel.obtain();
3320 Parcel reply = Parcel.obtain();
3321 data.writeInterfaceToken(IActivityManager.descriptor);
3322 data.writeString(packageName);
3323 data.writeStrongBinder(agent);
3324 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3325 reply.recycle();
3326 data.recycle();
3327 }
3328
3329 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3330 Parcel data = Parcel.obtain();
3331 Parcel reply = Parcel.obtain();
3332 data.writeInterfaceToken(IActivityManager.descriptor);
3333 app.writeToParcel(data, 0);
3334 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3335 reply.readException();
3336 reply.recycle();
3337 data.recycle();
3338 }
3339
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003340 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003341 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3342 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003343 Parcel data = Parcel.obtain();
3344 Parcel reply = Parcel.obtain();
3345 data.writeInterfaceToken(IActivityManager.descriptor);
3346 ComponentName.writeToParcel(className, data);
3347 data.writeString(profileFile);
3348 data.writeInt(flags);
3349 data.writeBundle(arguments);
3350 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003351 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003352 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003353 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3354 reply.readException();
3355 boolean res = reply.readInt() != 0;
3356 reply.recycle();
3357 data.recycle();
3358 return res;
3359 }
3360
3361 public void finishInstrumentation(IApplicationThread target,
3362 int resultCode, Bundle results) throws RemoteException {
3363 Parcel data = Parcel.obtain();
3364 Parcel reply = Parcel.obtain();
3365 data.writeInterfaceToken(IActivityManager.descriptor);
3366 data.writeStrongBinder(target != null ? target.asBinder() : null);
3367 data.writeInt(resultCode);
3368 data.writeBundle(results);
3369 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3370 reply.readException();
3371 data.recycle();
3372 reply.recycle();
3373 }
3374 public Configuration getConfiguration() throws RemoteException
3375 {
3376 Parcel data = Parcel.obtain();
3377 Parcel reply = Parcel.obtain();
3378 data.writeInterfaceToken(IActivityManager.descriptor);
3379 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3380 reply.readException();
3381 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3382 reply.recycle();
3383 data.recycle();
3384 return res;
3385 }
3386 public void updateConfiguration(Configuration values) throws RemoteException
3387 {
3388 Parcel data = Parcel.obtain();
3389 Parcel reply = Parcel.obtain();
3390 data.writeInterfaceToken(IActivityManager.descriptor);
3391 values.writeToParcel(data, 0);
3392 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3393 reply.readException();
3394 data.recycle();
3395 reply.recycle();
3396 }
3397 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3398 throws RemoteException {
3399 Parcel data = Parcel.obtain();
3400 Parcel reply = Parcel.obtain();
3401 data.writeInterfaceToken(IActivityManager.descriptor);
3402 data.writeStrongBinder(token);
3403 data.writeInt(requestedOrientation);
3404 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3405 reply.readException();
3406 data.recycle();
3407 reply.recycle();
3408 }
3409 public int getRequestedOrientation(IBinder token) throws RemoteException {
3410 Parcel data = Parcel.obtain();
3411 Parcel reply = Parcel.obtain();
3412 data.writeInterfaceToken(IActivityManager.descriptor);
3413 data.writeStrongBinder(token);
3414 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3415 reply.readException();
3416 int res = reply.readInt();
3417 data.recycle();
3418 reply.recycle();
3419 return res;
3420 }
3421 public ComponentName getActivityClassForToken(IBinder token)
3422 throws RemoteException {
3423 Parcel data = Parcel.obtain();
3424 Parcel reply = Parcel.obtain();
3425 data.writeInterfaceToken(IActivityManager.descriptor);
3426 data.writeStrongBinder(token);
3427 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3428 reply.readException();
3429 ComponentName res = ComponentName.readFromParcel(reply);
3430 data.recycle();
3431 reply.recycle();
3432 return res;
3433 }
3434 public String getPackageForToken(IBinder token) throws RemoteException
3435 {
3436 Parcel data = Parcel.obtain();
3437 Parcel reply = Parcel.obtain();
3438 data.writeInterfaceToken(IActivityManager.descriptor);
3439 data.writeStrongBinder(token);
3440 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3441 reply.readException();
3442 String res = reply.readString();
3443 data.recycle();
3444 reply.recycle();
3445 return res;
3446 }
3447 public IIntentSender getIntentSender(int type,
3448 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003449 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003450 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003451 Parcel data = Parcel.obtain();
3452 Parcel reply = Parcel.obtain();
3453 data.writeInterfaceToken(IActivityManager.descriptor);
3454 data.writeInt(type);
3455 data.writeString(packageName);
3456 data.writeStrongBinder(token);
3457 data.writeString(resultWho);
3458 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003459 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003460 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003461 data.writeTypedArray(intents, 0);
3462 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003463 } else {
3464 data.writeInt(0);
3465 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003466 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003467 if (options != null) {
3468 data.writeInt(1);
3469 options.writeToParcel(data, 0);
3470 } else {
3471 data.writeInt(0);
3472 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003473 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003474 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3475 reply.readException();
3476 IIntentSender res = IIntentSender.Stub.asInterface(
3477 reply.readStrongBinder());
3478 data.recycle();
3479 reply.recycle();
3480 return res;
3481 }
3482 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3483 Parcel data = Parcel.obtain();
3484 Parcel reply = Parcel.obtain();
3485 data.writeInterfaceToken(IActivityManager.descriptor);
3486 data.writeStrongBinder(sender.asBinder());
3487 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3488 reply.readException();
3489 data.recycle();
3490 reply.recycle();
3491 }
3492 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3493 Parcel data = Parcel.obtain();
3494 Parcel reply = Parcel.obtain();
3495 data.writeInterfaceToken(IActivityManager.descriptor);
3496 data.writeStrongBinder(sender.asBinder());
3497 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3498 reply.readException();
3499 String res = reply.readString();
3500 data.recycle();
3501 reply.recycle();
3502 return res;
3503 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003504 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3505 Parcel data = Parcel.obtain();
3506 Parcel reply = Parcel.obtain();
3507 data.writeInterfaceToken(IActivityManager.descriptor);
3508 data.writeStrongBinder(sender.asBinder());
3509 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3510 reply.readException();
3511 int res = reply.readInt();
3512 data.recycle();
3513 reply.recycle();
3514 return res;
3515 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003516 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3517 boolean requireFull, String name, String callerPackage) throws RemoteException {
3518 Parcel data = Parcel.obtain();
3519 Parcel reply = Parcel.obtain();
3520 data.writeInterfaceToken(IActivityManager.descriptor);
3521 data.writeInt(callingPid);
3522 data.writeInt(callingUid);
3523 data.writeInt(userId);
3524 data.writeInt(allowAll ? 1 : 0);
3525 data.writeInt(requireFull ? 1 : 0);
3526 data.writeString(name);
3527 data.writeString(callerPackage);
3528 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3529 reply.readException();
3530 int res = reply.readInt();
3531 data.recycle();
3532 reply.recycle();
3533 return res;
3534 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003535 public void setProcessLimit(int max) throws RemoteException
3536 {
3537 Parcel data = Parcel.obtain();
3538 Parcel reply = Parcel.obtain();
3539 data.writeInterfaceToken(IActivityManager.descriptor);
3540 data.writeInt(max);
3541 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3542 reply.readException();
3543 data.recycle();
3544 reply.recycle();
3545 }
3546 public int getProcessLimit() throws RemoteException
3547 {
3548 Parcel data = Parcel.obtain();
3549 Parcel reply = Parcel.obtain();
3550 data.writeInterfaceToken(IActivityManager.descriptor);
3551 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3552 reply.readException();
3553 int res = reply.readInt();
3554 data.recycle();
3555 reply.recycle();
3556 return res;
3557 }
3558 public void setProcessForeground(IBinder token, int pid,
3559 boolean isForeground) throws RemoteException {
3560 Parcel data = Parcel.obtain();
3561 Parcel reply = Parcel.obtain();
3562 data.writeInterfaceToken(IActivityManager.descriptor);
3563 data.writeStrongBinder(token);
3564 data.writeInt(pid);
3565 data.writeInt(isForeground ? 1 : 0);
3566 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3567 reply.readException();
3568 data.recycle();
3569 reply.recycle();
3570 }
3571 public int checkPermission(String permission, int pid, int uid)
3572 throws RemoteException {
3573 Parcel data = Parcel.obtain();
3574 Parcel reply = Parcel.obtain();
3575 data.writeInterfaceToken(IActivityManager.descriptor);
3576 data.writeString(permission);
3577 data.writeInt(pid);
3578 data.writeInt(uid);
3579 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3580 reply.readException();
3581 int res = reply.readInt();
3582 data.recycle();
3583 reply.recycle();
3584 return res;
3585 }
3586 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003587 final IPackageDataObserver observer, final 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.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003592 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003593 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003594 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3595 reply.readException();
3596 boolean res = reply.readInt() != 0;
3597 data.recycle();
3598 reply.recycle();
3599 return res;
3600 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003601 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003602 throws RemoteException {
3603 Parcel data = Parcel.obtain();
3604 Parcel reply = Parcel.obtain();
3605 data.writeInterfaceToken(IActivityManager.descriptor);
3606 uri.writeToParcel(data, 0);
3607 data.writeInt(pid);
3608 data.writeInt(uid);
3609 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003610 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003611 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3612 reply.readException();
3613 int res = reply.readInt();
3614 data.recycle();
3615 reply.recycle();
3616 return res;
3617 }
3618 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003619 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003620 Parcel data = Parcel.obtain();
3621 Parcel reply = Parcel.obtain();
3622 data.writeInterfaceToken(IActivityManager.descriptor);
3623 data.writeStrongBinder(caller.asBinder());
3624 data.writeString(targetPkg);
3625 uri.writeToParcel(data, 0);
3626 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003627 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003628 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3629 reply.readException();
3630 data.recycle();
3631 reply.recycle();
3632 }
3633 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003634 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003635 Parcel data = Parcel.obtain();
3636 Parcel reply = Parcel.obtain();
3637 data.writeInterfaceToken(IActivityManager.descriptor);
3638 data.writeStrongBinder(caller.asBinder());
3639 uri.writeToParcel(data, 0);
3640 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003641 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003642 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3643 reply.readException();
3644 data.recycle();
3645 reply.recycle();
3646 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003647
3648 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003649 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3650 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003651 Parcel data = Parcel.obtain();
3652 Parcel reply = Parcel.obtain();
3653 data.writeInterfaceToken(IActivityManager.descriptor);
3654 uri.writeToParcel(data, 0);
3655 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003656 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003657 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3658 reply.readException();
3659 data.recycle();
3660 reply.recycle();
3661 }
3662
3663 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003664 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3665 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003666 Parcel data = Parcel.obtain();
3667 Parcel reply = Parcel.obtain();
3668 data.writeInterfaceToken(IActivityManager.descriptor);
3669 uri.writeToParcel(data, 0);
3670 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003671 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003672 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3673 reply.readException();
3674 data.recycle();
3675 reply.recycle();
3676 }
3677
3678 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003679 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3680 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003681 Parcel data = Parcel.obtain();
3682 Parcel reply = Parcel.obtain();
3683 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003684 data.writeString(packageName);
3685 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003686 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3687 reply.readException();
3688 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3689 reply);
3690 data.recycle();
3691 reply.recycle();
3692 return perms;
3693 }
3694
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003695 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3696 throws RemoteException {
3697 Parcel data = Parcel.obtain();
3698 Parcel reply = Parcel.obtain();
3699 data.writeInterfaceToken(IActivityManager.descriptor);
3700 data.writeStrongBinder(who.asBinder());
3701 data.writeInt(waiting ? 1 : 0);
3702 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3703 reply.readException();
3704 data.recycle();
3705 reply.recycle();
3706 }
3707 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3708 Parcel data = Parcel.obtain();
3709 Parcel reply = Parcel.obtain();
3710 data.writeInterfaceToken(IActivityManager.descriptor);
3711 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3712 reply.readException();
3713 outInfo.readFromParcel(reply);
3714 data.recycle();
3715 reply.recycle();
3716 }
3717 public void unhandledBack() throws RemoteException
3718 {
3719 Parcel data = Parcel.obtain();
3720 Parcel reply = Parcel.obtain();
3721 data.writeInterfaceToken(IActivityManager.descriptor);
3722 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3723 reply.readException();
3724 data.recycle();
3725 reply.recycle();
3726 }
3727 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3728 {
3729 Parcel data = Parcel.obtain();
3730 Parcel reply = Parcel.obtain();
3731 data.writeInterfaceToken(IActivityManager.descriptor);
3732 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3733 reply.readException();
3734 ParcelFileDescriptor pfd = null;
3735 if (reply.readInt() != 0) {
3736 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3737 }
3738 data.recycle();
3739 reply.recycle();
3740 return pfd;
3741 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003742 public void setLockScreenShown(boolean shown) throws RemoteException
3743 {
3744 Parcel data = Parcel.obtain();
3745 Parcel reply = Parcel.obtain();
3746 data.writeInterfaceToken(IActivityManager.descriptor);
3747 data.writeInt(shown ? 1 : 0);
3748 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3749 reply.readException();
3750 data.recycle();
3751 reply.recycle();
3752 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003753 public void setDebugApp(
3754 String packageName, boolean waitForDebugger, boolean persistent)
3755 throws RemoteException
3756 {
3757 Parcel data = Parcel.obtain();
3758 Parcel reply = Parcel.obtain();
3759 data.writeInterfaceToken(IActivityManager.descriptor);
3760 data.writeString(packageName);
3761 data.writeInt(waitForDebugger ? 1 : 0);
3762 data.writeInt(persistent ? 1 : 0);
3763 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3764 reply.readException();
3765 data.recycle();
3766 reply.recycle();
3767 }
3768 public void setAlwaysFinish(boolean enabled) throws RemoteException
3769 {
3770 Parcel data = Parcel.obtain();
3771 Parcel reply = Parcel.obtain();
3772 data.writeInterfaceToken(IActivityManager.descriptor);
3773 data.writeInt(enabled ? 1 : 0);
3774 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3775 reply.readException();
3776 data.recycle();
3777 reply.recycle();
3778 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003779 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003780 {
3781 Parcel data = Parcel.obtain();
3782 Parcel reply = Parcel.obtain();
3783 data.writeInterfaceToken(IActivityManager.descriptor);
3784 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003785 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003786 reply.readException();
3787 data.recycle();
3788 reply.recycle();
3789 }
3790 public void enterSafeMode() throws RemoteException {
3791 Parcel data = Parcel.obtain();
3792 data.writeInterfaceToken(IActivityManager.descriptor);
3793 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3794 data.recycle();
3795 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003796 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3797 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003798 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003799 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003800 data.writeStrongBinder(sender.asBinder());
3801 data.writeInt(sourceUid);
3802 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003803 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3804 data.recycle();
3805 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003806 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003807 Parcel data = Parcel.obtain();
3808 Parcel reply = Parcel.obtain();
3809 data.writeInterfaceToken(IActivityManager.descriptor);
3810 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003811 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003812 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003813 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003814 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003815 boolean res = reply.readInt() != 0;
3816 data.recycle();
3817 reply.recycle();
3818 return res;
3819 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003820 @Override
3821 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3822 Parcel data = Parcel.obtain();
3823 Parcel reply = Parcel.obtain();
3824 data.writeInterfaceToken(IActivityManager.descriptor);
3825 data.writeString(reason);
3826 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3827 boolean res = reply.readInt() != 0;
3828 data.recycle();
3829 reply.recycle();
3830 return res;
3831 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003832 public boolean testIsSystemReady()
3833 {
3834 /* this base class version is never called */
3835 return true;
3836 }
Dan Egnor60d87622009-12-16 16:32:58 -08003837 public void handleApplicationCrash(IBinder app,
3838 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3839 {
3840 Parcel data = Parcel.obtain();
3841 Parcel reply = Parcel.obtain();
3842 data.writeInterfaceToken(IActivityManager.descriptor);
3843 data.writeStrongBinder(app);
3844 crashInfo.writeToParcel(data, 0);
3845 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3846 reply.readException();
3847 reply.recycle();
3848 data.recycle();
3849 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003850
Dan Egnor60d87622009-12-16 16:32:58 -08003851 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003852 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003853 {
3854 Parcel data = Parcel.obtain();
3855 Parcel reply = Parcel.obtain();
3856 data.writeInterfaceToken(IActivityManager.descriptor);
3857 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003858 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003859 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003860 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003861 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003862 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003863 reply.recycle();
3864 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003865 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003866 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003867
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003868 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003869 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003870 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003871 {
3872 Parcel data = Parcel.obtain();
3873 Parcel reply = Parcel.obtain();
3874 data.writeInterfaceToken(IActivityManager.descriptor);
3875 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003876 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003877 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003878 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3879 reply.readException();
3880 reply.recycle();
3881 data.recycle();
3882 }
3883
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003884 public void signalPersistentProcesses(int sig) throws RemoteException {
3885 Parcel data = Parcel.obtain();
3886 Parcel reply = Parcel.obtain();
3887 data.writeInterfaceToken(IActivityManager.descriptor);
3888 data.writeInt(sig);
3889 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3890 reply.readException();
3891 data.recycle();
3892 reply.recycle();
3893 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003894
Dianne Hackborn1676c852012-09-10 14:52:30 -07003895 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003896 Parcel data = Parcel.obtain();
3897 Parcel reply = Parcel.obtain();
3898 data.writeInterfaceToken(IActivityManager.descriptor);
3899 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003900 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003901 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3902 reply.readException();
3903 data.recycle();
3904 reply.recycle();
3905 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003906
3907 public void killAllBackgroundProcesses() throws RemoteException {
3908 Parcel data = Parcel.obtain();
3909 Parcel reply = Parcel.obtain();
3910 data.writeInterfaceToken(IActivityManager.descriptor);
3911 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3912 reply.readException();
3913 data.recycle();
3914 reply.recycle();
3915 }
3916
Dianne Hackborn1676c852012-09-10 14:52:30 -07003917 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003918 Parcel data = Parcel.obtain();
3919 Parcel reply = Parcel.obtain();
3920 data.writeInterfaceToken(IActivityManager.descriptor);
3921 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003922 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003923 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003924 reply.readException();
3925 data.recycle();
3926 reply.recycle();
3927 }
3928
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003929 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3930 throws RemoteException
3931 {
3932 Parcel data = Parcel.obtain();
3933 Parcel reply = Parcel.obtain();
3934 data.writeInterfaceToken(IActivityManager.descriptor);
3935 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3936 reply.readException();
3937 outInfo.readFromParcel(reply);
3938 reply.recycle();
3939 data.recycle();
3940 }
3941
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003942 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3943 {
3944 Parcel data = Parcel.obtain();
3945 Parcel reply = Parcel.obtain();
3946 data.writeInterfaceToken(IActivityManager.descriptor);
3947 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3948 reply.readException();
3949 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3950 reply.recycle();
3951 data.recycle();
3952 return res;
3953 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003954
Dianne Hackborn1676c852012-09-10 14:52:30 -07003955 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003956 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003957 {
3958 Parcel data = Parcel.obtain();
3959 Parcel reply = Parcel.obtain();
3960 data.writeInterfaceToken(IActivityManager.descriptor);
3961 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003962 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003963 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003964 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003965 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003966 if (fd != null) {
3967 data.writeInt(1);
3968 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3969 } else {
3970 data.writeInt(0);
3971 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003972 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3973 reply.readException();
3974 boolean res = reply.readInt() != 0;
3975 reply.recycle();
3976 data.recycle();
3977 return res;
3978 }
3979
Dianne Hackborn55280a92009-05-07 15:53:46 -07003980 public boolean shutdown(int timeout) throws RemoteException
3981 {
3982 Parcel data = Parcel.obtain();
3983 Parcel reply = Parcel.obtain();
3984 data.writeInterfaceToken(IActivityManager.descriptor);
3985 data.writeInt(timeout);
3986 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3987 reply.readException();
3988 boolean res = reply.readInt() != 0;
3989 reply.recycle();
3990 data.recycle();
3991 return res;
3992 }
3993
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003994 public void stopAppSwitches() throws RemoteException {
3995 Parcel data = Parcel.obtain();
3996 Parcel reply = Parcel.obtain();
3997 data.writeInterfaceToken(IActivityManager.descriptor);
3998 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3999 reply.readException();
4000 reply.recycle();
4001 data.recycle();
4002 }
4003
4004 public void resumeAppSwitches() throws RemoteException {
4005 Parcel data = Parcel.obtain();
4006 Parcel reply = Parcel.obtain();
4007 data.writeInterfaceToken(IActivityManager.descriptor);
4008 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4009 reply.readException();
4010 reply.recycle();
4011 data.recycle();
4012 }
4013
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004014 public void killApplicationWithAppId(String pkg, int appid, String reason)
4015 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004016 Parcel data = Parcel.obtain();
4017 Parcel reply = Parcel.obtain();
4018 data.writeInterfaceToken(IActivityManager.descriptor);
4019 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004020 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004021 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004022 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004023 reply.readException();
4024 data.recycle();
4025 reply.recycle();
4026 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004027
4028 public void closeSystemDialogs(String reason) throws RemoteException {
4029 Parcel data = Parcel.obtain();
4030 Parcel reply = Parcel.obtain();
4031 data.writeInterfaceToken(IActivityManager.descriptor);
4032 data.writeString(reason);
4033 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4034 reply.readException();
4035 data.recycle();
4036 reply.recycle();
4037 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004038
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004039 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004040 throws RemoteException {
4041 Parcel data = Parcel.obtain();
4042 Parcel reply = Parcel.obtain();
4043 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004044 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004045 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4046 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004047 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004048 data.recycle();
4049 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004050 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004051 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004052
4053 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4054 Parcel data = Parcel.obtain();
4055 Parcel reply = Parcel.obtain();
4056 data.writeInterfaceToken(IActivityManager.descriptor);
4057 data.writeString(processName);
4058 data.writeInt(uid);
4059 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4060 reply.readException();
4061 data.recycle();
4062 reply.recycle();
4063 }
4064
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004065 public void overridePendingTransition(IBinder token, String packageName,
4066 int enterAnim, int exitAnim) throws RemoteException {
4067 Parcel data = Parcel.obtain();
4068 Parcel reply = Parcel.obtain();
4069 data.writeInterfaceToken(IActivityManager.descriptor);
4070 data.writeStrongBinder(token);
4071 data.writeString(packageName);
4072 data.writeInt(enterAnim);
4073 data.writeInt(exitAnim);
4074 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4075 reply.readException();
4076 data.recycle();
4077 reply.recycle();
4078 }
4079
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004080 public boolean isUserAMonkey() throws RemoteException {
4081 Parcel data = Parcel.obtain();
4082 Parcel reply = Parcel.obtain();
4083 data.writeInterfaceToken(IActivityManager.descriptor);
4084 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4085 reply.readException();
4086 boolean res = reply.readInt() != 0;
4087 data.recycle();
4088 reply.recycle();
4089 return res;
4090 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004091
4092 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4093 Parcel data = Parcel.obtain();
4094 Parcel reply = Parcel.obtain();
4095 data.writeInterfaceToken(IActivityManager.descriptor);
4096 data.writeInt(monkey ? 1 : 0);
4097 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4098 reply.readException();
4099 data.recycle();
4100 reply.recycle();
4101 }
4102
Dianne Hackborn860755f2010-06-03 18:47:52 -07004103 public void finishHeavyWeightApp() throws RemoteException {
4104 Parcel data = Parcel.obtain();
4105 Parcel reply = Parcel.obtain();
4106 data.writeInterfaceToken(IActivityManager.descriptor);
4107 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4108 reply.readException();
4109 data.recycle();
4110 reply.recycle();
4111 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004112
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004113 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004114 throws RemoteException {
4115 Parcel data = Parcel.obtain();
4116 Parcel reply = Parcel.obtain();
4117 data.writeInterfaceToken(IActivityManager.descriptor);
4118 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004119 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4120 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004121 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004122 data.recycle();
4123 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004124 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004125 }
4126
Craig Mautner233ceee2014-05-09 17:05:11 -07004127 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004128 throws RemoteException {
4129 Parcel data = Parcel.obtain();
4130 Parcel reply = Parcel.obtain();
4131 data.writeInterfaceToken(IActivityManager.descriptor);
4132 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004133 if (options == null) {
4134 data.writeInt(0);
4135 } else {
4136 data.writeInt(1);
4137 data.writeBundle(options.toBundle());
4138 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004139 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004140 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004141 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004142 data.recycle();
4143 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004144 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004145 }
4146
Craig Mautner233ceee2014-05-09 17:05:11 -07004147 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4148 Parcel data = Parcel.obtain();
4149 Parcel reply = Parcel.obtain();
4150 data.writeInterfaceToken(IActivityManager.descriptor);
4151 data.writeStrongBinder(token);
4152 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4153 reply.readException();
4154 Bundle bundle = reply.readBundle();
4155 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4156 data.recycle();
4157 reply.recycle();
4158 return options;
4159 }
4160
Daniel Sandler69a48172010-06-23 16:29:36 -04004161 public void setImmersive(IBinder token, boolean immersive)
4162 throws RemoteException {
4163 Parcel data = Parcel.obtain();
4164 Parcel reply = Parcel.obtain();
4165 data.writeInterfaceToken(IActivityManager.descriptor);
4166 data.writeStrongBinder(token);
4167 data.writeInt(immersive ? 1 : 0);
4168 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4169 reply.readException();
4170 data.recycle();
4171 reply.recycle();
4172 }
4173
4174 public boolean isImmersive(IBinder token)
4175 throws RemoteException {
4176 Parcel data = Parcel.obtain();
4177 Parcel reply = Parcel.obtain();
4178 data.writeInterfaceToken(IActivityManager.descriptor);
4179 data.writeStrongBinder(token);
4180 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004181 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004182 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004183 data.recycle();
4184 reply.recycle();
4185 return res;
4186 }
4187
4188 public boolean isTopActivityImmersive()
4189 throws RemoteException {
4190 Parcel data = Parcel.obtain();
4191 Parcel reply = Parcel.obtain();
4192 data.writeInterfaceToken(IActivityManager.descriptor);
4193 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004194 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004195 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004196 data.recycle();
4197 reply.recycle();
4198 return res;
4199 }
4200
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004201 public void crashApplication(int uid, int initialPid, String packageName,
4202 String message) throws RemoteException {
4203 Parcel data = Parcel.obtain();
4204 Parcel reply = Parcel.obtain();
4205 data.writeInterfaceToken(IActivityManager.descriptor);
4206 data.writeInt(uid);
4207 data.writeInt(initialPid);
4208 data.writeString(packageName);
4209 data.writeString(message);
4210 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4211 reply.readException();
4212 data.recycle();
4213 reply.recycle();
4214 }
Andy McFadden824c5102010-07-09 16:26:57 -07004215
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004216 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004217 Parcel data = Parcel.obtain();
4218 Parcel reply = Parcel.obtain();
4219 data.writeInterfaceToken(IActivityManager.descriptor);
4220 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004221 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004222 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4223 reply.readException();
4224 String res = reply.readString();
4225 data.recycle();
4226 reply.recycle();
4227 return res;
4228 }
4229
Dianne Hackborn7e269642010-08-25 19:50:20 -07004230 public IBinder newUriPermissionOwner(String name)
4231 throws RemoteException {
4232 Parcel data = Parcel.obtain();
4233 Parcel reply = Parcel.obtain();
4234 data.writeInterfaceToken(IActivityManager.descriptor);
4235 data.writeString(name);
4236 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4237 reply.readException();
4238 IBinder res = reply.readStrongBinder();
4239 data.recycle();
4240 reply.recycle();
4241 return res;
4242 }
4243
4244 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004245 Uri uri, int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004246 Parcel data = Parcel.obtain();
4247 Parcel reply = Parcel.obtain();
4248 data.writeInterfaceToken(IActivityManager.descriptor);
4249 data.writeStrongBinder(owner);
4250 data.writeInt(fromUid);
4251 data.writeString(targetPkg);
4252 uri.writeToParcel(data, 0);
4253 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004254 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004255 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4256 reply.readException();
4257 data.recycle();
4258 reply.recycle();
4259 }
4260
4261 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004262 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004263 Parcel data = Parcel.obtain();
4264 Parcel reply = Parcel.obtain();
4265 data.writeInterfaceToken(IActivityManager.descriptor);
4266 data.writeStrongBinder(owner);
4267 if (uri != null) {
4268 data.writeInt(1);
4269 uri.writeToParcel(data, 0);
4270 } else {
4271 data.writeInt(0);
4272 }
4273 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004274 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004275 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4276 reply.readException();
4277 data.recycle();
4278 reply.recycle();
4279 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004280
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004281 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004282 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004283 Parcel data = Parcel.obtain();
4284 Parcel reply = Parcel.obtain();
4285 data.writeInterfaceToken(IActivityManager.descriptor);
4286 data.writeInt(callingUid);
4287 data.writeString(targetPkg);
4288 uri.writeToParcel(data, 0);
4289 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004290 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004291 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4292 reply.readException();
4293 int res = reply.readInt();
4294 data.recycle();
4295 reply.recycle();
4296 return res;
4297 }
4298
Dianne Hackborn1676c852012-09-10 14:52:30 -07004299 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004300 String path, ParcelFileDescriptor fd) throws RemoteException {
4301 Parcel data = Parcel.obtain();
4302 Parcel reply = Parcel.obtain();
4303 data.writeInterfaceToken(IActivityManager.descriptor);
4304 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004305 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004306 data.writeInt(managed ? 1 : 0);
4307 data.writeString(path);
4308 if (fd != null) {
4309 data.writeInt(1);
4310 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4311 } else {
4312 data.writeInt(0);
4313 }
4314 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4315 reply.readException();
4316 boolean res = reply.readInt() != 0;
4317 reply.recycle();
4318 data.recycle();
4319 return res;
4320 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004321
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004322 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004323 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004324 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004325 Parcel data = Parcel.obtain();
4326 Parcel reply = Parcel.obtain();
4327 data.writeInterfaceToken(IActivityManager.descriptor);
4328 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004329 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004330 data.writeTypedArray(intents, 0);
4331 data.writeStringArray(resolvedTypes);
4332 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004333 if (options != null) {
4334 data.writeInt(1);
4335 options.writeToParcel(data, 0);
4336 } else {
4337 data.writeInt(0);
4338 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004339 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004340 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4341 reply.readException();
4342 int result = reply.readInt();
4343 reply.recycle();
4344 data.recycle();
4345 return result;
4346 }
4347
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004348 public int getFrontActivityScreenCompatMode() throws RemoteException {
4349 Parcel data = Parcel.obtain();
4350 Parcel reply = Parcel.obtain();
4351 data.writeInterfaceToken(IActivityManager.descriptor);
4352 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4353 reply.readException();
4354 int mode = reply.readInt();
4355 reply.recycle();
4356 data.recycle();
4357 return mode;
4358 }
4359
4360 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4361 Parcel data = Parcel.obtain();
4362 Parcel reply = Parcel.obtain();
4363 data.writeInterfaceToken(IActivityManager.descriptor);
4364 data.writeInt(mode);
4365 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4366 reply.readException();
4367 reply.recycle();
4368 data.recycle();
4369 }
4370
4371 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4372 Parcel data = Parcel.obtain();
4373 Parcel reply = Parcel.obtain();
4374 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004375 data.writeString(packageName);
4376 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004377 reply.readException();
4378 int mode = reply.readInt();
4379 reply.recycle();
4380 data.recycle();
4381 return mode;
4382 }
4383
4384 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004385 throws RemoteException {
4386 Parcel data = Parcel.obtain();
4387 Parcel reply = Parcel.obtain();
4388 data.writeInterfaceToken(IActivityManager.descriptor);
4389 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004390 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004391 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4392 reply.readException();
4393 reply.recycle();
4394 data.recycle();
4395 }
4396
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004397 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4398 Parcel data = Parcel.obtain();
4399 Parcel reply = Parcel.obtain();
4400 data.writeInterfaceToken(IActivityManager.descriptor);
4401 data.writeString(packageName);
4402 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4403 reply.readException();
4404 boolean ask = reply.readInt() != 0;
4405 reply.recycle();
4406 data.recycle();
4407 return ask;
4408 }
4409
4410 public void setPackageAskScreenCompat(String packageName, boolean ask)
4411 throws RemoteException {
4412 Parcel data = Parcel.obtain();
4413 Parcel reply = Parcel.obtain();
4414 data.writeInterfaceToken(IActivityManager.descriptor);
4415 data.writeString(packageName);
4416 data.writeInt(ask ? 1 : 0);
4417 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4418 reply.readException();
4419 reply.recycle();
4420 data.recycle();
4421 }
4422
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004423 public boolean switchUser(int userid) throws RemoteException {
4424 Parcel data = Parcel.obtain();
4425 Parcel reply = Parcel.obtain();
4426 data.writeInterfaceToken(IActivityManager.descriptor);
4427 data.writeInt(userid);
4428 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4429 reply.readException();
4430 boolean result = reply.readInt() != 0;
4431 reply.recycle();
4432 data.recycle();
4433 return result;
4434 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004435
Kenny Guy08488bf2014-02-21 17:40:37 +00004436 public boolean startUserInBackground(int userid) throws RemoteException {
4437 Parcel data = Parcel.obtain();
4438 Parcel reply = Parcel.obtain();
4439 data.writeInterfaceToken(IActivityManager.descriptor);
4440 data.writeInt(userid);
4441 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4442 reply.readException();
4443 boolean result = reply.readInt() != 0;
4444 reply.recycle();
4445 data.recycle();
4446 return result;
4447 }
4448
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004449 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4450 Parcel data = Parcel.obtain();
4451 Parcel reply = Parcel.obtain();
4452 data.writeInterfaceToken(IActivityManager.descriptor);
4453 data.writeInt(userid);
4454 data.writeStrongInterface(callback);
4455 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4456 reply.readException();
4457 int result = reply.readInt();
4458 reply.recycle();
4459 data.recycle();
4460 return result;
4461 }
4462
Amith Yamasani52f1d752012-03-28 18:19:29 -07004463 public UserInfo getCurrentUser() throws RemoteException {
4464 Parcel data = Parcel.obtain();
4465 Parcel reply = Parcel.obtain();
4466 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004467 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004468 reply.readException();
4469 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4470 reply.recycle();
4471 data.recycle();
4472 return userInfo;
4473 }
4474
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004475 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004476 Parcel data = Parcel.obtain();
4477 Parcel reply = Parcel.obtain();
4478 data.writeInterfaceToken(IActivityManager.descriptor);
4479 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004480 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004481 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4482 reply.readException();
4483 boolean result = reply.readInt() != 0;
4484 reply.recycle();
4485 data.recycle();
4486 return result;
4487 }
4488
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004489 public int[] getRunningUserIds() throws RemoteException {
4490 Parcel data = Parcel.obtain();
4491 Parcel reply = Parcel.obtain();
4492 data.writeInterfaceToken(IActivityManager.descriptor);
4493 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4494 reply.readException();
4495 int[] result = reply.createIntArray();
4496 reply.recycle();
4497 data.recycle();
4498 return result;
4499 }
4500
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004501 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4502 Parcel data = Parcel.obtain();
4503 Parcel reply = Parcel.obtain();
4504 data.writeInterfaceToken(IActivityManager.descriptor);
4505 data.writeInt(taskId);
4506 data.writeInt(subTaskIndex);
4507 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4508 reply.readException();
4509 boolean result = reply.readInt() != 0;
4510 reply.recycle();
4511 data.recycle();
4512 return result;
4513 }
4514
4515 public boolean removeTask(int taskId, int flags) throws RemoteException {
4516 Parcel data = Parcel.obtain();
4517 Parcel reply = Parcel.obtain();
4518 data.writeInterfaceToken(IActivityManager.descriptor);
4519 data.writeInt(taskId);
4520 data.writeInt(flags);
4521 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4522 reply.readException();
4523 boolean result = reply.readInt() != 0;
4524 reply.recycle();
4525 data.recycle();
4526 return result;
4527 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004528
Jeff Sharkeya4620792011-05-20 15:29:23 -07004529 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4530 Parcel data = Parcel.obtain();
4531 Parcel reply = Parcel.obtain();
4532 data.writeInterfaceToken(IActivityManager.descriptor);
4533 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4534 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4535 reply.readException();
4536 data.recycle();
4537 reply.recycle();
4538 }
4539
4540 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4541 Parcel data = Parcel.obtain();
4542 Parcel reply = Parcel.obtain();
4543 data.writeInterfaceToken(IActivityManager.descriptor);
4544 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4545 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4546 reply.readException();
4547 data.recycle();
4548 reply.recycle();
4549 }
4550
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004551 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4552 Parcel data = Parcel.obtain();
4553 Parcel reply = Parcel.obtain();
4554 data.writeInterfaceToken(IActivityManager.descriptor);
4555 data.writeStrongBinder(sender.asBinder());
4556 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4557 reply.readException();
4558 boolean res = reply.readInt() != 0;
4559 data.recycle();
4560 reply.recycle();
4561 return res;
4562 }
4563
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004564 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4565 Parcel data = Parcel.obtain();
4566 Parcel reply = Parcel.obtain();
4567 data.writeInterfaceToken(IActivityManager.descriptor);
4568 data.writeStrongBinder(sender.asBinder());
4569 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4570 reply.readException();
4571 boolean res = reply.readInt() != 0;
4572 data.recycle();
4573 reply.recycle();
4574 return res;
4575 }
4576
Dianne Hackborn81038902012-11-26 17:04:09 -08004577 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4578 Parcel data = Parcel.obtain();
4579 Parcel reply = Parcel.obtain();
4580 data.writeInterfaceToken(IActivityManager.descriptor);
4581 data.writeStrongBinder(sender.asBinder());
4582 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4583 reply.readException();
4584 Intent res = reply.readInt() != 0
4585 ? Intent.CREATOR.createFromParcel(reply) : null;
4586 data.recycle();
4587 reply.recycle();
4588 return res;
4589 }
4590
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004591 public String getTagForIntentSender(IIntentSender sender, String prefix)
4592 throws RemoteException {
4593 Parcel data = Parcel.obtain();
4594 Parcel reply = Parcel.obtain();
4595 data.writeInterfaceToken(IActivityManager.descriptor);
4596 data.writeStrongBinder(sender.asBinder());
4597 data.writeString(prefix);
4598 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4599 reply.readException();
4600 String res = reply.readString();
4601 data.recycle();
4602 reply.recycle();
4603 return res;
4604 }
4605
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004606 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4607 {
4608 Parcel data = Parcel.obtain();
4609 Parcel reply = Parcel.obtain();
4610 data.writeInterfaceToken(IActivityManager.descriptor);
4611 values.writeToParcel(data, 0);
4612 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4613 reply.readException();
4614 data.recycle();
4615 reply.recycle();
4616 }
4617
Dianne Hackbornb437e092011-08-05 17:50:29 -07004618 public long[] getProcessPss(int[] pids) throws RemoteException {
4619 Parcel data = Parcel.obtain();
4620 Parcel reply = Parcel.obtain();
4621 data.writeInterfaceToken(IActivityManager.descriptor);
4622 data.writeIntArray(pids);
4623 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4624 reply.readException();
4625 long[] res = reply.createLongArray();
4626 data.recycle();
4627 reply.recycle();
4628 return res;
4629 }
4630
Dianne Hackborn661cd522011-08-22 00:26:20 -07004631 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4632 Parcel data = Parcel.obtain();
4633 Parcel reply = Parcel.obtain();
4634 data.writeInterfaceToken(IActivityManager.descriptor);
4635 TextUtils.writeToParcel(msg, data, 0);
4636 data.writeInt(always ? 1 : 0);
4637 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4638 reply.readException();
4639 data.recycle();
4640 reply.recycle();
4641 }
4642
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004643 public void dismissKeyguardOnNextActivity() throws RemoteException {
4644 Parcel data = Parcel.obtain();
4645 Parcel reply = Parcel.obtain();
4646 data.writeInterfaceToken(IActivityManager.descriptor);
4647 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4648 reply.readException();
4649 data.recycle();
4650 reply.recycle();
4651 }
4652
Adam Powelldd8fab22012-03-22 17:47:27 -07004653 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4654 throws RemoteException {
4655 Parcel data = Parcel.obtain();
4656 Parcel reply = Parcel.obtain();
4657 data.writeInterfaceToken(IActivityManager.descriptor);
4658 data.writeStrongBinder(token);
4659 data.writeString(destAffinity);
4660 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4661 reply.readException();
4662 boolean result = reply.readInt() != 0;
4663 data.recycle();
4664 reply.recycle();
4665 return result;
4666 }
4667
4668 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4669 throws RemoteException {
4670 Parcel data = Parcel.obtain();
4671 Parcel reply = Parcel.obtain();
4672 data.writeInterfaceToken(IActivityManager.descriptor);
4673 data.writeStrongBinder(token);
4674 target.writeToParcel(data, 0);
4675 data.writeInt(resultCode);
4676 if (resultData != null) {
4677 data.writeInt(1);
4678 resultData.writeToParcel(data, 0);
4679 } else {
4680 data.writeInt(0);
4681 }
4682 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4683 reply.readException();
4684 boolean result = reply.readInt() != 0;
4685 data.recycle();
4686 reply.recycle();
4687 return result;
4688 }
4689
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004690 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4691 Parcel data = Parcel.obtain();
4692 Parcel reply = Parcel.obtain();
4693 data.writeInterfaceToken(IActivityManager.descriptor);
4694 data.writeStrongBinder(activityToken);
4695 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4696 reply.readException();
4697 int result = reply.readInt();
4698 data.recycle();
4699 reply.recycle();
4700 return result;
4701 }
4702
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004703 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4704 Parcel data = Parcel.obtain();
4705 Parcel reply = Parcel.obtain();
4706 data.writeInterfaceToken(IActivityManager.descriptor);
4707 data.writeStrongBinder(activityToken);
4708 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4709 reply.readException();
4710 String result = reply.readString();
4711 data.recycle();
4712 reply.recycle();
4713 return result;
4714 }
4715
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004716 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4717 Parcel data = Parcel.obtain();
4718 Parcel reply = Parcel.obtain();
4719 data.writeInterfaceToken(IActivityManager.descriptor);
4720 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4721 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4722 reply.readException();
4723 data.recycle();
4724 reply.recycle();
4725 }
4726
4727 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4728 Parcel data = Parcel.obtain();
4729 Parcel reply = Parcel.obtain();
4730 data.writeInterfaceToken(IActivityManager.descriptor);
4731 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4732 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4733 reply.readException();
4734 data.recycle();
4735 reply.recycle();
4736 }
4737
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004738 public void requestBugReport() throws RemoteException {
4739 Parcel data = Parcel.obtain();
4740 Parcel reply = Parcel.obtain();
4741 data.writeInterfaceToken(IActivityManager.descriptor);
4742 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4743 reply.readException();
4744 data.recycle();
4745 reply.recycle();
4746 }
4747
Jeff Brownbd181bb2013-09-10 16:44:24 -07004748 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4749 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004750 Parcel data = Parcel.obtain();
4751 Parcel reply = Parcel.obtain();
4752 data.writeInterfaceToken(IActivityManager.descriptor);
4753 data.writeInt(pid);
4754 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004755 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004756 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4757 reply.readException();
4758 long res = reply.readInt();
4759 data.recycle();
4760 reply.recycle();
4761 return res;
4762 }
4763
Adam Skorydfc7fd72013-08-05 19:23:41 -07004764 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004765 Parcel data = Parcel.obtain();
4766 Parcel reply = Parcel.obtain();
4767 data.writeInterfaceToken(IActivityManager.descriptor);
4768 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004769 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004770 reply.readException();
4771 Bundle res = reply.readBundle();
4772 data.recycle();
4773 reply.recycle();
4774 return res;
4775 }
4776
Adam Skory7140a252013-09-11 12:04:58 +01004777 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004778 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004779 Parcel data = Parcel.obtain();
4780 Parcel reply = Parcel.obtain();
4781 data.writeInterfaceToken(IActivityManager.descriptor);
4782 data.writeStrongBinder(token);
4783 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004784 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004785 reply.readException();
4786 data.recycle();
4787 reply.recycle();
4788 }
4789
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004790 public void killUid(int uid, String reason) throws RemoteException {
4791 Parcel data = Parcel.obtain();
4792 Parcel reply = Parcel.obtain();
4793 data.writeInterfaceToken(IActivityManager.descriptor);
4794 data.writeInt(uid);
4795 data.writeString(reason);
4796 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4797 reply.readException();
4798 data.recycle();
4799 reply.recycle();
4800 }
4801
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004802 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4803 Parcel data = Parcel.obtain();
4804 Parcel reply = Parcel.obtain();
4805 data.writeInterfaceToken(IActivityManager.descriptor);
4806 data.writeStrongBinder(who);
4807 data.writeInt(allowRestart ? 1 : 0);
4808 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4809 reply.readException();
4810 data.recycle();
4811 reply.recycle();
4812 }
4813
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004814 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4815 Parcel data = Parcel.obtain();
4816 Parcel reply = Parcel.obtain();
4817 data.writeInterfaceToken(IActivityManager.descriptor);
4818 data.writeStrongBinder(token);
4819 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4820 reply.readException();
4821 data.recycle();
4822 reply.recycle();
4823 }
4824
Craig Mautner5eda9b32013-07-02 11:58:16 -07004825 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4826 Parcel data = Parcel.obtain();
4827 Parcel reply = Parcel.obtain();
4828 data.writeInterfaceToken(IActivityManager.descriptor);
4829 data.writeStrongBinder(token);
4830 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4831 reply.readException();
4832 data.recycle();
4833 reply.recycle();
4834 }
4835
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004836 public void restart() throws RemoteException {
4837 Parcel data = Parcel.obtain();
4838 Parcel reply = Parcel.obtain();
4839 data.writeInterfaceToken(IActivityManager.descriptor);
4840 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4841 reply.readException();
4842 data.recycle();
4843 reply.recycle();
4844 }
4845
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004846 public void performIdleMaintenance() throws RemoteException {
4847 Parcel data = Parcel.obtain();
4848 Parcel reply = Parcel.obtain();
4849 data.writeInterfaceToken(IActivityManager.descriptor);
4850 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4851 reply.readException();
4852 data.recycle();
4853 reply.recycle();
4854 }
4855
Craig Mautner4a1cb222013-12-04 16:14:06 -08004856 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4857 IActivityContainerCallback callback) throws RemoteException {
4858 Parcel data = Parcel.obtain();
4859 Parcel reply = Parcel.obtain();
4860 data.writeInterfaceToken(IActivityManager.descriptor);
4861 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07004862 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08004863 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4864 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004865 final int result = reply.readInt();
4866 final IActivityContainer res;
4867 if (result == 1) {
4868 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4869 } else {
4870 res = null;
4871 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004872 data.recycle();
4873 reply.recycle();
4874 return res;
4875 }
4876
Craig Mautner95da1082014-02-24 17:54:35 -08004877 public void deleteActivityContainer(IActivityContainer activityContainer)
4878 throws RemoteException {
4879 Parcel data = Parcel.obtain();
4880 Parcel reply = Parcel.obtain();
4881 data.writeInterfaceToken(IActivityManager.descriptor);
4882 data.writeStrongBinder(activityContainer.asBinder());
4883 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4884 reply.readException();
4885 data.recycle();
4886 reply.recycle();
4887 }
4888
Craig Mautnere0a38842013-12-16 16:14:02 -08004889 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4890 throws RemoteException {
4891 Parcel data = Parcel.obtain();
4892 Parcel reply = Parcel.obtain();
4893 data.writeInterfaceToken(IActivityManager.descriptor);
4894 data.writeStrongBinder(activityToken);
4895 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4896 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004897 final int result = reply.readInt();
4898 final IActivityContainer res;
4899 if (result == 1) {
4900 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4901 } else {
4902 res = null;
4903 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004904 data.recycle();
4905 reply.recycle();
4906 return res;
4907 }
4908
Craig Mautner4a1cb222013-12-04 16:14:06 -08004909 public IBinder getHomeActivityToken() throws RemoteException {
4910 Parcel data = Parcel.obtain();
4911 Parcel reply = Parcel.obtain();
4912 data.writeInterfaceToken(IActivityManager.descriptor);
4913 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4914 reply.readException();
4915 IBinder res = reply.readStrongBinder();
4916 data.recycle();
4917 reply.recycle();
4918 return res;
4919 }
4920
Craig Mautneraea74a52014-03-08 14:23:10 -08004921 @Override
4922 public void startLockTaskMode(int taskId) throws RemoteException {
4923 Parcel data = Parcel.obtain();
4924 Parcel reply = Parcel.obtain();
4925 data.writeInterfaceToken(IActivityManager.descriptor);
4926 data.writeInt(taskId);
4927 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
4928 reply.readException();
4929 data.recycle();
4930 reply.recycle();
4931 }
4932
4933 @Override
4934 public void startLockTaskMode(IBinder token) throws RemoteException {
4935 Parcel data = Parcel.obtain();
4936 Parcel reply = Parcel.obtain();
4937 data.writeInterfaceToken(IActivityManager.descriptor);
4938 data.writeStrongBinder(token);
4939 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
4940 reply.readException();
4941 data.recycle();
4942 reply.recycle();
4943 }
4944
4945 @Override
4946 public void stopLockTaskMode() throws RemoteException {
4947 Parcel data = Parcel.obtain();
4948 Parcel reply = Parcel.obtain();
4949 data.writeInterfaceToken(IActivityManager.descriptor);
4950 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4951 reply.readException();
4952 data.recycle();
4953 reply.recycle();
4954 }
4955
4956 @Override
4957 public boolean isInLockTaskMode() throws RemoteException {
4958 Parcel data = Parcel.obtain();
4959 Parcel reply = Parcel.obtain();
4960 data.writeInterfaceToken(IActivityManager.descriptor);
4961 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4962 reply.readException();
4963 boolean isInLockTaskMode = reply.readInt() == 1;
4964 data.recycle();
4965 reply.recycle();
4966 return isInLockTaskMode;
4967 }
4968
Craig Mautner688b5102014-03-27 16:55:03 -07004969 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07004970 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07004971 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07004972 Parcel data = Parcel.obtain();
4973 Parcel reply = Parcel.obtain();
4974 data.writeInterfaceToken(IActivityManager.descriptor);
4975 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07004976 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07004977 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07004978 reply.readException();
4979 data.recycle();
4980 reply.recycle();
4981 }
4982
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004983 private IBinder mRemote;
4984}