blob: 6c67c0996817c730cd19a30a825867ca0cc974f3 [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(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07001932 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001933 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 Hackbornfdf5b352014-10-08 17:43:48 -07002105 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2106 data.enforceInterface(IActivityManager.descriptor);
2107 Intent intent = Intent.CREATOR.createFromParcel(data);
2108 int requestType = data.readInt();
2109 String hint = data.readString();
2110 int userHandle = data.readInt();
2111 boolean res = launchAssistIntent(intent, requestType, hint, userHandle);
2112 reply.writeNoException();
2113 reply.writeInt(res ? 1 : 0);
2114 return true;
2115 }
2116
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002117 case KILL_UID_TRANSACTION: {
2118 data.enforceInterface(IActivityManager.descriptor);
2119 int uid = data.readInt();
2120 String reason = data.readString();
2121 killUid(uid, reason);
2122 reply.writeNoException();
2123 return true;
2124 }
2125
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002126 case HANG_TRANSACTION: {
2127 data.enforceInterface(IActivityManager.descriptor);
2128 IBinder who = data.readStrongBinder();
2129 boolean allowRestart = data.readInt() != 0;
2130 hang(who, allowRestart);
2131 reply.writeNoException();
2132 return true;
2133 }
2134
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002135 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2136 data.enforceInterface(IActivityManager.descriptor);
2137 IBinder token = data.readStrongBinder();
2138 reportActivityFullyDrawn(token);
2139 reply.writeNoException();
2140 return true;
2141 }
2142
Craig Mautner5eda9b32013-07-02 11:58:16 -07002143 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2144 data.enforceInterface(IActivityManager.descriptor);
2145 IBinder token = data.readStrongBinder();
2146 notifyActivityDrawn(token);
2147 reply.writeNoException();
2148 return true;
2149 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002150
2151 case RESTART_TRANSACTION: {
2152 data.enforceInterface(IActivityManager.descriptor);
2153 restart();
2154 reply.writeNoException();
2155 return true;
2156 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002157
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002158 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2159 data.enforceInterface(IActivityManager.descriptor);
2160 performIdleMaintenance();
2161 reply.writeNoException();
2162 return true;
2163 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002164
2165 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2166 data.enforceInterface(IActivityManager.descriptor);
2167 IBinder parentActivityToken = data.readStrongBinder();
2168 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002169 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002170 IActivityContainer activityContainer =
2171 createActivityContainer(parentActivityToken, callback);
2172 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002173 if (activityContainer != null) {
2174 reply.writeInt(1);
2175 reply.writeStrongBinder(activityContainer.asBinder());
2176 } else {
2177 reply.writeInt(0);
2178 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002179 return true;
2180 }
2181
Craig Mautner95da1082014-02-24 17:54:35 -08002182 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2183 data.enforceInterface(IActivityManager.descriptor);
2184 IActivityContainer activityContainer =
2185 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2186 deleteActivityContainer(activityContainer);
2187 reply.writeNoException();
2188 return true;
2189 }
2190
Craig Mautnere0a38842013-12-16 16:14:02 -08002191 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2192 data.enforceInterface(IActivityManager.descriptor);
2193 IBinder activityToken = data.readStrongBinder();
2194 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2195 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002196 if (activityContainer != null) {
2197 reply.writeInt(1);
2198 reply.writeStrongBinder(activityContainer.asBinder());
2199 } else {
2200 reply.writeInt(0);
2201 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002202 return true;
2203 }
2204
Craig Mautner4a1cb222013-12-04 16:14:06 -08002205 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2206 data.enforceInterface(IActivityManager.descriptor);
2207 IBinder homeActivityToken = getHomeActivityToken();
2208 reply.writeNoException();
2209 reply.writeStrongBinder(homeActivityToken);
2210 return true;
2211 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002212
2213 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2214 data.enforceInterface(IActivityManager.descriptor);
2215 final int taskId = data.readInt();
2216 startLockTaskMode(taskId);
2217 reply.writeNoException();
2218 return true;
2219 }
2220
2221 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2222 data.enforceInterface(IActivityManager.descriptor);
2223 IBinder token = data.readStrongBinder();
2224 startLockTaskMode(token);
2225 reply.writeNoException();
2226 return true;
2227 }
2228
Craig Mautnerd61dc202014-07-07 11:09:11 -07002229 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002230 data.enforceInterface(IActivityManager.descriptor);
2231 startLockTaskModeOnCurrent();
2232 reply.writeNoException();
2233 return true;
2234 }
2235
Craig Mautneraea74a52014-03-08 14:23:10 -08002236 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2237 data.enforceInterface(IActivityManager.descriptor);
2238 stopLockTaskMode();
2239 reply.writeNoException();
2240 return true;
2241 }
2242
Craig Mautnerd61dc202014-07-07 11:09:11 -07002243 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002244 data.enforceInterface(IActivityManager.descriptor);
2245 stopLockTaskModeOnCurrent();
2246 reply.writeNoException();
2247 return true;
2248 }
2249
Craig Mautneraea74a52014-03-08 14:23:10 -08002250 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2251 data.enforceInterface(IActivityManager.descriptor);
2252 final boolean isInLockTaskMode = isInLockTaskMode();
2253 reply.writeNoException();
2254 reply.writeInt(isInLockTaskMode ? 1 : 0);
2255 return true;
2256 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002257
Winson Chunga449dc02014-05-16 11:15:04 -07002258 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002259 data.enforceInterface(IActivityManager.descriptor);
2260 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002261 ActivityManager.TaskDescription values =
2262 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2263 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002264 reply.writeNoException();
2265 return true;
2266 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002267
Craig Mautner648f69b2014-09-18 14:16:26 -07002268 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2269 data.enforceInterface(IActivityManager.descriptor);
2270 String filename = data.readString();
2271 Bitmap icon = getTaskDescriptionIcon(filename);
2272 reply.writeNoException();
2273 if (icon == null) {
2274 reply.writeInt(0);
2275 } else {
2276 reply.writeInt(1);
2277 icon.writeToParcel(reply, 0);
2278 }
2279 return true;
2280 }
2281
Jose Lima4b6c6692014-08-12 17:41:12 -07002282 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002283 data.enforceInterface(IActivityManager.descriptor);
2284 IBinder token = data.readStrongBinder();
2285 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002286 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002287 reply.writeNoException();
2288 reply.writeInt(success ? 1 : 0);
2289 return true;
2290 }
2291
Jose Lima4b6c6692014-08-12 17:41:12 -07002292 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002293 data.enforceInterface(IActivityManager.descriptor);
2294 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002295 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002296 reply.writeNoException();
2297 reply.writeInt(enabled ? 1 : 0);
2298 return true;
2299 }
2300
Jose Lima4b6c6692014-08-12 17:41:12 -07002301 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002302 data.enforceInterface(IActivityManager.descriptor);
2303 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002304 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002305 reply.writeNoException();
2306 return true;
2307 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002308
2309 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2310 data.enforceInterface(IActivityManager.descriptor);
2311 IBinder token = data.readStrongBinder();
2312 notifyLaunchTaskBehindComplete(token);
2313 reply.writeNoException();
2314 return true;
2315 }
Craig Mautner8746a472014-07-24 15:12:54 -07002316
2317 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2318 data.enforceInterface(IActivityManager.descriptor);
2319 IBinder token = data.readStrongBinder();
2320 notifyEnterAnimationComplete(token);
2321 reply.writeNoException();
2322 return true;
2323 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002324
2325 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2326 data.enforceInterface(IActivityManager.descriptor);
2327 bootAnimationComplete();
2328 reply.writeNoException();
2329 return true;
2330 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002331 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002332
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002333 return super.onTransact(code, data, reply, flags);
2334 }
2335
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002336 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002337 return this;
2338 }
2339
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002340 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2341 protected IActivityManager create() {
2342 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002343 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002344 Log.v("ActivityManager", "default service binder = " + b);
2345 }
2346 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002347 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002348 Log.v("ActivityManager", "default service = " + am);
2349 }
2350 return am;
2351 }
2352 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002353}
2354
2355class ActivityManagerProxy implements IActivityManager
2356{
2357 public ActivityManagerProxy(IBinder remote)
2358 {
2359 mRemote = remote;
2360 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002361
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002362 public IBinder asBinder()
2363 {
2364 return mRemote;
2365 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002366
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002367 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002368 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002369 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002370 Parcel data = Parcel.obtain();
2371 Parcel reply = Parcel.obtain();
2372 data.writeInterfaceToken(IActivityManager.descriptor);
2373 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002374 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002375 intent.writeToParcel(data, 0);
2376 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002377 data.writeStrongBinder(resultTo);
2378 data.writeString(resultWho);
2379 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002380 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002381 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002382 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002383 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002384 } else {
2385 data.writeInt(0);
2386 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002387 if (options != null) {
2388 data.writeInt(1);
2389 options.writeToParcel(data, 0);
2390 } else {
2391 data.writeInt(0);
2392 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002393 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2394 reply.readException();
2395 int result = reply.readInt();
2396 reply.recycle();
2397 data.recycle();
2398 return result;
2399 }
Amith Yamasani82644082012-08-03 13:09:11 -07002400
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002401 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002402 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002403 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2404 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002405 Parcel data = Parcel.obtain();
2406 Parcel reply = Parcel.obtain();
2407 data.writeInterfaceToken(IActivityManager.descriptor);
2408 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002409 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002410 intent.writeToParcel(data, 0);
2411 data.writeString(resolvedType);
2412 data.writeStrongBinder(resultTo);
2413 data.writeString(resultWho);
2414 data.writeInt(requestCode);
2415 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002416 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002417 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002418 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002419 } else {
2420 data.writeInt(0);
2421 }
2422 if (options != null) {
2423 data.writeInt(1);
2424 options.writeToParcel(data, 0);
2425 } else {
2426 data.writeInt(0);
2427 }
2428 data.writeInt(userId);
2429 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2430 reply.readException();
2431 int result = reply.readInt();
2432 reply.recycle();
2433 data.recycle();
2434 return result;
2435 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002436 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2437 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002438 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002439 Parcel data = Parcel.obtain();
2440 Parcel reply = Parcel.obtain();
2441 data.writeInterfaceToken(IActivityManager.descriptor);
2442 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2443 data.writeString(callingPackage);
2444 intent.writeToParcel(data, 0);
2445 data.writeString(resolvedType);
2446 data.writeStrongBinder(resultTo);
2447 data.writeString(resultWho);
2448 data.writeInt(requestCode);
2449 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002450 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002451 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002452 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002453 } else {
2454 data.writeInt(0);
2455 }
2456 if (options != null) {
2457 data.writeInt(1);
2458 options.writeToParcel(data, 0);
2459 } else {
2460 data.writeInt(0);
2461 }
2462 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2463 reply.readException();
2464 int result = reply.readInt();
2465 reply.recycle();
2466 data.recycle();
2467 return result;
2468 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002469 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2470 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002471 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2472 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002473 Parcel data = Parcel.obtain();
2474 Parcel reply = Parcel.obtain();
2475 data.writeInterfaceToken(IActivityManager.descriptor);
2476 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002477 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002478 intent.writeToParcel(data, 0);
2479 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002480 data.writeStrongBinder(resultTo);
2481 data.writeString(resultWho);
2482 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002483 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002484 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002485 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002486 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002487 } else {
2488 data.writeInt(0);
2489 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002490 if (options != null) {
2491 data.writeInt(1);
2492 options.writeToParcel(data, 0);
2493 } else {
2494 data.writeInt(0);
2495 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002496 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002497 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2498 reply.readException();
2499 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2500 reply.recycle();
2501 data.recycle();
2502 return result;
2503 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002504 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2505 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002506 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002507 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002508 Parcel data = Parcel.obtain();
2509 Parcel reply = Parcel.obtain();
2510 data.writeInterfaceToken(IActivityManager.descriptor);
2511 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002512 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002513 intent.writeToParcel(data, 0);
2514 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002515 data.writeStrongBinder(resultTo);
2516 data.writeString(resultWho);
2517 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002518 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002519 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002520 if (options != null) {
2521 data.writeInt(1);
2522 options.writeToParcel(data, 0);
2523 } else {
2524 data.writeInt(0);
2525 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002526 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002527 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2528 reply.readException();
2529 int result = reply.readInt();
2530 reply.recycle();
2531 data.recycle();
2532 return result;
2533 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002534 public int startActivityIntentSender(IApplicationThread caller,
2535 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002536 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002537 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002538 Parcel data = Parcel.obtain();
2539 Parcel reply = Parcel.obtain();
2540 data.writeInterfaceToken(IActivityManager.descriptor);
2541 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2542 intent.writeToParcel(data, 0);
2543 if (fillInIntent != null) {
2544 data.writeInt(1);
2545 fillInIntent.writeToParcel(data, 0);
2546 } else {
2547 data.writeInt(0);
2548 }
2549 data.writeString(resolvedType);
2550 data.writeStrongBinder(resultTo);
2551 data.writeString(resultWho);
2552 data.writeInt(requestCode);
2553 data.writeInt(flagsMask);
2554 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002555 if (options != null) {
2556 data.writeInt(1);
2557 options.writeToParcel(data, 0);
2558 } else {
2559 data.writeInt(0);
2560 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002561 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002562 reply.readException();
2563 int result = reply.readInt();
2564 reply.recycle();
2565 data.recycle();
2566 return result;
2567 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002568 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2569 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002570 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2571 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002572 Parcel data = Parcel.obtain();
2573 Parcel reply = Parcel.obtain();
2574 data.writeInterfaceToken(IActivityManager.descriptor);
2575 data.writeString(callingPackage);
2576 data.writeInt(callingPid);
2577 data.writeInt(callingUid);
2578 intent.writeToParcel(data, 0);
2579 data.writeString(resolvedType);
2580 data.writeStrongBinder(session.asBinder());
2581 data.writeStrongBinder(interactor.asBinder());
2582 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002583 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002584 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002585 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002586 } else {
2587 data.writeInt(0);
2588 }
2589 if (options != null) {
2590 data.writeInt(1);
2591 options.writeToParcel(data, 0);
2592 } else {
2593 data.writeInt(0);
2594 }
2595 data.writeInt(userId);
2596 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2597 reply.readException();
2598 int result = reply.readInt();
2599 reply.recycle();
2600 data.recycle();
2601 return result;
2602 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002603 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002604 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002605 Parcel data = Parcel.obtain();
2606 Parcel reply = Parcel.obtain();
2607 data.writeInterfaceToken(IActivityManager.descriptor);
2608 data.writeStrongBinder(callingActivity);
2609 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002610 if (options != null) {
2611 data.writeInt(1);
2612 options.writeToParcel(data, 0);
2613 } else {
2614 data.writeInt(0);
2615 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002616 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2617 reply.readException();
2618 int result = reply.readInt();
2619 reply.recycle();
2620 data.recycle();
2621 return result != 0;
2622 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002623 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2624 Parcel data = Parcel.obtain();
2625 Parcel reply = Parcel.obtain();
2626 data.writeInterfaceToken(IActivityManager.descriptor);
2627 data.writeInt(taskId);
2628 if (options == null) {
2629 data.writeInt(0);
2630 } else {
2631 data.writeInt(1);
2632 options.writeToParcel(data, 0);
2633 }
2634 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2635 reply.readException();
2636 int result = reply.readInt();
2637 reply.recycle();
2638 data.recycle();
2639 return result;
2640 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002641 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002642 throws RemoteException {
2643 Parcel data = Parcel.obtain();
2644 Parcel reply = Parcel.obtain();
2645 data.writeInterfaceToken(IActivityManager.descriptor);
2646 data.writeStrongBinder(token);
2647 data.writeInt(resultCode);
2648 if (resultData != null) {
2649 data.writeInt(1);
2650 resultData.writeToParcel(data, 0);
2651 } else {
2652 data.writeInt(0);
2653 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002654 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002655 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2656 reply.readException();
2657 boolean res = reply.readInt() != 0;
2658 data.recycle();
2659 reply.recycle();
2660 return res;
2661 }
2662 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2663 {
2664 Parcel data = Parcel.obtain();
2665 Parcel reply = Parcel.obtain();
2666 data.writeInterfaceToken(IActivityManager.descriptor);
2667 data.writeStrongBinder(token);
2668 data.writeString(resultWho);
2669 data.writeInt(requestCode);
2670 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2671 reply.readException();
2672 data.recycle();
2673 reply.recycle();
2674 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002675 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2676 Parcel data = Parcel.obtain();
2677 Parcel reply = Parcel.obtain();
2678 data.writeInterfaceToken(IActivityManager.descriptor);
2679 data.writeStrongBinder(token);
2680 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2681 reply.readException();
2682 boolean res = reply.readInt() != 0;
2683 data.recycle();
2684 reply.recycle();
2685 return res;
2686 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002687 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2688 Parcel data = Parcel.obtain();
2689 Parcel reply = Parcel.obtain();
2690 data.writeInterfaceToken(IActivityManager.descriptor);
2691 data.writeStrongBinder(session.asBinder());
2692 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2693 reply.readException();
2694 data.recycle();
2695 reply.recycle();
2696 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002697 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2698 Parcel data = Parcel.obtain();
2699 Parcel reply = Parcel.obtain();
2700 data.writeInterfaceToken(IActivityManager.descriptor);
2701 data.writeStrongBinder(token);
2702 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2703 reply.readException();
2704 boolean res = reply.readInt() != 0;
2705 data.recycle();
2706 reply.recycle();
2707 return res;
2708 }
2709 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2710 Parcel data = Parcel.obtain();
2711 Parcel reply = Parcel.obtain();
2712 data.writeInterfaceToken(IActivityManager.descriptor);
2713 data.writeStrongBinder(app.asBinder());
2714 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2715 reply.readException();
2716 data.recycle();
2717 reply.recycle();
2718 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002719 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2720 Parcel data = Parcel.obtain();
2721 Parcel reply = Parcel.obtain();
2722 data.writeInterfaceToken(IActivityManager.descriptor);
2723 data.writeStrongBinder(token);
2724 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2725 reply.readException();
2726 boolean res = reply.readInt() != 0;
2727 data.recycle();
2728 reply.recycle();
2729 return res;
2730 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002731 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002732 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002733 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002734 {
2735 Parcel data = Parcel.obtain();
2736 Parcel reply = Parcel.obtain();
2737 data.writeInterfaceToken(IActivityManager.descriptor);
2738 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002739 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002740 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2741 filter.writeToParcel(data, 0);
2742 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002743 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002744 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2745 reply.readException();
2746 Intent intent = null;
2747 int haveIntent = reply.readInt();
2748 if (haveIntent != 0) {
2749 intent = Intent.CREATOR.createFromParcel(reply);
2750 }
2751 reply.recycle();
2752 data.recycle();
2753 return intent;
2754 }
2755 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2756 {
2757 Parcel data = Parcel.obtain();
2758 Parcel reply = Parcel.obtain();
2759 data.writeInterfaceToken(IActivityManager.descriptor);
2760 data.writeStrongBinder(receiver.asBinder());
2761 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2762 reply.readException();
2763 data.recycle();
2764 reply.recycle();
2765 }
2766 public int broadcastIntent(IApplicationThread caller,
2767 Intent intent, String resolvedType, IIntentReceiver resultTo,
2768 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002769 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002770 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002771 {
2772 Parcel data = Parcel.obtain();
2773 Parcel reply = Parcel.obtain();
2774 data.writeInterfaceToken(IActivityManager.descriptor);
2775 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2776 intent.writeToParcel(data, 0);
2777 data.writeString(resolvedType);
2778 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2779 data.writeInt(resultCode);
2780 data.writeString(resultData);
2781 data.writeBundle(map);
2782 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002783 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002784 data.writeInt(serialized ? 1 : 0);
2785 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002786 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002787 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2788 reply.readException();
2789 int res = reply.readInt();
2790 reply.recycle();
2791 data.recycle();
2792 return res;
2793 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002794 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2795 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002796 {
2797 Parcel data = Parcel.obtain();
2798 Parcel reply = Parcel.obtain();
2799 data.writeInterfaceToken(IActivityManager.descriptor);
2800 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2801 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002802 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002803 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2804 reply.readException();
2805 data.recycle();
2806 reply.recycle();
2807 }
2808 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2809 {
2810 Parcel data = Parcel.obtain();
2811 Parcel reply = Parcel.obtain();
2812 data.writeInterfaceToken(IActivityManager.descriptor);
2813 data.writeStrongBinder(who);
2814 data.writeInt(resultCode);
2815 data.writeString(resultData);
2816 data.writeBundle(map);
2817 data.writeInt(abortBroadcast ? 1 : 0);
2818 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2819 reply.readException();
2820 data.recycle();
2821 reply.recycle();
2822 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002823 public void attachApplication(IApplicationThread app) throws RemoteException
2824 {
2825 Parcel data = Parcel.obtain();
2826 Parcel reply = Parcel.obtain();
2827 data.writeInterfaceToken(IActivityManager.descriptor);
2828 data.writeStrongBinder(app.asBinder());
2829 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2830 reply.readException();
2831 data.recycle();
2832 reply.recycle();
2833 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002834 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2835 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002836 {
2837 Parcel data = Parcel.obtain();
2838 Parcel reply = Parcel.obtain();
2839 data.writeInterfaceToken(IActivityManager.descriptor);
2840 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002841 if (config != null) {
2842 data.writeInt(1);
2843 config.writeToParcel(data, 0);
2844 } else {
2845 data.writeInt(0);
2846 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002847 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002848 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2849 reply.readException();
2850 data.recycle();
2851 reply.recycle();
2852 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002853 public void activityResumed(IBinder token) throws RemoteException
2854 {
2855 Parcel data = Parcel.obtain();
2856 Parcel reply = Parcel.obtain();
2857 data.writeInterfaceToken(IActivityManager.descriptor);
2858 data.writeStrongBinder(token);
2859 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2860 reply.readException();
2861 data.recycle();
2862 reply.recycle();
2863 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07002864 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002865 {
2866 Parcel data = Parcel.obtain();
2867 Parcel reply = Parcel.obtain();
2868 data.writeInterfaceToken(IActivityManager.descriptor);
2869 data.writeStrongBinder(token);
2870 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2871 reply.readException();
2872 data.recycle();
2873 reply.recycle();
2874 }
2875 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002876 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002877 {
2878 Parcel data = Parcel.obtain();
2879 Parcel reply = Parcel.obtain();
2880 data.writeInterfaceToken(IActivityManager.descriptor);
2881 data.writeStrongBinder(token);
2882 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002883 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002884 TextUtils.writeToParcel(description, data, 0);
2885 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2886 reply.readException();
2887 data.recycle();
2888 reply.recycle();
2889 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002890 public void activitySlept(IBinder token) throws RemoteException
2891 {
2892 Parcel data = Parcel.obtain();
2893 Parcel reply = Parcel.obtain();
2894 data.writeInterfaceToken(IActivityManager.descriptor);
2895 data.writeStrongBinder(token);
2896 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2897 reply.readException();
2898 data.recycle();
2899 reply.recycle();
2900 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002901 public void activityDestroyed(IBinder token) throws RemoteException
2902 {
2903 Parcel data = Parcel.obtain();
2904 Parcel reply = Parcel.obtain();
2905 data.writeInterfaceToken(IActivityManager.descriptor);
2906 data.writeStrongBinder(token);
2907 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2908 reply.readException();
2909 data.recycle();
2910 reply.recycle();
2911 }
2912 public String getCallingPackage(IBinder token) throws RemoteException
2913 {
2914 Parcel data = Parcel.obtain();
2915 Parcel reply = Parcel.obtain();
2916 data.writeInterfaceToken(IActivityManager.descriptor);
2917 data.writeStrongBinder(token);
2918 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2919 reply.readException();
2920 String res = reply.readString();
2921 data.recycle();
2922 reply.recycle();
2923 return res;
2924 }
2925 public ComponentName getCallingActivity(IBinder token)
2926 throws RemoteException {
2927 Parcel data = Parcel.obtain();
2928 Parcel reply = Parcel.obtain();
2929 data.writeInterfaceToken(IActivityManager.descriptor);
2930 data.writeStrongBinder(token);
2931 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2932 reply.readException();
2933 ComponentName res = ComponentName.readFromParcel(reply);
2934 data.recycle();
2935 reply.recycle();
2936 return res;
2937 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002938 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07002939 Parcel data = Parcel.obtain();
2940 Parcel reply = Parcel.obtain();
2941 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002942 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07002943 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2944 reply.readException();
2945 ArrayList<IAppTask> list = null;
2946 int N = reply.readInt();
2947 if (N >= 0) {
2948 list = new ArrayList<IAppTask>();
2949 while (N > 0) {
2950 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2951 list.add(task);
2952 N--;
2953 }
2954 }
2955 data.recycle();
2956 reply.recycle();
2957 return list;
2958 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07002959 public int addAppTask(IBinder activityToken, Intent intent,
2960 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
2961 Parcel data = Parcel.obtain();
2962 Parcel reply = Parcel.obtain();
2963 data.writeInterfaceToken(IActivityManager.descriptor);
2964 data.writeStrongBinder(activityToken);
2965 intent.writeToParcel(data, 0);
2966 description.writeToParcel(data, 0);
2967 thumbnail.writeToParcel(data, 0);
2968 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
2969 reply.readException();
2970 int res = reply.readInt();
2971 data.recycle();
2972 reply.recycle();
2973 return res;
2974 }
2975 public Point getAppTaskThumbnailSize() throws RemoteException {
2976 Parcel data = Parcel.obtain();
2977 Parcel reply = Parcel.obtain();
2978 data.writeInterfaceToken(IActivityManager.descriptor);
2979 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
2980 reply.readException();
2981 Point size = Point.CREATOR.createFromParcel(reply);
2982 data.recycle();
2983 reply.recycle();
2984 return size;
2985 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002986 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002987 Parcel data = Parcel.obtain();
2988 Parcel reply = Parcel.obtain();
2989 data.writeInterfaceToken(IActivityManager.descriptor);
2990 data.writeInt(maxNum);
2991 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002992 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2993 reply.readException();
2994 ArrayList list = null;
2995 int N = reply.readInt();
2996 if (N >= 0) {
2997 list = new ArrayList();
2998 while (N > 0) {
2999 ActivityManager.RunningTaskInfo info =
3000 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003001 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003002 list.add(info);
3003 N--;
3004 }
3005 }
3006 data.recycle();
3007 reply.recycle();
3008 return list;
3009 }
3010 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003011 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003012 Parcel data = Parcel.obtain();
3013 Parcel reply = Parcel.obtain();
3014 data.writeInterfaceToken(IActivityManager.descriptor);
3015 data.writeInt(maxNum);
3016 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003017 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003018 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3019 reply.readException();
3020 ArrayList<ActivityManager.RecentTaskInfo> list
3021 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3022 data.recycle();
3023 reply.recycle();
3024 return list;
3025 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003026 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003027 Parcel data = Parcel.obtain();
3028 Parcel reply = Parcel.obtain();
3029 data.writeInterfaceToken(IActivityManager.descriptor);
3030 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003031 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003032 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003033 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003034 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003035 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003036 }
3037 data.recycle();
3038 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003039 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003040 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003041 public List getServices(int maxNum, int flags) throws RemoteException {
3042 Parcel data = Parcel.obtain();
3043 Parcel reply = Parcel.obtain();
3044 data.writeInterfaceToken(IActivityManager.descriptor);
3045 data.writeInt(maxNum);
3046 data.writeInt(flags);
3047 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3048 reply.readException();
3049 ArrayList list = null;
3050 int N = reply.readInt();
3051 if (N >= 0) {
3052 list = new ArrayList();
3053 while (N > 0) {
3054 ActivityManager.RunningServiceInfo info =
3055 ActivityManager.RunningServiceInfo.CREATOR
3056 .createFromParcel(reply);
3057 list.add(info);
3058 N--;
3059 }
3060 }
3061 data.recycle();
3062 reply.recycle();
3063 return list;
3064 }
3065 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3066 throws RemoteException {
3067 Parcel data = Parcel.obtain();
3068 Parcel reply = Parcel.obtain();
3069 data.writeInterfaceToken(IActivityManager.descriptor);
3070 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3071 reply.readException();
3072 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3073 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3074 data.recycle();
3075 reply.recycle();
3076 return list;
3077 }
3078 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3079 throws RemoteException {
3080 Parcel data = Parcel.obtain();
3081 Parcel reply = Parcel.obtain();
3082 data.writeInterfaceToken(IActivityManager.descriptor);
3083 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3084 reply.readException();
3085 ArrayList<ActivityManager.RunningAppProcessInfo> list
3086 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3087 data.recycle();
3088 reply.recycle();
3089 return list;
3090 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003091 public List<ApplicationInfo> getRunningExternalApplications()
3092 throws RemoteException {
3093 Parcel data = Parcel.obtain();
3094 Parcel reply = Parcel.obtain();
3095 data.writeInterfaceToken(IActivityManager.descriptor);
3096 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3097 reply.readException();
3098 ArrayList<ApplicationInfo> list
3099 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3100 data.recycle();
3101 reply.recycle();
3102 return list;
3103 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003104 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003105 {
3106 Parcel data = Parcel.obtain();
3107 Parcel reply = Parcel.obtain();
3108 data.writeInterfaceToken(IActivityManager.descriptor);
3109 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003110 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003111 if (options != null) {
3112 data.writeInt(1);
3113 options.writeToParcel(data, 0);
3114 } else {
3115 data.writeInt(0);
3116 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003117 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3118 reply.readException();
3119 data.recycle();
3120 reply.recycle();
3121 }
3122 public void moveTaskToBack(int task) throws RemoteException
3123 {
3124 Parcel data = Parcel.obtain();
3125 Parcel reply = Parcel.obtain();
3126 data.writeInterfaceToken(IActivityManager.descriptor);
3127 data.writeInt(task);
3128 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3129 reply.readException();
3130 data.recycle();
3131 reply.recycle();
3132 }
3133 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3134 throws RemoteException {
3135 Parcel data = Parcel.obtain();
3136 Parcel reply = Parcel.obtain();
3137 data.writeInterfaceToken(IActivityManager.descriptor);
3138 data.writeStrongBinder(token);
3139 data.writeInt(nonRoot ? 1 : 0);
3140 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3141 reply.readException();
3142 boolean res = reply.readInt() != 0;
3143 data.recycle();
3144 reply.recycle();
3145 return res;
3146 }
3147 public void moveTaskBackwards(int task) throws RemoteException
3148 {
3149 Parcel data = Parcel.obtain();
3150 Parcel reply = Parcel.obtain();
3151 data.writeInterfaceToken(IActivityManager.descriptor);
3152 data.writeInt(task);
3153 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3154 reply.readException();
3155 data.recycle();
3156 reply.recycle();
3157 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003158 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003159 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3160 {
3161 Parcel data = Parcel.obtain();
3162 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003163 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003164 data.writeInt(taskId);
3165 data.writeInt(stackId);
3166 data.writeInt(toTop ? 1 : 0);
3167 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3168 reply.readException();
3169 data.recycle();
3170 reply.recycle();
3171 }
3172 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003173 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003174 {
3175 Parcel data = Parcel.obtain();
3176 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003177 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003178 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003179 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003180 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003181 reply.readException();
3182 data.recycle();
3183 reply.recycle();
3184 }
Craig Mautner967212c2013-04-13 21:10:58 -07003185 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003186 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003187 {
3188 Parcel data = Parcel.obtain();
3189 Parcel reply = Parcel.obtain();
3190 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003191 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003192 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003193 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003194 data.recycle();
3195 reply.recycle();
3196 return list;
3197 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003198 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003199 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003200 {
3201 Parcel data = Parcel.obtain();
3202 Parcel reply = Parcel.obtain();
3203 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003204 data.writeInt(stackId);
3205 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003206 reply.readException();
3207 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003208 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003209 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003210 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003211 }
3212 data.recycle();
3213 reply.recycle();
3214 return info;
3215 }
3216 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003217 public boolean isInHomeStack(int taskId) throws RemoteException {
3218 Parcel data = Parcel.obtain();
3219 Parcel reply = Parcel.obtain();
3220 data.writeInterfaceToken(IActivityManager.descriptor);
3221 data.writeInt(taskId);
3222 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3223 reply.readException();
3224 boolean isInHomeStack = reply.readInt() > 0;
3225 data.recycle();
3226 reply.recycle();
3227 return isInHomeStack;
3228 }
3229 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003230 public void setFocusedStack(int stackId) throws RemoteException
3231 {
3232 Parcel data = Parcel.obtain();
3233 Parcel reply = Parcel.obtain();
3234 data.writeInterfaceToken(IActivityManager.descriptor);
3235 data.writeInt(stackId);
3236 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3237 reply.readException();
3238 data.recycle();
3239 reply.recycle();
3240 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003241 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3242 {
3243 Parcel data = Parcel.obtain();
3244 Parcel reply = Parcel.obtain();
3245 data.writeInterfaceToken(IActivityManager.descriptor);
3246 data.writeStrongBinder(token);
3247 data.writeInt(onlyRoot ? 1 : 0);
3248 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3249 reply.readException();
3250 int res = reply.readInt();
3251 data.recycle();
3252 reply.recycle();
3253 return res;
3254 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003255 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003256 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003257 Parcel data = Parcel.obtain();
3258 Parcel reply = Parcel.obtain();
3259 data.writeInterfaceToken(IActivityManager.descriptor);
3260 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3261 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003262 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003263 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003264 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3265 reply.readException();
3266 int res = reply.readInt();
3267 ContentProviderHolder cph = null;
3268 if (res != 0) {
3269 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3270 }
3271 data.recycle();
3272 reply.recycle();
3273 return cph;
3274 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003275 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3276 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003277 Parcel data = Parcel.obtain();
3278 Parcel reply = Parcel.obtain();
3279 data.writeInterfaceToken(IActivityManager.descriptor);
3280 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003281 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003282 data.writeStrongBinder(token);
3283 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3284 reply.readException();
3285 int res = reply.readInt();
3286 ContentProviderHolder cph = null;
3287 if (res != 0) {
3288 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3289 }
3290 data.recycle();
3291 reply.recycle();
3292 return cph;
3293 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003294 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003295 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003296 {
3297 Parcel data = Parcel.obtain();
3298 Parcel reply = Parcel.obtain();
3299 data.writeInterfaceToken(IActivityManager.descriptor);
3300 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3301 data.writeTypedList(providers);
3302 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3303 reply.readException();
3304 data.recycle();
3305 reply.recycle();
3306 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003307 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3308 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003309 Parcel data = Parcel.obtain();
3310 Parcel reply = Parcel.obtain();
3311 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003312 data.writeStrongBinder(connection);
3313 data.writeInt(stable);
3314 data.writeInt(unstable);
3315 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3316 reply.readException();
3317 boolean res = reply.readInt() != 0;
3318 data.recycle();
3319 reply.recycle();
3320 return res;
3321 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003322
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003323 public void unstableProviderDied(IBinder connection) throws RemoteException {
3324 Parcel data = Parcel.obtain();
3325 Parcel reply = Parcel.obtain();
3326 data.writeInterfaceToken(IActivityManager.descriptor);
3327 data.writeStrongBinder(connection);
3328 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3329 reply.readException();
3330 data.recycle();
3331 reply.recycle();
3332 }
3333
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003334 @Override
3335 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3336 Parcel data = Parcel.obtain();
3337 Parcel reply = Parcel.obtain();
3338 data.writeInterfaceToken(IActivityManager.descriptor);
3339 data.writeStrongBinder(connection);
3340 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3341 reply.readException();
3342 data.recycle();
3343 reply.recycle();
3344 }
3345
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003346 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3347 Parcel data = Parcel.obtain();
3348 Parcel reply = Parcel.obtain();
3349 data.writeInterfaceToken(IActivityManager.descriptor);
3350 data.writeStrongBinder(connection);
3351 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003352 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3353 reply.readException();
3354 data.recycle();
3355 reply.recycle();
3356 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003357
3358 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3359 Parcel data = Parcel.obtain();
3360 Parcel reply = Parcel.obtain();
3361 data.writeInterfaceToken(IActivityManager.descriptor);
3362 data.writeString(name);
3363 data.writeStrongBinder(token);
3364 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3365 reply.readException();
3366 data.recycle();
3367 reply.recycle();
3368 }
3369
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003370 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3371 throws RemoteException
3372 {
3373 Parcel data = Parcel.obtain();
3374 Parcel reply = Parcel.obtain();
3375 data.writeInterfaceToken(IActivityManager.descriptor);
3376 service.writeToParcel(data, 0);
3377 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3378 reply.readException();
3379 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3380 data.recycle();
3381 reply.recycle();
3382 return res;
3383 }
3384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003385 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003386 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003387 {
3388 Parcel data = Parcel.obtain();
3389 Parcel reply = Parcel.obtain();
3390 data.writeInterfaceToken(IActivityManager.descriptor);
3391 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3392 service.writeToParcel(data, 0);
3393 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003394 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003395 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3396 reply.readException();
3397 ComponentName res = ComponentName.readFromParcel(reply);
3398 data.recycle();
3399 reply.recycle();
3400 return res;
3401 }
3402 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003403 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003404 {
3405 Parcel data = Parcel.obtain();
3406 Parcel reply = Parcel.obtain();
3407 data.writeInterfaceToken(IActivityManager.descriptor);
3408 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3409 service.writeToParcel(data, 0);
3410 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003411 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003412 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3413 reply.readException();
3414 int res = reply.readInt();
3415 reply.recycle();
3416 data.recycle();
3417 return res;
3418 }
3419 public boolean stopServiceToken(ComponentName className, IBinder token,
3420 int startId) throws RemoteException {
3421 Parcel data = Parcel.obtain();
3422 Parcel reply = Parcel.obtain();
3423 data.writeInterfaceToken(IActivityManager.descriptor);
3424 ComponentName.writeToParcel(className, data);
3425 data.writeStrongBinder(token);
3426 data.writeInt(startId);
3427 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3428 reply.readException();
3429 boolean res = reply.readInt() != 0;
3430 data.recycle();
3431 reply.recycle();
3432 return res;
3433 }
3434 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003435 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003436 Parcel data = Parcel.obtain();
3437 Parcel reply = Parcel.obtain();
3438 data.writeInterfaceToken(IActivityManager.descriptor);
3439 ComponentName.writeToParcel(className, data);
3440 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003441 data.writeInt(id);
3442 if (notification != null) {
3443 data.writeInt(1);
3444 notification.writeToParcel(data, 0);
3445 } else {
3446 data.writeInt(0);
3447 }
3448 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003449 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3450 reply.readException();
3451 data.recycle();
3452 reply.recycle();
3453 }
3454 public int bindService(IApplicationThread caller, IBinder token,
3455 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003456 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003457 Parcel data = Parcel.obtain();
3458 Parcel reply = Parcel.obtain();
3459 data.writeInterfaceToken(IActivityManager.descriptor);
3460 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3461 data.writeStrongBinder(token);
3462 service.writeToParcel(data, 0);
3463 data.writeString(resolvedType);
3464 data.writeStrongBinder(connection.asBinder());
3465 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003466 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003467 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3468 reply.readException();
3469 int res = reply.readInt();
3470 data.recycle();
3471 reply.recycle();
3472 return res;
3473 }
3474 public boolean unbindService(IServiceConnection connection) throws RemoteException
3475 {
3476 Parcel data = Parcel.obtain();
3477 Parcel reply = Parcel.obtain();
3478 data.writeInterfaceToken(IActivityManager.descriptor);
3479 data.writeStrongBinder(connection.asBinder());
3480 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3481 reply.readException();
3482 boolean res = reply.readInt() != 0;
3483 data.recycle();
3484 reply.recycle();
3485 return res;
3486 }
3487
3488 public void publishService(IBinder token,
3489 Intent intent, IBinder service) throws RemoteException {
3490 Parcel data = Parcel.obtain();
3491 Parcel reply = Parcel.obtain();
3492 data.writeInterfaceToken(IActivityManager.descriptor);
3493 data.writeStrongBinder(token);
3494 intent.writeToParcel(data, 0);
3495 data.writeStrongBinder(service);
3496 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3497 reply.readException();
3498 data.recycle();
3499 reply.recycle();
3500 }
3501
3502 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3503 throws RemoteException {
3504 Parcel data = Parcel.obtain();
3505 Parcel reply = Parcel.obtain();
3506 data.writeInterfaceToken(IActivityManager.descriptor);
3507 data.writeStrongBinder(token);
3508 intent.writeToParcel(data, 0);
3509 data.writeInt(doRebind ? 1 : 0);
3510 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3511 reply.readException();
3512 data.recycle();
3513 reply.recycle();
3514 }
3515
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003516 public void serviceDoneExecuting(IBinder token, int type, int startId,
3517 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003518 Parcel data = Parcel.obtain();
3519 Parcel reply = Parcel.obtain();
3520 data.writeInterfaceToken(IActivityManager.descriptor);
3521 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003522 data.writeInt(type);
3523 data.writeInt(startId);
3524 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003525 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3526 reply.readException();
3527 data.recycle();
3528 reply.recycle();
3529 }
3530
3531 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3532 Parcel data = Parcel.obtain();
3533 Parcel reply = Parcel.obtain();
3534 data.writeInterfaceToken(IActivityManager.descriptor);
3535 service.writeToParcel(data, 0);
3536 data.writeString(resolvedType);
3537 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3538 reply.readException();
3539 IBinder binder = reply.readStrongBinder();
3540 reply.recycle();
3541 data.recycle();
3542 return binder;
3543 }
3544
Christopher Tate181fafa2009-05-14 11:12:14 -07003545 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3546 throws RemoteException {
3547 Parcel data = Parcel.obtain();
3548 Parcel reply = Parcel.obtain();
3549 data.writeInterfaceToken(IActivityManager.descriptor);
3550 app.writeToParcel(data, 0);
3551 data.writeInt(backupRestoreMode);
3552 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3553 reply.readException();
3554 boolean success = reply.readInt() != 0;
3555 reply.recycle();
3556 data.recycle();
3557 return success;
3558 }
3559
Christopher Tate346acb12012-10-15 19:20:25 -07003560 public void clearPendingBackup() throws RemoteException {
3561 Parcel data = Parcel.obtain();
3562 Parcel reply = Parcel.obtain();
3563 data.writeInterfaceToken(IActivityManager.descriptor);
3564 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3565 reply.recycle();
3566 data.recycle();
3567 }
3568
Christopher Tate181fafa2009-05-14 11:12:14 -07003569 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3570 Parcel data = Parcel.obtain();
3571 Parcel reply = Parcel.obtain();
3572 data.writeInterfaceToken(IActivityManager.descriptor);
3573 data.writeString(packageName);
3574 data.writeStrongBinder(agent);
3575 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3576 reply.recycle();
3577 data.recycle();
3578 }
3579
3580 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3581 Parcel data = Parcel.obtain();
3582 Parcel reply = Parcel.obtain();
3583 data.writeInterfaceToken(IActivityManager.descriptor);
3584 app.writeToParcel(data, 0);
3585 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3586 reply.readException();
3587 reply.recycle();
3588 data.recycle();
3589 }
3590
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003591 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003592 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003593 IUiAutomationConnection connection, int userId, String instructionSet)
3594 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003595 Parcel data = Parcel.obtain();
3596 Parcel reply = Parcel.obtain();
3597 data.writeInterfaceToken(IActivityManager.descriptor);
3598 ComponentName.writeToParcel(className, data);
3599 data.writeString(profileFile);
3600 data.writeInt(flags);
3601 data.writeBundle(arguments);
3602 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003603 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003604 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003605 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003606 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3607 reply.readException();
3608 boolean res = reply.readInt() != 0;
3609 reply.recycle();
3610 data.recycle();
3611 return res;
3612 }
3613
3614 public void finishInstrumentation(IApplicationThread target,
3615 int resultCode, Bundle results) throws RemoteException {
3616 Parcel data = Parcel.obtain();
3617 Parcel reply = Parcel.obtain();
3618 data.writeInterfaceToken(IActivityManager.descriptor);
3619 data.writeStrongBinder(target != null ? target.asBinder() : null);
3620 data.writeInt(resultCode);
3621 data.writeBundle(results);
3622 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3623 reply.readException();
3624 data.recycle();
3625 reply.recycle();
3626 }
3627 public Configuration getConfiguration() throws RemoteException
3628 {
3629 Parcel data = Parcel.obtain();
3630 Parcel reply = Parcel.obtain();
3631 data.writeInterfaceToken(IActivityManager.descriptor);
3632 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3633 reply.readException();
3634 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3635 reply.recycle();
3636 data.recycle();
3637 return res;
3638 }
3639 public void updateConfiguration(Configuration values) throws RemoteException
3640 {
3641 Parcel data = Parcel.obtain();
3642 Parcel reply = Parcel.obtain();
3643 data.writeInterfaceToken(IActivityManager.descriptor);
3644 values.writeToParcel(data, 0);
3645 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3646 reply.readException();
3647 data.recycle();
3648 reply.recycle();
3649 }
3650 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3651 throws RemoteException {
3652 Parcel data = Parcel.obtain();
3653 Parcel reply = Parcel.obtain();
3654 data.writeInterfaceToken(IActivityManager.descriptor);
3655 data.writeStrongBinder(token);
3656 data.writeInt(requestedOrientation);
3657 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3658 reply.readException();
3659 data.recycle();
3660 reply.recycle();
3661 }
3662 public int getRequestedOrientation(IBinder token) throws RemoteException {
3663 Parcel data = Parcel.obtain();
3664 Parcel reply = Parcel.obtain();
3665 data.writeInterfaceToken(IActivityManager.descriptor);
3666 data.writeStrongBinder(token);
3667 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3668 reply.readException();
3669 int res = reply.readInt();
3670 data.recycle();
3671 reply.recycle();
3672 return res;
3673 }
3674 public ComponentName getActivityClassForToken(IBinder token)
3675 throws RemoteException {
3676 Parcel data = Parcel.obtain();
3677 Parcel reply = Parcel.obtain();
3678 data.writeInterfaceToken(IActivityManager.descriptor);
3679 data.writeStrongBinder(token);
3680 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3681 reply.readException();
3682 ComponentName res = ComponentName.readFromParcel(reply);
3683 data.recycle();
3684 reply.recycle();
3685 return res;
3686 }
3687 public String getPackageForToken(IBinder token) throws RemoteException
3688 {
3689 Parcel data = Parcel.obtain();
3690 Parcel reply = Parcel.obtain();
3691 data.writeInterfaceToken(IActivityManager.descriptor);
3692 data.writeStrongBinder(token);
3693 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3694 reply.readException();
3695 String res = reply.readString();
3696 data.recycle();
3697 reply.recycle();
3698 return res;
3699 }
3700 public IIntentSender getIntentSender(int type,
3701 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003702 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003703 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003704 Parcel data = Parcel.obtain();
3705 Parcel reply = Parcel.obtain();
3706 data.writeInterfaceToken(IActivityManager.descriptor);
3707 data.writeInt(type);
3708 data.writeString(packageName);
3709 data.writeStrongBinder(token);
3710 data.writeString(resultWho);
3711 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003712 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003713 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003714 data.writeTypedArray(intents, 0);
3715 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003716 } else {
3717 data.writeInt(0);
3718 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003719 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003720 if (options != null) {
3721 data.writeInt(1);
3722 options.writeToParcel(data, 0);
3723 } else {
3724 data.writeInt(0);
3725 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003726 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003727 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3728 reply.readException();
3729 IIntentSender res = IIntentSender.Stub.asInterface(
3730 reply.readStrongBinder());
3731 data.recycle();
3732 reply.recycle();
3733 return res;
3734 }
3735 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3736 Parcel data = Parcel.obtain();
3737 Parcel reply = Parcel.obtain();
3738 data.writeInterfaceToken(IActivityManager.descriptor);
3739 data.writeStrongBinder(sender.asBinder());
3740 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3741 reply.readException();
3742 data.recycle();
3743 reply.recycle();
3744 }
3745 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3746 Parcel data = Parcel.obtain();
3747 Parcel reply = Parcel.obtain();
3748 data.writeInterfaceToken(IActivityManager.descriptor);
3749 data.writeStrongBinder(sender.asBinder());
3750 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3751 reply.readException();
3752 String res = reply.readString();
3753 data.recycle();
3754 reply.recycle();
3755 return res;
3756 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003757 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3758 Parcel data = Parcel.obtain();
3759 Parcel reply = Parcel.obtain();
3760 data.writeInterfaceToken(IActivityManager.descriptor);
3761 data.writeStrongBinder(sender.asBinder());
3762 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3763 reply.readException();
3764 int res = reply.readInt();
3765 data.recycle();
3766 reply.recycle();
3767 return res;
3768 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003769 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3770 boolean requireFull, String name, String callerPackage) throws RemoteException {
3771 Parcel data = Parcel.obtain();
3772 Parcel reply = Parcel.obtain();
3773 data.writeInterfaceToken(IActivityManager.descriptor);
3774 data.writeInt(callingPid);
3775 data.writeInt(callingUid);
3776 data.writeInt(userId);
3777 data.writeInt(allowAll ? 1 : 0);
3778 data.writeInt(requireFull ? 1 : 0);
3779 data.writeString(name);
3780 data.writeString(callerPackage);
3781 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3782 reply.readException();
3783 int res = reply.readInt();
3784 data.recycle();
3785 reply.recycle();
3786 return res;
3787 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003788 public void setProcessLimit(int max) throws RemoteException
3789 {
3790 Parcel data = Parcel.obtain();
3791 Parcel reply = Parcel.obtain();
3792 data.writeInterfaceToken(IActivityManager.descriptor);
3793 data.writeInt(max);
3794 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3795 reply.readException();
3796 data.recycle();
3797 reply.recycle();
3798 }
3799 public int getProcessLimit() throws RemoteException
3800 {
3801 Parcel data = Parcel.obtain();
3802 Parcel reply = Parcel.obtain();
3803 data.writeInterfaceToken(IActivityManager.descriptor);
3804 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3805 reply.readException();
3806 int res = reply.readInt();
3807 data.recycle();
3808 reply.recycle();
3809 return res;
3810 }
3811 public void setProcessForeground(IBinder token, int pid,
3812 boolean isForeground) throws RemoteException {
3813 Parcel data = Parcel.obtain();
3814 Parcel reply = Parcel.obtain();
3815 data.writeInterfaceToken(IActivityManager.descriptor);
3816 data.writeStrongBinder(token);
3817 data.writeInt(pid);
3818 data.writeInt(isForeground ? 1 : 0);
3819 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3820 reply.readException();
3821 data.recycle();
3822 reply.recycle();
3823 }
3824 public int checkPermission(String permission, int pid, int uid)
3825 throws RemoteException {
3826 Parcel data = Parcel.obtain();
3827 Parcel reply = Parcel.obtain();
3828 data.writeInterfaceToken(IActivityManager.descriptor);
3829 data.writeString(permission);
3830 data.writeInt(pid);
3831 data.writeInt(uid);
3832 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3833 reply.readException();
3834 int res = reply.readInt();
3835 data.recycle();
3836 reply.recycle();
3837 return res;
3838 }
3839 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003840 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003841 Parcel data = Parcel.obtain();
3842 Parcel reply = Parcel.obtain();
3843 data.writeInterfaceToken(IActivityManager.descriptor);
3844 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003845 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003846 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003847 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3848 reply.readException();
3849 boolean res = reply.readInt() != 0;
3850 data.recycle();
3851 reply.recycle();
3852 return res;
3853 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003854 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003855 throws RemoteException {
3856 Parcel data = Parcel.obtain();
3857 Parcel reply = Parcel.obtain();
3858 data.writeInterfaceToken(IActivityManager.descriptor);
3859 uri.writeToParcel(data, 0);
3860 data.writeInt(pid);
3861 data.writeInt(uid);
3862 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003863 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003864 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3865 reply.readException();
3866 int res = reply.readInt();
3867 data.recycle();
3868 reply.recycle();
3869 return res;
3870 }
3871 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003872 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003873 Parcel data = Parcel.obtain();
3874 Parcel reply = Parcel.obtain();
3875 data.writeInterfaceToken(IActivityManager.descriptor);
3876 data.writeStrongBinder(caller.asBinder());
3877 data.writeString(targetPkg);
3878 uri.writeToParcel(data, 0);
3879 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003880 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003881 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3882 reply.readException();
3883 data.recycle();
3884 reply.recycle();
3885 }
3886 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003887 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003888 Parcel data = Parcel.obtain();
3889 Parcel reply = Parcel.obtain();
3890 data.writeInterfaceToken(IActivityManager.descriptor);
3891 data.writeStrongBinder(caller.asBinder());
3892 uri.writeToParcel(data, 0);
3893 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003894 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003895 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3896 reply.readException();
3897 data.recycle();
3898 reply.recycle();
3899 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003900
3901 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003902 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3903 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003904 Parcel data = Parcel.obtain();
3905 Parcel reply = Parcel.obtain();
3906 data.writeInterfaceToken(IActivityManager.descriptor);
3907 uri.writeToParcel(data, 0);
3908 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003909 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003910 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3911 reply.readException();
3912 data.recycle();
3913 reply.recycle();
3914 }
3915
3916 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003917 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3918 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003919 Parcel data = Parcel.obtain();
3920 Parcel reply = Parcel.obtain();
3921 data.writeInterfaceToken(IActivityManager.descriptor);
3922 uri.writeToParcel(data, 0);
3923 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003924 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003925 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3926 reply.readException();
3927 data.recycle();
3928 reply.recycle();
3929 }
3930
3931 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003932 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3933 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003934 Parcel data = Parcel.obtain();
3935 Parcel reply = Parcel.obtain();
3936 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003937 data.writeString(packageName);
3938 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003939 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3940 reply.readException();
3941 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3942 reply);
3943 data.recycle();
3944 reply.recycle();
3945 return perms;
3946 }
3947
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003948 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3949 throws RemoteException {
3950 Parcel data = Parcel.obtain();
3951 Parcel reply = Parcel.obtain();
3952 data.writeInterfaceToken(IActivityManager.descriptor);
3953 data.writeStrongBinder(who.asBinder());
3954 data.writeInt(waiting ? 1 : 0);
3955 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3956 reply.readException();
3957 data.recycle();
3958 reply.recycle();
3959 }
3960 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3961 Parcel data = Parcel.obtain();
3962 Parcel reply = Parcel.obtain();
3963 data.writeInterfaceToken(IActivityManager.descriptor);
3964 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3965 reply.readException();
3966 outInfo.readFromParcel(reply);
3967 data.recycle();
3968 reply.recycle();
3969 }
3970 public void unhandledBack() throws RemoteException
3971 {
3972 Parcel data = Parcel.obtain();
3973 Parcel reply = Parcel.obtain();
3974 data.writeInterfaceToken(IActivityManager.descriptor);
3975 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3976 reply.readException();
3977 data.recycle();
3978 reply.recycle();
3979 }
3980 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3981 {
3982 Parcel data = Parcel.obtain();
3983 Parcel reply = Parcel.obtain();
3984 data.writeInterfaceToken(IActivityManager.descriptor);
3985 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3986 reply.readException();
3987 ParcelFileDescriptor pfd = null;
3988 if (reply.readInt() != 0) {
3989 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3990 }
3991 data.recycle();
3992 reply.recycle();
3993 return pfd;
3994 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003995 public void setLockScreenShown(boolean shown) throws RemoteException
3996 {
3997 Parcel data = Parcel.obtain();
3998 Parcel reply = Parcel.obtain();
3999 data.writeInterfaceToken(IActivityManager.descriptor);
4000 data.writeInt(shown ? 1 : 0);
4001 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4002 reply.readException();
4003 data.recycle();
4004 reply.recycle();
4005 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004006 public void setDebugApp(
4007 String packageName, boolean waitForDebugger, boolean persistent)
4008 throws RemoteException
4009 {
4010 Parcel data = Parcel.obtain();
4011 Parcel reply = Parcel.obtain();
4012 data.writeInterfaceToken(IActivityManager.descriptor);
4013 data.writeString(packageName);
4014 data.writeInt(waitForDebugger ? 1 : 0);
4015 data.writeInt(persistent ? 1 : 0);
4016 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4017 reply.readException();
4018 data.recycle();
4019 reply.recycle();
4020 }
4021 public void setAlwaysFinish(boolean enabled) throws RemoteException
4022 {
4023 Parcel data = Parcel.obtain();
4024 Parcel reply = Parcel.obtain();
4025 data.writeInterfaceToken(IActivityManager.descriptor);
4026 data.writeInt(enabled ? 1 : 0);
4027 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4028 reply.readException();
4029 data.recycle();
4030 reply.recycle();
4031 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004032 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004033 {
4034 Parcel data = Parcel.obtain();
4035 Parcel reply = Parcel.obtain();
4036 data.writeInterfaceToken(IActivityManager.descriptor);
4037 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004038 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004039 reply.readException();
4040 data.recycle();
4041 reply.recycle();
4042 }
4043 public void enterSafeMode() throws RemoteException {
4044 Parcel data = Parcel.obtain();
4045 data.writeInterfaceToken(IActivityManager.descriptor);
4046 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4047 data.recycle();
4048 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08004049 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
4050 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004051 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004052 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004053 data.writeStrongBinder(sender.asBinder());
4054 data.writeInt(sourceUid);
4055 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004056 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4057 data.recycle();
4058 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004059 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004060 Parcel data = Parcel.obtain();
4061 Parcel reply = Parcel.obtain();
4062 data.writeInterfaceToken(IActivityManager.descriptor);
4063 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004064 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004065 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004066 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004067 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004068 boolean res = reply.readInt() != 0;
4069 data.recycle();
4070 reply.recycle();
4071 return res;
4072 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004073 @Override
4074 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4075 Parcel data = Parcel.obtain();
4076 Parcel reply = Parcel.obtain();
4077 data.writeInterfaceToken(IActivityManager.descriptor);
4078 data.writeString(reason);
4079 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4080 boolean res = reply.readInt() != 0;
4081 data.recycle();
4082 reply.recycle();
4083 return res;
4084 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004085 public boolean testIsSystemReady()
4086 {
4087 /* this base class version is never called */
4088 return true;
4089 }
Dan Egnor60d87622009-12-16 16:32:58 -08004090 public void handleApplicationCrash(IBinder app,
4091 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4092 {
4093 Parcel data = Parcel.obtain();
4094 Parcel reply = Parcel.obtain();
4095 data.writeInterfaceToken(IActivityManager.descriptor);
4096 data.writeStrongBinder(app);
4097 crashInfo.writeToParcel(data, 0);
4098 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4099 reply.readException();
4100 reply.recycle();
4101 data.recycle();
4102 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004103
Dianne Hackborn52322712014-08-26 22:47:26 -07004104 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004105 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004106 {
4107 Parcel data = Parcel.obtain();
4108 Parcel reply = Parcel.obtain();
4109 data.writeInterfaceToken(IActivityManager.descriptor);
4110 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004111 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004112 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004113 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004114 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004115 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004116 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004117 reply.recycle();
4118 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004119 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004120 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004121
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004122 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004123 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004124 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004125 {
4126 Parcel data = Parcel.obtain();
4127 Parcel reply = Parcel.obtain();
4128 data.writeInterfaceToken(IActivityManager.descriptor);
4129 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004130 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004131 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004132 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4133 reply.readException();
4134 reply.recycle();
4135 data.recycle();
4136 }
4137
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004138 public void signalPersistentProcesses(int sig) throws RemoteException {
4139 Parcel data = Parcel.obtain();
4140 Parcel reply = Parcel.obtain();
4141 data.writeInterfaceToken(IActivityManager.descriptor);
4142 data.writeInt(sig);
4143 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4144 reply.readException();
4145 data.recycle();
4146 reply.recycle();
4147 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004148
Dianne Hackborn1676c852012-09-10 14:52:30 -07004149 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004150 Parcel data = Parcel.obtain();
4151 Parcel reply = Parcel.obtain();
4152 data.writeInterfaceToken(IActivityManager.descriptor);
4153 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004154 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004155 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4156 reply.readException();
4157 data.recycle();
4158 reply.recycle();
4159 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004160
4161 public void killAllBackgroundProcesses() throws RemoteException {
4162 Parcel data = Parcel.obtain();
4163 Parcel reply = Parcel.obtain();
4164 data.writeInterfaceToken(IActivityManager.descriptor);
4165 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4166 reply.readException();
4167 data.recycle();
4168 reply.recycle();
4169 }
4170
Dianne Hackborn1676c852012-09-10 14:52:30 -07004171 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004172 Parcel data = Parcel.obtain();
4173 Parcel reply = Parcel.obtain();
4174 data.writeInterfaceToken(IActivityManager.descriptor);
4175 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004176 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004177 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004178 reply.readException();
4179 data.recycle();
4180 reply.recycle();
4181 }
4182
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004183 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4184 throws RemoteException
4185 {
4186 Parcel data = Parcel.obtain();
4187 Parcel reply = Parcel.obtain();
4188 data.writeInterfaceToken(IActivityManager.descriptor);
4189 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4190 reply.readException();
4191 outInfo.readFromParcel(reply);
4192 reply.recycle();
4193 data.recycle();
4194 }
4195
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004196 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4197 {
4198 Parcel data = Parcel.obtain();
4199 Parcel reply = Parcel.obtain();
4200 data.writeInterfaceToken(IActivityManager.descriptor);
4201 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4202 reply.readException();
4203 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4204 reply.recycle();
4205 data.recycle();
4206 return res;
4207 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004208
Dianne Hackborn1676c852012-09-10 14:52:30 -07004209 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004210 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004211 {
4212 Parcel data = Parcel.obtain();
4213 Parcel reply = Parcel.obtain();
4214 data.writeInterfaceToken(IActivityManager.descriptor);
4215 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004216 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004217 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004218 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004219 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004220 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004221 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004222 } else {
4223 data.writeInt(0);
4224 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004225 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4226 reply.readException();
4227 boolean res = reply.readInt() != 0;
4228 reply.recycle();
4229 data.recycle();
4230 return res;
4231 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004232
Dianne Hackborn55280a92009-05-07 15:53:46 -07004233 public boolean shutdown(int timeout) throws RemoteException
4234 {
4235 Parcel data = Parcel.obtain();
4236 Parcel reply = Parcel.obtain();
4237 data.writeInterfaceToken(IActivityManager.descriptor);
4238 data.writeInt(timeout);
4239 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4240 reply.readException();
4241 boolean res = reply.readInt() != 0;
4242 reply.recycle();
4243 data.recycle();
4244 return res;
4245 }
4246
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004247 public void stopAppSwitches() throws RemoteException {
4248 Parcel data = Parcel.obtain();
4249 Parcel reply = Parcel.obtain();
4250 data.writeInterfaceToken(IActivityManager.descriptor);
4251 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4252 reply.readException();
4253 reply.recycle();
4254 data.recycle();
4255 }
4256
4257 public void resumeAppSwitches() throws RemoteException {
4258 Parcel data = Parcel.obtain();
4259 Parcel reply = Parcel.obtain();
4260 data.writeInterfaceToken(IActivityManager.descriptor);
4261 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4262 reply.readException();
4263 reply.recycle();
4264 data.recycle();
4265 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004266
4267 public void addPackageDependency(String packageName) throws RemoteException {
4268 Parcel data = Parcel.obtain();
4269 Parcel reply = Parcel.obtain();
4270 data.writeInterfaceToken(IActivityManager.descriptor);
4271 data.writeString(packageName);
4272 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4273 reply.readException();
4274 data.recycle();
4275 reply.recycle();
4276 }
4277
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004278 public void killApplicationWithAppId(String pkg, int appid, String reason)
4279 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004280 Parcel data = Parcel.obtain();
4281 Parcel reply = Parcel.obtain();
4282 data.writeInterfaceToken(IActivityManager.descriptor);
4283 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004284 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004285 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004286 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004287 reply.readException();
4288 data.recycle();
4289 reply.recycle();
4290 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004291
4292 public void closeSystemDialogs(String reason) throws RemoteException {
4293 Parcel data = Parcel.obtain();
4294 Parcel reply = Parcel.obtain();
4295 data.writeInterfaceToken(IActivityManager.descriptor);
4296 data.writeString(reason);
4297 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4298 reply.readException();
4299 data.recycle();
4300 reply.recycle();
4301 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004302
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004303 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004304 throws RemoteException {
4305 Parcel data = Parcel.obtain();
4306 Parcel reply = Parcel.obtain();
4307 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004308 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004309 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4310 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004311 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004312 data.recycle();
4313 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004314 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004315 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004316
4317 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4318 Parcel data = Parcel.obtain();
4319 Parcel reply = Parcel.obtain();
4320 data.writeInterfaceToken(IActivityManager.descriptor);
4321 data.writeString(processName);
4322 data.writeInt(uid);
4323 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4324 reply.readException();
4325 data.recycle();
4326 reply.recycle();
4327 }
4328
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004329 public void overridePendingTransition(IBinder token, String packageName,
4330 int enterAnim, int exitAnim) throws RemoteException {
4331 Parcel data = Parcel.obtain();
4332 Parcel reply = Parcel.obtain();
4333 data.writeInterfaceToken(IActivityManager.descriptor);
4334 data.writeStrongBinder(token);
4335 data.writeString(packageName);
4336 data.writeInt(enterAnim);
4337 data.writeInt(exitAnim);
4338 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4339 reply.readException();
4340 data.recycle();
4341 reply.recycle();
4342 }
4343
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004344 public boolean isUserAMonkey() throws RemoteException {
4345 Parcel data = Parcel.obtain();
4346 Parcel reply = Parcel.obtain();
4347 data.writeInterfaceToken(IActivityManager.descriptor);
4348 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4349 reply.readException();
4350 boolean res = reply.readInt() != 0;
4351 data.recycle();
4352 reply.recycle();
4353 return res;
4354 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004355
4356 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4357 Parcel data = Parcel.obtain();
4358 Parcel reply = Parcel.obtain();
4359 data.writeInterfaceToken(IActivityManager.descriptor);
4360 data.writeInt(monkey ? 1 : 0);
4361 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4362 reply.readException();
4363 data.recycle();
4364 reply.recycle();
4365 }
4366
Dianne Hackborn860755f2010-06-03 18:47:52 -07004367 public void finishHeavyWeightApp() throws RemoteException {
4368 Parcel data = Parcel.obtain();
4369 Parcel reply = Parcel.obtain();
4370 data.writeInterfaceToken(IActivityManager.descriptor);
4371 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4372 reply.readException();
4373 data.recycle();
4374 reply.recycle();
4375 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004376
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004377 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004378 throws RemoteException {
4379 Parcel data = Parcel.obtain();
4380 Parcel reply = Parcel.obtain();
4381 data.writeInterfaceToken(IActivityManager.descriptor);
4382 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004383 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4384 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004385 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004386 data.recycle();
4387 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004388 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004389 }
4390
Craig Mautner233ceee2014-05-09 17:05:11 -07004391 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004392 throws RemoteException {
4393 Parcel data = Parcel.obtain();
4394 Parcel reply = Parcel.obtain();
4395 data.writeInterfaceToken(IActivityManager.descriptor);
4396 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004397 if (options == null) {
4398 data.writeInt(0);
4399 } else {
4400 data.writeInt(1);
4401 data.writeBundle(options.toBundle());
4402 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004403 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004404 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004405 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004406 data.recycle();
4407 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004408 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004409 }
4410
Craig Mautner233ceee2014-05-09 17:05:11 -07004411 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4412 Parcel data = Parcel.obtain();
4413 Parcel reply = Parcel.obtain();
4414 data.writeInterfaceToken(IActivityManager.descriptor);
4415 data.writeStrongBinder(token);
4416 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4417 reply.readException();
4418 Bundle bundle = reply.readBundle();
4419 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4420 data.recycle();
4421 reply.recycle();
4422 return options;
4423 }
4424
Daniel Sandler69a48172010-06-23 16:29:36 -04004425 public void setImmersive(IBinder token, boolean immersive)
4426 throws RemoteException {
4427 Parcel data = Parcel.obtain();
4428 Parcel reply = Parcel.obtain();
4429 data.writeInterfaceToken(IActivityManager.descriptor);
4430 data.writeStrongBinder(token);
4431 data.writeInt(immersive ? 1 : 0);
4432 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4433 reply.readException();
4434 data.recycle();
4435 reply.recycle();
4436 }
4437
4438 public boolean isImmersive(IBinder token)
4439 throws RemoteException {
4440 Parcel data = Parcel.obtain();
4441 Parcel reply = Parcel.obtain();
4442 data.writeInterfaceToken(IActivityManager.descriptor);
4443 data.writeStrongBinder(token);
4444 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004445 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004446 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004447 data.recycle();
4448 reply.recycle();
4449 return res;
4450 }
4451
Craig Mautnerd61dc202014-07-07 11:09:11 -07004452 public boolean isTopOfTask(IBinder token) throws RemoteException {
4453 Parcel data = Parcel.obtain();
4454 Parcel reply = Parcel.obtain();
4455 data.writeInterfaceToken(IActivityManager.descriptor);
4456 data.writeStrongBinder(token);
4457 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4458 reply.readException();
4459 boolean res = reply.readInt() == 1;
4460 data.recycle();
4461 reply.recycle();
4462 return res;
4463 }
4464
Daniel Sandler69a48172010-06-23 16:29:36 -04004465 public boolean isTopActivityImmersive()
4466 throws RemoteException {
4467 Parcel data = Parcel.obtain();
4468 Parcel reply = Parcel.obtain();
4469 data.writeInterfaceToken(IActivityManager.descriptor);
4470 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004471 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004472 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004473 data.recycle();
4474 reply.recycle();
4475 return res;
4476 }
4477
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004478 public void crashApplication(int uid, int initialPid, String packageName,
4479 String message) throws RemoteException {
4480 Parcel data = Parcel.obtain();
4481 Parcel reply = Parcel.obtain();
4482 data.writeInterfaceToken(IActivityManager.descriptor);
4483 data.writeInt(uid);
4484 data.writeInt(initialPid);
4485 data.writeString(packageName);
4486 data.writeString(message);
4487 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4488 reply.readException();
4489 data.recycle();
4490 reply.recycle();
4491 }
Andy McFadden824c5102010-07-09 16:26:57 -07004492
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004493 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004494 Parcel data = Parcel.obtain();
4495 Parcel reply = Parcel.obtain();
4496 data.writeInterfaceToken(IActivityManager.descriptor);
4497 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004498 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004499 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4500 reply.readException();
4501 String res = reply.readString();
4502 data.recycle();
4503 reply.recycle();
4504 return res;
4505 }
4506
Dianne Hackborn7e269642010-08-25 19:50:20 -07004507 public IBinder newUriPermissionOwner(String name)
4508 throws RemoteException {
4509 Parcel data = Parcel.obtain();
4510 Parcel reply = Parcel.obtain();
4511 data.writeInterfaceToken(IActivityManager.descriptor);
4512 data.writeString(name);
4513 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4514 reply.readException();
4515 IBinder res = reply.readStrongBinder();
4516 data.recycle();
4517 reply.recycle();
4518 return res;
4519 }
4520
4521 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004522 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004523 Parcel data = Parcel.obtain();
4524 Parcel reply = Parcel.obtain();
4525 data.writeInterfaceToken(IActivityManager.descriptor);
4526 data.writeStrongBinder(owner);
4527 data.writeInt(fromUid);
4528 data.writeString(targetPkg);
4529 uri.writeToParcel(data, 0);
4530 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004531 data.writeInt(sourceUserId);
4532 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004533 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4534 reply.readException();
4535 data.recycle();
4536 reply.recycle();
4537 }
4538
4539 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004540 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004541 Parcel data = Parcel.obtain();
4542 Parcel reply = Parcel.obtain();
4543 data.writeInterfaceToken(IActivityManager.descriptor);
4544 data.writeStrongBinder(owner);
4545 if (uri != null) {
4546 data.writeInt(1);
4547 uri.writeToParcel(data, 0);
4548 } else {
4549 data.writeInt(0);
4550 }
4551 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004552 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004553 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4554 reply.readException();
4555 data.recycle();
4556 reply.recycle();
4557 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004558
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004559 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004560 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004561 Parcel data = Parcel.obtain();
4562 Parcel reply = Parcel.obtain();
4563 data.writeInterfaceToken(IActivityManager.descriptor);
4564 data.writeInt(callingUid);
4565 data.writeString(targetPkg);
4566 uri.writeToParcel(data, 0);
4567 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004568 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004569 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4570 reply.readException();
4571 int res = reply.readInt();
4572 data.recycle();
4573 reply.recycle();
4574 return res;
4575 }
4576
Dianne Hackborn1676c852012-09-10 14:52:30 -07004577 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004578 String path, ParcelFileDescriptor fd) throws RemoteException {
4579 Parcel data = Parcel.obtain();
4580 Parcel reply = Parcel.obtain();
4581 data.writeInterfaceToken(IActivityManager.descriptor);
4582 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004583 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004584 data.writeInt(managed ? 1 : 0);
4585 data.writeString(path);
4586 if (fd != null) {
4587 data.writeInt(1);
4588 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4589 } else {
4590 data.writeInt(0);
4591 }
4592 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4593 reply.readException();
4594 boolean res = reply.readInt() != 0;
4595 reply.recycle();
4596 data.recycle();
4597 return res;
4598 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004599
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004600 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004601 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004602 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004603 Parcel data = Parcel.obtain();
4604 Parcel reply = Parcel.obtain();
4605 data.writeInterfaceToken(IActivityManager.descriptor);
4606 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004607 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004608 data.writeTypedArray(intents, 0);
4609 data.writeStringArray(resolvedTypes);
4610 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004611 if (options != null) {
4612 data.writeInt(1);
4613 options.writeToParcel(data, 0);
4614 } else {
4615 data.writeInt(0);
4616 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004617 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004618 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4619 reply.readException();
4620 int result = reply.readInt();
4621 reply.recycle();
4622 data.recycle();
4623 return result;
4624 }
4625
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004626 public int getFrontActivityScreenCompatMode() throws RemoteException {
4627 Parcel data = Parcel.obtain();
4628 Parcel reply = Parcel.obtain();
4629 data.writeInterfaceToken(IActivityManager.descriptor);
4630 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4631 reply.readException();
4632 int mode = reply.readInt();
4633 reply.recycle();
4634 data.recycle();
4635 return mode;
4636 }
4637
4638 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4639 Parcel data = Parcel.obtain();
4640 Parcel reply = Parcel.obtain();
4641 data.writeInterfaceToken(IActivityManager.descriptor);
4642 data.writeInt(mode);
4643 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4644 reply.readException();
4645 reply.recycle();
4646 data.recycle();
4647 }
4648
4649 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4650 Parcel data = Parcel.obtain();
4651 Parcel reply = Parcel.obtain();
4652 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004653 data.writeString(packageName);
4654 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004655 reply.readException();
4656 int mode = reply.readInt();
4657 reply.recycle();
4658 data.recycle();
4659 return mode;
4660 }
4661
4662 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004663 throws RemoteException {
4664 Parcel data = Parcel.obtain();
4665 Parcel reply = Parcel.obtain();
4666 data.writeInterfaceToken(IActivityManager.descriptor);
4667 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004668 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004669 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4670 reply.readException();
4671 reply.recycle();
4672 data.recycle();
4673 }
4674
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004675 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4676 Parcel data = Parcel.obtain();
4677 Parcel reply = Parcel.obtain();
4678 data.writeInterfaceToken(IActivityManager.descriptor);
4679 data.writeString(packageName);
4680 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4681 reply.readException();
4682 boolean ask = reply.readInt() != 0;
4683 reply.recycle();
4684 data.recycle();
4685 return ask;
4686 }
4687
4688 public void setPackageAskScreenCompat(String packageName, boolean ask)
4689 throws RemoteException {
4690 Parcel data = Parcel.obtain();
4691 Parcel reply = Parcel.obtain();
4692 data.writeInterfaceToken(IActivityManager.descriptor);
4693 data.writeString(packageName);
4694 data.writeInt(ask ? 1 : 0);
4695 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4696 reply.readException();
4697 reply.recycle();
4698 data.recycle();
4699 }
4700
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004701 public boolean switchUser(int userid) throws RemoteException {
4702 Parcel data = Parcel.obtain();
4703 Parcel reply = Parcel.obtain();
4704 data.writeInterfaceToken(IActivityManager.descriptor);
4705 data.writeInt(userid);
4706 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4707 reply.readException();
4708 boolean result = reply.readInt() != 0;
4709 reply.recycle();
4710 data.recycle();
4711 return result;
4712 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004713
Kenny Guy08488bf2014-02-21 17:40:37 +00004714 public boolean startUserInBackground(int userid) throws RemoteException {
4715 Parcel data = Parcel.obtain();
4716 Parcel reply = Parcel.obtain();
4717 data.writeInterfaceToken(IActivityManager.descriptor);
4718 data.writeInt(userid);
4719 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4720 reply.readException();
4721 boolean result = reply.readInt() != 0;
4722 reply.recycle();
4723 data.recycle();
4724 return result;
4725 }
4726
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004727 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4728 Parcel data = Parcel.obtain();
4729 Parcel reply = Parcel.obtain();
4730 data.writeInterfaceToken(IActivityManager.descriptor);
4731 data.writeInt(userid);
4732 data.writeStrongInterface(callback);
4733 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4734 reply.readException();
4735 int result = reply.readInt();
4736 reply.recycle();
4737 data.recycle();
4738 return result;
4739 }
4740
Amith Yamasani52f1d752012-03-28 18:19:29 -07004741 public UserInfo getCurrentUser() throws RemoteException {
4742 Parcel data = Parcel.obtain();
4743 Parcel reply = Parcel.obtain();
4744 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004745 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004746 reply.readException();
4747 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4748 reply.recycle();
4749 data.recycle();
4750 return userInfo;
4751 }
4752
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004753 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004754 Parcel data = Parcel.obtain();
4755 Parcel reply = Parcel.obtain();
4756 data.writeInterfaceToken(IActivityManager.descriptor);
4757 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004758 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004759 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4760 reply.readException();
4761 boolean result = reply.readInt() != 0;
4762 reply.recycle();
4763 data.recycle();
4764 return result;
4765 }
4766
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004767 public int[] getRunningUserIds() throws RemoteException {
4768 Parcel data = Parcel.obtain();
4769 Parcel reply = Parcel.obtain();
4770 data.writeInterfaceToken(IActivityManager.descriptor);
4771 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4772 reply.readException();
4773 int[] result = reply.createIntArray();
4774 reply.recycle();
4775 data.recycle();
4776 return result;
4777 }
4778
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004779 public boolean removeTask(int taskId, int flags) throws RemoteException {
4780 Parcel data = Parcel.obtain();
4781 Parcel reply = Parcel.obtain();
4782 data.writeInterfaceToken(IActivityManager.descriptor);
4783 data.writeInt(taskId);
4784 data.writeInt(flags);
4785 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4786 reply.readException();
4787 boolean result = reply.readInt() != 0;
4788 reply.recycle();
4789 data.recycle();
4790 return result;
4791 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004792
Jeff Sharkeya4620792011-05-20 15:29:23 -07004793 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4794 Parcel data = Parcel.obtain();
4795 Parcel reply = Parcel.obtain();
4796 data.writeInterfaceToken(IActivityManager.descriptor);
4797 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4798 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4799 reply.readException();
4800 data.recycle();
4801 reply.recycle();
4802 }
4803
4804 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4805 Parcel data = Parcel.obtain();
4806 Parcel reply = Parcel.obtain();
4807 data.writeInterfaceToken(IActivityManager.descriptor);
4808 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4809 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4810 reply.readException();
4811 data.recycle();
4812 reply.recycle();
4813 }
4814
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004815 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4816 Parcel data = Parcel.obtain();
4817 Parcel reply = Parcel.obtain();
4818 data.writeInterfaceToken(IActivityManager.descriptor);
4819 data.writeStrongBinder(sender.asBinder());
4820 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4821 reply.readException();
4822 boolean res = reply.readInt() != 0;
4823 data.recycle();
4824 reply.recycle();
4825 return res;
4826 }
4827
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004828 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4829 Parcel data = Parcel.obtain();
4830 Parcel reply = Parcel.obtain();
4831 data.writeInterfaceToken(IActivityManager.descriptor);
4832 data.writeStrongBinder(sender.asBinder());
4833 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4834 reply.readException();
4835 boolean res = reply.readInt() != 0;
4836 data.recycle();
4837 reply.recycle();
4838 return res;
4839 }
4840
Dianne Hackborn81038902012-11-26 17:04:09 -08004841 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4842 Parcel data = Parcel.obtain();
4843 Parcel reply = Parcel.obtain();
4844 data.writeInterfaceToken(IActivityManager.descriptor);
4845 data.writeStrongBinder(sender.asBinder());
4846 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4847 reply.readException();
4848 Intent res = reply.readInt() != 0
4849 ? Intent.CREATOR.createFromParcel(reply) : null;
4850 data.recycle();
4851 reply.recycle();
4852 return res;
4853 }
4854
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004855 public String getTagForIntentSender(IIntentSender sender, String prefix)
4856 throws RemoteException {
4857 Parcel data = Parcel.obtain();
4858 Parcel reply = Parcel.obtain();
4859 data.writeInterfaceToken(IActivityManager.descriptor);
4860 data.writeStrongBinder(sender.asBinder());
4861 data.writeString(prefix);
4862 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4863 reply.readException();
4864 String res = reply.readString();
4865 data.recycle();
4866 reply.recycle();
4867 return res;
4868 }
4869
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004870 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4871 {
4872 Parcel data = Parcel.obtain();
4873 Parcel reply = Parcel.obtain();
4874 data.writeInterfaceToken(IActivityManager.descriptor);
4875 values.writeToParcel(data, 0);
4876 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4877 reply.readException();
4878 data.recycle();
4879 reply.recycle();
4880 }
4881
Dianne Hackbornb437e092011-08-05 17:50:29 -07004882 public long[] getProcessPss(int[] pids) throws RemoteException {
4883 Parcel data = Parcel.obtain();
4884 Parcel reply = Parcel.obtain();
4885 data.writeInterfaceToken(IActivityManager.descriptor);
4886 data.writeIntArray(pids);
4887 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4888 reply.readException();
4889 long[] res = reply.createLongArray();
4890 data.recycle();
4891 reply.recycle();
4892 return res;
4893 }
4894
Dianne Hackborn661cd522011-08-22 00:26:20 -07004895 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4896 Parcel data = Parcel.obtain();
4897 Parcel reply = Parcel.obtain();
4898 data.writeInterfaceToken(IActivityManager.descriptor);
4899 TextUtils.writeToParcel(msg, data, 0);
4900 data.writeInt(always ? 1 : 0);
4901 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4902 reply.readException();
4903 data.recycle();
4904 reply.recycle();
4905 }
4906
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004907 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004908 Parcel data = Parcel.obtain();
4909 Parcel reply = Parcel.obtain();
4910 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004911 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004912 reply.readException();
4913 data.recycle();
4914 reply.recycle();
4915 }
4916
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004917 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07004918 throws RemoteException {
4919 Parcel data = Parcel.obtain();
4920 Parcel reply = Parcel.obtain();
4921 data.writeInterfaceToken(IActivityManager.descriptor);
4922 data.writeStrongBinder(token);
4923 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004924 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07004925 reply.readException();
4926 boolean result = reply.readInt() != 0;
4927 data.recycle();
4928 reply.recycle();
4929 return result;
4930 }
4931
4932 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4933 throws RemoteException {
4934 Parcel data = Parcel.obtain();
4935 Parcel reply = Parcel.obtain();
4936 data.writeInterfaceToken(IActivityManager.descriptor);
4937 data.writeStrongBinder(token);
4938 target.writeToParcel(data, 0);
4939 data.writeInt(resultCode);
4940 if (resultData != null) {
4941 data.writeInt(1);
4942 resultData.writeToParcel(data, 0);
4943 } else {
4944 data.writeInt(0);
4945 }
4946 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4947 reply.readException();
4948 boolean result = reply.readInt() != 0;
4949 data.recycle();
4950 reply.recycle();
4951 return result;
4952 }
4953
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004954 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4955 Parcel data = Parcel.obtain();
4956 Parcel reply = Parcel.obtain();
4957 data.writeInterfaceToken(IActivityManager.descriptor);
4958 data.writeStrongBinder(activityToken);
4959 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4960 reply.readException();
4961 int result = reply.readInt();
4962 data.recycle();
4963 reply.recycle();
4964 return result;
4965 }
4966
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004967 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4968 Parcel data = Parcel.obtain();
4969 Parcel reply = Parcel.obtain();
4970 data.writeInterfaceToken(IActivityManager.descriptor);
4971 data.writeStrongBinder(activityToken);
4972 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4973 reply.readException();
4974 String result = reply.readString();
4975 data.recycle();
4976 reply.recycle();
4977 return result;
4978 }
4979
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004980 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4981 Parcel data = Parcel.obtain();
4982 Parcel reply = Parcel.obtain();
4983 data.writeInterfaceToken(IActivityManager.descriptor);
4984 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4985 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4986 reply.readException();
4987 data.recycle();
4988 reply.recycle();
4989 }
4990
4991 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4992 Parcel data = Parcel.obtain();
4993 Parcel reply = Parcel.obtain();
4994 data.writeInterfaceToken(IActivityManager.descriptor);
4995 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4996 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4997 reply.readException();
4998 data.recycle();
4999 reply.recycle();
5000 }
5001
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005002 public void requestBugReport() throws RemoteException {
5003 Parcel data = Parcel.obtain();
5004 Parcel reply = Parcel.obtain();
5005 data.writeInterfaceToken(IActivityManager.descriptor);
5006 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5007 reply.readException();
5008 data.recycle();
5009 reply.recycle();
5010 }
5011
Jeff Brownbd181bb2013-09-10 16:44:24 -07005012 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5013 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005014 Parcel data = Parcel.obtain();
5015 Parcel reply = Parcel.obtain();
5016 data.writeInterfaceToken(IActivityManager.descriptor);
5017 data.writeInt(pid);
5018 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005019 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005020 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5021 reply.readException();
5022 long res = reply.readInt();
5023 data.recycle();
5024 reply.recycle();
5025 return res;
5026 }
5027
Adam Skorydfc7fd72013-08-05 19:23:41 -07005028 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005029 Parcel data = Parcel.obtain();
5030 Parcel reply = Parcel.obtain();
5031 data.writeInterfaceToken(IActivityManager.descriptor);
5032 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005033 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005034 reply.readException();
5035 Bundle res = reply.readBundle();
5036 data.recycle();
5037 reply.recycle();
5038 return res;
5039 }
5040
Adam Skory7140a252013-09-11 12:04:58 +01005041 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005042 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005043 Parcel data = Parcel.obtain();
5044 Parcel reply = Parcel.obtain();
5045 data.writeInterfaceToken(IActivityManager.descriptor);
5046 data.writeStrongBinder(token);
5047 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005048 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005049 reply.readException();
5050 data.recycle();
5051 reply.recycle();
5052 }
5053
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005054 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
5055 throws RemoteException {
5056 Parcel data = Parcel.obtain();
5057 Parcel reply = Parcel.obtain();
5058 data.writeInterfaceToken(IActivityManager.descriptor);
5059 intent.writeToParcel(data, 0);
5060 data.writeInt(requestType);
5061 data.writeString(hint);
5062 data.writeInt(userHandle);
5063 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5064 reply.readException();
5065 boolean res = reply.readInt() != 0;
5066 data.recycle();
5067 reply.recycle();
5068 return res;
5069 }
5070
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005071 public void killUid(int uid, String reason) throws RemoteException {
5072 Parcel data = Parcel.obtain();
5073 Parcel reply = Parcel.obtain();
5074 data.writeInterfaceToken(IActivityManager.descriptor);
5075 data.writeInt(uid);
5076 data.writeString(reason);
5077 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5078 reply.readException();
5079 data.recycle();
5080 reply.recycle();
5081 }
5082
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005083 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5084 Parcel data = Parcel.obtain();
5085 Parcel reply = Parcel.obtain();
5086 data.writeInterfaceToken(IActivityManager.descriptor);
5087 data.writeStrongBinder(who);
5088 data.writeInt(allowRestart ? 1 : 0);
5089 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5090 reply.readException();
5091 data.recycle();
5092 reply.recycle();
5093 }
5094
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005095 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5096 Parcel data = Parcel.obtain();
5097 Parcel reply = Parcel.obtain();
5098 data.writeInterfaceToken(IActivityManager.descriptor);
5099 data.writeStrongBinder(token);
5100 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5101 reply.readException();
5102 data.recycle();
5103 reply.recycle();
5104 }
5105
Craig Mautner5eda9b32013-07-02 11:58:16 -07005106 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5107 Parcel data = Parcel.obtain();
5108 Parcel reply = Parcel.obtain();
5109 data.writeInterfaceToken(IActivityManager.descriptor);
5110 data.writeStrongBinder(token);
5111 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5112 reply.readException();
5113 data.recycle();
5114 reply.recycle();
5115 }
5116
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005117 public void restart() throws RemoteException {
5118 Parcel data = Parcel.obtain();
5119 Parcel reply = Parcel.obtain();
5120 data.writeInterfaceToken(IActivityManager.descriptor);
5121 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5122 reply.readException();
5123 data.recycle();
5124 reply.recycle();
5125 }
5126
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005127 public void performIdleMaintenance() throws RemoteException {
5128 Parcel data = Parcel.obtain();
5129 Parcel reply = Parcel.obtain();
5130 data.writeInterfaceToken(IActivityManager.descriptor);
5131 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5132 reply.readException();
5133 data.recycle();
5134 reply.recycle();
5135 }
5136
Craig Mautner4a1cb222013-12-04 16:14:06 -08005137 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
5138 IActivityContainerCallback callback) throws RemoteException {
5139 Parcel data = Parcel.obtain();
5140 Parcel reply = Parcel.obtain();
5141 data.writeInterfaceToken(IActivityManager.descriptor);
5142 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005143 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08005144 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5145 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005146 final int result = reply.readInt();
5147 final IActivityContainer res;
5148 if (result == 1) {
5149 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5150 } else {
5151 res = null;
5152 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005153 data.recycle();
5154 reply.recycle();
5155 return res;
5156 }
5157
Craig Mautner95da1082014-02-24 17:54:35 -08005158 public void deleteActivityContainer(IActivityContainer activityContainer)
5159 throws RemoteException {
5160 Parcel data = Parcel.obtain();
5161 Parcel reply = Parcel.obtain();
5162 data.writeInterfaceToken(IActivityManager.descriptor);
5163 data.writeStrongBinder(activityContainer.asBinder());
5164 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5165 reply.readException();
5166 data.recycle();
5167 reply.recycle();
5168 }
5169
Craig Mautnere0a38842013-12-16 16:14:02 -08005170 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
5171 throws RemoteException {
5172 Parcel data = Parcel.obtain();
5173 Parcel reply = Parcel.obtain();
5174 data.writeInterfaceToken(IActivityManager.descriptor);
5175 data.writeStrongBinder(activityToken);
5176 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5177 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005178 final int result = reply.readInt();
5179 final IActivityContainer res;
5180 if (result == 1) {
5181 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5182 } else {
5183 res = null;
5184 }
Craig Mautnere0a38842013-12-16 16:14:02 -08005185 data.recycle();
5186 reply.recycle();
5187 return res;
5188 }
5189
Craig Mautner4a1cb222013-12-04 16:14:06 -08005190 public IBinder getHomeActivityToken() throws RemoteException {
5191 Parcel data = Parcel.obtain();
5192 Parcel reply = Parcel.obtain();
5193 data.writeInterfaceToken(IActivityManager.descriptor);
5194 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5195 reply.readException();
5196 IBinder res = reply.readStrongBinder();
5197 data.recycle();
5198 reply.recycle();
5199 return res;
5200 }
5201
Craig Mautneraea74a52014-03-08 14:23:10 -08005202 @Override
5203 public void startLockTaskMode(int taskId) throws RemoteException {
5204 Parcel data = Parcel.obtain();
5205 Parcel reply = Parcel.obtain();
5206 data.writeInterfaceToken(IActivityManager.descriptor);
5207 data.writeInt(taskId);
5208 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5209 reply.readException();
5210 data.recycle();
5211 reply.recycle();
5212 }
5213
5214 @Override
5215 public void startLockTaskMode(IBinder token) throws RemoteException {
5216 Parcel data = Parcel.obtain();
5217 Parcel reply = Parcel.obtain();
5218 data.writeInterfaceToken(IActivityManager.descriptor);
5219 data.writeStrongBinder(token);
5220 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5221 reply.readException();
5222 data.recycle();
5223 reply.recycle();
5224 }
5225
5226 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005227 public void startLockTaskModeOnCurrent() throws RemoteException {
5228 Parcel data = Parcel.obtain();
5229 Parcel reply = Parcel.obtain();
5230 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005231 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005232 reply.readException();
5233 data.recycle();
5234 reply.recycle();
5235 }
5236
5237 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005238 public void stopLockTaskMode() throws RemoteException {
5239 Parcel data = Parcel.obtain();
5240 Parcel reply = Parcel.obtain();
5241 data.writeInterfaceToken(IActivityManager.descriptor);
5242 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5243 reply.readException();
5244 data.recycle();
5245 reply.recycle();
5246 }
5247
5248 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005249 public void stopLockTaskModeOnCurrent() throws RemoteException {
5250 Parcel data = Parcel.obtain();
5251 Parcel reply = Parcel.obtain();
5252 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005253 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005254 reply.readException();
5255 data.recycle();
5256 reply.recycle();
5257 }
5258
5259 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005260 public boolean isInLockTaskMode() throws RemoteException {
5261 Parcel data = Parcel.obtain();
5262 Parcel reply = Parcel.obtain();
5263 data.writeInterfaceToken(IActivityManager.descriptor);
5264 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5265 reply.readException();
5266 boolean isInLockTaskMode = reply.readInt() == 1;
5267 data.recycle();
5268 reply.recycle();
5269 return isInLockTaskMode;
5270 }
5271
Craig Mautner688b5102014-03-27 16:55:03 -07005272 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005273 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005274 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005275 Parcel data = Parcel.obtain();
5276 Parcel reply = Parcel.obtain();
5277 data.writeInterfaceToken(IActivityManager.descriptor);
5278 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005279 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005280 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005281 reply.readException();
5282 data.recycle();
5283 reply.recycle();
5284 }
5285
Craig Mautneree2e45a2014-06-27 12:10:03 -07005286 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005287 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5288 Parcel data = Parcel.obtain();
5289 Parcel reply = Parcel.obtain();
5290 data.writeInterfaceToken(IActivityManager.descriptor);
5291 data.writeString(filename);
5292 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5293 reply.readException();
5294 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5295 data.recycle();
5296 reply.recycle();
5297 return icon;
5298 }
5299
5300 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005301 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005302 Parcel data = Parcel.obtain();
5303 Parcel reply = Parcel.obtain();
5304 data.writeInterfaceToken(IActivityManager.descriptor);
5305 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005306 data.writeInt(visible ? 1 : 0);
5307 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005308 reply.readException();
5309 boolean success = reply.readInt() > 0;
5310 data.recycle();
5311 reply.recycle();
5312 return success;
5313 }
5314
5315 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005316 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005317 Parcel data = Parcel.obtain();
5318 Parcel reply = Parcel.obtain();
5319 data.writeInterfaceToken(IActivityManager.descriptor);
5320 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005321 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005322 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005323 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005324 data.recycle();
5325 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005326 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005327 }
5328
5329 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005330 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005331 Parcel data = Parcel.obtain();
5332 Parcel reply = Parcel.obtain();
5333 data.writeInterfaceToken(IActivityManager.descriptor);
5334 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005335 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5336 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005337 reply.readException();
5338 data.recycle();
5339 reply.recycle();
5340 }
5341
5342 @Override
5343 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5344 Parcel data = Parcel.obtain();
5345 Parcel reply = Parcel.obtain();
5346 data.writeInterfaceToken(IActivityManager.descriptor);
5347 data.writeStrongBinder(token);
5348 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5349 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005350 reply.readException();
5351 data.recycle();
5352 reply.recycle();
5353 }
5354
Craig Mautner8746a472014-07-24 15:12:54 -07005355 @Override
5356 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5357 Parcel data = Parcel.obtain();
5358 Parcel reply = Parcel.obtain();
5359 data.writeInterfaceToken(IActivityManager.descriptor);
5360 data.writeStrongBinder(token);
5361 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5362 IBinder.FLAG_ONEWAY);
5363 reply.readException();
5364 data.recycle();
5365 reply.recycle();
5366 }
5367
Craig Mautner6e2f3952014-09-09 14:26:41 -07005368 @Override
5369 public void bootAnimationComplete() throws RemoteException {
5370 Parcel data = Parcel.obtain();
5371 Parcel reply = Parcel.obtain();
5372 data.writeInterfaceToken(IActivityManager.descriptor);
5373 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5374 reply.readException();
5375 data.recycle();
5376 reply.recycle();
5377 }
5378
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005379 private IBinder mRemote;
5380}