blob: 16d091af2914fde9be9ab99743a1178b1fe68655 [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;
Jeff Hao1b012d32014-08-20 10:35:34 -070020import android.app.ProfilerInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070022import android.content.IIntentReceiver;
23import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.content.Intent;
25import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070026import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070027import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070028import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.pm.ConfigurationInfo;
30import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070031import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070032import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070034import android.graphics.Bitmap;
35import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080036import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080037import android.net.Uri;
38import android.os.Binder;
39import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070040import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.os.IBinder;
42import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070043import android.os.ParcelFileDescriptor;
44import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070045import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070046import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070048import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070049import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080052import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070053import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055import java.util.ArrayList;
56import java.util.List;
57
58/** {@hide} */
59public abstract class ActivityManagerNative extends Binder implements IActivityManager
60{
61 /**
62 * Cast a Binder object into an activity manager interface, generating
63 * a proxy if needed.
64 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 if (obj == null) {
67 return null;
68 }
69 IActivityManager in =
70 (IActivityManager)obj.queryLocalInterface(descriptor);
71 if (in != null) {
72 return in;
73 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 return new ActivityManagerProxy(obj);
76 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080077
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 /**
79 * Retrieve the system's default/global activity manager.
80 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080081 static public IActivityManager getDefault() {
82 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 }
84
85 /**
86 * Convenience for checking whether the system is ready. For internal use only.
87 */
88 static public boolean isSystemReady() {
89 if (!sSystemReady) {
90 sSystemReady = getDefault().testIsSystemReady();
91 }
92 return sSystemReady;
93 }
94 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080095
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 /**
97 * Convenience for sending a sticky broadcast. For internal use only.
98 * If you don't care about permission, use null.
99 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -0700100 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800101 try {
102 getDefault().broadcastIntent(
103 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800104 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105 } catch (RemoteException ex) {
106 }
107 }
108
Dianne Hackborn099bc622014-01-22 13:39:16 -0800109 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800111 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800116 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117 attachInterface(this, descriptor);
118 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700119
120 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800121 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
122 throws RemoteException {
123 switch (code) {
124 case START_ACTIVITY_TRANSACTION:
125 {
126 data.enforceInterface(IActivityManager.descriptor);
127 IBinder b = data.readStrongBinder();
128 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800129 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 Intent intent = Intent.CREATOR.createFromParcel(data);
131 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800133 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700135 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700136 ProfilerInfo profilerInfo = data.readInt() != 0
137 ? ProfilerInfo.CREATOR.createFromParcel(data) : 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,
Jeff Hao1b012d32014-08-20 10:35:34 -0700141 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 reply.writeNoException();
143 reply.writeInt(result);
144 return true;
145 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700146
Amith Yamasani82644082012-08-03 13:09:11 -0700147 case START_ACTIVITY_AS_USER_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
155 IBinder resultTo = data.readStrongBinder();
156 String resultWho = data.readString();
157 int requestCode = data.readInt();
158 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700159 ProfilerInfo profilerInfo = data.readInt() != 0
160 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
163 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800164 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700165 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700166 reply.writeNoException();
167 reply.writeInt(result);
168 return true;
169 }
170
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700171 case START_ACTIVITY_AS_CALLER_TRANSACTION:
172 {
173 data.enforceInterface(IActivityManager.descriptor);
174 IBinder b = data.readStrongBinder();
175 IApplicationThread app = ApplicationThreadNative.asInterface(b);
176 String callingPackage = data.readString();
177 Intent intent = Intent.CREATOR.createFromParcel(data);
178 String resolvedType = data.readString();
179 IBinder resultTo = data.readStrongBinder();
180 String resultWho = data.readString();
181 int requestCode = data.readInt();
182 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700183 ProfilerInfo profilerInfo = data.readInt() != 0
184 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700185 Bundle options = data.readInt() != 0
186 ? Bundle.CREATOR.createFromParcel(data) : null;
187 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700188 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700189 reply.writeNoException();
190 reply.writeInt(result);
191 return true;
192 }
193
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800194 case START_ACTIVITY_AND_WAIT_TRANSACTION:
195 {
196 data.enforceInterface(IActivityManager.descriptor);
197 IBinder b = data.readStrongBinder();
198 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800199 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800200 Intent intent = Intent.CREATOR.createFromParcel(data);
201 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800202 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800203 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800204 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700205 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700206 ProfilerInfo profilerInfo = data.readInt() != 0
207 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700208 Bundle options = data.readInt() != 0
209 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700210 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800211 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700212 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800213 reply.writeNoException();
214 result.writeToParcel(reply, 0);
215 return true;
216 }
217
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700218 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
219 {
220 data.enforceInterface(IActivityManager.descriptor);
221 IBinder b = data.readStrongBinder();
222 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800223 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700224 Intent intent = Intent.CREATOR.createFromParcel(data);
225 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700226 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700227 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700228 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700229 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700230 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 Bundle options = data.readInt() != 0
232 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700233 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800234 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700235 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700236 reply.writeNoException();
237 reply.writeInt(result);
238 return true;
239 }
240
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700241 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700242 {
243 data.enforceInterface(IActivityManager.descriptor);
244 IBinder b = data.readStrongBinder();
245 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700246 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700247 Intent fillInIntent = null;
248 if (data.readInt() != 0) {
249 fillInIntent = Intent.CREATOR.createFromParcel(data);
250 }
251 String resolvedType = data.readString();
252 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700253 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700254 int requestCode = data.readInt();
255 int flagsMask = data.readInt();
256 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700257 Bundle options = data.readInt() != 0
258 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700259 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700260 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700261 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700262 reply.writeNoException();
263 reply.writeInt(result);
264 return true;
265 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700266
Dianne Hackborn91097de2014-04-04 18:02:06 -0700267 case START_VOICE_ACTIVITY_TRANSACTION:
268 {
269 data.enforceInterface(IActivityManager.descriptor);
270 String callingPackage = data.readString();
271 int callingPid = data.readInt();
272 int callingUid = data.readInt();
273 Intent intent = Intent.CREATOR.createFromParcel(data);
274 String resolvedType = data.readString();
275 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
276 data.readStrongBinder());
277 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
278 data.readStrongBinder());
279 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700280 ProfilerInfo profilerInfo = data.readInt() != 0
281 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700282 Bundle options = data.readInt() != 0
283 ? Bundle.CREATOR.createFromParcel(data) : null;
284 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700285 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
286 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700287 reply.writeNoException();
288 reply.writeInt(result);
289 return true;
290 }
291
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800292 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
293 {
294 data.enforceInterface(IActivityManager.descriptor);
295 IBinder callingActivity = data.readStrongBinder();
296 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700297 Bundle options = data.readInt() != 0
298 ? Bundle.CREATOR.createFromParcel(data) : null;
299 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800300 reply.writeNoException();
301 reply.writeInt(result ? 1 : 0);
302 return true;
303 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700304
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700305 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
306 {
307 data.enforceInterface(IActivityManager.descriptor);
308 int taskId = data.readInt();
309 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
310 int result = startActivityFromRecents(taskId, options);
311 reply.writeNoException();
312 reply.writeInt(result);
313 return true;
314 }
315
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800316 case FINISH_ACTIVITY_TRANSACTION: {
317 data.enforceInterface(IActivityManager.descriptor);
318 IBinder token = data.readStrongBinder();
319 Intent resultData = null;
320 int resultCode = data.readInt();
321 if (data.readInt() != 0) {
322 resultData = Intent.CREATOR.createFromParcel(data);
323 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700324 boolean finishTask = (data.readInt() != 0);
325 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 reply.writeNoException();
327 reply.writeInt(res ? 1 : 0);
328 return true;
329 }
330
331 case FINISH_SUB_ACTIVITY_TRANSACTION: {
332 data.enforceInterface(IActivityManager.descriptor);
333 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700334 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800335 int requestCode = data.readInt();
336 finishSubActivity(token, resultWho, requestCode);
337 reply.writeNoException();
338 return true;
339 }
340
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700341 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
342 data.enforceInterface(IActivityManager.descriptor);
343 IBinder token = data.readStrongBinder();
344 boolean res = finishActivityAffinity(token);
345 reply.writeNoException();
346 reply.writeInt(res ? 1 : 0);
347 return true;
348 }
349
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700350 case FINISH_VOICE_TASK_TRANSACTION: {
351 data.enforceInterface(IActivityManager.descriptor);
352 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
353 data.readStrongBinder());
354 finishVoiceTask(session);
355 reply.writeNoException();
356 return true;
357 }
358
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700359 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
360 data.enforceInterface(IActivityManager.descriptor);
361 IBinder token = data.readStrongBinder();
362 boolean res = releaseActivityInstance(token);
363 reply.writeNoException();
364 reply.writeInt(res ? 1 : 0);
365 return true;
366 }
367
368 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
369 data.enforceInterface(IActivityManager.descriptor);
370 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
371 releaseSomeActivities(app);
372 reply.writeNoException();
373 return true;
374 }
375
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800376 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
377 data.enforceInterface(IActivityManager.descriptor);
378 IBinder token = data.readStrongBinder();
379 boolean res = willActivityBeVisible(token);
380 reply.writeNoException();
381 reply.writeInt(res ? 1 : 0);
382 return true;
383 }
384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 case REGISTER_RECEIVER_TRANSACTION:
386 {
387 data.enforceInterface(IActivityManager.descriptor);
388 IBinder b = data.readStrongBinder();
389 IApplicationThread app =
390 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700391 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800392 b = data.readStrongBinder();
393 IIntentReceiver rec
394 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
395 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
396 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700397 int userId = data.readInt();
398 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800399 reply.writeNoException();
400 if (intent != null) {
401 reply.writeInt(1);
402 intent.writeToParcel(reply, 0);
403 } else {
404 reply.writeInt(0);
405 }
406 return true;
407 }
408
409 case UNREGISTER_RECEIVER_TRANSACTION:
410 {
411 data.enforceInterface(IActivityManager.descriptor);
412 IBinder b = data.readStrongBinder();
413 if (b == null) {
414 return true;
415 }
416 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
417 unregisterReceiver(rec);
418 reply.writeNoException();
419 return true;
420 }
421
422 case BROADCAST_INTENT_TRANSACTION:
423 {
424 data.enforceInterface(IActivityManager.descriptor);
425 IBinder b = data.readStrongBinder();
426 IApplicationThread app =
427 b != null ? ApplicationThreadNative.asInterface(b) : null;
428 Intent intent = Intent.CREATOR.createFromParcel(data);
429 String resolvedType = data.readString();
430 b = data.readStrongBinder();
431 IIntentReceiver resultTo =
432 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
433 int resultCode = data.readInt();
434 String resultData = data.readString();
435 Bundle resultExtras = data.readBundle();
436 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800437 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800438 boolean serialized = data.readInt() != 0;
439 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700440 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800441 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800442 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700443 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800444 reply.writeNoException();
445 reply.writeInt(res);
446 return true;
447 }
448
449 case UNBROADCAST_INTENT_TRANSACTION:
450 {
451 data.enforceInterface(IActivityManager.descriptor);
452 IBinder b = data.readStrongBinder();
453 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
454 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700455 int userId = data.readInt();
456 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800457 reply.writeNoException();
458 return true;
459 }
460
461 case FINISH_RECEIVER_TRANSACTION: {
462 data.enforceInterface(IActivityManager.descriptor);
463 IBinder who = data.readStrongBinder();
464 int resultCode = data.readInt();
465 String resultData = data.readString();
466 Bundle resultExtras = data.readBundle();
467 boolean resultAbort = data.readInt() != 0;
468 if (who != null) {
469 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
470 }
471 reply.writeNoException();
472 return true;
473 }
474
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800475 case ATTACH_APPLICATION_TRANSACTION: {
476 data.enforceInterface(IActivityManager.descriptor);
477 IApplicationThread app = ApplicationThreadNative.asInterface(
478 data.readStrongBinder());
479 if (app != null) {
480 attachApplication(app);
481 }
482 reply.writeNoException();
483 return true;
484 }
485
486 case ACTIVITY_IDLE_TRANSACTION: {
487 data.enforceInterface(IActivityManager.descriptor);
488 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700489 Configuration config = null;
490 if (data.readInt() != 0) {
491 config = Configuration.CREATOR.createFromParcel(data);
492 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700493 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700495 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800496 }
497 reply.writeNoException();
498 return true;
499 }
500
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700501 case ACTIVITY_RESUMED_TRANSACTION: {
502 data.enforceInterface(IActivityManager.descriptor);
503 IBinder token = data.readStrongBinder();
504 activityResumed(token);
505 reply.writeNoException();
506 return true;
507 }
508
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800509 case ACTIVITY_PAUSED_TRANSACTION: {
510 data.enforceInterface(IActivityManager.descriptor);
511 IBinder token = data.readStrongBinder();
Craig Mautnera0026042014-04-23 11:45:37 -0700512 PersistableBundle persistentState = data.readPersistableBundle();
513 activityPaused(token, persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800514 reply.writeNoException();
515 return true;
516 }
517
518 case ACTIVITY_STOPPED_TRANSACTION: {
519 data.enforceInterface(IActivityManager.descriptor);
520 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800521 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700522 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800523 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700524 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800525 reply.writeNoException();
526 return true;
527 }
528
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800529 case ACTIVITY_SLEPT_TRANSACTION: {
530 data.enforceInterface(IActivityManager.descriptor);
531 IBinder token = data.readStrongBinder();
532 activitySlept(token);
533 reply.writeNoException();
534 return true;
535 }
536
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800537 case ACTIVITY_DESTROYED_TRANSACTION: {
538 data.enforceInterface(IActivityManager.descriptor);
539 IBinder token = data.readStrongBinder();
540 activityDestroyed(token);
541 reply.writeNoException();
542 return true;
543 }
544
545 case GET_CALLING_PACKAGE_TRANSACTION: {
546 data.enforceInterface(IActivityManager.descriptor);
547 IBinder token = data.readStrongBinder();
548 String res = token != null ? getCallingPackage(token) : null;
549 reply.writeNoException();
550 reply.writeString(res);
551 return true;
552 }
553
554 case GET_CALLING_ACTIVITY_TRANSACTION: {
555 data.enforceInterface(IActivityManager.descriptor);
556 IBinder token = data.readStrongBinder();
557 ComponentName cn = getCallingActivity(token);
558 reply.writeNoException();
559 ComponentName.writeToParcel(cn, reply);
560 return true;
561 }
562
Winson Chung1147c402014-05-14 11:05:00 -0700563 case GET_APP_TASKS_TRANSACTION: {
564 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700565 String callingPackage = data.readString();
566 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700567 reply.writeNoException();
568 int N = list != null ? list.size() : -1;
569 reply.writeInt(N);
570 int i;
571 for (i=0; i<N; i++) {
572 IAppTask task = list.get(i);
573 reply.writeStrongBinder(task.asBinder());
574 }
575 return true;
576 }
577
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700578 case ADD_APP_TASK_TRANSACTION: {
579 data.enforceInterface(IActivityManager.descriptor);
580 IBinder activityToken = data.readStrongBinder();
581 Intent intent = Intent.CREATOR.createFromParcel(data);
582 ActivityManager.TaskDescription descr
583 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
584 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
585 int res = addAppTask(activityToken, intent, descr, thumbnail);
586 reply.writeNoException();
587 reply.writeInt(res);
588 return true;
589 }
590
591 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
592 data.enforceInterface(IActivityManager.descriptor);
593 Point size = getAppTaskThumbnailSize();
594 reply.writeNoException();
595 size.writeToParcel(reply, 0);
596 return true;
597 }
598
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800599 case GET_TASKS_TRANSACTION: {
600 data.enforceInterface(IActivityManager.descriptor);
601 int maxNum = data.readInt();
602 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700603 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800604 reply.writeNoException();
605 int N = list != null ? list.size() : -1;
606 reply.writeInt(N);
607 int i;
608 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700609 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800610 info.writeToParcel(reply, 0);
611 }
612 return true;
613 }
614
615 case GET_RECENT_TASKS_TRANSACTION: {
616 data.enforceInterface(IActivityManager.descriptor);
617 int maxNum = data.readInt();
618 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700619 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800620 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700621 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800622 reply.writeNoException();
623 reply.writeTypedList(list);
624 return true;
625 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700626
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700627 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800628 data.enforceInterface(IActivityManager.descriptor);
629 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700630 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800631 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700632 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800633 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700634 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700635 } else {
636 reply.writeInt(0);
637 }
638 return true;
639 }
640
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800641 case GET_SERVICES_TRANSACTION: {
642 data.enforceInterface(IActivityManager.descriptor);
643 int maxNum = data.readInt();
644 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700645 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800646 reply.writeNoException();
647 int N = list != null ? list.size() : -1;
648 reply.writeInt(N);
649 int i;
650 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700651 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800652 info.writeToParcel(reply, 0);
653 }
654 return true;
655 }
656
657 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
658 data.enforceInterface(IActivityManager.descriptor);
659 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
660 reply.writeNoException();
661 reply.writeTypedList(list);
662 return true;
663 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700664
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800665 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
666 data.enforceInterface(IActivityManager.descriptor);
667 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
668 reply.writeNoException();
669 reply.writeTypedList(list);
670 return true;
671 }
672
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700673 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
674 data.enforceInterface(IActivityManager.descriptor);
675 List<ApplicationInfo> list = getRunningExternalApplications();
676 reply.writeNoException();
677 reply.writeTypedList(list);
678 return true;
679 }
680
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800681 case MOVE_TASK_TO_FRONT_TRANSACTION: {
682 data.enforceInterface(IActivityManager.descriptor);
683 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800684 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700685 Bundle options = data.readInt() != 0
686 ? Bundle.CREATOR.createFromParcel(data) : null;
687 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800688 reply.writeNoException();
689 return true;
690 }
691
692 case MOVE_TASK_TO_BACK_TRANSACTION: {
693 data.enforceInterface(IActivityManager.descriptor);
694 int task = data.readInt();
695 moveTaskToBack(task);
696 reply.writeNoException();
697 return true;
698 }
699
700 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
701 data.enforceInterface(IActivityManager.descriptor);
702 IBinder token = data.readStrongBinder();
703 boolean nonRoot = data.readInt() != 0;
704 boolean res = moveActivityTaskToBack(token, nonRoot);
705 reply.writeNoException();
706 reply.writeInt(res ? 1 : 0);
707 return true;
708 }
709
710 case MOVE_TASK_BACKWARDS_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 int task = data.readInt();
713 moveTaskBackwards(task);
714 reply.writeNoException();
715 return true;
716 }
717
Craig Mautnerc00204b2013-03-05 15:02:14 -0800718 case MOVE_TASK_TO_STACK_TRANSACTION: {
719 data.enforceInterface(IActivityManager.descriptor);
720 int taskId = data.readInt();
721 int stackId = data.readInt();
722 boolean toTop = data.readInt() != 0;
723 moveTaskToStack(taskId, stackId, toTop);
724 reply.writeNoException();
725 return true;
726 }
727
728 case RESIZE_STACK_TRANSACTION: {
729 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800730 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800731 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800732 Rect r = Rect.CREATOR.createFromParcel(data);
733 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800734 reply.writeNoException();
735 return true;
736 }
737
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800738 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700739 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800740 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700741 reply.writeNoException();
742 reply.writeTypedList(list);
743 return true;
744 }
745
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800746 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700747 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800748 int stackId = data.readInt();
749 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700750 reply.writeNoException();
751 if (info != null) {
752 reply.writeInt(1);
753 info.writeToParcel(reply, 0);
754 } else {
755 reply.writeInt(0);
756 }
757 return true;
758 }
759
Winson Chung303e1ff2014-03-07 15:06:19 -0800760 case IS_IN_HOME_STACK_TRANSACTION: {
761 data.enforceInterface(IActivityManager.descriptor);
762 int taskId = data.readInt();
763 boolean isInHomeStack = isInHomeStack(taskId);
764 reply.writeNoException();
765 reply.writeInt(isInHomeStack ? 1 : 0);
766 return true;
767 }
768
Craig Mautnercf910b02013-04-23 11:23:27 -0700769 case SET_FOCUSED_STACK_TRANSACTION: {
770 data.enforceInterface(IActivityManager.descriptor);
771 int stackId = data.readInt();
772 setFocusedStack(stackId);
773 reply.writeNoException();
774 return true;
775 }
776
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800777 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 IBinder token = data.readStrongBinder();
780 boolean onlyRoot = data.readInt() != 0;
781 int res = token != null
782 ? getTaskForActivity(token, onlyRoot) : -1;
783 reply.writeNoException();
784 reply.writeInt(res);
785 return true;
786 }
787
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800788 case GET_CONTENT_PROVIDER_TRANSACTION: {
789 data.enforceInterface(IActivityManager.descriptor);
790 IBinder b = data.readStrongBinder();
791 IApplicationThread app = ApplicationThreadNative.asInterface(b);
792 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700793 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700794 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700795 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800796 reply.writeNoException();
797 if (cph != null) {
798 reply.writeInt(1);
799 cph.writeToParcel(reply, 0);
800 } else {
801 reply.writeInt(0);
802 }
803 return true;
804 }
805
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800806 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
807 data.enforceInterface(IActivityManager.descriptor);
808 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700809 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800810 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700811 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800812 reply.writeNoException();
813 if (cph != null) {
814 reply.writeInt(1);
815 cph.writeToParcel(reply, 0);
816 } else {
817 reply.writeInt(0);
818 }
819 return true;
820 }
821
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800822 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
823 data.enforceInterface(IActivityManager.descriptor);
824 IBinder b = data.readStrongBinder();
825 IApplicationThread app = ApplicationThreadNative.asInterface(b);
826 ArrayList<ContentProviderHolder> providers =
827 data.createTypedArrayList(ContentProviderHolder.CREATOR);
828 publishContentProviders(app, providers);
829 reply.writeNoException();
830 return true;
831 }
832
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700833 case REF_CONTENT_PROVIDER_TRANSACTION: {
834 data.enforceInterface(IActivityManager.descriptor);
835 IBinder b = data.readStrongBinder();
836 int stable = data.readInt();
837 int unstable = data.readInt();
838 boolean res = refContentProvider(b, stable, unstable);
839 reply.writeNoException();
840 reply.writeInt(res ? 1 : 0);
841 return true;
842 }
843
844 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
845 data.enforceInterface(IActivityManager.descriptor);
846 IBinder b = data.readStrongBinder();
847 unstableProviderDied(b);
848 reply.writeNoException();
849 return true;
850 }
851
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700852 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
853 data.enforceInterface(IActivityManager.descriptor);
854 IBinder b = data.readStrongBinder();
855 appNotRespondingViaProvider(b);
856 reply.writeNoException();
857 return true;
858 }
859
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800860 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
861 data.enforceInterface(IActivityManager.descriptor);
862 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700863 boolean stable = data.readInt() != 0;
864 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800865 reply.writeNoException();
866 return true;
867 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800868
869 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
870 data.enforceInterface(IActivityManager.descriptor);
871 String name = data.readString();
872 IBinder token = data.readStrongBinder();
873 removeContentProviderExternal(name, token);
874 reply.writeNoException();
875 return true;
876 }
877
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700878 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
879 data.enforceInterface(IActivityManager.descriptor);
880 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
881 PendingIntent pi = getRunningServiceControlPanel(comp);
882 reply.writeNoException();
883 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
884 return true;
885 }
886
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800887 case START_SERVICE_TRANSACTION: {
888 data.enforceInterface(IActivityManager.descriptor);
889 IBinder b = data.readStrongBinder();
890 IApplicationThread app = ApplicationThreadNative.asInterface(b);
891 Intent service = Intent.CREATOR.createFromParcel(data);
892 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700893 int userId = data.readInt();
894 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800895 reply.writeNoException();
896 ComponentName.writeToParcel(cn, reply);
897 return true;
898 }
899
900 case STOP_SERVICE_TRANSACTION: {
901 data.enforceInterface(IActivityManager.descriptor);
902 IBinder b = data.readStrongBinder();
903 IApplicationThread app = ApplicationThreadNative.asInterface(b);
904 Intent service = Intent.CREATOR.createFromParcel(data);
905 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700906 int userId = data.readInt();
907 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 reply.writeNoException();
909 reply.writeInt(res);
910 return true;
911 }
912
913 case STOP_SERVICE_TOKEN_TRANSACTION: {
914 data.enforceInterface(IActivityManager.descriptor);
915 ComponentName className = ComponentName.readFromParcel(data);
916 IBinder token = data.readStrongBinder();
917 int startId = data.readInt();
918 boolean res = stopServiceToken(className, token, startId);
919 reply.writeNoException();
920 reply.writeInt(res ? 1 : 0);
921 return true;
922 }
923
924 case SET_SERVICE_FOREGROUND_TRANSACTION: {
925 data.enforceInterface(IActivityManager.descriptor);
926 ComponentName className = ComponentName.readFromParcel(data);
927 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700928 int id = data.readInt();
929 Notification notification = null;
930 if (data.readInt() != 0) {
931 notification = Notification.CREATOR.createFromParcel(data);
932 }
933 boolean removeNotification = data.readInt() != 0;
934 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800935 reply.writeNoException();
936 return true;
937 }
938
939 case BIND_SERVICE_TRANSACTION: {
940 data.enforceInterface(IActivityManager.descriptor);
941 IBinder b = data.readStrongBinder();
942 IApplicationThread app = ApplicationThreadNative.asInterface(b);
943 IBinder token = data.readStrongBinder();
944 Intent service = Intent.CREATOR.createFromParcel(data);
945 String resolvedType = data.readString();
946 b = data.readStrongBinder();
947 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800948 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800949 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800950 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800951 reply.writeNoException();
952 reply.writeInt(res);
953 return true;
954 }
955
956 case UNBIND_SERVICE_TRANSACTION: {
957 data.enforceInterface(IActivityManager.descriptor);
958 IBinder b = data.readStrongBinder();
959 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
960 boolean res = unbindService(conn);
961 reply.writeNoException();
962 reply.writeInt(res ? 1 : 0);
963 return true;
964 }
965
966 case PUBLISH_SERVICE_TRANSACTION: {
967 data.enforceInterface(IActivityManager.descriptor);
968 IBinder token = data.readStrongBinder();
969 Intent intent = Intent.CREATOR.createFromParcel(data);
970 IBinder service = data.readStrongBinder();
971 publishService(token, intent, service);
972 reply.writeNoException();
973 return true;
974 }
975
976 case UNBIND_FINISHED_TRANSACTION: {
977 data.enforceInterface(IActivityManager.descriptor);
978 IBinder token = data.readStrongBinder();
979 Intent intent = Intent.CREATOR.createFromParcel(data);
980 boolean doRebind = data.readInt() != 0;
981 unbindFinished(token, intent, doRebind);
982 reply.writeNoException();
983 return true;
984 }
985
986 case SERVICE_DONE_EXECUTING_TRANSACTION: {
987 data.enforceInterface(IActivityManager.descriptor);
988 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700989 int type = data.readInt();
990 int startId = data.readInt();
991 int res = data.readInt();
992 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800993 reply.writeNoException();
994 return true;
995 }
996
997 case START_INSTRUMENTATION_TRANSACTION: {
998 data.enforceInterface(IActivityManager.descriptor);
999 ComponentName className = ComponentName.readFromParcel(data);
1000 String profileFile = data.readString();
1001 int fl = data.readInt();
1002 Bundle arguments = data.readBundle();
1003 IBinder b = data.readStrongBinder();
1004 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001005 b = data.readStrongBinder();
1006 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001007 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001008 String abiOverride = data.readString();
1009 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1010 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001011 reply.writeNoException();
1012 reply.writeInt(res ? 1 : 0);
1013 return true;
1014 }
1015
1016
1017 case FINISH_INSTRUMENTATION_TRANSACTION: {
1018 data.enforceInterface(IActivityManager.descriptor);
1019 IBinder b = data.readStrongBinder();
1020 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1021 int resultCode = data.readInt();
1022 Bundle results = data.readBundle();
1023 finishInstrumentation(app, resultCode, results);
1024 reply.writeNoException();
1025 return true;
1026 }
1027
1028 case GET_CONFIGURATION_TRANSACTION: {
1029 data.enforceInterface(IActivityManager.descriptor);
1030 Configuration config = getConfiguration();
1031 reply.writeNoException();
1032 config.writeToParcel(reply, 0);
1033 return true;
1034 }
1035
1036 case UPDATE_CONFIGURATION_TRANSACTION: {
1037 data.enforceInterface(IActivityManager.descriptor);
1038 Configuration config = Configuration.CREATOR.createFromParcel(data);
1039 updateConfiguration(config);
1040 reply.writeNoException();
1041 return true;
1042 }
1043
1044 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1045 data.enforceInterface(IActivityManager.descriptor);
1046 IBinder token = data.readStrongBinder();
1047 int requestedOrientation = data.readInt();
1048 setRequestedOrientation(token, requestedOrientation);
1049 reply.writeNoException();
1050 return true;
1051 }
1052
1053 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1054 data.enforceInterface(IActivityManager.descriptor);
1055 IBinder token = data.readStrongBinder();
1056 int req = getRequestedOrientation(token);
1057 reply.writeNoException();
1058 reply.writeInt(req);
1059 return true;
1060 }
1061
1062 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1063 data.enforceInterface(IActivityManager.descriptor);
1064 IBinder token = data.readStrongBinder();
1065 ComponentName cn = getActivityClassForToken(token);
1066 reply.writeNoException();
1067 ComponentName.writeToParcel(cn, reply);
1068 return true;
1069 }
1070
1071 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1072 data.enforceInterface(IActivityManager.descriptor);
1073 IBinder token = data.readStrongBinder();
1074 reply.writeNoException();
1075 reply.writeString(getPackageForToken(token));
1076 return true;
1077 }
1078
1079 case GET_INTENT_SENDER_TRANSACTION: {
1080 data.enforceInterface(IActivityManager.descriptor);
1081 int type = data.readInt();
1082 String packageName = data.readString();
1083 IBinder token = data.readStrongBinder();
1084 String resultWho = data.readString();
1085 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001086 Intent[] requestIntents;
1087 String[] requestResolvedTypes;
1088 if (data.readInt() != 0) {
1089 requestIntents = data.createTypedArray(Intent.CREATOR);
1090 requestResolvedTypes = data.createStringArray();
1091 } else {
1092 requestIntents = null;
1093 requestResolvedTypes = null;
1094 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001095 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001096 Bundle options = data.readInt() != 0
1097 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001098 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001099 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001100 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001101 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001102 reply.writeNoException();
1103 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1104 return true;
1105 }
1106
1107 case CANCEL_INTENT_SENDER_TRANSACTION: {
1108 data.enforceInterface(IActivityManager.descriptor);
1109 IIntentSender r = IIntentSender.Stub.asInterface(
1110 data.readStrongBinder());
1111 cancelIntentSender(r);
1112 reply.writeNoException();
1113 return true;
1114 }
1115
1116 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1117 data.enforceInterface(IActivityManager.descriptor);
1118 IIntentSender r = IIntentSender.Stub.asInterface(
1119 data.readStrongBinder());
1120 String res = getPackageForIntentSender(r);
1121 reply.writeNoException();
1122 reply.writeString(res);
1123 return true;
1124 }
1125
Christopher Tatec4a07d12012-04-06 14:19:13 -07001126 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1127 data.enforceInterface(IActivityManager.descriptor);
1128 IIntentSender r = IIntentSender.Stub.asInterface(
1129 data.readStrongBinder());
1130 int res = getUidForIntentSender(r);
1131 reply.writeNoException();
1132 reply.writeInt(res);
1133 return true;
1134 }
1135
Dianne Hackborn41203752012-08-31 14:05:51 -07001136 case HANDLE_INCOMING_USER_TRANSACTION: {
1137 data.enforceInterface(IActivityManager.descriptor);
1138 int callingPid = data.readInt();
1139 int callingUid = data.readInt();
1140 int userId = data.readInt();
1141 boolean allowAll = data.readInt() != 0 ;
1142 boolean requireFull = data.readInt() != 0;
1143 String name = data.readString();
1144 String callerPackage = data.readString();
1145 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1146 requireFull, name, callerPackage);
1147 reply.writeNoException();
1148 reply.writeInt(res);
1149 return true;
1150 }
1151
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 case SET_PROCESS_LIMIT_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 int max = data.readInt();
1155 setProcessLimit(max);
1156 reply.writeNoException();
1157 return true;
1158 }
1159
1160 case GET_PROCESS_LIMIT_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 int limit = getProcessLimit();
1163 reply.writeNoException();
1164 reply.writeInt(limit);
1165 return true;
1166 }
1167
1168 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1169 data.enforceInterface(IActivityManager.descriptor);
1170 IBinder token = data.readStrongBinder();
1171 int pid = data.readInt();
1172 boolean isForeground = data.readInt() != 0;
1173 setProcessForeground(token, pid, isForeground);
1174 reply.writeNoException();
1175 return true;
1176 }
1177
1178 case CHECK_PERMISSION_TRANSACTION: {
1179 data.enforceInterface(IActivityManager.descriptor);
1180 String perm = data.readString();
1181 int pid = data.readInt();
1182 int uid = data.readInt();
1183 int res = checkPermission(perm, pid, uid);
1184 reply.writeNoException();
1185 reply.writeInt(res);
1186 return true;
1187 }
1188
1189 case CHECK_URI_PERMISSION_TRANSACTION: {
1190 data.enforceInterface(IActivityManager.descriptor);
1191 Uri uri = Uri.CREATOR.createFromParcel(data);
1192 int pid = data.readInt();
1193 int uid = data.readInt();
1194 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001195 int userId = data.readInt();
1196 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001197 reply.writeNoException();
1198 reply.writeInt(res);
1199 return true;
1200 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001201
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001202 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001203 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001204 String packageName = data.readString();
1205 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1206 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001207 int userId = data.readInt();
1208 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001209 reply.writeNoException();
1210 reply.writeInt(res ? 1 : 0);
1211 return true;
1212 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001213
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001214 case GRANT_URI_PERMISSION_TRANSACTION: {
1215 data.enforceInterface(IActivityManager.descriptor);
1216 IBinder b = data.readStrongBinder();
1217 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1218 String targetPkg = data.readString();
1219 Uri uri = Uri.CREATOR.createFromParcel(data);
1220 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001221 int userId = data.readInt();
1222 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223 reply.writeNoException();
1224 return true;
1225 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001226
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001227 case REVOKE_URI_PERMISSION_TRANSACTION: {
1228 data.enforceInterface(IActivityManager.descriptor);
1229 IBinder b = data.readStrongBinder();
1230 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1231 Uri uri = Uri.CREATOR.createFromParcel(data);
1232 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001233 int userId = data.readInt();
1234 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001235 reply.writeNoException();
1236 return true;
1237 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001238
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001239 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1240 data.enforceInterface(IActivityManager.descriptor);
1241 Uri uri = Uri.CREATOR.createFromParcel(data);
1242 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001243 int userId = data.readInt();
1244 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001245 reply.writeNoException();
1246 return true;
1247 }
1248
1249 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1250 data.enforceInterface(IActivityManager.descriptor);
1251 Uri uri = Uri.CREATOR.createFromParcel(data);
1252 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001253 int userId = data.readInt();
1254 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001255 reply.writeNoException();
1256 return true;
1257 }
1258
1259 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1260 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001261 final String packageName = data.readString();
1262 final boolean incoming = data.readInt() != 0;
1263 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1264 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001265 reply.writeNoException();
1266 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1267 return true;
1268 }
1269
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001270 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1271 data.enforceInterface(IActivityManager.descriptor);
1272 IBinder b = data.readStrongBinder();
1273 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1274 boolean waiting = data.readInt() != 0;
1275 showWaitingForDebugger(app, waiting);
1276 reply.writeNoException();
1277 return true;
1278 }
1279
1280 case GET_MEMORY_INFO_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
1282 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1283 getMemoryInfo(mi);
1284 reply.writeNoException();
1285 mi.writeToParcel(reply, 0);
1286 return true;
1287 }
1288
1289 case UNHANDLED_BACK_TRANSACTION: {
1290 data.enforceInterface(IActivityManager.descriptor);
1291 unhandledBack();
1292 reply.writeNoException();
1293 return true;
1294 }
1295
1296 case OPEN_CONTENT_URI_TRANSACTION: {
1297 data.enforceInterface(IActivityManager.descriptor);
1298 Uri uri = Uri.parse(data.readString());
1299 ParcelFileDescriptor pfd = openContentUri(uri);
1300 reply.writeNoException();
1301 if (pfd != null) {
1302 reply.writeInt(1);
1303 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1304 } else {
1305 reply.writeInt(0);
1306 }
1307 return true;
1308 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001309
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001310 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1311 data.enforceInterface(IActivityManager.descriptor);
1312 setLockScreenShown(data.readInt() != 0);
1313 reply.writeNoException();
1314 return true;
1315 }
1316
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001317 case SET_DEBUG_APP_TRANSACTION: {
1318 data.enforceInterface(IActivityManager.descriptor);
1319 String pn = data.readString();
1320 boolean wfd = data.readInt() != 0;
1321 boolean per = data.readInt() != 0;
1322 setDebugApp(pn, wfd, per);
1323 reply.writeNoException();
1324 return true;
1325 }
1326
1327 case SET_ALWAYS_FINISH_TRANSACTION: {
1328 data.enforceInterface(IActivityManager.descriptor);
1329 boolean enabled = data.readInt() != 0;
1330 setAlwaysFinish(enabled);
1331 reply.writeNoException();
1332 return true;
1333 }
1334
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001335 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001336 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001337 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001338 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001339 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001340 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001341 return true;
1342 }
1343
1344 case ENTER_SAFE_MODE_TRANSACTION: {
1345 data.enforceInterface(IActivityManager.descriptor);
1346 enterSafeMode();
1347 reply.writeNoException();
1348 return true;
1349 }
1350
1351 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1352 data.enforceInterface(IActivityManager.descriptor);
1353 IIntentSender is = IIntentSender.Stub.asInterface(
1354 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001355 int sourceUid = data.readInt();
1356 String sourcePkg = data.readString();
1357 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001358 reply.writeNoException();
1359 return true;
1360 }
1361
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001362 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001363 data.enforceInterface(IActivityManager.descriptor);
1364 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001365 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001366 boolean secure = data.readInt() != 0;
1367 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001368 reply.writeNoException();
1369 reply.writeInt(res ? 1 : 0);
1370 return true;
1371 }
1372
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001373 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1374 data.enforceInterface(IActivityManager.descriptor);
1375 String reason = data.readString();
1376 boolean res = killProcessesBelowForeground(reason);
1377 reply.writeNoException();
1378 reply.writeInt(res ? 1 : 0);
1379 return true;
1380 }
1381
Dan Egnor60d87622009-12-16 16:32:58 -08001382 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1383 data.enforceInterface(IActivityManager.descriptor);
1384 IBinder app = data.readStrongBinder();
1385 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1386 handleApplicationCrash(app, ci);
1387 reply.writeNoException();
1388 return true;
1389 }
1390
1391 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001392 data.enforceInterface(IActivityManager.descriptor);
1393 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001394 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001395 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001396 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001397 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001398 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001399 return true;
1400 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001401
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001402 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1403 data.enforceInterface(IActivityManager.descriptor);
1404 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001405 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001406 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1407 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001408 reply.writeNoException();
1409 return true;
1410 }
1411
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001412 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1413 data.enforceInterface(IActivityManager.descriptor);
1414 int sig = data.readInt();
1415 signalPersistentProcesses(sig);
1416 reply.writeNoException();
1417 return true;
1418 }
1419
Dianne Hackborn03abb812010-01-04 18:43:19 -08001420 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1421 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001423 int userId = data.readInt();
1424 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001425 reply.writeNoException();
1426 return true;
1427 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001428
1429 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1430 data.enforceInterface(IActivityManager.descriptor);
1431 killAllBackgroundProcesses();
1432 reply.writeNoException();
1433 return true;
1434 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001435
Dianne Hackborn03abb812010-01-04 18:43:19 -08001436 case FORCE_STOP_PACKAGE_TRANSACTION: {
1437 data.enforceInterface(IActivityManager.descriptor);
1438 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001439 int userId = data.readInt();
1440 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001441 reply.writeNoException();
1442 return true;
1443 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001444
1445 case GET_MY_MEMORY_STATE_TRANSACTION: {
1446 data.enforceInterface(IActivityManager.descriptor);
1447 ActivityManager.RunningAppProcessInfo info =
1448 new ActivityManager.RunningAppProcessInfo();
1449 getMyMemoryState(info);
1450 reply.writeNoException();
1451 info.writeToParcel(reply, 0);
1452 return true;
1453 }
1454
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001455 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1456 data.enforceInterface(IActivityManager.descriptor);
1457 ConfigurationInfo config = getDeviceConfigurationInfo();
1458 reply.writeNoException();
1459 config.writeToParcel(reply, 0);
1460 return true;
1461 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001462
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001463 case PROFILE_CONTROL_TRANSACTION: {
1464 data.enforceInterface(IActivityManager.descriptor);
1465 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001466 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001467 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001468 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001469 ProfilerInfo profilerInfo = data.readInt() != 0
1470 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1471 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001472 reply.writeNoException();
1473 reply.writeInt(res ? 1 : 0);
1474 return true;
1475 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001476
Dianne Hackborn55280a92009-05-07 15:53:46 -07001477 case SHUTDOWN_TRANSACTION: {
1478 data.enforceInterface(IActivityManager.descriptor);
1479 boolean res = shutdown(data.readInt());
1480 reply.writeNoException();
1481 reply.writeInt(res ? 1 : 0);
1482 return true;
1483 }
1484
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001485 case STOP_APP_SWITCHES_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 stopAppSwitches();
1488 reply.writeNoException();
1489 return true;
1490 }
1491
1492 case RESUME_APP_SWITCHES_TRANSACTION: {
1493 data.enforceInterface(IActivityManager.descriptor);
1494 resumeAppSwitches();
1495 reply.writeNoException();
1496 return true;
1497 }
1498
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001499 case PEEK_SERVICE_TRANSACTION: {
1500 data.enforceInterface(IActivityManager.descriptor);
1501 Intent service = Intent.CREATOR.createFromParcel(data);
1502 String resolvedType = data.readString();
1503 IBinder binder = peekService(service, resolvedType);
1504 reply.writeNoException();
1505 reply.writeStrongBinder(binder);
1506 return true;
1507 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001508
1509 case START_BACKUP_AGENT_TRANSACTION: {
1510 data.enforceInterface(IActivityManager.descriptor);
1511 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1512 int backupRestoreMode = data.readInt();
1513 boolean success = bindBackupAgent(info, backupRestoreMode);
1514 reply.writeNoException();
1515 reply.writeInt(success ? 1 : 0);
1516 return true;
1517 }
1518
1519 case BACKUP_AGENT_CREATED_TRANSACTION: {
1520 data.enforceInterface(IActivityManager.descriptor);
1521 String packageName = data.readString();
1522 IBinder agent = data.readStrongBinder();
1523 backupAgentCreated(packageName, agent);
1524 reply.writeNoException();
1525 return true;
1526 }
1527
1528 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1529 data.enforceInterface(IActivityManager.descriptor);
1530 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1531 unbindBackupAgent(info);
1532 reply.writeNoException();
1533 return true;
1534 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001535
1536 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1537 data.enforceInterface(IActivityManager.descriptor);
1538 String packageName = data.readString();
1539 addPackageDependency(packageName);
1540 reply.writeNoException();
1541 return true;
1542 }
1543
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001544 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001545 data.enforceInterface(IActivityManager.descriptor);
1546 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001547 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001548 String reason = data.readString();
1549 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001550 reply.writeNoException();
1551 return true;
1552 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001553
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001554 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1555 data.enforceInterface(IActivityManager.descriptor);
1556 String reason = data.readString();
1557 closeSystemDialogs(reason);
1558 reply.writeNoException();
1559 return true;
1560 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001561
1562 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1563 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001564 int[] pids = data.createIntArray();
1565 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001566 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001567 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001568 return true;
1569 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001570
1571 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1572 data.enforceInterface(IActivityManager.descriptor);
1573 String processName = data.readString();
1574 int uid = data.readInt();
1575 killApplicationProcess(processName, uid);
1576 reply.writeNoException();
1577 return true;
1578 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001579
1580 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1581 data.enforceInterface(IActivityManager.descriptor);
1582 IBinder token = data.readStrongBinder();
1583 String packageName = data.readString();
1584 int enterAnim = data.readInt();
1585 int exitAnim = data.readInt();
1586 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001587 reply.writeNoException();
1588 return true;
1589 }
1590
1591 case IS_USER_A_MONKEY_TRANSACTION: {
1592 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001593 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001594 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001595 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001596 return true;
1597 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001598
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001599 case SET_USER_IS_MONKEY_TRANSACTION: {
1600 data.enforceInterface(IActivityManager.descriptor);
1601 final boolean monkey = (data.readInt() == 1);
1602 setUserIsMonkey(monkey);
1603 reply.writeNoException();
1604 return true;
1605 }
1606
Dianne Hackborn860755f2010-06-03 18:47:52 -07001607 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1608 data.enforceInterface(IActivityManager.descriptor);
1609 finishHeavyWeightApp();
1610 reply.writeNoException();
1611 return true;
1612 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001613
1614 case IS_IMMERSIVE_TRANSACTION: {
1615 data.enforceInterface(IActivityManager.descriptor);
1616 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001617 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001618 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001619 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001620 return true;
1621 }
1622
Craig Mautnerd61dc202014-07-07 11:09:11 -07001623 case IS_TOP_OF_TASK_TRANSACTION: {
1624 data.enforceInterface(IActivityManager.descriptor);
1625 IBinder token = data.readStrongBinder();
1626 final boolean isTopOfTask = isTopOfTask(token);
1627 reply.writeNoException();
1628 reply.writeInt(isTopOfTask ? 1 : 0);
1629 return true;
1630 }
1631
Craig Mautner5eda9b32013-07-02 11:58:16 -07001632 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001633 data.enforceInterface(IActivityManager.descriptor);
1634 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001635 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001636 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001637 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001638 return true;
1639 }
1640
1641 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1642 data.enforceInterface(IActivityManager.descriptor);
1643 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001644 final Bundle bundle;
1645 if (data.readInt() == 0) {
1646 bundle = null;
1647 } else {
1648 bundle = data.readBundle();
1649 }
1650 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1651 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001652 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001653 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001654 return true;
1655 }
1656
Craig Mautner233ceee2014-05-09 17:05:11 -07001657 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1658 data.enforceInterface(IActivityManager.descriptor);
1659 IBinder token = data.readStrongBinder();
1660 final ActivityOptions options = getActivityOptions(token);
1661 reply.writeNoException();
1662 reply.writeBundle(options == null ? null : options.toBundle());
1663 return true;
1664 }
1665
Daniel Sandler69a48172010-06-23 16:29:36 -04001666 case SET_IMMERSIVE_TRANSACTION: {
1667 data.enforceInterface(IActivityManager.descriptor);
1668 IBinder token = data.readStrongBinder();
1669 boolean imm = data.readInt() == 1;
1670 setImmersive(token, imm);
1671 reply.writeNoException();
1672 return true;
1673 }
1674
1675 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1676 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001677 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001678 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001679 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001680 return true;
1681 }
1682
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001683 case CRASH_APPLICATION_TRANSACTION: {
1684 data.enforceInterface(IActivityManager.descriptor);
1685 int uid = data.readInt();
1686 int initialPid = data.readInt();
1687 String packageName = data.readString();
1688 String message = data.readString();
1689 crashApplication(uid, initialPid, packageName, message);
1690 reply.writeNoException();
1691 return true;
1692 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001693
1694 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1695 data.enforceInterface(IActivityManager.descriptor);
1696 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001697 int userId = data.readInt();
1698 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001699 reply.writeNoException();
1700 reply.writeString(type);
1701 return true;
1702 }
1703
Dianne Hackborn7e269642010-08-25 19:50:20 -07001704 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1705 data.enforceInterface(IActivityManager.descriptor);
1706 String name = data.readString();
1707 IBinder perm = newUriPermissionOwner(name);
1708 reply.writeNoException();
1709 reply.writeStrongBinder(perm);
1710 return true;
1711 }
1712
1713 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1714 data.enforceInterface(IActivityManager.descriptor);
1715 IBinder owner = data.readStrongBinder();
1716 int fromUid = data.readInt();
1717 String targetPkg = data.readString();
1718 Uri uri = Uri.CREATOR.createFromParcel(data);
1719 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001720 int sourceUserId = data.readInt();
1721 int targetUserId = data.readInt();
1722 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1723 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001724 reply.writeNoException();
1725 return true;
1726 }
1727
1728 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1729 data.enforceInterface(IActivityManager.descriptor);
1730 IBinder owner = data.readStrongBinder();
1731 Uri uri = null;
1732 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001733 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001734 }
1735 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001736 int userId = data.readInt();
1737 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001738 reply.writeNoException();
1739 return true;
1740 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001741
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001742 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 int callingUid = data.readInt();
1745 String targetPkg = data.readString();
1746 Uri uri = Uri.CREATOR.createFromParcel(data);
1747 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001748 int userId = data.readInt();
1749 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001750 reply.writeNoException();
1751 reply.writeInt(res);
1752 return true;
1753 }
1754
Andy McFadden824c5102010-07-09 16:26:57 -07001755 case DUMP_HEAP_TRANSACTION: {
1756 data.enforceInterface(IActivityManager.descriptor);
1757 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001758 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001759 boolean managed = data.readInt() != 0;
1760 String path = data.readString();
1761 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001762 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001763 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001764 reply.writeNoException();
1765 reply.writeInt(res ? 1 : 0);
1766 return true;
1767 }
1768
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001769 case START_ACTIVITIES_TRANSACTION:
1770 {
1771 data.enforceInterface(IActivityManager.descriptor);
1772 IBinder b = data.readStrongBinder();
1773 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001774 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001775 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1776 String[] resolvedTypes = data.createStringArray();
1777 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001778 Bundle options = data.readInt() != 0
1779 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001780 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001781 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001782 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001783 reply.writeNoException();
1784 reply.writeInt(result);
1785 return true;
1786 }
1787
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001788 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1789 {
1790 data.enforceInterface(IActivityManager.descriptor);
1791 int mode = getFrontActivityScreenCompatMode();
1792 reply.writeNoException();
1793 reply.writeInt(mode);
1794 return true;
1795 }
1796
1797 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1798 {
1799 data.enforceInterface(IActivityManager.descriptor);
1800 int mode = data.readInt();
1801 setFrontActivityScreenCompatMode(mode);
1802 reply.writeNoException();
1803 reply.writeInt(mode);
1804 return true;
1805 }
1806
1807 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1808 {
1809 data.enforceInterface(IActivityManager.descriptor);
1810 String pkg = data.readString();
1811 int mode = getPackageScreenCompatMode(pkg);
1812 reply.writeNoException();
1813 reply.writeInt(mode);
1814 return true;
1815 }
1816
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001817 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1818 {
1819 data.enforceInterface(IActivityManager.descriptor);
1820 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001821 int mode = data.readInt();
1822 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001823 reply.writeNoException();
1824 return true;
1825 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001826
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001827 case SWITCH_USER_TRANSACTION: {
1828 data.enforceInterface(IActivityManager.descriptor);
1829 int userid = data.readInt();
1830 boolean result = switchUser(userid);
1831 reply.writeNoException();
1832 reply.writeInt(result ? 1 : 0);
1833 return true;
1834 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001835
Kenny Guy08488bf2014-02-21 17:40:37 +00001836 case START_USER_IN_BACKGROUND_TRANSACTION: {
1837 data.enforceInterface(IActivityManager.descriptor);
1838 int userid = data.readInt();
1839 boolean result = startUserInBackground(userid);
1840 reply.writeNoException();
1841 reply.writeInt(result ? 1 : 0);
1842 return true;
1843 }
1844
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001845 case STOP_USER_TRANSACTION: {
1846 data.enforceInterface(IActivityManager.descriptor);
1847 int userid = data.readInt();
1848 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1849 data.readStrongBinder());
1850 int result = stopUser(userid, callback);
1851 reply.writeNoException();
1852 reply.writeInt(result);
1853 return true;
1854 }
1855
Amith Yamasani52f1d752012-03-28 18:19:29 -07001856 case GET_CURRENT_USER_TRANSACTION: {
1857 data.enforceInterface(IActivityManager.descriptor);
1858 UserInfo userInfo = getCurrentUser();
1859 reply.writeNoException();
1860 userInfo.writeToParcel(reply, 0);
1861 return true;
1862 }
1863
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001864 case IS_USER_RUNNING_TRANSACTION: {
1865 data.enforceInterface(IActivityManager.descriptor);
1866 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001867 boolean orStopping = data.readInt() != 0;
1868 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001869 reply.writeNoException();
1870 reply.writeInt(result ? 1 : 0);
1871 return true;
1872 }
1873
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001874 case GET_RUNNING_USER_IDS_TRANSACTION: {
1875 data.enforceInterface(IActivityManager.descriptor);
1876 int[] result = getRunningUserIds();
1877 reply.writeNoException();
1878 reply.writeIntArray(result);
1879 return true;
1880 }
1881
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001882 case REMOVE_TASK_TRANSACTION:
1883 {
1884 data.enforceInterface(IActivityManager.descriptor);
1885 int taskId = data.readInt();
1886 int fl = data.readInt();
1887 boolean result = removeTask(taskId, fl);
1888 reply.writeNoException();
1889 reply.writeInt(result ? 1 : 0);
1890 return true;
1891 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001892
Jeff Sharkeya4620792011-05-20 15:29:23 -07001893 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1894 data.enforceInterface(IActivityManager.descriptor);
1895 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1896 data.readStrongBinder());
1897 registerProcessObserver(observer);
1898 return true;
1899 }
1900
1901 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1902 data.enforceInterface(IActivityManager.descriptor);
1903 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1904 data.readStrongBinder());
1905 unregisterProcessObserver(observer);
1906 return true;
1907 }
1908
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001909 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1910 {
1911 data.enforceInterface(IActivityManager.descriptor);
1912 String pkg = data.readString();
1913 boolean ask = getPackageAskScreenCompat(pkg);
1914 reply.writeNoException();
1915 reply.writeInt(ask ? 1 : 0);
1916 return true;
1917 }
1918
1919 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1920 {
1921 data.enforceInterface(IActivityManager.descriptor);
1922 String pkg = data.readString();
1923 boolean ask = data.readInt() != 0;
1924 setPackageAskScreenCompat(pkg, ask);
1925 reply.writeNoException();
1926 return true;
1927 }
1928
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001929 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1930 data.enforceInterface(IActivityManager.descriptor);
1931 IIntentSender r = IIntentSender.Stub.asInterface(
1932 data.readStrongBinder());
1933 boolean res = isIntentSenderTargetedToPackage(r);
1934 reply.writeNoException();
1935 reply.writeInt(res ? 1 : 0);
1936 return true;
1937 }
1938
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001939 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1940 data.enforceInterface(IActivityManager.descriptor);
1941 IIntentSender r = IIntentSender.Stub.asInterface(
1942 data.readStrongBinder());
1943 boolean res = isIntentSenderAnActivity(r);
1944 reply.writeNoException();
1945 reply.writeInt(res ? 1 : 0);
1946 return true;
1947 }
1948
Dianne Hackborn81038902012-11-26 17:04:09 -08001949 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1950 data.enforceInterface(IActivityManager.descriptor);
1951 IIntentSender r = IIntentSender.Stub.asInterface(
1952 data.readStrongBinder());
1953 Intent intent = getIntentForIntentSender(r);
1954 reply.writeNoException();
1955 if (intent != null) {
1956 reply.writeInt(1);
1957 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1958 } else {
1959 reply.writeInt(0);
1960 }
1961 return true;
1962 }
1963
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001964 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1965 data.enforceInterface(IActivityManager.descriptor);
1966 IIntentSender r = IIntentSender.Stub.asInterface(
1967 data.readStrongBinder());
1968 String prefix = data.readString();
1969 String tag = getTagForIntentSender(r, prefix);
1970 reply.writeNoException();
1971 reply.writeString(tag);
1972 return true;
1973 }
1974
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001975 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1976 data.enforceInterface(IActivityManager.descriptor);
1977 Configuration config = Configuration.CREATOR.createFromParcel(data);
1978 updatePersistentConfiguration(config);
1979 reply.writeNoException();
1980 return true;
1981 }
1982
Dianne Hackbornb437e092011-08-05 17:50:29 -07001983 case GET_PROCESS_PSS_TRANSACTION: {
1984 data.enforceInterface(IActivityManager.descriptor);
1985 int[] pids = data.createIntArray();
1986 long[] pss = getProcessPss(pids);
1987 reply.writeNoException();
1988 reply.writeLongArray(pss);
1989 return true;
1990 }
1991
Dianne Hackborn661cd522011-08-22 00:26:20 -07001992 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1993 data.enforceInterface(IActivityManager.descriptor);
1994 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1995 boolean always = data.readInt() != 0;
1996 showBootMessage(msg, always);
1997 reply.writeNoException();
1998 return true;
1999 }
2000
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002001 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002002 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002003 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002004 reply.writeNoException();
2005 return true;
2006 }
2007
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002008 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002009 data.enforceInterface(IActivityManager.descriptor);
2010 IBinder token = data.readStrongBinder();
2011 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002012 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002013 reply.writeNoException();
2014 reply.writeInt(res ? 1 : 0);
2015 return true;
2016 }
2017
2018 case NAVIGATE_UP_TO_TRANSACTION: {
2019 data.enforceInterface(IActivityManager.descriptor);
2020 IBinder token = data.readStrongBinder();
2021 Intent target = Intent.CREATOR.createFromParcel(data);
2022 int resultCode = data.readInt();
2023 Intent resultData = null;
2024 if (data.readInt() != 0) {
2025 resultData = Intent.CREATOR.createFromParcel(data);
2026 }
2027 boolean res = navigateUpTo(token, target, resultCode, resultData);
2028 reply.writeNoException();
2029 reply.writeInt(res ? 1 : 0);
2030 return true;
2031 }
2032
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002033 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2034 data.enforceInterface(IActivityManager.descriptor);
2035 IBinder token = data.readStrongBinder();
2036 int res = getLaunchedFromUid(token);
2037 reply.writeNoException();
2038 reply.writeInt(res);
2039 return true;
2040 }
2041
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002042 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2043 data.enforceInterface(IActivityManager.descriptor);
2044 IBinder token = data.readStrongBinder();
2045 String res = getLaunchedFromPackage(token);
2046 reply.writeNoException();
2047 reply.writeString(res);
2048 return true;
2049 }
2050
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002051 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2052 data.enforceInterface(IActivityManager.descriptor);
2053 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2054 data.readStrongBinder());
2055 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002056 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002057 return true;
2058 }
2059
2060 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2061 data.enforceInterface(IActivityManager.descriptor);
2062 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2063 data.readStrongBinder());
2064 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002065 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002066 return true;
2067 }
2068
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002069 case REQUEST_BUG_REPORT_TRANSACTION: {
2070 data.enforceInterface(IActivityManager.descriptor);
2071 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002072 reply.writeNoException();
2073 return true;
2074 }
2075
2076 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2077 data.enforceInterface(IActivityManager.descriptor);
2078 int pid = data.readInt();
2079 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002080 String reason = data.readString();
2081 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002082 reply.writeNoException();
2083 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002084 return true;
2085 }
2086
Adam Skorydfc7fd72013-08-05 19:23:41 -07002087 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002088 data.enforceInterface(IActivityManager.descriptor);
2089 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002090 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002091 reply.writeNoException();
2092 reply.writeBundle(res);
2093 return true;
2094 }
2095
Adam Skorydfc7fd72013-08-05 19:23:41 -07002096 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002097 data.enforceInterface(IActivityManager.descriptor);
2098 IBinder token = data.readStrongBinder();
2099 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002100 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002101 reply.writeNoException();
2102 return true;
2103 }
2104
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002105 case KILL_UID_TRANSACTION: {
2106 data.enforceInterface(IActivityManager.descriptor);
2107 int uid = data.readInt();
2108 String reason = data.readString();
2109 killUid(uid, reason);
2110 reply.writeNoException();
2111 return true;
2112 }
2113
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002114 case HANG_TRANSACTION: {
2115 data.enforceInterface(IActivityManager.descriptor);
2116 IBinder who = data.readStrongBinder();
2117 boolean allowRestart = data.readInt() != 0;
2118 hang(who, allowRestart);
2119 reply.writeNoException();
2120 return true;
2121 }
2122
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002123 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2124 data.enforceInterface(IActivityManager.descriptor);
2125 IBinder token = data.readStrongBinder();
2126 reportActivityFullyDrawn(token);
2127 reply.writeNoException();
2128 return true;
2129 }
2130
Craig Mautner5eda9b32013-07-02 11:58:16 -07002131 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2132 data.enforceInterface(IActivityManager.descriptor);
2133 IBinder token = data.readStrongBinder();
2134 notifyActivityDrawn(token);
2135 reply.writeNoException();
2136 return true;
2137 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002138
2139 case RESTART_TRANSACTION: {
2140 data.enforceInterface(IActivityManager.descriptor);
2141 restart();
2142 reply.writeNoException();
2143 return true;
2144 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002145
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002146 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2147 data.enforceInterface(IActivityManager.descriptor);
2148 performIdleMaintenance();
2149 reply.writeNoException();
2150 return true;
2151 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002152
2153 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2154 data.enforceInterface(IActivityManager.descriptor);
2155 IBinder parentActivityToken = data.readStrongBinder();
2156 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002157 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002158 IActivityContainer activityContainer =
2159 createActivityContainer(parentActivityToken, callback);
2160 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002161 if (activityContainer != null) {
2162 reply.writeInt(1);
2163 reply.writeStrongBinder(activityContainer.asBinder());
2164 } else {
2165 reply.writeInt(0);
2166 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002167 return true;
2168 }
2169
Craig Mautner95da1082014-02-24 17:54:35 -08002170 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2171 data.enforceInterface(IActivityManager.descriptor);
2172 IActivityContainer activityContainer =
2173 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2174 deleteActivityContainer(activityContainer);
2175 reply.writeNoException();
2176 return true;
2177 }
2178
Craig Mautnere0a38842013-12-16 16:14:02 -08002179 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2180 data.enforceInterface(IActivityManager.descriptor);
2181 IBinder activityToken = data.readStrongBinder();
2182 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2183 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002184 if (activityContainer != null) {
2185 reply.writeInt(1);
2186 reply.writeStrongBinder(activityContainer.asBinder());
2187 } else {
2188 reply.writeInt(0);
2189 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002190 return true;
2191 }
2192
Craig Mautner4a1cb222013-12-04 16:14:06 -08002193 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2194 data.enforceInterface(IActivityManager.descriptor);
2195 IBinder homeActivityToken = getHomeActivityToken();
2196 reply.writeNoException();
2197 reply.writeStrongBinder(homeActivityToken);
2198 return true;
2199 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002200
2201 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2202 data.enforceInterface(IActivityManager.descriptor);
2203 final int taskId = data.readInt();
2204 startLockTaskMode(taskId);
2205 reply.writeNoException();
2206 return true;
2207 }
2208
2209 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2210 data.enforceInterface(IActivityManager.descriptor);
2211 IBinder token = data.readStrongBinder();
2212 startLockTaskMode(token);
2213 reply.writeNoException();
2214 return true;
2215 }
2216
Craig Mautnerd61dc202014-07-07 11:09:11 -07002217 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002218 data.enforceInterface(IActivityManager.descriptor);
2219 startLockTaskModeOnCurrent();
2220 reply.writeNoException();
2221 return true;
2222 }
2223
Craig Mautneraea74a52014-03-08 14:23:10 -08002224 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2225 data.enforceInterface(IActivityManager.descriptor);
2226 stopLockTaskMode();
2227 reply.writeNoException();
2228 return true;
2229 }
2230
Craig Mautnerd61dc202014-07-07 11:09:11 -07002231 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002232 data.enforceInterface(IActivityManager.descriptor);
2233 stopLockTaskModeOnCurrent();
2234 reply.writeNoException();
2235 return true;
2236 }
2237
Craig Mautneraea74a52014-03-08 14:23:10 -08002238 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2239 data.enforceInterface(IActivityManager.descriptor);
2240 final boolean isInLockTaskMode = isInLockTaskMode();
2241 reply.writeNoException();
2242 reply.writeInt(isInLockTaskMode ? 1 : 0);
2243 return true;
2244 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002245
Winson Chunga449dc02014-05-16 11:15:04 -07002246 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002247 data.enforceInterface(IActivityManager.descriptor);
2248 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002249 ActivityManager.TaskDescription values =
2250 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2251 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002252 reply.writeNoException();
2253 return true;
2254 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002255
Jose Lima4b6c6692014-08-12 17:41:12 -07002256 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002257 data.enforceInterface(IActivityManager.descriptor);
2258 IBinder token = data.readStrongBinder();
2259 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002260 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002261 reply.writeNoException();
2262 reply.writeInt(success ? 1 : 0);
2263 return true;
2264 }
2265
Jose Lima4b6c6692014-08-12 17:41:12 -07002266 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002267 data.enforceInterface(IActivityManager.descriptor);
2268 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002269 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002270 reply.writeNoException();
2271 reply.writeInt(enabled ? 1 : 0);
2272 return true;
2273 }
2274
Jose Lima4b6c6692014-08-12 17:41:12 -07002275 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002276 data.enforceInterface(IActivityManager.descriptor);
2277 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002278 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002279 reply.writeNoException();
2280 return true;
2281 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002282
2283 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2284 data.enforceInterface(IActivityManager.descriptor);
2285 IBinder token = data.readStrongBinder();
2286 notifyLaunchTaskBehindComplete(token);
2287 reply.writeNoException();
2288 return true;
2289 }
Craig Mautner8746a472014-07-24 15:12:54 -07002290
2291 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2292 data.enforceInterface(IActivityManager.descriptor);
2293 IBinder token = data.readStrongBinder();
2294 notifyEnterAnimationComplete(token);
2295 reply.writeNoException();
2296 return true;
2297 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002298 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002299
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002300 return super.onTransact(code, data, reply, flags);
2301 }
2302
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002303 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002304 return this;
2305 }
2306
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002307 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2308 protected IActivityManager create() {
2309 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002310 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002311 Log.v("ActivityManager", "default service binder = " + b);
2312 }
2313 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002314 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002315 Log.v("ActivityManager", "default service = " + am);
2316 }
2317 return am;
2318 }
2319 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002320}
2321
2322class ActivityManagerProxy implements IActivityManager
2323{
2324 public ActivityManagerProxy(IBinder remote)
2325 {
2326 mRemote = remote;
2327 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002328
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002329 public IBinder asBinder()
2330 {
2331 return mRemote;
2332 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002333
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002334 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002335 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002336 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002337 Parcel data = Parcel.obtain();
2338 Parcel reply = Parcel.obtain();
2339 data.writeInterfaceToken(IActivityManager.descriptor);
2340 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002341 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002342 intent.writeToParcel(data, 0);
2343 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002344 data.writeStrongBinder(resultTo);
2345 data.writeString(resultWho);
2346 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002347 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002348 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002349 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002350 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002351 } else {
2352 data.writeInt(0);
2353 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002354 if (options != null) {
2355 data.writeInt(1);
2356 options.writeToParcel(data, 0);
2357 } else {
2358 data.writeInt(0);
2359 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002360 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2361 reply.readException();
2362 int result = reply.readInt();
2363 reply.recycle();
2364 data.recycle();
2365 return result;
2366 }
Amith Yamasani82644082012-08-03 13:09:11 -07002367
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002368 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002369 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002370 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2371 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002372 Parcel data = Parcel.obtain();
2373 Parcel reply = Parcel.obtain();
2374 data.writeInterfaceToken(IActivityManager.descriptor);
2375 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002376 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002377 intent.writeToParcel(data, 0);
2378 data.writeString(resolvedType);
2379 data.writeStrongBinder(resultTo);
2380 data.writeString(resultWho);
2381 data.writeInt(requestCode);
2382 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002383 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002384 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002385 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002386 } else {
2387 data.writeInt(0);
2388 }
2389 if (options != null) {
2390 data.writeInt(1);
2391 options.writeToParcel(data, 0);
2392 } else {
2393 data.writeInt(0);
2394 }
2395 data.writeInt(userId);
2396 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2397 reply.readException();
2398 int result = reply.readInt();
2399 reply.recycle();
2400 data.recycle();
2401 return result;
2402 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002403 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2404 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002405 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002406 Parcel data = Parcel.obtain();
2407 Parcel reply = Parcel.obtain();
2408 data.writeInterfaceToken(IActivityManager.descriptor);
2409 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2410 data.writeString(callingPackage);
2411 intent.writeToParcel(data, 0);
2412 data.writeString(resolvedType);
2413 data.writeStrongBinder(resultTo);
2414 data.writeString(resultWho);
2415 data.writeInt(requestCode);
2416 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002417 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002418 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002419 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002420 } else {
2421 data.writeInt(0);
2422 }
2423 if (options != null) {
2424 data.writeInt(1);
2425 options.writeToParcel(data, 0);
2426 } else {
2427 data.writeInt(0);
2428 }
2429 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2430 reply.readException();
2431 int result = reply.readInt();
2432 reply.recycle();
2433 data.recycle();
2434 return result;
2435 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002436 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2437 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002438 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2439 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002440 Parcel data = Parcel.obtain();
2441 Parcel reply = Parcel.obtain();
2442 data.writeInterfaceToken(IActivityManager.descriptor);
2443 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002444 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002445 intent.writeToParcel(data, 0);
2446 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002447 data.writeStrongBinder(resultTo);
2448 data.writeString(resultWho);
2449 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002450 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002451 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002452 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002453 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002454 } else {
2455 data.writeInt(0);
2456 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002457 if (options != null) {
2458 data.writeInt(1);
2459 options.writeToParcel(data, 0);
2460 } else {
2461 data.writeInt(0);
2462 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002463 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002464 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2465 reply.readException();
2466 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2467 reply.recycle();
2468 data.recycle();
2469 return result;
2470 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002471 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2472 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002473 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002474 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002475 Parcel data = Parcel.obtain();
2476 Parcel reply = Parcel.obtain();
2477 data.writeInterfaceToken(IActivityManager.descriptor);
2478 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002479 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002480 intent.writeToParcel(data, 0);
2481 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002482 data.writeStrongBinder(resultTo);
2483 data.writeString(resultWho);
2484 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002485 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002486 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002487 if (options != null) {
2488 data.writeInt(1);
2489 options.writeToParcel(data, 0);
2490 } else {
2491 data.writeInt(0);
2492 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002493 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002494 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2495 reply.readException();
2496 int result = reply.readInt();
2497 reply.recycle();
2498 data.recycle();
2499 return result;
2500 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002501 public int startActivityIntentSender(IApplicationThread caller,
2502 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002503 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002504 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002505 Parcel data = Parcel.obtain();
2506 Parcel reply = Parcel.obtain();
2507 data.writeInterfaceToken(IActivityManager.descriptor);
2508 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2509 intent.writeToParcel(data, 0);
2510 if (fillInIntent != null) {
2511 data.writeInt(1);
2512 fillInIntent.writeToParcel(data, 0);
2513 } else {
2514 data.writeInt(0);
2515 }
2516 data.writeString(resolvedType);
2517 data.writeStrongBinder(resultTo);
2518 data.writeString(resultWho);
2519 data.writeInt(requestCode);
2520 data.writeInt(flagsMask);
2521 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002522 if (options != null) {
2523 data.writeInt(1);
2524 options.writeToParcel(data, 0);
2525 } else {
2526 data.writeInt(0);
2527 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002528 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002529 reply.readException();
2530 int result = reply.readInt();
2531 reply.recycle();
2532 data.recycle();
2533 return result;
2534 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002535 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2536 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002537 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2538 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002539 Parcel data = Parcel.obtain();
2540 Parcel reply = Parcel.obtain();
2541 data.writeInterfaceToken(IActivityManager.descriptor);
2542 data.writeString(callingPackage);
2543 data.writeInt(callingPid);
2544 data.writeInt(callingUid);
2545 intent.writeToParcel(data, 0);
2546 data.writeString(resolvedType);
2547 data.writeStrongBinder(session.asBinder());
2548 data.writeStrongBinder(interactor.asBinder());
2549 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002550 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002551 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002552 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002553 } else {
2554 data.writeInt(0);
2555 }
2556 if (options != null) {
2557 data.writeInt(1);
2558 options.writeToParcel(data, 0);
2559 } else {
2560 data.writeInt(0);
2561 }
2562 data.writeInt(userId);
2563 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2564 reply.readException();
2565 int result = reply.readInt();
2566 reply.recycle();
2567 data.recycle();
2568 return result;
2569 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002570 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002571 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002572 Parcel data = Parcel.obtain();
2573 Parcel reply = Parcel.obtain();
2574 data.writeInterfaceToken(IActivityManager.descriptor);
2575 data.writeStrongBinder(callingActivity);
2576 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002577 if (options != null) {
2578 data.writeInt(1);
2579 options.writeToParcel(data, 0);
2580 } else {
2581 data.writeInt(0);
2582 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002583 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2584 reply.readException();
2585 int result = reply.readInt();
2586 reply.recycle();
2587 data.recycle();
2588 return result != 0;
2589 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002590 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2591 Parcel data = Parcel.obtain();
2592 Parcel reply = Parcel.obtain();
2593 data.writeInterfaceToken(IActivityManager.descriptor);
2594 data.writeInt(taskId);
2595 if (options == null) {
2596 data.writeInt(0);
2597 } else {
2598 data.writeInt(1);
2599 options.writeToParcel(data, 0);
2600 }
2601 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2602 reply.readException();
2603 int result = reply.readInt();
2604 reply.recycle();
2605 data.recycle();
2606 return result;
2607 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002608 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002609 throws RemoteException {
2610 Parcel data = Parcel.obtain();
2611 Parcel reply = Parcel.obtain();
2612 data.writeInterfaceToken(IActivityManager.descriptor);
2613 data.writeStrongBinder(token);
2614 data.writeInt(resultCode);
2615 if (resultData != null) {
2616 data.writeInt(1);
2617 resultData.writeToParcel(data, 0);
2618 } else {
2619 data.writeInt(0);
2620 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002621 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002622 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2623 reply.readException();
2624 boolean res = reply.readInt() != 0;
2625 data.recycle();
2626 reply.recycle();
2627 return res;
2628 }
2629 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2630 {
2631 Parcel data = Parcel.obtain();
2632 Parcel reply = Parcel.obtain();
2633 data.writeInterfaceToken(IActivityManager.descriptor);
2634 data.writeStrongBinder(token);
2635 data.writeString(resultWho);
2636 data.writeInt(requestCode);
2637 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2638 reply.readException();
2639 data.recycle();
2640 reply.recycle();
2641 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002642 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2643 Parcel data = Parcel.obtain();
2644 Parcel reply = Parcel.obtain();
2645 data.writeInterfaceToken(IActivityManager.descriptor);
2646 data.writeStrongBinder(token);
2647 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2648 reply.readException();
2649 boolean res = reply.readInt() != 0;
2650 data.recycle();
2651 reply.recycle();
2652 return res;
2653 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002654 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2655 Parcel data = Parcel.obtain();
2656 Parcel reply = Parcel.obtain();
2657 data.writeInterfaceToken(IActivityManager.descriptor);
2658 data.writeStrongBinder(session.asBinder());
2659 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2660 reply.readException();
2661 data.recycle();
2662 reply.recycle();
2663 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002664 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2665 Parcel data = Parcel.obtain();
2666 Parcel reply = Parcel.obtain();
2667 data.writeInterfaceToken(IActivityManager.descriptor);
2668 data.writeStrongBinder(token);
2669 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2670 reply.readException();
2671 boolean res = reply.readInt() != 0;
2672 data.recycle();
2673 reply.recycle();
2674 return res;
2675 }
2676 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2677 Parcel data = Parcel.obtain();
2678 Parcel reply = Parcel.obtain();
2679 data.writeInterfaceToken(IActivityManager.descriptor);
2680 data.writeStrongBinder(app.asBinder());
2681 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2682 reply.readException();
2683 data.recycle();
2684 reply.recycle();
2685 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002686 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2687 Parcel data = Parcel.obtain();
2688 Parcel reply = Parcel.obtain();
2689 data.writeInterfaceToken(IActivityManager.descriptor);
2690 data.writeStrongBinder(token);
2691 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2692 reply.readException();
2693 boolean res = reply.readInt() != 0;
2694 data.recycle();
2695 reply.recycle();
2696 return res;
2697 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002698 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002699 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002700 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002701 {
2702 Parcel data = Parcel.obtain();
2703 Parcel reply = Parcel.obtain();
2704 data.writeInterfaceToken(IActivityManager.descriptor);
2705 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002706 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002707 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2708 filter.writeToParcel(data, 0);
2709 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002710 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002711 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2712 reply.readException();
2713 Intent intent = null;
2714 int haveIntent = reply.readInt();
2715 if (haveIntent != 0) {
2716 intent = Intent.CREATOR.createFromParcel(reply);
2717 }
2718 reply.recycle();
2719 data.recycle();
2720 return intent;
2721 }
2722 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2723 {
2724 Parcel data = Parcel.obtain();
2725 Parcel reply = Parcel.obtain();
2726 data.writeInterfaceToken(IActivityManager.descriptor);
2727 data.writeStrongBinder(receiver.asBinder());
2728 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2729 reply.readException();
2730 data.recycle();
2731 reply.recycle();
2732 }
2733 public int broadcastIntent(IApplicationThread caller,
2734 Intent intent, String resolvedType, IIntentReceiver resultTo,
2735 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002736 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002737 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002738 {
2739 Parcel data = Parcel.obtain();
2740 Parcel reply = Parcel.obtain();
2741 data.writeInterfaceToken(IActivityManager.descriptor);
2742 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2743 intent.writeToParcel(data, 0);
2744 data.writeString(resolvedType);
2745 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2746 data.writeInt(resultCode);
2747 data.writeString(resultData);
2748 data.writeBundle(map);
2749 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002750 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002751 data.writeInt(serialized ? 1 : 0);
2752 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002753 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002754 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2755 reply.readException();
2756 int res = reply.readInt();
2757 reply.recycle();
2758 data.recycle();
2759 return res;
2760 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002761 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2762 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002763 {
2764 Parcel data = Parcel.obtain();
2765 Parcel reply = Parcel.obtain();
2766 data.writeInterfaceToken(IActivityManager.descriptor);
2767 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2768 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002769 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002770 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2771 reply.readException();
2772 data.recycle();
2773 reply.recycle();
2774 }
2775 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2776 {
2777 Parcel data = Parcel.obtain();
2778 Parcel reply = Parcel.obtain();
2779 data.writeInterfaceToken(IActivityManager.descriptor);
2780 data.writeStrongBinder(who);
2781 data.writeInt(resultCode);
2782 data.writeString(resultData);
2783 data.writeBundle(map);
2784 data.writeInt(abortBroadcast ? 1 : 0);
2785 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2786 reply.readException();
2787 data.recycle();
2788 reply.recycle();
2789 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002790 public void attachApplication(IApplicationThread app) throws RemoteException
2791 {
2792 Parcel data = Parcel.obtain();
2793 Parcel reply = Parcel.obtain();
2794 data.writeInterfaceToken(IActivityManager.descriptor);
2795 data.writeStrongBinder(app.asBinder());
2796 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2797 reply.readException();
2798 data.recycle();
2799 reply.recycle();
2800 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002801 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2802 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002803 {
2804 Parcel data = Parcel.obtain();
2805 Parcel reply = Parcel.obtain();
2806 data.writeInterfaceToken(IActivityManager.descriptor);
2807 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002808 if (config != null) {
2809 data.writeInt(1);
2810 config.writeToParcel(data, 0);
2811 } else {
2812 data.writeInt(0);
2813 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002814 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002815 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2816 reply.readException();
2817 data.recycle();
2818 reply.recycle();
2819 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002820 public void activityResumed(IBinder token) throws RemoteException
2821 {
2822 Parcel data = Parcel.obtain();
2823 Parcel reply = Parcel.obtain();
2824 data.writeInterfaceToken(IActivityManager.descriptor);
2825 data.writeStrongBinder(token);
2826 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2827 reply.readException();
2828 data.recycle();
2829 reply.recycle();
2830 }
Craig Mautnera0026042014-04-23 11:45:37 -07002831 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002832 {
2833 Parcel data = Parcel.obtain();
2834 Parcel reply = Parcel.obtain();
2835 data.writeInterfaceToken(IActivityManager.descriptor);
2836 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002837 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002838 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2839 reply.readException();
2840 data.recycle();
2841 reply.recycle();
2842 }
2843 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002844 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002845 {
2846 Parcel data = Parcel.obtain();
2847 Parcel reply = Parcel.obtain();
2848 data.writeInterfaceToken(IActivityManager.descriptor);
2849 data.writeStrongBinder(token);
2850 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002851 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002852 TextUtils.writeToParcel(description, data, 0);
2853 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2854 reply.readException();
2855 data.recycle();
2856 reply.recycle();
2857 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002858 public void activitySlept(IBinder token) throws RemoteException
2859 {
2860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
2863 data.writeStrongBinder(token);
2864 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2865 reply.readException();
2866 data.recycle();
2867 reply.recycle();
2868 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002869 public void activityDestroyed(IBinder token) throws RemoteException
2870 {
2871 Parcel data = Parcel.obtain();
2872 Parcel reply = Parcel.obtain();
2873 data.writeInterfaceToken(IActivityManager.descriptor);
2874 data.writeStrongBinder(token);
2875 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2876 reply.readException();
2877 data.recycle();
2878 reply.recycle();
2879 }
2880 public String getCallingPackage(IBinder token) throws RemoteException
2881 {
2882 Parcel data = Parcel.obtain();
2883 Parcel reply = Parcel.obtain();
2884 data.writeInterfaceToken(IActivityManager.descriptor);
2885 data.writeStrongBinder(token);
2886 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2887 reply.readException();
2888 String res = reply.readString();
2889 data.recycle();
2890 reply.recycle();
2891 return res;
2892 }
2893 public ComponentName getCallingActivity(IBinder token)
2894 throws RemoteException {
2895 Parcel data = Parcel.obtain();
2896 Parcel reply = Parcel.obtain();
2897 data.writeInterfaceToken(IActivityManager.descriptor);
2898 data.writeStrongBinder(token);
2899 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2900 reply.readException();
2901 ComponentName res = ComponentName.readFromParcel(reply);
2902 data.recycle();
2903 reply.recycle();
2904 return res;
2905 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002906 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07002907 Parcel data = Parcel.obtain();
2908 Parcel reply = Parcel.obtain();
2909 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002910 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07002911 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2912 reply.readException();
2913 ArrayList<IAppTask> list = null;
2914 int N = reply.readInt();
2915 if (N >= 0) {
2916 list = new ArrayList<IAppTask>();
2917 while (N > 0) {
2918 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2919 list.add(task);
2920 N--;
2921 }
2922 }
2923 data.recycle();
2924 reply.recycle();
2925 return list;
2926 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07002927 public int addAppTask(IBinder activityToken, Intent intent,
2928 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
2929 Parcel data = Parcel.obtain();
2930 Parcel reply = Parcel.obtain();
2931 data.writeInterfaceToken(IActivityManager.descriptor);
2932 data.writeStrongBinder(activityToken);
2933 intent.writeToParcel(data, 0);
2934 description.writeToParcel(data, 0);
2935 thumbnail.writeToParcel(data, 0);
2936 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
2937 reply.readException();
2938 int res = reply.readInt();
2939 data.recycle();
2940 reply.recycle();
2941 return res;
2942 }
2943 public Point getAppTaskThumbnailSize() throws RemoteException {
2944 Parcel data = Parcel.obtain();
2945 Parcel reply = Parcel.obtain();
2946 data.writeInterfaceToken(IActivityManager.descriptor);
2947 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
2948 reply.readException();
2949 Point size = Point.CREATOR.createFromParcel(reply);
2950 data.recycle();
2951 reply.recycle();
2952 return size;
2953 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002954 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002955 Parcel data = Parcel.obtain();
2956 Parcel reply = Parcel.obtain();
2957 data.writeInterfaceToken(IActivityManager.descriptor);
2958 data.writeInt(maxNum);
2959 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002960 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2961 reply.readException();
2962 ArrayList list = null;
2963 int N = reply.readInt();
2964 if (N >= 0) {
2965 list = new ArrayList();
2966 while (N > 0) {
2967 ActivityManager.RunningTaskInfo info =
2968 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002969 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002970 list.add(info);
2971 N--;
2972 }
2973 }
2974 data.recycle();
2975 reply.recycle();
2976 return list;
2977 }
2978 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002979 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002980 Parcel data = Parcel.obtain();
2981 Parcel reply = Parcel.obtain();
2982 data.writeInterfaceToken(IActivityManager.descriptor);
2983 data.writeInt(maxNum);
2984 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002985 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002986 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2987 reply.readException();
2988 ArrayList<ActivityManager.RecentTaskInfo> list
2989 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2990 data.recycle();
2991 reply.recycle();
2992 return list;
2993 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002994 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002995 Parcel data = Parcel.obtain();
2996 Parcel reply = Parcel.obtain();
2997 data.writeInterfaceToken(IActivityManager.descriptor);
2998 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002999 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003000 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003001 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003002 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003003 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003004 }
3005 data.recycle();
3006 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003007 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003008 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003009 public List getServices(int maxNum, int flags) throws RemoteException {
3010 Parcel data = Parcel.obtain();
3011 Parcel reply = Parcel.obtain();
3012 data.writeInterfaceToken(IActivityManager.descriptor);
3013 data.writeInt(maxNum);
3014 data.writeInt(flags);
3015 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3016 reply.readException();
3017 ArrayList list = null;
3018 int N = reply.readInt();
3019 if (N >= 0) {
3020 list = new ArrayList();
3021 while (N > 0) {
3022 ActivityManager.RunningServiceInfo info =
3023 ActivityManager.RunningServiceInfo.CREATOR
3024 .createFromParcel(reply);
3025 list.add(info);
3026 N--;
3027 }
3028 }
3029 data.recycle();
3030 reply.recycle();
3031 return list;
3032 }
3033 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3034 throws RemoteException {
3035 Parcel data = Parcel.obtain();
3036 Parcel reply = Parcel.obtain();
3037 data.writeInterfaceToken(IActivityManager.descriptor);
3038 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3039 reply.readException();
3040 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3041 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3042 data.recycle();
3043 reply.recycle();
3044 return list;
3045 }
3046 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3047 throws RemoteException {
3048 Parcel data = Parcel.obtain();
3049 Parcel reply = Parcel.obtain();
3050 data.writeInterfaceToken(IActivityManager.descriptor);
3051 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3052 reply.readException();
3053 ArrayList<ActivityManager.RunningAppProcessInfo> list
3054 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3055 data.recycle();
3056 reply.recycle();
3057 return list;
3058 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003059 public List<ApplicationInfo> getRunningExternalApplications()
3060 throws RemoteException {
3061 Parcel data = Parcel.obtain();
3062 Parcel reply = Parcel.obtain();
3063 data.writeInterfaceToken(IActivityManager.descriptor);
3064 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3065 reply.readException();
3066 ArrayList<ApplicationInfo> list
3067 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3068 data.recycle();
3069 reply.recycle();
3070 return list;
3071 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003072 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003073 {
3074 Parcel data = Parcel.obtain();
3075 Parcel reply = Parcel.obtain();
3076 data.writeInterfaceToken(IActivityManager.descriptor);
3077 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003078 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003079 if (options != null) {
3080 data.writeInt(1);
3081 options.writeToParcel(data, 0);
3082 } else {
3083 data.writeInt(0);
3084 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003085 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3086 reply.readException();
3087 data.recycle();
3088 reply.recycle();
3089 }
3090 public void moveTaskToBack(int task) throws RemoteException
3091 {
3092 Parcel data = Parcel.obtain();
3093 Parcel reply = Parcel.obtain();
3094 data.writeInterfaceToken(IActivityManager.descriptor);
3095 data.writeInt(task);
3096 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3097 reply.readException();
3098 data.recycle();
3099 reply.recycle();
3100 }
3101 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3102 throws RemoteException {
3103 Parcel data = Parcel.obtain();
3104 Parcel reply = Parcel.obtain();
3105 data.writeInterfaceToken(IActivityManager.descriptor);
3106 data.writeStrongBinder(token);
3107 data.writeInt(nonRoot ? 1 : 0);
3108 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3109 reply.readException();
3110 boolean res = reply.readInt() != 0;
3111 data.recycle();
3112 reply.recycle();
3113 return res;
3114 }
3115 public void moveTaskBackwards(int task) throws RemoteException
3116 {
3117 Parcel data = Parcel.obtain();
3118 Parcel reply = Parcel.obtain();
3119 data.writeInterfaceToken(IActivityManager.descriptor);
3120 data.writeInt(task);
3121 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3122 reply.readException();
3123 data.recycle();
3124 reply.recycle();
3125 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003126 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003127 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3128 {
3129 Parcel data = Parcel.obtain();
3130 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003131 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003132 data.writeInt(taskId);
3133 data.writeInt(stackId);
3134 data.writeInt(toTop ? 1 : 0);
3135 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3136 reply.readException();
3137 data.recycle();
3138 reply.recycle();
3139 }
3140 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003141 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003142 {
3143 Parcel data = Parcel.obtain();
3144 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003145 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003146 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003147 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003148 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003149 reply.readException();
3150 data.recycle();
3151 reply.recycle();
3152 }
Craig Mautner967212c2013-04-13 21:10:58 -07003153 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003154 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003155 {
3156 Parcel data = Parcel.obtain();
3157 Parcel reply = Parcel.obtain();
3158 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003159 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003160 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003161 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003162 data.recycle();
3163 reply.recycle();
3164 return list;
3165 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003166 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003167 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003168 {
3169 Parcel data = Parcel.obtain();
3170 Parcel reply = Parcel.obtain();
3171 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003172 data.writeInt(stackId);
3173 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003174 reply.readException();
3175 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003176 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003177 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003178 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003179 }
3180 data.recycle();
3181 reply.recycle();
3182 return info;
3183 }
3184 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003185 public boolean isInHomeStack(int taskId) throws RemoteException {
3186 Parcel data = Parcel.obtain();
3187 Parcel reply = Parcel.obtain();
3188 data.writeInterfaceToken(IActivityManager.descriptor);
3189 data.writeInt(taskId);
3190 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3191 reply.readException();
3192 boolean isInHomeStack = reply.readInt() > 0;
3193 data.recycle();
3194 reply.recycle();
3195 return isInHomeStack;
3196 }
3197 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003198 public void setFocusedStack(int stackId) throws RemoteException
3199 {
3200 Parcel data = Parcel.obtain();
3201 Parcel reply = Parcel.obtain();
3202 data.writeInterfaceToken(IActivityManager.descriptor);
3203 data.writeInt(stackId);
3204 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3205 reply.readException();
3206 data.recycle();
3207 reply.recycle();
3208 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003209 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3210 {
3211 Parcel data = Parcel.obtain();
3212 Parcel reply = Parcel.obtain();
3213 data.writeInterfaceToken(IActivityManager.descriptor);
3214 data.writeStrongBinder(token);
3215 data.writeInt(onlyRoot ? 1 : 0);
3216 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3217 reply.readException();
3218 int res = reply.readInt();
3219 data.recycle();
3220 reply.recycle();
3221 return res;
3222 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003223 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003224 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003225 Parcel data = Parcel.obtain();
3226 Parcel reply = Parcel.obtain();
3227 data.writeInterfaceToken(IActivityManager.descriptor);
3228 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3229 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003230 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003231 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003232 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3233 reply.readException();
3234 int res = reply.readInt();
3235 ContentProviderHolder cph = null;
3236 if (res != 0) {
3237 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3238 }
3239 data.recycle();
3240 reply.recycle();
3241 return cph;
3242 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003243 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3244 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003245 Parcel data = Parcel.obtain();
3246 Parcel reply = Parcel.obtain();
3247 data.writeInterfaceToken(IActivityManager.descriptor);
3248 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003249 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003250 data.writeStrongBinder(token);
3251 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3252 reply.readException();
3253 int res = reply.readInt();
3254 ContentProviderHolder cph = null;
3255 if (res != 0) {
3256 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3257 }
3258 data.recycle();
3259 reply.recycle();
3260 return cph;
3261 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003262 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003263 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003264 {
3265 Parcel data = Parcel.obtain();
3266 Parcel reply = Parcel.obtain();
3267 data.writeInterfaceToken(IActivityManager.descriptor);
3268 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3269 data.writeTypedList(providers);
3270 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3271 reply.readException();
3272 data.recycle();
3273 reply.recycle();
3274 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003275 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3276 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003277 Parcel data = Parcel.obtain();
3278 Parcel reply = Parcel.obtain();
3279 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003280 data.writeStrongBinder(connection);
3281 data.writeInt(stable);
3282 data.writeInt(unstable);
3283 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3284 reply.readException();
3285 boolean res = reply.readInt() != 0;
3286 data.recycle();
3287 reply.recycle();
3288 return res;
3289 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003290
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003291 public void unstableProviderDied(IBinder connection) throws RemoteException {
3292 Parcel data = Parcel.obtain();
3293 Parcel reply = Parcel.obtain();
3294 data.writeInterfaceToken(IActivityManager.descriptor);
3295 data.writeStrongBinder(connection);
3296 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3297 reply.readException();
3298 data.recycle();
3299 reply.recycle();
3300 }
3301
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003302 @Override
3303 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3304 Parcel data = Parcel.obtain();
3305 Parcel reply = Parcel.obtain();
3306 data.writeInterfaceToken(IActivityManager.descriptor);
3307 data.writeStrongBinder(connection);
3308 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3309 reply.readException();
3310 data.recycle();
3311 reply.recycle();
3312 }
3313
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003314 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3315 Parcel data = Parcel.obtain();
3316 Parcel reply = Parcel.obtain();
3317 data.writeInterfaceToken(IActivityManager.descriptor);
3318 data.writeStrongBinder(connection);
3319 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003320 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3321 reply.readException();
3322 data.recycle();
3323 reply.recycle();
3324 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003325
3326 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3327 Parcel data = Parcel.obtain();
3328 Parcel reply = Parcel.obtain();
3329 data.writeInterfaceToken(IActivityManager.descriptor);
3330 data.writeString(name);
3331 data.writeStrongBinder(token);
3332 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3333 reply.readException();
3334 data.recycle();
3335 reply.recycle();
3336 }
3337
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003338 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3339 throws RemoteException
3340 {
3341 Parcel data = Parcel.obtain();
3342 Parcel reply = Parcel.obtain();
3343 data.writeInterfaceToken(IActivityManager.descriptor);
3344 service.writeToParcel(data, 0);
3345 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3346 reply.readException();
3347 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3348 data.recycle();
3349 reply.recycle();
3350 return res;
3351 }
3352
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003353 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003354 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003355 {
3356 Parcel data = Parcel.obtain();
3357 Parcel reply = Parcel.obtain();
3358 data.writeInterfaceToken(IActivityManager.descriptor);
3359 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3360 service.writeToParcel(data, 0);
3361 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003362 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003363 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3364 reply.readException();
3365 ComponentName res = ComponentName.readFromParcel(reply);
3366 data.recycle();
3367 reply.recycle();
3368 return res;
3369 }
3370 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003371 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003372 {
3373 Parcel data = Parcel.obtain();
3374 Parcel reply = Parcel.obtain();
3375 data.writeInterfaceToken(IActivityManager.descriptor);
3376 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3377 service.writeToParcel(data, 0);
3378 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003379 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003380 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3381 reply.readException();
3382 int res = reply.readInt();
3383 reply.recycle();
3384 data.recycle();
3385 return res;
3386 }
3387 public boolean stopServiceToken(ComponentName className, IBinder token,
3388 int startId) throws RemoteException {
3389 Parcel data = Parcel.obtain();
3390 Parcel reply = Parcel.obtain();
3391 data.writeInterfaceToken(IActivityManager.descriptor);
3392 ComponentName.writeToParcel(className, data);
3393 data.writeStrongBinder(token);
3394 data.writeInt(startId);
3395 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3396 reply.readException();
3397 boolean res = reply.readInt() != 0;
3398 data.recycle();
3399 reply.recycle();
3400 return res;
3401 }
3402 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003403 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003404 Parcel data = Parcel.obtain();
3405 Parcel reply = Parcel.obtain();
3406 data.writeInterfaceToken(IActivityManager.descriptor);
3407 ComponentName.writeToParcel(className, data);
3408 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003409 data.writeInt(id);
3410 if (notification != null) {
3411 data.writeInt(1);
3412 notification.writeToParcel(data, 0);
3413 } else {
3414 data.writeInt(0);
3415 }
3416 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003417 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3418 reply.readException();
3419 data.recycle();
3420 reply.recycle();
3421 }
3422 public int bindService(IApplicationThread caller, IBinder token,
3423 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003424 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003425 Parcel data = Parcel.obtain();
3426 Parcel reply = Parcel.obtain();
3427 data.writeInterfaceToken(IActivityManager.descriptor);
3428 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3429 data.writeStrongBinder(token);
3430 service.writeToParcel(data, 0);
3431 data.writeString(resolvedType);
3432 data.writeStrongBinder(connection.asBinder());
3433 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003434 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003435 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3436 reply.readException();
3437 int res = reply.readInt();
3438 data.recycle();
3439 reply.recycle();
3440 return res;
3441 }
3442 public boolean unbindService(IServiceConnection connection) throws RemoteException
3443 {
3444 Parcel data = Parcel.obtain();
3445 Parcel reply = Parcel.obtain();
3446 data.writeInterfaceToken(IActivityManager.descriptor);
3447 data.writeStrongBinder(connection.asBinder());
3448 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3449 reply.readException();
3450 boolean res = reply.readInt() != 0;
3451 data.recycle();
3452 reply.recycle();
3453 return res;
3454 }
3455
3456 public void publishService(IBinder token,
3457 Intent intent, IBinder service) throws RemoteException {
3458 Parcel data = Parcel.obtain();
3459 Parcel reply = Parcel.obtain();
3460 data.writeInterfaceToken(IActivityManager.descriptor);
3461 data.writeStrongBinder(token);
3462 intent.writeToParcel(data, 0);
3463 data.writeStrongBinder(service);
3464 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3465 reply.readException();
3466 data.recycle();
3467 reply.recycle();
3468 }
3469
3470 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3471 throws RemoteException {
3472 Parcel data = Parcel.obtain();
3473 Parcel reply = Parcel.obtain();
3474 data.writeInterfaceToken(IActivityManager.descriptor);
3475 data.writeStrongBinder(token);
3476 intent.writeToParcel(data, 0);
3477 data.writeInt(doRebind ? 1 : 0);
3478 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3479 reply.readException();
3480 data.recycle();
3481 reply.recycle();
3482 }
3483
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003484 public void serviceDoneExecuting(IBinder token, int type, int startId,
3485 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003486 Parcel data = Parcel.obtain();
3487 Parcel reply = Parcel.obtain();
3488 data.writeInterfaceToken(IActivityManager.descriptor);
3489 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003490 data.writeInt(type);
3491 data.writeInt(startId);
3492 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003493 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3494 reply.readException();
3495 data.recycle();
3496 reply.recycle();
3497 }
3498
3499 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3500 Parcel data = Parcel.obtain();
3501 Parcel reply = Parcel.obtain();
3502 data.writeInterfaceToken(IActivityManager.descriptor);
3503 service.writeToParcel(data, 0);
3504 data.writeString(resolvedType);
3505 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3506 reply.readException();
3507 IBinder binder = reply.readStrongBinder();
3508 reply.recycle();
3509 data.recycle();
3510 return binder;
3511 }
3512
Christopher Tate181fafa2009-05-14 11:12:14 -07003513 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3514 throws RemoteException {
3515 Parcel data = Parcel.obtain();
3516 Parcel reply = Parcel.obtain();
3517 data.writeInterfaceToken(IActivityManager.descriptor);
3518 app.writeToParcel(data, 0);
3519 data.writeInt(backupRestoreMode);
3520 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3521 reply.readException();
3522 boolean success = reply.readInt() != 0;
3523 reply.recycle();
3524 data.recycle();
3525 return success;
3526 }
3527
Christopher Tate346acb12012-10-15 19:20:25 -07003528 public void clearPendingBackup() throws RemoteException {
3529 Parcel data = Parcel.obtain();
3530 Parcel reply = Parcel.obtain();
3531 data.writeInterfaceToken(IActivityManager.descriptor);
3532 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3533 reply.recycle();
3534 data.recycle();
3535 }
3536
Christopher Tate181fafa2009-05-14 11:12:14 -07003537 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3538 Parcel data = Parcel.obtain();
3539 Parcel reply = Parcel.obtain();
3540 data.writeInterfaceToken(IActivityManager.descriptor);
3541 data.writeString(packageName);
3542 data.writeStrongBinder(agent);
3543 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3544 reply.recycle();
3545 data.recycle();
3546 }
3547
3548 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3549 Parcel data = Parcel.obtain();
3550 Parcel reply = Parcel.obtain();
3551 data.writeInterfaceToken(IActivityManager.descriptor);
3552 app.writeToParcel(data, 0);
3553 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3554 reply.readException();
3555 reply.recycle();
3556 data.recycle();
3557 }
3558
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003559 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003560 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003561 IUiAutomationConnection connection, int userId, String instructionSet)
3562 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003563 Parcel data = Parcel.obtain();
3564 Parcel reply = Parcel.obtain();
3565 data.writeInterfaceToken(IActivityManager.descriptor);
3566 ComponentName.writeToParcel(className, data);
3567 data.writeString(profileFile);
3568 data.writeInt(flags);
3569 data.writeBundle(arguments);
3570 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003571 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003572 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003573 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003574 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3575 reply.readException();
3576 boolean res = reply.readInt() != 0;
3577 reply.recycle();
3578 data.recycle();
3579 return res;
3580 }
3581
3582 public void finishInstrumentation(IApplicationThread target,
3583 int resultCode, Bundle results) throws RemoteException {
3584 Parcel data = Parcel.obtain();
3585 Parcel reply = Parcel.obtain();
3586 data.writeInterfaceToken(IActivityManager.descriptor);
3587 data.writeStrongBinder(target != null ? target.asBinder() : null);
3588 data.writeInt(resultCode);
3589 data.writeBundle(results);
3590 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3591 reply.readException();
3592 data.recycle();
3593 reply.recycle();
3594 }
3595 public Configuration getConfiguration() throws RemoteException
3596 {
3597 Parcel data = Parcel.obtain();
3598 Parcel reply = Parcel.obtain();
3599 data.writeInterfaceToken(IActivityManager.descriptor);
3600 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3601 reply.readException();
3602 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3603 reply.recycle();
3604 data.recycle();
3605 return res;
3606 }
3607 public void updateConfiguration(Configuration values) throws RemoteException
3608 {
3609 Parcel data = Parcel.obtain();
3610 Parcel reply = Parcel.obtain();
3611 data.writeInterfaceToken(IActivityManager.descriptor);
3612 values.writeToParcel(data, 0);
3613 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3614 reply.readException();
3615 data.recycle();
3616 reply.recycle();
3617 }
3618 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3619 throws RemoteException {
3620 Parcel data = Parcel.obtain();
3621 Parcel reply = Parcel.obtain();
3622 data.writeInterfaceToken(IActivityManager.descriptor);
3623 data.writeStrongBinder(token);
3624 data.writeInt(requestedOrientation);
3625 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3626 reply.readException();
3627 data.recycle();
3628 reply.recycle();
3629 }
3630 public int getRequestedOrientation(IBinder token) throws RemoteException {
3631 Parcel data = Parcel.obtain();
3632 Parcel reply = Parcel.obtain();
3633 data.writeInterfaceToken(IActivityManager.descriptor);
3634 data.writeStrongBinder(token);
3635 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3636 reply.readException();
3637 int res = reply.readInt();
3638 data.recycle();
3639 reply.recycle();
3640 return res;
3641 }
3642 public ComponentName getActivityClassForToken(IBinder token)
3643 throws RemoteException {
3644 Parcel data = Parcel.obtain();
3645 Parcel reply = Parcel.obtain();
3646 data.writeInterfaceToken(IActivityManager.descriptor);
3647 data.writeStrongBinder(token);
3648 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3649 reply.readException();
3650 ComponentName res = ComponentName.readFromParcel(reply);
3651 data.recycle();
3652 reply.recycle();
3653 return res;
3654 }
3655 public String getPackageForToken(IBinder token) throws RemoteException
3656 {
3657 Parcel data = Parcel.obtain();
3658 Parcel reply = Parcel.obtain();
3659 data.writeInterfaceToken(IActivityManager.descriptor);
3660 data.writeStrongBinder(token);
3661 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3662 reply.readException();
3663 String res = reply.readString();
3664 data.recycle();
3665 reply.recycle();
3666 return res;
3667 }
3668 public IIntentSender getIntentSender(int type,
3669 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003670 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003671 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003672 Parcel data = Parcel.obtain();
3673 Parcel reply = Parcel.obtain();
3674 data.writeInterfaceToken(IActivityManager.descriptor);
3675 data.writeInt(type);
3676 data.writeString(packageName);
3677 data.writeStrongBinder(token);
3678 data.writeString(resultWho);
3679 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003680 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003681 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003682 data.writeTypedArray(intents, 0);
3683 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003684 } else {
3685 data.writeInt(0);
3686 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003687 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003688 if (options != null) {
3689 data.writeInt(1);
3690 options.writeToParcel(data, 0);
3691 } else {
3692 data.writeInt(0);
3693 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003694 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003695 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3696 reply.readException();
3697 IIntentSender res = IIntentSender.Stub.asInterface(
3698 reply.readStrongBinder());
3699 data.recycle();
3700 reply.recycle();
3701 return res;
3702 }
3703 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3704 Parcel data = Parcel.obtain();
3705 Parcel reply = Parcel.obtain();
3706 data.writeInterfaceToken(IActivityManager.descriptor);
3707 data.writeStrongBinder(sender.asBinder());
3708 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3709 reply.readException();
3710 data.recycle();
3711 reply.recycle();
3712 }
3713 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3714 Parcel data = Parcel.obtain();
3715 Parcel reply = Parcel.obtain();
3716 data.writeInterfaceToken(IActivityManager.descriptor);
3717 data.writeStrongBinder(sender.asBinder());
3718 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3719 reply.readException();
3720 String res = reply.readString();
3721 data.recycle();
3722 reply.recycle();
3723 return res;
3724 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003725 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3726 Parcel data = Parcel.obtain();
3727 Parcel reply = Parcel.obtain();
3728 data.writeInterfaceToken(IActivityManager.descriptor);
3729 data.writeStrongBinder(sender.asBinder());
3730 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3731 reply.readException();
3732 int res = reply.readInt();
3733 data.recycle();
3734 reply.recycle();
3735 return res;
3736 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003737 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3738 boolean requireFull, String name, String callerPackage) throws RemoteException {
3739 Parcel data = Parcel.obtain();
3740 Parcel reply = Parcel.obtain();
3741 data.writeInterfaceToken(IActivityManager.descriptor);
3742 data.writeInt(callingPid);
3743 data.writeInt(callingUid);
3744 data.writeInt(userId);
3745 data.writeInt(allowAll ? 1 : 0);
3746 data.writeInt(requireFull ? 1 : 0);
3747 data.writeString(name);
3748 data.writeString(callerPackage);
3749 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3750 reply.readException();
3751 int res = reply.readInt();
3752 data.recycle();
3753 reply.recycle();
3754 return res;
3755 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003756 public void setProcessLimit(int max) throws RemoteException
3757 {
3758 Parcel data = Parcel.obtain();
3759 Parcel reply = Parcel.obtain();
3760 data.writeInterfaceToken(IActivityManager.descriptor);
3761 data.writeInt(max);
3762 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3763 reply.readException();
3764 data.recycle();
3765 reply.recycle();
3766 }
3767 public int getProcessLimit() throws RemoteException
3768 {
3769 Parcel data = Parcel.obtain();
3770 Parcel reply = Parcel.obtain();
3771 data.writeInterfaceToken(IActivityManager.descriptor);
3772 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3773 reply.readException();
3774 int res = reply.readInt();
3775 data.recycle();
3776 reply.recycle();
3777 return res;
3778 }
3779 public void setProcessForeground(IBinder token, int pid,
3780 boolean isForeground) throws RemoteException {
3781 Parcel data = Parcel.obtain();
3782 Parcel reply = Parcel.obtain();
3783 data.writeInterfaceToken(IActivityManager.descriptor);
3784 data.writeStrongBinder(token);
3785 data.writeInt(pid);
3786 data.writeInt(isForeground ? 1 : 0);
3787 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3788 reply.readException();
3789 data.recycle();
3790 reply.recycle();
3791 }
3792 public int checkPermission(String permission, int pid, int uid)
3793 throws RemoteException {
3794 Parcel data = Parcel.obtain();
3795 Parcel reply = Parcel.obtain();
3796 data.writeInterfaceToken(IActivityManager.descriptor);
3797 data.writeString(permission);
3798 data.writeInt(pid);
3799 data.writeInt(uid);
3800 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3801 reply.readException();
3802 int res = reply.readInt();
3803 data.recycle();
3804 reply.recycle();
3805 return res;
3806 }
3807 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003808 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003809 Parcel data = Parcel.obtain();
3810 Parcel reply = Parcel.obtain();
3811 data.writeInterfaceToken(IActivityManager.descriptor);
3812 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003813 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003814 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003815 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3816 reply.readException();
3817 boolean res = reply.readInt() != 0;
3818 data.recycle();
3819 reply.recycle();
3820 return res;
3821 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003822 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003823 throws RemoteException {
3824 Parcel data = Parcel.obtain();
3825 Parcel reply = Parcel.obtain();
3826 data.writeInterfaceToken(IActivityManager.descriptor);
3827 uri.writeToParcel(data, 0);
3828 data.writeInt(pid);
3829 data.writeInt(uid);
3830 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003831 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003832 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3833 reply.readException();
3834 int res = reply.readInt();
3835 data.recycle();
3836 reply.recycle();
3837 return res;
3838 }
3839 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003840 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003841 Parcel data = Parcel.obtain();
3842 Parcel reply = Parcel.obtain();
3843 data.writeInterfaceToken(IActivityManager.descriptor);
3844 data.writeStrongBinder(caller.asBinder());
3845 data.writeString(targetPkg);
3846 uri.writeToParcel(data, 0);
3847 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003848 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003849 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3850 reply.readException();
3851 data.recycle();
3852 reply.recycle();
3853 }
3854 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003855 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003856 Parcel data = Parcel.obtain();
3857 Parcel reply = Parcel.obtain();
3858 data.writeInterfaceToken(IActivityManager.descriptor);
3859 data.writeStrongBinder(caller.asBinder());
3860 uri.writeToParcel(data, 0);
3861 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003862 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003863 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3864 reply.readException();
3865 data.recycle();
3866 reply.recycle();
3867 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003868
3869 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003870 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3871 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003872 Parcel data = Parcel.obtain();
3873 Parcel reply = Parcel.obtain();
3874 data.writeInterfaceToken(IActivityManager.descriptor);
3875 uri.writeToParcel(data, 0);
3876 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003877 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003878 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3879 reply.readException();
3880 data.recycle();
3881 reply.recycle();
3882 }
3883
3884 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003885 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3886 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003887 Parcel data = Parcel.obtain();
3888 Parcel reply = Parcel.obtain();
3889 data.writeInterfaceToken(IActivityManager.descriptor);
3890 uri.writeToParcel(data, 0);
3891 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003892 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003893 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3894 reply.readException();
3895 data.recycle();
3896 reply.recycle();
3897 }
3898
3899 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003900 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3901 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003902 Parcel data = Parcel.obtain();
3903 Parcel reply = Parcel.obtain();
3904 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003905 data.writeString(packageName);
3906 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003907 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3908 reply.readException();
3909 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3910 reply);
3911 data.recycle();
3912 reply.recycle();
3913 return perms;
3914 }
3915
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003916 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3917 throws RemoteException {
3918 Parcel data = Parcel.obtain();
3919 Parcel reply = Parcel.obtain();
3920 data.writeInterfaceToken(IActivityManager.descriptor);
3921 data.writeStrongBinder(who.asBinder());
3922 data.writeInt(waiting ? 1 : 0);
3923 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3924 reply.readException();
3925 data.recycle();
3926 reply.recycle();
3927 }
3928 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3929 Parcel data = Parcel.obtain();
3930 Parcel reply = Parcel.obtain();
3931 data.writeInterfaceToken(IActivityManager.descriptor);
3932 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3933 reply.readException();
3934 outInfo.readFromParcel(reply);
3935 data.recycle();
3936 reply.recycle();
3937 }
3938 public void unhandledBack() throws RemoteException
3939 {
3940 Parcel data = Parcel.obtain();
3941 Parcel reply = Parcel.obtain();
3942 data.writeInterfaceToken(IActivityManager.descriptor);
3943 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3944 reply.readException();
3945 data.recycle();
3946 reply.recycle();
3947 }
3948 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3949 {
3950 Parcel data = Parcel.obtain();
3951 Parcel reply = Parcel.obtain();
3952 data.writeInterfaceToken(IActivityManager.descriptor);
3953 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3954 reply.readException();
3955 ParcelFileDescriptor pfd = null;
3956 if (reply.readInt() != 0) {
3957 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3958 }
3959 data.recycle();
3960 reply.recycle();
3961 return pfd;
3962 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003963 public void setLockScreenShown(boolean shown) throws RemoteException
3964 {
3965 Parcel data = Parcel.obtain();
3966 Parcel reply = Parcel.obtain();
3967 data.writeInterfaceToken(IActivityManager.descriptor);
3968 data.writeInt(shown ? 1 : 0);
3969 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3970 reply.readException();
3971 data.recycle();
3972 reply.recycle();
3973 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003974 public void setDebugApp(
3975 String packageName, boolean waitForDebugger, boolean persistent)
3976 throws RemoteException
3977 {
3978 Parcel data = Parcel.obtain();
3979 Parcel reply = Parcel.obtain();
3980 data.writeInterfaceToken(IActivityManager.descriptor);
3981 data.writeString(packageName);
3982 data.writeInt(waitForDebugger ? 1 : 0);
3983 data.writeInt(persistent ? 1 : 0);
3984 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3985 reply.readException();
3986 data.recycle();
3987 reply.recycle();
3988 }
3989 public void setAlwaysFinish(boolean enabled) throws RemoteException
3990 {
3991 Parcel data = Parcel.obtain();
3992 Parcel reply = Parcel.obtain();
3993 data.writeInterfaceToken(IActivityManager.descriptor);
3994 data.writeInt(enabled ? 1 : 0);
3995 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3996 reply.readException();
3997 data.recycle();
3998 reply.recycle();
3999 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004000 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004001 {
4002 Parcel data = Parcel.obtain();
4003 Parcel reply = Parcel.obtain();
4004 data.writeInterfaceToken(IActivityManager.descriptor);
4005 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004006 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004007 reply.readException();
4008 data.recycle();
4009 reply.recycle();
4010 }
4011 public void enterSafeMode() throws RemoteException {
4012 Parcel data = Parcel.obtain();
4013 data.writeInterfaceToken(IActivityManager.descriptor);
4014 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4015 data.recycle();
4016 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08004017 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
4018 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004019 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004020 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004021 data.writeStrongBinder(sender.asBinder());
4022 data.writeInt(sourceUid);
4023 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004024 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4025 data.recycle();
4026 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004027 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004028 Parcel data = Parcel.obtain();
4029 Parcel reply = Parcel.obtain();
4030 data.writeInterfaceToken(IActivityManager.descriptor);
4031 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004032 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004033 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004034 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004035 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004036 boolean res = reply.readInt() != 0;
4037 data.recycle();
4038 reply.recycle();
4039 return res;
4040 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004041 @Override
4042 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4043 Parcel data = Parcel.obtain();
4044 Parcel reply = Parcel.obtain();
4045 data.writeInterfaceToken(IActivityManager.descriptor);
4046 data.writeString(reason);
4047 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4048 boolean res = reply.readInt() != 0;
4049 data.recycle();
4050 reply.recycle();
4051 return res;
4052 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004053 public boolean testIsSystemReady()
4054 {
4055 /* this base class version is never called */
4056 return true;
4057 }
Dan Egnor60d87622009-12-16 16:32:58 -08004058 public void handleApplicationCrash(IBinder app,
4059 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4060 {
4061 Parcel data = Parcel.obtain();
4062 Parcel reply = Parcel.obtain();
4063 data.writeInterfaceToken(IActivityManager.descriptor);
4064 data.writeStrongBinder(app);
4065 crashInfo.writeToParcel(data, 0);
4066 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4067 reply.readException();
4068 reply.recycle();
4069 data.recycle();
4070 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004071
Dan Egnor60d87622009-12-16 16:32:58 -08004072 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08004073 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004074 {
4075 Parcel data = Parcel.obtain();
4076 Parcel reply = Parcel.obtain();
4077 data.writeInterfaceToken(IActivityManager.descriptor);
4078 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004079 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08004080 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004081 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004082 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004083 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004084 reply.recycle();
4085 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004086 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004087 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004088
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004089 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004090 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004091 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004092 {
4093 Parcel data = Parcel.obtain();
4094 Parcel reply = Parcel.obtain();
4095 data.writeInterfaceToken(IActivityManager.descriptor);
4096 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004097 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004098 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004099 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4100 reply.readException();
4101 reply.recycle();
4102 data.recycle();
4103 }
4104
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004105 public void signalPersistentProcesses(int sig) throws RemoteException {
4106 Parcel data = Parcel.obtain();
4107 Parcel reply = Parcel.obtain();
4108 data.writeInterfaceToken(IActivityManager.descriptor);
4109 data.writeInt(sig);
4110 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4111 reply.readException();
4112 data.recycle();
4113 reply.recycle();
4114 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004115
Dianne Hackborn1676c852012-09-10 14:52:30 -07004116 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004117 Parcel data = Parcel.obtain();
4118 Parcel reply = Parcel.obtain();
4119 data.writeInterfaceToken(IActivityManager.descriptor);
4120 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004121 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004122 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4123 reply.readException();
4124 data.recycle();
4125 reply.recycle();
4126 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004127
4128 public void killAllBackgroundProcesses() throws RemoteException {
4129 Parcel data = Parcel.obtain();
4130 Parcel reply = Parcel.obtain();
4131 data.writeInterfaceToken(IActivityManager.descriptor);
4132 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4133 reply.readException();
4134 data.recycle();
4135 reply.recycle();
4136 }
4137
Dianne Hackborn1676c852012-09-10 14:52:30 -07004138 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004139 Parcel data = Parcel.obtain();
4140 Parcel reply = Parcel.obtain();
4141 data.writeInterfaceToken(IActivityManager.descriptor);
4142 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004143 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004144 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004145 reply.readException();
4146 data.recycle();
4147 reply.recycle();
4148 }
4149
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004150 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4151 throws RemoteException
4152 {
4153 Parcel data = Parcel.obtain();
4154 Parcel reply = Parcel.obtain();
4155 data.writeInterfaceToken(IActivityManager.descriptor);
4156 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4157 reply.readException();
4158 outInfo.readFromParcel(reply);
4159 reply.recycle();
4160 data.recycle();
4161 }
4162
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004163 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4164 {
4165 Parcel data = Parcel.obtain();
4166 Parcel reply = Parcel.obtain();
4167 data.writeInterfaceToken(IActivityManager.descriptor);
4168 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4169 reply.readException();
4170 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4171 reply.recycle();
4172 data.recycle();
4173 return res;
4174 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004175
Dianne Hackborn1676c852012-09-10 14:52:30 -07004176 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004177 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004178 {
4179 Parcel data = Parcel.obtain();
4180 Parcel reply = Parcel.obtain();
4181 data.writeInterfaceToken(IActivityManager.descriptor);
4182 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004183 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004184 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004185 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004186 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004187 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004188 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004189 } else {
4190 data.writeInt(0);
4191 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004192 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4193 reply.readException();
4194 boolean res = reply.readInt() != 0;
4195 reply.recycle();
4196 data.recycle();
4197 return res;
4198 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004199
Dianne Hackborn55280a92009-05-07 15:53:46 -07004200 public boolean shutdown(int timeout) throws RemoteException
4201 {
4202 Parcel data = Parcel.obtain();
4203 Parcel reply = Parcel.obtain();
4204 data.writeInterfaceToken(IActivityManager.descriptor);
4205 data.writeInt(timeout);
4206 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4207 reply.readException();
4208 boolean res = reply.readInt() != 0;
4209 reply.recycle();
4210 data.recycle();
4211 return res;
4212 }
4213
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004214 public void stopAppSwitches() throws RemoteException {
4215 Parcel data = Parcel.obtain();
4216 Parcel reply = Parcel.obtain();
4217 data.writeInterfaceToken(IActivityManager.descriptor);
4218 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4219 reply.readException();
4220 reply.recycle();
4221 data.recycle();
4222 }
4223
4224 public void resumeAppSwitches() throws RemoteException {
4225 Parcel data = Parcel.obtain();
4226 Parcel reply = Parcel.obtain();
4227 data.writeInterfaceToken(IActivityManager.descriptor);
4228 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4229 reply.readException();
4230 reply.recycle();
4231 data.recycle();
4232 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004233
4234 public void addPackageDependency(String packageName) throws RemoteException {
4235 Parcel data = Parcel.obtain();
4236 Parcel reply = Parcel.obtain();
4237 data.writeInterfaceToken(IActivityManager.descriptor);
4238 data.writeString(packageName);
4239 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4240 reply.readException();
4241 data.recycle();
4242 reply.recycle();
4243 }
4244
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004245 public void killApplicationWithAppId(String pkg, int appid, String reason)
4246 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004247 Parcel data = Parcel.obtain();
4248 Parcel reply = Parcel.obtain();
4249 data.writeInterfaceToken(IActivityManager.descriptor);
4250 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004251 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004252 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004253 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004254 reply.readException();
4255 data.recycle();
4256 reply.recycle();
4257 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004258
4259 public void closeSystemDialogs(String reason) throws RemoteException {
4260 Parcel data = Parcel.obtain();
4261 Parcel reply = Parcel.obtain();
4262 data.writeInterfaceToken(IActivityManager.descriptor);
4263 data.writeString(reason);
4264 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4265 reply.readException();
4266 data.recycle();
4267 reply.recycle();
4268 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004269
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004270 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004271 throws RemoteException {
4272 Parcel data = Parcel.obtain();
4273 Parcel reply = Parcel.obtain();
4274 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004275 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004276 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4277 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004278 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004279 data.recycle();
4280 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004281 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004282 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004283
4284 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4285 Parcel data = Parcel.obtain();
4286 Parcel reply = Parcel.obtain();
4287 data.writeInterfaceToken(IActivityManager.descriptor);
4288 data.writeString(processName);
4289 data.writeInt(uid);
4290 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4291 reply.readException();
4292 data.recycle();
4293 reply.recycle();
4294 }
4295
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004296 public void overridePendingTransition(IBinder token, String packageName,
4297 int enterAnim, int exitAnim) throws RemoteException {
4298 Parcel data = Parcel.obtain();
4299 Parcel reply = Parcel.obtain();
4300 data.writeInterfaceToken(IActivityManager.descriptor);
4301 data.writeStrongBinder(token);
4302 data.writeString(packageName);
4303 data.writeInt(enterAnim);
4304 data.writeInt(exitAnim);
4305 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4306 reply.readException();
4307 data.recycle();
4308 reply.recycle();
4309 }
4310
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004311 public boolean isUserAMonkey() throws RemoteException {
4312 Parcel data = Parcel.obtain();
4313 Parcel reply = Parcel.obtain();
4314 data.writeInterfaceToken(IActivityManager.descriptor);
4315 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4316 reply.readException();
4317 boolean res = reply.readInt() != 0;
4318 data.recycle();
4319 reply.recycle();
4320 return res;
4321 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004322
4323 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4324 Parcel data = Parcel.obtain();
4325 Parcel reply = Parcel.obtain();
4326 data.writeInterfaceToken(IActivityManager.descriptor);
4327 data.writeInt(monkey ? 1 : 0);
4328 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4329 reply.readException();
4330 data.recycle();
4331 reply.recycle();
4332 }
4333
Dianne Hackborn860755f2010-06-03 18:47:52 -07004334 public void finishHeavyWeightApp() throws RemoteException {
4335 Parcel data = Parcel.obtain();
4336 Parcel reply = Parcel.obtain();
4337 data.writeInterfaceToken(IActivityManager.descriptor);
4338 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4339 reply.readException();
4340 data.recycle();
4341 reply.recycle();
4342 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004343
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004344 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004345 throws RemoteException {
4346 Parcel data = Parcel.obtain();
4347 Parcel reply = Parcel.obtain();
4348 data.writeInterfaceToken(IActivityManager.descriptor);
4349 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004350 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4351 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004352 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004353 data.recycle();
4354 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004355 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004356 }
4357
Craig Mautner233ceee2014-05-09 17:05:11 -07004358 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004359 throws RemoteException {
4360 Parcel data = Parcel.obtain();
4361 Parcel reply = Parcel.obtain();
4362 data.writeInterfaceToken(IActivityManager.descriptor);
4363 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004364 if (options == null) {
4365 data.writeInt(0);
4366 } else {
4367 data.writeInt(1);
4368 data.writeBundle(options.toBundle());
4369 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004370 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004371 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004372 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004373 data.recycle();
4374 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004375 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004376 }
4377
Craig Mautner233ceee2014-05-09 17:05:11 -07004378 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4379 Parcel data = Parcel.obtain();
4380 Parcel reply = Parcel.obtain();
4381 data.writeInterfaceToken(IActivityManager.descriptor);
4382 data.writeStrongBinder(token);
4383 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4384 reply.readException();
4385 Bundle bundle = reply.readBundle();
4386 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4387 data.recycle();
4388 reply.recycle();
4389 return options;
4390 }
4391
Daniel Sandler69a48172010-06-23 16:29:36 -04004392 public void setImmersive(IBinder token, boolean immersive)
4393 throws RemoteException {
4394 Parcel data = Parcel.obtain();
4395 Parcel reply = Parcel.obtain();
4396 data.writeInterfaceToken(IActivityManager.descriptor);
4397 data.writeStrongBinder(token);
4398 data.writeInt(immersive ? 1 : 0);
4399 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4400 reply.readException();
4401 data.recycle();
4402 reply.recycle();
4403 }
4404
4405 public boolean isImmersive(IBinder token)
4406 throws RemoteException {
4407 Parcel data = Parcel.obtain();
4408 Parcel reply = Parcel.obtain();
4409 data.writeInterfaceToken(IActivityManager.descriptor);
4410 data.writeStrongBinder(token);
4411 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004412 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004413 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004414 data.recycle();
4415 reply.recycle();
4416 return res;
4417 }
4418
Craig Mautnerd61dc202014-07-07 11:09:11 -07004419 public boolean isTopOfTask(IBinder token) throws RemoteException {
4420 Parcel data = Parcel.obtain();
4421 Parcel reply = Parcel.obtain();
4422 data.writeInterfaceToken(IActivityManager.descriptor);
4423 data.writeStrongBinder(token);
4424 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4425 reply.readException();
4426 boolean res = reply.readInt() == 1;
4427 data.recycle();
4428 reply.recycle();
4429 return res;
4430 }
4431
Daniel Sandler69a48172010-06-23 16:29:36 -04004432 public boolean isTopActivityImmersive()
4433 throws RemoteException {
4434 Parcel data = Parcel.obtain();
4435 Parcel reply = Parcel.obtain();
4436 data.writeInterfaceToken(IActivityManager.descriptor);
4437 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004438 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004439 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004440 data.recycle();
4441 reply.recycle();
4442 return res;
4443 }
4444
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004445 public void crashApplication(int uid, int initialPid, String packageName,
4446 String message) throws RemoteException {
4447 Parcel data = Parcel.obtain();
4448 Parcel reply = Parcel.obtain();
4449 data.writeInterfaceToken(IActivityManager.descriptor);
4450 data.writeInt(uid);
4451 data.writeInt(initialPid);
4452 data.writeString(packageName);
4453 data.writeString(message);
4454 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4455 reply.readException();
4456 data.recycle();
4457 reply.recycle();
4458 }
Andy McFadden824c5102010-07-09 16:26:57 -07004459
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004460 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004461 Parcel data = Parcel.obtain();
4462 Parcel reply = Parcel.obtain();
4463 data.writeInterfaceToken(IActivityManager.descriptor);
4464 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004465 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004466 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4467 reply.readException();
4468 String res = reply.readString();
4469 data.recycle();
4470 reply.recycle();
4471 return res;
4472 }
4473
Dianne Hackborn7e269642010-08-25 19:50:20 -07004474 public IBinder newUriPermissionOwner(String name)
4475 throws RemoteException {
4476 Parcel data = Parcel.obtain();
4477 Parcel reply = Parcel.obtain();
4478 data.writeInterfaceToken(IActivityManager.descriptor);
4479 data.writeString(name);
4480 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4481 reply.readException();
4482 IBinder res = reply.readStrongBinder();
4483 data.recycle();
4484 reply.recycle();
4485 return res;
4486 }
4487
4488 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004489 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004490 Parcel data = Parcel.obtain();
4491 Parcel reply = Parcel.obtain();
4492 data.writeInterfaceToken(IActivityManager.descriptor);
4493 data.writeStrongBinder(owner);
4494 data.writeInt(fromUid);
4495 data.writeString(targetPkg);
4496 uri.writeToParcel(data, 0);
4497 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004498 data.writeInt(sourceUserId);
4499 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004500 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4501 reply.readException();
4502 data.recycle();
4503 reply.recycle();
4504 }
4505
4506 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004507 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004508 Parcel data = Parcel.obtain();
4509 Parcel reply = Parcel.obtain();
4510 data.writeInterfaceToken(IActivityManager.descriptor);
4511 data.writeStrongBinder(owner);
4512 if (uri != null) {
4513 data.writeInt(1);
4514 uri.writeToParcel(data, 0);
4515 } else {
4516 data.writeInt(0);
4517 }
4518 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004519 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004520 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4521 reply.readException();
4522 data.recycle();
4523 reply.recycle();
4524 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004525
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004526 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004527 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004528 Parcel data = Parcel.obtain();
4529 Parcel reply = Parcel.obtain();
4530 data.writeInterfaceToken(IActivityManager.descriptor);
4531 data.writeInt(callingUid);
4532 data.writeString(targetPkg);
4533 uri.writeToParcel(data, 0);
4534 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004535 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004536 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4537 reply.readException();
4538 int res = reply.readInt();
4539 data.recycle();
4540 reply.recycle();
4541 return res;
4542 }
4543
Dianne Hackborn1676c852012-09-10 14:52:30 -07004544 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004545 String path, ParcelFileDescriptor fd) throws RemoteException {
4546 Parcel data = Parcel.obtain();
4547 Parcel reply = Parcel.obtain();
4548 data.writeInterfaceToken(IActivityManager.descriptor);
4549 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004550 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004551 data.writeInt(managed ? 1 : 0);
4552 data.writeString(path);
4553 if (fd != null) {
4554 data.writeInt(1);
4555 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4556 } else {
4557 data.writeInt(0);
4558 }
4559 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4560 reply.readException();
4561 boolean res = reply.readInt() != 0;
4562 reply.recycle();
4563 data.recycle();
4564 return res;
4565 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004566
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004567 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004568 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004569 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004570 Parcel data = Parcel.obtain();
4571 Parcel reply = Parcel.obtain();
4572 data.writeInterfaceToken(IActivityManager.descriptor);
4573 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004574 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004575 data.writeTypedArray(intents, 0);
4576 data.writeStringArray(resolvedTypes);
4577 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004578 if (options != null) {
4579 data.writeInt(1);
4580 options.writeToParcel(data, 0);
4581 } else {
4582 data.writeInt(0);
4583 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004584 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004585 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4586 reply.readException();
4587 int result = reply.readInt();
4588 reply.recycle();
4589 data.recycle();
4590 return result;
4591 }
4592
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004593 public int getFrontActivityScreenCompatMode() throws RemoteException {
4594 Parcel data = Parcel.obtain();
4595 Parcel reply = Parcel.obtain();
4596 data.writeInterfaceToken(IActivityManager.descriptor);
4597 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4598 reply.readException();
4599 int mode = reply.readInt();
4600 reply.recycle();
4601 data.recycle();
4602 return mode;
4603 }
4604
4605 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4606 Parcel data = Parcel.obtain();
4607 Parcel reply = Parcel.obtain();
4608 data.writeInterfaceToken(IActivityManager.descriptor);
4609 data.writeInt(mode);
4610 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4611 reply.readException();
4612 reply.recycle();
4613 data.recycle();
4614 }
4615
4616 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4617 Parcel data = Parcel.obtain();
4618 Parcel reply = Parcel.obtain();
4619 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004620 data.writeString(packageName);
4621 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004622 reply.readException();
4623 int mode = reply.readInt();
4624 reply.recycle();
4625 data.recycle();
4626 return mode;
4627 }
4628
4629 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004630 throws RemoteException {
4631 Parcel data = Parcel.obtain();
4632 Parcel reply = Parcel.obtain();
4633 data.writeInterfaceToken(IActivityManager.descriptor);
4634 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004635 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004636 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4637 reply.readException();
4638 reply.recycle();
4639 data.recycle();
4640 }
4641
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004642 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4643 Parcel data = Parcel.obtain();
4644 Parcel reply = Parcel.obtain();
4645 data.writeInterfaceToken(IActivityManager.descriptor);
4646 data.writeString(packageName);
4647 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4648 reply.readException();
4649 boolean ask = reply.readInt() != 0;
4650 reply.recycle();
4651 data.recycle();
4652 return ask;
4653 }
4654
4655 public void setPackageAskScreenCompat(String packageName, boolean ask)
4656 throws RemoteException {
4657 Parcel data = Parcel.obtain();
4658 Parcel reply = Parcel.obtain();
4659 data.writeInterfaceToken(IActivityManager.descriptor);
4660 data.writeString(packageName);
4661 data.writeInt(ask ? 1 : 0);
4662 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4663 reply.readException();
4664 reply.recycle();
4665 data.recycle();
4666 }
4667
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004668 public boolean switchUser(int userid) throws RemoteException {
4669 Parcel data = Parcel.obtain();
4670 Parcel reply = Parcel.obtain();
4671 data.writeInterfaceToken(IActivityManager.descriptor);
4672 data.writeInt(userid);
4673 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4674 reply.readException();
4675 boolean result = reply.readInt() != 0;
4676 reply.recycle();
4677 data.recycle();
4678 return result;
4679 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004680
Kenny Guy08488bf2014-02-21 17:40:37 +00004681 public boolean startUserInBackground(int userid) throws RemoteException {
4682 Parcel data = Parcel.obtain();
4683 Parcel reply = Parcel.obtain();
4684 data.writeInterfaceToken(IActivityManager.descriptor);
4685 data.writeInt(userid);
4686 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4687 reply.readException();
4688 boolean result = reply.readInt() != 0;
4689 reply.recycle();
4690 data.recycle();
4691 return result;
4692 }
4693
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004694 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4695 Parcel data = Parcel.obtain();
4696 Parcel reply = Parcel.obtain();
4697 data.writeInterfaceToken(IActivityManager.descriptor);
4698 data.writeInt(userid);
4699 data.writeStrongInterface(callback);
4700 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4701 reply.readException();
4702 int result = reply.readInt();
4703 reply.recycle();
4704 data.recycle();
4705 return result;
4706 }
4707
Amith Yamasani52f1d752012-03-28 18:19:29 -07004708 public UserInfo getCurrentUser() throws RemoteException {
4709 Parcel data = Parcel.obtain();
4710 Parcel reply = Parcel.obtain();
4711 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004712 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004713 reply.readException();
4714 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4715 reply.recycle();
4716 data.recycle();
4717 return userInfo;
4718 }
4719
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004720 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004721 Parcel data = Parcel.obtain();
4722 Parcel reply = Parcel.obtain();
4723 data.writeInterfaceToken(IActivityManager.descriptor);
4724 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004725 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004726 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4727 reply.readException();
4728 boolean result = reply.readInt() != 0;
4729 reply.recycle();
4730 data.recycle();
4731 return result;
4732 }
4733
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004734 public int[] getRunningUserIds() throws RemoteException {
4735 Parcel data = Parcel.obtain();
4736 Parcel reply = Parcel.obtain();
4737 data.writeInterfaceToken(IActivityManager.descriptor);
4738 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4739 reply.readException();
4740 int[] result = reply.createIntArray();
4741 reply.recycle();
4742 data.recycle();
4743 return result;
4744 }
4745
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004746 public boolean removeTask(int taskId, int flags) throws RemoteException {
4747 Parcel data = Parcel.obtain();
4748 Parcel reply = Parcel.obtain();
4749 data.writeInterfaceToken(IActivityManager.descriptor);
4750 data.writeInt(taskId);
4751 data.writeInt(flags);
4752 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4753 reply.readException();
4754 boolean result = reply.readInt() != 0;
4755 reply.recycle();
4756 data.recycle();
4757 return result;
4758 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004759
Jeff Sharkeya4620792011-05-20 15:29:23 -07004760 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4761 Parcel data = Parcel.obtain();
4762 Parcel reply = Parcel.obtain();
4763 data.writeInterfaceToken(IActivityManager.descriptor);
4764 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4765 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4766 reply.readException();
4767 data.recycle();
4768 reply.recycle();
4769 }
4770
4771 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4772 Parcel data = Parcel.obtain();
4773 Parcel reply = Parcel.obtain();
4774 data.writeInterfaceToken(IActivityManager.descriptor);
4775 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4776 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4777 reply.readException();
4778 data.recycle();
4779 reply.recycle();
4780 }
4781
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004782 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4783 Parcel data = Parcel.obtain();
4784 Parcel reply = Parcel.obtain();
4785 data.writeInterfaceToken(IActivityManager.descriptor);
4786 data.writeStrongBinder(sender.asBinder());
4787 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4788 reply.readException();
4789 boolean res = reply.readInt() != 0;
4790 data.recycle();
4791 reply.recycle();
4792 return res;
4793 }
4794
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004795 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4796 Parcel data = Parcel.obtain();
4797 Parcel reply = Parcel.obtain();
4798 data.writeInterfaceToken(IActivityManager.descriptor);
4799 data.writeStrongBinder(sender.asBinder());
4800 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4801 reply.readException();
4802 boolean res = reply.readInt() != 0;
4803 data.recycle();
4804 reply.recycle();
4805 return res;
4806 }
4807
Dianne Hackborn81038902012-11-26 17:04:09 -08004808 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4809 Parcel data = Parcel.obtain();
4810 Parcel reply = Parcel.obtain();
4811 data.writeInterfaceToken(IActivityManager.descriptor);
4812 data.writeStrongBinder(sender.asBinder());
4813 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4814 reply.readException();
4815 Intent res = reply.readInt() != 0
4816 ? Intent.CREATOR.createFromParcel(reply) : null;
4817 data.recycle();
4818 reply.recycle();
4819 return res;
4820 }
4821
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004822 public String getTagForIntentSender(IIntentSender sender, String prefix)
4823 throws RemoteException {
4824 Parcel data = Parcel.obtain();
4825 Parcel reply = Parcel.obtain();
4826 data.writeInterfaceToken(IActivityManager.descriptor);
4827 data.writeStrongBinder(sender.asBinder());
4828 data.writeString(prefix);
4829 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4830 reply.readException();
4831 String res = reply.readString();
4832 data.recycle();
4833 reply.recycle();
4834 return res;
4835 }
4836
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004837 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4838 {
4839 Parcel data = Parcel.obtain();
4840 Parcel reply = Parcel.obtain();
4841 data.writeInterfaceToken(IActivityManager.descriptor);
4842 values.writeToParcel(data, 0);
4843 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4844 reply.readException();
4845 data.recycle();
4846 reply.recycle();
4847 }
4848
Dianne Hackbornb437e092011-08-05 17:50:29 -07004849 public long[] getProcessPss(int[] pids) throws RemoteException {
4850 Parcel data = Parcel.obtain();
4851 Parcel reply = Parcel.obtain();
4852 data.writeInterfaceToken(IActivityManager.descriptor);
4853 data.writeIntArray(pids);
4854 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4855 reply.readException();
4856 long[] res = reply.createLongArray();
4857 data.recycle();
4858 reply.recycle();
4859 return res;
4860 }
4861
Dianne Hackborn661cd522011-08-22 00:26:20 -07004862 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4863 Parcel data = Parcel.obtain();
4864 Parcel reply = Parcel.obtain();
4865 data.writeInterfaceToken(IActivityManager.descriptor);
4866 TextUtils.writeToParcel(msg, data, 0);
4867 data.writeInt(always ? 1 : 0);
4868 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4869 reply.readException();
4870 data.recycle();
4871 reply.recycle();
4872 }
4873
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004874 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004875 Parcel data = Parcel.obtain();
4876 Parcel reply = Parcel.obtain();
4877 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004878 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004879 reply.readException();
4880 data.recycle();
4881 reply.recycle();
4882 }
4883
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004884 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07004885 throws RemoteException {
4886 Parcel data = Parcel.obtain();
4887 Parcel reply = Parcel.obtain();
4888 data.writeInterfaceToken(IActivityManager.descriptor);
4889 data.writeStrongBinder(token);
4890 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004891 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07004892 reply.readException();
4893 boolean result = reply.readInt() != 0;
4894 data.recycle();
4895 reply.recycle();
4896 return result;
4897 }
4898
4899 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4900 throws RemoteException {
4901 Parcel data = Parcel.obtain();
4902 Parcel reply = Parcel.obtain();
4903 data.writeInterfaceToken(IActivityManager.descriptor);
4904 data.writeStrongBinder(token);
4905 target.writeToParcel(data, 0);
4906 data.writeInt(resultCode);
4907 if (resultData != null) {
4908 data.writeInt(1);
4909 resultData.writeToParcel(data, 0);
4910 } else {
4911 data.writeInt(0);
4912 }
4913 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4914 reply.readException();
4915 boolean result = reply.readInt() != 0;
4916 data.recycle();
4917 reply.recycle();
4918 return result;
4919 }
4920
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004921 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4922 Parcel data = Parcel.obtain();
4923 Parcel reply = Parcel.obtain();
4924 data.writeInterfaceToken(IActivityManager.descriptor);
4925 data.writeStrongBinder(activityToken);
4926 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4927 reply.readException();
4928 int result = reply.readInt();
4929 data.recycle();
4930 reply.recycle();
4931 return result;
4932 }
4933
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004934 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4935 Parcel data = Parcel.obtain();
4936 Parcel reply = Parcel.obtain();
4937 data.writeInterfaceToken(IActivityManager.descriptor);
4938 data.writeStrongBinder(activityToken);
4939 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4940 reply.readException();
4941 String result = reply.readString();
4942 data.recycle();
4943 reply.recycle();
4944 return result;
4945 }
4946
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004947 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4948 Parcel data = Parcel.obtain();
4949 Parcel reply = Parcel.obtain();
4950 data.writeInterfaceToken(IActivityManager.descriptor);
4951 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4952 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4953 reply.readException();
4954 data.recycle();
4955 reply.recycle();
4956 }
4957
4958 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4959 Parcel data = Parcel.obtain();
4960 Parcel reply = Parcel.obtain();
4961 data.writeInterfaceToken(IActivityManager.descriptor);
4962 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4963 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4964 reply.readException();
4965 data.recycle();
4966 reply.recycle();
4967 }
4968
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004969 public void requestBugReport() throws RemoteException {
4970 Parcel data = Parcel.obtain();
4971 Parcel reply = Parcel.obtain();
4972 data.writeInterfaceToken(IActivityManager.descriptor);
4973 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4974 reply.readException();
4975 data.recycle();
4976 reply.recycle();
4977 }
4978
Jeff Brownbd181bb2013-09-10 16:44:24 -07004979 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4980 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004981 Parcel data = Parcel.obtain();
4982 Parcel reply = Parcel.obtain();
4983 data.writeInterfaceToken(IActivityManager.descriptor);
4984 data.writeInt(pid);
4985 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004986 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004987 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4988 reply.readException();
4989 long res = reply.readInt();
4990 data.recycle();
4991 reply.recycle();
4992 return res;
4993 }
4994
Adam Skorydfc7fd72013-08-05 19:23:41 -07004995 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004996 Parcel data = Parcel.obtain();
4997 Parcel reply = Parcel.obtain();
4998 data.writeInterfaceToken(IActivityManager.descriptor);
4999 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005000 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005001 reply.readException();
5002 Bundle res = reply.readBundle();
5003 data.recycle();
5004 reply.recycle();
5005 return res;
5006 }
5007
Adam Skory7140a252013-09-11 12:04:58 +01005008 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005009 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005010 Parcel data = Parcel.obtain();
5011 Parcel reply = Parcel.obtain();
5012 data.writeInterfaceToken(IActivityManager.descriptor);
5013 data.writeStrongBinder(token);
5014 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005015 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005016 reply.readException();
5017 data.recycle();
5018 reply.recycle();
5019 }
5020
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005021 public void killUid(int uid, String reason) throws RemoteException {
5022 Parcel data = Parcel.obtain();
5023 Parcel reply = Parcel.obtain();
5024 data.writeInterfaceToken(IActivityManager.descriptor);
5025 data.writeInt(uid);
5026 data.writeString(reason);
5027 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5028 reply.readException();
5029 data.recycle();
5030 reply.recycle();
5031 }
5032
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005033 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5034 Parcel data = Parcel.obtain();
5035 Parcel reply = Parcel.obtain();
5036 data.writeInterfaceToken(IActivityManager.descriptor);
5037 data.writeStrongBinder(who);
5038 data.writeInt(allowRestart ? 1 : 0);
5039 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5040 reply.readException();
5041 data.recycle();
5042 reply.recycle();
5043 }
5044
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005045 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5046 Parcel data = Parcel.obtain();
5047 Parcel reply = Parcel.obtain();
5048 data.writeInterfaceToken(IActivityManager.descriptor);
5049 data.writeStrongBinder(token);
5050 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5051 reply.readException();
5052 data.recycle();
5053 reply.recycle();
5054 }
5055
Craig Mautner5eda9b32013-07-02 11:58:16 -07005056 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5057 Parcel data = Parcel.obtain();
5058 Parcel reply = Parcel.obtain();
5059 data.writeInterfaceToken(IActivityManager.descriptor);
5060 data.writeStrongBinder(token);
5061 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5062 reply.readException();
5063 data.recycle();
5064 reply.recycle();
5065 }
5066
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005067 public void restart() throws RemoteException {
5068 Parcel data = Parcel.obtain();
5069 Parcel reply = Parcel.obtain();
5070 data.writeInterfaceToken(IActivityManager.descriptor);
5071 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5072 reply.readException();
5073 data.recycle();
5074 reply.recycle();
5075 }
5076
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005077 public void performIdleMaintenance() throws RemoteException {
5078 Parcel data = Parcel.obtain();
5079 Parcel reply = Parcel.obtain();
5080 data.writeInterfaceToken(IActivityManager.descriptor);
5081 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5082 reply.readException();
5083 data.recycle();
5084 reply.recycle();
5085 }
5086
Craig Mautner4a1cb222013-12-04 16:14:06 -08005087 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
5088 IActivityContainerCallback callback) throws RemoteException {
5089 Parcel data = Parcel.obtain();
5090 Parcel reply = Parcel.obtain();
5091 data.writeInterfaceToken(IActivityManager.descriptor);
5092 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005093 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08005094 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5095 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005096 final int result = reply.readInt();
5097 final IActivityContainer res;
5098 if (result == 1) {
5099 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5100 } else {
5101 res = null;
5102 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005103 data.recycle();
5104 reply.recycle();
5105 return res;
5106 }
5107
Craig Mautner95da1082014-02-24 17:54:35 -08005108 public void deleteActivityContainer(IActivityContainer activityContainer)
5109 throws RemoteException {
5110 Parcel data = Parcel.obtain();
5111 Parcel reply = Parcel.obtain();
5112 data.writeInterfaceToken(IActivityManager.descriptor);
5113 data.writeStrongBinder(activityContainer.asBinder());
5114 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5115 reply.readException();
5116 data.recycle();
5117 reply.recycle();
5118 }
5119
Craig Mautnere0a38842013-12-16 16:14:02 -08005120 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
5121 throws RemoteException {
5122 Parcel data = Parcel.obtain();
5123 Parcel reply = Parcel.obtain();
5124 data.writeInterfaceToken(IActivityManager.descriptor);
5125 data.writeStrongBinder(activityToken);
5126 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5127 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005128 final int result = reply.readInt();
5129 final IActivityContainer res;
5130 if (result == 1) {
5131 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5132 } else {
5133 res = null;
5134 }
Craig Mautnere0a38842013-12-16 16:14:02 -08005135 data.recycle();
5136 reply.recycle();
5137 return res;
5138 }
5139
Craig Mautner4a1cb222013-12-04 16:14:06 -08005140 public IBinder getHomeActivityToken() throws RemoteException {
5141 Parcel data = Parcel.obtain();
5142 Parcel reply = Parcel.obtain();
5143 data.writeInterfaceToken(IActivityManager.descriptor);
5144 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5145 reply.readException();
5146 IBinder res = reply.readStrongBinder();
5147 data.recycle();
5148 reply.recycle();
5149 return res;
5150 }
5151
Craig Mautneraea74a52014-03-08 14:23:10 -08005152 @Override
5153 public void startLockTaskMode(int taskId) throws RemoteException {
5154 Parcel data = Parcel.obtain();
5155 Parcel reply = Parcel.obtain();
5156 data.writeInterfaceToken(IActivityManager.descriptor);
5157 data.writeInt(taskId);
5158 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5159 reply.readException();
5160 data.recycle();
5161 reply.recycle();
5162 }
5163
5164 @Override
5165 public void startLockTaskMode(IBinder token) throws RemoteException {
5166 Parcel data = Parcel.obtain();
5167 Parcel reply = Parcel.obtain();
5168 data.writeInterfaceToken(IActivityManager.descriptor);
5169 data.writeStrongBinder(token);
5170 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5171 reply.readException();
5172 data.recycle();
5173 reply.recycle();
5174 }
5175
5176 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005177 public void startLockTaskModeOnCurrent() throws RemoteException {
5178 Parcel data = Parcel.obtain();
5179 Parcel reply = Parcel.obtain();
5180 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005181 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005182 reply.readException();
5183 data.recycle();
5184 reply.recycle();
5185 }
5186
5187 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005188 public void stopLockTaskMode() throws RemoteException {
5189 Parcel data = Parcel.obtain();
5190 Parcel reply = Parcel.obtain();
5191 data.writeInterfaceToken(IActivityManager.descriptor);
5192 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5193 reply.readException();
5194 data.recycle();
5195 reply.recycle();
5196 }
5197
5198 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005199 public void stopLockTaskModeOnCurrent() throws RemoteException {
5200 Parcel data = Parcel.obtain();
5201 Parcel reply = Parcel.obtain();
5202 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005203 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005204 reply.readException();
5205 data.recycle();
5206 reply.recycle();
5207 }
5208
5209 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005210 public boolean isInLockTaskMode() throws RemoteException {
5211 Parcel data = Parcel.obtain();
5212 Parcel reply = Parcel.obtain();
5213 data.writeInterfaceToken(IActivityManager.descriptor);
5214 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5215 reply.readException();
5216 boolean isInLockTaskMode = reply.readInt() == 1;
5217 data.recycle();
5218 reply.recycle();
5219 return isInLockTaskMode;
5220 }
5221
Craig Mautner688b5102014-03-27 16:55:03 -07005222 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005223 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005224 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005225 Parcel data = Parcel.obtain();
5226 Parcel reply = Parcel.obtain();
5227 data.writeInterfaceToken(IActivityManager.descriptor);
5228 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005229 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005230 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005231 reply.readException();
5232 data.recycle();
5233 reply.recycle();
5234 }
5235
Craig Mautneree2e45a2014-06-27 12:10:03 -07005236 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005237 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005238 Parcel data = Parcel.obtain();
5239 Parcel reply = Parcel.obtain();
5240 data.writeInterfaceToken(IActivityManager.descriptor);
5241 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005242 data.writeInt(visible ? 1 : 0);
5243 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005244 reply.readException();
5245 boolean success = reply.readInt() > 0;
5246 data.recycle();
5247 reply.recycle();
5248 return success;
5249 }
5250
5251 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005252 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005253 Parcel data = Parcel.obtain();
5254 Parcel reply = Parcel.obtain();
5255 data.writeInterfaceToken(IActivityManager.descriptor);
5256 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005257 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005258 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005259 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005260 data.recycle();
5261 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005262 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005263 }
5264
5265 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005266 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005267 Parcel data = Parcel.obtain();
5268 Parcel reply = Parcel.obtain();
5269 data.writeInterfaceToken(IActivityManager.descriptor);
5270 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005271 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5272 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005273 reply.readException();
5274 data.recycle();
5275 reply.recycle();
5276 }
5277
5278 @Override
5279 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5280 Parcel data = Parcel.obtain();
5281 Parcel reply = Parcel.obtain();
5282 data.writeInterfaceToken(IActivityManager.descriptor);
5283 data.writeStrongBinder(token);
5284 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5285 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005286 reply.readException();
5287 data.recycle();
5288 reply.recycle();
5289 }
5290
Craig Mautner8746a472014-07-24 15:12:54 -07005291 @Override
5292 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5293 Parcel data = Parcel.obtain();
5294 Parcel reply = Parcel.obtain();
5295 data.writeInterfaceToken(IActivityManager.descriptor);
5296 data.writeStrongBinder(token);
5297 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5298 IBinder.FLAG_ONEWAY);
5299 reply.readException();
5300 data.recycle();
5301 reply.recycle();
5302 }
5303
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005304 private IBinder mRemote;
5305}