blob: 3dafa4bedd7852efd0996d2c4eab672ac6aaf6b3 [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);
557 List<IAppTask> list = getAppTasks();
558 reply.writeNoException();
559 int N = list != null ? list.size() : -1;
560 reply.writeInt(N);
561 int i;
562 for (i=0; i<N; i++) {
563 IAppTask task = list.get(i);
564 reply.writeStrongBinder(task.asBinder());
565 }
566 return true;
567 }
568
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700569 case ADD_APP_TASK_TRANSACTION: {
570 data.enforceInterface(IActivityManager.descriptor);
571 IBinder activityToken = data.readStrongBinder();
572 Intent intent = Intent.CREATOR.createFromParcel(data);
573 ActivityManager.TaskDescription descr
574 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
575 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
576 int res = addAppTask(activityToken, intent, descr, thumbnail);
577 reply.writeNoException();
578 reply.writeInt(res);
579 return true;
580 }
581
582 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
583 data.enforceInterface(IActivityManager.descriptor);
584 Point size = getAppTaskThumbnailSize();
585 reply.writeNoException();
586 size.writeToParcel(reply, 0);
587 return true;
588 }
589
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800590 case GET_TASKS_TRANSACTION: {
591 data.enforceInterface(IActivityManager.descriptor);
592 int maxNum = data.readInt();
593 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700594 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800595 reply.writeNoException();
596 int N = list != null ? list.size() : -1;
597 reply.writeInt(N);
598 int i;
599 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700600 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800601 info.writeToParcel(reply, 0);
602 }
603 return true;
604 }
605
606 case GET_RECENT_TASKS_TRANSACTION: {
607 data.enforceInterface(IActivityManager.descriptor);
608 int maxNum = data.readInt();
609 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700610 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800611 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700612 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800613 reply.writeNoException();
614 reply.writeTypedList(list);
615 return true;
616 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700617
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700618 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800619 data.enforceInterface(IActivityManager.descriptor);
620 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700621 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800622 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700623 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800624 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700625 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700626 } else {
627 reply.writeInt(0);
628 }
629 return true;
630 }
631
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800632 case GET_SERVICES_TRANSACTION: {
633 data.enforceInterface(IActivityManager.descriptor);
634 int maxNum = data.readInt();
635 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700636 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800637 reply.writeNoException();
638 int N = list != null ? list.size() : -1;
639 reply.writeInt(N);
640 int i;
641 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700642 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800643 info.writeToParcel(reply, 0);
644 }
645 return true;
646 }
647
648 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
649 data.enforceInterface(IActivityManager.descriptor);
650 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
651 reply.writeNoException();
652 reply.writeTypedList(list);
653 return true;
654 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700655
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800656 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
657 data.enforceInterface(IActivityManager.descriptor);
658 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
659 reply.writeNoException();
660 reply.writeTypedList(list);
661 return true;
662 }
663
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700664 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
665 data.enforceInterface(IActivityManager.descriptor);
666 List<ApplicationInfo> list = getRunningExternalApplications();
667 reply.writeNoException();
668 reply.writeTypedList(list);
669 return true;
670 }
671
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800672 case MOVE_TASK_TO_FRONT_TRANSACTION: {
673 data.enforceInterface(IActivityManager.descriptor);
674 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800675 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700676 Bundle options = data.readInt() != 0
677 ? Bundle.CREATOR.createFromParcel(data) : null;
678 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800679 reply.writeNoException();
680 return true;
681 }
682
683 case MOVE_TASK_TO_BACK_TRANSACTION: {
684 data.enforceInterface(IActivityManager.descriptor);
685 int task = data.readInt();
686 moveTaskToBack(task);
687 reply.writeNoException();
688 return true;
689 }
690
691 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
692 data.enforceInterface(IActivityManager.descriptor);
693 IBinder token = data.readStrongBinder();
694 boolean nonRoot = data.readInt() != 0;
695 boolean res = moveActivityTaskToBack(token, nonRoot);
696 reply.writeNoException();
697 reply.writeInt(res ? 1 : 0);
698 return true;
699 }
700
701 case MOVE_TASK_BACKWARDS_TRANSACTION: {
702 data.enforceInterface(IActivityManager.descriptor);
703 int task = data.readInt();
704 moveTaskBackwards(task);
705 reply.writeNoException();
706 return true;
707 }
708
Craig Mautnerc00204b2013-03-05 15:02:14 -0800709 case MOVE_TASK_TO_STACK_TRANSACTION: {
710 data.enforceInterface(IActivityManager.descriptor);
711 int taskId = data.readInt();
712 int stackId = data.readInt();
713 boolean toTop = data.readInt() != 0;
714 moveTaskToStack(taskId, stackId, toTop);
715 reply.writeNoException();
716 return true;
717 }
718
719 case RESIZE_STACK_TRANSACTION: {
720 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800721 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800722 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800723 Rect r = Rect.CREATOR.createFromParcel(data);
724 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800725 reply.writeNoException();
726 return true;
727 }
728
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800729 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700730 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800731 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700732 reply.writeNoException();
733 reply.writeTypedList(list);
734 return true;
735 }
736
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800737 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700738 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800739 int stackId = data.readInt();
740 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700741 reply.writeNoException();
742 if (info != null) {
743 reply.writeInt(1);
744 info.writeToParcel(reply, 0);
745 } else {
746 reply.writeInt(0);
747 }
748 return true;
749 }
750
Winson Chung303e1ff2014-03-07 15:06:19 -0800751 case IS_IN_HOME_STACK_TRANSACTION: {
752 data.enforceInterface(IActivityManager.descriptor);
753 int taskId = data.readInt();
754 boolean isInHomeStack = isInHomeStack(taskId);
755 reply.writeNoException();
756 reply.writeInt(isInHomeStack ? 1 : 0);
757 return true;
758 }
759
Craig Mautnercf910b02013-04-23 11:23:27 -0700760 case SET_FOCUSED_STACK_TRANSACTION: {
761 data.enforceInterface(IActivityManager.descriptor);
762 int stackId = data.readInt();
763 setFocusedStack(stackId);
764 reply.writeNoException();
765 return true;
766 }
767
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800768 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 IBinder token = data.readStrongBinder();
771 boolean onlyRoot = data.readInt() != 0;
772 int res = token != null
773 ? getTaskForActivity(token, onlyRoot) : -1;
774 reply.writeNoException();
775 reply.writeInt(res);
776 return true;
777 }
778
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800779 case GET_CONTENT_PROVIDER_TRANSACTION: {
780 data.enforceInterface(IActivityManager.descriptor);
781 IBinder b = data.readStrongBinder();
782 IApplicationThread app = ApplicationThreadNative.asInterface(b);
783 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700784 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700785 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700786 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800787 reply.writeNoException();
788 if (cph != null) {
789 reply.writeInt(1);
790 cph.writeToParcel(reply, 0);
791 } else {
792 reply.writeInt(0);
793 }
794 return true;
795 }
796
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800797 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
798 data.enforceInterface(IActivityManager.descriptor);
799 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700800 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800801 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700802 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800803 reply.writeNoException();
804 if (cph != null) {
805 reply.writeInt(1);
806 cph.writeToParcel(reply, 0);
807 } else {
808 reply.writeInt(0);
809 }
810 return true;
811 }
812
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800813 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
814 data.enforceInterface(IActivityManager.descriptor);
815 IBinder b = data.readStrongBinder();
816 IApplicationThread app = ApplicationThreadNative.asInterface(b);
817 ArrayList<ContentProviderHolder> providers =
818 data.createTypedArrayList(ContentProviderHolder.CREATOR);
819 publishContentProviders(app, providers);
820 reply.writeNoException();
821 return true;
822 }
823
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700824 case REF_CONTENT_PROVIDER_TRANSACTION: {
825 data.enforceInterface(IActivityManager.descriptor);
826 IBinder b = data.readStrongBinder();
827 int stable = data.readInt();
828 int unstable = data.readInt();
829 boolean res = refContentProvider(b, stable, unstable);
830 reply.writeNoException();
831 reply.writeInt(res ? 1 : 0);
832 return true;
833 }
834
835 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
836 data.enforceInterface(IActivityManager.descriptor);
837 IBinder b = data.readStrongBinder();
838 unstableProviderDied(b);
839 reply.writeNoException();
840 return true;
841 }
842
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700843 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
844 data.enforceInterface(IActivityManager.descriptor);
845 IBinder b = data.readStrongBinder();
846 appNotRespondingViaProvider(b);
847 reply.writeNoException();
848 return true;
849 }
850
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800851 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
852 data.enforceInterface(IActivityManager.descriptor);
853 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700854 boolean stable = data.readInt() != 0;
855 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800856 reply.writeNoException();
857 return true;
858 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800859
860 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
861 data.enforceInterface(IActivityManager.descriptor);
862 String name = data.readString();
863 IBinder token = data.readStrongBinder();
864 removeContentProviderExternal(name, token);
865 reply.writeNoException();
866 return true;
867 }
868
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700869 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
870 data.enforceInterface(IActivityManager.descriptor);
871 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
872 PendingIntent pi = getRunningServiceControlPanel(comp);
873 reply.writeNoException();
874 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
875 return true;
876 }
877
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800878 case START_SERVICE_TRANSACTION: {
879 data.enforceInterface(IActivityManager.descriptor);
880 IBinder b = data.readStrongBinder();
881 IApplicationThread app = ApplicationThreadNative.asInterface(b);
882 Intent service = Intent.CREATOR.createFromParcel(data);
883 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700884 int userId = data.readInt();
885 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800886 reply.writeNoException();
887 ComponentName.writeToParcel(cn, reply);
888 return true;
889 }
890
891 case STOP_SERVICE_TRANSACTION: {
892 data.enforceInterface(IActivityManager.descriptor);
893 IBinder b = data.readStrongBinder();
894 IApplicationThread app = ApplicationThreadNative.asInterface(b);
895 Intent service = Intent.CREATOR.createFromParcel(data);
896 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700897 int userId = data.readInt();
898 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800899 reply.writeNoException();
900 reply.writeInt(res);
901 return true;
902 }
903
904 case STOP_SERVICE_TOKEN_TRANSACTION: {
905 data.enforceInterface(IActivityManager.descriptor);
906 ComponentName className = ComponentName.readFromParcel(data);
907 IBinder token = data.readStrongBinder();
908 int startId = data.readInt();
909 boolean res = stopServiceToken(className, token, startId);
910 reply.writeNoException();
911 reply.writeInt(res ? 1 : 0);
912 return true;
913 }
914
915 case SET_SERVICE_FOREGROUND_TRANSACTION: {
916 data.enforceInterface(IActivityManager.descriptor);
917 ComponentName className = ComponentName.readFromParcel(data);
918 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700919 int id = data.readInt();
920 Notification notification = null;
921 if (data.readInt() != 0) {
922 notification = Notification.CREATOR.createFromParcel(data);
923 }
924 boolean removeNotification = data.readInt() != 0;
925 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800926 reply.writeNoException();
927 return true;
928 }
929
930 case BIND_SERVICE_TRANSACTION: {
931 data.enforceInterface(IActivityManager.descriptor);
932 IBinder b = data.readStrongBinder();
933 IApplicationThread app = ApplicationThreadNative.asInterface(b);
934 IBinder token = data.readStrongBinder();
935 Intent service = Intent.CREATOR.createFromParcel(data);
936 String resolvedType = data.readString();
937 b = data.readStrongBinder();
938 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800939 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800940 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800941 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800942 reply.writeNoException();
943 reply.writeInt(res);
944 return true;
945 }
946
947 case UNBIND_SERVICE_TRANSACTION: {
948 data.enforceInterface(IActivityManager.descriptor);
949 IBinder b = data.readStrongBinder();
950 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
951 boolean res = unbindService(conn);
952 reply.writeNoException();
953 reply.writeInt(res ? 1 : 0);
954 return true;
955 }
956
957 case PUBLISH_SERVICE_TRANSACTION: {
958 data.enforceInterface(IActivityManager.descriptor);
959 IBinder token = data.readStrongBinder();
960 Intent intent = Intent.CREATOR.createFromParcel(data);
961 IBinder service = data.readStrongBinder();
962 publishService(token, intent, service);
963 reply.writeNoException();
964 return true;
965 }
966
967 case UNBIND_FINISHED_TRANSACTION: {
968 data.enforceInterface(IActivityManager.descriptor);
969 IBinder token = data.readStrongBinder();
970 Intent intent = Intent.CREATOR.createFromParcel(data);
971 boolean doRebind = data.readInt() != 0;
972 unbindFinished(token, intent, doRebind);
973 reply.writeNoException();
974 return true;
975 }
976
977 case SERVICE_DONE_EXECUTING_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700980 int type = data.readInt();
981 int startId = data.readInt();
982 int res = data.readInt();
983 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800984 reply.writeNoException();
985 return true;
986 }
987
988 case START_INSTRUMENTATION_TRANSACTION: {
989 data.enforceInterface(IActivityManager.descriptor);
990 ComponentName className = ComponentName.readFromParcel(data);
991 String profileFile = data.readString();
992 int fl = data.readInt();
993 Bundle arguments = data.readBundle();
994 IBinder b = data.readStrongBinder();
995 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800996 b = data.readStrongBinder();
997 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700998 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +0100999 String abiOverride = data.readString();
1000 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1001 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001002 reply.writeNoException();
1003 reply.writeInt(res ? 1 : 0);
1004 return true;
1005 }
1006
1007
1008 case FINISH_INSTRUMENTATION_TRANSACTION: {
1009 data.enforceInterface(IActivityManager.descriptor);
1010 IBinder b = data.readStrongBinder();
1011 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1012 int resultCode = data.readInt();
1013 Bundle results = data.readBundle();
1014 finishInstrumentation(app, resultCode, results);
1015 reply.writeNoException();
1016 return true;
1017 }
1018
1019 case GET_CONFIGURATION_TRANSACTION: {
1020 data.enforceInterface(IActivityManager.descriptor);
1021 Configuration config = getConfiguration();
1022 reply.writeNoException();
1023 config.writeToParcel(reply, 0);
1024 return true;
1025 }
1026
1027 case UPDATE_CONFIGURATION_TRANSACTION: {
1028 data.enforceInterface(IActivityManager.descriptor);
1029 Configuration config = Configuration.CREATOR.createFromParcel(data);
1030 updateConfiguration(config);
1031 reply.writeNoException();
1032 return true;
1033 }
1034
1035 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1036 data.enforceInterface(IActivityManager.descriptor);
1037 IBinder token = data.readStrongBinder();
1038 int requestedOrientation = data.readInt();
1039 setRequestedOrientation(token, requestedOrientation);
1040 reply.writeNoException();
1041 return true;
1042 }
1043
1044 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1045 data.enforceInterface(IActivityManager.descriptor);
1046 IBinder token = data.readStrongBinder();
1047 int req = getRequestedOrientation(token);
1048 reply.writeNoException();
1049 reply.writeInt(req);
1050 return true;
1051 }
1052
1053 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1054 data.enforceInterface(IActivityManager.descriptor);
1055 IBinder token = data.readStrongBinder();
1056 ComponentName cn = getActivityClassForToken(token);
1057 reply.writeNoException();
1058 ComponentName.writeToParcel(cn, reply);
1059 return true;
1060 }
1061
1062 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1063 data.enforceInterface(IActivityManager.descriptor);
1064 IBinder token = data.readStrongBinder();
1065 reply.writeNoException();
1066 reply.writeString(getPackageForToken(token));
1067 return true;
1068 }
1069
1070 case GET_INTENT_SENDER_TRANSACTION: {
1071 data.enforceInterface(IActivityManager.descriptor);
1072 int type = data.readInt();
1073 String packageName = data.readString();
1074 IBinder token = data.readStrongBinder();
1075 String resultWho = data.readString();
1076 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001077 Intent[] requestIntents;
1078 String[] requestResolvedTypes;
1079 if (data.readInt() != 0) {
1080 requestIntents = data.createTypedArray(Intent.CREATOR);
1081 requestResolvedTypes = data.createStringArray();
1082 } else {
1083 requestIntents = null;
1084 requestResolvedTypes = null;
1085 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001086 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001087 Bundle options = data.readInt() != 0
1088 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001089 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001090 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001091 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001092 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001093 reply.writeNoException();
1094 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1095 return true;
1096 }
1097
1098 case CANCEL_INTENT_SENDER_TRANSACTION: {
1099 data.enforceInterface(IActivityManager.descriptor);
1100 IIntentSender r = IIntentSender.Stub.asInterface(
1101 data.readStrongBinder());
1102 cancelIntentSender(r);
1103 reply.writeNoException();
1104 return true;
1105 }
1106
1107 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1108 data.enforceInterface(IActivityManager.descriptor);
1109 IIntentSender r = IIntentSender.Stub.asInterface(
1110 data.readStrongBinder());
1111 String res = getPackageForIntentSender(r);
1112 reply.writeNoException();
1113 reply.writeString(res);
1114 return true;
1115 }
1116
Christopher Tatec4a07d12012-04-06 14:19:13 -07001117 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1118 data.enforceInterface(IActivityManager.descriptor);
1119 IIntentSender r = IIntentSender.Stub.asInterface(
1120 data.readStrongBinder());
1121 int res = getUidForIntentSender(r);
1122 reply.writeNoException();
1123 reply.writeInt(res);
1124 return true;
1125 }
1126
Dianne Hackborn41203752012-08-31 14:05:51 -07001127 case HANDLE_INCOMING_USER_TRANSACTION: {
1128 data.enforceInterface(IActivityManager.descriptor);
1129 int callingPid = data.readInt();
1130 int callingUid = data.readInt();
1131 int userId = data.readInt();
1132 boolean allowAll = data.readInt() != 0 ;
1133 boolean requireFull = data.readInt() != 0;
1134 String name = data.readString();
1135 String callerPackage = data.readString();
1136 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1137 requireFull, name, callerPackage);
1138 reply.writeNoException();
1139 reply.writeInt(res);
1140 return true;
1141 }
1142
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001143 case SET_PROCESS_LIMIT_TRANSACTION: {
1144 data.enforceInterface(IActivityManager.descriptor);
1145 int max = data.readInt();
1146 setProcessLimit(max);
1147 reply.writeNoException();
1148 return true;
1149 }
1150
1151 case GET_PROCESS_LIMIT_TRANSACTION: {
1152 data.enforceInterface(IActivityManager.descriptor);
1153 int limit = getProcessLimit();
1154 reply.writeNoException();
1155 reply.writeInt(limit);
1156 return true;
1157 }
1158
1159 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1160 data.enforceInterface(IActivityManager.descriptor);
1161 IBinder token = data.readStrongBinder();
1162 int pid = data.readInt();
1163 boolean isForeground = data.readInt() != 0;
1164 setProcessForeground(token, pid, isForeground);
1165 reply.writeNoException();
1166 return true;
1167 }
1168
1169 case CHECK_PERMISSION_TRANSACTION: {
1170 data.enforceInterface(IActivityManager.descriptor);
1171 String perm = data.readString();
1172 int pid = data.readInt();
1173 int uid = data.readInt();
1174 int res = checkPermission(perm, pid, uid);
1175 reply.writeNoException();
1176 reply.writeInt(res);
1177 return true;
1178 }
1179
1180 case CHECK_URI_PERMISSION_TRANSACTION: {
1181 data.enforceInterface(IActivityManager.descriptor);
1182 Uri uri = Uri.CREATOR.createFromParcel(data);
1183 int pid = data.readInt();
1184 int uid = data.readInt();
1185 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001186 int userId = data.readInt();
1187 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001188 reply.writeNoException();
1189 reply.writeInt(res);
1190 return true;
1191 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001192
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001193 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001194 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001195 String packageName = data.readString();
1196 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1197 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001198 int userId = data.readInt();
1199 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001200 reply.writeNoException();
1201 reply.writeInt(res ? 1 : 0);
1202 return true;
1203 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001204
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001205 case GRANT_URI_PERMISSION_TRANSACTION: {
1206 data.enforceInterface(IActivityManager.descriptor);
1207 IBinder b = data.readStrongBinder();
1208 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1209 String targetPkg = data.readString();
1210 Uri uri = Uri.CREATOR.createFromParcel(data);
1211 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001212 int userId = data.readInt();
1213 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001214 reply.writeNoException();
1215 return true;
1216 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001217
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001218 case REVOKE_URI_PERMISSION_TRANSACTION: {
1219 data.enforceInterface(IActivityManager.descriptor);
1220 IBinder b = data.readStrongBinder();
1221 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1222 Uri uri = Uri.CREATOR.createFromParcel(data);
1223 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001224 int userId = data.readInt();
1225 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001226 reply.writeNoException();
1227 return true;
1228 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001229
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001230 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1231 data.enforceInterface(IActivityManager.descriptor);
1232 Uri uri = Uri.CREATOR.createFromParcel(data);
1233 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001234 int userId = data.readInt();
1235 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001236 reply.writeNoException();
1237 return true;
1238 }
1239
1240 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1241 data.enforceInterface(IActivityManager.descriptor);
1242 Uri uri = Uri.CREATOR.createFromParcel(data);
1243 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001244 int userId = data.readInt();
1245 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001246 reply.writeNoException();
1247 return true;
1248 }
1249
1250 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1251 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001252 final String packageName = data.readString();
1253 final boolean incoming = data.readInt() != 0;
1254 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1255 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001256 reply.writeNoException();
1257 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1258 return true;
1259 }
1260
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001261 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1262 data.enforceInterface(IActivityManager.descriptor);
1263 IBinder b = data.readStrongBinder();
1264 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1265 boolean waiting = data.readInt() != 0;
1266 showWaitingForDebugger(app, waiting);
1267 reply.writeNoException();
1268 return true;
1269 }
1270
1271 case GET_MEMORY_INFO_TRANSACTION: {
1272 data.enforceInterface(IActivityManager.descriptor);
1273 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1274 getMemoryInfo(mi);
1275 reply.writeNoException();
1276 mi.writeToParcel(reply, 0);
1277 return true;
1278 }
1279
1280 case UNHANDLED_BACK_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
1282 unhandledBack();
1283 reply.writeNoException();
1284 return true;
1285 }
1286
1287 case OPEN_CONTENT_URI_TRANSACTION: {
1288 data.enforceInterface(IActivityManager.descriptor);
1289 Uri uri = Uri.parse(data.readString());
1290 ParcelFileDescriptor pfd = openContentUri(uri);
1291 reply.writeNoException();
1292 if (pfd != null) {
1293 reply.writeInt(1);
1294 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1295 } else {
1296 reply.writeInt(0);
1297 }
1298 return true;
1299 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001300
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001301 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1302 data.enforceInterface(IActivityManager.descriptor);
1303 setLockScreenShown(data.readInt() != 0);
1304 reply.writeNoException();
1305 return true;
1306 }
1307
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001308 case SET_DEBUG_APP_TRANSACTION: {
1309 data.enforceInterface(IActivityManager.descriptor);
1310 String pn = data.readString();
1311 boolean wfd = data.readInt() != 0;
1312 boolean per = data.readInt() != 0;
1313 setDebugApp(pn, wfd, per);
1314 reply.writeNoException();
1315 return true;
1316 }
1317
1318 case SET_ALWAYS_FINISH_TRANSACTION: {
1319 data.enforceInterface(IActivityManager.descriptor);
1320 boolean enabled = data.readInt() != 0;
1321 setAlwaysFinish(enabled);
1322 reply.writeNoException();
1323 return true;
1324 }
1325
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001326 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001327 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001328 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001329 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001330 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001331 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001332 return true;
1333 }
1334
1335 case ENTER_SAFE_MODE_TRANSACTION: {
1336 data.enforceInterface(IActivityManager.descriptor);
1337 enterSafeMode();
1338 reply.writeNoException();
1339 return true;
1340 }
1341
1342 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1343 data.enforceInterface(IActivityManager.descriptor);
1344 IIntentSender is = IIntentSender.Stub.asInterface(
1345 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001346 int sourceUid = data.readInt();
1347 String sourcePkg = data.readString();
1348 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001349 reply.writeNoException();
1350 return true;
1351 }
1352
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001353 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001354 data.enforceInterface(IActivityManager.descriptor);
1355 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001356 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001357 boolean secure = data.readInt() != 0;
1358 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001359 reply.writeNoException();
1360 reply.writeInt(res ? 1 : 0);
1361 return true;
1362 }
1363
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001364 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1365 data.enforceInterface(IActivityManager.descriptor);
1366 String reason = data.readString();
1367 boolean res = killProcessesBelowForeground(reason);
1368 reply.writeNoException();
1369 reply.writeInt(res ? 1 : 0);
1370 return true;
1371 }
1372
Dan Egnor60d87622009-12-16 16:32:58 -08001373 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1374 data.enforceInterface(IActivityManager.descriptor);
1375 IBinder app = data.readStrongBinder();
1376 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1377 handleApplicationCrash(app, ci);
1378 reply.writeNoException();
1379 return true;
1380 }
1381
1382 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001383 data.enforceInterface(IActivityManager.descriptor);
1384 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001385 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001386 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001387 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001388 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001389 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001390 return true;
1391 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001392
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001393 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1394 data.enforceInterface(IActivityManager.descriptor);
1395 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001396 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001397 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1398 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001399 reply.writeNoException();
1400 return true;
1401 }
1402
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001403 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1404 data.enforceInterface(IActivityManager.descriptor);
1405 int sig = data.readInt();
1406 signalPersistentProcesses(sig);
1407 reply.writeNoException();
1408 return true;
1409 }
1410
Dianne Hackborn03abb812010-01-04 18:43:19 -08001411 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1412 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001413 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001414 int userId = data.readInt();
1415 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001416 reply.writeNoException();
1417 return true;
1418 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001419
1420 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1421 data.enforceInterface(IActivityManager.descriptor);
1422 killAllBackgroundProcesses();
1423 reply.writeNoException();
1424 return true;
1425 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001426
Dianne Hackborn03abb812010-01-04 18:43:19 -08001427 case FORCE_STOP_PACKAGE_TRANSACTION: {
1428 data.enforceInterface(IActivityManager.descriptor);
1429 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001430 int userId = data.readInt();
1431 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001432 reply.writeNoException();
1433 return true;
1434 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001435
1436 case GET_MY_MEMORY_STATE_TRANSACTION: {
1437 data.enforceInterface(IActivityManager.descriptor);
1438 ActivityManager.RunningAppProcessInfo info =
1439 new ActivityManager.RunningAppProcessInfo();
1440 getMyMemoryState(info);
1441 reply.writeNoException();
1442 info.writeToParcel(reply, 0);
1443 return true;
1444 }
1445
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001446 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
1448 ConfigurationInfo config = getDeviceConfigurationInfo();
1449 reply.writeNoException();
1450 config.writeToParcel(reply, 0);
1451 return true;
1452 }
1453
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001454 case PROFILE_CONTROL_TRANSACTION: {
1455 data.enforceInterface(IActivityManager.descriptor);
1456 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001457 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001458 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001459 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001460 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001461 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001462 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001463 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001464 reply.writeNoException();
1465 reply.writeInt(res ? 1 : 0);
1466 return true;
1467 }
1468
Dianne Hackborn55280a92009-05-07 15:53:46 -07001469 case SHUTDOWN_TRANSACTION: {
1470 data.enforceInterface(IActivityManager.descriptor);
1471 boolean res = shutdown(data.readInt());
1472 reply.writeNoException();
1473 reply.writeInt(res ? 1 : 0);
1474 return true;
1475 }
1476
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001477 case STOP_APP_SWITCHES_TRANSACTION: {
1478 data.enforceInterface(IActivityManager.descriptor);
1479 stopAppSwitches();
1480 reply.writeNoException();
1481 return true;
1482 }
1483
1484 case RESUME_APP_SWITCHES_TRANSACTION: {
1485 data.enforceInterface(IActivityManager.descriptor);
1486 resumeAppSwitches();
1487 reply.writeNoException();
1488 return true;
1489 }
1490
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001491 case PEEK_SERVICE_TRANSACTION: {
1492 data.enforceInterface(IActivityManager.descriptor);
1493 Intent service = Intent.CREATOR.createFromParcel(data);
1494 String resolvedType = data.readString();
1495 IBinder binder = peekService(service, resolvedType);
1496 reply.writeNoException();
1497 reply.writeStrongBinder(binder);
1498 return true;
1499 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001500
1501 case START_BACKUP_AGENT_TRANSACTION: {
1502 data.enforceInterface(IActivityManager.descriptor);
1503 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1504 int backupRestoreMode = data.readInt();
1505 boolean success = bindBackupAgent(info, backupRestoreMode);
1506 reply.writeNoException();
1507 reply.writeInt(success ? 1 : 0);
1508 return true;
1509 }
1510
1511 case BACKUP_AGENT_CREATED_TRANSACTION: {
1512 data.enforceInterface(IActivityManager.descriptor);
1513 String packageName = data.readString();
1514 IBinder agent = data.readStrongBinder();
1515 backupAgentCreated(packageName, agent);
1516 reply.writeNoException();
1517 return true;
1518 }
1519
1520 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1521 data.enforceInterface(IActivityManager.descriptor);
1522 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1523 unbindBackupAgent(info);
1524 reply.writeNoException();
1525 return true;
1526 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001527
1528 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1529 data.enforceInterface(IActivityManager.descriptor);
1530 String packageName = data.readString();
1531 addPackageDependency(packageName);
1532 reply.writeNoException();
1533 return true;
1534 }
1535
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001536 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001537 data.enforceInterface(IActivityManager.descriptor);
1538 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001539 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001540 String reason = data.readString();
1541 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001542 reply.writeNoException();
1543 return true;
1544 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001545
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001546 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1547 data.enforceInterface(IActivityManager.descriptor);
1548 String reason = data.readString();
1549 closeSystemDialogs(reason);
1550 reply.writeNoException();
1551 return true;
1552 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001553
1554 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1555 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001556 int[] pids = data.createIntArray();
1557 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001558 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001559 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001560 return true;
1561 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001562
1563 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1564 data.enforceInterface(IActivityManager.descriptor);
1565 String processName = data.readString();
1566 int uid = data.readInt();
1567 killApplicationProcess(processName, uid);
1568 reply.writeNoException();
1569 return true;
1570 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001571
1572 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1573 data.enforceInterface(IActivityManager.descriptor);
1574 IBinder token = data.readStrongBinder();
1575 String packageName = data.readString();
1576 int enterAnim = data.readInt();
1577 int exitAnim = data.readInt();
1578 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001579 reply.writeNoException();
1580 return true;
1581 }
1582
1583 case IS_USER_A_MONKEY_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001585 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001586 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001587 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001588 return true;
1589 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001590
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001591 case SET_USER_IS_MONKEY_TRANSACTION: {
1592 data.enforceInterface(IActivityManager.descriptor);
1593 final boolean monkey = (data.readInt() == 1);
1594 setUserIsMonkey(monkey);
1595 reply.writeNoException();
1596 return true;
1597 }
1598
Dianne Hackborn860755f2010-06-03 18:47:52 -07001599 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1600 data.enforceInterface(IActivityManager.descriptor);
1601 finishHeavyWeightApp();
1602 reply.writeNoException();
1603 return true;
1604 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001605
1606 case IS_IMMERSIVE_TRANSACTION: {
1607 data.enforceInterface(IActivityManager.descriptor);
1608 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001609 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001610 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001611 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001612 return true;
1613 }
1614
Craig Mautnerd61dc202014-07-07 11:09:11 -07001615 case IS_TOP_OF_TASK_TRANSACTION: {
1616 data.enforceInterface(IActivityManager.descriptor);
1617 IBinder token = data.readStrongBinder();
1618 final boolean isTopOfTask = isTopOfTask(token);
1619 reply.writeNoException();
1620 reply.writeInt(isTopOfTask ? 1 : 0);
1621 return true;
1622 }
1623
Craig Mautner5eda9b32013-07-02 11:58:16 -07001624 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001625 data.enforceInterface(IActivityManager.descriptor);
1626 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001627 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001628 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001629 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001630 return true;
1631 }
1632
1633 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1634 data.enforceInterface(IActivityManager.descriptor);
1635 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001636 final Bundle bundle;
1637 if (data.readInt() == 0) {
1638 bundle = null;
1639 } else {
1640 bundle = data.readBundle();
1641 }
1642 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1643 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001644 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001645 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001646 return true;
1647 }
1648
Craig Mautner233ceee2014-05-09 17:05:11 -07001649 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1650 data.enforceInterface(IActivityManager.descriptor);
1651 IBinder token = data.readStrongBinder();
1652 final ActivityOptions options = getActivityOptions(token);
1653 reply.writeNoException();
1654 reply.writeBundle(options == null ? null : options.toBundle());
1655 return true;
1656 }
1657
Daniel Sandler69a48172010-06-23 16:29:36 -04001658 case SET_IMMERSIVE_TRANSACTION: {
1659 data.enforceInterface(IActivityManager.descriptor);
1660 IBinder token = data.readStrongBinder();
1661 boolean imm = data.readInt() == 1;
1662 setImmersive(token, imm);
1663 reply.writeNoException();
1664 return true;
1665 }
1666
1667 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1668 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001669 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001670 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001671 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001672 return true;
1673 }
1674
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001675 case CRASH_APPLICATION_TRANSACTION: {
1676 data.enforceInterface(IActivityManager.descriptor);
1677 int uid = data.readInt();
1678 int initialPid = data.readInt();
1679 String packageName = data.readString();
1680 String message = data.readString();
1681 crashApplication(uid, initialPid, packageName, message);
1682 reply.writeNoException();
1683 return true;
1684 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001685
1686 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1687 data.enforceInterface(IActivityManager.descriptor);
1688 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001689 int userId = data.readInt();
1690 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001691 reply.writeNoException();
1692 reply.writeString(type);
1693 return true;
1694 }
1695
Dianne Hackborn7e269642010-08-25 19:50:20 -07001696 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1697 data.enforceInterface(IActivityManager.descriptor);
1698 String name = data.readString();
1699 IBinder perm = newUriPermissionOwner(name);
1700 reply.writeNoException();
1701 reply.writeStrongBinder(perm);
1702 return true;
1703 }
1704
1705 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1706 data.enforceInterface(IActivityManager.descriptor);
1707 IBinder owner = data.readStrongBinder();
1708 int fromUid = data.readInt();
1709 String targetPkg = data.readString();
1710 Uri uri = Uri.CREATOR.createFromParcel(data);
1711 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001712 int sourceUserId = data.readInt();
1713 int targetUserId = data.readInt();
1714 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1715 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001716 reply.writeNoException();
1717 return true;
1718 }
1719
1720 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1721 data.enforceInterface(IActivityManager.descriptor);
1722 IBinder owner = data.readStrongBinder();
1723 Uri uri = null;
1724 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001725 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001726 }
1727 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001728 int userId = data.readInt();
1729 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001730 reply.writeNoException();
1731 return true;
1732 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001733
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001734 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1735 data.enforceInterface(IActivityManager.descriptor);
1736 int callingUid = data.readInt();
1737 String targetPkg = data.readString();
1738 Uri uri = Uri.CREATOR.createFromParcel(data);
1739 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001740 int userId = data.readInt();
1741 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001742 reply.writeNoException();
1743 reply.writeInt(res);
1744 return true;
1745 }
1746
Andy McFadden824c5102010-07-09 16:26:57 -07001747 case DUMP_HEAP_TRANSACTION: {
1748 data.enforceInterface(IActivityManager.descriptor);
1749 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001750 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001751 boolean managed = data.readInt() != 0;
1752 String path = data.readString();
1753 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001754 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001755 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001756 reply.writeNoException();
1757 reply.writeInt(res ? 1 : 0);
1758 return true;
1759 }
1760
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001761 case START_ACTIVITIES_TRANSACTION:
1762 {
1763 data.enforceInterface(IActivityManager.descriptor);
1764 IBinder b = data.readStrongBinder();
1765 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001766 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001767 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1768 String[] resolvedTypes = data.createStringArray();
1769 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001770 Bundle options = data.readInt() != 0
1771 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001772 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001773 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001774 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001775 reply.writeNoException();
1776 reply.writeInt(result);
1777 return true;
1778 }
1779
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001780 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1781 {
1782 data.enforceInterface(IActivityManager.descriptor);
1783 int mode = getFrontActivityScreenCompatMode();
1784 reply.writeNoException();
1785 reply.writeInt(mode);
1786 return true;
1787 }
1788
1789 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1790 {
1791 data.enforceInterface(IActivityManager.descriptor);
1792 int mode = data.readInt();
1793 setFrontActivityScreenCompatMode(mode);
1794 reply.writeNoException();
1795 reply.writeInt(mode);
1796 return true;
1797 }
1798
1799 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1800 {
1801 data.enforceInterface(IActivityManager.descriptor);
1802 String pkg = data.readString();
1803 int mode = getPackageScreenCompatMode(pkg);
1804 reply.writeNoException();
1805 reply.writeInt(mode);
1806 return true;
1807 }
1808
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001809 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1810 {
1811 data.enforceInterface(IActivityManager.descriptor);
1812 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001813 int mode = data.readInt();
1814 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001815 reply.writeNoException();
1816 return true;
1817 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001818
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001819 case SWITCH_USER_TRANSACTION: {
1820 data.enforceInterface(IActivityManager.descriptor);
1821 int userid = data.readInt();
1822 boolean result = switchUser(userid);
1823 reply.writeNoException();
1824 reply.writeInt(result ? 1 : 0);
1825 return true;
1826 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001827
Kenny Guy08488bf2014-02-21 17:40:37 +00001828 case START_USER_IN_BACKGROUND_TRANSACTION: {
1829 data.enforceInterface(IActivityManager.descriptor);
1830 int userid = data.readInt();
1831 boolean result = startUserInBackground(userid);
1832 reply.writeNoException();
1833 reply.writeInt(result ? 1 : 0);
1834 return true;
1835 }
1836
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001837 case STOP_USER_TRANSACTION: {
1838 data.enforceInterface(IActivityManager.descriptor);
1839 int userid = data.readInt();
1840 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1841 data.readStrongBinder());
1842 int result = stopUser(userid, callback);
1843 reply.writeNoException();
1844 reply.writeInt(result);
1845 return true;
1846 }
1847
Amith Yamasani52f1d752012-03-28 18:19:29 -07001848 case GET_CURRENT_USER_TRANSACTION: {
1849 data.enforceInterface(IActivityManager.descriptor);
1850 UserInfo userInfo = getCurrentUser();
1851 reply.writeNoException();
1852 userInfo.writeToParcel(reply, 0);
1853 return true;
1854 }
1855
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001856 case IS_USER_RUNNING_TRANSACTION: {
1857 data.enforceInterface(IActivityManager.descriptor);
1858 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001859 boolean orStopping = data.readInt() != 0;
1860 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001861 reply.writeNoException();
1862 reply.writeInt(result ? 1 : 0);
1863 return true;
1864 }
1865
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001866 case GET_RUNNING_USER_IDS_TRANSACTION: {
1867 data.enforceInterface(IActivityManager.descriptor);
1868 int[] result = getRunningUserIds();
1869 reply.writeNoException();
1870 reply.writeIntArray(result);
1871 return true;
1872 }
1873
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001874 case REMOVE_TASK_TRANSACTION:
1875 {
1876 data.enforceInterface(IActivityManager.descriptor);
1877 int taskId = data.readInt();
1878 int fl = data.readInt();
1879 boolean result = removeTask(taskId, fl);
1880 reply.writeNoException();
1881 reply.writeInt(result ? 1 : 0);
1882 return true;
1883 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001884
Jeff Sharkeya4620792011-05-20 15:29:23 -07001885 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1886 data.enforceInterface(IActivityManager.descriptor);
1887 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1888 data.readStrongBinder());
1889 registerProcessObserver(observer);
1890 return true;
1891 }
1892
1893 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1894 data.enforceInterface(IActivityManager.descriptor);
1895 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1896 data.readStrongBinder());
1897 unregisterProcessObserver(observer);
1898 return true;
1899 }
1900
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001901 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1902 {
1903 data.enforceInterface(IActivityManager.descriptor);
1904 String pkg = data.readString();
1905 boolean ask = getPackageAskScreenCompat(pkg);
1906 reply.writeNoException();
1907 reply.writeInt(ask ? 1 : 0);
1908 return true;
1909 }
1910
1911 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1912 {
1913 data.enforceInterface(IActivityManager.descriptor);
1914 String pkg = data.readString();
1915 boolean ask = data.readInt() != 0;
1916 setPackageAskScreenCompat(pkg, ask);
1917 reply.writeNoException();
1918 return true;
1919 }
1920
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001921 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1922 data.enforceInterface(IActivityManager.descriptor);
1923 IIntentSender r = IIntentSender.Stub.asInterface(
1924 data.readStrongBinder());
1925 boolean res = isIntentSenderTargetedToPackage(r);
1926 reply.writeNoException();
1927 reply.writeInt(res ? 1 : 0);
1928 return true;
1929 }
1930
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001931 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1932 data.enforceInterface(IActivityManager.descriptor);
1933 IIntentSender r = IIntentSender.Stub.asInterface(
1934 data.readStrongBinder());
1935 boolean res = isIntentSenderAnActivity(r);
1936 reply.writeNoException();
1937 reply.writeInt(res ? 1 : 0);
1938 return true;
1939 }
1940
Dianne Hackborn81038902012-11-26 17:04:09 -08001941 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1942 data.enforceInterface(IActivityManager.descriptor);
1943 IIntentSender r = IIntentSender.Stub.asInterface(
1944 data.readStrongBinder());
1945 Intent intent = getIntentForIntentSender(r);
1946 reply.writeNoException();
1947 if (intent != null) {
1948 reply.writeInt(1);
1949 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1950 } else {
1951 reply.writeInt(0);
1952 }
1953 return true;
1954 }
1955
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001956 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1957 data.enforceInterface(IActivityManager.descriptor);
1958 IIntentSender r = IIntentSender.Stub.asInterface(
1959 data.readStrongBinder());
1960 String prefix = data.readString();
1961 String tag = getTagForIntentSender(r, prefix);
1962 reply.writeNoException();
1963 reply.writeString(tag);
1964 return true;
1965 }
1966
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001967 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1968 data.enforceInterface(IActivityManager.descriptor);
1969 Configuration config = Configuration.CREATOR.createFromParcel(data);
1970 updatePersistentConfiguration(config);
1971 reply.writeNoException();
1972 return true;
1973 }
1974
Dianne Hackbornb437e092011-08-05 17:50:29 -07001975 case GET_PROCESS_PSS_TRANSACTION: {
1976 data.enforceInterface(IActivityManager.descriptor);
1977 int[] pids = data.createIntArray();
1978 long[] pss = getProcessPss(pids);
1979 reply.writeNoException();
1980 reply.writeLongArray(pss);
1981 return true;
1982 }
1983
Dianne Hackborn661cd522011-08-22 00:26:20 -07001984 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1985 data.enforceInterface(IActivityManager.descriptor);
1986 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1987 boolean always = data.readInt() != 0;
1988 showBootMessage(msg, always);
1989 reply.writeNoException();
1990 return true;
1991 }
1992
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02001993 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001994 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02001995 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001996 reply.writeNoException();
1997 return true;
1998 }
1999
Adam Powelldd8fab22012-03-22 17:47:27 -07002000 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
2001 data.enforceInterface(IActivityManager.descriptor);
2002 IBinder token = data.readStrongBinder();
2003 String destAffinity = data.readString();
2004 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
2005 reply.writeNoException();
2006 reply.writeInt(res ? 1 : 0);
2007 return true;
2008 }
2009
2010 case NAVIGATE_UP_TO_TRANSACTION: {
2011 data.enforceInterface(IActivityManager.descriptor);
2012 IBinder token = data.readStrongBinder();
2013 Intent target = Intent.CREATOR.createFromParcel(data);
2014 int resultCode = data.readInt();
2015 Intent resultData = null;
2016 if (data.readInt() != 0) {
2017 resultData = Intent.CREATOR.createFromParcel(data);
2018 }
2019 boolean res = navigateUpTo(token, target, resultCode, resultData);
2020 reply.writeNoException();
2021 reply.writeInt(res ? 1 : 0);
2022 return true;
2023 }
2024
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002025 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2026 data.enforceInterface(IActivityManager.descriptor);
2027 IBinder token = data.readStrongBinder();
2028 int res = getLaunchedFromUid(token);
2029 reply.writeNoException();
2030 reply.writeInt(res);
2031 return true;
2032 }
2033
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002034 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2035 data.enforceInterface(IActivityManager.descriptor);
2036 IBinder token = data.readStrongBinder();
2037 String res = getLaunchedFromPackage(token);
2038 reply.writeNoException();
2039 reply.writeString(res);
2040 return true;
2041 }
2042
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002043 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2044 data.enforceInterface(IActivityManager.descriptor);
2045 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2046 data.readStrongBinder());
2047 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002048 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002049 return true;
2050 }
2051
2052 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2053 data.enforceInterface(IActivityManager.descriptor);
2054 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2055 data.readStrongBinder());
2056 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002057 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002058 return true;
2059 }
2060
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002061 case REQUEST_BUG_REPORT_TRANSACTION: {
2062 data.enforceInterface(IActivityManager.descriptor);
2063 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002064 reply.writeNoException();
2065 return true;
2066 }
2067
2068 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2069 data.enforceInterface(IActivityManager.descriptor);
2070 int pid = data.readInt();
2071 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002072 String reason = data.readString();
2073 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002074 reply.writeNoException();
2075 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002076 return true;
2077 }
2078
Adam Skorydfc7fd72013-08-05 19:23:41 -07002079 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002080 data.enforceInterface(IActivityManager.descriptor);
2081 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002082 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002083 reply.writeNoException();
2084 reply.writeBundle(res);
2085 return true;
2086 }
2087
Adam Skorydfc7fd72013-08-05 19:23:41 -07002088 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002089 data.enforceInterface(IActivityManager.descriptor);
2090 IBinder token = data.readStrongBinder();
2091 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002092 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002093 reply.writeNoException();
2094 return true;
2095 }
2096
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002097 case KILL_UID_TRANSACTION: {
2098 data.enforceInterface(IActivityManager.descriptor);
2099 int uid = data.readInt();
2100 String reason = data.readString();
2101 killUid(uid, reason);
2102 reply.writeNoException();
2103 return true;
2104 }
2105
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002106 case HANG_TRANSACTION: {
2107 data.enforceInterface(IActivityManager.descriptor);
2108 IBinder who = data.readStrongBinder();
2109 boolean allowRestart = data.readInt() != 0;
2110 hang(who, allowRestart);
2111 reply.writeNoException();
2112 return true;
2113 }
2114
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002115 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2116 data.enforceInterface(IActivityManager.descriptor);
2117 IBinder token = data.readStrongBinder();
2118 reportActivityFullyDrawn(token);
2119 reply.writeNoException();
2120 return true;
2121 }
2122
Craig Mautner5eda9b32013-07-02 11:58:16 -07002123 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2124 data.enforceInterface(IActivityManager.descriptor);
2125 IBinder token = data.readStrongBinder();
2126 notifyActivityDrawn(token);
2127 reply.writeNoException();
2128 return true;
2129 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002130
2131 case RESTART_TRANSACTION: {
2132 data.enforceInterface(IActivityManager.descriptor);
2133 restart();
2134 reply.writeNoException();
2135 return true;
2136 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002137
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002138 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2139 data.enforceInterface(IActivityManager.descriptor);
2140 performIdleMaintenance();
2141 reply.writeNoException();
2142 return true;
2143 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002144
2145 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2146 data.enforceInterface(IActivityManager.descriptor);
2147 IBinder parentActivityToken = data.readStrongBinder();
2148 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002149 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002150 IActivityContainer activityContainer =
2151 createActivityContainer(parentActivityToken, callback);
2152 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002153 if (activityContainer != null) {
2154 reply.writeInt(1);
2155 reply.writeStrongBinder(activityContainer.asBinder());
2156 } else {
2157 reply.writeInt(0);
2158 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002159 return true;
2160 }
2161
Craig Mautner95da1082014-02-24 17:54:35 -08002162 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2163 data.enforceInterface(IActivityManager.descriptor);
2164 IActivityContainer activityContainer =
2165 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2166 deleteActivityContainer(activityContainer);
2167 reply.writeNoException();
2168 return true;
2169 }
2170
Craig Mautnere0a38842013-12-16 16:14:02 -08002171 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2172 data.enforceInterface(IActivityManager.descriptor);
2173 IBinder activityToken = data.readStrongBinder();
2174 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2175 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002176 if (activityContainer != null) {
2177 reply.writeInt(1);
2178 reply.writeStrongBinder(activityContainer.asBinder());
2179 } else {
2180 reply.writeInt(0);
2181 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002182 return true;
2183 }
2184
Craig Mautner4a1cb222013-12-04 16:14:06 -08002185 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2186 data.enforceInterface(IActivityManager.descriptor);
2187 IBinder homeActivityToken = getHomeActivityToken();
2188 reply.writeNoException();
2189 reply.writeStrongBinder(homeActivityToken);
2190 return true;
2191 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002192
2193 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2194 data.enforceInterface(IActivityManager.descriptor);
2195 final int taskId = data.readInt();
2196 startLockTaskMode(taskId);
2197 reply.writeNoException();
2198 return true;
2199 }
2200
2201 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2202 data.enforceInterface(IActivityManager.descriptor);
2203 IBinder token = data.readStrongBinder();
2204 startLockTaskMode(token);
2205 reply.writeNoException();
2206 return true;
2207 }
2208
Craig Mautnerd61dc202014-07-07 11:09:11 -07002209 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002210 data.enforceInterface(IActivityManager.descriptor);
2211 startLockTaskModeOnCurrent();
2212 reply.writeNoException();
2213 return true;
2214 }
2215
Craig Mautneraea74a52014-03-08 14:23:10 -08002216 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2217 data.enforceInterface(IActivityManager.descriptor);
2218 stopLockTaskMode();
2219 reply.writeNoException();
2220 return true;
2221 }
2222
Craig Mautnerd61dc202014-07-07 11:09:11 -07002223 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002224 data.enforceInterface(IActivityManager.descriptor);
2225 stopLockTaskModeOnCurrent();
2226 reply.writeNoException();
2227 return true;
2228 }
2229
Craig Mautneraea74a52014-03-08 14:23:10 -08002230 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2231 data.enforceInterface(IActivityManager.descriptor);
2232 final boolean isInLockTaskMode = isInLockTaskMode();
2233 reply.writeNoException();
2234 reply.writeInt(isInLockTaskMode ? 1 : 0);
2235 return true;
2236 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002237
Winson Chunga449dc02014-05-16 11:15:04 -07002238 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002239 data.enforceInterface(IActivityManager.descriptor);
2240 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002241 ActivityManager.TaskDescription values =
2242 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2243 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002244 reply.writeNoException();
2245 return true;
2246 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002247
Jose Lima4b6c6692014-08-12 17:41:12 -07002248 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002249 data.enforceInterface(IActivityManager.descriptor);
2250 IBinder token = data.readStrongBinder();
2251 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002252 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002253 reply.writeNoException();
2254 reply.writeInt(success ? 1 : 0);
2255 return true;
2256 }
2257
Jose Lima4b6c6692014-08-12 17:41:12 -07002258 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002259 data.enforceInterface(IActivityManager.descriptor);
2260 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002261 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002262 reply.writeNoException();
2263 reply.writeInt(enabled ? 1 : 0);
2264 return true;
2265 }
2266
Jose Lima4b6c6692014-08-12 17:41:12 -07002267 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002268 data.enforceInterface(IActivityManager.descriptor);
2269 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002270 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002271 reply.writeNoException();
2272 return true;
2273 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002274
2275 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2276 data.enforceInterface(IActivityManager.descriptor);
2277 IBinder token = data.readStrongBinder();
2278 notifyLaunchTaskBehindComplete(token);
2279 reply.writeNoException();
2280 return true;
2281 }
Craig Mautner8746a472014-07-24 15:12:54 -07002282
2283 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2284 data.enforceInterface(IActivityManager.descriptor);
2285 IBinder token = data.readStrongBinder();
2286 notifyEnterAnimationComplete(token);
2287 reply.writeNoException();
2288 return true;
2289 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002290 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002291
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002292 return super.onTransact(code, data, reply, flags);
2293 }
2294
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002295 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002296 return this;
2297 }
2298
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002299 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2300 protected IActivityManager create() {
2301 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002302 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002303 Log.v("ActivityManager", "default service binder = " + b);
2304 }
2305 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002306 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002307 Log.v("ActivityManager", "default service = " + am);
2308 }
2309 return am;
2310 }
2311 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002312}
2313
2314class ActivityManagerProxy implements IActivityManager
2315{
2316 public ActivityManagerProxy(IBinder remote)
2317 {
2318 mRemote = remote;
2319 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002320
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002321 public IBinder asBinder()
2322 {
2323 return mRemote;
2324 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002325
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002326 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002327 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2328 int startFlags, String profileFile,
2329 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002330 Parcel data = Parcel.obtain();
2331 Parcel reply = Parcel.obtain();
2332 data.writeInterfaceToken(IActivityManager.descriptor);
2333 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002334 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002335 intent.writeToParcel(data, 0);
2336 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002337 data.writeStrongBinder(resultTo);
2338 data.writeString(resultWho);
2339 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002340 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002341 data.writeString(profileFile);
2342 if (profileFd != null) {
2343 data.writeInt(1);
2344 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2345 } else {
2346 data.writeInt(0);
2347 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002348 if (options != null) {
2349 data.writeInt(1);
2350 options.writeToParcel(data, 0);
2351 } else {
2352 data.writeInt(0);
2353 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002354 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2355 reply.readException();
2356 int result = reply.readInt();
2357 reply.recycle();
2358 data.recycle();
2359 return result;
2360 }
Amith Yamasani82644082012-08-03 13:09:11 -07002361
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002362 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002363 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2364 int startFlags, String profileFile,
2365 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2366 Parcel data = Parcel.obtain();
2367 Parcel reply = Parcel.obtain();
2368 data.writeInterfaceToken(IActivityManager.descriptor);
2369 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002370 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002371 intent.writeToParcel(data, 0);
2372 data.writeString(resolvedType);
2373 data.writeStrongBinder(resultTo);
2374 data.writeString(resultWho);
2375 data.writeInt(requestCode);
2376 data.writeInt(startFlags);
2377 data.writeString(profileFile);
2378 if (profileFd != null) {
2379 data.writeInt(1);
2380 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2381 } else {
2382 data.writeInt(0);
2383 }
2384 if (options != null) {
2385 data.writeInt(1);
2386 options.writeToParcel(data, 0);
2387 } else {
2388 data.writeInt(0);
2389 }
2390 data.writeInt(userId);
2391 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2392 reply.readException();
2393 int result = reply.readInt();
2394 reply.recycle();
2395 data.recycle();
2396 return result;
2397 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002398 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2399 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2400 int startFlags, String profileFile,
2401 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
2402 Parcel data = Parcel.obtain();
2403 Parcel reply = Parcel.obtain();
2404 data.writeInterfaceToken(IActivityManager.descriptor);
2405 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2406 data.writeString(callingPackage);
2407 intent.writeToParcel(data, 0);
2408 data.writeString(resolvedType);
2409 data.writeStrongBinder(resultTo);
2410 data.writeString(resultWho);
2411 data.writeInt(requestCode);
2412 data.writeInt(startFlags);
2413 data.writeString(profileFile);
2414 if (profileFd != null) {
2415 data.writeInt(1);
2416 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2417 } else {
2418 data.writeInt(0);
2419 }
2420 if (options != null) {
2421 data.writeInt(1);
2422 options.writeToParcel(data, 0);
2423 } else {
2424 data.writeInt(0);
2425 }
2426 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2427 reply.readException();
2428 int result = reply.readInt();
2429 reply.recycle();
2430 data.recycle();
2431 return result;
2432 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002433 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2434 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002435 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002436 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002437 Parcel data = Parcel.obtain();
2438 Parcel reply = Parcel.obtain();
2439 data.writeInterfaceToken(IActivityManager.descriptor);
2440 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002441 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002442 intent.writeToParcel(data, 0);
2443 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002444 data.writeStrongBinder(resultTo);
2445 data.writeString(resultWho);
2446 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002447 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002448 data.writeString(profileFile);
2449 if (profileFd != null) {
2450 data.writeInt(1);
2451 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2452 } else {
2453 data.writeInt(0);
2454 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002455 if (options != null) {
2456 data.writeInt(1);
2457 options.writeToParcel(data, 0);
2458 } else {
2459 data.writeInt(0);
2460 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002461 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002462 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2463 reply.readException();
2464 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2465 reply.recycle();
2466 data.recycle();
2467 return result;
2468 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002469 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2470 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002471 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002472 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002473 Parcel data = Parcel.obtain();
2474 Parcel reply = Parcel.obtain();
2475 data.writeInterfaceToken(IActivityManager.descriptor);
2476 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002477 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002478 intent.writeToParcel(data, 0);
2479 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002480 data.writeStrongBinder(resultTo);
2481 data.writeString(resultWho);
2482 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002483 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002484 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002485 if (options != null) {
2486 data.writeInt(1);
2487 options.writeToParcel(data, 0);
2488 } else {
2489 data.writeInt(0);
2490 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002491 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002492 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2493 reply.readException();
2494 int result = reply.readInt();
2495 reply.recycle();
2496 data.recycle();
2497 return result;
2498 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002499 public int startActivityIntentSender(IApplicationThread caller,
2500 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002501 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002502 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002503 Parcel data = Parcel.obtain();
2504 Parcel reply = Parcel.obtain();
2505 data.writeInterfaceToken(IActivityManager.descriptor);
2506 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2507 intent.writeToParcel(data, 0);
2508 if (fillInIntent != null) {
2509 data.writeInt(1);
2510 fillInIntent.writeToParcel(data, 0);
2511 } else {
2512 data.writeInt(0);
2513 }
2514 data.writeString(resolvedType);
2515 data.writeStrongBinder(resultTo);
2516 data.writeString(resultWho);
2517 data.writeInt(requestCode);
2518 data.writeInt(flagsMask);
2519 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002520 if (options != null) {
2521 data.writeInt(1);
2522 options.writeToParcel(data, 0);
2523 } else {
2524 data.writeInt(0);
2525 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002526 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002527 reply.readException();
2528 int result = reply.readInt();
2529 reply.recycle();
2530 data.recycle();
2531 return result;
2532 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002533 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2534 Intent intent, String resolvedType, IVoiceInteractionSession session,
2535 IVoiceInteractor interactor, int startFlags, String profileFile,
2536 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2537 Parcel data = Parcel.obtain();
2538 Parcel reply = Parcel.obtain();
2539 data.writeInterfaceToken(IActivityManager.descriptor);
2540 data.writeString(callingPackage);
2541 data.writeInt(callingPid);
2542 data.writeInt(callingUid);
2543 intent.writeToParcel(data, 0);
2544 data.writeString(resolvedType);
2545 data.writeStrongBinder(session.asBinder());
2546 data.writeStrongBinder(interactor.asBinder());
2547 data.writeInt(startFlags);
2548 data.writeString(profileFile);
2549 if (profileFd != null) {
2550 data.writeInt(1);
2551 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2552 } else {
2553 data.writeInt(0);
2554 }
2555 if (options != null) {
2556 data.writeInt(1);
2557 options.writeToParcel(data, 0);
2558 } else {
2559 data.writeInt(0);
2560 }
2561 data.writeInt(userId);
2562 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2563 reply.readException();
2564 int result = reply.readInt();
2565 reply.recycle();
2566 data.recycle();
2567 return result;
2568 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002569 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002570 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002571 Parcel data = Parcel.obtain();
2572 Parcel reply = Parcel.obtain();
2573 data.writeInterfaceToken(IActivityManager.descriptor);
2574 data.writeStrongBinder(callingActivity);
2575 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002576 if (options != null) {
2577 data.writeInt(1);
2578 options.writeToParcel(data, 0);
2579 } else {
2580 data.writeInt(0);
2581 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002582 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2583 reply.readException();
2584 int result = reply.readInt();
2585 reply.recycle();
2586 data.recycle();
2587 return result != 0;
2588 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002589 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2590 Parcel data = Parcel.obtain();
2591 Parcel reply = Parcel.obtain();
2592 data.writeInterfaceToken(IActivityManager.descriptor);
2593 data.writeInt(taskId);
2594 if (options == null) {
2595 data.writeInt(0);
2596 } else {
2597 data.writeInt(1);
2598 options.writeToParcel(data, 0);
2599 }
2600 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2601 reply.readException();
2602 int result = reply.readInt();
2603 reply.recycle();
2604 data.recycle();
2605 return result;
2606 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002607 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002608 throws RemoteException {
2609 Parcel data = Parcel.obtain();
2610 Parcel reply = Parcel.obtain();
2611 data.writeInterfaceToken(IActivityManager.descriptor);
2612 data.writeStrongBinder(token);
2613 data.writeInt(resultCode);
2614 if (resultData != null) {
2615 data.writeInt(1);
2616 resultData.writeToParcel(data, 0);
2617 } else {
2618 data.writeInt(0);
2619 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002620 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002621 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2622 reply.readException();
2623 boolean res = reply.readInt() != 0;
2624 data.recycle();
2625 reply.recycle();
2626 return res;
2627 }
2628 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2629 {
2630 Parcel data = Parcel.obtain();
2631 Parcel reply = Parcel.obtain();
2632 data.writeInterfaceToken(IActivityManager.descriptor);
2633 data.writeStrongBinder(token);
2634 data.writeString(resultWho);
2635 data.writeInt(requestCode);
2636 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2637 reply.readException();
2638 data.recycle();
2639 reply.recycle();
2640 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002641 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2642 Parcel data = Parcel.obtain();
2643 Parcel reply = Parcel.obtain();
2644 data.writeInterfaceToken(IActivityManager.descriptor);
2645 data.writeStrongBinder(token);
2646 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2647 reply.readException();
2648 boolean res = reply.readInt() != 0;
2649 data.recycle();
2650 reply.recycle();
2651 return res;
2652 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002653 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2654 Parcel data = Parcel.obtain();
2655 Parcel reply = Parcel.obtain();
2656 data.writeInterfaceToken(IActivityManager.descriptor);
2657 data.writeStrongBinder(session.asBinder());
2658 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2659 reply.readException();
2660 data.recycle();
2661 reply.recycle();
2662 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002663 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2664 Parcel data = Parcel.obtain();
2665 Parcel reply = Parcel.obtain();
2666 data.writeInterfaceToken(IActivityManager.descriptor);
2667 data.writeStrongBinder(token);
2668 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2669 reply.readException();
2670 boolean res = reply.readInt() != 0;
2671 data.recycle();
2672 reply.recycle();
2673 return res;
2674 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002675 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002676 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002677 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002678 {
2679 Parcel data = Parcel.obtain();
2680 Parcel reply = Parcel.obtain();
2681 data.writeInterfaceToken(IActivityManager.descriptor);
2682 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002683 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002684 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2685 filter.writeToParcel(data, 0);
2686 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002687 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002688 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2689 reply.readException();
2690 Intent intent = null;
2691 int haveIntent = reply.readInt();
2692 if (haveIntent != 0) {
2693 intent = Intent.CREATOR.createFromParcel(reply);
2694 }
2695 reply.recycle();
2696 data.recycle();
2697 return intent;
2698 }
2699 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2700 {
2701 Parcel data = Parcel.obtain();
2702 Parcel reply = Parcel.obtain();
2703 data.writeInterfaceToken(IActivityManager.descriptor);
2704 data.writeStrongBinder(receiver.asBinder());
2705 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2706 reply.readException();
2707 data.recycle();
2708 reply.recycle();
2709 }
2710 public int broadcastIntent(IApplicationThread caller,
2711 Intent intent, String resolvedType, IIntentReceiver resultTo,
2712 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002713 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002714 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002715 {
2716 Parcel data = Parcel.obtain();
2717 Parcel reply = Parcel.obtain();
2718 data.writeInterfaceToken(IActivityManager.descriptor);
2719 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2720 intent.writeToParcel(data, 0);
2721 data.writeString(resolvedType);
2722 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2723 data.writeInt(resultCode);
2724 data.writeString(resultData);
2725 data.writeBundle(map);
2726 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002727 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002728 data.writeInt(serialized ? 1 : 0);
2729 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002730 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002731 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2732 reply.readException();
2733 int res = reply.readInt();
2734 reply.recycle();
2735 data.recycle();
2736 return res;
2737 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002738 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2739 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002740 {
2741 Parcel data = Parcel.obtain();
2742 Parcel reply = Parcel.obtain();
2743 data.writeInterfaceToken(IActivityManager.descriptor);
2744 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2745 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002746 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002747 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2748 reply.readException();
2749 data.recycle();
2750 reply.recycle();
2751 }
2752 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2753 {
2754 Parcel data = Parcel.obtain();
2755 Parcel reply = Parcel.obtain();
2756 data.writeInterfaceToken(IActivityManager.descriptor);
2757 data.writeStrongBinder(who);
2758 data.writeInt(resultCode);
2759 data.writeString(resultData);
2760 data.writeBundle(map);
2761 data.writeInt(abortBroadcast ? 1 : 0);
2762 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2763 reply.readException();
2764 data.recycle();
2765 reply.recycle();
2766 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002767 public void attachApplication(IApplicationThread app) throws RemoteException
2768 {
2769 Parcel data = Parcel.obtain();
2770 Parcel reply = Parcel.obtain();
2771 data.writeInterfaceToken(IActivityManager.descriptor);
2772 data.writeStrongBinder(app.asBinder());
2773 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2774 reply.readException();
2775 data.recycle();
2776 reply.recycle();
2777 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002778 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2779 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002780 {
2781 Parcel data = Parcel.obtain();
2782 Parcel reply = Parcel.obtain();
2783 data.writeInterfaceToken(IActivityManager.descriptor);
2784 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002785 if (config != null) {
2786 data.writeInt(1);
2787 config.writeToParcel(data, 0);
2788 } else {
2789 data.writeInt(0);
2790 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002791 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002792 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2793 reply.readException();
2794 data.recycle();
2795 reply.recycle();
2796 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002797 public void activityResumed(IBinder token) throws RemoteException
2798 {
2799 Parcel data = Parcel.obtain();
2800 Parcel reply = Parcel.obtain();
2801 data.writeInterfaceToken(IActivityManager.descriptor);
2802 data.writeStrongBinder(token);
2803 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2804 reply.readException();
2805 data.recycle();
2806 reply.recycle();
2807 }
Craig Mautnera0026042014-04-23 11:45:37 -07002808 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002809 {
2810 Parcel data = Parcel.obtain();
2811 Parcel reply = Parcel.obtain();
2812 data.writeInterfaceToken(IActivityManager.descriptor);
2813 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002814 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002815 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2816 reply.readException();
2817 data.recycle();
2818 reply.recycle();
2819 }
2820 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002821 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002822 {
2823 Parcel data = Parcel.obtain();
2824 Parcel reply = Parcel.obtain();
2825 data.writeInterfaceToken(IActivityManager.descriptor);
2826 data.writeStrongBinder(token);
2827 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002828 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002829 TextUtils.writeToParcel(description, data, 0);
2830 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2831 reply.readException();
2832 data.recycle();
2833 reply.recycle();
2834 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002835 public void activitySlept(IBinder token) throws RemoteException
2836 {
2837 Parcel data = Parcel.obtain();
2838 Parcel reply = Parcel.obtain();
2839 data.writeInterfaceToken(IActivityManager.descriptor);
2840 data.writeStrongBinder(token);
2841 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2842 reply.readException();
2843 data.recycle();
2844 reply.recycle();
2845 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002846 public void activityDestroyed(IBinder token) throws RemoteException
2847 {
2848 Parcel data = Parcel.obtain();
2849 Parcel reply = Parcel.obtain();
2850 data.writeInterfaceToken(IActivityManager.descriptor);
2851 data.writeStrongBinder(token);
2852 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2853 reply.readException();
2854 data.recycle();
2855 reply.recycle();
2856 }
2857 public String getCallingPackage(IBinder token) throws RemoteException
2858 {
2859 Parcel data = Parcel.obtain();
2860 Parcel reply = Parcel.obtain();
2861 data.writeInterfaceToken(IActivityManager.descriptor);
2862 data.writeStrongBinder(token);
2863 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2864 reply.readException();
2865 String res = reply.readString();
2866 data.recycle();
2867 reply.recycle();
2868 return res;
2869 }
2870 public ComponentName getCallingActivity(IBinder token)
2871 throws RemoteException {
2872 Parcel data = Parcel.obtain();
2873 Parcel reply = Parcel.obtain();
2874 data.writeInterfaceToken(IActivityManager.descriptor);
2875 data.writeStrongBinder(token);
2876 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2877 reply.readException();
2878 ComponentName res = ComponentName.readFromParcel(reply);
2879 data.recycle();
2880 reply.recycle();
2881 return res;
2882 }
Winson Chung1147c402014-05-14 11:05:00 -07002883 public List<IAppTask> getAppTasks() throws RemoteException {
2884 Parcel data = Parcel.obtain();
2885 Parcel reply = Parcel.obtain();
2886 data.writeInterfaceToken(IActivityManager.descriptor);
2887 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2888 reply.readException();
2889 ArrayList<IAppTask> list = null;
2890 int N = reply.readInt();
2891 if (N >= 0) {
2892 list = new ArrayList<IAppTask>();
2893 while (N > 0) {
2894 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2895 list.add(task);
2896 N--;
2897 }
2898 }
2899 data.recycle();
2900 reply.recycle();
2901 return list;
2902 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07002903 public int addAppTask(IBinder activityToken, Intent intent,
2904 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
2905 Parcel data = Parcel.obtain();
2906 Parcel reply = Parcel.obtain();
2907 data.writeInterfaceToken(IActivityManager.descriptor);
2908 data.writeStrongBinder(activityToken);
2909 intent.writeToParcel(data, 0);
2910 description.writeToParcel(data, 0);
2911 thumbnail.writeToParcel(data, 0);
2912 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
2913 reply.readException();
2914 int res = reply.readInt();
2915 data.recycle();
2916 reply.recycle();
2917 return res;
2918 }
2919 public Point getAppTaskThumbnailSize() throws RemoteException {
2920 Parcel data = Parcel.obtain();
2921 Parcel reply = Parcel.obtain();
2922 data.writeInterfaceToken(IActivityManager.descriptor);
2923 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
2924 reply.readException();
2925 Point size = Point.CREATOR.createFromParcel(reply);
2926 data.recycle();
2927 reply.recycle();
2928 return size;
2929 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002930 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002931 Parcel data = Parcel.obtain();
2932 Parcel reply = Parcel.obtain();
2933 data.writeInterfaceToken(IActivityManager.descriptor);
2934 data.writeInt(maxNum);
2935 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002936 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2937 reply.readException();
2938 ArrayList list = null;
2939 int N = reply.readInt();
2940 if (N >= 0) {
2941 list = new ArrayList();
2942 while (N > 0) {
2943 ActivityManager.RunningTaskInfo info =
2944 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002945 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002946 list.add(info);
2947 N--;
2948 }
2949 }
2950 data.recycle();
2951 reply.recycle();
2952 return list;
2953 }
2954 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002955 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002956 Parcel data = Parcel.obtain();
2957 Parcel reply = Parcel.obtain();
2958 data.writeInterfaceToken(IActivityManager.descriptor);
2959 data.writeInt(maxNum);
2960 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002961 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002962 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2963 reply.readException();
2964 ArrayList<ActivityManager.RecentTaskInfo> list
2965 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2966 data.recycle();
2967 reply.recycle();
2968 return list;
2969 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002970 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002971 Parcel data = Parcel.obtain();
2972 Parcel reply = Parcel.obtain();
2973 data.writeInterfaceToken(IActivityManager.descriptor);
2974 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002975 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002976 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002977 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002978 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002979 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002980 }
2981 data.recycle();
2982 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002983 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07002984 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002985 public List getServices(int maxNum, int flags) throws RemoteException {
2986 Parcel data = Parcel.obtain();
2987 Parcel reply = Parcel.obtain();
2988 data.writeInterfaceToken(IActivityManager.descriptor);
2989 data.writeInt(maxNum);
2990 data.writeInt(flags);
2991 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2992 reply.readException();
2993 ArrayList list = null;
2994 int N = reply.readInt();
2995 if (N >= 0) {
2996 list = new ArrayList();
2997 while (N > 0) {
2998 ActivityManager.RunningServiceInfo info =
2999 ActivityManager.RunningServiceInfo.CREATOR
3000 .createFromParcel(reply);
3001 list.add(info);
3002 N--;
3003 }
3004 }
3005 data.recycle();
3006 reply.recycle();
3007 return list;
3008 }
3009 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3010 throws RemoteException {
3011 Parcel data = Parcel.obtain();
3012 Parcel reply = Parcel.obtain();
3013 data.writeInterfaceToken(IActivityManager.descriptor);
3014 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3015 reply.readException();
3016 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3017 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3018 data.recycle();
3019 reply.recycle();
3020 return list;
3021 }
3022 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3023 throws RemoteException {
3024 Parcel data = Parcel.obtain();
3025 Parcel reply = Parcel.obtain();
3026 data.writeInterfaceToken(IActivityManager.descriptor);
3027 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3028 reply.readException();
3029 ArrayList<ActivityManager.RunningAppProcessInfo> list
3030 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3031 data.recycle();
3032 reply.recycle();
3033 return list;
3034 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003035 public List<ApplicationInfo> getRunningExternalApplications()
3036 throws RemoteException {
3037 Parcel data = Parcel.obtain();
3038 Parcel reply = Parcel.obtain();
3039 data.writeInterfaceToken(IActivityManager.descriptor);
3040 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3041 reply.readException();
3042 ArrayList<ApplicationInfo> list
3043 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3044 data.recycle();
3045 reply.recycle();
3046 return list;
3047 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003048 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003049 {
3050 Parcel data = Parcel.obtain();
3051 Parcel reply = Parcel.obtain();
3052 data.writeInterfaceToken(IActivityManager.descriptor);
3053 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003054 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003055 if (options != null) {
3056 data.writeInt(1);
3057 options.writeToParcel(data, 0);
3058 } else {
3059 data.writeInt(0);
3060 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003061 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3062 reply.readException();
3063 data.recycle();
3064 reply.recycle();
3065 }
3066 public void moveTaskToBack(int task) throws RemoteException
3067 {
3068 Parcel data = Parcel.obtain();
3069 Parcel reply = Parcel.obtain();
3070 data.writeInterfaceToken(IActivityManager.descriptor);
3071 data.writeInt(task);
3072 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3073 reply.readException();
3074 data.recycle();
3075 reply.recycle();
3076 }
3077 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3078 throws RemoteException {
3079 Parcel data = Parcel.obtain();
3080 Parcel reply = Parcel.obtain();
3081 data.writeInterfaceToken(IActivityManager.descriptor);
3082 data.writeStrongBinder(token);
3083 data.writeInt(nonRoot ? 1 : 0);
3084 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3085 reply.readException();
3086 boolean res = reply.readInt() != 0;
3087 data.recycle();
3088 reply.recycle();
3089 return res;
3090 }
3091 public void moveTaskBackwards(int task) throws RemoteException
3092 {
3093 Parcel data = Parcel.obtain();
3094 Parcel reply = Parcel.obtain();
3095 data.writeInterfaceToken(IActivityManager.descriptor);
3096 data.writeInt(task);
3097 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3098 reply.readException();
3099 data.recycle();
3100 reply.recycle();
3101 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003102 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003103 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3104 {
3105 Parcel data = Parcel.obtain();
3106 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003107 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003108 data.writeInt(taskId);
3109 data.writeInt(stackId);
3110 data.writeInt(toTop ? 1 : 0);
3111 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3112 reply.readException();
3113 data.recycle();
3114 reply.recycle();
3115 }
3116 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003117 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003118 {
3119 Parcel data = Parcel.obtain();
3120 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003121 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003122 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003123 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003124 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003125 reply.readException();
3126 data.recycle();
3127 reply.recycle();
3128 }
Craig Mautner967212c2013-04-13 21:10:58 -07003129 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003130 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003131 {
3132 Parcel data = Parcel.obtain();
3133 Parcel reply = Parcel.obtain();
3134 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003135 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003136 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003137 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003138 data.recycle();
3139 reply.recycle();
3140 return list;
3141 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003142 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003143 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003144 {
3145 Parcel data = Parcel.obtain();
3146 Parcel reply = Parcel.obtain();
3147 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003148 data.writeInt(stackId);
3149 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003150 reply.readException();
3151 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003152 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003153 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003154 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003155 }
3156 data.recycle();
3157 reply.recycle();
3158 return info;
3159 }
3160 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003161 public boolean isInHomeStack(int taskId) throws RemoteException {
3162 Parcel data = Parcel.obtain();
3163 Parcel reply = Parcel.obtain();
3164 data.writeInterfaceToken(IActivityManager.descriptor);
3165 data.writeInt(taskId);
3166 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3167 reply.readException();
3168 boolean isInHomeStack = reply.readInt() > 0;
3169 data.recycle();
3170 reply.recycle();
3171 return isInHomeStack;
3172 }
3173 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003174 public void setFocusedStack(int stackId) throws RemoteException
3175 {
3176 Parcel data = Parcel.obtain();
3177 Parcel reply = Parcel.obtain();
3178 data.writeInterfaceToken(IActivityManager.descriptor);
3179 data.writeInt(stackId);
3180 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3181 reply.readException();
3182 data.recycle();
3183 reply.recycle();
3184 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003185 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3186 {
3187 Parcel data = Parcel.obtain();
3188 Parcel reply = Parcel.obtain();
3189 data.writeInterfaceToken(IActivityManager.descriptor);
3190 data.writeStrongBinder(token);
3191 data.writeInt(onlyRoot ? 1 : 0);
3192 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3193 reply.readException();
3194 int res = reply.readInt();
3195 data.recycle();
3196 reply.recycle();
3197 return res;
3198 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003199 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003200 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003201 Parcel data = Parcel.obtain();
3202 Parcel reply = Parcel.obtain();
3203 data.writeInterfaceToken(IActivityManager.descriptor);
3204 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3205 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003206 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003207 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003208 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3209 reply.readException();
3210 int res = reply.readInt();
3211 ContentProviderHolder cph = null;
3212 if (res != 0) {
3213 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3214 }
3215 data.recycle();
3216 reply.recycle();
3217 return cph;
3218 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003219 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3220 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003221 Parcel data = Parcel.obtain();
3222 Parcel reply = Parcel.obtain();
3223 data.writeInterfaceToken(IActivityManager.descriptor);
3224 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003225 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003226 data.writeStrongBinder(token);
3227 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3228 reply.readException();
3229 int res = reply.readInt();
3230 ContentProviderHolder cph = null;
3231 if (res != 0) {
3232 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3233 }
3234 data.recycle();
3235 reply.recycle();
3236 return cph;
3237 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003238 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003239 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003240 {
3241 Parcel data = Parcel.obtain();
3242 Parcel reply = Parcel.obtain();
3243 data.writeInterfaceToken(IActivityManager.descriptor);
3244 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3245 data.writeTypedList(providers);
3246 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3247 reply.readException();
3248 data.recycle();
3249 reply.recycle();
3250 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003251 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3252 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003253 Parcel data = Parcel.obtain();
3254 Parcel reply = Parcel.obtain();
3255 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003256 data.writeStrongBinder(connection);
3257 data.writeInt(stable);
3258 data.writeInt(unstable);
3259 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3260 reply.readException();
3261 boolean res = reply.readInt() != 0;
3262 data.recycle();
3263 reply.recycle();
3264 return res;
3265 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003266
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003267 public void unstableProviderDied(IBinder connection) throws RemoteException {
3268 Parcel data = Parcel.obtain();
3269 Parcel reply = Parcel.obtain();
3270 data.writeInterfaceToken(IActivityManager.descriptor);
3271 data.writeStrongBinder(connection);
3272 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3273 reply.readException();
3274 data.recycle();
3275 reply.recycle();
3276 }
3277
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003278 @Override
3279 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3280 Parcel data = Parcel.obtain();
3281 Parcel reply = Parcel.obtain();
3282 data.writeInterfaceToken(IActivityManager.descriptor);
3283 data.writeStrongBinder(connection);
3284 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3285 reply.readException();
3286 data.recycle();
3287 reply.recycle();
3288 }
3289
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003290 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3291 Parcel data = Parcel.obtain();
3292 Parcel reply = Parcel.obtain();
3293 data.writeInterfaceToken(IActivityManager.descriptor);
3294 data.writeStrongBinder(connection);
3295 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003296 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3297 reply.readException();
3298 data.recycle();
3299 reply.recycle();
3300 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003301
3302 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3303 Parcel data = Parcel.obtain();
3304 Parcel reply = Parcel.obtain();
3305 data.writeInterfaceToken(IActivityManager.descriptor);
3306 data.writeString(name);
3307 data.writeStrongBinder(token);
3308 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3309 reply.readException();
3310 data.recycle();
3311 reply.recycle();
3312 }
3313
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003314 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3315 throws RemoteException
3316 {
3317 Parcel data = Parcel.obtain();
3318 Parcel reply = Parcel.obtain();
3319 data.writeInterfaceToken(IActivityManager.descriptor);
3320 service.writeToParcel(data, 0);
3321 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3322 reply.readException();
3323 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3324 data.recycle();
3325 reply.recycle();
3326 return res;
3327 }
3328
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003329 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003330 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003331 {
3332 Parcel data = Parcel.obtain();
3333 Parcel reply = Parcel.obtain();
3334 data.writeInterfaceToken(IActivityManager.descriptor);
3335 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3336 service.writeToParcel(data, 0);
3337 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003338 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003339 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3340 reply.readException();
3341 ComponentName res = ComponentName.readFromParcel(reply);
3342 data.recycle();
3343 reply.recycle();
3344 return res;
3345 }
3346 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003347 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003348 {
3349 Parcel data = Parcel.obtain();
3350 Parcel reply = Parcel.obtain();
3351 data.writeInterfaceToken(IActivityManager.descriptor);
3352 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3353 service.writeToParcel(data, 0);
3354 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003355 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003356 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3357 reply.readException();
3358 int res = reply.readInt();
3359 reply.recycle();
3360 data.recycle();
3361 return res;
3362 }
3363 public boolean stopServiceToken(ComponentName className, IBinder token,
3364 int startId) throws RemoteException {
3365 Parcel data = Parcel.obtain();
3366 Parcel reply = Parcel.obtain();
3367 data.writeInterfaceToken(IActivityManager.descriptor);
3368 ComponentName.writeToParcel(className, data);
3369 data.writeStrongBinder(token);
3370 data.writeInt(startId);
3371 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3372 reply.readException();
3373 boolean res = reply.readInt() != 0;
3374 data.recycle();
3375 reply.recycle();
3376 return res;
3377 }
3378 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003379 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003380 Parcel data = Parcel.obtain();
3381 Parcel reply = Parcel.obtain();
3382 data.writeInterfaceToken(IActivityManager.descriptor);
3383 ComponentName.writeToParcel(className, data);
3384 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003385 data.writeInt(id);
3386 if (notification != null) {
3387 data.writeInt(1);
3388 notification.writeToParcel(data, 0);
3389 } else {
3390 data.writeInt(0);
3391 }
3392 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003393 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3394 reply.readException();
3395 data.recycle();
3396 reply.recycle();
3397 }
3398 public int bindService(IApplicationThread caller, IBinder token,
3399 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003400 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003401 Parcel data = Parcel.obtain();
3402 Parcel reply = Parcel.obtain();
3403 data.writeInterfaceToken(IActivityManager.descriptor);
3404 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3405 data.writeStrongBinder(token);
3406 service.writeToParcel(data, 0);
3407 data.writeString(resolvedType);
3408 data.writeStrongBinder(connection.asBinder());
3409 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003410 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003411 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3412 reply.readException();
3413 int res = reply.readInt();
3414 data.recycle();
3415 reply.recycle();
3416 return res;
3417 }
3418 public boolean unbindService(IServiceConnection connection) throws RemoteException
3419 {
3420 Parcel data = Parcel.obtain();
3421 Parcel reply = Parcel.obtain();
3422 data.writeInterfaceToken(IActivityManager.descriptor);
3423 data.writeStrongBinder(connection.asBinder());
3424 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3425 reply.readException();
3426 boolean res = reply.readInt() != 0;
3427 data.recycle();
3428 reply.recycle();
3429 return res;
3430 }
3431
3432 public void publishService(IBinder token,
3433 Intent intent, IBinder service) throws RemoteException {
3434 Parcel data = Parcel.obtain();
3435 Parcel reply = Parcel.obtain();
3436 data.writeInterfaceToken(IActivityManager.descriptor);
3437 data.writeStrongBinder(token);
3438 intent.writeToParcel(data, 0);
3439 data.writeStrongBinder(service);
3440 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3441 reply.readException();
3442 data.recycle();
3443 reply.recycle();
3444 }
3445
3446 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3447 throws RemoteException {
3448 Parcel data = Parcel.obtain();
3449 Parcel reply = Parcel.obtain();
3450 data.writeInterfaceToken(IActivityManager.descriptor);
3451 data.writeStrongBinder(token);
3452 intent.writeToParcel(data, 0);
3453 data.writeInt(doRebind ? 1 : 0);
3454 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3455 reply.readException();
3456 data.recycle();
3457 reply.recycle();
3458 }
3459
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003460 public void serviceDoneExecuting(IBinder token, int type, int startId,
3461 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003462 Parcel data = Parcel.obtain();
3463 Parcel reply = Parcel.obtain();
3464 data.writeInterfaceToken(IActivityManager.descriptor);
3465 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003466 data.writeInt(type);
3467 data.writeInt(startId);
3468 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003469 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3470 reply.readException();
3471 data.recycle();
3472 reply.recycle();
3473 }
3474
3475 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3476 Parcel data = Parcel.obtain();
3477 Parcel reply = Parcel.obtain();
3478 data.writeInterfaceToken(IActivityManager.descriptor);
3479 service.writeToParcel(data, 0);
3480 data.writeString(resolvedType);
3481 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3482 reply.readException();
3483 IBinder binder = reply.readStrongBinder();
3484 reply.recycle();
3485 data.recycle();
3486 return binder;
3487 }
3488
Christopher Tate181fafa2009-05-14 11:12:14 -07003489 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3490 throws RemoteException {
3491 Parcel data = Parcel.obtain();
3492 Parcel reply = Parcel.obtain();
3493 data.writeInterfaceToken(IActivityManager.descriptor);
3494 app.writeToParcel(data, 0);
3495 data.writeInt(backupRestoreMode);
3496 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3497 reply.readException();
3498 boolean success = reply.readInt() != 0;
3499 reply.recycle();
3500 data.recycle();
3501 return success;
3502 }
3503
Christopher Tate346acb12012-10-15 19:20:25 -07003504 public void clearPendingBackup() throws RemoteException {
3505 Parcel data = Parcel.obtain();
3506 Parcel reply = Parcel.obtain();
3507 data.writeInterfaceToken(IActivityManager.descriptor);
3508 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3509 reply.recycle();
3510 data.recycle();
3511 }
3512
Christopher Tate181fafa2009-05-14 11:12:14 -07003513 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3514 Parcel data = Parcel.obtain();
3515 Parcel reply = Parcel.obtain();
3516 data.writeInterfaceToken(IActivityManager.descriptor);
3517 data.writeString(packageName);
3518 data.writeStrongBinder(agent);
3519 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3520 reply.recycle();
3521 data.recycle();
3522 }
3523
3524 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3525 Parcel data = Parcel.obtain();
3526 Parcel reply = Parcel.obtain();
3527 data.writeInterfaceToken(IActivityManager.descriptor);
3528 app.writeToParcel(data, 0);
3529 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3530 reply.readException();
3531 reply.recycle();
3532 data.recycle();
3533 }
3534
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003535 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003536 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003537 IUiAutomationConnection connection, int userId, String instructionSet)
3538 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003539 Parcel data = Parcel.obtain();
3540 Parcel reply = Parcel.obtain();
3541 data.writeInterfaceToken(IActivityManager.descriptor);
3542 ComponentName.writeToParcel(className, data);
3543 data.writeString(profileFile);
3544 data.writeInt(flags);
3545 data.writeBundle(arguments);
3546 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003547 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003548 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003549 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003550 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3551 reply.readException();
3552 boolean res = reply.readInt() != 0;
3553 reply.recycle();
3554 data.recycle();
3555 return res;
3556 }
3557
3558 public void finishInstrumentation(IApplicationThread target,
3559 int resultCode, Bundle results) throws RemoteException {
3560 Parcel data = Parcel.obtain();
3561 Parcel reply = Parcel.obtain();
3562 data.writeInterfaceToken(IActivityManager.descriptor);
3563 data.writeStrongBinder(target != null ? target.asBinder() : null);
3564 data.writeInt(resultCode);
3565 data.writeBundle(results);
3566 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3567 reply.readException();
3568 data.recycle();
3569 reply.recycle();
3570 }
3571 public Configuration getConfiguration() throws RemoteException
3572 {
3573 Parcel data = Parcel.obtain();
3574 Parcel reply = Parcel.obtain();
3575 data.writeInterfaceToken(IActivityManager.descriptor);
3576 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3577 reply.readException();
3578 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3579 reply.recycle();
3580 data.recycle();
3581 return res;
3582 }
3583 public void updateConfiguration(Configuration values) throws RemoteException
3584 {
3585 Parcel data = Parcel.obtain();
3586 Parcel reply = Parcel.obtain();
3587 data.writeInterfaceToken(IActivityManager.descriptor);
3588 values.writeToParcel(data, 0);
3589 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3590 reply.readException();
3591 data.recycle();
3592 reply.recycle();
3593 }
3594 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3595 throws RemoteException {
3596 Parcel data = Parcel.obtain();
3597 Parcel reply = Parcel.obtain();
3598 data.writeInterfaceToken(IActivityManager.descriptor);
3599 data.writeStrongBinder(token);
3600 data.writeInt(requestedOrientation);
3601 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3602 reply.readException();
3603 data.recycle();
3604 reply.recycle();
3605 }
3606 public int getRequestedOrientation(IBinder token) throws RemoteException {
3607 Parcel data = Parcel.obtain();
3608 Parcel reply = Parcel.obtain();
3609 data.writeInterfaceToken(IActivityManager.descriptor);
3610 data.writeStrongBinder(token);
3611 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3612 reply.readException();
3613 int res = reply.readInt();
3614 data.recycle();
3615 reply.recycle();
3616 return res;
3617 }
3618 public ComponentName getActivityClassForToken(IBinder token)
3619 throws RemoteException {
3620 Parcel data = Parcel.obtain();
3621 Parcel reply = Parcel.obtain();
3622 data.writeInterfaceToken(IActivityManager.descriptor);
3623 data.writeStrongBinder(token);
3624 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3625 reply.readException();
3626 ComponentName res = ComponentName.readFromParcel(reply);
3627 data.recycle();
3628 reply.recycle();
3629 return res;
3630 }
3631 public String getPackageForToken(IBinder token) throws RemoteException
3632 {
3633 Parcel data = Parcel.obtain();
3634 Parcel reply = Parcel.obtain();
3635 data.writeInterfaceToken(IActivityManager.descriptor);
3636 data.writeStrongBinder(token);
3637 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3638 reply.readException();
3639 String res = reply.readString();
3640 data.recycle();
3641 reply.recycle();
3642 return res;
3643 }
3644 public IIntentSender getIntentSender(int type,
3645 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003646 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003647 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003648 Parcel data = Parcel.obtain();
3649 Parcel reply = Parcel.obtain();
3650 data.writeInterfaceToken(IActivityManager.descriptor);
3651 data.writeInt(type);
3652 data.writeString(packageName);
3653 data.writeStrongBinder(token);
3654 data.writeString(resultWho);
3655 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003656 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003657 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003658 data.writeTypedArray(intents, 0);
3659 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003660 } else {
3661 data.writeInt(0);
3662 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003663 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003664 if (options != null) {
3665 data.writeInt(1);
3666 options.writeToParcel(data, 0);
3667 } else {
3668 data.writeInt(0);
3669 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003670 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003671 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3672 reply.readException();
3673 IIntentSender res = IIntentSender.Stub.asInterface(
3674 reply.readStrongBinder());
3675 data.recycle();
3676 reply.recycle();
3677 return res;
3678 }
3679 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3680 Parcel data = Parcel.obtain();
3681 Parcel reply = Parcel.obtain();
3682 data.writeInterfaceToken(IActivityManager.descriptor);
3683 data.writeStrongBinder(sender.asBinder());
3684 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3685 reply.readException();
3686 data.recycle();
3687 reply.recycle();
3688 }
3689 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3690 Parcel data = Parcel.obtain();
3691 Parcel reply = Parcel.obtain();
3692 data.writeInterfaceToken(IActivityManager.descriptor);
3693 data.writeStrongBinder(sender.asBinder());
3694 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3695 reply.readException();
3696 String res = reply.readString();
3697 data.recycle();
3698 reply.recycle();
3699 return res;
3700 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003701 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3702 Parcel data = Parcel.obtain();
3703 Parcel reply = Parcel.obtain();
3704 data.writeInterfaceToken(IActivityManager.descriptor);
3705 data.writeStrongBinder(sender.asBinder());
3706 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3707 reply.readException();
3708 int res = reply.readInt();
3709 data.recycle();
3710 reply.recycle();
3711 return res;
3712 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003713 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3714 boolean requireFull, String name, String callerPackage) throws RemoteException {
3715 Parcel data = Parcel.obtain();
3716 Parcel reply = Parcel.obtain();
3717 data.writeInterfaceToken(IActivityManager.descriptor);
3718 data.writeInt(callingPid);
3719 data.writeInt(callingUid);
3720 data.writeInt(userId);
3721 data.writeInt(allowAll ? 1 : 0);
3722 data.writeInt(requireFull ? 1 : 0);
3723 data.writeString(name);
3724 data.writeString(callerPackage);
3725 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3726 reply.readException();
3727 int res = reply.readInt();
3728 data.recycle();
3729 reply.recycle();
3730 return res;
3731 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003732 public void setProcessLimit(int max) throws RemoteException
3733 {
3734 Parcel data = Parcel.obtain();
3735 Parcel reply = Parcel.obtain();
3736 data.writeInterfaceToken(IActivityManager.descriptor);
3737 data.writeInt(max);
3738 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3739 reply.readException();
3740 data.recycle();
3741 reply.recycle();
3742 }
3743 public int getProcessLimit() throws RemoteException
3744 {
3745 Parcel data = Parcel.obtain();
3746 Parcel reply = Parcel.obtain();
3747 data.writeInterfaceToken(IActivityManager.descriptor);
3748 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3749 reply.readException();
3750 int res = reply.readInt();
3751 data.recycle();
3752 reply.recycle();
3753 return res;
3754 }
3755 public void setProcessForeground(IBinder token, int pid,
3756 boolean isForeground) throws RemoteException {
3757 Parcel data = Parcel.obtain();
3758 Parcel reply = Parcel.obtain();
3759 data.writeInterfaceToken(IActivityManager.descriptor);
3760 data.writeStrongBinder(token);
3761 data.writeInt(pid);
3762 data.writeInt(isForeground ? 1 : 0);
3763 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3764 reply.readException();
3765 data.recycle();
3766 reply.recycle();
3767 }
3768 public int checkPermission(String permission, int pid, int uid)
3769 throws RemoteException {
3770 Parcel data = Parcel.obtain();
3771 Parcel reply = Parcel.obtain();
3772 data.writeInterfaceToken(IActivityManager.descriptor);
3773 data.writeString(permission);
3774 data.writeInt(pid);
3775 data.writeInt(uid);
3776 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3777 reply.readException();
3778 int res = reply.readInt();
3779 data.recycle();
3780 reply.recycle();
3781 return res;
3782 }
3783 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003784 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003785 Parcel data = Parcel.obtain();
3786 Parcel reply = Parcel.obtain();
3787 data.writeInterfaceToken(IActivityManager.descriptor);
3788 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003789 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003790 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003791 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3792 reply.readException();
3793 boolean res = reply.readInt() != 0;
3794 data.recycle();
3795 reply.recycle();
3796 return res;
3797 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003798 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003799 throws RemoteException {
3800 Parcel data = Parcel.obtain();
3801 Parcel reply = Parcel.obtain();
3802 data.writeInterfaceToken(IActivityManager.descriptor);
3803 uri.writeToParcel(data, 0);
3804 data.writeInt(pid);
3805 data.writeInt(uid);
3806 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003807 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003808 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3809 reply.readException();
3810 int res = reply.readInt();
3811 data.recycle();
3812 reply.recycle();
3813 return res;
3814 }
3815 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003816 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003817 Parcel data = Parcel.obtain();
3818 Parcel reply = Parcel.obtain();
3819 data.writeInterfaceToken(IActivityManager.descriptor);
3820 data.writeStrongBinder(caller.asBinder());
3821 data.writeString(targetPkg);
3822 uri.writeToParcel(data, 0);
3823 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003824 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003825 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3826 reply.readException();
3827 data.recycle();
3828 reply.recycle();
3829 }
3830 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003831 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003832 Parcel data = Parcel.obtain();
3833 Parcel reply = Parcel.obtain();
3834 data.writeInterfaceToken(IActivityManager.descriptor);
3835 data.writeStrongBinder(caller.asBinder());
3836 uri.writeToParcel(data, 0);
3837 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003838 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003839 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3840 reply.readException();
3841 data.recycle();
3842 reply.recycle();
3843 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003844
3845 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003846 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3847 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003848 Parcel data = Parcel.obtain();
3849 Parcel reply = Parcel.obtain();
3850 data.writeInterfaceToken(IActivityManager.descriptor);
3851 uri.writeToParcel(data, 0);
3852 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003853 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003854 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3855 reply.readException();
3856 data.recycle();
3857 reply.recycle();
3858 }
3859
3860 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003861 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3862 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003863 Parcel data = Parcel.obtain();
3864 Parcel reply = Parcel.obtain();
3865 data.writeInterfaceToken(IActivityManager.descriptor);
3866 uri.writeToParcel(data, 0);
3867 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003868 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003869 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3870 reply.readException();
3871 data.recycle();
3872 reply.recycle();
3873 }
3874
3875 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003876 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3877 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003878 Parcel data = Parcel.obtain();
3879 Parcel reply = Parcel.obtain();
3880 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003881 data.writeString(packageName);
3882 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003883 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3884 reply.readException();
3885 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3886 reply);
3887 data.recycle();
3888 reply.recycle();
3889 return perms;
3890 }
3891
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003892 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3893 throws RemoteException {
3894 Parcel data = Parcel.obtain();
3895 Parcel reply = Parcel.obtain();
3896 data.writeInterfaceToken(IActivityManager.descriptor);
3897 data.writeStrongBinder(who.asBinder());
3898 data.writeInt(waiting ? 1 : 0);
3899 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3900 reply.readException();
3901 data.recycle();
3902 reply.recycle();
3903 }
3904 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3905 Parcel data = Parcel.obtain();
3906 Parcel reply = Parcel.obtain();
3907 data.writeInterfaceToken(IActivityManager.descriptor);
3908 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3909 reply.readException();
3910 outInfo.readFromParcel(reply);
3911 data.recycle();
3912 reply.recycle();
3913 }
3914 public void unhandledBack() throws RemoteException
3915 {
3916 Parcel data = Parcel.obtain();
3917 Parcel reply = Parcel.obtain();
3918 data.writeInterfaceToken(IActivityManager.descriptor);
3919 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3920 reply.readException();
3921 data.recycle();
3922 reply.recycle();
3923 }
3924 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3925 {
3926 Parcel data = Parcel.obtain();
3927 Parcel reply = Parcel.obtain();
3928 data.writeInterfaceToken(IActivityManager.descriptor);
3929 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3930 reply.readException();
3931 ParcelFileDescriptor pfd = null;
3932 if (reply.readInt() != 0) {
3933 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3934 }
3935 data.recycle();
3936 reply.recycle();
3937 return pfd;
3938 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003939 public void setLockScreenShown(boolean shown) throws RemoteException
3940 {
3941 Parcel data = Parcel.obtain();
3942 Parcel reply = Parcel.obtain();
3943 data.writeInterfaceToken(IActivityManager.descriptor);
3944 data.writeInt(shown ? 1 : 0);
3945 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3946 reply.readException();
3947 data.recycle();
3948 reply.recycle();
3949 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003950 public void setDebugApp(
3951 String packageName, boolean waitForDebugger, boolean persistent)
3952 throws RemoteException
3953 {
3954 Parcel data = Parcel.obtain();
3955 Parcel reply = Parcel.obtain();
3956 data.writeInterfaceToken(IActivityManager.descriptor);
3957 data.writeString(packageName);
3958 data.writeInt(waitForDebugger ? 1 : 0);
3959 data.writeInt(persistent ? 1 : 0);
3960 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3961 reply.readException();
3962 data.recycle();
3963 reply.recycle();
3964 }
3965 public void setAlwaysFinish(boolean enabled) throws RemoteException
3966 {
3967 Parcel data = Parcel.obtain();
3968 Parcel reply = Parcel.obtain();
3969 data.writeInterfaceToken(IActivityManager.descriptor);
3970 data.writeInt(enabled ? 1 : 0);
3971 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3972 reply.readException();
3973 data.recycle();
3974 reply.recycle();
3975 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003976 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003977 {
3978 Parcel data = Parcel.obtain();
3979 Parcel reply = Parcel.obtain();
3980 data.writeInterfaceToken(IActivityManager.descriptor);
3981 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003982 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003983 reply.readException();
3984 data.recycle();
3985 reply.recycle();
3986 }
3987 public void enterSafeMode() throws RemoteException {
3988 Parcel data = Parcel.obtain();
3989 data.writeInterfaceToken(IActivityManager.descriptor);
3990 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3991 data.recycle();
3992 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003993 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3994 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003995 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003996 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003997 data.writeStrongBinder(sender.asBinder());
3998 data.writeInt(sourceUid);
3999 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004000 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4001 data.recycle();
4002 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004003 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004004 Parcel data = Parcel.obtain();
4005 Parcel reply = Parcel.obtain();
4006 data.writeInterfaceToken(IActivityManager.descriptor);
4007 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004008 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004009 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004010 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004011 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004012 boolean res = reply.readInt() != 0;
4013 data.recycle();
4014 reply.recycle();
4015 return res;
4016 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004017 @Override
4018 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4019 Parcel data = Parcel.obtain();
4020 Parcel reply = Parcel.obtain();
4021 data.writeInterfaceToken(IActivityManager.descriptor);
4022 data.writeString(reason);
4023 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4024 boolean res = reply.readInt() != 0;
4025 data.recycle();
4026 reply.recycle();
4027 return res;
4028 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004029 public boolean testIsSystemReady()
4030 {
4031 /* this base class version is never called */
4032 return true;
4033 }
Dan Egnor60d87622009-12-16 16:32:58 -08004034 public void handleApplicationCrash(IBinder app,
4035 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4036 {
4037 Parcel data = Parcel.obtain();
4038 Parcel reply = Parcel.obtain();
4039 data.writeInterfaceToken(IActivityManager.descriptor);
4040 data.writeStrongBinder(app);
4041 crashInfo.writeToParcel(data, 0);
4042 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4043 reply.readException();
4044 reply.recycle();
4045 data.recycle();
4046 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004047
Dan Egnor60d87622009-12-16 16:32:58 -08004048 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08004049 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004050 {
4051 Parcel data = Parcel.obtain();
4052 Parcel reply = Parcel.obtain();
4053 data.writeInterfaceToken(IActivityManager.descriptor);
4054 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004055 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08004056 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004057 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004058 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004059 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004060 reply.recycle();
4061 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004062 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004063 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004064
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004065 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004066 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004067 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004068 {
4069 Parcel data = Parcel.obtain();
4070 Parcel reply = Parcel.obtain();
4071 data.writeInterfaceToken(IActivityManager.descriptor);
4072 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004073 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004074 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004075 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4076 reply.readException();
4077 reply.recycle();
4078 data.recycle();
4079 }
4080
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004081 public void signalPersistentProcesses(int sig) throws RemoteException {
4082 Parcel data = Parcel.obtain();
4083 Parcel reply = Parcel.obtain();
4084 data.writeInterfaceToken(IActivityManager.descriptor);
4085 data.writeInt(sig);
4086 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4087 reply.readException();
4088 data.recycle();
4089 reply.recycle();
4090 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004091
Dianne Hackborn1676c852012-09-10 14:52:30 -07004092 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004093 Parcel data = Parcel.obtain();
4094 Parcel reply = Parcel.obtain();
4095 data.writeInterfaceToken(IActivityManager.descriptor);
4096 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004097 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004098 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4099 reply.readException();
4100 data.recycle();
4101 reply.recycle();
4102 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004103
4104 public void killAllBackgroundProcesses() throws RemoteException {
4105 Parcel data = Parcel.obtain();
4106 Parcel reply = Parcel.obtain();
4107 data.writeInterfaceToken(IActivityManager.descriptor);
4108 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4109 reply.readException();
4110 data.recycle();
4111 reply.recycle();
4112 }
4113
Dianne Hackborn1676c852012-09-10 14:52:30 -07004114 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004115 Parcel data = Parcel.obtain();
4116 Parcel reply = Parcel.obtain();
4117 data.writeInterfaceToken(IActivityManager.descriptor);
4118 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004119 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004120 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004121 reply.readException();
4122 data.recycle();
4123 reply.recycle();
4124 }
4125
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004126 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4127 throws RemoteException
4128 {
4129 Parcel data = Parcel.obtain();
4130 Parcel reply = Parcel.obtain();
4131 data.writeInterfaceToken(IActivityManager.descriptor);
4132 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4133 reply.readException();
4134 outInfo.readFromParcel(reply);
4135 reply.recycle();
4136 data.recycle();
4137 }
4138
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004139 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4140 {
4141 Parcel data = Parcel.obtain();
4142 Parcel reply = Parcel.obtain();
4143 data.writeInterfaceToken(IActivityManager.descriptor);
4144 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4145 reply.readException();
4146 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4147 reply.recycle();
4148 data.recycle();
4149 return res;
4150 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004151
Dianne Hackborn1676c852012-09-10 14:52:30 -07004152 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07004153 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004154 {
4155 Parcel data = Parcel.obtain();
4156 Parcel reply = Parcel.obtain();
4157 data.writeInterfaceToken(IActivityManager.descriptor);
4158 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004159 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004160 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004161 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004162 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004163 if (fd != null) {
4164 data.writeInt(1);
4165 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4166 } else {
4167 data.writeInt(0);
4168 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004169 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4170 reply.readException();
4171 boolean res = reply.readInt() != 0;
4172 reply.recycle();
4173 data.recycle();
4174 return res;
4175 }
4176
Dianne Hackborn55280a92009-05-07 15:53:46 -07004177 public boolean shutdown(int timeout) throws RemoteException
4178 {
4179 Parcel data = Parcel.obtain();
4180 Parcel reply = Parcel.obtain();
4181 data.writeInterfaceToken(IActivityManager.descriptor);
4182 data.writeInt(timeout);
4183 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4184 reply.readException();
4185 boolean res = reply.readInt() != 0;
4186 reply.recycle();
4187 data.recycle();
4188 return res;
4189 }
4190
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004191 public void stopAppSwitches() throws RemoteException {
4192 Parcel data = Parcel.obtain();
4193 Parcel reply = Parcel.obtain();
4194 data.writeInterfaceToken(IActivityManager.descriptor);
4195 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4196 reply.readException();
4197 reply.recycle();
4198 data.recycle();
4199 }
4200
4201 public void resumeAppSwitches() throws RemoteException {
4202 Parcel data = Parcel.obtain();
4203 Parcel reply = Parcel.obtain();
4204 data.writeInterfaceToken(IActivityManager.descriptor);
4205 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4206 reply.readException();
4207 reply.recycle();
4208 data.recycle();
4209 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004210
4211 public void addPackageDependency(String packageName) throws RemoteException {
4212 Parcel data = Parcel.obtain();
4213 Parcel reply = Parcel.obtain();
4214 data.writeInterfaceToken(IActivityManager.descriptor);
4215 data.writeString(packageName);
4216 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4217 reply.readException();
4218 data.recycle();
4219 reply.recycle();
4220 }
4221
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004222 public void killApplicationWithAppId(String pkg, int appid, String reason)
4223 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004224 Parcel data = Parcel.obtain();
4225 Parcel reply = Parcel.obtain();
4226 data.writeInterfaceToken(IActivityManager.descriptor);
4227 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004228 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004229 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004230 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004231 reply.readException();
4232 data.recycle();
4233 reply.recycle();
4234 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004235
4236 public void closeSystemDialogs(String reason) throws RemoteException {
4237 Parcel data = Parcel.obtain();
4238 Parcel reply = Parcel.obtain();
4239 data.writeInterfaceToken(IActivityManager.descriptor);
4240 data.writeString(reason);
4241 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4242 reply.readException();
4243 data.recycle();
4244 reply.recycle();
4245 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004246
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004247 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004248 throws RemoteException {
4249 Parcel data = Parcel.obtain();
4250 Parcel reply = Parcel.obtain();
4251 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004252 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004253 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4254 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004255 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004256 data.recycle();
4257 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004258 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004259 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004260
4261 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4262 Parcel data = Parcel.obtain();
4263 Parcel reply = Parcel.obtain();
4264 data.writeInterfaceToken(IActivityManager.descriptor);
4265 data.writeString(processName);
4266 data.writeInt(uid);
4267 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4268 reply.readException();
4269 data.recycle();
4270 reply.recycle();
4271 }
4272
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004273 public void overridePendingTransition(IBinder token, String packageName,
4274 int enterAnim, int exitAnim) throws RemoteException {
4275 Parcel data = Parcel.obtain();
4276 Parcel reply = Parcel.obtain();
4277 data.writeInterfaceToken(IActivityManager.descriptor);
4278 data.writeStrongBinder(token);
4279 data.writeString(packageName);
4280 data.writeInt(enterAnim);
4281 data.writeInt(exitAnim);
4282 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4283 reply.readException();
4284 data.recycle();
4285 reply.recycle();
4286 }
4287
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004288 public boolean isUserAMonkey() throws RemoteException {
4289 Parcel data = Parcel.obtain();
4290 Parcel reply = Parcel.obtain();
4291 data.writeInterfaceToken(IActivityManager.descriptor);
4292 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4293 reply.readException();
4294 boolean res = reply.readInt() != 0;
4295 data.recycle();
4296 reply.recycle();
4297 return res;
4298 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004299
4300 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4301 Parcel data = Parcel.obtain();
4302 Parcel reply = Parcel.obtain();
4303 data.writeInterfaceToken(IActivityManager.descriptor);
4304 data.writeInt(monkey ? 1 : 0);
4305 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4306 reply.readException();
4307 data.recycle();
4308 reply.recycle();
4309 }
4310
Dianne Hackborn860755f2010-06-03 18:47:52 -07004311 public void finishHeavyWeightApp() throws RemoteException {
4312 Parcel data = Parcel.obtain();
4313 Parcel reply = Parcel.obtain();
4314 data.writeInterfaceToken(IActivityManager.descriptor);
4315 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4316 reply.readException();
4317 data.recycle();
4318 reply.recycle();
4319 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004320
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004321 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004322 throws RemoteException {
4323 Parcel data = Parcel.obtain();
4324 Parcel reply = Parcel.obtain();
4325 data.writeInterfaceToken(IActivityManager.descriptor);
4326 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004327 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4328 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004329 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004330 data.recycle();
4331 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004332 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004333 }
4334
Craig Mautner233ceee2014-05-09 17:05:11 -07004335 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004336 throws RemoteException {
4337 Parcel data = Parcel.obtain();
4338 Parcel reply = Parcel.obtain();
4339 data.writeInterfaceToken(IActivityManager.descriptor);
4340 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004341 if (options == null) {
4342 data.writeInt(0);
4343 } else {
4344 data.writeInt(1);
4345 data.writeBundle(options.toBundle());
4346 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004347 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004348 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004349 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004350 data.recycle();
4351 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004352 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004353 }
4354
Craig Mautner233ceee2014-05-09 17:05:11 -07004355 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4356 Parcel data = Parcel.obtain();
4357 Parcel reply = Parcel.obtain();
4358 data.writeInterfaceToken(IActivityManager.descriptor);
4359 data.writeStrongBinder(token);
4360 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4361 reply.readException();
4362 Bundle bundle = reply.readBundle();
4363 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4364 data.recycle();
4365 reply.recycle();
4366 return options;
4367 }
4368
Daniel Sandler69a48172010-06-23 16:29:36 -04004369 public void setImmersive(IBinder token, boolean immersive)
4370 throws RemoteException {
4371 Parcel data = Parcel.obtain();
4372 Parcel reply = Parcel.obtain();
4373 data.writeInterfaceToken(IActivityManager.descriptor);
4374 data.writeStrongBinder(token);
4375 data.writeInt(immersive ? 1 : 0);
4376 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4377 reply.readException();
4378 data.recycle();
4379 reply.recycle();
4380 }
4381
4382 public boolean isImmersive(IBinder token)
4383 throws RemoteException {
4384 Parcel data = Parcel.obtain();
4385 Parcel reply = Parcel.obtain();
4386 data.writeInterfaceToken(IActivityManager.descriptor);
4387 data.writeStrongBinder(token);
4388 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004389 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004390 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004391 data.recycle();
4392 reply.recycle();
4393 return res;
4394 }
4395
Craig Mautnerd61dc202014-07-07 11:09:11 -07004396 public boolean isTopOfTask(IBinder token) throws RemoteException {
4397 Parcel data = Parcel.obtain();
4398 Parcel reply = Parcel.obtain();
4399 data.writeInterfaceToken(IActivityManager.descriptor);
4400 data.writeStrongBinder(token);
4401 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4402 reply.readException();
4403 boolean res = reply.readInt() == 1;
4404 data.recycle();
4405 reply.recycle();
4406 return res;
4407 }
4408
Daniel Sandler69a48172010-06-23 16:29:36 -04004409 public boolean isTopActivityImmersive()
4410 throws RemoteException {
4411 Parcel data = Parcel.obtain();
4412 Parcel reply = Parcel.obtain();
4413 data.writeInterfaceToken(IActivityManager.descriptor);
4414 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004415 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004416 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004417 data.recycle();
4418 reply.recycle();
4419 return res;
4420 }
4421
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004422 public void crashApplication(int uid, int initialPid, String packageName,
4423 String message) throws RemoteException {
4424 Parcel data = Parcel.obtain();
4425 Parcel reply = Parcel.obtain();
4426 data.writeInterfaceToken(IActivityManager.descriptor);
4427 data.writeInt(uid);
4428 data.writeInt(initialPid);
4429 data.writeString(packageName);
4430 data.writeString(message);
4431 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4432 reply.readException();
4433 data.recycle();
4434 reply.recycle();
4435 }
Andy McFadden824c5102010-07-09 16:26:57 -07004436
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004437 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004438 Parcel data = Parcel.obtain();
4439 Parcel reply = Parcel.obtain();
4440 data.writeInterfaceToken(IActivityManager.descriptor);
4441 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004442 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004443 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4444 reply.readException();
4445 String res = reply.readString();
4446 data.recycle();
4447 reply.recycle();
4448 return res;
4449 }
4450
Dianne Hackborn7e269642010-08-25 19:50:20 -07004451 public IBinder newUriPermissionOwner(String name)
4452 throws RemoteException {
4453 Parcel data = Parcel.obtain();
4454 Parcel reply = Parcel.obtain();
4455 data.writeInterfaceToken(IActivityManager.descriptor);
4456 data.writeString(name);
4457 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4458 reply.readException();
4459 IBinder res = reply.readStrongBinder();
4460 data.recycle();
4461 reply.recycle();
4462 return res;
4463 }
4464
4465 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004466 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004467 Parcel data = Parcel.obtain();
4468 Parcel reply = Parcel.obtain();
4469 data.writeInterfaceToken(IActivityManager.descriptor);
4470 data.writeStrongBinder(owner);
4471 data.writeInt(fromUid);
4472 data.writeString(targetPkg);
4473 uri.writeToParcel(data, 0);
4474 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004475 data.writeInt(sourceUserId);
4476 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004477 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4478 reply.readException();
4479 data.recycle();
4480 reply.recycle();
4481 }
4482
4483 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004484 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004485 Parcel data = Parcel.obtain();
4486 Parcel reply = Parcel.obtain();
4487 data.writeInterfaceToken(IActivityManager.descriptor);
4488 data.writeStrongBinder(owner);
4489 if (uri != null) {
4490 data.writeInt(1);
4491 uri.writeToParcel(data, 0);
4492 } else {
4493 data.writeInt(0);
4494 }
4495 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004496 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004497 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4498 reply.readException();
4499 data.recycle();
4500 reply.recycle();
4501 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004502
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004503 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004504 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004505 Parcel data = Parcel.obtain();
4506 Parcel reply = Parcel.obtain();
4507 data.writeInterfaceToken(IActivityManager.descriptor);
4508 data.writeInt(callingUid);
4509 data.writeString(targetPkg);
4510 uri.writeToParcel(data, 0);
4511 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004512 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004513 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4514 reply.readException();
4515 int res = reply.readInt();
4516 data.recycle();
4517 reply.recycle();
4518 return res;
4519 }
4520
Dianne Hackborn1676c852012-09-10 14:52:30 -07004521 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004522 String path, ParcelFileDescriptor fd) throws RemoteException {
4523 Parcel data = Parcel.obtain();
4524 Parcel reply = Parcel.obtain();
4525 data.writeInterfaceToken(IActivityManager.descriptor);
4526 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004527 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004528 data.writeInt(managed ? 1 : 0);
4529 data.writeString(path);
4530 if (fd != null) {
4531 data.writeInt(1);
4532 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4533 } else {
4534 data.writeInt(0);
4535 }
4536 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4537 reply.readException();
4538 boolean res = reply.readInt() != 0;
4539 reply.recycle();
4540 data.recycle();
4541 return res;
4542 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004543
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004544 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004545 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004546 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004547 Parcel data = Parcel.obtain();
4548 Parcel reply = Parcel.obtain();
4549 data.writeInterfaceToken(IActivityManager.descriptor);
4550 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004551 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004552 data.writeTypedArray(intents, 0);
4553 data.writeStringArray(resolvedTypes);
4554 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004555 if (options != null) {
4556 data.writeInt(1);
4557 options.writeToParcel(data, 0);
4558 } else {
4559 data.writeInt(0);
4560 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004561 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004562 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4563 reply.readException();
4564 int result = reply.readInt();
4565 reply.recycle();
4566 data.recycle();
4567 return result;
4568 }
4569
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004570 public int getFrontActivityScreenCompatMode() throws RemoteException {
4571 Parcel data = Parcel.obtain();
4572 Parcel reply = Parcel.obtain();
4573 data.writeInterfaceToken(IActivityManager.descriptor);
4574 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4575 reply.readException();
4576 int mode = reply.readInt();
4577 reply.recycle();
4578 data.recycle();
4579 return mode;
4580 }
4581
4582 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4583 Parcel data = Parcel.obtain();
4584 Parcel reply = Parcel.obtain();
4585 data.writeInterfaceToken(IActivityManager.descriptor);
4586 data.writeInt(mode);
4587 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4588 reply.readException();
4589 reply.recycle();
4590 data.recycle();
4591 }
4592
4593 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4594 Parcel data = Parcel.obtain();
4595 Parcel reply = Parcel.obtain();
4596 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004597 data.writeString(packageName);
4598 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004599 reply.readException();
4600 int mode = reply.readInt();
4601 reply.recycle();
4602 data.recycle();
4603 return mode;
4604 }
4605
4606 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004607 throws RemoteException {
4608 Parcel data = Parcel.obtain();
4609 Parcel reply = Parcel.obtain();
4610 data.writeInterfaceToken(IActivityManager.descriptor);
4611 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004612 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004613 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4614 reply.readException();
4615 reply.recycle();
4616 data.recycle();
4617 }
4618
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004619 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4620 Parcel data = Parcel.obtain();
4621 Parcel reply = Parcel.obtain();
4622 data.writeInterfaceToken(IActivityManager.descriptor);
4623 data.writeString(packageName);
4624 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4625 reply.readException();
4626 boolean ask = reply.readInt() != 0;
4627 reply.recycle();
4628 data.recycle();
4629 return ask;
4630 }
4631
4632 public void setPackageAskScreenCompat(String packageName, boolean ask)
4633 throws RemoteException {
4634 Parcel data = Parcel.obtain();
4635 Parcel reply = Parcel.obtain();
4636 data.writeInterfaceToken(IActivityManager.descriptor);
4637 data.writeString(packageName);
4638 data.writeInt(ask ? 1 : 0);
4639 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4640 reply.readException();
4641 reply.recycle();
4642 data.recycle();
4643 }
4644
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004645 public boolean switchUser(int userid) throws RemoteException {
4646 Parcel data = Parcel.obtain();
4647 Parcel reply = Parcel.obtain();
4648 data.writeInterfaceToken(IActivityManager.descriptor);
4649 data.writeInt(userid);
4650 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4651 reply.readException();
4652 boolean result = reply.readInt() != 0;
4653 reply.recycle();
4654 data.recycle();
4655 return result;
4656 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004657
Kenny Guy08488bf2014-02-21 17:40:37 +00004658 public boolean startUserInBackground(int userid) throws RemoteException {
4659 Parcel data = Parcel.obtain();
4660 Parcel reply = Parcel.obtain();
4661 data.writeInterfaceToken(IActivityManager.descriptor);
4662 data.writeInt(userid);
4663 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4664 reply.readException();
4665 boolean result = reply.readInt() != 0;
4666 reply.recycle();
4667 data.recycle();
4668 return result;
4669 }
4670
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004671 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4672 Parcel data = Parcel.obtain();
4673 Parcel reply = Parcel.obtain();
4674 data.writeInterfaceToken(IActivityManager.descriptor);
4675 data.writeInt(userid);
4676 data.writeStrongInterface(callback);
4677 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4678 reply.readException();
4679 int result = reply.readInt();
4680 reply.recycle();
4681 data.recycle();
4682 return result;
4683 }
4684
Amith Yamasani52f1d752012-03-28 18:19:29 -07004685 public UserInfo getCurrentUser() throws RemoteException {
4686 Parcel data = Parcel.obtain();
4687 Parcel reply = Parcel.obtain();
4688 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004689 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004690 reply.readException();
4691 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4692 reply.recycle();
4693 data.recycle();
4694 return userInfo;
4695 }
4696
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004697 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004698 Parcel data = Parcel.obtain();
4699 Parcel reply = Parcel.obtain();
4700 data.writeInterfaceToken(IActivityManager.descriptor);
4701 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004702 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004703 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4704 reply.readException();
4705 boolean result = reply.readInt() != 0;
4706 reply.recycle();
4707 data.recycle();
4708 return result;
4709 }
4710
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004711 public int[] getRunningUserIds() throws RemoteException {
4712 Parcel data = Parcel.obtain();
4713 Parcel reply = Parcel.obtain();
4714 data.writeInterfaceToken(IActivityManager.descriptor);
4715 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4716 reply.readException();
4717 int[] result = reply.createIntArray();
4718 reply.recycle();
4719 data.recycle();
4720 return result;
4721 }
4722
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004723 public boolean removeTask(int taskId, int flags) throws RemoteException {
4724 Parcel data = Parcel.obtain();
4725 Parcel reply = Parcel.obtain();
4726 data.writeInterfaceToken(IActivityManager.descriptor);
4727 data.writeInt(taskId);
4728 data.writeInt(flags);
4729 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4730 reply.readException();
4731 boolean result = reply.readInt() != 0;
4732 reply.recycle();
4733 data.recycle();
4734 return result;
4735 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004736
Jeff Sharkeya4620792011-05-20 15:29:23 -07004737 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4738 Parcel data = Parcel.obtain();
4739 Parcel reply = Parcel.obtain();
4740 data.writeInterfaceToken(IActivityManager.descriptor);
4741 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4742 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4743 reply.readException();
4744 data.recycle();
4745 reply.recycle();
4746 }
4747
4748 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4749 Parcel data = Parcel.obtain();
4750 Parcel reply = Parcel.obtain();
4751 data.writeInterfaceToken(IActivityManager.descriptor);
4752 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4753 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4754 reply.readException();
4755 data.recycle();
4756 reply.recycle();
4757 }
4758
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004759 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4760 Parcel data = Parcel.obtain();
4761 Parcel reply = Parcel.obtain();
4762 data.writeInterfaceToken(IActivityManager.descriptor);
4763 data.writeStrongBinder(sender.asBinder());
4764 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4765 reply.readException();
4766 boolean res = reply.readInt() != 0;
4767 data.recycle();
4768 reply.recycle();
4769 return res;
4770 }
4771
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004772 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4773 Parcel data = Parcel.obtain();
4774 Parcel reply = Parcel.obtain();
4775 data.writeInterfaceToken(IActivityManager.descriptor);
4776 data.writeStrongBinder(sender.asBinder());
4777 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4778 reply.readException();
4779 boolean res = reply.readInt() != 0;
4780 data.recycle();
4781 reply.recycle();
4782 return res;
4783 }
4784
Dianne Hackborn81038902012-11-26 17:04:09 -08004785 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4786 Parcel data = Parcel.obtain();
4787 Parcel reply = Parcel.obtain();
4788 data.writeInterfaceToken(IActivityManager.descriptor);
4789 data.writeStrongBinder(sender.asBinder());
4790 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4791 reply.readException();
4792 Intent res = reply.readInt() != 0
4793 ? Intent.CREATOR.createFromParcel(reply) : null;
4794 data.recycle();
4795 reply.recycle();
4796 return res;
4797 }
4798
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004799 public String getTagForIntentSender(IIntentSender sender, String prefix)
4800 throws RemoteException {
4801 Parcel data = Parcel.obtain();
4802 Parcel reply = Parcel.obtain();
4803 data.writeInterfaceToken(IActivityManager.descriptor);
4804 data.writeStrongBinder(sender.asBinder());
4805 data.writeString(prefix);
4806 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4807 reply.readException();
4808 String res = reply.readString();
4809 data.recycle();
4810 reply.recycle();
4811 return res;
4812 }
4813
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004814 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4815 {
4816 Parcel data = Parcel.obtain();
4817 Parcel reply = Parcel.obtain();
4818 data.writeInterfaceToken(IActivityManager.descriptor);
4819 values.writeToParcel(data, 0);
4820 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4821 reply.readException();
4822 data.recycle();
4823 reply.recycle();
4824 }
4825
Dianne Hackbornb437e092011-08-05 17:50:29 -07004826 public long[] getProcessPss(int[] pids) throws RemoteException {
4827 Parcel data = Parcel.obtain();
4828 Parcel reply = Parcel.obtain();
4829 data.writeInterfaceToken(IActivityManager.descriptor);
4830 data.writeIntArray(pids);
4831 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4832 reply.readException();
4833 long[] res = reply.createLongArray();
4834 data.recycle();
4835 reply.recycle();
4836 return res;
4837 }
4838
Dianne Hackborn661cd522011-08-22 00:26:20 -07004839 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4840 Parcel data = Parcel.obtain();
4841 Parcel reply = Parcel.obtain();
4842 data.writeInterfaceToken(IActivityManager.descriptor);
4843 TextUtils.writeToParcel(msg, data, 0);
4844 data.writeInt(always ? 1 : 0);
4845 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4846 reply.readException();
4847 data.recycle();
4848 reply.recycle();
4849 }
4850
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004851 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004852 Parcel data = Parcel.obtain();
4853 Parcel reply = Parcel.obtain();
4854 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004855 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004856 reply.readException();
4857 data.recycle();
4858 reply.recycle();
4859 }
4860
Adam Powelldd8fab22012-03-22 17:47:27 -07004861 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4862 throws RemoteException {
4863 Parcel data = Parcel.obtain();
4864 Parcel reply = Parcel.obtain();
4865 data.writeInterfaceToken(IActivityManager.descriptor);
4866 data.writeStrongBinder(token);
4867 data.writeString(destAffinity);
4868 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4869 reply.readException();
4870 boolean result = reply.readInt() != 0;
4871 data.recycle();
4872 reply.recycle();
4873 return result;
4874 }
4875
4876 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4877 throws RemoteException {
4878 Parcel data = Parcel.obtain();
4879 Parcel reply = Parcel.obtain();
4880 data.writeInterfaceToken(IActivityManager.descriptor);
4881 data.writeStrongBinder(token);
4882 target.writeToParcel(data, 0);
4883 data.writeInt(resultCode);
4884 if (resultData != null) {
4885 data.writeInt(1);
4886 resultData.writeToParcel(data, 0);
4887 } else {
4888 data.writeInt(0);
4889 }
4890 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4891 reply.readException();
4892 boolean result = reply.readInt() != 0;
4893 data.recycle();
4894 reply.recycle();
4895 return result;
4896 }
4897
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004898 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4899 Parcel data = Parcel.obtain();
4900 Parcel reply = Parcel.obtain();
4901 data.writeInterfaceToken(IActivityManager.descriptor);
4902 data.writeStrongBinder(activityToken);
4903 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4904 reply.readException();
4905 int result = reply.readInt();
4906 data.recycle();
4907 reply.recycle();
4908 return result;
4909 }
4910
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004911 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4912 Parcel data = Parcel.obtain();
4913 Parcel reply = Parcel.obtain();
4914 data.writeInterfaceToken(IActivityManager.descriptor);
4915 data.writeStrongBinder(activityToken);
4916 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4917 reply.readException();
4918 String result = reply.readString();
4919 data.recycle();
4920 reply.recycle();
4921 return result;
4922 }
4923
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004924 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4925 Parcel data = Parcel.obtain();
4926 Parcel reply = Parcel.obtain();
4927 data.writeInterfaceToken(IActivityManager.descriptor);
4928 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4929 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4930 reply.readException();
4931 data.recycle();
4932 reply.recycle();
4933 }
4934
4935 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4936 Parcel data = Parcel.obtain();
4937 Parcel reply = Parcel.obtain();
4938 data.writeInterfaceToken(IActivityManager.descriptor);
4939 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4940 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4941 reply.readException();
4942 data.recycle();
4943 reply.recycle();
4944 }
4945
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004946 public void requestBugReport() throws RemoteException {
4947 Parcel data = Parcel.obtain();
4948 Parcel reply = Parcel.obtain();
4949 data.writeInterfaceToken(IActivityManager.descriptor);
4950 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4951 reply.readException();
4952 data.recycle();
4953 reply.recycle();
4954 }
4955
Jeff Brownbd181bb2013-09-10 16:44:24 -07004956 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4957 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004958 Parcel data = Parcel.obtain();
4959 Parcel reply = Parcel.obtain();
4960 data.writeInterfaceToken(IActivityManager.descriptor);
4961 data.writeInt(pid);
4962 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004963 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004964 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4965 reply.readException();
4966 long res = reply.readInt();
4967 data.recycle();
4968 reply.recycle();
4969 return res;
4970 }
4971
Adam Skorydfc7fd72013-08-05 19:23:41 -07004972 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004973 Parcel data = Parcel.obtain();
4974 Parcel reply = Parcel.obtain();
4975 data.writeInterfaceToken(IActivityManager.descriptor);
4976 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004977 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004978 reply.readException();
4979 Bundle res = reply.readBundle();
4980 data.recycle();
4981 reply.recycle();
4982 return res;
4983 }
4984
Adam Skory7140a252013-09-11 12:04:58 +01004985 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004986 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004987 Parcel data = Parcel.obtain();
4988 Parcel reply = Parcel.obtain();
4989 data.writeInterfaceToken(IActivityManager.descriptor);
4990 data.writeStrongBinder(token);
4991 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004992 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004993 reply.readException();
4994 data.recycle();
4995 reply.recycle();
4996 }
4997
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004998 public void killUid(int uid, String reason) throws RemoteException {
4999 Parcel data = Parcel.obtain();
5000 Parcel reply = Parcel.obtain();
5001 data.writeInterfaceToken(IActivityManager.descriptor);
5002 data.writeInt(uid);
5003 data.writeString(reason);
5004 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5005 reply.readException();
5006 data.recycle();
5007 reply.recycle();
5008 }
5009
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005010 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5011 Parcel data = Parcel.obtain();
5012 Parcel reply = Parcel.obtain();
5013 data.writeInterfaceToken(IActivityManager.descriptor);
5014 data.writeStrongBinder(who);
5015 data.writeInt(allowRestart ? 1 : 0);
5016 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5017 reply.readException();
5018 data.recycle();
5019 reply.recycle();
5020 }
5021
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005022 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5023 Parcel data = Parcel.obtain();
5024 Parcel reply = Parcel.obtain();
5025 data.writeInterfaceToken(IActivityManager.descriptor);
5026 data.writeStrongBinder(token);
5027 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5028 reply.readException();
5029 data.recycle();
5030 reply.recycle();
5031 }
5032
Craig Mautner5eda9b32013-07-02 11:58:16 -07005033 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5034 Parcel data = Parcel.obtain();
5035 Parcel reply = Parcel.obtain();
5036 data.writeInterfaceToken(IActivityManager.descriptor);
5037 data.writeStrongBinder(token);
5038 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5039 reply.readException();
5040 data.recycle();
5041 reply.recycle();
5042 }
5043
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005044 public void restart() throws RemoteException {
5045 Parcel data = Parcel.obtain();
5046 Parcel reply = Parcel.obtain();
5047 data.writeInterfaceToken(IActivityManager.descriptor);
5048 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5049 reply.readException();
5050 data.recycle();
5051 reply.recycle();
5052 }
5053
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005054 public void performIdleMaintenance() throws RemoteException {
5055 Parcel data = Parcel.obtain();
5056 Parcel reply = Parcel.obtain();
5057 data.writeInterfaceToken(IActivityManager.descriptor);
5058 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5059 reply.readException();
5060 data.recycle();
5061 reply.recycle();
5062 }
5063
Craig Mautner4a1cb222013-12-04 16:14:06 -08005064 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
5065 IActivityContainerCallback callback) throws RemoteException {
5066 Parcel data = Parcel.obtain();
5067 Parcel reply = Parcel.obtain();
5068 data.writeInterfaceToken(IActivityManager.descriptor);
5069 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005070 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08005071 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5072 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005073 final int result = reply.readInt();
5074 final IActivityContainer res;
5075 if (result == 1) {
5076 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5077 } else {
5078 res = null;
5079 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005080 data.recycle();
5081 reply.recycle();
5082 return res;
5083 }
5084
Craig Mautner95da1082014-02-24 17:54:35 -08005085 public void deleteActivityContainer(IActivityContainer activityContainer)
5086 throws RemoteException {
5087 Parcel data = Parcel.obtain();
5088 Parcel reply = Parcel.obtain();
5089 data.writeInterfaceToken(IActivityManager.descriptor);
5090 data.writeStrongBinder(activityContainer.asBinder());
5091 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5092 reply.readException();
5093 data.recycle();
5094 reply.recycle();
5095 }
5096
Craig Mautnere0a38842013-12-16 16:14:02 -08005097 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
5098 throws RemoteException {
5099 Parcel data = Parcel.obtain();
5100 Parcel reply = Parcel.obtain();
5101 data.writeInterfaceToken(IActivityManager.descriptor);
5102 data.writeStrongBinder(activityToken);
5103 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5104 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005105 final int result = reply.readInt();
5106 final IActivityContainer res;
5107 if (result == 1) {
5108 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5109 } else {
5110 res = null;
5111 }
Craig Mautnere0a38842013-12-16 16:14:02 -08005112 data.recycle();
5113 reply.recycle();
5114 return res;
5115 }
5116
Craig Mautner4a1cb222013-12-04 16:14:06 -08005117 public IBinder getHomeActivityToken() throws RemoteException {
5118 Parcel data = Parcel.obtain();
5119 Parcel reply = Parcel.obtain();
5120 data.writeInterfaceToken(IActivityManager.descriptor);
5121 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5122 reply.readException();
5123 IBinder res = reply.readStrongBinder();
5124 data.recycle();
5125 reply.recycle();
5126 return res;
5127 }
5128
Craig Mautneraea74a52014-03-08 14:23:10 -08005129 @Override
5130 public void startLockTaskMode(int taskId) throws RemoteException {
5131 Parcel data = Parcel.obtain();
5132 Parcel reply = Parcel.obtain();
5133 data.writeInterfaceToken(IActivityManager.descriptor);
5134 data.writeInt(taskId);
5135 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5136 reply.readException();
5137 data.recycle();
5138 reply.recycle();
5139 }
5140
5141 @Override
5142 public void startLockTaskMode(IBinder token) throws RemoteException {
5143 Parcel data = Parcel.obtain();
5144 Parcel reply = Parcel.obtain();
5145 data.writeInterfaceToken(IActivityManager.descriptor);
5146 data.writeStrongBinder(token);
5147 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5148 reply.readException();
5149 data.recycle();
5150 reply.recycle();
5151 }
5152
5153 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005154 public void startLockTaskModeOnCurrent() throws RemoteException {
5155 Parcel data = Parcel.obtain();
5156 Parcel reply = Parcel.obtain();
5157 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005158 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005159 reply.readException();
5160 data.recycle();
5161 reply.recycle();
5162 }
5163
5164 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005165 public void stopLockTaskMode() throws RemoteException {
5166 Parcel data = Parcel.obtain();
5167 Parcel reply = Parcel.obtain();
5168 data.writeInterfaceToken(IActivityManager.descriptor);
5169 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5170 reply.readException();
5171 data.recycle();
5172 reply.recycle();
5173 }
5174
5175 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005176 public void stopLockTaskModeOnCurrent() throws RemoteException {
5177 Parcel data = Parcel.obtain();
5178 Parcel reply = Parcel.obtain();
5179 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005180 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005181 reply.readException();
5182 data.recycle();
5183 reply.recycle();
5184 }
5185
5186 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005187 public boolean isInLockTaskMode() throws RemoteException {
5188 Parcel data = Parcel.obtain();
5189 Parcel reply = Parcel.obtain();
5190 data.writeInterfaceToken(IActivityManager.descriptor);
5191 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5192 reply.readException();
5193 boolean isInLockTaskMode = reply.readInt() == 1;
5194 data.recycle();
5195 reply.recycle();
5196 return isInLockTaskMode;
5197 }
5198
Craig Mautner688b5102014-03-27 16:55:03 -07005199 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005200 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005201 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005202 Parcel data = Parcel.obtain();
5203 Parcel reply = Parcel.obtain();
5204 data.writeInterfaceToken(IActivityManager.descriptor);
5205 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005206 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005207 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005208 reply.readException();
5209 data.recycle();
5210 reply.recycle();
5211 }
5212
Craig Mautneree2e45a2014-06-27 12:10:03 -07005213 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005214 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005215 Parcel data = Parcel.obtain();
5216 Parcel reply = Parcel.obtain();
5217 data.writeInterfaceToken(IActivityManager.descriptor);
5218 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005219 data.writeInt(visible ? 1 : 0);
5220 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005221 reply.readException();
5222 boolean success = reply.readInt() > 0;
5223 data.recycle();
5224 reply.recycle();
5225 return success;
5226 }
5227
5228 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005229 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005230 Parcel data = Parcel.obtain();
5231 Parcel reply = Parcel.obtain();
5232 data.writeInterfaceToken(IActivityManager.descriptor);
5233 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005234 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005235 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005236 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005237 data.recycle();
5238 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005239 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005240 }
5241
5242 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005243 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005244 Parcel data = Parcel.obtain();
5245 Parcel reply = Parcel.obtain();
5246 data.writeInterfaceToken(IActivityManager.descriptor);
5247 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005248 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5249 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005250 reply.readException();
5251 data.recycle();
5252 reply.recycle();
5253 }
5254
5255 @Override
5256 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5257 Parcel data = Parcel.obtain();
5258 Parcel reply = Parcel.obtain();
5259 data.writeInterfaceToken(IActivityManager.descriptor);
5260 data.writeStrongBinder(token);
5261 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5262 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005263 reply.readException();
5264 data.recycle();
5265 reply.recycle();
5266 }
5267
Craig Mautner8746a472014-07-24 15:12:54 -07005268 @Override
5269 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5270 Parcel data = Parcel.obtain();
5271 Parcel reply = Parcel.obtain();
5272 data.writeInterfaceToken(IActivityManager.descriptor);
5273 data.writeStrongBinder(token);
5274 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5275 IBinder.FLAG_ONEWAY);
5276 reply.readException();
5277 data.recycle();
5278 reply.recycle();
5279 }
5280
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005281 private IBinder mRemote;
5282}