blob: 97e793f9720227d33b4224a1cf9ac998658271f6 [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;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070033import android.graphics.Bitmap;
34import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080035import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036import android.net.Uri;
37import android.os.Binder;
38import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070039import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.os.IBinder;
41import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070042import android.os.ParcelFileDescriptor;
43import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070044import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070045import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070047import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070048import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080051import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070052import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054import java.util.ArrayList;
55import java.util.List;
56
57/** {@hide} */
58public abstract class ActivityManagerNative extends Binder implements IActivityManager
59{
60 /**
61 * Cast a Binder object into an activity manager interface, generating
62 * a proxy if needed.
63 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080064 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080065 if (obj == null) {
66 return null;
67 }
68 IActivityManager in =
69 (IActivityManager)obj.queryLocalInterface(descriptor);
70 if (in != null) {
71 return in;
72 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080073
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 return new ActivityManagerProxy(obj);
75 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 /**
78 * Retrieve the system's default/global activity manager.
79 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080080 static public IActivityManager getDefault() {
81 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082 }
83
84 /**
85 * Convenience for checking whether the system is ready. For internal use only.
86 */
87 static public boolean isSystemReady() {
88 if (!sSystemReady) {
89 sSystemReady = getDefault().testIsSystemReady();
90 }
91 return sSystemReady;
92 }
93 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080094
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095 /**
96 * Convenience for sending a sticky broadcast. For internal use only.
97 * If you don't care about permission, use null.
98 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070099 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100 try {
101 getDefault().broadcastIntent(
102 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800103 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800104 } catch (RemoteException ex) {
105 }
106 }
107
Dianne Hackborn099bc622014-01-22 13:39:16 -0800108 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800110 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800111 } catch (RemoteException ex) {
112 }
113 }
114
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800115 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800116 attachInterface(this, descriptor);
117 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700118
119 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
121 throws RemoteException {
122 switch (code) {
123 case START_ACTIVITY_TRANSACTION:
124 {
125 data.enforceInterface(IActivityManager.descriptor);
126 IBinder b = data.readStrongBinder();
127 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800128 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 Intent intent = Intent.CREATOR.createFromParcel(data);
130 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800132 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800133 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700134 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700135 String profileFile = data.readString();
136 ParcelFileDescriptor profileFd = data.readInt() != 0
137 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700138 Bundle options = data.readInt() != 0
139 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800140 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700141 resultTo, resultWho, requestCode, startFlags,
142 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800143 reply.writeNoException();
144 reply.writeInt(result);
145 return true;
146 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700147
Amith Yamasani82644082012-08-03 13:09:11 -0700148 case START_ACTIVITY_AS_USER_TRANSACTION:
149 {
150 data.enforceInterface(IActivityManager.descriptor);
151 IBinder b = data.readStrongBinder();
152 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800153 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700154 Intent intent = Intent.CREATOR.createFromParcel(data);
155 String resolvedType = data.readString();
156 IBinder resultTo = data.readStrongBinder();
157 String resultWho = data.readString();
158 int requestCode = data.readInt();
159 int startFlags = data.readInt();
160 String profileFile = data.readString();
161 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700162 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700163 Bundle options = data.readInt() != 0
164 ? Bundle.CREATOR.createFromParcel(data) : null;
165 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800166 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700167 resultTo, resultWho, requestCode, startFlags,
168 profileFile, profileFd, options, userId);
169 reply.writeNoException();
170 reply.writeInt(result);
171 return true;
172 }
173
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700174 case START_ACTIVITY_AS_CALLER_TRANSACTION:
175 {
176 data.enforceInterface(IActivityManager.descriptor);
177 IBinder b = data.readStrongBinder();
178 IApplicationThread app = ApplicationThreadNative.asInterface(b);
179 String callingPackage = data.readString();
180 Intent intent = Intent.CREATOR.createFromParcel(data);
181 String resolvedType = data.readString();
182 IBinder resultTo = data.readStrongBinder();
183 String resultWho = data.readString();
184 int requestCode = data.readInt();
185 int startFlags = data.readInt();
186 String profileFile = data.readString();
187 ParcelFileDescriptor profileFd = data.readInt() != 0
188 ? data.readFileDescriptor() : null;
189 Bundle options = data.readInt() != 0
190 ? Bundle.CREATOR.createFromParcel(data) : null;
191 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
192 resultTo, resultWho, requestCode, startFlags,
193 profileFile, profileFd, options);
194 reply.writeNoException();
195 reply.writeInt(result);
196 return true;
197 }
198
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800199 case START_ACTIVITY_AND_WAIT_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 Hackborn8f7f35e2010-02-25 18:48:12 -0800205 Intent intent = Intent.CREATOR.createFromParcel(data);
206 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800207 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800208 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800209 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700210 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700211 String profileFile = data.readString();
212 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700213 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700214 Bundle options = data.readInt() != 0
215 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700216 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800217 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700218 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700219 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800220 reply.writeNoException();
221 result.writeToParcel(reply, 0);
222 return true;
223 }
224
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700225 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
226 {
227 data.enforceInterface(IActivityManager.descriptor);
228 IBinder b = data.readStrongBinder();
229 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800230 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700231 Intent intent = Intent.CREATOR.createFromParcel(data);
232 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700233 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700234 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700235 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700236 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700237 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700238 Bundle options = data.readInt() != 0
239 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700240 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800241 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700242 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700243 reply.writeNoException();
244 reply.writeInt(result);
245 return true;
246 }
247
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700248 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700249 {
250 data.enforceInterface(IActivityManager.descriptor);
251 IBinder b = data.readStrongBinder();
252 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700253 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700254 Intent fillInIntent = null;
255 if (data.readInt() != 0) {
256 fillInIntent = Intent.CREATOR.createFromParcel(data);
257 }
258 String resolvedType = data.readString();
259 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700260 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700261 int requestCode = data.readInt();
262 int flagsMask = data.readInt();
263 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700264 Bundle options = data.readInt() != 0
265 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700266 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700267 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700268 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700269 reply.writeNoException();
270 reply.writeInt(result);
271 return true;
272 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700273
Dianne Hackborn91097de2014-04-04 18:02:06 -0700274 case START_VOICE_ACTIVITY_TRANSACTION:
275 {
276 data.enforceInterface(IActivityManager.descriptor);
277 String callingPackage = data.readString();
278 int callingPid = data.readInt();
279 int callingUid = data.readInt();
280 Intent intent = Intent.CREATOR.createFromParcel(data);
281 String resolvedType = data.readString();
282 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
283 data.readStrongBinder());
284 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
285 data.readStrongBinder());
286 int startFlags = data.readInt();
287 String profileFile = data.readString();
288 ParcelFileDescriptor profileFd = data.readInt() != 0
289 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
290 Bundle options = data.readInt() != 0
291 ? Bundle.CREATOR.createFromParcel(data) : null;
292 int userId = data.readInt();
293 int result = startVoiceActivity(callingPackage, callingPid, callingUid,
294 intent, resolvedType, session, interactor, startFlags,
295 profileFile, profileFd, options, userId);
296 reply.writeNoException();
297 reply.writeInt(result);
298 return true;
299 }
300
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800301 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
302 {
303 data.enforceInterface(IActivityManager.descriptor);
304 IBinder callingActivity = data.readStrongBinder();
305 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700306 Bundle options = data.readInt() != 0
307 ? Bundle.CREATOR.createFromParcel(data) : null;
308 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800309 reply.writeNoException();
310 reply.writeInt(result ? 1 : 0);
311 return true;
312 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700313
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700314 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
315 {
316 data.enforceInterface(IActivityManager.descriptor);
317 int taskId = data.readInt();
318 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
319 int result = startActivityFromRecents(taskId, options);
320 reply.writeNoException();
321 reply.writeInt(result);
322 return true;
323 }
324
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800325 case FINISH_ACTIVITY_TRANSACTION: {
326 data.enforceInterface(IActivityManager.descriptor);
327 IBinder token = data.readStrongBinder();
328 Intent resultData = null;
329 int resultCode = data.readInt();
330 if (data.readInt() != 0) {
331 resultData = Intent.CREATOR.createFromParcel(data);
332 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700333 boolean finishTask = (data.readInt() != 0);
334 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800335 reply.writeNoException();
336 reply.writeInt(res ? 1 : 0);
337 return true;
338 }
339
340 case FINISH_SUB_ACTIVITY_TRANSACTION: {
341 data.enforceInterface(IActivityManager.descriptor);
342 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700343 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800344 int requestCode = data.readInt();
345 finishSubActivity(token, resultWho, requestCode);
346 reply.writeNoException();
347 return true;
348 }
349
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700350 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
351 data.enforceInterface(IActivityManager.descriptor);
352 IBinder token = data.readStrongBinder();
353 boolean res = finishActivityAffinity(token);
354 reply.writeNoException();
355 reply.writeInt(res ? 1 : 0);
356 return true;
357 }
358
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700359 case FINISH_VOICE_TASK_TRANSACTION: {
360 data.enforceInterface(IActivityManager.descriptor);
361 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
362 data.readStrongBinder());
363 finishVoiceTask(session);
364 reply.writeNoException();
365 return true;
366 }
367
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800368 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
369 data.enforceInterface(IActivityManager.descriptor);
370 IBinder token = data.readStrongBinder();
371 boolean res = willActivityBeVisible(token);
372 reply.writeNoException();
373 reply.writeInt(res ? 1 : 0);
374 return true;
375 }
376
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800377 case REGISTER_RECEIVER_TRANSACTION:
378 {
379 data.enforceInterface(IActivityManager.descriptor);
380 IBinder b = data.readStrongBinder();
381 IApplicationThread app =
382 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700383 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 b = data.readStrongBinder();
385 IIntentReceiver rec
386 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
387 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
388 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700389 int userId = data.readInt();
390 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800391 reply.writeNoException();
392 if (intent != null) {
393 reply.writeInt(1);
394 intent.writeToParcel(reply, 0);
395 } else {
396 reply.writeInt(0);
397 }
398 return true;
399 }
400
401 case UNREGISTER_RECEIVER_TRANSACTION:
402 {
403 data.enforceInterface(IActivityManager.descriptor);
404 IBinder b = data.readStrongBinder();
405 if (b == null) {
406 return true;
407 }
408 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
409 unregisterReceiver(rec);
410 reply.writeNoException();
411 return true;
412 }
413
414 case BROADCAST_INTENT_TRANSACTION:
415 {
416 data.enforceInterface(IActivityManager.descriptor);
417 IBinder b = data.readStrongBinder();
418 IApplicationThread app =
419 b != null ? ApplicationThreadNative.asInterface(b) : null;
420 Intent intent = Intent.CREATOR.createFromParcel(data);
421 String resolvedType = data.readString();
422 b = data.readStrongBinder();
423 IIntentReceiver resultTo =
424 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
425 int resultCode = data.readInt();
426 String resultData = data.readString();
427 Bundle resultExtras = data.readBundle();
428 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800429 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800430 boolean serialized = data.readInt() != 0;
431 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700432 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800433 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800434 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700435 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800436 reply.writeNoException();
437 reply.writeInt(res);
438 return true;
439 }
440
441 case UNBROADCAST_INTENT_TRANSACTION:
442 {
443 data.enforceInterface(IActivityManager.descriptor);
444 IBinder b = data.readStrongBinder();
445 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
446 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700447 int userId = data.readInt();
448 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800449 reply.writeNoException();
450 return true;
451 }
452
453 case FINISH_RECEIVER_TRANSACTION: {
454 data.enforceInterface(IActivityManager.descriptor);
455 IBinder who = data.readStrongBinder();
456 int resultCode = data.readInt();
457 String resultData = data.readString();
458 Bundle resultExtras = data.readBundle();
459 boolean resultAbort = data.readInt() != 0;
460 if (who != null) {
461 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
462 }
463 reply.writeNoException();
464 return true;
465 }
466
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 case ATTACH_APPLICATION_TRANSACTION: {
468 data.enforceInterface(IActivityManager.descriptor);
469 IApplicationThread app = ApplicationThreadNative.asInterface(
470 data.readStrongBinder());
471 if (app != null) {
472 attachApplication(app);
473 }
474 reply.writeNoException();
475 return true;
476 }
477
478 case ACTIVITY_IDLE_TRANSACTION: {
479 data.enforceInterface(IActivityManager.descriptor);
480 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700481 Configuration config = null;
482 if (data.readInt() != 0) {
483 config = Configuration.CREATOR.createFromParcel(data);
484 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700485 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800486 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700487 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800488 }
489 reply.writeNoException();
490 return true;
491 }
492
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700493 case ACTIVITY_RESUMED_TRANSACTION: {
494 data.enforceInterface(IActivityManager.descriptor);
495 IBinder token = data.readStrongBinder();
496 activityResumed(token);
497 reply.writeNoException();
498 return true;
499 }
500
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800501 case ACTIVITY_PAUSED_TRANSACTION: {
502 data.enforceInterface(IActivityManager.descriptor);
503 IBinder token = data.readStrongBinder();
Craig Mautnera0026042014-04-23 11:45:37 -0700504 PersistableBundle persistentState = data.readPersistableBundle();
505 activityPaused(token, persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800506 reply.writeNoException();
507 return true;
508 }
509
510 case ACTIVITY_STOPPED_TRANSACTION: {
511 data.enforceInterface(IActivityManager.descriptor);
512 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800513 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700514 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800515 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700516 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800517 reply.writeNoException();
518 return true;
519 }
520
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800521 case ACTIVITY_SLEPT_TRANSACTION: {
522 data.enforceInterface(IActivityManager.descriptor);
523 IBinder token = data.readStrongBinder();
524 activitySlept(token);
525 reply.writeNoException();
526 return true;
527 }
528
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800529 case ACTIVITY_DESTROYED_TRANSACTION: {
530 data.enforceInterface(IActivityManager.descriptor);
531 IBinder token = data.readStrongBinder();
532 activityDestroyed(token);
533 reply.writeNoException();
534 return true;
535 }
536
537 case GET_CALLING_PACKAGE_TRANSACTION: {
538 data.enforceInterface(IActivityManager.descriptor);
539 IBinder token = data.readStrongBinder();
540 String res = token != null ? getCallingPackage(token) : null;
541 reply.writeNoException();
542 reply.writeString(res);
543 return true;
544 }
545
546 case GET_CALLING_ACTIVITY_TRANSACTION: {
547 data.enforceInterface(IActivityManager.descriptor);
548 IBinder token = data.readStrongBinder();
549 ComponentName cn = getCallingActivity(token);
550 reply.writeNoException();
551 ComponentName.writeToParcel(cn, reply);
552 return true;
553 }
554
Winson Chung1147c402014-05-14 11:05:00 -0700555 case GET_APP_TASKS_TRANSACTION: {
556 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700557 String callingPackage = data.readString();
558 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700559 reply.writeNoException();
560 int N = list != null ? list.size() : -1;
561 reply.writeInt(N);
562 int i;
563 for (i=0; i<N; i++) {
564 IAppTask task = list.get(i);
565 reply.writeStrongBinder(task.asBinder());
566 }
567 return true;
568 }
569
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700570 case ADD_APP_TASK_TRANSACTION: {
571 data.enforceInterface(IActivityManager.descriptor);
572 IBinder activityToken = data.readStrongBinder();
573 Intent intent = Intent.CREATOR.createFromParcel(data);
574 ActivityManager.TaskDescription descr
575 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
576 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
577 int res = addAppTask(activityToken, intent, descr, thumbnail);
578 reply.writeNoException();
579 reply.writeInt(res);
580 return true;
581 }
582
583 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
584 data.enforceInterface(IActivityManager.descriptor);
585 Point size = getAppTaskThumbnailSize();
586 reply.writeNoException();
587 size.writeToParcel(reply, 0);
588 return true;
589 }
590
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800591 case GET_TASKS_TRANSACTION: {
592 data.enforceInterface(IActivityManager.descriptor);
593 int maxNum = data.readInt();
594 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700595 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800596 reply.writeNoException();
597 int N = list != null ? list.size() : -1;
598 reply.writeInt(N);
599 int i;
600 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700601 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800602 info.writeToParcel(reply, 0);
603 }
604 return true;
605 }
606
607 case GET_RECENT_TASKS_TRANSACTION: {
608 data.enforceInterface(IActivityManager.descriptor);
609 int maxNum = data.readInt();
610 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700611 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800612 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700613 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800614 reply.writeNoException();
615 reply.writeTypedList(list);
616 return true;
617 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700618
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700619 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800620 data.enforceInterface(IActivityManager.descriptor);
621 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700622 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800623 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700624 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800625 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700626 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700627 } else {
628 reply.writeInt(0);
629 }
630 return true;
631 }
632
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800633 case GET_SERVICES_TRANSACTION: {
634 data.enforceInterface(IActivityManager.descriptor);
635 int maxNum = data.readInt();
636 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700637 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800638 reply.writeNoException();
639 int N = list != null ? list.size() : -1;
640 reply.writeInt(N);
641 int i;
642 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700643 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800644 info.writeToParcel(reply, 0);
645 }
646 return true;
647 }
648
649 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
650 data.enforceInterface(IActivityManager.descriptor);
651 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
652 reply.writeNoException();
653 reply.writeTypedList(list);
654 return true;
655 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700656
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800657 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
658 data.enforceInterface(IActivityManager.descriptor);
659 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
660 reply.writeNoException();
661 reply.writeTypedList(list);
662 return true;
663 }
664
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700665 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
666 data.enforceInterface(IActivityManager.descriptor);
667 List<ApplicationInfo> list = getRunningExternalApplications();
668 reply.writeNoException();
669 reply.writeTypedList(list);
670 return true;
671 }
672
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800673 case MOVE_TASK_TO_FRONT_TRANSACTION: {
674 data.enforceInterface(IActivityManager.descriptor);
675 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800676 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700677 Bundle options = data.readInt() != 0
678 ? Bundle.CREATOR.createFromParcel(data) : null;
679 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800680 reply.writeNoException();
681 return true;
682 }
683
684 case MOVE_TASK_TO_BACK_TRANSACTION: {
685 data.enforceInterface(IActivityManager.descriptor);
686 int task = data.readInt();
687 moveTaskToBack(task);
688 reply.writeNoException();
689 return true;
690 }
691
692 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
693 data.enforceInterface(IActivityManager.descriptor);
694 IBinder token = data.readStrongBinder();
695 boolean nonRoot = data.readInt() != 0;
696 boolean res = moveActivityTaskToBack(token, nonRoot);
697 reply.writeNoException();
698 reply.writeInt(res ? 1 : 0);
699 return true;
700 }
701
702 case MOVE_TASK_BACKWARDS_TRANSACTION: {
703 data.enforceInterface(IActivityManager.descriptor);
704 int task = data.readInt();
705 moveTaskBackwards(task);
706 reply.writeNoException();
707 return true;
708 }
709
Craig Mautnerc00204b2013-03-05 15:02:14 -0800710 case MOVE_TASK_TO_STACK_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 int taskId = data.readInt();
713 int stackId = data.readInt();
714 boolean toTop = data.readInt() != 0;
715 moveTaskToStack(taskId, stackId, toTop);
716 reply.writeNoException();
717 return true;
718 }
719
720 case RESIZE_STACK_TRANSACTION: {
721 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800722 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800723 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800724 Rect r = Rect.CREATOR.createFromParcel(data);
725 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800726 reply.writeNoException();
727 return true;
728 }
729
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800730 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700731 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800732 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700733 reply.writeNoException();
734 reply.writeTypedList(list);
735 return true;
736 }
737
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800738 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700739 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800740 int stackId = data.readInt();
741 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700742 reply.writeNoException();
743 if (info != null) {
744 reply.writeInt(1);
745 info.writeToParcel(reply, 0);
746 } else {
747 reply.writeInt(0);
748 }
749 return true;
750 }
751
Winson Chung303e1ff2014-03-07 15:06:19 -0800752 case IS_IN_HOME_STACK_TRANSACTION: {
753 data.enforceInterface(IActivityManager.descriptor);
754 int taskId = data.readInt();
755 boolean isInHomeStack = isInHomeStack(taskId);
756 reply.writeNoException();
757 reply.writeInt(isInHomeStack ? 1 : 0);
758 return true;
759 }
760
Craig Mautnercf910b02013-04-23 11:23:27 -0700761 case SET_FOCUSED_STACK_TRANSACTION: {
762 data.enforceInterface(IActivityManager.descriptor);
763 int stackId = data.readInt();
764 setFocusedStack(stackId);
765 reply.writeNoException();
766 return true;
767 }
768
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800769 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
770 data.enforceInterface(IActivityManager.descriptor);
771 IBinder token = data.readStrongBinder();
772 boolean onlyRoot = data.readInt() != 0;
773 int res = token != null
774 ? getTaskForActivity(token, onlyRoot) : -1;
775 reply.writeNoException();
776 reply.writeInt(res);
777 return true;
778 }
779
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800780 case GET_CONTENT_PROVIDER_TRANSACTION: {
781 data.enforceInterface(IActivityManager.descriptor);
782 IBinder b = data.readStrongBinder();
783 IApplicationThread app = ApplicationThreadNative.asInterface(b);
784 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700785 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700786 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700787 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800788 reply.writeNoException();
789 if (cph != null) {
790 reply.writeInt(1);
791 cph.writeToParcel(reply, 0);
792 } else {
793 reply.writeInt(0);
794 }
795 return true;
796 }
797
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800798 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
799 data.enforceInterface(IActivityManager.descriptor);
800 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700801 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800802 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700803 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800804 reply.writeNoException();
805 if (cph != null) {
806 reply.writeInt(1);
807 cph.writeToParcel(reply, 0);
808 } else {
809 reply.writeInt(0);
810 }
811 return true;
812 }
813
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800814 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
815 data.enforceInterface(IActivityManager.descriptor);
816 IBinder b = data.readStrongBinder();
817 IApplicationThread app = ApplicationThreadNative.asInterface(b);
818 ArrayList<ContentProviderHolder> providers =
819 data.createTypedArrayList(ContentProviderHolder.CREATOR);
820 publishContentProviders(app, providers);
821 reply.writeNoException();
822 return true;
823 }
824
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700825 case REF_CONTENT_PROVIDER_TRANSACTION: {
826 data.enforceInterface(IActivityManager.descriptor);
827 IBinder b = data.readStrongBinder();
828 int stable = data.readInt();
829 int unstable = data.readInt();
830 boolean res = refContentProvider(b, stable, unstable);
831 reply.writeNoException();
832 reply.writeInt(res ? 1 : 0);
833 return true;
834 }
835
836 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
837 data.enforceInterface(IActivityManager.descriptor);
838 IBinder b = data.readStrongBinder();
839 unstableProviderDied(b);
840 reply.writeNoException();
841 return true;
842 }
843
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700844 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
845 data.enforceInterface(IActivityManager.descriptor);
846 IBinder b = data.readStrongBinder();
847 appNotRespondingViaProvider(b);
848 reply.writeNoException();
849 return true;
850 }
851
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800852 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
853 data.enforceInterface(IActivityManager.descriptor);
854 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700855 boolean stable = data.readInt() != 0;
856 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800857 reply.writeNoException();
858 return true;
859 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800860
861 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
862 data.enforceInterface(IActivityManager.descriptor);
863 String name = data.readString();
864 IBinder token = data.readStrongBinder();
865 removeContentProviderExternal(name, token);
866 reply.writeNoException();
867 return true;
868 }
869
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700870 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
871 data.enforceInterface(IActivityManager.descriptor);
872 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
873 PendingIntent pi = getRunningServiceControlPanel(comp);
874 reply.writeNoException();
875 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
876 return true;
877 }
878
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800879 case START_SERVICE_TRANSACTION: {
880 data.enforceInterface(IActivityManager.descriptor);
881 IBinder b = data.readStrongBinder();
882 IApplicationThread app = ApplicationThreadNative.asInterface(b);
883 Intent service = Intent.CREATOR.createFromParcel(data);
884 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700885 int userId = data.readInt();
886 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800887 reply.writeNoException();
888 ComponentName.writeToParcel(cn, reply);
889 return true;
890 }
891
892 case STOP_SERVICE_TRANSACTION: {
893 data.enforceInterface(IActivityManager.descriptor);
894 IBinder b = data.readStrongBinder();
895 IApplicationThread app = ApplicationThreadNative.asInterface(b);
896 Intent service = Intent.CREATOR.createFromParcel(data);
897 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700898 int userId = data.readInt();
899 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800900 reply.writeNoException();
901 reply.writeInt(res);
902 return true;
903 }
904
905 case STOP_SERVICE_TOKEN_TRANSACTION: {
906 data.enforceInterface(IActivityManager.descriptor);
907 ComponentName className = ComponentName.readFromParcel(data);
908 IBinder token = data.readStrongBinder();
909 int startId = data.readInt();
910 boolean res = stopServiceToken(className, token, startId);
911 reply.writeNoException();
912 reply.writeInt(res ? 1 : 0);
913 return true;
914 }
915
916 case SET_SERVICE_FOREGROUND_TRANSACTION: {
917 data.enforceInterface(IActivityManager.descriptor);
918 ComponentName className = ComponentName.readFromParcel(data);
919 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700920 int id = data.readInt();
921 Notification notification = null;
922 if (data.readInt() != 0) {
923 notification = Notification.CREATOR.createFromParcel(data);
924 }
925 boolean removeNotification = data.readInt() != 0;
926 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800927 reply.writeNoException();
928 return true;
929 }
930
931 case BIND_SERVICE_TRANSACTION: {
932 data.enforceInterface(IActivityManager.descriptor);
933 IBinder b = data.readStrongBinder();
934 IApplicationThread app = ApplicationThreadNative.asInterface(b);
935 IBinder token = data.readStrongBinder();
936 Intent service = Intent.CREATOR.createFromParcel(data);
937 String resolvedType = data.readString();
938 b = data.readStrongBinder();
939 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800940 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800941 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800942 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800943 reply.writeNoException();
944 reply.writeInt(res);
945 return true;
946 }
947
948 case UNBIND_SERVICE_TRANSACTION: {
949 data.enforceInterface(IActivityManager.descriptor);
950 IBinder b = data.readStrongBinder();
951 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
952 boolean res = unbindService(conn);
953 reply.writeNoException();
954 reply.writeInt(res ? 1 : 0);
955 return true;
956 }
957
958 case PUBLISH_SERVICE_TRANSACTION: {
959 data.enforceInterface(IActivityManager.descriptor);
960 IBinder token = data.readStrongBinder();
961 Intent intent = Intent.CREATOR.createFromParcel(data);
962 IBinder service = data.readStrongBinder();
963 publishService(token, intent, service);
964 reply.writeNoException();
965 return true;
966 }
967
968 case UNBIND_FINISHED_TRANSACTION: {
969 data.enforceInterface(IActivityManager.descriptor);
970 IBinder token = data.readStrongBinder();
971 Intent intent = Intent.CREATOR.createFromParcel(data);
972 boolean doRebind = data.readInt() != 0;
973 unbindFinished(token, intent, doRebind);
974 reply.writeNoException();
975 return true;
976 }
977
978 case SERVICE_DONE_EXECUTING_TRANSACTION: {
979 data.enforceInterface(IActivityManager.descriptor);
980 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700981 int type = data.readInt();
982 int startId = data.readInt();
983 int res = data.readInt();
984 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800985 reply.writeNoException();
986 return true;
987 }
988
989 case START_INSTRUMENTATION_TRANSACTION: {
990 data.enforceInterface(IActivityManager.descriptor);
991 ComponentName className = ComponentName.readFromParcel(data);
992 String profileFile = data.readString();
993 int fl = data.readInt();
994 Bundle arguments = data.readBundle();
995 IBinder b = data.readStrongBinder();
996 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800997 b = data.readStrongBinder();
998 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700999 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001000 String abiOverride = data.readString();
1001 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1002 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001003 reply.writeNoException();
1004 reply.writeInt(res ? 1 : 0);
1005 return true;
1006 }
1007
1008
1009 case FINISH_INSTRUMENTATION_TRANSACTION: {
1010 data.enforceInterface(IActivityManager.descriptor);
1011 IBinder b = data.readStrongBinder();
1012 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1013 int resultCode = data.readInt();
1014 Bundle results = data.readBundle();
1015 finishInstrumentation(app, resultCode, results);
1016 reply.writeNoException();
1017 return true;
1018 }
1019
1020 case GET_CONFIGURATION_TRANSACTION: {
1021 data.enforceInterface(IActivityManager.descriptor);
1022 Configuration config = getConfiguration();
1023 reply.writeNoException();
1024 config.writeToParcel(reply, 0);
1025 return true;
1026 }
1027
1028 case UPDATE_CONFIGURATION_TRANSACTION: {
1029 data.enforceInterface(IActivityManager.descriptor);
1030 Configuration config = Configuration.CREATOR.createFromParcel(data);
1031 updateConfiguration(config);
1032 reply.writeNoException();
1033 return true;
1034 }
1035
1036 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1037 data.enforceInterface(IActivityManager.descriptor);
1038 IBinder token = data.readStrongBinder();
1039 int requestedOrientation = data.readInt();
1040 setRequestedOrientation(token, requestedOrientation);
1041 reply.writeNoException();
1042 return true;
1043 }
1044
1045 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1046 data.enforceInterface(IActivityManager.descriptor);
1047 IBinder token = data.readStrongBinder();
1048 int req = getRequestedOrientation(token);
1049 reply.writeNoException();
1050 reply.writeInt(req);
1051 return true;
1052 }
1053
1054 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1055 data.enforceInterface(IActivityManager.descriptor);
1056 IBinder token = data.readStrongBinder();
1057 ComponentName cn = getActivityClassForToken(token);
1058 reply.writeNoException();
1059 ComponentName.writeToParcel(cn, reply);
1060 return true;
1061 }
1062
1063 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1064 data.enforceInterface(IActivityManager.descriptor);
1065 IBinder token = data.readStrongBinder();
1066 reply.writeNoException();
1067 reply.writeString(getPackageForToken(token));
1068 return true;
1069 }
1070
1071 case GET_INTENT_SENDER_TRANSACTION: {
1072 data.enforceInterface(IActivityManager.descriptor);
1073 int type = data.readInt();
1074 String packageName = data.readString();
1075 IBinder token = data.readStrongBinder();
1076 String resultWho = data.readString();
1077 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001078 Intent[] requestIntents;
1079 String[] requestResolvedTypes;
1080 if (data.readInt() != 0) {
1081 requestIntents = data.createTypedArray(Intent.CREATOR);
1082 requestResolvedTypes = data.createStringArray();
1083 } else {
1084 requestIntents = null;
1085 requestResolvedTypes = null;
1086 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001087 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001088 Bundle options = data.readInt() != 0
1089 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001090 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001091 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001092 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001093 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001094 reply.writeNoException();
1095 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1096 return true;
1097 }
1098
1099 case CANCEL_INTENT_SENDER_TRANSACTION: {
1100 data.enforceInterface(IActivityManager.descriptor);
1101 IIntentSender r = IIntentSender.Stub.asInterface(
1102 data.readStrongBinder());
1103 cancelIntentSender(r);
1104 reply.writeNoException();
1105 return true;
1106 }
1107
1108 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1109 data.enforceInterface(IActivityManager.descriptor);
1110 IIntentSender r = IIntentSender.Stub.asInterface(
1111 data.readStrongBinder());
1112 String res = getPackageForIntentSender(r);
1113 reply.writeNoException();
1114 reply.writeString(res);
1115 return true;
1116 }
1117
Christopher Tatec4a07d12012-04-06 14:19:13 -07001118 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1119 data.enforceInterface(IActivityManager.descriptor);
1120 IIntentSender r = IIntentSender.Stub.asInterface(
1121 data.readStrongBinder());
1122 int res = getUidForIntentSender(r);
1123 reply.writeNoException();
1124 reply.writeInt(res);
1125 return true;
1126 }
1127
Dianne Hackborn41203752012-08-31 14:05:51 -07001128 case HANDLE_INCOMING_USER_TRANSACTION: {
1129 data.enforceInterface(IActivityManager.descriptor);
1130 int callingPid = data.readInt();
1131 int callingUid = data.readInt();
1132 int userId = data.readInt();
1133 boolean allowAll = data.readInt() != 0 ;
1134 boolean requireFull = data.readInt() != 0;
1135 String name = data.readString();
1136 String callerPackage = data.readString();
1137 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1138 requireFull, name, callerPackage);
1139 reply.writeNoException();
1140 reply.writeInt(res);
1141 return true;
1142 }
1143
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001144 case SET_PROCESS_LIMIT_TRANSACTION: {
1145 data.enforceInterface(IActivityManager.descriptor);
1146 int max = data.readInt();
1147 setProcessLimit(max);
1148 reply.writeNoException();
1149 return true;
1150 }
1151
1152 case GET_PROCESS_LIMIT_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 int limit = getProcessLimit();
1155 reply.writeNoException();
1156 reply.writeInt(limit);
1157 return true;
1158 }
1159
1160 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 IBinder token = data.readStrongBinder();
1163 int pid = data.readInt();
1164 boolean isForeground = data.readInt() != 0;
1165 setProcessForeground(token, pid, isForeground);
1166 reply.writeNoException();
1167 return true;
1168 }
1169
1170 case CHECK_PERMISSION_TRANSACTION: {
1171 data.enforceInterface(IActivityManager.descriptor);
1172 String perm = data.readString();
1173 int pid = data.readInt();
1174 int uid = data.readInt();
1175 int res = checkPermission(perm, pid, uid);
1176 reply.writeNoException();
1177 reply.writeInt(res);
1178 return true;
1179 }
1180
1181 case CHECK_URI_PERMISSION_TRANSACTION: {
1182 data.enforceInterface(IActivityManager.descriptor);
1183 Uri uri = Uri.CREATOR.createFromParcel(data);
1184 int pid = data.readInt();
1185 int uid = data.readInt();
1186 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001187 int userId = data.readInt();
1188 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001189 reply.writeNoException();
1190 reply.writeInt(res);
1191 return true;
1192 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001193
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001194 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001195 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001196 String packageName = data.readString();
1197 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1198 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001199 int userId = data.readInt();
1200 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001201 reply.writeNoException();
1202 reply.writeInt(res ? 1 : 0);
1203 return true;
1204 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001205
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001206 case GRANT_URI_PERMISSION_TRANSACTION: {
1207 data.enforceInterface(IActivityManager.descriptor);
1208 IBinder b = data.readStrongBinder();
1209 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1210 String targetPkg = data.readString();
1211 Uri uri = Uri.CREATOR.createFromParcel(data);
1212 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001213 int userId = data.readInt();
1214 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001215 reply.writeNoException();
1216 return true;
1217 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001218
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001219 case REVOKE_URI_PERMISSION_TRANSACTION: {
1220 data.enforceInterface(IActivityManager.descriptor);
1221 IBinder b = data.readStrongBinder();
1222 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1223 Uri uri = Uri.CREATOR.createFromParcel(data);
1224 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001225 int userId = data.readInt();
1226 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001227 reply.writeNoException();
1228 return true;
1229 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001230
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001231 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1232 data.enforceInterface(IActivityManager.descriptor);
1233 Uri uri = Uri.CREATOR.createFromParcel(data);
1234 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001235 int userId = data.readInt();
1236 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001237 reply.writeNoException();
1238 return true;
1239 }
1240
1241 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1242 data.enforceInterface(IActivityManager.descriptor);
1243 Uri uri = Uri.CREATOR.createFromParcel(data);
1244 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001245 int userId = data.readInt();
1246 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001247 reply.writeNoException();
1248 return true;
1249 }
1250
1251 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1252 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001253 final String packageName = data.readString();
1254 final boolean incoming = data.readInt() != 0;
1255 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1256 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001257 reply.writeNoException();
1258 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1259 return true;
1260 }
1261
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001262 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1263 data.enforceInterface(IActivityManager.descriptor);
1264 IBinder b = data.readStrongBinder();
1265 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1266 boolean waiting = data.readInt() != 0;
1267 showWaitingForDebugger(app, waiting);
1268 reply.writeNoException();
1269 return true;
1270 }
1271
1272 case GET_MEMORY_INFO_TRANSACTION: {
1273 data.enforceInterface(IActivityManager.descriptor);
1274 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1275 getMemoryInfo(mi);
1276 reply.writeNoException();
1277 mi.writeToParcel(reply, 0);
1278 return true;
1279 }
1280
1281 case UNHANDLED_BACK_TRANSACTION: {
1282 data.enforceInterface(IActivityManager.descriptor);
1283 unhandledBack();
1284 reply.writeNoException();
1285 return true;
1286 }
1287
1288 case OPEN_CONTENT_URI_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 Uri uri = Uri.parse(data.readString());
1291 ParcelFileDescriptor pfd = openContentUri(uri);
1292 reply.writeNoException();
1293 if (pfd != null) {
1294 reply.writeInt(1);
1295 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1296 } else {
1297 reply.writeInt(0);
1298 }
1299 return true;
1300 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001301
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001302 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1303 data.enforceInterface(IActivityManager.descriptor);
1304 setLockScreenShown(data.readInt() != 0);
1305 reply.writeNoException();
1306 return true;
1307 }
1308
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001309 case SET_DEBUG_APP_TRANSACTION: {
1310 data.enforceInterface(IActivityManager.descriptor);
1311 String pn = data.readString();
1312 boolean wfd = data.readInt() != 0;
1313 boolean per = data.readInt() != 0;
1314 setDebugApp(pn, wfd, per);
1315 reply.writeNoException();
1316 return true;
1317 }
1318
1319 case SET_ALWAYS_FINISH_TRANSACTION: {
1320 data.enforceInterface(IActivityManager.descriptor);
1321 boolean enabled = data.readInt() != 0;
1322 setAlwaysFinish(enabled);
1323 reply.writeNoException();
1324 return true;
1325 }
1326
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001327 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001328 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001329 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001330 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001331 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001332 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001333 return true;
1334 }
1335
1336 case ENTER_SAFE_MODE_TRANSACTION: {
1337 data.enforceInterface(IActivityManager.descriptor);
1338 enterSafeMode();
1339 reply.writeNoException();
1340 return true;
1341 }
1342
1343 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1344 data.enforceInterface(IActivityManager.descriptor);
1345 IIntentSender is = IIntentSender.Stub.asInterface(
1346 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001347 int sourceUid = data.readInt();
1348 String sourcePkg = data.readString();
1349 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001350 reply.writeNoException();
1351 return true;
1352 }
1353
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001354 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001355 data.enforceInterface(IActivityManager.descriptor);
1356 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001357 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001358 boolean secure = data.readInt() != 0;
1359 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001360 reply.writeNoException();
1361 reply.writeInt(res ? 1 : 0);
1362 return true;
1363 }
1364
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001365 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1366 data.enforceInterface(IActivityManager.descriptor);
1367 String reason = data.readString();
1368 boolean res = killProcessesBelowForeground(reason);
1369 reply.writeNoException();
1370 reply.writeInt(res ? 1 : 0);
1371 return true;
1372 }
1373
Dan Egnor60d87622009-12-16 16:32:58 -08001374 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1375 data.enforceInterface(IActivityManager.descriptor);
1376 IBinder app = data.readStrongBinder();
1377 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1378 handleApplicationCrash(app, ci);
1379 reply.writeNoException();
1380 return true;
1381 }
1382
1383 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001384 data.enforceInterface(IActivityManager.descriptor);
1385 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001386 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001387 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001388 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001389 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001390 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001391 return true;
1392 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001393
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001394 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1395 data.enforceInterface(IActivityManager.descriptor);
1396 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001397 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001398 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1399 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001400 reply.writeNoException();
1401 return true;
1402 }
1403
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001404 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1405 data.enforceInterface(IActivityManager.descriptor);
1406 int sig = data.readInt();
1407 signalPersistentProcesses(sig);
1408 reply.writeNoException();
1409 return true;
1410 }
1411
Dianne Hackborn03abb812010-01-04 18:43:19 -08001412 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1413 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001414 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001415 int userId = data.readInt();
1416 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001417 reply.writeNoException();
1418 return true;
1419 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001420
1421 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1422 data.enforceInterface(IActivityManager.descriptor);
1423 killAllBackgroundProcesses();
1424 reply.writeNoException();
1425 return true;
1426 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001427
Dianne Hackborn03abb812010-01-04 18:43:19 -08001428 case FORCE_STOP_PACKAGE_TRANSACTION: {
1429 data.enforceInterface(IActivityManager.descriptor);
1430 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001431 int userId = data.readInt();
1432 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001433 reply.writeNoException();
1434 return true;
1435 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001436
1437 case GET_MY_MEMORY_STATE_TRANSACTION: {
1438 data.enforceInterface(IActivityManager.descriptor);
1439 ActivityManager.RunningAppProcessInfo info =
1440 new ActivityManager.RunningAppProcessInfo();
1441 getMyMemoryState(info);
1442 reply.writeNoException();
1443 info.writeToParcel(reply, 0);
1444 return true;
1445 }
1446
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001447 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1448 data.enforceInterface(IActivityManager.descriptor);
1449 ConfigurationInfo config = getDeviceConfigurationInfo();
1450 reply.writeNoException();
1451 config.writeToParcel(reply, 0);
1452 return true;
1453 }
1454
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001455 case PROFILE_CONTROL_TRANSACTION: {
1456 data.enforceInterface(IActivityManager.descriptor);
1457 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001458 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001459 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001460 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001461 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001462 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001463 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001464 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001465 reply.writeNoException();
1466 reply.writeInt(res ? 1 : 0);
1467 return true;
1468 }
1469
Dianne Hackborn55280a92009-05-07 15:53:46 -07001470 case SHUTDOWN_TRANSACTION: {
1471 data.enforceInterface(IActivityManager.descriptor);
1472 boolean res = shutdown(data.readInt());
1473 reply.writeNoException();
1474 reply.writeInt(res ? 1 : 0);
1475 return true;
1476 }
1477
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001478 case STOP_APP_SWITCHES_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 stopAppSwitches();
1481 reply.writeNoException();
1482 return true;
1483 }
1484
1485 case RESUME_APP_SWITCHES_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 resumeAppSwitches();
1488 reply.writeNoException();
1489 return true;
1490 }
1491
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001492 case PEEK_SERVICE_TRANSACTION: {
1493 data.enforceInterface(IActivityManager.descriptor);
1494 Intent service = Intent.CREATOR.createFromParcel(data);
1495 String resolvedType = data.readString();
1496 IBinder binder = peekService(service, resolvedType);
1497 reply.writeNoException();
1498 reply.writeStrongBinder(binder);
1499 return true;
1500 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001501
1502 case START_BACKUP_AGENT_TRANSACTION: {
1503 data.enforceInterface(IActivityManager.descriptor);
1504 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1505 int backupRestoreMode = data.readInt();
1506 boolean success = bindBackupAgent(info, backupRestoreMode);
1507 reply.writeNoException();
1508 reply.writeInt(success ? 1 : 0);
1509 return true;
1510 }
1511
1512 case BACKUP_AGENT_CREATED_TRANSACTION: {
1513 data.enforceInterface(IActivityManager.descriptor);
1514 String packageName = data.readString();
1515 IBinder agent = data.readStrongBinder();
1516 backupAgentCreated(packageName, agent);
1517 reply.writeNoException();
1518 return true;
1519 }
1520
1521 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1522 data.enforceInterface(IActivityManager.descriptor);
1523 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1524 unbindBackupAgent(info);
1525 reply.writeNoException();
1526 return true;
1527 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001528
1529 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1530 data.enforceInterface(IActivityManager.descriptor);
1531 String packageName = data.readString();
1532 addPackageDependency(packageName);
1533 reply.writeNoException();
1534 return true;
1535 }
1536
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001537 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001538 data.enforceInterface(IActivityManager.descriptor);
1539 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001540 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001541 String reason = data.readString();
1542 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001543 reply.writeNoException();
1544 return true;
1545 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001546
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001547 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1548 data.enforceInterface(IActivityManager.descriptor);
1549 String reason = data.readString();
1550 closeSystemDialogs(reason);
1551 reply.writeNoException();
1552 return true;
1553 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001554
1555 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1556 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001557 int[] pids = data.createIntArray();
1558 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001559 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001560 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001561 return true;
1562 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001563
1564 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1565 data.enforceInterface(IActivityManager.descriptor);
1566 String processName = data.readString();
1567 int uid = data.readInt();
1568 killApplicationProcess(processName, uid);
1569 reply.writeNoException();
1570 return true;
1571 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001572
1573 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1574 data.enforceInterface(IActivityManager.descriptor);
1575 IBinder token = data.readStrongBinder();
1576 String packageName = data.readString();
1577 int enterAnim = data.readInt();
1578 int exitAnim = data.readInt();
1579 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001580 reply.writeNoException();
1581 return true;
1582 }
1583
1584 case IS_USER_A_MONKEY_TRANSACTION: {
1585 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001586 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001587 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001588 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001589 return true;
1590 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001591
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001592 case SET_USER_IS_MONKEY_TRANSACTION: {
1593 data.enforceInterface(IActivityManager.descriptor);
1594 final boolean monkey = (data.readInt() == 1);
1595 setUserIsMonkey(monkey);
1596 reply.writeNoException();
1597 return true;
1598 }
1599
Dianne Hackborn860755f2010-06-03 18:47:52 -07001600 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1601 data.enforceInterface(IActivityManager.descriptor);
1602 finishHeavyWeightApp();
1603 reply.writeNoException();
1604 return true;
1605 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001606
1607 case IS_IMMERSIVE_TRANSACTION: {
1608 data.enforceInterface(IActivityManager.descriptor);
1609 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001610 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001611 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001612 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001613 return true;
1614 }
1615
Craig Mautnerd61dc202014-07-07 11:09:11 -07001616 case IS_TOP_OF_TASK_TRANSACTION: {
1617 data.enforceInterface(IActivityManager.descriptor);
1618 IBinder token = data.readStrongBinder();
1619 final boolean isTopOfTask = isTopOfTask(token);
1620 reply.writeNoException();
1621 reply.writeInt(isTopOfTask ? 1 : 0);
1622 return true;
1623 }
1624
Craig Mautner5eda9b32013-07-02 11:58:16 -07001625 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001626 data.enforceInterface(IActivityManager.descriptor);
1627 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001628 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001629 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001630 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001631 return true;
1632 }
1633
1634 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1635 data.enforceInterface(IActivityManager.descriptor);
1636 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001637 final Bundle bundle;
1638 if (data.readInt() == 0) {
1639 bundle = null;
1640 } else {
1641 bundle = data.readBundle();
1642 }
1643 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1644 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001645 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001646 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001647 return true;
1648 }
1649
Craig Mautner233ceee2014-05-09 17:05:11 -07001650 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1651 data.enforceInterface(IActivityManager.descriptor);
1652 IBinder token = data.readStrongBinder();
1653 final ActivityOptions options = getActivityOptions(token);
1654 reply.writeNoException();
1655 reply.writeBundle(options == null ? null : options.toBundle());
1656 return true;
1657 }
1658
Daniel Sandler69a48172010-06-23 16:29:36 -04001659 case SET_IMMERSIVE_TRANSACTION: {
1660 data.enforceInterface(IActivityManager.descriptor);
1661 IBinder token = data.readStrongBinder();
1662 boolean imm = data.readInt() == 1;
1663 setImmersive(token, imm);
1664 reply.writeNoException();
1665 return true;
1666 }
1667
1668 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1669 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001670 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001671 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001672 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001673 return true;
1674 }
1675
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001676 case CRASH_APPLICATION_TRANSACTION: {
1677 data.enforceInterface(IActivityManager.descriptor);
1678 int uid = data.readInt();
1679 int initialPid = data.readInt();
1680 String packageName = data.readString();
1681 String message = data.readString();
1682 crashApplication(uid, initialPid, packageName, message);
1683 reply.writeNoException();
1684 return true;
1685 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001686
1687 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1688 data.enforceInterface(IActivityManager.descriptor);
1689 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001690 int userId = data.readInt();
1691 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001692 reply.writeNoException();
1693 reply.writeString(type);
1694 return true;
1695 }
1696
Dianne Hackborn7e269642010-08-25 19:50:20 -07001697 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1698 data.enforceInterface(IActivityManager.descriptor);
1699 String name = data.readString();
1700 IBinder perm = newUriPermissionOwner(name);
1701 reply.writeNoException();
1702 reply.writeStrongBinder(perm);
1703 return true;
1704 }
1705
1706 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1707 data.enforceInterface(IActivityManager.descriptor);
1708 IBinder owner = data.readStrongBinder();
1709 int fromUid = data.readInt();
1710 String targetPkg = data.readString();
1711 Uri uri = Uri.CREATOR.createFromParcel(data);
1712 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001713 int sourceUserId = data.readInt();
1714 int targetUserId = data.readInt();
1715 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1716 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001717 reply.writeNoException();
1718 return true;
1719 }
1720
1721 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1722 data.enforceInterface(IActivityManager.descriptor);
1723 IBinder owner = data.readStrongBinder();
1724 Uri uri = null;
1725 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001726 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001727 }
1728 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001729 int userId = data.readInt();
1730 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001731 reply.writeNoException();
1732 return true;
1733 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001734
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001735 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1736 data.enforceInterface(IActivityManager.descriptor);
1737 int callingUid = data.readInt();
1738 String targetPkg = data.readString();
1739 Uri uri = Uri.CREATOR.createFromParcel(data);
1740 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001741 int userId = data.readInt();
1742 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001743 reply.writeNoException();
1744 reply.writeInt(res);
1745 return true;
1746 }
1747
Andy McFadden824c5102010-07-09 16:26:57 -07001748 case DUMP_HEAP_TRANSACTION: {
1749 data.enforceInterface(IActivityManager.descriptor);
1750 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001751 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001752 boolean managed = data.readInt() != 0;
1753 String path = data.readString();
1754 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001755 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001756 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001757 reply.writeNoException();
1758 reply.writeInt(res ? 1 : 0);
1759 return true;
1760 }
1761
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001762 case START_ACTIVITIES_TRANSACTION:
1763 {
1764 data.enforceInterface(IActivityManager.descriptor);
1765 IBinder b = data.readStrongBinder();
1766 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001767 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001768 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1769 String[] resolvedTypes = data.createStringArray();
1770 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001771 Bundle options = data.readInt() != 0
1772 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001773 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001774 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001775 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001776 reply.writeNoException();
1777 reply.writeInt(result);
1778 return true;
1779 }
1780
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001781 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1782 {
1783 data.enforceInterface(IActivityManager.descriptor);
1784 int mode = getFrontActivityScreenCompatMode();
1785 reply.writeNoException();
1786 reply.writeInt(mode);
1787 return true;
1788 }
1789
1790 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1791 {
1792 data.enforceInterface(IActivityManager.descriptor);
1793 int mode = data.readInt();
1794 setFrontActivityScreenCompatMode(mode);
1795 reply.writeNoException();
1796 reply.writeInt(mode);
1797 return true;
1798 }
1799
1800 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1801 {
1802 data.enforceInterface(IActivityManager.descriptor);
1803 String pkg = data.readString();
1804 int mode = getPackageScreenCompatMode(pkg);
1805 reply.writeNoException();
1806 reply.writeInt(mode);
1807 return true;
1808 }
1809
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001810 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1811 {
1812 data.enforceInterface(IActivityManager.descriptor);
1813 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001814 int mode = data.readInt();
1815 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001816 reply.writeNoException();
1817 return true;
1818 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001819
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001820 case SWITCH_USER_TRANSACTION: {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 int userid = data.readInt();
1823 boolean result = switchUser(userid);
1824 reply.writeNoException();
1825 reply.writeInt(result ? 1 : 0);
1826 return true;
1827 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001828
Kenny Guy08488bf2014-02-21 17:40:37 +00001829 case START_USER_IN_BACKGROUND_TRANSACTION: {
1830 data.enforceInterface(IActivityManager.descriptor);
1831 int userid = data.readInt();
1832 boolean result = startUserInBackground(userid);
1833 reply.writeNoException();
1834 reply.writeInt(result ? 1 : 0);
1835 return true;
1836 }
1837
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001838 case STOP_USER_TRANSACTION: {
1839 data.enforceInterface(IActivityManager.descriptor);
1840 int userid = data.readInt();
1841 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1842 data.readStrongBinder());
1843 int result = stopUser(userid, callback);
1844 reply.writeNoException();
1845 reply.writeInt(result);
1846 return true;
1847 }
1848
Amith Yamasani52f1d752012-03-28 18:19:29 -07001849 case GET_CURRENT_USER_TRANSACTION: {
1850 data.enforceInterface(IActivityManager.descriptor);
1851 UserInfo userInfo = getCurrentUser();
1852 reply.writeNoException();
1853 userInfo.writeToParcel(reply, 0);
1854 return true;
1855 }
1856
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001857 case IS_USER_RUNNING_TRANSACTION: {
1858 data.enforceInterface(IActivityManager.descriptor);
1859 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001860 boolean orStopping = data.readInt() != 0;
1861 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001862 reply.writeNoException();
1863 reply.writeInt(result ? 1 : 0);
1864 return true;
1865 }
1866
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001867 case GET_RUNNING_USER_IDS_TRANSACTION: {
1868 data.enforceInterface(IActivityManager.descriptor);
1869 int[] result = getRunningUserIds();
1870 reply.writeNoException();
1871 reply.writeIntArray(result);
1872 return true;
1873 }
1874
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001875 case REMOVE_TASK_TRANSACTION:
1876 {
1877 data.enforceInterface(IActivityManager.descriptor);
1878 int taskId = data.readInt();
1879 int fl = data.readInt();
1880 boolean result = removeTask(taskId, fl);
1881 reply.writeNoException();
1882 reply.writeInt(result ? 1 : 0);
1883 return true;
1884 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001885
Jeff Sharkeya4620792011-05-20 15:29:23 -07001886 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1887 data.enforceInterface(IActivityManager.descriptor);
1888 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1889 data.readStrongBinder());
1890 registerProcessObserver(observer);
1891 return true;
1892 }
1893
1894 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1895 data.enforceInterface(IActivityManager.descriptor);
1896 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1897 data.readStrongBinder());
1898 unregisterProcessObserver(observer);
1899 return true;
1900 }
1901
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001902 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1903 {
1904 data.enforceInterface(IActivityManager.descriptor);
1905 String pkg = data.readString();
1906 boolean ask = getPackageAskScreenCompat(pkg);
1907 reply.writeNoException();
1908 reply.writeInt(ask ? 1 : 0);
1909 return true;
1910 }
1911
1912 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1913 {
1914 data.enforceInterface(IActivityManager.descriptor);
1915 String pkg = data.readString();
1916 boolean ask = data.readInt() != 0;
1917 setPackageAskScreenCompat(pkg, ask);
1918 reply.writeNoException();
1919 return true;
1920 }
1921
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001922 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1923 data.enforceInterface(IActivityManager.descriptor);
1924 IIntentSender r = IIntentSender.Stub.asInterface(
1925 data.readStrongBinder());
1926 boolean res = isIntentSenderTargetedToPackage(r);
1927 reply.writeNoException();
1928 reply.writeInt(res ? 1 : 0);
1929 return true;
1930 }
1931
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001932 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1933 data.enforceInterface(IActivityManager.descriptor);
1934 IIntentSender r = IIntentSender.Stub.asInterface(
1935 data.readStrongBinder());
1936 boolean res = isIntentSenderAnActivity(r);
1937 reply.writeNoException();
1938 reply.writeInt(res ? 1 : 0);
1939 return true;
1940 }
1941
Dianne Hackborn81038902012-11-26 17:04:09 -08001942 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1943 data.enforceInterface(IActivityManager.descriptor);
1944 IIntentSender r = IIntentSender.Stub.asInterface(
1945 data.readStrongBinder());
1946 Intent intent = getIntentForIntentSender(r);
1947 reply.writeNoException();
1948 if (intent != null) {
1949 reply.writeInt(1);
1950 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1951 } else {
1952 reply.writeInt(0);
1953 }
1954 return true;
1955 }
1956
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001957 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1958 data.enforceInterface(IActivityManager.descriptor);
1959 IIntentSender r = IIntentSender.Stub.asInterface(
1960 data.readStrongBinder());
1961 String prefix = data.readString();
1962 String tag = getTagForIntentSender(r, prefix);
1963 reply.writeNoException();
1964 reply.writeString(tag);
1965 return true;
1966 }
1967
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001968 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1969 data.enforceInterface(IActivityManager.descriptor);
1970 Configuration config = Configuration.CREATOR.createFromParcel(data);
1971 updatePersistentConfiguration(config);
1972 reply.writeNoException();
1973 return true;
1974 }
1975
Dianne Hackbornb437e092011-08-05 17:50:29 -07001976 case GET_PROCESS_PSS_TRANSACTION: {
1977 data.enforceInterface(IActivityManager.descriptor);
1978 int[] pids = data.createIntArray();
1979 long[] pss = getProcessPss(pids);
1980 reply.writeNoException();
1981 reply.writeLongArray(pss);
1982 return true;
1983 }
1984
Dianne Hackborn661cd522011-08-22 00:26:20 -07001985 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1986 data.enforceInterface(IActivityManager.descriptor);
1987 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1988 boolean always = data.readInt() != 0;
1989 showBootMessage(msg, always);
1990 reply.writeNoException();
1991 return true;
1992 }
1993
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02001994 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001995 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02001996 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001997 reply.writeNoException();
1998 return true;
1999 }
2000
Adam Powelldd8fab22012-03-22 17:47:27 -07002001 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
2002 data.enforceInterface(IActivityManager.descriptor);
2003 IBinder token = data.readStrongBinder();
2004 String destAffinity = data.readString();
2005 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
2006 reply.writeNoException();
2007 reply.writeInt(res ? 1 : 0);
2008 return true;
2009 }
2010
2011 case NAVIGATE_UP_TO_TRANSACTION: {
2012 data.enforceInterface(IActivityManager.descriptor);
2013 IBinder token = data.readStrongBinder();
2014 Intent target = Intent.CREATOR.createFromParcel(data);
2015 int resultCode = data.readInt();
2016 Intent resultData = null;
2017 if (data.readInt() != 0) {
2018 resultData = Intent.CREATOR.createFromParcel(data);
2019 }
2020 boolean res = navigateUpTo(token, target, resultCode, resultData);
2021 reply.writeNoException();
2022 reply.writeInt(res ? 1 : 0);
2023 return true;
2024 }
2025
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002026 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2027 data.enforceInterface(IActivityManager.descriptor);
2028 IBinder token = data.readStrongBinder();
2029 int res = getLaunchedFromUid(token);
2030 reply.writeNoException();
2031 reply.writeInt(res);
2032 return true;
2033 }
2034
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002035 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2036 data.enforceInterface(IActivityManager.descriptor);
2037 IBinder token = data.readStrongBinder();
2038 String res = getLaunchedFromPackage(token);
2039 reply.writeNoException();
2040 reply.writeString(res);
2041 return true;
2042 }
2043
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002044 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2045 data.enforceInterface(IActivityManager.descriptor);
2046 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2047 data.readStrongBinder());
2048 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002049 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002050 return true;
2051 }
2052
2053 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2054 data.enforceInterface(IActivityManager.descriptor);
2055 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2056 data.readStrongBinder());
2057 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002058 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002059 return true;
2060 }
2061
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002062 case REQUEST_BUG_REPORT_TRANSACTION: {
2063 data.enforceInterface(IActivityManager.descriptor);
2064 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002065 reply.writeNoException();
2066 return true;
2067 }
2068
2069 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2070 data.enforceInterface(IActivityManager.descriptor);
2071 int pid = data.readInt();
2072 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002073 String reason = data.readString();
2074 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002075 reply.writeNoException();
2076 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002077 return true;
2078 }
2079
Adam Skorydfc7fd72013-08-05 19:23:41 -07002080 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002081 data.enforceInterface(IActivityManager.descriptor);
2082 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002083 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002084 reply.writeNoException();
2085 reply.writeBundle(res);
2086 return true;
2087 }
2088
Adam Skorydfc7fd72013-08-05 19:23:41 -07002089 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002090 data.enforceInterface(IActivityManager.descriptor);
2091 IBinder token = data.readStrongBinder();
2092 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002093 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002094 reply.writeNoException();
2095 return true;
2096 }
2097
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002098 case KILL_UID_TRANSACTION: {
2099 data.enforceInterface(IActivityManager.descriptor);
2100 int uid = data.readInt();
2101 String reason = data.readString();
2102 killUid(uid, reason);
2103 reply.writeNoException();
2104 return true;
2105 }
2106
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002107 case HANG_TRANSACTION: {
2108 data.enforceInterface(IActivityManager.descriptor);
2109 IBinder who = data.readStrongBinder();
2110 boolean allowRestart = data.readInt() != 0;
2111 hang(who, allowRestart);
2112 reply.writeNoException();
2113 return true;
2114 }
2115
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002116 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2117 data.enforceInterface(IActivityManager.descriptor);
2118 IBinder token = data.readStrongBinder();
2119 reportActivityFullyDrawn(token);
2120 reply.writeNoException();
2121 return true;
2122 }
2123
Craig Mautner5eda9b32013-07-02 11:58:16 -07002124 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2125 data.enforceInterface(IActivityManager.descriptor);
2126 IBinder token = data.readStrongBinder();
2127 notifyActivityDrawn(token);
2128 reply.writeNoException();
2129 return true;
2130 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002131
2132 case RESTART_TRANSACTION: {
2133 data.enforceInterface(IActivityManager.descriptor);
2134 restart();
2135 reply.writeNoException();
2136 return true;
2137 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002138
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002139 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2140 data.enforceInterface(IActivityManager.descriptor);
2141 performIdleMaintenance();
2142 reply.writeNoException();
2143 return true;
2144 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002145
2146 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2147 data.enforceInterface(IActivityManager.descriptor);
2148 IBinder parentActivityToken = data.readStrongBinder();
2149 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002150 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002151 IActivityContainer activityContainer =
2152 createActivityContainer(parentActivityToken, callback);
2153 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002154 if (activityContainer != null) {
2155 reply.writeInt(1);
2156 reply.writeStrongBinder(activityContainer.asBinder());
2157 } else {
2158 reply.writeInt(0);
2159 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002160 return true;
2161 }
2162
Craig Mautner95da1082014-02-24 17:54:35 -08002163 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2164 data.enforceInterface(IActivityManager.descriptor);
2165 IActivityContainer activityContainer =
2166 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2167 deleteActivityContainer(activityContainer);
2168 reply.writeNoException();
2169 return true;
2170 }
2171
Craig Mautnere0a38842013-12-16 16:14:02 -08002172 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2173 data.enforceInterface(IActivityManager.descriptor);
2174 IBinder activityToken = data.readStrongBinder();
2175 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2176 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002177 if (activityContainer != null) {
2178 reply.writeInt(1);
2179 reply.writeStrongBinder(activityContainer.asBinder());
2180 } else {
2181 reply.writeInt(0);
2182 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002183 return true;
2184 }
2185
Craig Mautner4a1cb222013-12-04 16:14:06 -08002186 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2187 data.enforceInterface(IActivityManager.descriptor);
2188 IBinder homeActivityToken = getHomeActivityToken();
2189 reply.writeNoException();
2190 reply.writeStrongBinder(homeActivityToken);
2191 return true;
2192 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002193
2194 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2195 data.enforceInterface(IActivityManager.descriptor);
2196 final int taskId = data.readInt();
2197 startLockTaskMode(taskId);
2198 reply.writeNoException();
2199 return true;
2200 }
2201
2202 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2203 data.enforceInterface(IActivityManager.descriptor);
2204 IBinder token = data.readStrongBinder();
2205 startLockTaskMode(token);
2206 reply.writeNoException();
2207 return true;
2208 }
2209
Craig Mautnerd61dc202014-07-07 11:09:11 -07002210 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002211 data.enforceInterface(IActivityManager.descriptor);
2212 startLockTaskModeOnCurrent();
2213 reply.writeNoException();
2214 return true;
2215 }
2216
Craig Mautneraea74a52014-03-08 14:23:10 -08002217 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2218 data.enforceInterface(IActivityManager.descriptor);
2219 stopLockTaskMode();
2220 reply.writeNoException();
2221 return true;
2222 }
2223
Craig Mautnerd61dc202014-07-07 11:09:11 -07002224 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002225 data.enforceInterface(IActivityManager.descriptor);
2226 stopLockTaskModeOnCurrent();
2227 reply.writeNoException();
2228 return true;
2229 }
2230
Craig Mautneraea74a52014-03-08 14:23:10 -08002231 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2232 data.enforceInterface(IActivityManager.descriptor);
2233 final boolean isInLockTaskMode = isInLockTaskMode();
2234 reply.writeNoException();
2235 reply.writeInt(isInLockTaskMode ? 1 : 0);
2236 return true;
2237 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002238
Winson Chunga449dc02014-05-16 11:15:04 -07002239 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002240 data.enforceInterface(IActivityManager.descriptor);
2241 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002242 ActivityManager.TaskDescription values =
2243 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2244 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002245 reply.writeNoException();
2246 return true;
2247 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002248
Jose Lima4b6c6692014-08-12 17:41:12 -07002249 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002250 data.enforceInterface(IActivityManager.descriptor);
2251 IBinder token = data.readStrongBinder();
2252 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002253 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002254 reply.writeNoException();
2255 reply.writeInt(success ? 1 : 0);
2256 return true;
2257 }
2258
Jose Lima4b6c6692014-08-12 17:41:12 -07002259 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002260 data.enforceInterface(IActivityManager.descriptor);
2261 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002262 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002263 reply.writeNoException();
2264 reply.writeInt(enabled ? 1 : 0);
2265 return true;
2266 }
2267
Jose Lima4b6c6692014-08-12 17:41:12 -07002268 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002269 data.enforceInterface(IActivityManager.descriptor);
2270 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002271 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002272 reply.writeNoException();
2273 return true;
2274 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002275
2276 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2277 data.enforceInterface(IActivityManager.descriptor);
2278 IBinder token = data.readStrongBinder();
2279 notifyLaunchTaskBehindComplete(token);
2280 reply.writeNoException();
2281 return true;
2282 }
Craig Mautner8746a472014-07-24 15:12:54 -07002283
2284 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2285 data.enforceInterface(IActivityManager.descriptor);
2286 IBinder token = data.readStrongBinder();
2287 notifyEnterAnimationComplete(token);
2288 reply.writeNoException();
2289 return true;
2290 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002291 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002292
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002293 return super.onTransact(code, data, reply, flags);
2294 }
2295
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002296 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002297 return this;
2298 }
2299
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002300 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2301 protected IActivityManager create() {
2302 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002303 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002304 Log.v("ActivityManager", "default service binder = " + b);
2305 }
2306 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002307 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002308 Log.v("ActivityManager", "default service = " + am);
2309 }
2310 return am;
2311 }
2312 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002313}
2314
2315class ActivityManagerProxy implements IActivityManager
2316{
2317 public ActivityManagerProxy(IBinder remote)
2318 {
2319 mRemote = remote;
2320 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002321
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002322 public IBinder asBinder()
2323 {
2324 return mRemote;
2325 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002326
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002327 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002328 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2329 int startFlags, String profileFile,
2330 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002331 Parcel data = Parcel.obtain();
2332 Parcel reply = Parcel.obtain();
2333 data.writeInterfaceToken(IActivityManager.descriptor);
2334 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002335 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002336 intent.writeToParcel(data, 0);
2337 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002338 data.writeStrongBinder(resultTo);
2339 data.writeString(resultWho);
2340 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002341 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002342 data.writeString(profileFile);
2343 if (profileFd != null) {
2344 data.writeInt(1);
2345 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2346 } else {
2347 data.writeInt(0);
2348 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002349 if (options != null) {
2350 data.writeInt(1);
2351 options.writeToParcel(data, 0);
2352 } else {
2353 data.writeInt(0);
2354 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002355 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2356 reply.readException();
2357 int result = reply.readInt();
2358 reply.recycle();
2359 data.recycle();
2360 return result;
2361 }
Amith Yamasani82644082012-08-03 13:09:11 -07002362
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002363 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002364 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2365 int startFlags, String profileFile,
2366 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2367 Parcel data = Parcel.obtain();
2368 Parcel reply = Parcel.obtain();
2369 data.writeInterfaceToken(IActivityManager.descriptor);
2370 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002371 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002372 intent.writeToParcel(data, 0);
2373 data.writeString(resolvedType);
2374 data.writeStrongBinder(resultTo);
2375 data.writeString(resultWho);
2376 data.writeInt(requestCode);
2377 data.writeInt(startFlags);
2378 data.writeString(profileFile);
2379 if (profileFd != null) {
2380 data.writeInt(1);
2381 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2382 } else {
2383 data.writeInt(0);
2384 }
2385 if (options != null) {
2386 data.writeInt(1);
2387 options.writeToParcel(data, 0);
2388 } else {
2389 data.writeInt(0);
2390 }
2391 data.writeInt(userId);
2392 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2393 reply.readException();
2394 int result = reply.readInt();
2395 reply.recycle();
2396 data.recycle();
2397 return result;
2398 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002399 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2400 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2401 int startFlags, String profileFile,
2402 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
2403 Parcel data = Parcel.obtain();
2404 Parcel reply = Parcel.obtain();
2405 data.writeInterfaceToken(IActivityManager.descriptor);
2406 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2407 data.writeString(callingPackage);
2408 intent.writeToParcel(data, 0);
2409 data.writeString(resolvedType);
2410 data.writeStrongBinder(resultTo);
2411 data.writeString(resultWho);
2412 data.writeInt(requestCode);
2413 data.writeInt(startFlags);
2414 data.writeString(profileFile);
2415 if (profileFd != null) {
2416 data.writeInt(1);
2417 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2418 } else {
2419 data.writeInt(0);
2420 }
2421 if (options != null) {
2422 data.writeInt(1);
2423 options.writeToParcel(data, 0);
2424 } else {
2425 data.writeInt(0);
2426 }
2427 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2428 reply.readException();
2429 int result = reply.readInt();
2430 reply.recycle();
2431 data.recycle();
2432 return result;
2433 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002434 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2435 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002436 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002437 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002438 Parcel data = Parcel.obtain();
2439 Parcel reply = Parcel.obtain();
2440 data.writeInterfaceToken(IActivityManager.descriptor);
2441 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002442 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002443 intent.writeToParcel(data, 0);
2444 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002445 data.writeStrongBinder(resultTo);
2446 data.writeString(resultWho);
2447 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002448 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002449 data.writeString(profileFile);
2450 if (profileFd != null) {
2451 data.writeInt(1);
2452 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2453 } else {
2454 data.writeInt(0);
2455 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002456 if (options != null) {
2457 data.writeInt(1);
2458 options.writeToParcel(data, 0);
2459 } else {
2460 data.writeInt(0);
2461 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002462 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002463 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2464 reply.readException();
2465 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2466 reply.recycle();
2467 data.recycle();
2468 return result;
2469 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002470 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2471 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002472 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002473 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002474 Parcel data = Parcel.obtain();
2475 Parcel reply = Parcel.obtain();
2476 data.writeInterfaceToken(IActivityManager.descriptor);
2477 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002478 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002479 intent.writeToParcel(data, 0);
2480 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002481 data.writeStrongBinder(resultTo);
2482 data.writeString(resultWho);
2483 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002484 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002485 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002486 if (options != null) {
2487 data.writeInt(1);
2488 options.writeToParcel(data, 0);
2489 } else {
2490 data.writeInt(0);
2491 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002492 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002493 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2494 reply.readException();
2495 int result = reply.readInt();
2496 reply.recycle();
2497 data.recycle();
2498 return result;
2499 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002500 public int startActivityIntentSender(IApplicationThread caller,
2501 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002502 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002503 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002504 Parcel data = Parcel.obtain();
2505 Parcel reply = Parcel.obtain();
2506 data.writeInterfaceToken(IActivityManager.descriptor);
2507 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2508 intent.writeToParcel(data, 0);
2509 if (fillInIntent != null) {
2510 data.writeInt(1);
2511 fillInIntent.writeToParcel(data, 0);
2512 } else {
2513 data.writeInt(0);
2514 }
2515 data.writeString(resolvedType);
2516 data.writeStrongBinder(resultTo);
2517 data.writeString(resultWho);
2518 data.writeInt(requestCode);
2519 data.writeInt(flagsMask);
2520 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002521 if (options != null) {
2522 data.writeInt(1);
2523 options.writeToParcel(data, 0);
2524 } else {
2525 data.writeInt(0);
2526 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002527 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002528 reply.readException();
2529 int result = reply.readInt();
2530 reply.recycle();
2531 data.recycle();
2532 return result;
2533 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002534 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2535 Intent intent, String resolvedType, IVoiceInteractionSession session,
2536 IVoiceInteractor interactor, int startFlags, String profileFile,
2537 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2538 Parcel data = Parcel.obtain();
2539 Parcel reply = Parcel.obtain();
2540 data.writeInterfaceToken(IActivityManager.descriptor);
2541 data.writeString(callingPackage);
2542 data.writeInt(callingPid);
2543 data.writeInt(callingUid);
2544 intent.writeToParcel(data, 0);
2545 data.writeString(resolvedType);
2546 data.writeStrongBinder(session.asBinder());
2547 data.writeStrongBinder(interactor.asBinder());
2548 data.writeInt(startFlags);
2549 data.writeString(profileFile);
2550 if (profileFd != null) {
2551 data.writeInt(1);
2552 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2553 } else {
2554 data.writeInt(0);
2555 }
2556 if (options != null) {
2557 data.writeInt(1);
2558 options.writeToParcel(data, 0);
2559 } else {
2560 data.writeInt(0);
2561 }
2562 data.writeInt(userId);
2563 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2564 reply.readException();
2565 int result = reply.readInt();
2566 reply.recycle();
2567 data.recycle();
2568 return result;
2569 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002570 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002571 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002572 Parcel data = Parcel.obtain();
2573 Parcel reply = Parcel.obtain();
2574 data.writeInterfaceToken(IActivityManager.descriptor);
2575 data.writeStrongBinder(callingActivity);
2576 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002577 if (options != null) {
2578 data.writeInt(1);
2579 options.writeToParcel(data, 0);
2580 } else {
2581 data.writeInt(0);
2582 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002583 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2584 reply.readException();
2585 int result = reply.readInt();
2586 reply.recycle();
2587 data.recycle();
2588 return result != 0;
2589 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002590 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2591 Parcel data = Parcel.obtain();
2592 Parcel reply = Parcel.obtain();
2593 data.writeInterfaceToken(IActivityManager.descriptor);
2594 data.writeInt(taskId);
2595 if (options == null) {
2596 data.writeInt(0);
2597 } else {
2598 data.writeInt(1);
2599 options.writeToParcel(data, 0);
2600 }
2601 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2602 reply.readException();
2603 int result = reply.readInt();
2604 reply.recycle();
2605 data.recycle();
2606 return result;
2607 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002608 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002609 throws RemoteException {
2610 Parcel data = Parcel.obtain();
2611 Parcel reply = Parcel.obtain();
2612 data.writeInterfaceToken(IActivityManager.descriptor);
2613 data.writeStrongBinder(token);
2614 data.writeInt(resultCode);
2615 if (resultData != null) {
2616 data.writeInt(1);
2617 resultData.writeToParcel(data, 0);
2618 } else {
2619 data.writeInt(0);
2620 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002621 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002622 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2623 reply.readException();
2624 boolean res = reply.readInt() != 0;
2625 data.recycle();
2626 reply.recycle();
2627 return res;
2628 }
2629 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2630 {
2631 Parcel data = Parcel.obtain();
2632 Parcel reply = Parcel.obtain();
2633 data.writeInterfaceToken(IActivityManager.descriptor);
2634 data.writeStrongBinder(token);
2635 data.writeString(resultWho);
2636 data.writeInt(requestCode);
2637 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2638 reply.readException();
2639 data.recycle();
2640 reply.recycle();
2641 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002642 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2643 Parcel data = Parcel.obtain();
2644 Parcel reply = Parcel.obtain();
2645 data.writeInterfaceToken(IActivityManager.descriptor);
2646 data.writeStrongBinder(token);
2647 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2648 reply.readException();
2649 boolean res = reply.readInt() != 0;
2650 data.recycle();
2651 reply.recycle();
2652 return res;
2653 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002654 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2655 Parcel data = Parcel.obtain();
2656 Parcel reply = Parcel.obtain();
2657 data.writeInterfaceToken(IActivityManager.descriptor);
2658 data.writeStrongBinder(session.asBinder());
2659 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2660 reply.readException();
2661 data.recycle();
2662 reply.recycle();
2663 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002664 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2665 Parcel data = Parcel.obtain();
2666 Parcel reply = Parcel.obtain();
2667 data.writeInterfaceToken(IActivityManager.descriptor);
2668 data.writeStrongBinder(token);
2669 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2670 reply.readException();
2671 boolean res = reply.readInt() != 0;
2672 data.recycle();
2673 reply.recycle();
2674 return res;
2675 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002676 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002677 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002678 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002679 {
2680 Parcel data = Parcel.obtain();
2681 Parcel reply = Parcel.obtain();
2682 data.writeInterfaceToken(IActivityManager.descriptor);
2683 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002684 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002685 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2686 filter.writeToParcel(data, 0);
2687 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002688 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002689 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2690 reply.readException();
2691 Intent intent = null;
2692 int haveIntent = reply.readInt();
2693 if (haveIntent != 0) {
2694 intent = Intent.CREATOR.createFromParcel(reply);
2695 }
2696 reply.recycle();
2697 data.recycle();
2698 return intent;
2699 }
2700 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2701 {
2702 Parcel data = Parcel.obtain();
2703 Parcel reply = Parcel.obtain();
2704 data.writeInterfaceToken(IActivityManager.descriptor);
2705 data.writeStrongBinder(receiver.asBinder());
2706 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2707 reply.readException();
2708 data.recycle();
2709 reply.recycle();
2710 }
2711 public int broadcastIntent(IApplicationThread caller,
2712 Intent intent, String resolvedType, IIntentReceiver resultTo,
2713 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002714 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002715 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002716 {
2717 Parcel data = Parcel.obtain();
2718 Parcel reply = Parcel.obtain();
2719 data.writeInterfaceToken(IActivityManager.descriptor);
2720 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2721 intent.writeToParcel(data, 0);
2722 data.writeString(resolvedType);
2723 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2724 data.writeInt(resultCode);
2725 data.writeString(resultData);
2726 data.writeBundle(map);
2727 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002728 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002729 data.writeInt(serialized ? 1 : 0);
2730 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002731 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002732 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2733 reply.readException();
2734 int res = reply.readInt();
2735 reply.recycle();
2736 data.recycle();
2737 return res;
2738 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002739 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2740 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002741 {
2742 Parcel data = Parcel.obtain();
2743 Parcel reply = Parcel.obtain();
2744 data.writeInterfaceToken(IActivityManager.descriptor);
2745 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2746 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002747 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002748 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2749 reply.readException();
2750 data.recycle();
2751 reply.recycle();
2752 }
2753 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2754 {
2755 Parcel data = Parcel.obtain();
2756 Parcel reply = Parcel.obtain();
2757 data.writeInterfaceToken(IActivityManager.descriptor);
2758 data.writeStrongBinder(who);
2759 data.writeInt(resultCode);
2760 data.writeString(resultData);
2761 data.writeBundle(map);
2762 data.writeInt(abortBroadcast ? 1 : 0);
2763 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2764 reply.readException();
2765 data.recycle();
2766 reply.recycle();
2767 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002768 public void attachApplication(IApplicationThread app) throws RemoteException
2769 {
2770 Parcel data = Parcel.obtain();
2771 Parcel reply = Parcel.obtain();
2772 data.writeInterfaceToken(IActivityManager.descriptor);
2773 data.writeStrongBinder(app.asBinder());
2774 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2775 reply.readException();
2776 data.recycle();
2777 reply.recycle();
2778 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002779 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2780 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002781 {
2782 Parcel data = Parcel.obtain();
2783 Parcel reply = Parcel.obtain();
2784 data.writeInterfaceToken(IActivityManager.descriptor);
2785 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002786 if (config != null) {
2787 data.writeInt(1);
2788 config.writeToParcel(data, 0);
2789 } else {
2790 data.writeInt(0);
2791 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002792 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002793 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2794 reply.readException();
2795 data.recycle();
2796 reply.recycle();
2797 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002798 public void activityResumed(IBinder token) throws RemoteException
2799 {
2800 Parcel data = Parcel.obtain();
2801 Parcel reply = Parcel.obtain();
2802 data.writeInterfaceToken(IActivityManager.descriptor);
2803 data.writeStrongBinder(token);
2804 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2805 reply.readException();
2806 data.recycle();
2807 reply.recycle();
2808 }
Craig Mautnera0026042014-04-23 11:45:37 -07002809 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002810 {
2811 Parcel data = Parcel.obtain();
2812 Parcel reply = Parcel.obtain();
2813 data.writeInterfaceToken(IActivityManager.descriptor);
2814 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002815 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002816 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2817 reply.readException();
2818 data.recycle();
2819 reply.recycle();
2820 }
2821 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002822 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002823 {
2824 Parcel data = Parcel.obtain();
2825 Parcel reply = Parcel.obtain();
2826 data.writeInterfaceToken(IActivityManager.descriptor);
2827 data.writeStrongBinder(token);
2828 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002829 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002830 TextUtils.writeToParcel(description, data, 0);
2831 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2832 reply.readException();
2833 data.recycle();
2834 reply.recycle();
2835 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002836 public void activitySlept(IBinder token) throws RemoteException
2837 {
2838 Parcel data = Parcel.obtain();
2839 Parcel reply = Parcel.obtain();
2840 data.writeInterfaceToken(IActivityManager.descriptor);
2841 data.writeStrongBinder(token);
2842 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2843 reply.readException();
2844 data.recycle();
2845 reply.recycle();
2846 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002847 public void activityDestroyed(IBinder token) throws RemoteException
2848 {
2849 Parcel data = Parcel.obtain();
2850 Parcel reply = Parcel.obtain();
2851 data.writeInterfaceToken(IActivityManager.descriptor);
2852 data.writeStrongBinder(token);
2853 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2854 reply.readException();
2855 data.recycle();
2856 reply.recycle();
2857 }
2858 public String getCallingPackage(IBinder token) throws RemoteException
2859 {
2860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
2863 data.writeStrongBinder(token);
2864 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2865 reply.readException();
2866 String res = reply.readString();
2867 data.recycle();
2868 reply.recycle();
2869 return res;
2870 }
2871 public ComponentName getCallingActivity(IBinder token)
2872 throws RemoteException {
2873 Parcel data = Parcel.obtain();
2874 Parcel reply = Parcel.obtain();
2875 data.writeInterfaceToken(IActivityManager.descriptor);
2876 data.writeStrongBinder(token);
2877 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2878 reply.readException();
2879 ComponentName res = ComponentName.readFromParcel(reply);
2880 data.recycle();
2881 reply.recycle();
2882 return res;
2883 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002884 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07002885 Parcel data = Parcel.obtain();
2886 Parcel reply = Parcel.obtain();
2887 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002888 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07002889 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2890 reply.readException();
2891 ArrayList<IAppTask> list = null;
2892 int N = reply.readInt();
2893 if (N >= 0) {
2894 list = new ArrayList<IAppTask>();
2895 while (N > 0) {
2896 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2897 list.add(task);
2898 N--;
2899 }
2900 }
2901 data.recycle();
2902 reply.recycle();
2903 return list;
2904 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07002905 public int addAppTask(IBinder activityToken, Intent intent,
2906 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
2907 Parcel data = Parcel.obtain();
2908 Parcel reply = Parcel.obtain();
2909 data.writeInterfaceToken(IActivityManager.descriptor);
2910 data.writeStrongBinder(activityToken);
2911 intent.writeToParcel(data, 0);
2912 description.writeToParcel(data, 0);
2913 thumbnail.writeToParcel(data, 0);
2914 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
2915 reply.readException();
2916 int res = reply.readInt();
2917 data.recycle();
2918 reply.recycle();
2919 return res;
2920 }
2921 public Point getAppTaskThumbnailSize() throws RemoteException {
2922 Parcel data = Parcel.obtain();
2923 Parcel reply = Parcel.obtain();
2924 data.writeInterfaceToken(IActivityManager.descriptor);
2925 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
2926 reply.readException();
2927 Point size = Point.CREATOR.createFromParcel(reply);
2928 data.recycle();
2929 reply.recycle();
2930 return size;
2931 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002932 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002933 Parcel data = Parcel.obtain();
2934 Parcel reply = Parcel.obtain();
2935 data.writeInterfaceToken(IActivityManager.descriptor);
2936 data.writeInt(maxNum);
2937 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002938 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2939 reply.readException();
2940 ArrayList list = null;
2941 int N = reply.readInt();
2942 if (N >= 0) {
2943 list = new ArrayList();
2944 while (N > 0) {
2945 ActivityManager.RunningTaskInfo info =
2946 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002947 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002948 list.add(info);
2949 N--;
2950 }
2951 }
2952 data.recycle();
2953 reply.recycle();
2954 return list;
2955 }
2956 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002957 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002958 Parcel data = Parcel.obtain();
2959 Parcel reply = Parcel.obtain();
2960 data.writeInterfaceToken(IActivityManager.descriptor);
2961 data.writeInt(maxNum);
2962 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002963 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002964 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2965 reply.readException();
2966 ArrayList<ActivityManager.RecentTaskInfo> list
2967 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2968 data.recycle();
2969 reply.recycle();
2970 return list;
2971 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002972 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002973 Parcel data = Parcel.obtain();
2974 Parcel reply = Parcel.obtain();
2975 data.writeInterfaceToken(IActivityManager.descriptor);
2976 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002977 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002978 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002979 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002980 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002981 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002982 }
2983 data.recycle();
2984 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002985 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07002986 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002987 public List getServices(int maxNum, int flags) throws RemoteException {
2988 Parcel data = Parcel.obtain();
2989 Parcel reply = Parcel.obtain();
2990 data.writeInterfaceToken(IActivityManager.descriptor);
2991 data.writeInt(maxNum);
2992 data.writeInt(flags);
2993 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2994 reply.readException();
2995 ArrayList list = null;
2996 int N = reply.readInt();
2997 if (N >= 0) {
2998 list = new ArrayList();
2999 while (N > 0) {
3000 ActivityManager.RunningServiceInfo info =
3001 ActivityManager.RunningServiceInfo.CREATOR
3002 .createFromParcel(reply);
3003 list.add(info);
3004 N--;
3005 }
3006 }
3007 data.recycle();
3008 reply.recycle();
3009 return list;
3010 }
3011 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3012 throws RemoteException {
3013 Parcel data = Parcel.obtain();
3014 Parcel reply = Parcel.obtain();
3015 data.writeInterfaceToken(IActivityManager.descriptor);
3016 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3017 reply.readException();
3018 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3019 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3020 data.recycle();
3021 reply.recycle();
3022 return list;
3023 }
3024 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3025 throws RemoteException {
3026 Parcel data = Parcel.obtain();
3027 Parcel reply = Parcel.obtain();
3028 data.writeInterfaceToken(IActivityManager.descriptor);
3029 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3030 reply.readException();
3031 ArrayList<ActivityManager.RunningAppProcessInfo> list
3032 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3033 data.recycle();
3034 reply.recycle();
3035 return list;
3036 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003037 public List<ApplicationInfo> getRunningExternalApplications()
3038 throws RemoteException {
3039 Parcel data = Parcel.obtain();
3040 Parcel reply = Parcel.obtain();
3041 data.writeInterfaceToken(IActivityManager.descriptor);
3042 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3043 reply.readException();
3044 ArrayList<ApplicationInfo> list
3045 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3046 data.recycle();
3047 reply.recycle();
3048 return list;
3049 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003050 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003051 {
3052 Parcel data = Parcel.obtain();
3053 Parcel reply = Parcel.obtain();
3054 data.writeInterfaceToken(IActivityManager.descriptor);
3055 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003056 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003057 if (options != null) {
3058 data.writeInt(1);
3059 options.writeToParcel(data, 0);
3060 } else {
3061 data.writeInt(0);
3062 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003063 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3064 reply.readException();
3065 data.recycle();
3066 reply.recycle();
3067 }
3068 public void moveTaskToBack(int task) throws RemoteException
3069 {
3070 Parcel data = Parcel.obtain();
3071 Parcel reply = Parcel.obtain();
3072 data.writeInterfaceToken(IActivityManager.descriptor);
3073 data.writeInt(task);
3074 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3075 reply.readException();
3076 data.recycle();
3077 reply.recycle();
3078 }
3079 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3080 throws RemoteException {
3081 Parcel data = Parcel.obtain();
3082 Parcel reply = Parcel.obtain();
3083 data.writeInterfaceToken(IActivityManager.descriptor);
3084 data.writeStrongBinder(token);
3085 data.writeInt(nonRoot ? 1 : 0);
3086 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3087 reply.readException();
3088 boolean res = reply.readInt() != 0;
3089 data.recycle();
3090 reply.recycle();
3091 return res;
3092 }
3093 public void moveTaskBackwards(int task) throws RemoteException
3094 {
3095 Parcel data = Parcel.obtain();
3096 Parcel reply = Parcel.obtain();
3097 data.writeInterfaceToken(IActivityManager.descriptor);
3098 data.writeInt(task);
3099 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3100 reply.readException();
3101 data.recycle();
3102 reply.recycle();
3103 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003104 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003105 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3106 {
3107 Parcel data = Parcel.obtain();
3108 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003109 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003110 data.writeInt(taskId);
3111 data.writeInt(stackId);
3112 data.writeInt(toTop ? 1 : 0);
3113 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3114 reply.readException();
3115 data.recycle();
3116 reply.recycle();
3117 }
3118 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003119 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003120 {
3121 Parcel data = Parcel.obtain();
3122 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003123 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003124 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003125 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003126 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003127 reply.readException();
3128 data.recycle();
3129 reply.recycle();
3130 }
Craig Mautner967212c2013-04-13 21:10:58 -07003131 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003132 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003133 {
3134 Parcel data = Parcel.obtain();
3135 Parcel reply = Parcel.obtain();
3136 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003137 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003138 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003139 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003140 data.recycle();
3141 reply.recycle();
3142 return list;
3143 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003144 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003145 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003146 {
3147 Parcel data = Parcel.obtain();
3148 Parcel reply = Parcel.obtain();
3149 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003150 data.writeInt(stackId);
3151 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003152 reply.readException();
3153 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003154 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003155 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003156 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003157 }
3158 data.recycle();
3159 reply.recycle();
3160 return info;
3161 }
3162 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003163 public boolean isInHomeStack(int taskId) throws RemoteException {
3164 Parcel data = Parcel.obtain();
3165 Parcel reply = Parcel.obtain();
3166 data.writeInterfaceToken(IActivityManager.descriptor);
3167 data.writeInt(taskId);
3168 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3169 reply.readException();
3170 boolean isInHomeStack = reply.readInt() > 0;
3171 data.recycle();
3172 reply.recycle();
3173 return isInHomeStack;
3174 }
3175 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003176 public void setFocusedStack(int stackId) throws RemoteException
3177 {
3178 Parcel data = Parcel.obtain();
3179 Parcel reply = Parcel.obtain();
3180 data.writeInterfaceToken(IActivityManager.descriptor);
3181 data.writeInt(stackId);
3182 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3183 reply.readException();
3184 data.recycle();
3185 reply.recycle();
3186 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003187 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3188 {
3189 Parcel data = Parcel.obtain();
3190 Parcel reply = Parcel.obtain();
3191 data.writeInterfaceToken(IActivityManager.descriptor);
3192 data.writeStrongBinder(token);
3193 data.writeInt(onlyRoot ? 1 : 0);
3194 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3195 reply.readException();
3196 int res = reply.readInt();
3197 data.recycle();
3198 reply.recycle();
3199 return res;
3200 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003201 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003202 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003203 Parcel data = Parcel.obtain();
3204 Parcel reply = Parcel.obtain();
3205 data.writeInterfaceToken(IActivityManager.descriptor);
3206 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3207 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003208 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003209 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003210 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3211 reply.readException();
3212 int res = reply.readInt();
3213 ContentProviderHolder cph = null;
3214 if (res != 0) {
3215 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3216 }
3217 data.recycle();
3218 reply.recycle();
3219 return cph;
3220 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003221 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3222 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003223 Parcel data = Parcel.obtain();
3224 Parcel reply = Parcel.obtain();
3225 data.writeInterfaceToken(IActivityManager.descriptor);
3226 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003227 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003228 data.writeStrongBinder(token);
3229 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3230 reply.readException();
3231 int res = reply.readInt();
3232 ContentProviderHolder cph = null;
3233 if (res != 0) {
3234 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3235 }
3236 data.recycle();
3237 reply.recycle();
3238 return cph;
3239 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003240 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003241 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003242 {
3243 Parcel data = Parcel.obtain();
3244 Parcel reply = Parcel.obtain();
3245 data.writeInterfaceToken(IActivityManager.descriptor);
3246 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3247 data.writeTypedList(providers);
3248 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3249 reply.readException();
3250 data.recycle();
3251 reply.recycle();
3252 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003253 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3254 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003255 Parcel data = Parcel.obtain();
3256 Parcel reply = Parcel.obtain();
3257 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003258 data.writeStrongBinder(connection);
3259 data.writeInt(stable);
3260 data.writeInt(unstable);
3261 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3262 reply.readException();
3263 boolean res = reply.readInt() != 0;
3264 data.recycle();
3265 reply.recycle();
3266 return res;
3267 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003268
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003269 public void unstableProviderDied(IBinder connection) throws RemoteException {
3270 Parcel data = Parcel.obtain();
3271 Parcel reply = Parcel.obtain();
3272 data.writeInterfaceToken(IActivityManager.descriptor);
3273 data.writeStrongBinder(connection);
3274 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3275 reply.readException();
3276 data.recycle();
3277 reply.recycle();
3278 }
3279
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003280 @Override
3281 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3282 Parcel data = Parcel.obtain();
3283 Parcel reply = Parcel.obtain();
3284 data.writeInterfaceToken(IActivityManager.descriptor);
3285 data.writeStrongBinder(connection);
3286 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3287 reply.readException();
3288 data.recycle();
3289 reply.recycle();
3290 }
3291
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003292 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3293 Parcel data = Parcel.obtain();
3294 Parcel reply = Parcel.obtain();
3295 data.writeInterfaceToken(IActivityManager.descriptor);
3296 data.writeStrongBinder(connection);
3297 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003298 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3299 reply.readException();
3300 data.recycle();
3301 reply.recycle();
3302 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003303
3304 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3305 Parcel data = Parcel.obtain();
3306 Parcel reply = Parcel.obtain();
3307 data.writeInterfaceToken(IActivityManager.descriptor);
3308 data.writeString(name);
3309 data.writeStrongBinder(token);
3310 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3311 reply.readException();
3312 data.recycle();
3313 reply.recycle();
3314 }
3315
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003316 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3317 throws RemoteException
3318 {
3319 Parcel data = Parcel.obtain();
3320 Parcel reply = Parcel.obtain();
3321 data.writeInterfaceToken(IActivityManager.descriptor);
3322 service.writeToParcel(data, 0);
3323 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3324 reply.readException();
3325 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3326 data.recycle();
3327 reply.recycle();
3328 return res;
3329 }
3330
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003331 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003332 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003333 {
3334 Parcel data = Parcel.obtain();
3335 Parcel reply = Parcel.obtain();
3336 data.writeInterfaceToken(IActivityManager.descriptor);
3337 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3338 service.writeToParcel(data, 0);
3339 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003340 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003341 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3342 reply.readException();
3343 ComponentName res = ComponentName.readFromParcel(reply);
3344 data.recycle();
3345 reply.recycle();
3346 return res;
3347 }
3348 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003349 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003350 {
3351 Parcel data = Parcel.obtain();
3352 Parcel reply = Parcel.obtain();
3353 data.writeInterfaceToken(IActivityManager.descriptor);
3354 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3355 service.writeToParcel(data, 0);
3356 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003357 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003358 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3359 reply.readException();
3360 int res = reply.readInt();
3361 reply.recycle();
3362 data.recycle();
3363 return res;
3364 }
3365 public boolean stopServiceToken(ComponentName className, IBinder token,
3366 int startId) throws RemoteException {
3367 Parcel data = Parcel.obtain();
3368 Parcel reply = Parcel.obtain();
3369 data.writeInterfaceToken(IActivityManager.descriptor);
3370 ComponentName.writeToParcel(className, data);
3371 data.writeStrongBinder(token);
3372 data.writeInt(startId);
3373 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3374 reply.readException();
3375 boolean res = reply.readInt() != 0;
3376 data.recycle();
3377 reply.recycle();
3378 return res;
3379 }
3380 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003381 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003382 Parcel data = Parcel.obtain();
3383 Parcel reply = Parcel.obtain();
3384 data.writeInterfaceToken(IActivityManager.descriptor);
3385 ComponentName.writeToParcel(className, data);
3386 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003387 data.writeInt(id);
3388 if (notification != null) {
3389 data.writeInt(1);
3390 notification.writeToParcel(data, 0);
3391 } else {
3392 data.writeInt(0);
3393 }
3394 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003395 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3396 reply.readException();
3397 data.recycle();
3398 reply.recycle();
3399 }
3400 public int bindService(IApplicationThread caller, IBinder token,
3401 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003402 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003403 Parcel data = Parcel.obtain();
3404 Parcel reply = Parcel.obtain();
3405 data.writeInterfaceToken(IActivityManager.descriptor);
3406 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3407 data.writeStrongBinder(token);
3408 service.writeToParcel(data, 0);
3409 data.writeString(resolvedType);
3410 data.writeStrongBinder(connection.asBinder());
3411 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003412 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003413 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3414 reply.readException();
3415 int res = reply.readInt();
3416 data.recycle();
3417 reply.recycle();
3418 return res;
3419 }
3420 public boolean unbindService(IServiceConnection connection) throws RemoteException
3421 {
3422 Parcel data = Parcel.obtain();
3423 Parcel reply = Parcel.obtain();
3424 data.writeInterfaceToken(IActivityManager.descriptor);
3425 data.writeStrongBinder(connection.asBinder());
3426 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3427 reply.readException();
3428 boolean res = reply.readInt() != 0;
3429 data.recycle();
3430 reply.recycle();
3431 return res;
3432 }
3433
3434 public void publishService(IBinder token,
3435 Intent intent, IBinder service) throws RemoteException {
3436 Parcel data = Parcel.obtain();
3437 Parcel reply = Parcel.obtain();
3438 data.writeInterfaceToken(IActivityManager.descriptor);
3439 data.writeStrongBinder(token);
3440 intent.writeToParcel(data, 0);
3441 data.writeStrongBinder(service);
3442 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3443 reply.readException();
3444 data.recycle();
3445 reply.recycle();
3446 }
3447
3448 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3449 throws RemoteException {
3450 Parcel data = Parcel.obtain();
3451 Parcel reply = Parcel.obtain();
3452 data.writeInterfaceToken(IActivityManager.descriptor);
3453 data.writeStrongBinder(token);
3454 intent.writeToParcel(data, 0);
3455 data.writeInt(doRebind ? 1 : 0);
3456 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3457 reply.readException();
3458 data.recycle();
3459 reply.recycle();
3460 }
3461
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003462 public void serviceDoneExecuting(IBinder token, int type, int startId,
3463 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003464 Parcel data = Parcel.obtain();
3465 Parcel reply = Parcel.obtain();
3466 data.writeInterfaceToken(IActivityManager.descriptor);
3467 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003468 data.writeInt(type);
3469 data.writeInt(startId);
3470 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003471 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3472 reply.readException();
3473 data.recycle();
3474 reply.recycle();
3475 }
3476
3477 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3478 Parcel data = Parcel.obtain();
3479 Parcel reply = Parcel.obtain();
3480 data.writeInterfaceToken(IActivityManager.descriptor);
3481 service.writeToParcel(data, 0);
3482 data.writeString(resolvedType);
3483 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3484 reply.readException();
3485 IBinder binder = reply.readStrongBinder();
3486 reply.recycle();
3487 data.recycle();
3488 return binder;
3489 }
3490
Christopher Tate181fafa2009-05-14 11:12:14 -07003491 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3492 throws RemoteException {
3493 Parcel data = Parcel.obtain();
3494 Parcel reply = Parcel.obtain();
3495 data.writeInterfaceToken(IActivityManager.descriptor);
3496 app.writeToParcel(data, 0);
3497 data.writeInt(backupRestoreMode);
3498 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3499 reply.readException();
3500 boolean success = reply.readInt() != 0;
3501 reply.recycle();
3502 data.recycle();
3503 return success;
3504 }
3505
Christopher Tate346acb12012-10-15 19:20:25 -07003506 public void clearPendingBackup() throws RemoteException {
3507 Parcel data = Parcel.obtain();
3508 Parcel reply = Parcel.obtain();
3509 data.writeInterfaceToken(IActivityManager.descriptor);
3510 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3511 reply.recycle();
3512 data.recycle();
3513 }
3514
Christopher Tate181fafa2009-05-14 11:12:14 -07003515 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3516 Parcel data = Parcel.obtain();
3517 Parcel reply = Parcel.obtain();
3518 data.writeInterfaceToken(IActivityManager.descriptor);
3519 data.writeString(packageName);
3520 data.writeStrongBinder(agent);
3521 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3522 reply.recycle();
3523 data.recycle();
3524 }
3525
3526 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3527 Parcel data = Parcel.obtain();
3528 Parcel reply = Parcel.obtain();
3529 data.writeInterfaceToken(IActivityManager.descriptor);
3530 app.writeToParcel(data, 0);
3531 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3532 reply.readException();
3533 reply.recycle();
3534 data.recycle();
3535 }
3536
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003537 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003538 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003539 IUiAutomationConnection connection, int userId, String instructionSet)
3540 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003541 Parcel data = Parcel.obtain();
3542 Parcel reply = Parcel.obtain();
3543 data.writeInterfaceToken(IActivityManager.descriptor);
3544 ComponentName.writeToParcel(className, data);
3545 data.writeString(profileFile);
3546 data.writeInt(flags);
3547 data.writeBundle(arguments);
3548 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003549 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003550 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003551 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003552 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3553 reply.readException();
3554 boolean res = reply.readInt() != 0;
3555 reply.recycle();
3556 data.recycle();
3557 return res;
3558 }
3559
3560 public void finishInstrumentation(IApplicationThread target,
3561 int resultCode, Bundle results) throws RemoteException {
3562 Parcel data = Parcel.obtain();
3563 Parcel reply = Parcel.obtain();
3564 data.writeInterfaceToken(IActivityManager.descriptor);
3565 data.writeStrongBinder(target != null ? target.asBinder() : null);
3566 data.writeInt(resultCode);
3567 data.writeBundle(results);
3568 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3569 reply.readException();
3570 data.recycle();
3571 reply.recycle();
3572 }
3573 public Configuration getConfiguration() throws RemoteException
3574 {
3575 Parcel data = Parcel.obtain();
3576 Parcel reply = Parcel.obtain();
3577 data.writeInterfaceToken(IActivityManager.descriptor);
3578 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3579 reply.readException();
3580 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3581 reply.recycle();
3582 data.recycle();
3583 return res;
3584 }
3585 public void updateConfiguration(Configuration values) throws RemoteException
3586 {
3587 Parcel data = Parcel.obtain();
3588 Parcel reply = Parcel.obtain();
3589 data.writeInterfaceToken(IActivityManager.descriptor);
3590 values.writeToParcel(data, 0);
3591 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3592 reply.readException();
3593 data.recycle();
3594 reply.recycle();
3595 }
3596 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3597 throws RemoteException {
3598 Parcel data = Parcel.obtain();
3599 Parcel reply = Parcel.obtain();
3600 data.writeInterfaceToken(IActivityManager.descriptor);
3601 data.writeStrongBinder(token);
3602 data.writeInt(requestedOrientation);
3603 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3604 reply.readException();
3605 data.recycle();
3606 reply.recycle();
3607 }
3608 public int getRequestedOrientation(IBinder token) throws RemoteException {
3609 Parcel data = Parcel.obtain();
3610 Parcel reply = Parcel.obtain();
3611 data.writeInterfaceToken(IActivityManager.descriptor);
3612 data.writeStrongBinder(token);
3613 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3614 reply.readException();
3615 int res = reply.readInt();
3616 data.recycle();
3617 reply.recycle();
3618 return res;
3619 }
3620 public ComponentName getActivityClassForToken(IBinder token)
3621 throws RemoteException {
3622 Parcel data = Parcel.obtain();
3623 Parcel reply = Parcel.obtain();
3624 data.writeInterfaceToken(IActivityManager.descriptor);
3625 data.writeStrongBinder(token);
3626 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3627 reply.readException();
3628 ComponentName res = ComponentName.readFromParcel(reply);
3629 data.recycle();
3630 reply.recycle();
3631 return res;
3632 }
3633 public String getPackageForToken(IBinder token) throws RemoteException
3634 {
3635 Parcel data = Parcel.obtain();
3636 Parcel reply = Parcel.obtain();
3637 data.writeInterfaceToken(IActivityManager.descriptor);
3638 data.writeStrongBinder(token);
3639 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3640 reply.readException();
3641 String res = reply.readString();
3642 data.recycle();
3643 reply.recycle();
3644 return res;
3645 }
3646 public IIntentSender getIntentSender(int type,
3647 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003648 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003649 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003650 Parcel data = Parcel.obtain();
3651 Parcel reply = Parcel.obtain();
3652 data.writeInterfaceToken(IActivityManager.descriptor);
3653 data.writeInt(type);
3654 data.writeString(packageName);
3655 data.writeStrongBinder(token);
3656 data.writeString(resultWho);
3657 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003658 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003659 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003660 data.writeTypedArray(intents, 0);
3661 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003662 } else {
3663 data.writeInt(0);
3664 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003665 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003666 if (options != null) {
3667 data.writeInt(1);
3668 options.writeToParcel(data, 0);
3669 } else {
3670 data.writeInt(0);
3671 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003672 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003673 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3674 reply.readException();
3675 IIntentSender res = IIntentSender.Stub.asInterface(
3676 reply.readStrongBinder());
3677 data.recycle();
3678 reply.recycle();
3679 return res;
3680 }
3681 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3682 Parcel data = Parcel.obtain();
3683 Parcel reply = Parcel.obtain();
3684 data.writeInterfaceToken(IActivityManager.descriptor);
3685 data.writeStrongBinder(sender.asBinder());
3686 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3687 reply.readException();
3688 data.recycle();
3689 reply.recycle();
3690 }
3691 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3692 Parcel data = Parcel.obtain();
3693 Parcel reply = Parcel.obtain();
3694 data.writeInterfaceToken(IActivityManager.descriptor);
3695 data.writeStrongBinder(sender.asBinder());
3696 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3697 reply.readException();
3698 String res = reply.readString();
3699 data.recycle();
3700 reply.recycle();
3701 return res;
3702 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003703 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3704 Parcel data = Parcel.obtain();
3705 Parcel reply = Parcel.obtain();
3706 data.writeInterfaceToken(IActivityManager.descriptor);
3707 data.writeStrongBinder(sender.asBinder());
3708 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3709 reply.readException();
3710 int res = reply.readInt();
3711 data.recycle();
3712 reply.recycle();
3713 return res;
3714 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003715 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3716 boolean requireFull, String name, String callerPackage) throws RemoteException {
3717 Parcel data = Parcel.obtain();
3718 Parcel reply = Parcel.obtain();
3719 data.writeInterfaceToken(IActivityManager.descriptor);
3720 data.writeInt(callingPid);
3721 data.writeInt(callingUid);
3722 data.writeInt(userId);
3723 data.writeInt(allowAll ? 1 : 0);
3724 data.writeInt(requireFull ? 1 : 0);
3725 data.writeString(name);
3726 data.writeString(callerPackage);
3727 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3728 reply.readException();
3729 int res = reply.readInt();
3730 data.recycle();
3731 reply.recycle();
3732 return res;
3733 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003734 public void setProcessLimit(int max) throws RemoteException
3735 {
3736 Parcel data = Parcel.obtain();
3737 Parcel reply = Parcel.obtain();
3738 data.writeInterfaceToken(IActivityManager.descriptor);
3739 data.writeInt(max);
3740 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3741 reply.readException();
3742 data.recycle();
3743 reply.recycle();
3744 }
3745 public int getProcessLimit() throws RemoteException
3746 {
3747 Parcel data = Parcel.obtain();
3748 Parcel reply = Parcel.obtain();
3749 data.writeInterfaceToken(IActivityManager.descriptor);
3750 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3751 reply.readException();
3752 int res = reply.readInt();
3753 data.recycle();
3754 reply.recycle();
3755 return res;
3756 }
3757 public void setProcessForeground(IBinder token, int pid,
3758 boolean isForeground) throws RemoteException {
3759 Parcel data = Parcel.obtain();
3760 Parcel reply = Parcel.obtain();
3761 data.writeInterfaceToken(IActivityManager.descriptor);
3762 data.writeStrongBinder(token);
3763 data.writeInt(pid);
3764 data.writeInt(isForeground ? 1 : 0);
3765 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3766 reply.readException();
3767 data.recycle();
3768 reply.recycle();
3769 }
3770 public int checkPermission(String permission, int pid, int uid)
3771 throws RemoteException {
3772 Parcel data = Parcel.obtain();
3773 Parcel reply = Parcel.obtain();
3774 data.writeInterfaceToken(IActivityManager.descriptor);
3775 data.writeString(permission);
3776 data.writeInt(pid);
3777 data.writeInt(uid);
3778 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3779 reply.readException();
3780 int res = reply.readInt();
3781 data.recycle();
3782 reply.recycle();
3783 return res;
3784 }
3785 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003786 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003787 Parcel data = Parcel.obtain();
3788 Parcel reply = Parcel.obtain();
3789 data.writeInterfaceToken(IActivityManager.descriptor);
3790 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003791 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003792 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003793 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3794 reply.readException();
3795 boolean res = reply.readInt() != 0;
3796 data.recycle();
3797 reply.recycle();
3798 return res;
3799 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003800 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003801 throws RemoteException {
3802 Parcel data = Parcel.obtain();
3803 Parcel reply = Parcel.obtain();
3804 data.writeInterfaceToken(IActivityManager.descriptor);
3805 uri.writeToParcel(data, 0);
3806 data.writeInt(pid);
3807 data.writeInt(uid);
3808 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003809 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003810 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3811 reply.readException();
3812 int res = reply.readInt();
3813 data.recycle();
3814 reply.recycle();
3815 return res;
3816 }
3817 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003818 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003819 Parcel data = Parcel.obtain();
3820 Parcel reply = Parcel.obtain();
3821 data.writeInterfaceToken(IActivityManager.descriptor);
3822 data.writeStrongBinder(caller.asBinder());
3823 data.writeString(targetPkg);
3824 uri.writeToParcel(data, 0);
3825 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003826 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003827 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3828 reply.readException();
3829 data.recycle();
3830 reply.recycle();
3831 }
3832 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003833 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003834 Parcel data = Parcel.obtain();
3835 Parcel reply = Parcel.obtain();
3836 data.writeInterfaceToken(IActivityManager.descriptor);
3837 data.writeStrongBinder(caller.asBinder());
3838 uri.writeToParcel(data, 0);
3839 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003840 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003841 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3842 reply.readException();
3843 data.recycle();
3844 reply.recycle();
3845 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003846
3847 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003848 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3849 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003850 Parcel data = Parcel.obtain();
3851 Parcel reply = Parcel.obtain();
3852 data.writeInterfaceToken(IActivityManager.descriptor);
3853 uri.writeToParcel(data, 0);
3854 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003855 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003856 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3857 reply.readException();
3858 data.recycle();
3859 reply.recycle();
3860 }
3861
3862 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003863 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3864 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003865 Parcel data = Parcel.obtain();
3866 Parcel reply = Parcel.obtain();
3867 data.writeInterfaceToken(IActivityManager.descriptor);
3868 uri.writeToParcel(data, 0);
3869 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003870 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003871 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3872 reply.readException();
3873 data.recycle();
3874 reply.recycle();
3875 }
3876
3877 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003878 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3879 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003880 Parcel data = Parcel.obtain();
3881 Parcel reply = Parcel.obtain();
3882 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003883 data.writeString(packageName);
3884 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003885 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3886 reply.readException();
3887 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3888 reply);
3889 data.recycle();
3890 reply.recycle();
3891 return perms;
3892 }
3893
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003894 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3895 throws RemoteException {
3896 Parcel data = Parcel.obtain();
3897 Parcel reply = Parcel.obtain();
3898 data.writeInterfaceToken(IActivityManager.descriptor);
3899 data.writeStrongBinder(who.asBinder());
3900 data.writeInt(waiting ? 1 : 0);
3901 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3902 reply.readException();
3903 data.recycle();
3904 reply.recycle();
3905 }
3906 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3907 Parcel data = Parcel.obtain();
3908 Parcel reply = Parcel.obtain();
3909 data.writeInterfaceToken(IActivityManager.descriptor);
3910 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3911 reply.readException();
3912 outInfo.readFromParcel(reply);
3913 data.recycle();
3914 reply.recycle();
3915 }
3916 public void unhandledBack() throws RemoteException
3917 {
3918 Parcel data = Parcel.obtain();
3919 Parcel reply = Parcel.obtain();
3920 data.writeInterfaceToken(IActivityManager.descriptor);
3921 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3922 reply.readException();
3923 data.recycle();
3924 reply.recycle();
3925 }
3926 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3927 {
3928 Parcel data = Parcel.obtain();
3929 Parcel reply = Parcel.obtain();
3930 data.writeInterfaceToken(IActivityManager.descriptor);
3931 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3932 reply.readException();
3933 ParcelFileDescriptor pfd = null;
3934 if (reply.readInt() != 0) {
3935 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3936 }
3937 data.recycle();
3938 reply.recycle();
3939 return pfd;
3940 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003941 public void setLockScreenShown(boolean shown) throws RemoteException
3942 {
3943 Parcel data = Parcel.obtain();
3944 Parcel reply = Parcel.obtain();
3945 data.writeInterfaceToken(IActivityManager.descriptor);
3946 data.writeInt(shown ? 1 : 0);
3947 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3948 reply.readException();
3949 data.recycle();
3950 reply.recycle();
3951 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003952 public void setDebugApp(
3953 String packageName, boolean waitForDebugger, boolean persistent)
3954 throws RemoteException
3955 {
3956 Parcel data = Parcel.obtain();
3957 Parcel reply = Parcel.obtain();
3958 data.writeInterfaceToken(IActivityManager.descriptor);
3959 data.writeString(packageName);
3960 data.writeInt(waitForDebugger ? 1 : 0);
3961 data.writeInt(persistent ? 1 : 0);
3962 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3963 reply.readException();
3964 data.recycle();
3965 reply.recycle();
3966 }
3967 public void setAlwaysFinish(boolean enabled) throws RemoteException
3968 {
3969 Parcel data = Parcel.obtain();
3970 Parcel reply = Parcel.obtain();
3971 data.writeInterfaceToken(IActivityManager.descriptor);
3972 data.writeInt(enabled ? 1 : 0);
3973 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3974 reply.readException();
3975 data.recycle();
3976 reply.recycle();
3977 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003978 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003979 {
3980 Parcel data = Parcel.obtain();
3981 Parcel reply = Parcel.obtain();
3982 data.writeInterfaceToken(IActivityManager.descriptor);
3983 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003984 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003985 reply.readException();
3986 data.recycle();
3987 reply.recycle();
3988 }
3989 public void enterSafeMode() throws RemoteException {
3990 Parcel data = Parcel.obtain();
3991 data.writeInterfaceToken(IActivityManager.descriptor);
3992 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3993 data.recycle();
3994 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003995 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3996 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003997 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003998 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003999 data.writeStrongBinder(sender.asBinder());
4000 data.writeInt(sourceUid);
4001 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004002 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4003 data.recycle();
4004 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004005 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004006 Parcel data = Parcel.obtain();
4007 Parcel reply = Parcel.obtain();
4008 data.writeInterfaceToken(IActivityManager.descriptor);
4009 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004010 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004011 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004012 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004013 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004014 boolean res = reply.readInt() != 0;
4015 data.recycle();
4016 reply.recycle();
4017 return res;
4018 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004019 @Override
4020 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4021 Parcel data = Parcel.obtain();
4022 Parcel reply = Parcel.obtain();
4023 data.writeInterfaceToken(IActivityManager.descriptor);
4024 data.writeString(reason);
4025 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4026 boolean res = reply.readInt() != 0;
4027 data.recycle();
4028 reply.recycle();
4029 return res;
4030 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004031 public boolean testIsSystemReady()
4032 {
4033 /* this base class version is never called */
4034 return true;
4035 }
Dan Egnor60d87622009-12-16 16:32:58 -08004036 public void handleApplicationCrash(IBinder app,
4037 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4038 {
4039 Parcel data = Parcel.obtain();
4040 Parcel reply = Parcel.obtain();
4041 data.writeInterfaceToken(IActivityManager.descriptor);
4042 data.writeStrongBinder(app);
4043 crashInfo.writeToParcel(data, 0);
4044 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4045 reply.readException();
4046 reply.recycle();
4047 data.recycle();
4048 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004049
Dan Egnor60d87622009-12-16 16:32:58 -08004050 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08004051 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004052 {
4053 Parcel data = Parcel.obtain();
4054 Parcel reply = Parcel.obtain();
4055 data.writeInterfaceToken(IActivityManager.descriptor);
4056 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004057 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08004058 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004059 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004060 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004061 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004062 reply.recycle();
4063 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004064 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004065 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004066
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004067 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004068 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004069 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004070 {
4071 Parcel data = Parcel.obtain();
4072 Parcel reply = Parcel.obtain();
4073 data.writeInterfaceToken(IActivityManager.descriptor);
4074 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004075 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004076 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004077 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4078 reply.readException();
4079 reply.recycle();
4080 data.recycle();
4081 }
4082
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004083 public void signalPersistentProcesses(int sig) throws RemoteException {
4084 Parcel data = Parcel.obtain();
4085 Parcel reply = Parcel.obtain();
4086 data.writeInterfaceToken(IActivityManager.descriptor);
4087 data.writeInt(sig);
4088 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4089 reply.readException();
4090 data.recycle();
4091 reply.recycle();
4092 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004093
Dianne Hackborn1676c852012-09-10 14:52:30 -07004094 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004095 Parcel data = Parcel.obtain();
4096 Parcel reply = Parcel.obtain();
4097 data.writeInterfaceToken(IActivityManager.descriptor);
4098 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004099 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004100 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4101 reply.readException();
4102 data.recycle();
4103 reply.recycle();
4104 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004105
4106 public void killAllBackgroundProcesses() throws RemoteException {
4107 Parcel data = Parcel.obtain();
4108 Parcel reply = Parcel.obtain();
4109 data.writeInterfaceToken(IActivityManager.descriptor);
4110 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4111 reply.readException();
4112 data.recycle();
4113 reply.recycle();
4114 }
4115
Dianne Hackborn1676c852012-09-10 14:52:30 -07004116 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004117 Parcel data = Parcel.obtain();
4118 Parcel reply = Parcel.obtain();
4119 data.writeInterfaceToken(IActivityManager.descriptor);
4120 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004121 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004122 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004123 reply.readException();
4124 data.recycle();
4125 reply.recycle();
4126 }
4127
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004128 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4129 throws RemoteException
4130 {
4131 Parcel data = Parcel.obtain();
4132 Parcel reply = Parcel.obtain();
4133 data.writeInterfaceToken(IActivityManager.descriptor);
4134 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4135 reply.readException();
4136 outInfo.readFromParcel(reply);
4137 reply.recycle();
4138 data.recycle();
4139 }
4140
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004141 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4142 {
4143 Parcel data = Parcel.obtain();
4144 Parcel reply = Parcel.obtain();
4145 data.writeInterfaceToken(IActivityManager.descriptor);
4146 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4147 reply.readException();
4148 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4149 reply.recycle();
4150 data.recycle();
4151 return res;
4152 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004153
Dianne Hackborn1676c852012-09-10 14:52:30 -07004154 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07004155 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004156 {
4157 Parcel data = Parcel.obtain();
4158 Parcel reply = Parcel.obtain();
4159 data.writeInterfaceToken(IActivityManager.descriptor);
4160 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004161 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004162 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004163 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004164 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004165 if (fd != null) {
4166 data.writeInt(1);
4167 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4168 } else {
4169 data.writeInt(0);
4170 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004171 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4172 reply.readException();
4173 boolean res = reply.readInt() != 0;
4174 reply.recycle();
4175 data.recycle();
4176 return res;
4177 }
4178
Dianne Hackborn55280a92009-05-07 15:53:46 -07004179 public boolean shutdown(int timeout) throws RemoteException
4180 {
4181 Parcel data = Parcel.obtain();
4182 Parcel reply = Parcel.obtain();
4183 data.writeInterfaceToken(IActivityManager.descriptor);
4184 data.writeInt(timeout);
4185 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4186 reply.readException();
4187 boolean res = reply.readInt() != 0;
4188 reply.recycle();
4189 data.recycle();
4190 return res;
4191 }
4192
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004193 public void stopAppSwitches() throws RemoteException {
4194 Parcel data = Parcel.obtain();
4195 Parcel reply = Parcel.obtain();
4196 data.writeInterfaceToken(IActivityManager.descriptor);
4197 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4198 reply.readException();
4199 reply.recycle();
4200 data.recycle();
4201 }
4202
4203 public void resumeAppSwitches() throws RemoteException {
4204 Parcel data = Parcel.obtain();
4205 Parcel reply = Parcel.obtain();
4206 data.writeInterfaceToken(IActivityManager.descriptor);
4207 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4208 reply.readException();
4209 reply.recycle();
4210 data.recycle();
4211 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004212
4213 public void addPackageDependency(String packageName) throws RemoteException {
4214 Parcel data = Parcel.obtain();
4215 Parcel reply = Parcel.obtain();
4216 data.writeInterfaceToken(IActivityManager.descriptor);
4217 data.writeString(packageName);
4218 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4219 reply.readException();
4220 data.recycle();
4221 reply.recycle();
4222 }
4223
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004224 public void killApplicationWithAppId(String pkg, int appid, String reason)
4225 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004226 Parcel data = Parcel.obtain();
4227 Parcel reply = Parcel.obtain();
4228 data.writeInterfaceToken(IActivityManager.descriptor);
4229 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004230 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004231 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004232 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004233 reply.readException();
4234 data.recycle();
4235 reply.recycle();
4236 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004237
4238 public void closeSystemDialogs(String reason) throws RemoteException {
4239 Parcel data = Parcel.obtain();
4240 Parcel reply = Parcel.obtain();
4241 data.writeInterfaceToken(IActivityManager.descriptor);
4242 data.writeString(reason);
4243 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4244 reply.readException();
4245 data.recycle();
4246 reply.recycle();
4247 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004248
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004249 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004250 throws RemoteException {
4251 Parcel data = Parcel.obtain();
4252 Parcel reply = Parcel.obtain();
4253 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004254 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004255 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4256 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004257 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004258 data.recycle();
4259 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004260 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004261 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004262
4263 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4264 Parcel data = Parcel.obtain();
4265 Parcel reply = Parcel.obtain();
4266 data.writeInterfaceToken(IActivityManager.descriptor);
4267 data.writeString(processName);
4268 data.writeInt(uid);
4269 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4270 reply.readException();
4271 data.recycle();
4272 reply.recycle();
4273 }
4274
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004275 public void overridePendingTransition(IBinder token, String packageName,
4276 int enterAnim, int exitAnim) throws RemoteException {
4277 Parcel data = Parcel.obtain();
4278 Parcel reply = Parcel.obtain();
4279 data.writeInterfaceToken(IActivityManager.descriptor);
4280 data.writeStrongBinder(token);
4281 data.writeString(packageName);
4282 data.writeInt(enterAnim);
4283 data.writeInt(exitAnim);
4284 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4285 reply.readException();
4286 data.recycle();
4287 reply.recycle();
4288 }
4289
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004290 public boolean isUserAMonkey() throws RemoteException {
4291 Parcel data = Parcel.obtain();
4292 Parcel reply = Parcel.obtain();
4293 data.writeInterfaceToken(IActivityManager.descriptor);
4294 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4295 reply.readException();
4296 boolean res = reply.readInt() != 0;
4297 data.recycle();
4298 reply.recycle();
4299 return res;
4300 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004301
4302 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4303 Parcel data = Parcel.obtain();
4304 Parcel reply = Parcel.obtain();
4305 data.writeInterfaceToken(IActivityManager.descriptor);
4306 data.writeInt(monkey ? 1 : 0);
4307 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4308 reply.readException();
4309 data.recycle();
4310 reply.recycle();
4311 }
4312
Dianne Hackborn860755f2010-06-03 18:47:52 -07004313 public void finishHeavyWeightApp() throws RemoteException {
4314 Parcel data = Parcel.obtain();
4315 Parcel reply = Parcel.obtain();
4316 data.writeInterfaceToken(IActivityManager.descriptor);
4317 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4318 reply.readException();
4319 data.recycle();
4320 reply.recycle();
4321 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004322
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004323 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004324 throws RemoteException {
4325 Parcel data = Parcel.obtain();
4326 Parcel reply = Parcel.obtain();
4327 data.writeInterfaceToken(IActivityManager.descriptor);
4328 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004329 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4330 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004331 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004332 data.recycle();
4333 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004334 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004335 }
4336
Craig Mautner233ceee2014-05-09 17:05:11 -07004337 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004338 throws RemoteException {
4339 Parcel data = Parcel.obtain();
4340 Parcel reply = Parcel.obtain();
4341 data.writeInterfaceToken(IActivityManager.descriptor);
4342 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004343 if (options == null) {
4344 data.writeInt(0);
4345 } else {
4346 data.writeInt(1);
4347 data.writeBundle(options.toBundle());
4348 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004349 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004350 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004351 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004352 data.recycle();
4353 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004354 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004355 }
4356
Craig Mautner233ceee2014-05-09 17:05:11 -07004357 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4358 Parcel data = Parcel.obtain();
4359 Parcel reply = Parcel.obtain();
4360 data.writeInterfaceToken(IActivityManager.descriptor);
4361 data.writeStrongBinder(token);
4362 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4363 reply.readException();
4364 Bundle bundle = reply.readBundle();
4365 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4366 data.recycle();
4367 reply.recycle();
4368 return options;
4369 }
4370
Daniel Sandler69a48172010-06-23 16:29:36 -04004371 public void setImmersive(IBinder token, boolean immersive)
4372 throws RemoteException {
4373 Parcel data = Parcel.obtain();
4374 Parcel reply = Parcel.obtain();
4375 data.writeInterfaceToken(IActivityManager.descriptor);
4376 data.writeStrongBinder(token);
4377 data.writeInt(immersive ? 1 : 0);
4378 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4379 reply.readException();
4380 data.recycle();
4381 reply.recycle();
4382 }
4383
4384 public boolean isImmersive(IBinder token)
4385 throws RemoteException {
4386 Parcel data = Parcel.obtain();
4387 Parcel reply = Parcel.obtain();
4388 data.writeInterfaceToken(IActivityManager.descriptor);
4389 data.writeStrongBinder(token);
4390 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004391 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004392 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004393 data.recycle();
4394 reply.recycle();
4395 return res;
4396 }
4397
Craig Mautnerd61dc202014-07-07 11:09:11 -07004398 public boolean isTopOfTask(IBinder token) throws RemoteException {
4399 Parcel data = Parcel.obtain();
4400 Parcel reply = Parcel.obtain();
4401 data.writeInterfaceToken(IActivityManager.descriptor);
4402 data.writeStrongBinder(token);
4403 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4404 reply.readException();
4405 boolean res = reply.readInt() == 1;
4406 data.recycle();
4407 reply.recycle();
4408 return res;
4409 }
4410
Daniel Sandler69a48172010-06-23 16:29:36 -04004411 public boolean isTopActivityImmersive()
4412 throws RemoteException {
4413 Parcel data = Parcel.obtain();
4414 Parcel reply = Parcel.obtain();
4415 data.writeInterfaceToken(IActivityManager.descriptor);
4416 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004417 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004418 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004419 data.recycle();
4420 reply.recycle();
4421 return res;
4422 }
4423
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004424 public void crashApplication(int uid, int initialPid, String packageName,
4425 String message) throws RemoteException {
4426 Parcel data = Parcel.obtain();
4427 Parcel reply = Parcel.obtain();
4428 data.writeInterfaceToken(IActivityManager.descriptor);
4429 data.writeInt(uid);
4430 data.writeInt(initialPid);
4431 data.writeString(packageName);
4432 data.writeString(message);
4433 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4434 reply.readException();
4435 data.recycle();
4436 reply.recycle();
4437 }
Andy McFadden824c5102010-07-09 16:26:57 -07004438
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004439 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004440 Parcel data = Parcel.obtain();
4441 Parcel reply = Parcel.obtain();
4442 data.writeInterfaceToken(IActivityManager.descriptor);
4443 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004444 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004445 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4446 reply.readException();
4447 String res = reply.readString();
4448 data.recycle();
4449 reply.recycle();
4450 return res;
4451 }
4452
Dianne Hackborn7e269642010-08-25 19:50:20 -07004453 public IBinder newUriPermissionOwner(String name)
4454 throws RemoteException {
4455 Parcel data = Parcel.obtain();
4456 Parcel reply = Parcel.obtain();
4457 data.writeInterfaceToken(IActivityManager.descriptor);
4458 data.writeString(name);
4459 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4460 reply.readException();
4461 IBinder res = reply.readStrongBinder();
4462 data.recycle();
4463 reply.recycle();
4464 return res;
4465 }
4466
4467 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004468 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004469 Parcel data = Parcel.obtain();
4470 Parcel reply = Parcel.obtain();
4471 data.writeInterfaceToken(IActivityManager.descriptor);
4472 data.writeStrongBinder(owner);
4473 data.writeInt(fromUid);
4474 data.writeString(targetPkg);
4475 uri.writeToParcel(data, 0);
4476 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004477 data.writeInt(sourceUserId);
4478 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004479 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4480 reply.readException();
4481 data.recycle();
4482 reply.recycle();
4483 }
4484
4485 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004486 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004487 Parcel data = Parcel.obtain();
4488 Parcel reply = Parcel.obtain();
4489 data.writeInterfaceToken(IActivityManager.descriptor);
4490 data.writeStrongBinder(owner);
4491 if (uri != null) {
4492 data.writeInt(1);
4493 uri.writeToParcel(data, 0);
4494 } else {
4495 data.writeInt(0);
4496 }
4497 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004498 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004499 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4500 reply.readException();
4501 data.recycle();
4502 reply.recycle();
4503 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004504
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004505 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004506 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004507 Parcel data = Parcel.obtain();
4508 Parcel reply = Parcel.obtain();
4509 data.writeInterfaceToken(IActivityManager.descriptor);
4510 data.writeInt(callingUid);
4511 data.writeString(targetPkg);
4512 uri.writeToParcel(data, 0);
4513 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004514 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004515 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4516 reply.readException();
4517 int res = reply.readInt();
4518 data.recycle();
4519 reply.recycle();
4520 return res;
4521 }
4522
Dianne Hackborn1676c852012-09-10 14:52:30 -07004523 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004524 String path, ParcelFileDescriptor fd) throws RemoteException {
4525 Parcel data = Parcel.obtain();
4526 Parcel reply = Parcel.obtain();
4527 data.writeInterfaceToken(IActivityManager.descriptor);
4528 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004529 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004530 data.writeInt(managed ? 1 : 0);
4531 data.writeString(path);
4532 if (fd != null) {
4533 data.writeInt(1);
4534 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4535 } else {
4536 data.writeInt(0);
4537 }
4538 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4539 reply.readException();
4540 boolean res = reply.readInt() != 0;
4541 reply.recycle();
4542 data.recycle();
4543 return res;
4544 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004545
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004546 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004547 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004548 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004549 Parcel data = Parcel.obtain();
4550 Parcel reply = Parcel.obtain();
4551 data.writeInterfaceToken(IActivityManager.descriptor);
4552 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004553 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004554 data.writeTypedArray(intents, 0);
4555 data.writeStringArray(resolvedTypes);
4556 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004557 if (options != null) {
4558 data.writeInt(1);
4559 options.writeToParcel(data, 0);
4560 } else {
4561 data.writeInt(0);
4562 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004563 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004564 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4565 reply.readException();
4566 int result = reply.readInt();
4567 reply.recycle();
4568 data.recycle();
4569 return result;
4570 }
4571
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004572 public int getFrontActivityScreenCompatMode() throws RemoteException {
4573 Parcel data = Parcel.obtain();
4574 Parcel reply = Parcel.obtain();
4575 data.writeInterfaceToken(IActivityManager.descriptor);
4576 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4577 reply.readException();
4578 int mode = reply.readInt();
4579 reply.recycle();
4580 data.recycle();
4581 return mode;
4582 }
4583
4584 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4585 Parcel data = Parcel.obtain();
4586 Parcel reply = Parcel.obtain();
4587 data.writeInterfaceToken(IActivityManager.descriptor);
4588 data.writeInt(mode);
4589 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4590 reply.readException();
4591 reply.recycle();
4592 data.recycle();
4593 }
4594
4595 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4596 Parcel data = Parcel.obtain();
4597 Parcel reply = Parcel.obtain();
4598 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004599 data.writeString(packageName);
4600 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004601 reply.readException();
4602 int mode = reply.readInt();
4603 reply.recycle();
4604 data.recycle();
4605 return mode;
4606 }
4607
4608 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004609 throws RemoteException {
4610 Parcel data = Parcel.obtain();
4611 Parcel reply = Parcel.obtain();
4612 data.writeInterfaceToken(IActivityManager.descriptor);
4613 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004614 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004615 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4616 reply.readException();
4617 reply.recycle();
4618 data.recycle();
4619 }
4620
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004621 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4622 Parcel data = Parcel.obtain();
4623 Parcel reply = Parcel.obtain();
4624 data.writeInterfaceToken(IActivityManager.descriptor);
4625 data.writeString(packageName);
4626 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4627 reply.readException();
4628 boolean ask = reply.readInt() != 0;
4629 reply.recycle();
4630 data.recycle();
4631 return ask;
4632 }
4633
4634 public void setPackageAskScreenCompat(String packageName, boolean ask)
4635 throws RemoteException {
4636 Parcel data = Parcel.obtain();
4637 Parcel reply = Parcel.obtain();
4638 data.writeInterfaceToken(IActivityManager.descriptor);
4639 data.writeString(packageName);
4640 data.writeInt(ask ? 1 : 0);
4641 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4642 reply.readException();
4643 reply.recycle();
4644 data.recycle();
4645 }
4646
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004647 public boolean switchUser(int userid) throws RemoteException {
4648 Parcel data = Parcel.obtain();
4649 Parcel reply = Parcel.obtain();
4650 data.writeInterfaceToken(IActivityManager.descriptor);
4651 data.writeInt(userid);
4652 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4653 reply.readException();
4654 boolean result = reply.readInt() != 0;
4655 reply.recycle();
4656 data.recycle();
4657 return result;
4658 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004659
Kenny Guy08488bf2014-02-21 17:40:37 +00004660 public boolean startUserInBackground(int userid) throws RemoteException {
4661 Parcel data = Parcel.obtain();
4662 Parcel reply = Parcel.obtain();
4663 data.writeInterfaceToken(IActivityManager.descriptor);
4664 data.writeInt(userid);
4665 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4666 reply.readException();
4667 boolean result = reply.readInt() != 0;
4668 reply.recycle();
4669 data.recycle();
4670 return result;
4671 }
4672
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004673 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4674 Parcel data = Parcel.obtain();
4675 Parcel reply = Parcel.obtain();
4676 data.writeInterfaceToken(IActivityManager.descriptor);
4677 data.writeInt(userid);
4678 data.writeStrongInterface(callback);
4679 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4680 reply.readException();
4681 int result = reply.readInt();
4682 reply.recycle();
4683 data.recycle();
4684 return result;
4685 }
4686
Amith Yamasani52f1d752012-03-28 18:19:29 -07004687 public UserInfo getCurrentUser() throws RemoteException {
4688 Parcel data = Parcel.obtain();
4689 Parcel reply = Parcel.obtain();
4690 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004691 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004692 reply.readException();
4693 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4694 reply.recycle();
4695 data.recycle();
4696 return userInfo;
4697 }
4698
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004699 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004700 Parcel data = Parcel.obtain();
4701 Parcel reply = Parcel.obtain();
4702 data.writeInterfaceToken(IActivityManager.descriptor);
4703 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004704 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004705 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4706 reply.readException();
4707 boolean result = reply.readInt() != 0;
4708 reply.recycle();
4709 data.recycle();
4710 return result;
4711 }
4712
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004713 public int[] getRunningUserIds() throws RemoteException {
4714 Parcel data = Parcel.obtain();
4715 Parcel reply = Parcel.obtain();
4716 data.writeInterfaceToken(IActivityManager.descriptor);
4717 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4718 reply.readException();
4719 int[] result = reply.createIntArray();
4720 reply.recycle();
4721 data.recycle();
4722 return result;
4723 }
4724
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004725 public boolean removeTask(int taskId, int flags) throws RemoteException {
4726 Parcel data = Parcel.obtain();
4727 Parcel reply = Parcel.obtain();
4728 data.writeInterfaceToken(IActivityManager.descriptor);
4729 data.writeInt(taskId);
4730 data.writeInt(flags);
4731 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4732 reply.readException();
4733 boolean result = reply.readInt() != 0;
4734 reply.recycle();
4735 data.recycle();
4736 return result;
4737 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004738
Jeff Sharkeya4620792011-05-20 15:29:23 -07004739 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4740 Parcel data = Parcel.obtain();
4741 Parcel reply = Parcel.obtain();
4742 data.writeInterfaceToken(IActivityManager.descriptor);
4743 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4744 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4745 reply.readException();
4746 data.recycle();
4747 reply.recycle();
4748 }
4749
4750 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4751 Parcel data = Parcel.obtain();
4752 Parcel reply = Parcel.obtain();
4753 data.writeInterfaceToken(IActivityManager.descriptor);
4754 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4755 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4756 reply.readException();
4757 data.recycle();
4758 reply.recycle();
4759 }
4760
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004761 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4762 Parcel data = Parcel.obtain();
4763 Parcel reply = Parcel.obtain();
4764 data.writeInterfaceToken(IActivityManager.descriptor);
4765 data.writeStrongBinder(sender.asBinder());
4766 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4767 reply.readException();
4768 boolean res = reply.readInt() != 0;
4769 data.recycle();
4770 reply.recycle();
4771 return res;
4772 }
4773
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004774 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4775 Parcel data = Parcel.obtain();
4776 Parcel reply = Parcel.obtain();
4777 data.writeInterfaceToken(IActivityManager.descriptor);
4778 data.writeStrongBinder(sender.asBinder());
4779 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4780 reply.readException();
4781 boolean res = reply.readInt() != 0;
4782 data.recycle();
4783 reply.recycle();
4784 return res;
4785 }
4786
Dianne Hackborn81038902012-11-26 17:04:09 -08004787 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4788 Parcel data = Parcel.obtain();
4789 Parcel reply = Parcel.obtain();
4790 data.writeInterfaceToken(IActivityManager.descriptor);
4791 data.writeStrongBinder(sender.asBinder());
4792 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4793 reply.readException();
4794 Intent res = reply.readInt() != 0
4795 ? Intent.CREATOR.createFromParcel(reply) : null;
4796 data.recycle();
4797 reply.recycle();
4798 return res;
4799 }
4800
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004801 public String getTagForIntentSender(IIntentSender sender, String prefix)
4802 throws RemoteException {
4803 Parcel data = Parcel.obtain();
4804 Parcel reply = Parcel.obtain();
4805 data.writeInterfaceToken(IActivityManager.descriptor);
4806 data.writeStrongBinder(sender.asBinder());
4807 data.writeString(prefix);
4808 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4809 reply.readException();
4810 String res = reply.readString();
4811 data.recycle();
4812 reply.recycle();
4813 return res;
4814 }
4815
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004816 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4817 {
4818 Parcel data = Parcel.obtain();
4819 Parcel reply = Parcel.obtain();
4820 data.writeInterfaceToken(IActivityManager.descriptor);
4821 values.writeToParcel(data, 0);
4822 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4823 reply.readException();
4824 data.recycle();
4825 reply.recycle();
4826 }
4827
Dianne Hackbornb437e092011-08-05 17:50:29 -07004828 public long[] getProcessPss(int[] pids) throws RemoteException {
4829 Parcel data = Parcel.obtain();
4830 Parcel reply = Parcel.obtain();
4831 data.writeInterfaceToken(IActivityManager.descriptor);
4832 data.writeIntArray(pids);
4833 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4834 reply.readException();
4835 long[] res = reply.createLongArray();
4836 data.recycle();
4837 reply.recycle();
4838 return res;
4839 }
4840
Dianne Hackborn661cd522011-08-22 00:26:20 -07004841 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4842 Parcel data = Parcel.obtain();
4843 Parcel reply = Parcel.obtain();
4844 data.writeInterfaceToken(IActivityManager.descriptor);
4845 TextUtils.writeToParcel(msg, data, 0);
4846 data.writeInt(always ? 1 : 0);
4847 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4848 reply.readException();
4849 data.recycle();
4850 reply.recycle();
4851 }
4852
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004853 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004854 Parcel data = Parcel.obtain();
4855 Parcel reply = Parcel.obtain();
4856 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004857 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004858 reply.readException();
4859 data.recycle();
4860 reply.recycle();
4861 }
4862
Adam Powelldd8fab22012-03-22 17:47:27 -07004863 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4864 throws RemoteException {
4865 Parcel data = Parcel.obtain();
4866 Parcel reply = Parcel.obtain();
4867 data.writeInterfaceToken(IActivityManager.descriptor);
4868 data.writeStrongBinder(token);
4869 data.writeString(destAffinity);
4870 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4871 reply.readException();
4872 boolean result = reply.readInt() != 0;
4873 data.recycle();
4874 reply.recycle();
4875 return result;
4876 }
4877
4878 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4879 throws RemoteException {
4880 Parcel data = Parcel.obtain();
4881 Parcel reply = Parcel.obtain();
4882 data.writeInterfaceToken(IActivityManager.descriptor);
4883 data.writeStrongBinder(token);
4884 target.writeToParcel(data, 0);
4885 data.writeInt(resultCode);
4886 if (resultData != null) {
4887 data.writeInt(1);
4888 resultData.writeToParcel(data, 0);
4889 } else {
4890 data.writeInt(0);
4891 }
4892 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4893 reply.readException();
4894 boolean result = reply.readInt() != 0;
4895 data.recycle();
4896 reply.recycle();
4897 return result;
4898 }
4899
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004900 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4901 Parcel data = Parcel.obtain();
4902 Parcel reply = Parcel.obtain();
4903 data.writeInterfaceToken(IActivityManager.descriptor);
4904 data.writeStrongBinder(activityToken);
4905 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4906 reply.readException();
4907 int result = reply.readInt();
4908 data.recycle();
4909 reply.recycle();
4910 return result;
4911 }
4912
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004913 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4914 Parcel data = Parcel.obtain();
4915 Parcel reply = Parcel.obtain();
4916 data.writeInterfaceToken(IActivityManager.descriptor);
4917 data.writeStrongBinder(activityToken);
4918 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4919 reply.readException();
4920 String result = reply.readString();
4921 data.recycle();
4922 reply.recycle();
4923 return result;
4924 }
4925
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004926 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4927 Parcel data = Parcel.obtain();
4928 Parcel reply = Parcel.obtain();
4929 data.writeInterfaceToken(IActivityManager.descriptor);
4930 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4931 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4932 reply.readException();
4933 data.recycle();
4934 reply.recycle();
4935 }
4936
4937 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4938 Parcel data = Parcel.obtain();
4939 Parcel reply = Parcel.obtain();
4940 data.writeInterfaceToken(IActivityManager.descriptor);
4941 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4942 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4943 reply.readException();
4944 data.recycle();
4945 reply.recycle();
4946 }
4947
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004948 public void requestBugReport() throws RemoteException {
4949 Parcel data = Parcel.obtain();
4950 Parcel reply = Parcel.obtain();
4951 data.writeInterfaceToken(IActivityManager.descriptor);
4952 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4953 reply.readException();
4954 data.recycle();
4955 reply.recycle();
4956 }
4957
Jeff Brownbd181bb2013-09-10 16:44:24 -07004958 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4959 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004960 Parcel data = Parcel.obtain();
4961 Parcel reply = Parcel.obtain();
4962 data.writeInterfaceToken(IActivityManager.descriptor);
4963 data.writeInt(pid);
4964 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004965 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004966 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4967 reply.readException();
4968 long res = reply.readInt();
4969 data.recycle();
4970 reply.recycle();
4971 return res;
4972 }
4973
Adam Skorydfc7fd72013-08-05 19:23:41 -07004974 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004975 Parcel data = Parcel.obtain();
4976 Parcel reply = Parcel.obtain();
4977 data.writeInterfaceToken(IActivityManager.descriptor);
4978 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004979 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004980 reply.readException();
4981 Bundle res = reply.readBundle();
4982 data.recycle();
4983 reply.recycle();
4984 return res;
4985 }
4986
Adam Skory7140a252013-09-11 12:04:58 +01004987 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004988 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004989 Parcel data = Parcel.obtain();
4990 Parcel reply = Parcel.obtain();
4991 data.writeInterfaceToken(IActivityManager.descriptor);
4992 data.writeStrongBinder(token);
4993 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004994 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004995 reply.readException();
4996 data.recycle();
4997 reply.recycle();
4998 }
4999
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005000 public void killUid(int uid, String reason) throws RemoteException {
5001 Parcel data = Parcel.obtain();
5002 Parcel reply = Parcel.obtain();
5003 data.writeInterfaceToken(IActivityManager.descriptor);
5004 data.writeInt(uid);
5005 data.writeString(reason);
5006 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5007 reply.readException();
5008 data.recycle();
5009 reply.recycle();
5010 }
5011
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005012 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5013 Parcel data = Parcel.obtain();
5014 Parcel reply = Parcel.obtain();
5015 data.writeInterfaceToken(IActivityManager.descriptor);
5016 data.writeStrongBinder(who);
5017 data.writeInt(allowRestart ? 1 : 0);
5018 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5019 reply.readException();
5020 data.recycle();
5021 reply.recycle();
5022 }
5023
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005024 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5025 Parcel data = Parcel.obtain();
5026 Parcel reply = Parcel.obtain();
5027 data.writeInterfaceToken(IActivityManager.descriptor);
5028 data.writeStrongBinder(token);
5029 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5030 reply.readException();
5031 data.recycle();
5032 reply.recycle();
5033 }
5034
Craig Mautner5eda9b32013-07-02 11:58:16 -07005035 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5036 Parcel data = Parcel.obtain();
5037 Parcel reply = Parcel.obtain();
5038 data.writeInterfaceToken(IActivityManager.descriptor);
5039 data.writeStrongBinder(token);
5040 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5041 reply.readException();
5042 data.recycle();
5043 reply.recycle();
5044 }
5045
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005046 public void restart() throws RemoteException {
5047 Parcel data = Parcel.obtain();
5048 Parcel reply = Parcel.obtain();
5049 data.writeInterfaceToken(IActivityManager.descriptor);
5050 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5051 reply.readException();
5052 data.recycle();
5053 reply.recycle();
5054 }
5055
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005056 public void performIdleMaintenance() throws RemoteException {
5057 Parcel data = Parcel.obtain();
5058 Parcel reply = Parcel.obtain();
5059 data.writeInterfaceToken(IActivityManager.descriptor);
5060 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5061 reply.readException();
5062 data.recycle();
5063 reply.recycle();
5064 }
5065
Craig Mautner4a1cb222013-12-04 16:14:06 -08005066 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
5067 IActivityContainerCallback callback) throws RemoteException {
5068 Parcel data = Parcel.obtain();
5069 Parcel reply = Parcel.obtain();
5070 data.writeInterfaceToken(IActivityManager.descriptor);
5071 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005072 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08005073 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5074 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005075 final int result = reply.readInt();
5076 final IActivityContainer res;
5077 if (result == 1) {
5078 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5079 } else {
5080 res = null;
5081 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005082 data.recycle();
5083 reply.recycle();
5084 return res;
5085 }
5086
Craig Mautner95da1082014-02-24 17:54:35 -08005087 public void deleteActivityContainer(IActivityContainer activityContainer)
5088 throws RemoteException {
5089 Parcel data = Parcel.obtain();
5090 Parcel reply = Parcel.obtain();
5091 data.writeInterfaceToken(IActivityManager.descriptor);
5092 data.writeStrongBinder(activityContainer.asBinder());
5093 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5094 reply.readException();
5095 data.recycle();
5096 reply.recycle();
5097 }
5098
Craig Mautnere0a38842013-12-16 16:14:02 -08005099 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
5100 throws RemoteException {
5101 Parcel data = Parcel.obtain();
5102 Parcel reply = Parcel.obtain();
5103 data.writeInterfaceToken(IActivityManager.descriptor);
5104 data.writeStrongBinder(activityToken);
5105 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5106 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005107 final int result = reply.readInt();
5108 final IActivityContainer res;
5109 if (result == 1) {
5110 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5111 } else {
5112 res = null;
5113 }
Craig Mautnere0a38842013-12-16 16:14:02 -08005114 data.recycle();
5115 reply.recycle();
5116 return res;
5117 }
5118
Craig Mautner4a1cb222013-12-04 16:14:06 -08005119 public IBinder getHomeActivityToken() throws RemoteException {
5120 Parcel data = Parcel.obtain();
5121 Parcel reply = Parcel.obtain();
5122 data.writeInterfaceToken(IActivityManager.descriptor);
5123 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5124 reply.readException();
5125 IBinder res = reply.readStrongBinder();
5126 data.recycle();
5127 reply.recycle();
5128 return res;
5129 }
5130
Craig Mautneraea74a52014-03-08 14:23:10 -08005131 @Override
5132 public void startLockTaskMode(int taskId) throws RemoteException {
5133 Parcel data = Parcel.obtain();
5134 Parcel reply = Parcel.obtain();
5135 data.writeInterfaceToken(IActivityManager.descriptor);
5136 data.writeInt(taskId);
5137 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5138 reply.readException();
5139 data.recycle();
5140 reply.recycle();
5141 }
5142
5143 @Override
5144 public void startLockTaskMode(IBinder token) throws RemoteException {
5145 Parcel data = Parcel.obtain();
5146 Parcel reply = Parcel.obtain();
5147 data.writeInterfaceToken(IActivityManager.descriptor);
5148 data.writeStrongBinder(token);
5149 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5150 reply.readException();
5151 data.recycle();
5152 reply.recycle();
5153 }
5154
5155 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005156 public void startLockTaskModeOnCurrent() throws RemoteException {
5157 Parcel data = Parcel.obtain();
5158 Parcel reply = Parcel.obtain();
5159 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005160 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005161 reply.readException();
5162 data.recycle();
5163 reply.recycle();
5164 }
5165
5166 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005167 public void stopLockTaskMode() throws RemoteException {
5168 Parcel data = Parcel.obtain();
5169 Parcel reply = Parcel.obtain();
5170 data.writeInterfaceToken(IActivityManager.descriptor);
5171 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5172 reply.readException();
5173 data.recycle();
5174 reply.recycle();
5175 }
5176
5177 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005178 public void stopLockTaskModeOnCurrent() throws RemoteException {
5179 Parcel data = Parcel.obtain();
5180 Parcel reply = Parcel.obtain();
5181 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005182 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005183 reply.readException();
5184 data.recycle();
5185 reply.recycle();
5186 }
5187
5188 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005189 public boolean isInLockTaskMode() throws RemoteException {
5190 Parcel data = Parcel.obtain();
5191 Parcel reply = Parcel.obtain();
5192 data.writeInterfaceToken(IActivityManager.descriptor);
5193 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5194 reply.readException();
5195 boolean isInLockTaskMode = reply.readInt() == 1;
5196 data.recycle();
5197 reply.recycle();
5198 return isInLockTaskMode;
5199 }
5200
Craig Mautner688b5102014-03-27 16:55:03 -07005201 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005202 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005203 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005204 Parcel data = Parcel.obtain();
5205 Parcel reply = Parcel.obtain();
5206 data.writeInterfaceToken(IActivityManager.descriptor);
5207 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005208 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005209 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005210 reply.readException();
5211 data.recycle();
5212 reply.recycle();
5213 }
5214
Craig Mautneree2e45a2014-06-27 12:10:03 -07005215 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005216 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005217 Parcel data = Parcel.obtain();
5218 Parcel reply = Parcel.obtain();
5219 data.writeInterfaceToken(IActivityManager.descriptor);
5220 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005221 data.writeInt(visible ? 1 : 0);
5222 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005223 reply.readException();
5224 boolean success = reply.readInt() > 0;
5225 data.recycle();
5226 reply.recycle();
5227 return success;
5228 }
5229
5230 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005231 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005232 Parcel data = Parcel.obtain();
5233 Parcel reply = Parcel.obtain();
5234 data.writeInterfaceToken(IActivityManager.descriptor);
5235 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005236 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005237 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005238 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005239 data.recycle();
5240 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005241 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005242 }
5243
5244 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005245 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005246 Parcel data = Parcel.obtain();
5247 Parcel reply = Parcel.obtain();
5248 data.writeInterfaceToken(IActivityManager.descriptor);
5249 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005250 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5251 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005252 reply.readException();
5253 data.recycle();
5254 reply.recycle();
5255 }
5256
5257 @Override
5258 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5259 Parcel data = Parcel.obtain();
5260 Parcel reply = Parcel.obtain();
5261 data.writeInterfaceToken(IActivityManager.descriptor);
5262 data.writeStrongBinder(token);
5263 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5264 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005265 reply.readException();
5266 data.recycle();
5267 reply.recycle();
5268 }
5269
Craig Mautner8746a472014-07-24 15:12:54 -07005270 @Override
5271 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5272 Parcel data = Parcel.obtain();
5273 Parcel reply = Parcel.obtain();
5274 data.writeInterfaceToken(IActivityManager.descriptor);
5275 data.writeStrongBinder(token);
5276 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5277 IBinder.FLAG_ONEWAY);
5278 reply.readException();
5279 data.recycle();
5280 reply.recycle();
5281 }
5282
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005283 private IBinder mRemote;
5284}