blob: 394b183ffd06f9efda9fbc7a92918e19b1d241dc [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();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700512 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800513 reply.writeNoException();
514 return true;
515 }
516
517 case ACTIVITY_STOPPED_TRANSACTION: {
518 data.enforceInterface(IActivityManager.descriptor);
519 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800520 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700521 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800522 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700523 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800524 reply.writeNoException();
525 return true;
526 }
527
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800528 case ACTIVITY_SLEPT_TRANSACTION: {
529 data.enforceInterface(IActivityManager.descriptor);
530 IBinder token = data.readStrongBinder();
531 activitySlept(token);
532 reply.writeNoException();
533 return true;
534 }
535
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800536 case ACTIVITY_DESTROYED_TRANSACTION: {
537 data.enforceInterface(IActivityManager.descriptor);
538 IBinder token = data.readStrongBinder();
539 activityDestroyed(token);
540 reply.writeNoException();
541 return true;
542 }
543
544 case GET_CALLING_PACKAGE_TRANSACTION: {
545 data.enforceInterface(IActivityManager.descriptor);
546 IBinder token = data.readStrongBinder();
547 String res = token != null ? getCallingPackage(token) : null;
548 reply.writeNoException();
549 reply.writeString(res);
550 return true;
551 }
552
553 case GET_CALLING_ACTIVITY_TRANSACTION: {
554 data.enforceInterface(IActivityManager.descriptor);
555 IBinder token = data.readStrongBinder();
556 ComponentName cn = getCallingActivity(token);
557 reply.writeNoException();
558 ComponentName.writeToParcel(cn, reply);
559 return true;
560 }
561
Winson Chung1147c402014-05-14 11:05:00 -0700562 case GET_APP_TASKS_TRANSACTION: {
563 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700564 String callingPackage = data.readString();
565 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700566 reply.writeNoException();
567 int N = list != null ? list.size() : -1;
568 reply.writeInt(N);
569 int i;
570 for (i=0; i<N; i++) {
571 IAppTask task = list.get(i);
572 reply.writeStrongBinder(task.asBinder());
573 }
574 return true;
575 }
576
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700577 case ADD_APP_TASK_TRANSACTION: {
578 data.enforceInterface(IActivityManager.descriptor);
579 IBinder activityToken = data.readStrongBinder();
580 Intent intent = Intent.CREATOR.createFromParcel(data);
581 ActivityManager.TaskDescription descr
582 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
583 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
584 int res = addAppTask(activityToken, intent, descr, thumbnail);
585 reply.writeNoException();
586 reply.writeInt(res);
587 return true;
588 }
589
590 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
591 data.enforceInterface(IActivityManager.descriptor);
592 Point size = getAppTaskThumbnailSize();
593 reply.writeNoException();
594 size.writeToParcel(reply, 0);
595 return true;
596 }
597
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800598 case GET_TASKS_TRANSACTION: {
599 data.enforceInterface(IActivityManager.descriptor);
600 int maxNum = data.readInt();
601 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700602 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800603 reply.writeNoException();
604 int N = list != null ? list.size() : -1;
605 reply.writeInt(N);
606 int i;
607 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700608 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800609 info.writeToParcel(reply, 0);
610 }
611 return true;
612 }
613
614 case GET_RECENT_TASKS_TRANSACTION: {
615 data.enforceInterface(IActivityManager.descriptor);
616 int maxNum = data.readInt();
617 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700618 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800619 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700620 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800621 reply.writeNoException();
622 reply.writeTypedList(list);
623 return true;
624 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700625
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700626 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800627 data.enforceInterface(IActivityManager.descriptor);
628 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700629 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800630 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700631 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800632 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700633 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700634 } else {
635 reply.writeInt(0);
636 }
637 return true;
638 }
639
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 case GET_SERVICES_TRANSACTION: {
641 data.enforceInterface(IActivityManager.descriptor);
642 int maxNum = data.readInt();
643 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700644 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800645 reply.writeNoException();
646 int N = list != null ? list.size() : -1;
647 reply.writeInt(N);
648 int i;
649 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700650 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800651 info.writeToParcel(reply, 0);
652 }
653 return true;
654 }
655
656 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
657 data.enforceInterface(IActivityManager.descriptor);
658 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
659 reply.writeNoException();
660 reply.writeTypedList(list);
661 return true;
662 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700663
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800664 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
665 data.enforceInterface(IActivityManager.descriptor);
666 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
667 reply.writeNoException();
668 reply.writeTypedList(list);
669 return true;
670 }
671
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700672 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
673 data.enforceInterface(IActivityManager.descriptor);
674 List<ApplicationInfo> list = getRunningExternalApplications();
675 reply.writeNoException();
676 reply.writeTypedList(list);
677 return true;
678 }
679
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800680 case MOVE_TASK_TO_FRONT_TRANSACTION: {
681 data.enforceInterface(IActivityManager.descriptor);
682 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800683 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700684 Bundle options = data.readInt() != 0
685 ? Bundle.CREATOR.createFromParcel(data) : null;
686 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800687 reply.writeNoException();
688 return true;
689 }
690
691 case MOVE_TASK_TO_BACK_TRANSACTION: {
692 data.enforceInterface(IActivityManager.descriptor);
693 int task = data.readInt();
694 moveTaskToBack(task);
695 reply.writeNoException();
696 return true;
697 }
698
699 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
700 data.enforceInterface(IActivityManager.descriptor);
701 IBinder token = data.readStrongBinder();
702 boolean nonRoot = data.readInt() != 0;
703 boolean res = moveActivityTaskToBack(token, nonRoot);
704 reply.writeNoException();
705 reply.writeInt(res ? 1 : 0);
706 return true;
707 }
708
709 case MOVE_TASK_BACKWARDS_TRANSACTION: {
710 data.enforceInterface(IActivityManager.descriptor);
711 int task = data.readInt();
712 moveTaskBackwards(task);
713 reply.writeNoException();
714 return true;
715 }
716
Craig Mautnerc00204b2013-03-05 15:02:14 -0800717 case MOVE_TASK_TO_STACK_TRANSACTION: {
718 data.enforceInterface(IActivityManager.descriptor);
719 int taskId = data.readInt();
720 int stackId = data.readInt();
721 boolean toTop = data.readInt() != 0;
722 moveTaskToStack(taskId, stackId, toTop);
723 reply.writeNoException();
724 return true;
725 }
726
727 case RESIZE_STACK_TRANSACTION: {
728 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800729 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800730 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800731 Rect r = Rect.CREATOR.createFromParcel(data);
732 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800733 reply.writeNoException();
734 return true;
735 }
736
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800737 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700738 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800739 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700740 reply.writeNoException();
741 reply.writeTypedList(list);
742 return true;
743 }
744
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800745 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700746 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800747 int stackId = data.readInt();
748 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700749 reply.writeNoException();
750 if (info != null) {
751 reply.writeInt(1);
752 info.writeToParcel(reply, 0);
753 } else {
754 reply.writeInt(0);
755 }
756 return true;
757 }
758
Winson Chung303e1ff2014-03-07 15:06:19 -0800759 case IS_IN_HOME_STACK_TRANSACTION: {
760 data.enforceInterface(IActivityManager.descriptor);
761 int taskId = data.readInt();
762 boolean isInHomeStack = isInHomeStack(taskId);
763 reply.writeNoException();
764 reply.writeInt(isInHomeStack ? 1 : 0);
765 return true;
766 }
767
Craig Mautnercf910b02013-04-23 11:23:27 -0700768 case SET_FOCUSED_STACK_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 int stackId = data.readInt();
771 setFocusedStack(stackId);
772 reply.writeNoException();
773 return true;
774 }
775
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800776 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
777 data.enforceInterface(IActivityManager.descriptor);
778 IBinder token = data.readStrongBinder();
779 boolean onlyRoot = data.readInt() != 0;
780 int res = token != null
781 ? getTaskForActivity(token, onlyRoot) : -1;
782 reply.writeNoException();
783 reply.writeInt(res);
784 return true;
785 }
786
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800787 case GET_CONTENT_PROVIDER_TRANSACTION: {
788 data.enforceInterface(IActivityManager.descriptor);
789 IBinder b = data.readStrongBinder();
790 IApplicationThread app = ApplicationThreadNative.asInterface(b);
791 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700792 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700793 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700794 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800795 reply.writeNoException();
796 if (cph != null) {
797 reply.writeInt(1);
798 cph.writeToParcel(reply, 0);
799 } else {
800 reply.writeInt(0);
801 }
802 return true;
803 }
804
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800805 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
806 data.enforceInterface(IActivityManager.descriptor);
807 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700808 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800809 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700810 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800811 reply.writeNoException();
812 if (cph != null) {
813 reply.writeInt(1);
814 cph.writeToParcel(reply, 0);
815 } else {
816 reply.writeInt(0);
817 }
818 return true;
819 }
820
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800821 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
822 data.enforceInterface(IActivityManager.descriptor);
823 IBinder b = data.readStrongBinder();
824 IApplicationThread app = ApplicationThreadNative.asInterface(b);
825 ArrayList<ContentProviderHolder> providers =
826 data.createTypedArrayList(ContentProviderHolder.CREATOR);
827 publishContentProviders(app, providers);
828 reply.writeNoException();
829 return true;
830 }
831
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700832 case REF_CONTENT_PROVIDER_TRANSACTION: {
833 data.enforceInterface(IActivityManager.descriptor);
834 IBinder b = data.readStrongBinder();
835 int stable = data.readInt();
836 int unstable = data.readInt();
837 boolean res = refContentProvider(b, stable, unstable);
838 reply.writeNoException();
839 reply.writeInt(res ? 1 : 0);
840 return true;
841 }
842
843 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
844 data.enforceInterface(IActivityManager.descriptor);
845 IBinder b = data.readStrongBinder();
846 unstableProviderDied(b);
847 reply.writeNoException();
848 return true;
849 }
850
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700851 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
852 data.enforceInterface(IActivityManager.descriptor);
853 IBinder b = data.readStrongBinder();
854 appNotRespondingViaProvider(b);
855 reply.writeNoException();
856 return true;
857 }
858
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800859 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
860 data.enforceInterface(IActivityManager.descriptor);
861 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700862 boolean stable = data.readInt() != 0;
863 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800864 reply.writeNoException();
865 return true;
866 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800867
868 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
869 data.enforceInterface(IActivityManager.descriptor);
870 String name = data.readString();
871 IBinder token = data.readStrongBinder();
872 removeContentProviderExternal(name, token);
873 reply.writeNoException();
874 return true;
875 }
876
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700877 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
878 data.enforceInterface(IActivityManager.descriptor);
879 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
880 PendingIntent pi = getRunningServiceControlPanel(comp);
881 reply.writeNoException();
882 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
883 return true;
884 }
885
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800886 case START_SERVICE_TRANSACTION: {
887 data.enforceInterface(IActivityManager.descriptor);
888 IBinder b = data.readStrongBinder();
889 IApplicationThread app = ApplicationThreadNative.asInterface(b);
890 Intent service = Intent.CREATOR.createFromParcel(data);
891 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700892 int userId = data.readInt();
893 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800894 reply.writeNoException();
895 ComponentName.writeToParcel(cn, reply);
896 return true;
897 }
898
899 case STOP_SERVICE_TRANSACTION: {
900 data.enforceInterface(IActivityManager.descriptor);
901 IBinder b = data.readStrongBinder();
902 IApplicationThread app = ApplicationThreadNative.asInterface(b);
903 Intent service = Intent.CREATOR.createFromParcel(data);
904 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700905 int userId = data.readInt();
906 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800907 reply.writeNoException();
908 reply.writeInt(res);
909 return true;
910 }
911
912 case STOP_SERVICE_TOKEN_TRANSACTION: {
913 data.enforceInterface(IActivityManager.descriptor);
914 ComponentName className = ComponentName.readFromParcel(data);
915 IBinder token = data.readStrongBinder();
916 int startId = data.readInt();
917 boolean res = stopServiceToken(className, token, startId);
918 reply.writeNoException();
919 reply.writeInt(res ? 1 : 0);
920 return true;
921 }
922
923 case SET_SERVICE_FOREGROUND_TRANSACTION: {
924 data.enforceInterface(IActivityManager.descriptor);
925 ComponentName className = ComponentName.readFromParcel(data);
926 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700927 int id = data.readInt();
928 Notification notification = null;
929 if (data.readInt() != 0) {
930 notification = Notification.CREATOR.createFromParcel(data);
931 }
932 boolean removeNotification = data.readInt() != 0;
933 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800934 reply.writeNoException();
935 return true;
936 }
937
938 case BIND_SERVICE_TRANSACTION: {
939 data.enforceInterface(IActivityManager.descriptor);
940 IBinder b = data.readStrongBinder();
941 IApplicationThread app = ApplicationThreadNative.asInterface(b);
942 IBinder token = data.readStrongBinder();
943 Intent service = Intent.CREATOR.createFromParcel(data);
944 String resolvedType = data.readString();
945 b = data.readStrongBinder();
946 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800947 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800948 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800949 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800950 reply.writeNoException();
951 reply.writeInt(res);
952 return true;
953 }
954
955 case UNBIND_SERVICE_TRANSACTION: {
956 data.enforceInterface(IActivityManager.descriptor);
957 IBinder b = data.readStrongBinder();
958 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
959 boolean res = unbindService(conn);
960 reply.writeNoException();
961 reply.writeInt(res ? 1 : 0);
962 return true;
963 }
964
965 case PUBLISH_SERVICE_TRANSACTION: {
966 data.enforceInterface(IActivityManager.descriptor);
967 IBinder token = data.readStrongBinder();
968 Intent intent = Intent.CREATOR.createFromParcel(data);
969 IBinder service = data.readStrongBinder();
970 publishService(token, intent, service);
971 reply.writeNoException();
972 return true;
973 }
974
975 case UNBIND_FINISHED_TRANSACTION: {
976 data.enforceInterface(IActivityManager.descriptor);
977 IBinder token = data.readStrongBinder();
978 Intent intent = Intent.CREATOR.createFromParcel(data);
979 boolean doRebind = data.readInt() != 0;
980 unbindFinished(token, intent, doRebind);
981 reply.writeNoException();
982 return true;
983 }
984
985 case SERVICE_DONE_EXECUTING_TRANSACTION: {
986 data.enforceInterface(IActivityManager.descriptor);
987 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700988 int type = data.readInt();
989 int startId = data.readInt();
990 int res = data.readInt();
991 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800992 reply.writeNoException();
993 return true;
994 }
995
996 case START_INSTRUMENTATION_TRANSACTION: {
997 data.enforceInterface(IActivityManager.descriptor);
998 ComponentName className = ComponentName.readFromParcel(data);
999 String profileFile = data.readString();
1000 int fl = data.readInt();
1001 Bundle arguments = data.readBundle();
1002 IBinder b = data.readStrongBinder();
1003 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001004 b = data.readStrongBinder();
1005 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001006 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001007 String abiOverride = data.readString();
1008 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1009 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001010 reply.writeNoException();
1011 reply.writeInt(res ? 1 : 0);
1012 return true;
1013 }
1014
1015
1016 case FINISH_INSTRUMENTATION_TRANSACTION: {
1017 data.enforceInterface(IActivityManager.descriptor);
1018 IBinder b = data.readStrongBinder();
1019 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1020 int resultCode = data.readInt();
1021 Bundle results = data.readBundle();
1022 finishInstrumentation(app, resultCode, results);
1023 reply.writeNoException();
1024 return true;
1025 }
1026
1027 case GET_CONFIGURATION_TRANSACTION: {
1028 data.enforceInterface(IActivityManager.descriptor);
1029 Configuration config = getConfiguration();
1030 reply.writeNoException();
1031 config.writeToParcel(reply, 0);
1032 return true;
1033 }
1034
1035 case UPDATE_CONFIGURATION_TRANSACTION: {
1036 data.enforceInterface(IActivityManager.descriptor);
1037 Configuration config = Configuration.CREATOR.createFromParcel(data);
1038 updateConfiguration(config);
1039 reply.writeNoException();
1040 return true;
1041 }
1042
1043 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1044 data.enforceInterface(IActivityManager.descriptor);
1045 IBinder token = data.readStrongBinder();
1046 int requestedOrientation = data.readInt();
1047 setRequestedOrientation(token, requestedOrientation);
1048 reply.writeNoException();
1049 return true;
1050 }
1051
1052 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1053 data.enforceInterface(IActivityManager.descriptor);
1054 IBinder token = data.readStrongBinder();
1055 int req = getRequestedOrientation(token);
1056 reply.writeNoException();
1057 reply.writeInt(req);
1058 return true;
1059 }
1060
1061 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1062 data.enforceInterface(IActivityManager.descriptor);
1063 IBinder token = data.readStrongBinder();
1064 ComponentName cn = getActivityClassForToken(token);
1065 reply.writeNoException();
1066 ComponentName.writeToParcel(cn, reply);
1067 return true;
1068 }
1069
1070 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1071 data.enforceInterface(IActivityManager.descriptor);
1072 IBinder token = data.readStrongBinder();
1073 reply.writeNoException();
1074 reply.writeString(getPackageForToken(token));
1075 return true;
1076 }
1077
1078 case GET_INTENT_SENDER_TRANSACTION: {
1079 data.enforceInterface(IActivityManager.descriptor);
1080 int type = data.readInt();
1081 String packageName = data.readString();
1082 IBinder token = data.readStrongBinder();
1083 String resultWho = data.readString();
1084 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001085 Intent[] requestIntents;
1086 String[] requestResolvedTypes;
1087 if (data.readInt() != 0) {
1088 requestIntents = data.createTypedArray(Intent.CREATOR);
1089 requestResolvedTypes = data.createStringArray();
1090 } else {
1091 requestIntents = null;
1092 requestResolvedTypes = null;
1093 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001094 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001095 Bundle options = data.readInt() != 0
1096 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001097 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001098 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001099 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001100 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001101 reply.writeNoException();
1102 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1103 return true;
1104 }
1105
1106 case CANCEL_INTENT_SENDER_TRANSACTION: {
1107 data.enforceInterface(IActivityManager.descriptor);
1108 IIntentSender r = IIntentSender.Stub.asInterface(
1109 data.readStrongBinder());
1110 cancelIntentSender(r);
1111 reply.writeNoException();
1112 return true;
1113 }
1114
1115 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1116 data.enforceInterface(IActivityManager.descriptor);
1117 IIntentSender r = IIntentSender.Stub.asInterface(
1118 data.readStrongBinder());
1119 String res = getPackageForIntentSender(r);
1120 reply.writeNoException();
1121 reply.writeString(res);
1122 return true;
1123 }
1124
Christopher Tatec4a07d12012-04-06 14:19:13 -07001125 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1126 data.enforceInterface(IActivityManager.descriptor);
1127 IIntentSender r = IIntentSender.Stub.asInterface(
1128 data.readStrongBinder());
1129 int res = getUidForIntentSender(r);
1130 reply.writeNoException();
1131 reply.writeInt(res);
1132 return true;
1133 }
1134
Dianne Hackborn41203752012-08-31 14:05:51 -07001135 case HANDLE_INCOMING_USER_TRANSACTION: {
1136 data.enforceInterface(IActivityManager.descriptor);
1137 int callingPid = data.readInt();
1138 int callingUid = data.readInt();
1139 int userId = data.readInt();
1140 boolean allowAll = data.readInt() != 0 ;
1141 boolean requireFull = data.readInt() != 0;
1142 String name = data.readString();
1143 String callerPackage = data.readString();
1144 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1145 requireFull, name, callerPackage);
1146 reply.writeNoException();
1147 reply.writeInt(res);
1148 return true;
1149 }
1150
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 case SET_PROCESS_LIMIT_TRANSACTION: {
1152 data.enforceInterface(IActivityManager.descriptor);
1153 int max = data.readInt();
1154 setProcessLimit(max);
1155 reply.writeNoException();
1156 return true;
1157 }
1158
1159 case GET_PROCESS_LIMIT_TRANSACTION: {
1160 data.enforceInterface(IActivityManager.descriptor);
1161 int limit = getProcessLimit();
1162 reply.writeNoException();
1163 reply.writeInt(limit);
1164 return true;
1165 }
1166
1167 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1168 data.enforceInterface(IActivityManager.descriptor);
1169 IBinder token = data.readStrongBinder();
1170 int pid = data.readInt();
1171 boolean isForeground = data.readInt() != 0;
1172 setProcessForeground(token, pid, isForeground);
1173 reply.writeNoException();
1174 return true;
1175 }
1176
1177 case CHECK_PERMISSION_TRANSACTION: {
1178 data.enforceInterface(IActivityManager.descriptor);
1179 String perm = data.readString();
1180 int pid = data.readInt();
1181 int uid = data.readInt();
1182 int res = checkPermission(perm, pid, uid);
1183 reply.writeNoException();
1184 reply.writeInt(res);
1185 return true;
1186 }
1187
1188 case CHECK_URI_PERMISSION_TRANSACTION: {
1189 data.enforceInterface(IActivityManager.descriptor);
1190 Uri uri = Uri.CREATOR.createFromParcel(data);
1191 int pid = data.readInt();
1192 int uid = data.readInt();
1193 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001194 int userId = data.readInt();
1195 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001196 reply.writeNoException();
1197 reply.writeInt(res);
1198 return true;
1199 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001200
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001201 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001202 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001203 String packageName = data.readString();
1204 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1205 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001206 int userId = data.readInt();
1207 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001208 reply.writeNoException();
1209 reply.writeInt(res ? 1 : 0);
1210 return true;
1211 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001212
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 case GRANT_URI_PERMISSION_TRANSACTION: {
1214 data.enforceInterface(IActivityManager.descriptor);
1215 IBinder b = data.readStrongBinder();
1216 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1217 String targetPkg = data.readString();
1218 Uri uri = Uri.CREATOR.createFromParcel(data);
1219 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001220 int userId = data.readInt();
1221 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001222 reply.writeNoException();
1223 return true;
1224 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001225
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001226 case REVOKE_URI_PERMISSION_TRANSACTION: {
1227 data.enforceInterface(IActivityManager.descriptor);
1228 IBinder b = data.readStrongBinder();
1229 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1230 Uri uri = Uri.CREATOR.createFromParcel(data);
1231 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001232 int userId = data.readInt();
1233 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001234 reply.writeNoException();
1235 return true;
1236 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001237
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001238 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1239 data.enforceInterface(IActivityManager.descriptor);
1240 Uri uri = Uri.CREATOR.createFromParcel(data);
1241 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001242 int userId = data.readInt();
1243 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001244 reply.writeNoException();
1245 return true;
1246 }
1247
1248 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 Uri uri = Uri.CREATOR.createFromParcel(data);
1251 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001252 int userId = data.readInt();
1253 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001254 reply.writeNoException();
1255 return true;
1256 }
1257
1258 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1259 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001260 final String packageName = data.readString();
1261 final boolean incoming = data.readInt() != 0;
1262 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1263 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001264 reply.writeNoException();
1265 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1266 return true;
1267 }
1268
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001269 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1270 data.enforceInterface(IActivityManager.descriptor);
1271 IBinder b = data.readStrongBinder();
1272 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1273 boolean waiting = data.readInt() != 0;
1274 showWaitingForDebugger(app, waiting);
1275 reply.writeNoException();
1276 return true;
1277 }
1278
1279 case GET_MEMORY_INFO_TRANSACTION: {
1280 data.enforceInterface(IActivityManager.descriptor);
1281 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1282 getMemoryInfo(mi);
1283 reply.writeNoException();
1284 mi.writeToParcel(reply, 0);
1285 return true;
1286 }
1287
1288 case UNHANDLED_BACK_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 unhandledBack();
1291 reply.writeNoException();
1292 return true;
1293 }
1294
1295 case OPEN_CONTENT_URI_TRANSACTION: {
1296 data.enforceInterface(IActivityManager.descriptor);
1297 Uri uri = Uri.parse(data.readString());
1298 ParcelFileDescriptor pfd = openContentUri(uri);
1299 reply.writeNoException();
1300 if (pfd != null) {
1301 reply.writeInt(1);
1302 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1303 } else {
1304 reply.writeInt(0);
1305 }
1306 return true;
1307 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001308
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001309 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1310 data.enforceInterface(IActivityManager.descriptor);
1311 setLockScreenShown(data.readInt() != 0);
1312 reply.writeNoException();
1313 return true;
1314 }
1315
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001316 case SET_DEBUG_APP_TRANSACTION: {
1317 data.enforceInterface(IActivityManager.descriptor);
1318 String pn = data.readString();
1319 boolean wfd = data.readInt() != 0;
1320 boolean per = data.readInt() != 0;
1321 setDebugApp(pn, wfd, per);
1322 reply.writeNoException();
1323 return true;
1324 }
1325
1326 case SET_ALWAYS_FINISH_TRANSACTION: {
1327 data.enforceInterface(IActivityManager.descriptor);
1328 boolean enabled = data.readInt() != 0;
1329 setAlwaysFinish(enabled);
1330 reply.writeNoException();
1331 return true;
1332 }
1333
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001334 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001335 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001336 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001337 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001338 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001339 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001340 return true;
1341 }
1342
1343 case ENTER_SAFE_MODE_TRANSACTION: {
1344 data.enforceInterface(IActivityManager.descriptor);
1345 enterSafeMode();
1346 reply.writeNoException();
1347 return true;
1348 }
1349
1350 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1351 data.enforceInterface(IActivityManager.descriptor);
1352 IIntentSender is = IIntentSender.Stub.asInterface(
1353 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001354 int sourceUid = data.readInt();
1355 String sourcePkg = data.readString();
1356 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001357 reply.writeNoException();
1358 return true;
1359 }
1360
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001361 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001362 data.enforceInterface(IActivityManager.descriptor);
1363 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001364 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001365 boolean secure = data.readInt() != 0;
1366 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001367 reply.writeNoException();
1368 reply.writeInt(res ? 1 : 0);
1369 return true;
1370 }
1371
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001372 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
1374 String reason = data.readString();
1375 boolean res = killProcessesBelowForeground(reason);
1376 reply.writeNoException();
1377 reply.writeInt(res ? 1 : 0);
1378 return true;
1379 }
1380
Dan Egnor60d87622009-12-16 16:32:58 -08001381 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1382 data.enforceInterface(IActivityManager.descriptor);
1383 IBinder app = data.readStrongBinder();
1384 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1385 handleApplicationCrash(app, ci);
1386 reply.writeNoException();
1387 return true;
1388 }
1389
1390 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001391 data.enforceInterface(IActivityManager.descriptor);
1392 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001393 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001394 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001395 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001396 boolean res = handleApplicationWtf(app, tag, system, 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 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07002831 public void activityPaused(IBinder token) 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);
2837 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2838 reply.readException();
2839 data.recycle();
2840 reply.recycle();
2841 }
2842 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002843 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002844 {
2845 Parcel data = Parcel.obtain();
2846 Parcel reply = Parcel.obtain();
2847 data.writeInterfaceToken(IActivityManager.descriptor);
2848 data.writeStrongBinder(token);
2849 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002850 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002851 TextUtils.writeToParcel(description, data, 0);
2852 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2853 reply.readException();
2854 data.recycle();
2855 reply.recycle();
2856 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002857 public void activitySlept(IBinder token) throws RemoteException
2858 {
2859 Parcel data = Parcel.obtain();
2860 Parcel reply = Parcel.obtain();
2861 data.writeInterfaceToken(IActivityManager.descriptor);
2862 data.writeStrongBinder(token);
2863 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2864 reply.readException();
2865 data.recycle();
2866 reply.recycle();
2867 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002868 public void activityDestroyed(IBinder token) throws RemoteException
2869 {
2870 Parcel data = Parcel.obtain();
2871 Parcel reply = Parcel.obtain();
2872 data.writeInterfaceToken(IActivityManager.descriptor);
2873 data.writeStrongBinder(token);
2874 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2875 reply.readException();
2876 data.recycle();
2877 reply.recycle();
2878 }
2879 public String getCallingPackage(IBinder token) throws RemoteException
2880 {
2881 Parcel data = Parcel.obtain();
2882 Parcel reply = Parcel.obtain();
2883 data.writeInterfaceToken(IActivityManager.descriptor);
2884 data.writeStrongBinder(token);
2885 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2886 reply.readException();
2887 String res = reply.readString();
2888 data.recycle();
2889 reply.recycle();
2890 return res;
2891 }
2892 public ComponentName getCallingActivity(IBinder token)
2893 throws RemoteException {
2894 Parcel data = Parcel.obtain();
2895 Parcel reply = Parcel.obtain();
2896 data.writeInterfaceToken(IActivityManager.descriptor);
2897 data.writeStrongBinder(token);
2898 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2899 reply.readException();
2900 ComponentName res = ComponentName.readFromParcel(reply);
2901 data.recycle();
2902 reply.recycle();
2903 return res;
2904 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002905 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07002906 Parcel data = Parcel.obtain();
2907 Parcel reply = Parcel.obtain();
2908 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002909 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07002910 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2911 reply.readException();
2912 ArrayList<IAppTask> list = null;
2913 int N = reply.readInt();
2914 if (N >= 0) {
2915 list = new ArrayList<IAppTask>();
2916 while (N > 0) {
2917 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2918 list.add(task);
2919 N--;
2920 }
2921 }
2922 data.recycle();
2923 reply.recycle();
2924 return list;
2925 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07002926 public int addAppTask(IBinder activityToken, Intent intent,
2927 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
2928 Parcel data = Parcel.obtain();
2929 Parcel reply = Parcel.obtain();
2930 data.writeInterfaceToken(IActivityManager.descriptor);
2931 data.writeStrongBinder(activityToken);
2932 intent.writeToParcel(data, 0);
2933 description.writeToParcel(data, 0);
2934 thumbnail.writeToParcel(data, 0);
2935 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
2936 reply.readException();
2937 int res = reply.readInt();
2938 data.recycle();
2939 reply.recycle();
2940 return res;
2941 }
2942 public Point getAppTaskThumbnailSize() throws RemoteException {
2943 Parcel data = Parcel.obtain();
2944 Parcel reply = Parcel.obtain();
2945 data.writeInterfaceToken(IActivityManager.descriptor);
2946 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
2947 reply.readException();
2948 Point size = Point.CREATOR.createFromParcel(reply);
2949 data.recycle();
2950 reply.recycle();
2951 return size;
2952 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002953 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002954 Parcel data = Parcel.obtain();
2955 Parcel reply = Parcel.obtain();
2956 data.writeInterfaceToken(IActivityManager.descriptor);
2957 data.writeInt(maxNum);
2958 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002959 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2960 reply.readException();
2961 ArrayList list = null;
2962 int N = reply.readInt();
2963 if (N >= 0) {
2964 list = new ArrayList();
2965 while (N > 0) {
2966 ActivityManager.RunningTaskInfo info =
2967 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002968 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002969 list.add(info);
2970 N--;
2971 }
2972 }
2973 data.recycle();
2974 reply.recycle();
2975 return list;
2976 }
2977 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002978 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002979 Parcel data = Parcel.obtain();
2980 Parcel reply = Parcel.obtain();
2981 data.writeInterfaceToken(IActivityManager.descriptor);
2982 data.writeInt(maxNum);
2983 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002984 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002985 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2986 reply.readException();
2987 ArrayList<ActivityManager.RecentTaskInfo> list
2988 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2989 data.recycle();
2990 reply.recycle();
2991 return list;
2992 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002993 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002994 Parcel data = Parcel.obtain();
2995 Parcel reply = Parcel.obtain();
2996 data.writeInterfaceToken(IActivityManager.descriptor);
2997 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002998 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002999 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003000 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003001 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003002 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003003 }
3004 data.recycle();
3005 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003006 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003007 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003008 public List getServices(int maxNum, int flags) throws RemoteException {
3009 Parcel data = Parcel.obtain();
3010 Parcel reply = Parcel.obtain();
3011 data.writeInterfaceToken(IActivityManager.descriptor);
3012 data.writeInt(maxNum);
3013 data.writeInt(flags);
3014 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3015 reply.readException();
3016 ArrayList list = null;
3017 int N = reply.readInt();
3018 if (N >= 0) {
3019 list = new ArrayList();
3020 while (N > 0) {
3021 ActivityManager.RunningServiceInfo info =
3022 ActivityManager.RunningServiceInfo.CREATOR
3023 .createFromParcel(reply);
3024 list.add(info);
3025 N--;
3026 }
3027 }
3028 data.recycle();
3029 reply.recycle();
3030 return list;
3031 }
3032 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3033 throws RemoteException {
3034 Parcel data = Parcel.obtain();
3035 Parcel reply = Parcel.obtain();
3036 data.writeInterfaceToken(IActivityManager.descriptor);
3037 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3038 reply.readException();
3039 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3040 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3041 data.recycle();
3042 reply.recycle();
3043 return list;
3044 }
3045 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3046 throws RemoteException {
3047 Parcel data = Parcel.obtain();
3048 Parcel reply = Parcel.obtain();
3049 data.writeInterfaceToken(IActivityManager.descriptor);
3050 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3051 reply.readException();
3052 ArrayList<ActivityManager.RunningAppProcessInfo> list
3053 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3054 data.recycle();
3055 reply.recycle();
3056 return list;
3057 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003058 public List<ApplicationInfo> getRunningExternalApplications()
3059 throws RemoteException {
3060 Parcel data = Parcel.obtain();
3061 Parcel reply = Parcel.obtain();
3062 data.writeInterfaceToken(IActivityManager.descriptor);
3063 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3064 reply.readException();
3065 ArrayList<ApplicationInfo> list
3066 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3067 data.recycle();
3068 reply.recycle();
3069 return list;
3070 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003071 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003072 {
3073 Parcel data = Parcel.obtain();
3074 Parcel reply = Parcel.obtain();
3075 data.writeInterfaceToken(IActivityManager.descriptor);
3076 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003077 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003078 if (options != null) {
3079 data.writeInt(1);
3080 options.writeToParcel(data, 0);
3081 } else {
3082 data.writeInt(0);
3083 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003084 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3085 reply.readException();
3086 data.recycle();
3087 reply.recycle();
3088 }
3089 public void moveTaskToBack(int task) throws RemoteException
3090 {
3091 Parcel data = Parcel.obtain();
3092 Parcel reply = Parcel.obtain();
3093 data.writeInterfaceToken(IActivityManager.descriptor);
3094 data.writeInt(task);
3095 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3096 reply.readException();
3097 data.recycle();
3098 reply.recycle();
3099 }
3100 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3101 throws RemoteException {
3102 Parcel data = Parcel.obtain();
3103 Parcel reply = Parcel.obtain();
3104 data.writeInterfaceToken(IActivityManager.descriptor);
3105 data.writeStrongBinder(token);
3106 data.writeInt(nonRoot ? 1 : 0);
3107 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3108 reply.readException();
3109 boolean res = reply.readInt() != 0;
3110 data.recycle();
3111 reply.recycle();
3112 return res;
3113 }
3114 public void moveTaskBackwards(int task) throws RemoteException
3115 {
3116 Parcel data = Parcel.obtain();
3117 Parcel reply = Parcel.obtain();
3118 data.writeInterfaceToken(IActivityManager.descriptor);
3119 data.writeInt(task);
3120 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3121 reply.readException();
3122 data.recycle();
3123 reply.recycle();
3124 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003125 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003126 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3127 {
3128 Parcel data = Parcel.obtain();
3129 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003130 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003131 data.writeInt(taskId);
3132 data.writeInt(stackId);
3133 data.writeInt(toTop ? 1 : 0);
3134 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3135 reply.readException();
3136 data.recycle();
3137 reply.recycle();
3138 }
3139 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003140 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003141 {
3142 Parcel data = Parcel.obtain();
3143 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003144 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003145 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003146 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003147 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003148 reply.readException();
3149 data.recycle();
3150 reply.recycle();
3151 }
Craig Mautner967212c2013-04-13 21:10:58 -07003152 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003153 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003154 {
3155 Parcel data = Parcel.obtain();
3156 Parcel reply = Parcel.obtain();
3157 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003158 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003159 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003160 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003161 data.recycle();
3162 reply.recycle();
3163 return list;
3164 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003165 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003166 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003167 {
3168 Parcel data = Parcel.obtain();
3169 Parcel reply = Parcel.obtain();
3170 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003171 data.writeInt(stackId);
3172 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003173 reply.readException();
3174 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003175 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003176 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003177 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003178 }
3179 data.recycle();
3180 reply.recycle();
3181 return info;
3182 }
3183 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003184 public boolean isInHomeStack(int taskId) throws RemoteException {
3185 Parcel data = Parcel.obtain();
3186 Parcel reply = Parcel.obtain();
3187 data.writeInterfaceToken(IActivityManager.descriptor);
3188 data.writeInt(taskId);
3189 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3190 reply.readException();
3191 boolean isInHomeStack = reply.readInt() > 0;
3192 data.recycle();
3193 reply.recycle();
3194 return isInHomeStack;
3195 }
3196 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003197 public void setFocusedStack(int stackId) throws RemoteException
3198 {
3199 Parcel data = Parcel.obtain();
3200 Parcel reply = Parcel.obtain();
3201 data.writeInterfaceToken(IActivityManager.descriptor);
3202 data.writeInt(stackId);
3203 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3204 reply.readException();
3205 data.recycle();
3206 reply.recycle();
3207 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003208 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3209 {
3210 Parcel data = Parcel.obtain();
3211 Parcel reply = Parcel.obtain();
3212 data.writeInterfaceToken(IActivityManager.descriptor);
3213 data.writeStrongBinder(token);
3214 data.writeInt(onlyRoot ? 1 : 0);
3215 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3216 reply.readException();
3217 int res = reply.readInt();
3218 data.recycle();
3219 reply.recycle();
3220 return res;
3221 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003222 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003223 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003224 Parcel data = Parcel.obtain();
3225 Parcel reply = Parcel.obtain();
3226 data.writeInterfaceToken(IActivityManager.descriptor);
3227 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3228 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003229 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003230 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003231 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3232 reply.readException();
3233 int res = reply.readInt();
3234 ContentProviderHolder cph = null;
3235 if (res != 0) {
3236 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3237 }
3238 data.recycle();
3239 reply.recycle();
3240 return cph;
3241 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003242 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3243 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003244 Parcel data = Parcel.obtain();
3245 Parcel reply = Parcel.obtain();
3246 data.writeInterfaceToken(IActivityManager.descriptor);
3247 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003248 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003249 data.writeStrongBinder(token);
3250 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3251 reply.readException();
3252 int res = reply.readInt();
3253 ContentProviderHolder cph = null;
3254 if (res != 0) {
3255 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3256 }
3257 data.recycle();
3258 reply.recycle();
3259 return cph;
3260 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003261 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003262 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003263 {
3264 Parcel data = Parcel.obtain();
3265 Parcel reply = Parcel.obtain();
3266 data.writeInterfaceToken(IActivityManager.descriptor);
3267 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3268 data.writeTypedList(providers);
3269 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3270 reply.readException();
3271 data.recycle();
3272 reply.recycle();
3273 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003274 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3275 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003276 Parcel data = Parcel.obtain();
3277 Parcel reply = Parcel.obtain();
3278 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003279 data.writeStrongBinder(connection);
3280 data.writeInt(stable);
3281 data.writeInt(unstable);
3282 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3283 reply.readException();
3284 boolean res = reply.readInt() != 0;
3285 data.recycle();
3286 reply.recycle();
3287 return res;
3288 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003289
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003290 public void unstableProviderDied(IBinder connection) throws RemoteException {
3291 Parcel data = Parcel.obtain();
3292 Parcel reply = Parcel.obtain();
3293 data.writeInterfaceToken(IActivityManager.descriptor);
3294 data.writeStrongBinder(connection);
3295 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3296 reply.readException();
3297 data.recycle();
3298 reply.recycle();
3299 }
3300
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003301 @Override
3302 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3303 Parcel data = Parcel.obtain();
3304 Parcel reply = Parcel.obtain();
3305 data.writeInterfaceToken(IActivityManager.descriptor);
3306 data.writeStrongBinder(connection);
3307 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3308 reply.readException();
3309 data.recycle();
3310 reply.recycle();
3311 }
3312
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003313 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3314 Parcel data = Parcel.obtain();
3315 Parcel reply = Parcel.obtain();
3316 data.writeInterfaceToken(IActivityManager.descriptor);
3317 data.writeStrongBinder(connection);
3318 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003319 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3320 reply.readException();
3321 data.recycle();
3322 reply.recycle();
3323 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003324
3325 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3326 Parcel data = Parcel.obtain();
3327 Parcel reply = Parcel.obtain();
3328 data.writeInterfaceToken(IActivityManager.descriptor);
3329 data.writeString(name);
3330 data.writeStrongBinder(token);
3331 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3332 reply.readException();
3333 data.recycle();
3334 reply.recycle();
3335 }
3336
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003337 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3338 throws RemoteException
3339 {
3340 Parcel data = Parcel.obtain();
3341 Parcel reply = Parcel.obtain();
3342 data.writeInterfaceToken(IActivityManager.descriptor);
3343 service.writeToParcel(data, 0);
3344 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3345 reply.readException();
3346 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3347 data.recycle();
3348 reply.recycle();
3349 return res;
3350 }
3351
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003352 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003353 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003354 {
3355 Parcel data = Parcel.obtain();
3356 Parcel reply = Parcel.obtain();
3357 data.writeInterfaceToken(IActivityManager.descriptor);
3358 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3359 service.writeToParcel(data, 0);
3360 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003361 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003362 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3363 reply.readException();
3364 ComponentName res = ComponentName.readFromParcel(reply);
3365 data.recycle();
3366 reply.recycle();
3367 return res;
3368 }
3369 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003370 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003371 {
3372 Parcel data = Parcel.obtain();
3373 Parcel reply = Parcel.obtain();
3374 data.writeInterfaceToken(IActivityManager.descriptor);
3375 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3376 service.writeToParcel(data, 0);
3377 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003378 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003379 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3380 reply.readException();
3381 int res = reply.readInt();
3382 reply.recycle();
3383 data.recycle();
3384 return res;
3385 }
3386 public boolean stopServiceToken(ComponentName className, IBinder token,
3387 int startId) throws RemoteException {
3388 Parcel data = Parcel.obtain();
3389 Parcel reply = Parcel.obtain();
3390 data.writeInterfaceToken(IActivityManager.descriptor);
3391 ComponentName.writeToParcel(className, data);
3392 data.writeStrongBinder(token);
3393 data.writeInt(startId);
3394 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3395 reply.readException();
3396 boolean res = reply.readInt() != 0;
3397 data.recycle();
3398 reply.recycle();
3399 return res;
3400 }
3401 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003402 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003403 Parcel data = Parcel.obtain();
3404 Parcel reply = Parcel.obtain();
3405 data.writeInterfaceToken(IActivityManager.descriptor);
3406 ComponentName.writeToParcel(className, data);
3407 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003408 data.writeInt(id);
3409 if (notification != null) {
3410 data.writeInt(1);
3411 notification.writeToParcel(data, 0);
3412 } else {
3413 data.writeInt(0);
3414 }
3415 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003416 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3417 reply.readException();
3418 data.recycle();
3419 reply.recycle();
3420 }
3421 public int bindService(IApplicationThread caller, IBinder token,
3422 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003423 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003424 Parcel data = Parcel.obtain();
3425 Parcel reply = Parcel.obtain();
3426 data.writeInterfaceToken(IActivityManager.descriptor);
3427 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3428 data.writeStrongBinder(token);
3429 service.writeToParcel(data, 0);
3430 data.writeString(resolvedType);
3431 data.writeStrongBinder(connection.asBinder());
3432 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003433 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003434 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3435 reply.readException();
3436 int res = reply.readInt();
3437 data.recycle();
3438 reply.recycle();
3439 return res;
3440 }
3441 public boolean unbindService(IServiceConnection connection) throws RemoteException
3442 {
3443 Parcel data = Parcel.obtain();
3444 Parcel reply = Parcel.obtain();
3445 data.writeInterfaceToken(IActivityManager.descriptor);
3446 data.writeStrongBinder(connection.asBinder());
3447 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3448 reply.readException();
3449 boolean res = reply.readInt() != 0;
3450 data.recycle();
3451 reply.recycle();
3452 return res;
3453 }
3454
3455 public void publishService(IBinder token,
3456 Intent intent, IBinder service) throws RemoteException {
3457 Parcel data = Parcel.obtain();
3458 Parcel reply = Parcel.obtain();
3459 data.writeInterfaceToken(IActivityManager.descriptor);
3460 data.writeStrongBinder(token);
3461 intent.writeToParcel(data, 0);
3462 data.writeStrongBinder(service);
3463 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3464 reply.readException();
3465 data.recycle();
3466 reply.recycle();
3467 }
3468
3469 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3470 throws RemoteException {
3471 Parcel data = Parcel.obtain();
3472 Parcel reply = Parcel.obtain();
3473 data.writeInterfaceToken(IActivityManager.descriptor);
3474 data.writeStrongBinder(token);
3475 intent.writeToParcel(data, 0);
3476 data.writeInt(doRebind ? 1 : 0);
3477 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3478 reply.readException();
3479 data.recycle();
3480 reply.recycle();
3481 }
3482
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003483 public void serviceDoneExecuting(IBinder token, int type, int startId,
3484 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003485 Parcel data = Parcel.obtain();
3486 Parcel reply = Parcel.obtain();
3487 data.writeInterfaceToken(IActivityManager.descriptor);
3488 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003489 data.writeInt(type);
3490 data.writeInt(startId);
3491 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003492 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3493 reply.readException();
3494 data.recycle();
3495 reply.recycle();
3496 }
3497
3498 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3499 Parcel data = Parcel.obtain();
3500 Parcel reply = Parcel.obtain();
3501 data.writeInterfaceToken(IActivityManager.descriptor);
3502 service.writeToParcel(data, 0);
3503 data.writeString(resolvedType);
3504 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3505 reply.readException();
3506 IBinder binder = reply.readStrongBinder();
3507 reply.recycle();
3508 data.recycle();
3509 return binder;
3510 }
3511
Christopher Tate181fafa2009-05-14 11:12:14 -07003512 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3513 throws RemoteException {
3514 Parcel data = Parcel.obtain();
3515 Parcel reply = Parcel.obtain();
3516 data.writeInterfaceToken(IActivityManager.descriptor);
3517 app.writeToParcel(data, 0);
3518 data.writeInt(backupRestoreMode);
3519 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3520 reply.readException();
3521 boolean success = reply.readInt() != 0;
3522 reply.recycle();
3523 data.recycle();
3524 return success;
3525 }
3526
Christopher Tate346acb12012-10-15 19:20:25 -07003527 public void clearPendingBackup() throws RemoteException {
3528 Parcel data = Parcel.obtain();
3529 Parcel reply = Parcel.obtain();
3530 data.writeInterfaceToken(IActivityManager.descriptor);
3531 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3532 reply.recycle();
3533 data.recycle();
3534 }
3535
Christopher Tate181fafa2009-05-14 11:12:14 -07003536 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3537 Parcel data = Parcel.obtain();
3538 Parcel reply = Parcel.obtain();
3539 data.writeInterfaceToken(IActivityManager.descriptor);
3540 data.writeString(packageName);
3541 data.writeStrongBinder(agent);
3542 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3543 reply.recycle();
3544 data.recycle();
3545 }
3546
3547 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3548 Parcel data = Parcel.obtain();
3549 Parcel reply = Parcel.obtain();
3550 data.writeInterfaceToken(IActivityManager.descriptor);
3551 app.writeToParcel(data, 0);
3552 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3553 reply.readException();
3554 reply.recycle();
3555 data.recycle();
3556 }
3557
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003558 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003559 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003560 IUiAutomationConnection connection, int userId, String instructionSet)
3561 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003562 Parcel data = Parcel.obtain();
3563 Parcel reply = Parcel.obtain();
3564 data.writeInterfaceToken(IActivityManager.descriptor);
3565 ComponentName.writeToParcel(className, data);
3566 data.writeString(profileFile);
3567 data.writeInt(flags);
3568 data.writeBundle(arguments);
3569 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003570 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003571 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003572 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003573 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3574 reply.readException();
3575 boolean res = reply.readInt() != 0;
3576 reply.recycle();
3577 data.recycle();
3578 return res;
3579 }
3580
3581 public void finishInstrumentation(IApplicationThread target,
3582 int resultCode, Bundle results) throws RemoteException {
3583 Parcel data = Parcel.obtain();
3584 Parcel reply = Parcel.obtain();
3585 data.writeInterfaceToken(IActivityManager.descriptor);
3586 data.writeStrongBinder(target != null ? target.asBinder() : null);
3587 data.writeInt(resultCode);
3588 data.writeBundle(results);
3589 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3590 reply.readException();
3591 data.recycle();
3592 reply.recycle();
3593 }
3594 public Configuration getConfiguration() throws RemoteException
3595 {
3596 Parcel data = Parcel.obtain();
3597 Parcel reply = Parcel.obtain();
3598 data.writeInterfaceToken(IActivityManager.descriptor);
3599 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3600 reply.readException();
3601 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3602 reply.recycle();
3603 data.recycle();
3604 return res;
3605 }
3606 public void updateConfiguration(Configuration values) throws RemoteException
3607 {
3608 Parcel data = Parcel.obtain();
3609 Parcel reply = Parcel.obtain();
3610 data.writeInterfaceToken(IActivityManager.descriptor);
3611 values.writeToParcel(data, 0);
3612 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3613 reply.readException();
3614 data.recycle();
3615 reply.recycle();
3616 }
3617 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3618 throws RemoteException {
3619 Parcel data = Parcel.obtain();
3620 Parcel reply = Parcel.obtain();
3621 data.writeInterfaceToken(IActivityManager.descriptor);
3622 data.writeStrongBinder(token);
3623 data.writeInt(requestedOrientation);
3624 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3625 reply.readException();
3626 data.recycle();
3627 reply.recycle();
3628 }
3629 public int getRequestedOrientation(IBinder token) throws RemoteException {
3630 Parcel data = Parcel.obtain();
3631 Parcel reply = Parcel.obtain();
3632 data.writeInterfaceToken(IActivityManager.descriptor);
3633 data.writeStrongBinder(token);
3634 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3635 reply.readException();
3636 int res = reply.readInt();
3637 data.recycle();
3638 reply.recycle();
3639 return res;
3640 }
3641 public ComponentName getActivityClassForToken(IBinder token)
3642 throws RemoteException {
3643 Parcel data = Parcel.obtain();
3644 Parcel reply = Parcel.obtain();
3645 data.writeInterfaceToken(IActivityManager.descriptor);
3646 data.writeStrongBinder(token);
3647 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3648 reply.readException();
3649 ComponentName res = ComponentName.readFromParcel(reply);
3650 data.recycle();
3651 reply.recycle();
3652 return res;
3653 }
3654 public String getPackageForToken(IBinder token) throws RemoteException
3655 {
3656 Parcel data = Parcel.obtain();
3657 Parcel reply = Parcel.obtain();
3658 data.writeInterfaceToken(IActivityManager.descriptor);
3659 data.writeStrongBinder(token);
3660 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3661 reply.readException();
3662 String res = reply.readString();
3663 data.recycle();
3664 reply.recycle();
3665 return res;
3666 }
3667 public IIntentSender getIntentSender(int type,
3668 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003669 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003670 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003671 Parcel data = Parcel.obtain();
3672 Parcel reply = Parcel.obtain();
3673 data.writeInterfaceToken(IActivityManager.descriptor);
3674 data.writeInt(type);
3675 data.writeString(packageName);
3676 data.writeStrongBinder(token);
3677 data.writeString(resultWho);
3678 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003679 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003680 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003681 data.writeTypedArray(intents, 0);
3682 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003683 } else {
3684 data.writeInt(0);
3685 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003686 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003687 if (options != null) {
3688 data.writeInt(1);
3689 options.writeToParcel(data, 0);
3690 } else {
3691 data.writeInt(0);
3692 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003693 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003694 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3695 reply.readException();
3696 IIntentSender res = IIntentSender.Stub.asInterface(
3697 reply.readStrongBinder());
3698 data.recycle();
3699 reply.recycle();
3700 return res;
3701 }
3702 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3703 Parcel data = Parcel.obtain();
3704 Parcel reply = Parcel.obtain();
3705 data.writeInterfaceToken(IActivityManager.descriptor);
3706 data.writeStrongBinder(sender.asBinder());
3707 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3708 reply.readException();
3709 data.recycle();
3710 reply.recycle();
3711 }
3712 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3713 Parcel data = Parcel.obtain();
3714 Parcel reply = Parcel.obtain();
3715 data.writeInterfaceToken(IActivityManager.descriptor);
3716 data.writeStrongBinder(sender.asBinder());
3717 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3718 reply.readException();
3719 String res = reply.readString();
3720 data.recycle();
3721 reply.recycle();
3722 return res;
3723 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003724 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3725 Parcel data = Parcel.obtain();
3726 Parcel reply = Parcel.obtain();
3727 data.writeInterfaceToken(IActivityManager.descriptor);
3728 data.writeStrongBinder(sender.asBinder());
3729 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3730 reply.readException();
3731 int res = reply.readInt();
3732 data.recycle();
3733 reply.recycle();
3734 return res;
3735 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003736 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3737 boolean requireFull, String name, String callerPackage) throws RemoteException {
3738 Parcel data = Parcel.obtain();
3739 Parcel reply = Parcel.obtain();
3740 data.writeInterfaceToken(IActivityManager.descriptor);
3741 data.writeInt(callingPid);
3742 data.writeInt(callingUid);
3743 data.writeInt(userId);
3744 data.writeInt(allowAll ? 1 : 0);
3745 data.writeInt(requireFull ? 1 : 0);
3746 data.writeString(name);
3747 data.writeString(callerPackage);
3748 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3749 reply.readException();
3750 int res = reply.readInt();
3751 data.recycle();
3752 reply.recycle();
3753 return res;
3754 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003755 public void setProcessLimit(int max) throws RemoteException
3756 {
3757 Parcel data = Parcel.obtain();
3758 Parcel reply = Parcel.obtain();
3759 data.writeInterfaceToken(IActivityManager.descriptor);
3760 data.writeInt(max);
3761 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3762 reply.readException();
3763 data.recycle();
3764 reply.recycle();
3765 }
3766 public int getProcessLimit() throws RemoteException
3767 {
3768 Parcel data = Parcel.obtain();
3769 Parcel reply = Parcel.obtain();
3770 data.writeInterfaceToken(IActivityManager.descriptor);
3771 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3772 reply.readException();
3773 int res = reply.readInt();
3774 data.recycle();
3775 reply.recycle();
3776 return res;
3777 }
3778 public void setProcessForeground(IBinder token, int pid,
3779 boolean isForeground) throws RemoteException {
3780 Parcel data = Parcel.obtain();
3781 Parcel reply = Parcel.obtain();
3782 data.writeInterfaceToken(IActivityManager.descriptor);
3783 data.writeStrongBinder(token);
3784 data.writeInt(pid);
3785 data.writeInt(isForeground ? 1 : 0);
3786 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3787 reply.readException();
3788 data.recycle();
3789 reply.recycle();
3790 }
3791 public int checkPermission(String permission, int pid, int uid)
3792 throws RemoteException {
3793 Parcel data = Parcel.obtain();
3794 Parcel reply = Parcel.obtain();
3795 data.writeInterfaceToken(IActivityManager.descriptor);
3796 data.writeString(permission);
3797 data.writeInt(pid);
3798 data.writeInt(uid);
3799 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3800 reply.readException();
3801 int res = reply.readInt();
3802 data.recycle();
3803 reply.recycle();
3804 return res;
3805 }
3806 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003807 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003808 Parcel data = Parcel.obtain();
3809 Parcel reply = Parcel.obtain();
3810 data.writeInterfaceToken(IActivityManager.descriptor);
3811 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003812 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003813 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003814 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3815 reply.readException();
3816 boolean res = reply.readInt() != 0;
3817 data.recycle();
3818 reply.recycle();
3819 return res;
3820 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003821 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003822 throws RemoteException {
3823 Parcel data = Parcel.obtain();
3824 Parcel reply = Parcel.obtain();
3825 data.writeInterfaceToken(IActivityManager.descriptor);
3826 uri.writeToParcel(data, 0);
3827 data.writeInt(pid);
3828 data.writeInt(uid);
3829 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003830 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003831 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3832 reply.readException();
3833 int res = reply.readInt();
3834 data.recycle();
3835 reply.recycle();
3836 return res;
3837 }
3838 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003839 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003840 Parcel data = Parcel.obtain();
3841 Parcel reply = Parcel.obtain();
3842 data.writeInterfaceToken(IActivityManager.descriptor);
3843 data.writeStrongBinder(caller.asBinder());
3844 data.writeString(targetPkg);
3845 uri.writeToParcel(data, 0);
3846 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003847 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003848 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3849 reply.readException();
3850 data.recycle();
3851 reply.recycle();
3852 }
3853 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003854 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003855 Parcel data = Parcel.obtain();
3856 Parcel reply = Parcel.obtain();
3857 data.writeInterfaceToken(IActivityManager.descriptor);
3858 data.writeStrongBinder(caller.asBinder());
3859 uri.writeToParcel(data, 0);
3860 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003861 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003862 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3863 reply.readException();
3864 data.recycle();
3865 reply.recycle();
3866 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003867
3868 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003869 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3870 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003871 Parcel data = Parcel.obtain();
3872 Parcel reply = Parcel.obtain();
3873 data.writeInterfaceToken(IActivityManager.descriptor);
3874 uri.writeToParcel(data, 0);
3875 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003876 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003877 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3878 reply.readException();
3879 data.recycle();
3880 reply.recycle();
3881 }
3882
3883 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003884 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3885 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003886 Parcel data = Parcel.obtain();
3887 Parcel reply = Parcel.obtain();
3888 data.writeInterfaceToken(IActivityManager.descriptor);
3889 uri.writeToParcel(data, 0);
3890 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003891 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003892 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3893 reply.readException();
3894 data.recycle();
3895 reply.recycle();
3896 }
3897
3898 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003899 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3900 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003901 Parcel data = Parcel.obtain();
3902 Parcel reply = Parcel.obtain();
3903 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003904 data.writeString(packageName);
3905 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003906 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3907 reply.readException();
3908 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3909 reply);
3910 data.recycle();
3911 reply.recycle();
3912 return perms;
3913 }
3914
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003915 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3916 throws RemoteException {
3917 Parcel data = Parcel.obtain();
3918 Parcel reply = Parcel.obtain();
3919 data.writeInterfaceToken(IActivityManager.descriptor);
3920 data.writeStrongBinder(who.asBinder());
3921 data.writeInt(waiting ? 1 : 0);
3922 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3923 reply.readException();
3924 data.recycle();
3925 reply.recycle();
3926 }
3927 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3928 Parcel data = Parcel.obtain();
3929 Parcel reply = Parcel.obtain();
3930 data.writeInterfaceToken(IActivityManager.descriptor);
3931 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3932 reply.readException();
3933 outInfo.readFromParcel(reply);
3934 data.recycle();
3935 reply.recycle();
3936 }
3937 public void unhandledBack() throws RemoteException
3938 {
3939 Parcel data = Parcel.obtain();
3940 Parcel reply = Parcel.obtain();
3941 data.writeInterfaceToken(IActivityManager.descriptor);
3942 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3943 reply.readException();
3944 data.recycle();
3945 reply.recycle();
3946 }
3947 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3948 {
3949 Parcel data = Parcel.obtain();
3950 Parcel reply = Parcel.obtain();
3951 data.writeInterfaceToken(IActivityManager.descriptor);
3952 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3953 reply.readException();
3954 ParcelFileDescriptor pfd = null;
3955 if (reply.readInt() != 0) {
3956 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3957 }
3958 data.recycle();
3959 reply.recycle();
3960 return pfd;
3961 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003962 public void setLockScreenShown(boolean shown) throws RemoteException
3963 {
3964 Parcel data = Parcel.obtain();
3965 Parcel reply = Parcel.obtain();
3966 data.writeInterfaceToken(IActivityManager.descriptor);
3967 data.writeInt(shown ? 1 : 0);
3968 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3969 reply.readException();
3970 data.recycle();
3971 reply.recycle();
3972 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003973 public void setDebugApp(
3974 String packageName, boolean waitForDebugger, boolean persistent)
3975 throws RemoteException
3976 {
3977 Parcel data = Parcel.obtain();
3978 Parcel reply = Parcel.obtain();
3979 data.writeInterfaceToken(IActivityManager.descriptor);
3980 data.writeString(packageName);
3981 data.writeInt(waitForDebugger ? 1 : 0);
3982 data.writeInt(persistent ? 1 : 0);
3983 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3984 reply.readException();
3985 data.recycle();
3986 reply.recycle();
3987 }
3988 public void setAlwaysFinish(boolean enabled) throws RemoteException
3989 {
3990 Parcel data = Parcel.obtain();
3991 Parcel reply = Parcel.obtain();
3992 data.writeInterfaceToken(IActivityManager.descriptor);
3993 data.writeInt(enabled ? 1 : 0);
3994 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3995 reply.readException();
3996 data.recycle();
3997 reply.recycle();
3998 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003999 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004000 {
4001 Parcel data = Parcel.obtain();
4002 Parcel reply = Parcel.obtain();
4003 data.writeInterfaceToken(IActivityManager.descriptor);
4004 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004005 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004006 reply.readException();
4007 data.recycle();
4008 reply.recycle();
4009 }
4010 public void enterSafeMode() throws RemoteException {
4011 Parcel data = Parcel.obtain();
4012 data.writeInterfaceToken(IActivityManager.descriptor);
4013 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4014 data.recycle();
4015 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08004016 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
4017 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004018 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004019 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004020 data.writeStrongBinder(sender.asBinder());
4021 data.writeInt(sourceUid);
4022 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004023 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4024 data.recycle();
4025 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004026 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004027 Parcel data = Parcel.obtain();
4028 Parcel reply = Parcel.obtain();
4029 data.writeInterfaceToken(IActivityManager.descriptor);
4030 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004031 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004032 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004033 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004034 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004035 boolean res = reply.readInt() != 0;
4036 data.recycle();
4037 reply.recycle();
4038 return res;
4039 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004040 @Override
4041 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4042 Parcel data = Parcel.obtain();
4043 Parcel reply = Parcel.obtain();
4044 data.writeInterfaceToken(IActivityManager.descriptor);
4045 data.writeString(reason);
4046 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4047 boolean res = reply.readInt() != 0;
4048 data.recycle();
4049 reply.recycle();
4050 return res;
4051 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004052 public boolean testIsSystemReady()
4053 {
4054 /* this base class version is never called */
4055 return true;
4056 }
Dan Egnor60d87622009-12-16 16:32:58 -08004057 public void handleApplicationCrash(IBinder app,
4058 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4059 {
4060 Parcel data = Parcel.obtain();
4061 Parcel reply = Parcel.obtain();
4062 data.writeInterfaceToken(IActivityManager.descriptor);
4063 data.writeStrongBinder(app);
4064 crashInfo.writeToParcel(data, 0);
4065 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4066 reply.readException();
4067 reply.recycle();
4068 data.recycle();
4069 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004070
Dianne Hackborn52322712014-08-26 22:47:26 -07004071 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004072 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004073 {
4074 Parcel data = Parcel.obtain();
4075 Parcel reply = Parcel.obtain();
4076 data.writeInterfaceToken(IActivityManager.descriptor);
4077 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004078 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004079 data.writeInt(system ? 1 : 0);
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}