blob: 1f7e4507806e4aec789bf861a6040d5003e9b1f1 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
Jeff Hao1b012d32014-08-20 10:35:34 -070020import android.app.ProfilerInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070022import android.content.IIntentReceiver;
23import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.content.Intent;
25import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070026import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070027import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070028import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.pm.ConfigurationInfo;
30import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070031import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070032import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070034import android.graphics.Bitmap;
35import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080036import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080037import android.net.Uri;
38import android.os.Binder;
39import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070040import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.os.IBinder;
42import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070043import android.os.ParcelFileDescriptor;
44import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070045import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070046import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070048import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070049import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080052import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070053import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055import java.util.ArrayList;
56import java.util.List;
57
58/** {@hide} */
59public abstract class ActivityManagerNative extends Binder implements IActivityManager
60{
61 /**
62 * Cast a Binder object into an activity manager interface, generating
63 * a proxy if needed.
64 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 if (obj == null) {
67 return null;
68 }
69 IActivityManager in =
70 (IActivityManager)obj.queryLocalInterface(descriptor);
71 if (in != null) {
72 return in;
73 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 return new ActivityManagerProxy(obj);
76 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080077
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 /**
79 * Retrieve the system's default/global activity manager.
80 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080081 static public IActivityManager getDefault() {
82 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 }
84
85 /**
86 * Convenience for checking whether the system is ready. For internal use only.
87 */
88 static public boolean isSystemReady() {
89 if (!sSystemReady) {
90 sSystemReady = getDefault().testIsSystemReady();
91 }
92 return sSystemReady;
93 }
94 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080095
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 /**
97 * Convenience for sending a sticky broadcast. For internal use only.
98 * If you don't care about permission, use null.
99 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -0700100 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800101 try {
102 getDefault().broadcastIntent(
103 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800104 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105 } catch (RemoteException ex) {
106 }
107 }
108
Dianne Hackborn099bc622014-01-22 13:39:16 -0800109 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800111 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800116 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117 attachInterface(this, descriptor);
118 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700119
120 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800121 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
122 throws RemoteException {
123 switch (code) {
124 case START_ACTIVITY_TRANSACTION:
125 {
126 data.enforceInterface(IActivityManager.descriptor);
127 IBinder b = data.readStrongBinder();
128 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800129 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 Intent intent = Intent.CREATOR.createFromParcel(data);
131 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800133 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700135 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700136 ProfilerInfo profilerInfo = data.readInt() != 0
137 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700138 Bundle options = data.readInt() != 0
139 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800140 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700141 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 reply.writeNoException();
143 reply.writeInt(result);
144 return true;
145 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700146
Amith Yamasani82644082012-08-03 13:09:11 -0700147 case START_ACTIVITY_AS_USER_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
155 IBinder resultTo = data.readStrongBinder();
156 String resultWho = data.readString();
157 int requestCode = data.readInt();
158 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700159 ProfilerInfo profilerInfo = data.readInt() != 0
160 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
163 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800164 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700165 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700166 reply.writeNoException();
167 reply.writeInt(result);
168 return true;
169 }
170
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700171 case START_ACTIVITY_AS_CALLER_TRANSACTION:
172 {
173 data.enforceInterface(IActivityManager.descriptor);
174 IBinder b = data.readStrongBinder();
175 IApplicationThread app = ApplicationThreadNative.asInterface(b);
176 String callingPackage = data.readString();
177 Intent intent = Intent.CREATOR.createFromParcel(data);
178 String resolvedType = data.readString();
179 IBinder resultTo = data.readStrongBinder();
180 String resultWho = data.readString();
181 int requestCode = data.readInt();
182 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700183 ProfilerInfo profilerInfo = data.readInt() != 0
184 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700185 Bundle options = data.readInt() != 0
186 ? Bundle.CREATOR.createFromParcel(data) : null;
187 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700188 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700189 reply.writeNoException();
190 reply.writeInt(result);
191 return true;
192 }
193
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800194 case START_ACTIVITY_AND_WAIT_TRANSACTION:
195 {
196 data.enforceInterface(IActivityManager.descriptor);
197 IBinder b = data.readStrongBinder();
198 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800199 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800200 Intent intent = Intent.CREATOR.createFromParcel(data);
201 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800202 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800203 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800204 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700205 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700206 ProfilerInfo profilerInfo = data.readInt() != 0
207 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700208 Bundle options = data.readInt() != 0
209 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700210 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800211 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700212 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800213 reply.writeNoException();
214 result.writeToParcel(reply, 0);
215 return true;
216 }
217
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700218 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
219 {
220 data.enforceInterface(IActivityManager.descriptor);
221 IBinder b = data.readStrongBinder();
222 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800223 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700224 Intent intent = Intent.CREATOR.createFromParcel(data);
225 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700226 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700227 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700228 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700229 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700230 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 Bundle options = data.readInt() != 0
232 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700233 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800234 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700235 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700236 reply.writeNoException();
237 reply.writeInt(result);
238 return true;
239 }
240
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700241 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700242 {
243 data.enforceInterface(IActivityManager.descriptor);
244 IBinder b = data.readStrongBinder();
245 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700246 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700247 Intent fillInIntent = null;
248 if (data.readInt() != 0) {
249 fillInIntent = Intent.CREATOR.createFromParcel(data);
250 }
251 String resolvedType = data.readString();
252 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700253 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700254 int requestCode = data.readInt();
255 int flagsMask = data.readInt();
256 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700257 Bundle options = data.readInt() != 0
258 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700259 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700260 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700261 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700262 reply.writeNoException();
263 reply.writeInt(result);
264 return true;
265 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700266
Dianne Hackborn91097de2014-04-04 18:02:06 -0700267 case START_VOICE_ACTIVITY_TRANSACTION:
268 {
269 data.enforceInterface(IActivityManager.descriptor);
270 String callingPackage = data.readString();
271 int callingPid = data.readInt();
272 int callingUid = data.readInt();
273 Intent intent = Intent.CREATOR.createFromParcel(data);
274 String resolvedType = data.readString();
275 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
276 data.readStrongBinder());
277 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
278 data.readStrongBinder());
279 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700280 ProfilerInfo profilerInfo = data.readInt() != 0
281 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700282 Bundle options = data.readInt() != 0
283 ? Bundle.CREATOR.createFromParcel(data) : null;
284 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700285 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
286 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700287 reply.writeNoException();
288 reply.writeInt(result);
289 return true;
290 }
291
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800292 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
293 {
294 data.enforceInterface(IActivityManager.descriptor);
295 IBinder callingActivity = data.readStrongBinder();
296 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700297 Bundle options = data.readInt() != 0
298 ? Bundle.CREATOR.createFromParcel(data) : null;
299 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800300 reply.writeNoException();
301 reply.writeInt(result ? 1 : 0);
302 return true;
303 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700304
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700305 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
306 {
307 data.enforceInterface(IActivityManager.descriptor);
308 int taskId = data.readInt();
309 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
310 int result = startActivityFromRecents(taskId, options);
311 reply.writeNoException();
312 reply.writeInt(result);
313 return true;
314 }
315
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800316 case FINISH_ACTIVITY_TRANSACTION: {
317 data.enforceInterface(IActivityManager.descriptor);
318 IBinder token = data.readStrongBinder();
319 Intent resultData = null;
320 int resultCode = data.readInt();
321 if (data.readInt() != 0) {
322 resultData = Intent.CREATOR.createFromParcel(data);
323 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700324 boolean finishTask = (data.readInt() != 0);
325 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 reply.writeNoException();
327 reply.writeInt(res ? 1 : 0);
328 return true;
329 }
330
331 case FINISH_SUB_ACTIVITY_TRANSACTION: {
332 data.enforceInterface(IActivityManager.descriptor);
333 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700334 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800335 int requestCode = data.readInt();
336 finishSubActivity(token, resultWho, requestCode);
337 reply.writeNoException();
338 return true;
339 }
340
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700341 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
342 data.enforceInterface(IActivityManager.descriptor);
343 IBinder token = data.readStrongBinder();
344 boolean res = finishActivityAffinity(token);
345 reply.writeNoException();
346 reply.writeInt(res ? 1 : 0);
347 return true;
348 }
349
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700350 case FINISH_VOICE_TASK_TRANSACTION: {
351 data.enforceInterface(IActivityManager.descriptor);
352 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
353 data.readStrongBinder());
354 finishVoiceTask(session);
355 reply.writeNoException();
356 return true;
357 }
358
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700359 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
360 data.enforceInterface(IActivityManager.descriptor);
361 IBinder token = data.readStrongBinder();
362 boolean res = releaseActivityInstance(token);
363 reply.writeNoException();
364 reply.writeInt(res ? 1 : 0);
365 return true;
366 }
367
368 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
369 data.enforceInterface(IActivityManager.descriptor);
370 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
371 releaseSomeActivities(app);
372 reply.writeNoException();
373 return true;
374 }
375
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800376 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
377 data.enforceInterface(IActivityManager.descriptor);
378 IBinder token = data.readStrongBinder();
379 boolean res = willActivityBeVisible(token);
380 reply.writeNoException();
381 reply.writeInt(res ? 1 : 0);
382 return true;
383 }
384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 case REGISTER_RECEIVER_TRANSACTION:
386 {
387 data.enforceInterface(IActivityManager.descriptor);
388 IBinder b = data.readStrongBinder();
389 IApplicationThread app =
390 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700391 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800392 b = data.readStrongBinder();
393 IIntentReceiver rec
394 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
395 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
396 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700397 int userId = data.readInt();
398 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800399 reply.writeNoException();
400 if (intent != null) {
401 reply.writeInt(1);
402 intent.writeToParcel(reply, 0);
403 } else {
404 reply.writeInt(0);
405 }
406 return true;
407 }
408
409 case UNREGISTER_RECEIVER_TRANSACTION:
410 {
411 data.enforceInterface(IActivityManager.descriptor);
412 IBinder b = data.readStrongBinder();
413 if (b == null) {
414 return true;
415 }
416 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
417 unregisterReceiver(rec);
418 reply.writeNoException();
419 return true;
420 }
421
422 case BROADCAST_INTENT_TRANSACTION:
423 {
424 data.enforceInterface(IActivityManager.descriptor);
425 IBinder b = data.readStrongBinder();
426 IApplicationThread app =
427 b != null ? ApplicationThreadNative.asInterface(b) : null;
428 Intent intent = Intent.CREATOR.createFromParcel(data);
429 String resolvedType = data.readString();
430 b = data.readStrongBinder();
431 IIntentReceiver resultTo =
432 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
433 int resultCode = data.readInt();
434 String resultData = data.readString();
435 Bundle resultExtras = data.readBundle();
436 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800437 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800438 boolean serialized = data.readInt() != 0;
439 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700440 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800441 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800442 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700443 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800444 reply.writeNoException();
445 reply.writeInt(res);
446 return true;
447 }
448
449 case UNBROADCAST_INTENT_TRANSACTION:
450 {
451 data.enforceInterface(IActivityManager.descriptor);
452 IBinder b = data.readStrongBinder();
453 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
454 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700455 int userId = data.readInt();
456 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800457 reply.writeNoException();
458 return true;
459 }
460
461 case FINISH_RECEIVER_TRANSACTION: {
462 data.enforceInterface(IActivityManager.descriptor);
463 IBinder who = data.readStrongBinder();
464 int resultCode = data.readInt();
465 String resultData = data.readString();
466 Bundle resultExtras = data.readBundle();
467 boolean resultAbort = data.readInt() != 0;
468 if (who != null) {
469 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
470 }
471 reply.writeNoException();
472 return true;
473 }
474
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800475 case ATTACH_APPLICATION_TRANSACTION: {
476 data.enforceInterface(IActivityManager.descriptor);
477 IApplicationThread app = ApplicationThreadNative.asInterface(
478 data.readStrongBinder());
479 if (app != null) {
480 attachApplication(app);
481 }
482 reply.writeNoException();
483 return true;
484 }
485
486 case ACTIVITY_IDLE_TRANSACTION: {
487 data.enforceInterface(IActivityManager.descriptor);
488 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700489 Configuration config = null;
490 if (data.readInt() != 0) {
491 config = Configuration.CREATOR.createFromParcel(data);
492 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700493 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700495 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800496 }
497 reply.writeNoException();
498 return true;
499 }
500
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700501 case ACTIVITY_RESUMED_TRANSACTION: {
502 data.enforceInterface(IActivityManager.descriptor);
503 IBinder token = data.readStrongBinder();
504 activityResumed(token);
505 reply.writeNoException();
506 return true;
507 }
508
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800509 case ACTIVITY_PAUSED_TRANSACTION: {
510 data.enforceInterface(IActivityManager.descriptor);
511 IBinder token = data.readStrongBinder();
Craig Mautnera0026042014-04-23 11:45:37 -0700512 PersistableBundle persistentState = data.readPersistableBundle();
513 activityPaused(token, persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800514 reply.writeNoException();
515 return true;
516 }
517
518 case ACTIVITY_STOPPED_TRANSACTION: {
519 data.enforceInterface(IActivityManager.descriptor);
520 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800521 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700522 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800523 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700524 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800525 reply.writeNoException();
526 return true;
527 }
528
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800529 case ACTIVITY_SLEPT_TRANSACTION: {
530 data.enforceInterface(IActivityManager.descriptor);
531 IBinder token = data.readStrongBinder();
532 activitySlept(token);
533 reply.writeNoException();
534 return true;
535 }
536
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800537 case ACTIVITY_DESTROYED_TRANSACTION: {
538 data.enforceInterface(IActivityManager.descriptor);
539 IBinder token = data.readStrongBinder();
540 activityDestroyed(token);
541 reply.writeNoException();
542 return true;
543 }
544
545 case GET_CALLING_PACKAGE_TRANSACTION: {
546 data.enforceInterface(IActivityManager.descriptor);
547 IBinder token = data.readStrongBinder();
548 String res = token != null ? getCallingPackage(token) : null;
549 reply.writeNoException();
550 reply.writeString(res);
551 return true;
552 }
553
554 case GET_CALLING_ACTIVITY_TRANSACTION: {
555 data.enforceInterface(IActivityManager.descriptor);
556 IBinder token = data.readStrongBinder();
557 ComponentName cn = getCallingActivity(token);
558 reply.writeNoException();
559 ComponentName.writeToParcel(cn, reply);
560 return true;
561 }
562
Winson Chung1147c402014-05-14 11:05:00 -0700563 case GET_APP_TASKS_TRANSACTION: {
564 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700565 String callingPackage = data.readString();
566 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700567 reply.writeNoException();
568 int N = list != null ? list.size() : -1;
569 reply.writeInt(N);
570 int i;
571 for (i=0; i<N; i++) {
572 IAppTask task = list.get(i);
573 reply.writeStrongBinder(task.asBinder());
574 }
575 return true;
576 }
577
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700578 case ADD_APP_TASK_TRANSACTION: {
579 data.enforceInterface(IActivityManager.descriptor);
580 IBinder activityToken = data.readStrongBinder();
581 Intent intent = Intent.CREATOR.createFromParcel(data);
582 ActivityManager.TaskDescription descr
583 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
584 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
585 int res = addAppTask(activityToken, intent, descr, thumbnail);
586 reply.writeNoException();
587 reply.writeInt(res);
588 return true;
589 }
590
591 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
592 data.enforceInterface(IActivityManager.descriptor);
593 Point size = getAppTaskThumbnailSize();
594 reply.writeNoException();
595 size.writeToParcel(reply, 0);
596 return true;
597 }
598
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800599 case GET_TASKS_TRANSACTION: {
600 data.enforceInterface(IActivityManager.descriptor);
601 int maxNum = data.readInt();
602 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700603 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800604 reply.writeNoException();
605 int N = list != null ? list.size() : -1;
606 reply.writeInt(N);
607 int i;
608 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700609 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800610 info.writeToParcel(reply, 0);
611 }
612 return true;
613 }
614
615 case GET_RECENT_TASKS_TRANSACTION: {
616 data.enforceInterface(IActivityManager.descriptor);
617 int maxNum = data.readInt();
618 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700619 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800620 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700621 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800622 reply.writeNoException();
623 reply.writeTypedList(list);
624 return true;
625 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700626
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700627 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800628 data.enforceInterface(IActivityManager.descriptor);
629 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700630 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800631 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700632 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800633 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700634 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700635 } else {
636 reply.writeInt(0);
637 }
638 return true;
639 }
640
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800641 case GET_SERVICES_TRANSACTION: {
642 data.enforceInterface(IActivityManager.descriptor);
643 int maxNum = data.readInt();
644 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700645 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800646 reply.writeNoException();
647 int N = list != null ? list.size() : -1;
648 reply.writeInt(N);
649 int i;
650 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700651 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800652 info.writeToParcel(reply, 0);
653 }
654 return true;
655 }
656
657 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
658 data.enforceInterface(IActivityManager.descriptor);
659 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
660 reply.writeNoException();
661 reply.writeTypedList(list);
662 return true;
663 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700664
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800665 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
666 data.enforceInterface(IActivityManager.descriptor);
667 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
668 reply.writeNoException();
669 reply.writeTypedList(list);
670 return true;
671 }
672
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700673 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
674 data.enforceInterface(IActivityManager.descriptor);
675 List<ApplicationInfo> list = getRunningExternalApplications();
676 reply.writeNoException();
677 reply.writeTypedList(list);
678 return true;
679 }
680
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800681 case MOVE_TASK_TO_FRONT_TRANSACTION: {
682 data.enforceInterface(IActivityManager.descriptor);
683 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800684 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700685 Bundle options = data.readInt() != 0
686 ? Bundle.CREATOR.createFromParcel(data) : null;
687 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800688 reply.writeNoException();
689 return true;
690 }
691
692 case MOVE_TASK_TO_BACK_TRANSACTION: {
693 data.enforceInterface(IActivityManager.descriptor);
694 int task = data.readInt();
695 moveTaskToBack(task);
696 reply.writeNoException();
697 return true;
698 }
699
700 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
701 data.enforceInterface(IActivityManager.descriptor);
702 IBinder token = data.readStrongBinder();
703 boolean nonRoot = data.readInt() != 0;
704 boolean res = moveActivityTaskToBack(token, nonRoot);
705 reply.writeNoException();
706 reply.writeInt(res ? 1 : 0);
707 return true;
708 }
709
710 case MOVE_TASK_BACKWARDS_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 int task = data.readInt();
713 moveTaskBackwards(task);
714 reply.writeNoException();
715 return true;
716 }
717
Craig Mautnerc00204b2013-03-05 15:02:14 -0800718 case MOVE_TASK_TO_STACK_TRANSACTION: {
719 data.enforceInterface(IActivityManager.descriptor);
720 int taskId = data.readInt();
721 int stackId = data.readInt();
722 boolean toTop = data.readInt() != 0;
723 moveTaskToStack(taskId, stackId, toTop);
724 reply.writeNoException();
725 return true;
726 }
727
728 case RESIZE_STACK_TRANSACTION: {
729 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800730 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800731 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800732 Rect r = Rect.CREATOR.createFromParcel(data);
733 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800734 reply.writeNoException();
735 return true;
736 }
737
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800738 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700739 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800740 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700741 reply.writeNoException();
742 reply.writeTypedList(list);
743 return true;
744 }
745
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800746 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700747 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800748 int stackId = data.readInt();
749 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700750 reply.writeNoException();
751 if (info != null) {
752 reply.writeInt(1);
753 info.writeToParcel(reply, 0);
754 } else {
755 reply.writeInt(0);
756 }
757 return true;
758 }
759
Winson Chung303e1ff2014-03-07 15:06:19 -0800760 case IS_IN_HOME_STACK_TRANSACTION: {
761 data.enforceInterface(IActivityManager.descriptor);
762 int taskId = data.readInt();
763 boolean isInHomeStack = isInHomeStack(taskId);
764 reply.writeNoException();
765 reply.writeInt(isInHomeStack ? 1 : 0);
766 return true;
767 }
768
Craig Mautnercf910b02013-04-23 11:23:27 -0700769 case SET_FOCUSED_STACK_TRANSACTION: {
770 data.enforceInterface(IActivityManager.descriptor);
771 int stackId = data.readInt();
772 setFocusedStack(stackId);
773 reply.writeNoException();
774 return true;
775 }
776
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800777 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 IBinder token = data.readStrongBinder();
780 boolean onlyRoot = data.readInt() != 0;
781 int res = token != null
782 ? getTaskForActivity(token, onlyRoot) : -1;
783 reply.writeNoException();
784 reply.writeInt(res);
785 return true;
786 }
787
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800788 case GET_CONTENT_PROVIDER_TRANSACTION: {
789 data.enforceInterface(IActivityManager.descriptor);
790 IBinder b = data.readStrongBinder();
791 IApplicationThread app = ApplicationThreadNative.asInterface(b);
792 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700793 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700794 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700795 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800796 reply.writeNoException();
797 if (cph != null) {
798 reply.writeInt(1);
799 cph.writeToParcel(reply, 0);
800 } else {
801 reply.writeInt(0);
802 }
803 return true;
804 }
805
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800806 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
807 data.enforceInterface(IActivityManager.descriptor);
808 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700809 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800810 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700811 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800812 reply.writeNoException();
813 if (cph != null) {
814 reply.writeInt(1);
815 cph.writeToParcel(reply, 0);
816 } else {
817 reply.writeInt(0);
818 }
819 return true;
820 }
821
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800822 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
823 data.enforceInterface(IActivityManager.descriptor);
824 IBinder b = data.readStrongBinder();
825 IApplicationThread app = ApplicationThreadNative.asInterface(b);
826 ArrayList<ContentProviderHolder> providers =
827 data.createTypedArrayList(ContentProviderHolder.CREATOR);
828 publishContentProviders(app, providers);
829 reply.writeNoException();
830 return true;
831 }
832
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700833 case REF_CONTENT_PROVIDER_TRANSACTION: {
834 data.enforceInterface(IActivityManager.descriptor);
835 IBinder b = data.readStrongBinder();
836 int stable = data.readInt();
837 int unstable = data.readInt();
838 boolean res = refContentProvider(b, stable, unstable);
839 reply.writeNoException();
840 reply.writeInt(res ? 1 : 0);
841 return true;
842 }
843
844 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
845 data.enforceInterface(IActivityManager.descriptor);
846 IBinder b = data.readStrongBinder();
847 unstableProviderDied(b);
848 reply.writeNoException();
849 return true;
850 }
851
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700852 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
853 data.enforceInterface(IActivityManager.descriptor);
854 IBinder b = data.readStrongBinder();
855 appNotRespondingViaProvider(b);
856 reply.writeNoException();
857 return true;
858 }
859
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800860 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
861 data.enforceInterface(IActivityManager.descriptor);
862 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700863 boolean stable = data.readInt() != 0;
864 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800865 reply.writeNoException();
866 return true;
867 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800868
869 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
870 data.enforceInterface(IActivityManager.descriptor);
871 String name = data.readString();
872 IBinder token = data.readStrongBinder();
873 removeContentProviderExternal(name, token);
874 reply.writeNoException();
875 return true;
876 }
877
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700878 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
879 data.enforceInterface(IActivityManager.descriptor);
880 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
881 PendingIntent pi = getRunningServiceControlPanel(comp);
882 reply.writeNoException();
883 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
884 return true;
885 }
886
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800887 case START_SERVICE_TRANSACTION: {
888 data.enforceInterface(IActivityManager.descriptor);
889 IBinder b = data.readStrongBinder();
890 IApplicationThread app = ApplicationThreadNative.asInterface(b);
891 Intent service = Intent.CREATOR.createFromParcel(data);
892 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700893 int userId = data.readInt();
894 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800895 reply.writeNoException();
896 ComponentName.writeToParcel(cn, reply);
897 return true;
898 }
899
900 case STOP_SERVICE_TRANSACTION: {
901 data.enforceInterface(IActivityManager.descriptor);
902 IBinder b = data.readStrongBinder();
903 IApplicationThread app = ApplicationThreadNative.asInterface(b);
904 Intent service = Intent.CREATOR.createFromParcel(data);
905 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700906 int userId = data.readInt();
907 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 reply.writeNoException();
909 reply.writeInt(res);
910 return true;
911 }
912
913 case STOP_SERVICE_TOKEN_TRANSACTION: {
914 data.enforceInterface(IActivityManager.descriptor);
915 ComponentName className = ComponentName.readFromParcel(data);
916 IBinder token = data.readStrongBinder();
917 int startId = data.readInt();
918 boolean res = stopServiceToken(className, token, startId);
919 reply.writeNoException();
920 reply.writeInt(res ? 1 : 0);
921 return true;
922 }
923
924 case SET_SERVICE_FOREGROUND_TRANSACTION: {
925 data.enforceInterface(IActivityManager.descriptor);
926 ComponentName className = ComponentName.readFromParcel(data);
927 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700928 int id = data.readInt();
929 Notification notification = null;
930 if (data.readInt() != 0) {
931 notification = Notification.CREATOR.createFromParcel(data);
932 }
933 boolean removeNotification = data.readInt() != 0;
934 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800935 reply.writeNoException();
936 return true;
937 }
938
939 case BIND_SERVICE_TRANSACTION: {
940 data.enforceInterface(IActivityManager.descriptor);
941 IBinder b = data.readStrongBinder();
942 IApplicationThread app = ApplicationThreadNative.asInterface(b);
943 IBinder token = data.readStrongBinder();
944 Intent service = Intent.CREATOR.createFromParcel(data);
945 String resolvedType = data.readString();
946 b = data.readStrongBinder();
947 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800948 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800949 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800950 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800951 reply.writeNoException();
952 reply.writeInt(res);
953 return true;
954 }
955
956 case UNBIND_SERVICE_TRANSACTION: {
957 data.enforceInterface(IActivityManager.descriptor);
958 IBinder b = data.readStrongBinder();
959 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
960 boolean res = unbindService(conn);
961 reply.writeNoException();
962 reply.writeInt(res ? 1 : 0);
963 return true;
964 }
965
966 case PUBLISH_SERVICE_TRANSACTION: {
967 data.enforceInterface(IActivityManager.descriptor);
968 IBinder token = data.readStrongBinder();
969 Intent intent = Intent.CREATOR.createFromParcel(data);
970 IBinder service = data.readStrongBinder();
971 publishService(token, intent, service);
972 reply.writeNoException();
973 return true;
974 }
975
976 case UNBIND_FINISHED_TRANSACTION: {
977 data.enforceInterface(IActivityManager.descriptor);
978 IBinder token = data.readStrongBinder();
979 Intent intent = Intent.CREATOR.createFromParcel(data);
980 boolean doRebind = data.readInt() != 0;
981 unbindFinished(token, intent, doRebind);
982 reply.writeNoException();
983 return true;
984 }
985
986 case SERVICE_DONE_EXECUTING_TRANSACTION: {
987 data.enforceInterface(IActivityManager.descriptor);
988 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700989 int type = data.readInt();
990 int startId = data.readInt();
991 int res = data.readInt();
992 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800993 reply.writeNoException();
994 return true;
995 }
996
997 case START_INSTRUMENTATION_TRANSACTION: {
998 data.enforceInterface(IActivityManager.descriptor);
999 ComponentName className = ComponentName.readFromParcel(data);
1000 String profileFile = data.readString();
1001 int fl = data.readInt();
1002 Bundle arguments = data.readBundle();
1003 IBinder b = data.readStrongBinder();
1004 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001005 b = data.readStrongBinder();
1006 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001007 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001008 String abiOverride = data.readString();
1009 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1010 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001011 reply.writeNoException();
1012 reply.writeInt(res ? 1 : 0);
1013 return true;
1014 }
1015
1016
1017 case FINISH_INSTRUMENTATION_TRANSACTION: {
1018 data.enforceInterface(IActivityManager.descriptor);
1019 IBinder b = data.readStrongBinder();
1020 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1021 int resultCode = data.readInt();
1022 Bundle results = data.readBundle();
1023 finishInstrumentation(app, resultCode, results);
1024 reply.writeNoException();
1025 return true;
1026 }
1027
1028 case GET_CONFIGURATION_TRANSACTION: {
1029 data.enforceInterface(IActivityManager.descriptor);
1030 Configuration config = getConfiguration();
1031 reply.writeNoException();
1032 config.writeToParcel(reply, 0);
1033 return true;
1034 }
1035
1036 case UPDATE_CONFIGURATION_TRANSACTION: {
1037 data.enforceInterface(IActivityManager.descriptor);
1038 Configuration config = Configuration.CREATOR.createFromParcel(data);
1039 updateConfiguration(config);
1040 reply.writeNoException();
1041 return true;
1042 }
1043
1044 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1045 data.enforceInterface(IActivityManager.descriptor);
1046 IBinder token = data.readStrongBinder();
1047 int requestedOrientation = data.readInt();
1048 setRequestedOrientation(token, requestedOrientation);
1049 reply.writeNoException();
1050 return true;
1051 }
1052
1053 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1054 data.enforceInterface(IActivityManager.descriptor);
1055 IBinder token = data.readStrongBinder();
1056 int req = getRequestedOrientation(token);
1057 reply.writeNoException();
1058 reply.writeInt(req);
1059 return true;
1060 }
1061
1062 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1063 data.enforceInterface(IActivityManager.descriptor);
1064 IBinder token = data.readStrongBinder();
1065 ComponentName cn = getActivityClassForToken(token);
1066 reply.writeNoException();
1067 ComponentName.writeToParcel(cn, reply);
1068 return true;
1069 }
1070
1071 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1072 data.enforceInterface(IActivityManager.descriptor);
1073 IBinder token = data.readStrongBinder();
1074 reply.writeNoException();
1075 reply.writeString(getPackageForToken(token));
1076 return true;
1077 }
1078
1079 case GET_INTENT_SENDER_TRANSACTION: {
1080 data.enforceInterface(IActivityManager.descriptor);
1081 int type = data.readInt();
1082 String packageName = data.readString();
1083 IBinder token = data.readStrongBinder();
1084 String resultWho = data.readString();
1085 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001086 Intent[] requestIntents;
1087 String[] requestResolvedTypes;
1088 if (data.readInt() != 0) {
1089 requestIntents = data.createTypedArray(Intent.CREATOR);
1090 requestResolvedTypes = data.createStringArray();
1091 } else {
1092 requestIntents = null;
1093 requestResolvedTypes = null;
1094 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001095 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001096 Bundle options = data.readInt() != 0
1097 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001098 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001099 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001100 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001101 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001102 reply.writeNoException();
1103 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1104 return true;
1105 }
1106
1107 case CANCEL_INTENT_SENDER_TRANSACTION: {
1108 data.enforceInterface(IActivityManager.descriptor);
1109 IIntentSender r = IIntentSender.Stub.asInterface(
1110 data.readStrongBinder());
1111 cancelIntentSender(r);
1112 reply.writeNoException();
1113 return true;
1114 }
1115
1116 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1117 data.enforceInterface(IActivityManager.descriptor);
1118 IIntentSender r = IIntentSender.Stub.asInterface(
1119 data.readStrongBinder());
1120 String res = getPackageForIntentSender(r);
1121 reply.writeNoException();
1122 reply.writeString(res);
1123 return true;
1124 }
1125
Christopher Tatec4a07d12012-04-06 14:19:13 -07001126 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1127 data.enforceInterface(IActivityManager.descriptor);
1128 IIntentSender r = IIntentSender.Stub.asInterface(
1129 data.readStrongBinder());
1130 int res = getUidForIntentSender(r);
1131 reply.writeNoException();
1132 reply.writeInt(res);
1133 return true;
1134 }
1135
Dianne Hackborn41203752012-08-31 14:05:51 -07001136 case HANDLE_INCOMING_USER_TRANSACTION: {
1137 data.enforceInterface(IActivityManager.descriptor);
1138 int callingPid = data.readInt();
1139 int callingUid = data.readInt();
1140 int userId = data.readInt();
1141 boolean allowAll = data.readInt() != 0 ;
1142 boolean requireFull = data.readInt() != 0;
1143 String name = data.readString();
1144 String callerPackage = data.readString();
1145 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1146 requireFull, name, callerPackage);
1147 reply.writeNoException();
1148 reply.writeInt(res);
1149 return true;
1150 }
1151
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 case SET_PROCESS_LIMIT_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 int max = data.readInt();
1155 setProcessLimit(max);
1156 reply.writeNoException();
1157 return true;
1158 }
1159
1160 case GET_PROCESS_LIMIT_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 int limit = getProcessLimit();
1163 reply.writeNoException();
1164 reply.writeInt(limit);
1165 return true;
1166 }
1167
1168 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1169 data.enforceInterface(IActivityManager.descriptor);
1170 IBinder token = data.readStrongBinder();
1171 int pid = data.readInt();
1172 boolean isForeground = data.readInt() != 0;
1173 setProcessForeground(token, pid, isForeground);
1174 reply.writeNoException();
1175 return true;
1176 }
1177
1178 case CHECK_PERMISSION_TRANSACTION: {
1179 data.enforceInterface(IActivityManager.descriptor);
1180 String perm = data.readString();
1181 int pid = data.readInt();
1182 int uid = data.readInt();
1183 int res = checkPermission(perm, pid, uid);
1184 reply.writeNoException();
1185 reply.writeInt(res);
1186 return true;
1187 }
1188
1189 case CHECK_URI_PERMISSION_TRANSACTION: {
1190 data.enforceInterface(IActivityManager.descriptor);
1191 Uri uri = Uri.CREATOR.createFromParcel(data);
1192 int pid = data.readInt();
1193 int uid = data.readInt();
1194 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001195 int userId = data.readInt();
1196 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001197 reply.writeNoException();
1198 reply.writeInt(res);
1199 return true;
1200 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001201
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001202 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001203 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001204 String packageName = data.readString();
1205 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1206 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001207 int userId = data.readInt();
1208 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001209 reply.writeNoException();
1210 reply.writeInt(res ? 1 : 0);
1211 return true;
1212 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001213
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001214 case GRANT_URI_PERMISSION_TRANSACTION: {
1215 data.enforceInterface(IActivityManager.descriptor);
1216 IBinder b = data.readStrongBinder();
1217 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1218 String targetPkg = data.readString();
1219 Uri uri = Uri.CREATOR.createFromParcel(data);
1220 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001221 int userId = data.readInt();
1222 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223 reply.writeNoException();
1224 return true;
1225 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001226
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001227 case REVOKE_URI_PERMISSION_TRANSACTION: {
1228 data.enforceInterface(IActivityManager.descriptor);
1229 IBinder b = data.readStrongBinder();
1230 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1231 Uri uri = Uri.CREATOR.createFromParcel(data);
1232 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001233 int userId = data.readInt();
1234 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001235 reply.writeNoException();
1236 return true;
1237 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001238
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001239 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1240 data.enforceInterface(IActivityManager.descriptor);
1241 Uri uri = Uri.CREATOR.createFromParcel(data);
1242 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001243 int userId = data.readInt();
1244 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001245 reply.writeNoException();
1246 return true;
1247 }
1248
1249 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1250 data.enforceInterface(IActivityManager.descriptor);
1251 Uri uri = Uri.CREATOR.createFromParcel(data);
1252 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001253 int userId = data.readInt();
1254 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001255 reply.writeNoException();
1256 return true;
1257 }
1258
1259 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1260 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001261 final String packageName = data.readString();
1262 final boolean incoming = data.readInt() != 0;
1263 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1264 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001265 reply.writeNoException();
1266 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1267 return true;
1268 }
1269
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001270 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1271 data.enforceInterface(IActivityManager.descriptor);
1272 IBinder b = data.readStrongBinder();
1273 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1274 boolean waiting = data.readInt() != 0;
1275 showWaitingForDebugger(app, waiting);
1276 reply.writeNoException();
1277 return true;
1278 }
1279
1280 case GET_MEMORY_INFO_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
1282 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1283 getMemoryInfo(mi);
1284 reply.writeNoException();
1285 mi.writeToParcel(reply, 0);
1286 return true;
1287 }
1288
1289 case UNHANDLED_BACK_TRANSACTION: {
1290 data.enforceInterface(IActivityManager.descriptor);
1291 unhandledBack();
1292 reply.writeNoException();
1293 return true;
1294 }
1295
1296 case OPEN_CONTENT_URI_TRANSACTION: {
1297 data.enforceInterface(IActivityManager.descriptor);
1298 Uri uri = Uri.parse(data.readString());
1299 ParcelFileDescriptor pfd = openContentUri(uri);
1300 reply.writeNoException();
1301 if (pfd != null) {
1302 reply.writeInt(1);
1303 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1304 } else {
1305 reply.writeInt(0);
1306 }
1307 return true;
1308 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001309
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001310 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1311 data.enforceInterface(IActivityManager.descriptor);
1312 setLockScreenShown(data.readInt() != 0);
1313 reply.writeNoException();
1314 return true;
1315 }
1316
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001317 case SET_DEBUG_APP_TRANSACTION: {
1318 data.enforceInterface(IActivityManager.descriptor);
1319 String pn = data.readString();
1320 boolean wfd = data.readInt() != 0;
1321 boolean per = data.readInt() != 0;
1322 setDebugApp(pn, wfd, per);
1323 reply.writeNoException();
1324 return true;
1325 }
1326
1327 case SET_ALWAYS_FINISH_TRANSACTION: {
1328 data.enforceInterface(IActivityManager.descriptor);
1329 boolean enabled = data.readInt() != 0;
1330 setAlwaysFinish(enabled);
1331 reply.writeNoException();
1332 return true;
1333 }
1334
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001335 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001336 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001337 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001338 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001339 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001340 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001341 return true;
1342 }
1343
1344 case ENTER_SAFE_MODE_TRANSACTION: {
1345 data.enforceInterface(IActivityManager.descriptor);
1346 enterSafeMode();
1347 reply.writeNoException();
1348 return true;
1349 }
1350
1351 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1352 data.enforceInterface(IActivityManager.descriptor);
1353 IIntentSender is = IIntentSender.Stub.asInterface(
1354 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001355 int sourceUid = data.readInt();
1356 String sourcePkg = data.readString();
1357 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001358 reply.writeNoException();
1359 return true;
1360 }
1361
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001362 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001363 data.enforceInterface(IActivityManager.descriptor);
1364 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001365 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001366 boolean secure = data.readInt() != 0;
1367 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001368 reply.writeNoException();
1369 reply.writeInt(res ? 1 : 0);
1370 return true;
1371 }
1372
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001373 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1374 data.enforceInterface(IActivityManager.descriptor);
1375 String reason = data.readString();
1376 boolean res = killProcessesBelowForeground(reason);
1377 reply.writeNoException();
1378 reply.writeInt(res ? 1 : 0);
1379 return true;
1380 }
1381
Dan Egnor60d87622009-12-16 16:32:58 -08001382 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1383 data.enforceInterface(IActivityManager.descriptor);
1384 IBinder app = data.readStrongBinder();
1385 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1386 handleApplicationCrash(app, ci);
1387 reply.writeNoException();
1388 return true;
1389 }
1390
1391 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001392 data.enforceInterface(IActivityManager.descriptor);
1393 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001394 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001395 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001396 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001397 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001398 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001399 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001400 return true;
1401 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001402
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001403 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1404 data.enforceInterface(IActivityManager.descriptor);
1405 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001406 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001407 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1408 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001409 reply.writeNoException();
1410 return true;
1411 }
1412
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001413 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1414 data.enforceInterface(IActivityManager.descriptor);
1415 int sig = data.readInt();
1416 signalPersistentProcesses(sig);
1417 reply.writeNoException();
1418 return true;
1419 }
1420
Dianne Hackborn03abb812010-01-04 18:43:19 -08001421 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1422 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001423 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001424 int userId = data.readInt();
1425 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001426 reply.writeNoException();
1427 return true;
1428 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001429
1430 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1431 data.enforceInterface(IActivityManager.descriptor);
1432 killAllBackgroundProcesses();
1433 reply.writeNoException();
1434 return true;
1435 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001436
Dianne Hackborn03abb812010-01-04 18:43:19 -08001437 case FORCE_STOP_PACKAGE_TRANSACTION: {
1438 data.enforceInterface(IActivityManager.descriptor);
1439 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001440 int userId = data.readInt();
1441 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001442 reply.writeNoException();
1443 return true;
1444 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001445
1446 case GET_MY_MEMORY_STATE_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
1448 ActivityManager.RunningAppProcessInfo info =
1449 new ActivityManager.RunningAppProcessInfo();
1450 getMyMemoryState(info);
1451 reply.writeNoException();
1452 info.writeToParcel(reply, 0);
1453 return true;
1454 }
1455
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001456 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1457 data.enforceInterface(IActivityManager.descriptor);
1458 ConfigurationInfo config = getDeviceConfigurationInfo();
1459 reply.writeNoException();
1460 config.writeToParcel(reply, 0);
1461 return true;
1462 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001463
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001464 case PROFILE_CONTROL_TRANSACTION: {
1465 data.enforceInterface(IActivityManager.descriptor);
1466 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001467 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001468 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001469 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001470 ProfilerInfo profilerInfo = data.readInt() != 0
1471 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1472 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001473 reply.writeNoException();
1474 reply.writeInt(res ? 1 : 0);
1475 return true;
1476 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001477
Dianne Hackborn55280a92009-05-07 15:53:46 -07001478 case SHUTDOWN_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 boolean res = shutdown(data.readInt());
1481 reply.writeNoException();
1482 reply.writeInt(res ? 1 : 0);
1483 return true;
1484 }
1485
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001486 case STOP_APP_SWITCHES_TRANSACTION: {
1487 data.enforceInterface(IActivityManager.descriptor);
1488 stopAppSwitches();
1489 reply.writeNoException();
1490 return true;
1491 }
1492
1493 case RESUME_APP_SWITCHES_TRANSACTION: {
1494 data.enforceInterface(IActivityManager.descriptor);
1495 resumeAppSwitches();
1496 reply.writeNoException();
1497 return true;
1498 }
1499
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001500 case PEEK_SERVICE_TRANSACTION: {
1501 data.enforceInterface(IActivityManager.descriptor);
1502 Intent service = Intent.CREATOR.createFromParcel(data);
1503 String resolvedType = data.readString();
1504 IBinder binder = peekService(service, resolvedType);
1505 reply.writeNoException();
1506 reply.writeStrongBinder(binder);
1507 return true;
1508 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001509
1510 case START_BACKUP_AGENT_TRANSACTION: {
1511 data.enforceInterface(IActivityManager.descriptor);
1512 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1513 int backupRestoreMode = data.readInt();
1514 boolean success = bindBackupAgent(info, backupRestoreMode);
1515 reply.writeNoException();
1516 reply.writeInt(success ? 1 : 0);
1517 return true;
1518 }
1519
1520 case BACKUP_AGENT_CREATED_TRANSACTION: {
1521 data.enforceInterface(IActivityManager.descriptor);
1522 String packageName = data.readString();
1523 IBinder agent = data.readStrongBinder();
1524 backupAgentCreated(packageName, agent);
1525 reply.writeNoException();
1526 return true;
1527 }
1528
1529 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1530 data.enforceInterface(IActivityManager.descriptor);
1531 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1532 unbindBackupAgent(info);
1533 reply.writeNoException();
1534 return true;
1535 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001536
1537 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1538 data.enforceInterface(IActivityManager.descriptor);
1539 String packageName = data.readString();
1540 addPackageDependency(packageName);
1541 reply.writeNoException();
1542 return true;
1543 }
1544
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001545 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001546 data.enforceInterface(IActivityManager.descriptor);
1547 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001548 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001549 String reason = data.readString();
1550 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001551 reply.writeNoException();
1552 return true;
1553 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001554
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001555 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1556 data.enforceInterface(IActivityManager.descriptor);
1557 String reason = data.readString();
1558 closeSystemDialogs(reason);
1559 reply.writeNoException();
1560 return true;
1561 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001562
1563 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1564 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001565 int[] pids = data.createIntArray();
1566 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001567 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001568 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001569 return true;
1570 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001571
1572 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1573 data.enforceInterface(IActivityManager.descriptor);
1574 String processName = data.readString();
1575 int uid = data.readInt();
1576 killApplicationProcess(processName, uid);
1577 reply.writeNoException();
1578 return true;
1579 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001580
1581 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1582 data.enforceInterface(IActivityManager.descriptor);
1583 IBinder token = data.readStrongBinder();
1584 String packageName = data.readString();
1585 int enterAnim = data.readInt();
1586 int exitAnim = data.readInt();
1587 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001588 reply.writeNoException();
1589 return true;
1590 }
1591
1592 case IS_USER_A_MONKEY_TRANSACTION: {
1593 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001594 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001595 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001596 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001597 return true;
1598 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001599
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001600 case SET_USER_IS_MONKEY_TRANSACTION: {
1601 data.enforceInterface(IActivityManager.descriptor);
1602 final boolean monkey = (data.readInt() == 1);
1603 setUserIsMonkey(monkey);
1604 reply.writeNoException();
1605 return true;
1606 }
1607
Dianne Hackborn860755f2010-06-03 18:47:52 -07001608 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1609 data.enforceInterface(IActivityManager.descriptor);
1610 finishHeavyWeightApp();
1611 reply.writeNoException();
1612 return true;
1613 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001614
1615 case IS_IMMERSIVE_TRANSACTION: {
1616 data.enforceInterface(IActivityManager.descriptor);
1617 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001618 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001619 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001620 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001621 return true;
1622 }
1623
Craig Mautnerd61dc202014-07-07 11:09:11 -07001624 case IS_TOP_OF_TASK_TRANSACTION: {
1625 data.enforceInterface(IActivityManager.descriptor);
1626 IBinder token = data.readStrongBinder();
1627 final boolean isTopOfTask = isTopOfTask(token);
1628 reply.writeNoException();
1629 reply.writeInt(isTopOfTask ? 1 : 0);
1630 return true;
1631 }
1632
Craig Mautner5eda9b32013-07-02 11:58:16 -07001633 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001634 data.enforceInterface(IActivityManager.descriptor);
1635 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001636 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001637 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001638 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001639 return true;
1640 }
1641
1642 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1643 data.enforceInterface(IActivityManager.descriptor);
1644 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001645 final Bundle bundle;
1646 if (data.readInt() == 0) {
1647 bundle = null;
1648 } else {
1649 bundle = data.readBundle();
1650 }
1651 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1652 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001653 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001654 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001655 return true;
1656 }
1657
Craig Mautner233ceee2014-05-09 17:05:11 -07001658 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1659 data.enforceInterface(IActivityManager.descriptor);
1660 IBinder token = data.readStrongBinder();
1661 final ActivityOptions options = getActivityOptions(token);
1662 reply.writeNoException();
1663 reply.writeBundle(options == null ? null : options.toBundle());
1664 return true;
1665 }
1666
Daniel Sandler69a48172010-06-23 16:29:36 -04001667 case SET_IMMERSIVE_TRANSACTION: {
1668 data.enforceInterface(IActivityManager.descriptor);
1669 IBinder token = data.readStrongBinder();
1670 boolean imm = data.readInt() == 1;
1671 setImmersive(token, imm);
1672 reply.writeNoException();
1673 return true;
1674 }
1675
1676 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1677 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001678 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001679 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001680 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001681 return true;
1682 }
1683
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001684 case CRASH_APPLICATION_TRANSACTION: {
1685 data.enforceInterface(IActivityManager.descriptor);
1686 int uid = data.readInt();
1687 int initialPid = data.readInt();
1688 String packageName = data.readString();
1689 String message = data.readString();
1690 crashApplication(uid, initialPid, packageName, message);
1691 reply.writeNoException();
1692 return true;
1693 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001694
1695 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1696 data.enforceInterface(IActivityManager.descriptor);
1697 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001698 int userId = data.readInt();
1699 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001700 reply.writeNoException();
1701 reply.writeString(type);
1702 return true;
1703 }
1704
Dianne Hackborn7e269642010-08-25 19:50:20 -07001705 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1706 data.enforceInterface(IActivityManager.descriptor);
1707 String name = data.readString();
1708 IBinder perm = newUriPermissionOwner(name);
1709 reply.writeNoException();
1710 reply.writeStrongBinder(perm);
1711 return true;
1712 }
1713
1714 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1715 data.enforceInterface(IActivityManager.descriptor);
1716 IBinder owner = data.readStrongBinder();
1717 int fromUid = data.readInt();
1718 String targetPkg = data.readString();
1719 Uri uri = Uri.CREATOR.createFromParcel(data);
1720 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001721 int sourceUserId = data.readInt();
1722 int targetUserId = data.readInt();
1723 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1724 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001725 reply.writeNoException();
1726 return true;
1727 }
1728
1729 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1730 data.enforceInterface(IActivityManager.descriptor);
1731 IBinder owner = data.readStrongBinder();
1732 Uri uri = null;
1733 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001734 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001735 }
1736 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001737 int userId = data.readInt();
1738 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001739 reply.writeNoException();
1740 return true;
1741 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001742
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001743 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1744 data.enforceInterface(IActivityManager.descriptor);
1745 int callingUid = data.readInt();
1746 String targetPkg = data.readString();
1747 Uri uri = Uri.CREATOR.createFromParcel(data);
1748 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001749 int userId = data.readInt();
1750 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001751 reply.writeNoException();
1752 reply.writeInt(res);
1753 return true;
1754 }
1755
Andy McFadden824c5102010-07-09 16:26:57 -07001756 case DUMP_HEAP_TRANSACTION: {
1757 data.enforceInterface(IActivityManager.descriptor);
1758 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001759 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001760 boolean managed = data.readInt() != 0;
1761 String path = data.readString();
1762 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001763 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001764 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001765 reply.writeNoException();
1766 reply.writeInt(res ? 1 : 0);
1767 return true;
1768 }
1769
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001770 case START_ACTIVITIES_TRANSACTION:
1771 {
1772 data.enforceInterface(IActivityManager.descriptor);
1773 IBinder b = data.readStrongBinder();
1774 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001775 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001776 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1777 String[] resolvedTypes = data.createStringArray();
1778 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001779 Bundle options = data.readInt() != 0
1780 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001781 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001782 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001783 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001784 reply.writeNoException();
1785 reply.writeInt(result);
1786 return true;
1787 }
1788
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001789 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1790 {
1791 data.enforceInterface(IActivityManager.descriptor);
1792 int mode = getFrontActivityScreenCompatMode();
1793 reply.writeNoException();
1794 reply.writeInt(mode);
1795 return true;
1796 }
1797
1798 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1799 {
1800 data.enforceInterface(IActivityManager.descriptor);
1801 int mode = data.readInt();
1802 setFrontActivityScreenCompatMode(mode);
1803 reply.writeNoException();
1804 reply.writeInt(mode);
1805 return true;
1806 }
1807
1808 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1809 {
1810 data.enforceInterface(IActivityManager.descriptor);
1811 String pkg = data.readString();
1812 int mode = getPackageScreenCompatMode(pkg);
1813 reply.writeNoException();
1814 reply.writeInt(mode);
1815 return true;
1816 }
1817
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001818 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1819 {
1820 data.enforceInterface(IActivityManager.descriptor);
1821 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001822 int mode = data.readInt();
1823 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001824 reply.writeNoException();
1825 return true;
1826 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001827
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001828 case SWITCH_USER_TRANSACTION: {
1829 data.enforceInterface(IActivityManager.descriptor);
1830 int userid = data.readInt();
1831 boolean result = switchUser(userid);
1832 reply.writeNoException();
1833 reply.writeInt(result ? 1 : 0);
1834 return true;
1835 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001836
Kenny Guy08488bf2014-02-21 17:40:37 +00001837 case START_USER_IN_BACKGROUND_TRANSACTION: {
1838 data.enforceInterface(IActivityManager.descriptor);
1839 int userid = data.readInt();
1840 boolean result = startUserInBackground(userid);
1841 reply.writeNoException();
1842 reply.writeInt(result ? 1 : 0);
1843 return true;
1844 }
1845
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001846 case STOP_USER_TRANSACTION: {
1847 data.enforceInterface(IActivityManager.descriptor);
1848 int userid = data.readInt();
1849 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1850 data.readStrongBinder());
1851 int result = stopUser(userid, callback);
1852 reply.writeNoException();
1853 reply.writeInt(result);
1854 return true;
1855 }
1856
Amith Yamasani52f1d752012-03-28 18:19:29 -07001857 case GET_CURRENT_USER_TRANSACTION: {
1858 data.enforceInterface(IActivityManager.descriptor);
1859 UserInfo userInfo = getCurrentUser();
1860 reply.writeNoException();
1861 userInfo.writeToParcel(reply, 0);
1862 return true;
1863 }
1864
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001865 case IS_USER_RUNNING_TRANSACTION: {
1866 data.enforceInterface(IActivityManager.descriptor);
1867 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001868 boolean orStopping = data.readInt() != 0;
1869 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001870 reply.writeNoException();
1871 reply.writeInt(result ? 1 : 0);
1872 return true;
1873 }
1874
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001875 case GET_RUNNING_USER_IDS_TRANSACTION: {
1876 data.enforceInterface(IActivityManager.descriptor);
1877 int[] result = getRunningUserIds();
1878 reply.writeNoException();
1879 reply.writeIntArray(result);
1880 return true;
1881 }
1882
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001883 case REMOVE_TASK_TRANSACTION:
1884 {
1885 data.enforceInterface(IActivityManager.descriptor);
1886 int taskId = data.readInt();
1887 int fl = data.readInt();
1888 boolean result = removeTask(taskId, fl);
1889 reply.writeNoException();
1890 reply.writeInt(result ? 1 : 0);
1891 return true;
1892 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001893
Jeff Sharkeya4620792011-05-20 15:29:23 -07001894 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1895 data.enforceInterface(IActivityManager.descriptor);
1896 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1897 data.readStrongBinder());
1898 registerProcessObserver(observer);
1899 return true;
1900 }
1901
1902 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1903 data.enforceInterface(IActivityManager.descriptor);
1904 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1905 data.readStrongBinder());
1906 unregisterProcessObserver(observer);
1907 return true;
1908 }
1909
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001910 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1911 {
1912 data.enforceInterface(IActivityManager.descriptor);
1913 String pkg = data.readString();
1914 boolean ask = getPackageAskScreenCompat(pkg);
1915 reply.writeNoException();
1916 reply.writeInt(ask ? 1 : 0);
1917 return true;
1918 }
1919
1920 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1921 {
1922 data.enforceInterface(IActivityManager.descriptor);
1923 String pkg = data.readString();
1924 boolean ask = data.readInt() != 0;
1925 setPackageAskScreenCompat(pkg, ask);
1926 reply.writeNoException();
1927 return true;
1928 }
1929
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001930 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1931 data.enforceInterface(IActivityManager.descriptor);
1932 IIntentSender r = IIntentSender.Stub.asInterface(
1933 data.readStrongBinder());
1934 boolean res = isIntentSenderTargetedToPackage(r);
1935 reply.writeNoException();
1936 reply.writeInt(res ? 1 : 0);
1937 return true;
1938 }
1939
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001940 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1941 data.enforceInterface(IActivityManager.descriptor);
1942 IIntentSender r = IIntentSender.Stub.asInterface(
1943 data.readStrongBinder());
1944 boolean res = isIntentSenderAnActivity(r);
1945 reply.writeNoException();
1946 reply.writeInt(res ? 1 : 0);
1947 return true;
1948 }
1949
Dianne Hackborn81038902012-11-26 17:04:09 -08001950 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1951 data.enforceInterface(IActivityManager.descriptor);
1952 IIntentSender r = IIntentSender.Stub.asInterface(
1953 data.readStrongBinder());
1954 Intent intent = getIntentForIntentSender(r);
1955 reply.writeNoException();
1956 if (intent != null) {
1957 reply.writeInt(1);
1958 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1959 } else {
1960 reply.writeInt(0);
1961 }
1962 return true;
1963 }
1964
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001965 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1966 data.enforceInterface(IActivityManager.descriptor);
1967 IIntentSender r = IIntentSender.Stub.asInterface(
1968 data.readStrongBinder());
1969 String prefix = data.readString();
1970 String tag = getTagForIntentSender(r, prefix);
1971 reply.writeNoException();
1972 reply.writeString(tag);
1973 return true;
1974 }
1975
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001976 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1977 data.enforceInterface(IActivityManager.descriptor);
1978 Configuration config = Configuration.CREATOR.createFromParcel(data);
1979 updatePersistentConfiguration(config);
1980 reply.writeNoException();
1981 return true;
1982 }
1983
Dianne Hackbornb437e092011-08-05 17:50:29 -07001984 case GET_PROCESS_PSS_TRANSACTION: {
1985 data.enforceInterface(IActivityManager.descriptor);
1986 int[] pids = data.createIntArray();
1987 long[] pss = getProcessPss(pids);
1988 reply.writeNoException();
1989 reply.writeLongArray(pss);
1990 return true;
1991 }
1992
Dianne Hackborn661cd522011-08-22 00:26:20 -07001993 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1994 data.enforceInterface(IActivityManager.descriptor);
1995 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1996 boolean always = data.readInt() != 0;
1997 showBootMessage(msg, always);
1998 reply.writeNoException();
1999 return true;
2000 }
2001
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002002 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002003 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002004 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002005 reply.writeNoException();
2006 return true;
2007 }
2008
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002009 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002010 data.enforceInterface(IActivityManager.descriptor);
2011 IBinder token = data.readStrongBinder();
2012 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002013 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002014 reply.writeNoException();
2015 reply.writeInt(res ? 1 : 0);
2016 return true;
2017 }
2018
2019 case NAVIGATE_UP_TO_TRANSACTION: {
2020 data.enforceInterface(IActivityManager.descriptor);
2021 IBinder token = data.readStrongBinder();
2022 Intent target = Intent.CREATOR.createFromParcel(data);
2023 int resultCode = data.readInt();
2024 Intent resultData = null;
2025 if (data.readInt() != 0) {
2026 resultData = Intent.CREATOR.createFromParcel(data);
2027 }
2028 boolean res = navigateUpTo(token, target, resultCode, resultData);
2029 reply.writeNoException();
2030 reply.writeInt(res ? 1 : 0);
2031 return true;
2032 }
2033
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002034 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2035 data.enforceInterface(IActivityManager.descriptor);
2036 IBinder token = data.readStrongBinder();
2037 int res = getLaunchedFromUid(token);
2038 reply.writeNoException();
2039 reply.writeInt(res);
2040 return true;
2041 }
2042
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002043 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2044 data.enforceInterface(IActivityManager.descriptor);
2045 IBinder token = data.readStrongBinder();
2046 String res = getLaunchedFromPackage(token);
2047 reply.writeNoException();
2048 reply.writeString(res);
2049 return true;
2050 }
2051
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002052 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2053 data.enforceInterface(IActivityManager.descriptor);
2054 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2055 data.readStrongBinder());
2056 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002057 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002058 return true;
2059 }
2060
2061 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2062 data.enforceInterface(IActivityManager.descriptor);
2063 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2064 data.readStrongBinder());
2065 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002066 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002067 return true;
2068 }
2069
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002070 case REQUEST_BUG_REPORT_TRANSACTION: {
2071 data.enforceInterface(IActivityManager.descriptor);
2072 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002073 reply.writeNoException();
2074 return true;
2075 }
2076
2077 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2078 data.enforceInterface(IActivityManager.descriptor);
2079 int pid = data.readInt();
2080 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002081 String reason = data.readString();
2082 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002083 reply.writeNoException();
2084 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002085 return true;
2086 }
2087
Adam Skorydfc7fd72013-08-05 19:23:41 -07002088 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002089 data.enforceInterface(IActivityManager.descriptor);
2090 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002091 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002092 reply.writeNoException();
2093 reply.writeBundle(res);
2094 return true;
2095 }
2096
Adam Skorydfc7fd72013-08-05 19:23:41 -07002097 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002098 data.enforceInterface(IActivityManager.descriptor);
2099 IBinder token = data.readStrongBinder();
2100 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002101 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002102 reply.writeNoException();
2103 return true;
2104 }
2105
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002106 case KILL_UID_TRANSACTION: {
2107 data.enforceInterface(IActivityManager.descriptor);
2108 int uid = data.readInt();
2109 String reason = data.readString();
2110 killUid(uid, reason);
2111 reply.writeNoException();
2112 return true;
2113 }
2114
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002115 case HANG_TRANSACTION: {
2116 data.enforceInterface(IActivityManager.descriptor);
2117 IBinder who = data.readStrongBinder();
2118 boolean allowRestart = data.readInt() != 0;
2119 hang(who, allowRestart);
2120 reply.writeNoException();
2121 return true;
2122 }
2123
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002124 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2125 data.enforceInterface(IActivityManager.descriptor);
2126 IBinder token = data.readStrongBinder();
2127 reportActivityFullyDrawn(token);
2128 reply.writeNoException();
2129 return true;
2130 }
2131
Craig Mautner5eda9b32013-07-02 11:58:16 -07002132 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2133 data.enforceInterface(IActivityManager.descriptor);
2134 IBinder token = data.readStrongBinder();
2135 notifyActivityDrawn(token);
2136 reply.writeNoException();
2137 return true;
2138 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002139
2140 case RESTART_TRANSACTION: {
2141 data.enforceInterface(IActivityManager.descriptor);
2142 restart();
2143 reply.writeNoException();
2144 return true;
2145 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002146
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002147 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2148 data.enforceInterface(IActivityManager.descriptor);
2149 performIdleMaintenance();
2150 reply.writeNoException();
2151 return true;
2152 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002153
2154 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2155 data.enforceInterface(IActivityManager.descriptor);
2156 IBinder parentActivityToken = data.readStrongBinder();
2157 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002158 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002159 IActivityContainer activityContainer =
2160 createActivityContainer(parentActivityToken, callback);
2161 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002162 if (activityContainer != null) {
2163 reply.writeInt(1);
2164 reply.writeStrongBinder(activityContainer.asBinder());
2165 } else {
2166 reply.writeInt(0);
2167 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002168 return true;
2169 }
2170
Craig Mautner95da1082014-02-24 17:54:35 -08002171 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2172 data.enforceInterface(IActivityManager.descriptor);
2173 IActivityContainer activityContainer =
2174 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2175 deleteActivityContainer(activityContainer);
2176 reply.writeNoException();
2177 return true;
2178 }
2179
Craig Mautnere0a38842013-12-16 16:14:02 -08002180 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2181 data.enforceInterface(IActivityManager.descriptor);
2182 IBinder activityToken = data.readStrongBinder();
2183 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2184 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002185 if (activityContainer != null) {
2186 reply.writeInt(1);
2187 reply.writeStrongBinder(activityContainer.asBinder());
2188 } else {
2189 reply.writeInt(0);
2190 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002191 return true;
2192 }
2193
Craig Mautner4a1cb222013-12-04 16:14:06 -08002194 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2195 data.enforceInterface(IActivityManager.descriptor);
2196 IBinder homeActivityToken = getHomeActivityToken();
2197 reply.writeNoException();
2198 reply.writeStrongBinder(homeActivityToken);
2199 return true;
2200 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002201
2202 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2203 data.enforceInterface(IActivityManager.descriptor);
2204 final int taskId = data.readInt();
2205 startLockTaskMode(taskId);
2206 reply.writeNoException();
2207 return true;
2208 }
2209
2210 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2211 data.enforceInterface(IActivityManager.descriptor);
2212 IBinder token = data.readStrongBinder();
2213 startLockTaskMode(token);
2214 reply.writeNoException();
2215 return true;
2216 }
2217
Craig Mautnerd61dc202014-07-07 11:09:11 -07002218 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002219 data.enforceInterface(IActivityManager.descriptor);
2220 startLockTaskModeOnCurrent();
2221 reply.writeNoException();
2222 return true;
2223 }
2224
Craig Mautneraea74a52014-03-08 14:23:10 -08002225 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2226 data.enforceInterface(IActivityManager.descriptor);
2227 stopLockTaskMode();
2228 reply.writeNoException();
2229 return true;
2230 }
2231
Craig Mautnerd61dc202014-07-07 11:09:11 -07002232 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002233 data.enforceInterface(IActivityManager.descriptor);
2234 stopLockTaskModeOnCurrent();
2235 reply.writeNoException();
2236 return true;
2237 }
2238
Craig Mautneraea74a52014-03-08 14:23:10 -08002239 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2240 data.enforceInterface(IActivityManager.descriptor);
2241 final boolean isInLockTaskMode = isInLockTaskMode();
2242 reply.writeNoException();
2243 reply.writeInt(isInLockTaskMode ? 1 : 0);
2244 return true;
2245 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002246
Winson Chunga449dc02014-05-16 11:15:04 -07002247 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002248 data.enforceInterface(IActivityManager.descriptor);
2249 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002250 ActivityManager.TaskDescription values =
2251 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2252 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002253 reply.writeNoException();
2254 return true;
2255 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002256
Jose Lima4b6c6692014-08-12 17:41:12 -07002257 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002258 data.enforceInterface(IActivityManager.descriptor);
2259 IBinder token = data.readStrongBinder();
2260 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002261 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002262 reply.writeNoException();
2263 reply.writeInt(success ? 1 : 0);
2264 return true;
2265 }
2266
Jose Lima4b6c6692014-08-12 17:41:12 -07002267 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002268 data.enforceInterface(IActivityManager.descriptor);
2269 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002270 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002271 reply.writeNoException();
2272 reply.writeInt(enabled ? 1 : 0);
2273 return true;
2274 }
2275
Jose Lima4b6c6692014-08-12 17:41:12 -07002276 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002277 data.enforceInterface(IActivityManager.descriptor);
2278 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002279 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002280 reply.writeNoException();
2281 return true;
2282 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002283
2284 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2285 data.enforceInterface(IActivityManager.descriptor);
2286 IBinder token = data.readStrongBinder();
2287 notifyLaunchTaskBehindComplete(token);
2288 reply.writeNoException();
2289 return true;
2290 }
Craig Mautner8746a472014-07-24 15:12:54 -07002291
2292 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2293 data.enforceInterface(IActivityManager.descriptor);
2294 IBinder token = data.readStrongBinder();
2295 notifyEnterAnimationComplete(token);
2296 reply.writeNoException();
2297 return true;
2298 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002299 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002300
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002301 return super.onTransact(code, data, reply, flags);
2302 }
2303
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002304 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002305 return this;
2306 }
2307
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002308 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2309 protected IActivityManager create() {
2310 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002311 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002312 Log.v("ActivityManager", "default service binder = " + b);
2313 }
2314 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002315 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002316 Log.v("ActivityManager", "default service = " + am);
2317 }
2318 return am;
2319 }
2320 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002321}
2322
2323class ActivityManagerProxy implements IActivityManager
2324{
2325 public ActivityManagerProxy(IBinder remote)
2326 {
2327 mRemote = remote;
2328 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002329
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002330 public IBinder asBinder()
2331 {
2332 return mRemote;
2333 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002334
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002335 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002336 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002337 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002338 Parcel data = Parcel.obtain();
2339 Parcel reply = Parcel.obtain();
2340 data.writeInterfaceToken(IActivityManager.descriptor);
2341 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002342 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002343 intent.writeToParcel(data, 0);
2344 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002345 data.writeStrongBinder(resultTo);
2346 data.writeString(resultWho);
2347 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002348 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002349 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002350 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002351 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002352 } else {
2353 data.writeInt(0);
2354 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002355 if (options != null) {
2356 data.writeInt(1);
2357 options.writeToParcel(data, 0);
2358 } else {
2359 data.writeInt(0);
2360 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002361 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2362 reply.readException();
2363 int result = reply.readInt();
2364 reply.recycle();
2365 data.recycle();
2366 return result;
2367 }
Amith Yamasani82644082012-08-03 13:09:11 -07002368
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002369 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002370 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002371 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2372 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002373 Parcel data = Parcel.obtain();
2374 Parcel reply = Parcel.obtain();
2375 data.writeInterfaceToken(IActivityManager.descriptor);
2376 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002377 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002378 intent.writeToParcel(data, 0);
2379 data.writeString(resolvedType);
2380 data.writeStrongBinder(resultTo);
2381 data.writeString(resultWho);
2382 data.writeInt(requestCode);
2383 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002384 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002385 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002386 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002387 } else {
2388 data.writeInt(0);
2389 }
2390 if (options != null) {
2391 data.writeInt(1);
2392 options.writeToParcel(data, 0);
2393 } else {
2394 data.writeInt(0);
2395 }
2396 data.writeInt(userId);
2397 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2398 reply.readException();
2399 int result = reply.readInt();
2400 reply.recycle();
2401 data.recycle();
2402 return result;
2403 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002404 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2405 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002406 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002407 Parcel data = Parcel.obtain();
2408 Parcel reply = Parcel.obtain();
2409 data.writeInterfaceToken(IActivityManager.descriptor);
2410 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2411 data.writeString(callingPackage);
2412 intent.writeToParcel(data, 0);
2413 data.writeString(resolvedType);
2414 data.writeStrongBinder(resultTo);
2415 data.writeString(resultWho);
2416 data.writeInt(requestCode);
2417 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002418 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002419 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002420 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002421 } else {
2422 data.writeInt(0);
2423 }
2424 if (options != null) {
2425 data.writeInt(1);
2426 options.writeToParcel(data, 0);
2427 } else {
2428 data.writeInt(0);
2429 }
2430 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2431 reply.readException();
2432 int result = reply.readInt();
2433 reply.recycle();
2434 data.recycle();
2435 return result;
2436 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002437 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2438 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002439 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2440 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002441 Parcel data = Parcel.obtain();
2442 Parcel reply = Parcel.obtain();
2443 data.writeInterfaceToken(IActivityManager.descriptor);
2444 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002445 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002446 intent.writeToParcel(data, 0);
2447 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002448 data.writeStrongBinder(resultTo);
2449 data.writeString(resultWho);
2450 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002451 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002452 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002453 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002454 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002455 } else {
2456 data.writeInt(0);
2457 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002458 if (options != null) {
2459 data.writeInt(1);
2460 options.writeToParcel(data, 0);
2461 } else {
2462 data.writeInt(0);
2463 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002464 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002465 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2466 reply.readException();
2467 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2468 reply.recycle();
2469 data.recycle();
2470 return result;
2471 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002472 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2473 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002474 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002475 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002476 Parcel data = Parcel.obtain();
2477 Parcel reply = Parcel.obtain();
2478 data.writeInterfaceToken(IActivityManager.descriptor);
2479 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002480 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002481 intent.writeToParcel(data, 0);
2482 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002483 data.writeStrongBinder(resultTo);
2484 data.writeString(resultWho);
2485 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002486 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002487 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002488 if (options != null) {
2489 data.writeInt(1);
2490 options.writeToParcel(data, 0);
2491 } else {
2492 data.writeInt(0);
2493 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002494 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002495 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2496 reply.readException();
2497 int result = reply.readInt();
2498 reply.recycle();
2499 data.recycle();
2500 return result;
2501 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002502 public int startActivityIntentSender(IApplicationThread caller,
2503 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002504 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002505 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002506 Parcel data = Parcel.obtain();
2507 Parcel reply = Parcel.obtain();
2508 data.writeInterfaceToken(IActivityManager.descriptor);
2509 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2510 intent.writeToParcel(data, 0);
2511 if (fillInIntent != null) {
2512 data.writeInt(1);
2513 fillInIntent.writeToParcel(data, 0);
2514 } else {
2515 data.writeInt(0);
2516 }
2517 data.writeString(resolvedType);
2518 data.writeStrongBinder(resultTo);
2519 data.writeString(resultWho);
2520 data.writeInt(requestCode);
2521 data.writeInt(flagsMask);
2522 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002523 if (options != null) {
2524 data.writeInt(1);
2525 options.writeToParcel(data, 0);
2526 } else {
2527 data.writeInt(0);
2528 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002529 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002530 reply.readException();
2531 int result = reply.readInt();
2532 reply.recycle();
2533 data.recycle();
2534 return result;
2535 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002536 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2537 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002538 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2539 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002540 Parcel data = Parcel.obtain();
2541 Parcel reply = Parcel.obtain();
2542 data.writeInterfaceToken(IActivityManager.descriptor);
2543 data.writeString(callingPackage);
2544 data.writeInt(callingPid);
2545 data.writeInt(callingUid);
2546 intent.writeToParcel(data, 0);
2547 data.writeString(resolvedType);
2548 data.writeStrongBinder(session.asBinder());
2549 data.writeStrongBinder(interactor.asBinder());
2550 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002551 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002552 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002553 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002554 } else {
2555 data.writeInt(0);
2556 }
2557 if (options != null) {
2558 data.writeInt(1);
2559 options.writeToParcel(data, 0);
2560 } else {
2561 data.writeInt(0);
2562 }
2563 data.writeInt(userId);
2564 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2565 reply.readException();
2566 int result = reply.readInt();
2567 reply.recycle();
2568 data.recycle();
2569 return result;
2570 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002571 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002572 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002573 Parcel data = Parcel.obtain();
2574 Parcel reply = Parcel.obtain();
2575 data.writeInterfaceToken(IActivityManager.descriptor);
2576 data.writeStrongBinder(callingActivity);
2577 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002578 if (options != null) {
2579 data.writeInt(1);
2580 options.writeToParcel(data, 0);
2581 } else {
2582 data.writeInt(0);
2583 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002584 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2585 reply.readException();
2586 int result = reply.readInt();
2587 reply.recycle();
2588 data.recycle();
2589 return result != 0;
2590 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002591 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2592 Parcel data = Parcel.obtain();
2593 Parcel reply = Parcel.obtain();
2594 data.writeInterfaceToken(IActivityManager.descriptor);
2595 data.writeInt(taskId);
2596 if (options == null) {
2597 data.writeInt(0);
2598 } else {
2599 data.writeInt(1);
2600 options.writeToParcel(data, 0);
2601 }
2602 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2603 reply.readException();
2604 int result = reply.readInt();
2605 reply.recycle();
2606 data.recycle();
2607 return result;
2608 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002609 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002610 throws RemoteException {
2611 Parcel data = Parcel.obtain();
2612 Parcel reply = Parcel.obtain();
2613 data.writeInterfaceToken(IActivityManager.descriptor);
2614 data.writeStrongBinder(token);
2615 data.writeInt(resultCode);
2616 if (resultData != null) {
2617 data.writeInt(1);
2618 resultData.writeToParcel(data, 0);
2619 } else {
2620 data.writeInt(0);
2621 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002622 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002623 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2624 reply.readException();
2625 boolean res = reply.readInt() != 0;
2626 data.recycle();
2627 reply.recycle();
2628 return res;
2629 }
2630 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2631 {
2632 Parcel data = Parcel.obtain();
2633 Parcel reply = Parcel.obtain();
2634 data.writeInterfaceToken(IActivityManager.descriptor);
2635 data.writeStrongBinder(token);
2636 data.writeString(resultWho);
2637 data.writeInt(requestCode);
2638 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2639 reply.readException();
2640 data.recycle();
2641 reply.recycle();
2642 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002643 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2644 Parcel data = Parcel.obtain();
2645 Parcel reply = Parcel.obtain();
2646 data.writeInterfaceToken(IActivityManager.descriptor);
2647 data.writeStrongBinder(token);
2648 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2649 reply.readException();
2650 boolean res = reply.readInt() != 0;
2651 data.recycle();
2652 reply.recycle();
2653 return res;
2654 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002655 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2656 Parcel data = Parcel.obtain();
2657 Parcel reply = Parcel.obtain();
2658 data.writeInterfaceToken(IActivityManager.descriptor);
2659 data.writeStrongBinder(session.asBinder());
2660 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2661 reply.readException();
2662 data.recycle();
2663 reply.recycle();
2664 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002665 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2666 Parcel data = Parcel.obtain();
2667 Parcel reply = Parcel.obtain();
2668 data.writeInterfaceToken(IActivityManager.descriptor);
2669 data.writeStrongBinder(token);
2670 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2671 reply.readException();
2672 boolean res = reply.readInt() != 0;
2673 data.recycle();
2674 reply.recycle();
2675 return res;
2676 }
2677 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2678 Parcel data = Parcel.obtain();
2679 Parcel reply = Parcel.obtain();
2680 data.writeInterfaceToken(IActivityManager.descriptor);
2681 data.writeStrongBinder(app.asBinder());
2682 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2683 reply.readException();
2684 data.recycle();
2685 reply.recycle();
2686 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002687 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2688 Parcel data = Parcel.obtain();
2689 Parcel reply = Parcel.obtain();
2690 data.writeInterfaceToken(IActivityManager.descriptor);
2691 data.writeStrongBinder(token);
2692 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2693 reply.readException();
2694 boolean res = reply.readInt() != 0;
2695 data.recycle();
2696 reply.recycle();
2697 return res;
2698 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002699 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002700 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002701 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002702 {
2703 Parcel data = Parcel.obtain();
2704 Parcel reply = Parcel.obtain();
2705 data.writeInterfaceToken(IActivityManager.descriptor);
2706 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002707 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002708 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2709 filter.writeToParcel(data, 0);
2710 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002711 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002712 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2713 reply.readException();
2714 Intent intent = null;
2715 int haveIntent = reply.readInt();
2716 if (haveIntent != 0) {
2717 intent = Intent.CREATOR.createFromParcel(reply);
2718 }
2719 reply.recycle();
2720 data.recycle();
2721 return intent;
2722 }
2723 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2724 {
2725 Parcel data = Parcel.obtain();
2726 Parcel reply = Parcel.obtain();
2727 data.writeInterfaceToken(IActivityManager.descriptor);
2728 data.writeStrongBinder(receiver.asBinder());
2729 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2730 reply.readException();
2731 data.recycle();
2732 reply.recycle();
2733 }
2734 public int broadcastIntent(IApplicationThread caller,
2735 Intent intent, String resolvedType, IIntentReceiver resultTo,
2736 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002737 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002738 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002739 {
2740 Parcel data = Parcel.obtain();
2741 Parcel reply = Parcel.obtain();
2742 data.writeInterfaceToken(IActivityManager.descriptor);
2743 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2744 intent.writeToParcel(data, 0);
2745 data.writeString(resolvedType);
2746 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2747 data.writeInt(resultCode);
2748 data.writeString(resultData);
2749 data.writeBundle(map);
2750 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002751 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002752 data.writeInt(serialized ? 1 : 0);
2753 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002754 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002755 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2756 reply.readException();
2757 int res = reply.readInt();
2758 reply.recycle();
2759 data.recycle();
2760 return res;
2761 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002762 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2763 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002764 {
2765 Parcel data = Parcel.obtain();
2766 Parcel reply = Parcel.obtain();
2767 data.writeInterfaceToken(IActivityManager.descriptor);
2768 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2769 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002770 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002771 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2772 reply.readException();
2773 data.recycle();
2774 reply.recycle();
2775 }
2776 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2777 {
2778 Parcel data = Parcel.obtain();
2779 Parcel reply = Parcel.obtain();
2780 data.writeInterfaceToken(IActivityManager.descriptor);
2781 data.writeStrongBinder(who);
2782 data.writeInt(resultCode);
2783 data.writeString(resultData);
2784 data.writeBundle(map);
2785 data.writeInt(abortBroadcast ? 1 : 0);
2786 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2787 reply.readException();
2788 data.recycle();
2789 reply.recycle();
2790 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002791 public void attachApplication(IApplicationThread app) throws RemoteException
2792 {
2793 Parcel data = Parcel.obtain();
2794 Parcel reply = Parcel.obtain();
2795 data.writeInterfaceToken(IActivityManager.descriptor);
2796 data.writeStrongBinder(app.asBinder());
2797 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2798 reply.readException();
2799 data.recycle();
2800 reply.recycle();
2801 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002802 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2803 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002804 {
2805 Parcel data = Parcel.obtain();
2806 Parcel reply = Parcel.obtain();
2807 data.writeInterfaceToken(IActivityManager.descriptor);
2808 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002809 if (config != null) {
2810 data.writeInt(1);
2811 config.writeToParcel(data, 0);
2812 } else {
2813 data.writeInt(0);
2814 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002815 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002816 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2817 reply.readException();
2818 data.recycle();
2819 reply.recycle();
2820 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002821 public void activityResumed(IBinder token) throws RemoteException
2822 {
2823 Parcel data = Parcel.obtain();
2824 Parcel reply = Parcel.obtain();
2825 data.writeInterfaceToken(IActivityManager.descriptor);
2826 data.writeStrongBinder(token);
2827 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2828 reply.readException();
2829 data.recycle();
2830 reply.recycle();
2831 }
Craig Mautnera0026042014-04-23 11:45:37 -07002832 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002833 {
2834 Parcel data = Parcel.obtain();
2835 Parcel reply = Parcel.obtain();
2836 data.writeInterfaceToken(IActivityManager.descriptor);
2837 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002838 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002839 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2840 reply.readException();
2841 data.recycle();
2842 reply.recycle();
2843 }
2844 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002845 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002846 {
2847 Parcel data = Parcel.obtain();
2848 Parcel reply = Parcel.obtain();
2849 data.writeInterfaceToken(IActivityManager.descriptor);
2850 data.writeStrongBinder(token);
2851 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002852 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002853 TextUtils.writeToParcel(description, data, 0);
2854 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2855 reply.readException();
2856 data.recycle();
2857 reply.recycle();
2858 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002859 public void activitySlept(IBinder token) throws RemoteException
2860 {
2861 Parcel data = Parcel.obtain();
2862 Parcel reply = Parcel.obtain();
2863 data.writeInterfaceToken(IActivityManager.descriptor);
2864 data.writeStrongBinder(token);
2865 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2866 reply.readException();
2867 data.recycle();
2868 reply.recycle();
2869 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002870 public void activityDestroyed(IBinder token) throws RemoteException
2871 {
2872 Parcel data = Parcel.obtain();
2873 Parcel reply = Parcel.obtain();
2874 data.writeInterfaceToken(IActivityManager.descriptor);
2875 data.writeStrongBinder(token);
2876 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2877 reply.readException();
2878 data.recycle();
2879 reply.recycle();
2880 }
2881 public String getCallingPackage(IBinder token) throws RemoteException
2882 {
2883 Parcel data = Parcel.obtain();
2884 Parcel reply = Parcel.obtain();
2885 data.writeInterfaceToken(IActivityManager.descriptor);
2886 data.writeStrongBinder(token);
2887 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2888 reply.readException();
2889 String res = reply.readString();
2890 data.recycle();
2891 reply.recycle();
2892 return res;
2893 }
2894 public ComponentName getCallingActivity(IBinder token)
2895 throws RemoteException {
2896 Parcel data = Parcel.obtain();
2897 Parcel reply = Parcel.obtain();
2898 data.writeInterfaceToken(IActivityManager.descriptor);
2899 data.writeStrongBinder(token);
2900 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2901 reply.readException();
2902 ComponentName res = ComponentName.readFromParcel(reply);
2903 data.recycle();
2904 reply.recycle();
2905 return res;
2906 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002907 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07002908 Parcel data = Parcel.obtain();
2909 Parcel reply = Parcel.obtain();
2910 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002911 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07002912 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2913 reply.readException();
2914 ArrayList<IAppTask> list = null;
2915 int N = reply.readInt();
2916 if (N >= 0) {
2917 list = new ArrayList<IAppTask>();
2918 while (N > 0) {
2919 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2920 list.add(task);
2921 N--;
2922 }
2923 }
2924 data.recycle();
2925 reply.recycle();
2926 return list;
2927 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07002928 public int addAppTask(IBinder activityToken, Intent intent,
2929 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
2930 Parcel data = Parcel.obtain();
2931 Parcel reply = Parcel.obtain();
2932 data.writeInterfaceToken(IActivityManager.descriptor);
2933 data.writeStrongBinder(activityToken);
2934 intent.writeToParcel(data, 0);
2935 description.writeToParcel(data, 0);
2936 thumbnail.writeToParcel(data, 0);
2937 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
2938 reply.readException();
2939 int res = reply.readInt();
2940 data.recycle();
2941 reply.recycle();
2942 return res;
2943 }
2944 public Point getAppTaskThumbnailSize() throws RemoteException {
2945 Parcel data = Parcel.obtain();
2946 Parcel reply = Parcel.obtain();
2947 data.writeInterfaceToken(IActivityManager.descriptor);
2948 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
2949 reply.readException();
2950 Point size = Point.CREATOR.createFromParcel(reply);
2951 data.recycle();
2952 reply.recycle();
2953 return size;
2954 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002955 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002956 Parcel data = Parcel.obtain();
2957 Parcel reply = Parcel.obtain();
2958 data.writeInterfaceToken(IActivityManager.descriptor);
2959 data.writeInt(maxNum);
2960 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002961 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2962 reply.readException();
2963 ArrayList list = null;
2964 int N = reply.readInt();
2965 if (N >= 0) {
2966 list = new ArrayList();
2967 while (N > 0) {
2968 ActivityManager.RunningTaskInfo info =
2969 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002970 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002971 list.add(info);
2972 N--;
2973 }
2974 }
2975 data.recycle();
2976 reply.recycle();
2977 return list;
2978 }
2979 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002980 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002981 Parcel data = Parcel.obtain();
2982 Parcel reply = Parcel.obtain();
2983 data.writeInterfaceToken(IActivityManager.descriptor);
2984 data.writeInt(maxNum);
2985 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002986 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002987 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2988 reply.readException();
2989 ArrayList<ActivityManager.RecentTaskInfo> list
2990 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2991 data.recycle();
2992 reply.recycle();
2993 return list;
2994 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002995 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002996 Parcel data = Parcel.obtain();
2997 Parcel reply = Parcel.obtain();
2998 data.writeInterfaceToken(IActivityManager.descriptor);
2999 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003000 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003001 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003002 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003003 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003004 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003005 }
3006 data.recycle();
3007 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003008 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003009 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003010 public List getServices(int maxNum, int flags) throws RemoteException {
3011 Parcel data = Parcel.obtain();
3012 Parcel reply = Parcel.obtain();
3013 data.writeInterfaceToken(IActivityManager.descriptor);
3014 data.writeInt(maxNum);
3015 data.writeInt(flags);
3016 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3017 reply.readException();
3018 ArrayList list = null;
3019 int N = reply.readInt();
3020 if (N >= 0) {
3021 list = new ArrayList();
3022 while (N > 0) {
3023 ActivityManager.RunningServiceInfo info =
3024 ActivityManager.RunningServiceInfo.CREATOR
3025 .createFromParcel(reply);
3026 list.add(info);
3027 N--;
3028 }
3029 }
3030 data.recycle();
3031 reply.recycle();
3032 return list;
3033 }
3034 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3035 throws RemoteException {
3036 Parcel data = Parcel.obtain();
3037 Parcel reply = Parcel.obtain();
3038 data.writeInterfaceToken(IActivityManager.descriptor);
3039 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3040 reply.readException();
3041 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3042 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3043 data.recycle();
3044 reply.recycle();
3045 return list;
3046 }
3047 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3048 throws RemoteException {
3049 Parcel data = Parcel.obtain();
3050 Parcel reply = Parcel.obtain();
3051 data.writeInterfaceToken(IActivityManager.descriptor);
3052 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3053 reply.readException();
3054 ArrayList<ActivityManager.RunningAppProcessInfo> list
3055 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3056 data.recycle();
3057 reply.recycle();
3058 return list;
3059 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003060 public List<ApplicationInfo> getRunningExternalApplications()
3061 throws RemoteException {
3062 Parcel data = Parcel.obtain();
3063 Parcel reply = Parcel.obtain();
3064 data.writeInterfaceToken(IActivityManager.descriptor);
3065 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3066 reply.readException();
3067 ArrayList<ApplicationInfo> list
3068 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3069 data.recycle();
3070 reply.recycle();
3071 return list;
3072 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003073 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003074 {
3075 Parcel data = Parcel.obtain();
3076 Parcel reply = Parcel.obtain();
3077 data.writeInterfaceToken(IActivityManager.descriptor);
3078 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003079 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003080 if (options != null) {
3081 data.writeInt(1);
3082 options.writeToParcel(data, 0);
3083 } else {
3084 data.writeInt(0);
3085 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003086 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3087 reply.readException();
3088 data.recycle();
3089 reply.recycle();
3090 }
3091 public void moveTaskToBack(int task) throws RemoteException
3092 {
3093 Parcel data = Parcel.obtain();
3094 Parcel reply = Parcel.obtain();
3095 data.writeInterfaceToken(IActivityManager.descriptor);
3096 data.writeInt(task);
3097 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3098 reply.readException();
3099 data.recycle();
3100 reply.recycle();
3101 }
3102 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3103 throws RemoteException {
3104 Parcel data = Parcel.obtain();
3105 Parcel reply = Parcel.obtain();
3106 data.writeInterfaceToken(IActivityManager.descriptor);
3107 data.writeStrongBinder(token);
3108 data.writeInt(nonRoot ? 1 : 0);
3109 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3110 reply.readException();
3111 boolean res = reply.readInt() != 0;
3112 data.recycle();
3113 reply.recycle();
3114 return res;
3115 }
3116 public void moveTaskBackwards(int task) throws RemoteException
3117 {
3118 Parcel data = Parcel.obtain();
3119 Parcel reply = Parcel.obtain();
3120 data.writeInterfaceToken(IActivityManager.descriptor);
3121 data.writeInt(task);
3122 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3123 reply.readException();
3124 data.recycle();
3125 reply.recycle();
3126 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003127 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003128 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3129 {
3130 Parcel data = Parcel.obtain();
3131 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003132 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003133 data.writeInt(taskId);
3134 data.writeInt(stackId);
3135 data.writeInt(toTop ? 1 : 0);
3136 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3137 reply.readException();
3138 data.recycle();
3139 reply.recycle();
3140 }
3141 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003142 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003143 {
3144 Parcel data = Parcel.obtain();
3145 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003146 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003147 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003148 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003149 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003150 reply.readException();
3151 data.recycle();
3152 reply.recycle();
3153 }
Craig Mautner967212c2013-04-13 21:10:58 -07003154 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003155 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003156 {
3157 Parcel data = Parcel.obtain();
3158 Parcel reply = Parcel.obtain();
3159 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003160 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003161 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003162 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003163 data.recycle();
3164 reply.recycle();
3165 return list;
3166 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003167 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003168 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003169 {
3170 Parcel data = Parcel.obtain();
3171 Parcel reply = Parcel.obtain();
3172 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003173 data.writeInt(stackId);
3174 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003175 reply.readException();
3176 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003177 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003178 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003179 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003180 }
3181 data.recycle();
3182 reply.recycle();
3183 return info;
3184 }
3185 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003186 public boolean isInHomeStack(int taskId) throws RemoteException {
3187 Parcel data = Parcel.obtain();
3188 Parcel reply = Parcel.obtain();
3189 data.writeInterfaceToken(IActivityManager.descriptor);
3190 data.writeInt(taskId);
3191 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3192 reply.readException();
3193 boolean isInHomeStack = reply.readInt() > 0;
3194 data.recycle();
3195 reply.recycle();
3196 return isInHomeStack;
3197 }
3198 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003199 public void setFocusedStack(int stackId) throws RemoteException
3200 {
3201 Parcel data = Parcel.obtain();
3202 Parcel reply = Parcel.obtain();
3203 data.writeInterfaceToken(IActivityManager.descriptor);
3204 data.writeInt(stackId);
3205 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3206 reply.readException();
3207 data.recycle();
3208 reply.recycle();
3209 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003210 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3211 {
3212 Parcel data = Parcel.obtain();
3213 Parcel reply = Parcel.obtain();
3214 data.writeInterfaceToken(IActivityManager.descriptor);
3215 data.writeStrongBinder(token);
3216 data.writeInt(onlyRoot ? 1 : 0);
3217 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3218 reply.readException();
3219 int res = reply.readInt();
3220 data.recycle();
3221 reply.recycle();
3222 return res;
3223 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003224 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003225 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003226 Parcel data = Parcel.obtain();
3227 Parcel reply = Parcel.obtain();
3228 data.writeInterfaceToken(IActivityManager.descriptor);
3229 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3230 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003231 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003232 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003233 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3234 reply.readException();
3235 int res = reply.readInt();
3236 ContentProviderHolder cph = null;
3237 if (res != 0) {
3238 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3239 }
3240 data.recycle();
3241 reply.recycle();
3242 return cph;
3243 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003244 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3245 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003246 Parcel data = Parcel.obtain();
3247 Parcel reply = Parcel.obtain();
3248 data.writeInterfaceToken(IActivityManager.descriptor);
3249 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003250 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003251 data.writeStrongBinder(token);
3252 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3253 reply.readException();
3254 int res = reply.readInt();
3255 ContentProviderHolder cph = null;
3256 if (res != 0) {
3257 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3258 }
3259 data.recycle();
3260 reply.recycle();
3261 return cph;
3262 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003263 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003264 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003265 {
3266 Parcel data = Parcel.obtain();
3267 Parcel reply = Parcel.obtain();
3268 data.writeInterfaceToken(IActivityManager.descriptor);
3269 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3270 data.writeTypedList(providers);
3271 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3272 reply.readException();
3273 data.recycle();
3274 reply.recycle();
3275 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003276 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3277 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003278 Parcel data = Parcel.obtain();
3279 Parcel reply = Parcel.obtain();
3280 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003281 data.writeStrongBinder(connection);
3282 data.writeInt(stable);
3283 data.writeInt(unstable);
3284 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3285 reply.readException();
3286 boolean res = reply.readInt() != 0;
3287 data.recycle();
3288 reply.recycle();
3289 return res;
3290 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003291
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003292 public void unstableProviderDied(IBinder connection) throws RemoteException {
3293 Parcel data = Parcel.obtain();
3294 Parcel reply = Parcel.obtain();
3295 data.writeInterfaceToken(IActivityManager.descriptor);
3296 data.writeStrongBinder(connection);
3297 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3298 reply.readException();
3299 data.recycle();
3300 reply.recycle();
3301 }
3302
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003303 @Override
3304 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3305 Parcel data = Parcel.obtain();
3306 Parcel reply = Parcel.obtain();
3307 data.writeInterfaceToken(IActivityManager.descriptor);
3308 data.writeStrongBinder(connection);
3309 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3310 reply.readException();
3311 data.recycle();
3312 reply.recycle();
3313 }
3314
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003315 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3316 Parcel data = Parcel.obtain();
3317 Parcel reply = Parcel.obtain();
3318 data.writeInterfaceToken(IActivityManager.descriptor);
3319 data.writeStrongBinder(connection);
3320 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003321 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3322 reply.readException();
3323 data.recycle();
3324 reply.recycle();
3325 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003326
3327 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3328 Parcel data = Parcel.obtain();
3329 Parcel reply = Parcel.obtain();
3330 data.writeInterfaceToken(IActivityManager.descriptor);
3331 data.writeString(name);
3332 data.writeStrongBinder(token);
3333 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3334 reply.readException();
3335 data.recycle();
3336 reply.recycle();
3337 }
3338
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003339 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3340 throws RemoteException
3341 {
3342 Parcel data = Parcel.obtain();
3343 Parcel reply = Parcel.obtain();
3344 data.writeInterfaceToken(IActivityManager.descriptor);
3345 service.writeToParcel(data, 0);
3346 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3347 reply.readException();
3348 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3349 data.recycle();
3350 reply.recycle();
3351 return res;
3352 }
3353
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003354 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003355 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003356 {
3357 Parcel data = Parcel.obtain();
3358 Parcel reply = Parcel.obtain();
3359 data.writeInterfaceToken(IActivityManager.descriptor);
3360 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3361 service.writeToParcel(data, 0);
3362 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003363 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003364 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3365 reply.readException();
3366 ComponentName res = ComponentName.readFromParcel(reply);
3367 data.recycle();
3368 reply.recycle();
3369 return res;
3370 }
3371 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003372 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003373 {
3374 Parcel data = Parcel.obtain();
3375 Parcel reply = Parcel.obtain();
3376 data.writeInterfaceToken(IActivityManager.descriptor);
3377 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3378 service.writeToParcel(data, 0);
3379 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003380 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003381 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3382 reply.readException();
3383 int res = reply.readInt();
3384 reply.recycle();
3385 data.recycle();
3386 return res;
3387 }
3388 public boolean stopServiceToken(ComponentName className, IBinder token,
3389 int startId) throws RemoteException {
3390 Parcel data = Parcel.obtain();
3391 Parcel reply = Parcel.obtain();
3392 data.writeInterfaceToken(IActivityManager.descriptor);
3393 ComponentName.writeToParcel(className, data);
3394 data.writeStrongBinder(token);
3395 data.writeInt(startId);
3396 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3397 reply.readException();
3398 boolean res = reply.readInt() != 0;
3399 data.recycle();
3400 reply.recycle();
3401 return res;
3402 }
3403 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003404 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003405 Parcel data = Parcel.obtain();
3406 Parcel reply = Parcel.obtain();
3407 data.writeInterfaceToken(IActivityManager.descriptor);
3408 ComponentName.writeToParcel(className, data);
3409 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003410 data.writeInt(id);
3411 if (notification != null) {
3412 data.writeInt(1);
3413 notification.writeToParcel(data, 0);
3414 } else {
3415 data.writeInt(0);
3416 }
3417 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003418 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3419 reply.readException();
3420 data.recycle();
3421 reply.recycle();
3422 }
3423 public int bindService(IApplicationThread caller, IBinder token,
3424 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003425 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003426 Parcel data = Parcel.obtain();
3427 Parcel reply = Parcel.obtain();
3428 data.writeInterfaceToken(IActivityManager.descriptor);
3429 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3430 data.writeStrongBinder(token);
3431 service.writeToParcel(data, 0);
3432 data.writeString(resolvedType);
3433 data.writeStrongBinder(connection.asBinder());
3434 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003435 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003436 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3437 reply.readException();
3438 int res = reply.readInt();
3439 data.recycle();
3440 reply.recycle();
3441 return res;
3442 }
3443 public boolean unbindService(IServiceConnection connection) throws RemoteException
3444 {
3445 Parcel data = Parcel.obtain();
3446 Parcel reply = Parcel.obtain();
3447 data.writeInterfaceToken(IActivityManager.descriptor);
3448 data.writeStrongBinder(connection.asBinder());
3449 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3450 reply.readException();
3451 boolean res = reply.readInt() != 0;
3452 data.recycle();
3453 reply.recycle();
3454 return res;
3455 }
3456
3457 public void publishService(IBinder token,
3458 Intent intent, IBinder service) throws RemoteException {
3459 Parcel data = Parcel.obtain();
3460 Parcel reply = Parcel.obtain();
3461 data.writeInterfaceToken(IActivityManager.descriptor);
3462 data.writeStrongBinder(token);
3463 intent.writeToParcel(data, 0);
3464 data.writeStrongBinder(service);
3465 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3466 reply.readException();
3467 data.recycle();
3468 reply.recycle();
3469 }
3470
3471 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3472 throws RemoteException {
3473 Parcel data = Parcel.obtain();
3474 Parcel reply = Parcel.obtain();
3475 data.writeInterfaceToken(IActivityManager.descriptor);
3476 data.writeStrongBinder(token);
3477 intent.writeToParcel(data, 0);
3478 data.writeInt(doRebind ? 1 : 0);
3479 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3480 reply.readException();
3481 data.recycle();
3482 reply.recycle();
3483 }
3484
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003485 public void serviceDoneExecuting(IBinder token, int type, int startId,
3486 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003487 Parcel data = Parcel.obtain();
3488 Parcel reply = Parcel.obtain();
3489 data.writeInterfaceToken(IActivityManager.descriptor);
3490 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003491 data.writeInt(type);
3492 data.writeInt(startId);
3493 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003494 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3495 reply.readException();
3496 data.recycle();
3497 reply.recycle();
3498 }
3499
3500 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3501 Parcel data = Parcel.obtain();
3502 Parcel reply = Parcel.obtain();
3503 data.writeInterfaceToken(IActivityManager.descriptor);
3504 service.writeToParcel(data, 0);
3505 data.writeString(resolvedType);
3506 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3507 reply.readException();
3508 IBinder binder = reply.readStrongBinder();
3509 reply.recycle();
3510 data.recycle();
3511 return binder;
3512 }
3513
Christopher Tate181fafa2009-05-14 11:12:14 -07003514 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3515 throws RemoteException {
3516 Parcel data = Parcel.obtain();
3517 Parcel reply = Parcel.obtain();
3518 data.writeInterfaceToken(IActivityManager.descriptor);
3519 app.writeToParcel(data, 0);
3520 data.writeInt(backupRestoreMode);
3521 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3522 reply.readException();
3523 boolean success = reply.readInt() != 0;
3524 reply.recycle();
3525 data.recycle();
3526 return success;
3527 }
3528
Christopher Tate346acb12012-10-15 19:20:25 -07003529 public void clearPendingBackup() throws RemoteException {
3530 Parcel data = Parcel.obtain();
3531 Parcel reply = Parcel.obtain();
3532 data.writeInterfaceToken(IActivityManager.descriptor);
3533 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3534 reply.recycle();
3535 data.recycle();
3536 }
3537
Christopher Tate181fafa2009-05-14 11:12:14 -07003538 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3539 Parcel data = Parcel.obtain();
3540 Parcel reply = Parcel.obtain();
3541 data.writeInterfaceToken(IActivityManager.descriptor);
3542 data.writeString(packageName);
3543 data.writeStrongBinder(agent);
3544 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3545 reply.recycle();
3546 data.recycle();
3547 }
3548
3549 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3550 Parcel data = Parcel.obtain();
3551 Parcel reply = Parcel.obtain();
3552 data.writeInterfaceToken(IActivityManager.descriptor);
3553 app.writeToParcel(data, 0);
3554 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3555 reply.readException();
3556 reply.recycle();
3557 data.recycle();
3558 }
3559
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003560 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003561 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003562 IUiAutomationConnection connection, int userId, String instructionSet)
3563 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003564 Parcel data = Parcel.obtain();
3565 Parcel reply = Parcel.obtain();
3566 data.writeInterfaceToken(IActivityManager.descriptor);
3567 ComponentName.writeToParcel(className, data);
3568 data.writeString(profileFile);
3569 data.writeInt(flags);
3570 data.writeBundle(arguments);
3571 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003572 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003573 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003574 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003575 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3576 reply.readException();
3577 boolean res = reply.readInt() != 0;
3578 reply.recycle();
3579 data.recycle();
3580 return res;
3581 }
3582
3583 public void finishInstrumentation(IApplicationThread target,
3584 int resultCode, Bundle results) throws RemoteException {
3585 Parcel data = Parcel.obtain();
3586 Parcel reply = Parcel.obtain();
3587 data.writeInterfaceToken(IActivityManager.descriptor);
3588 data.writeStrongBinder(target != null ? target.asBinder() : null);
3589 data.writeInt(resultCode);
3590 data.writeBundle(results);
3591 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3592 reply.readException();
3593 data.recycle();
3594 reply.recycle();
3595 }
3596 public Configuration getConfiguration() throws RemoteException
3597 {
3598 Parcel data = Parcel.obtain();
3599 Parcel reply = Parcel.obtain();
3600 data.writeInterfaceToken(IActivityManager.descriptor);
3601 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3602 reply.readException();
3603 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3604 reply.recycle();
3605 data.recycle();
3606 return res;
3607 }
3608 public void updateConfiguration(Configuration values) throws RemoteException
3609 {
3610 Parcel data = Parcel.obtain();
3611 Parcel reply = Parcel.obtain();
3612 data.writeInterfaceToken(IActivityManager.descriptor);
3613 values.writeToParcel(data, 0);
3614 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3615 reply.readException();
3616 data.recycle();
3617 reply.recycle();
3618 }
3619 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3620 throws RemoteException {
3621 Parcel data = Parcel.obtain();
3622 Parcel reply = Parcel.obtain();
3623 data.writeInterfaceToken(IActivityManager.descriptor);
3624 data.writeStrongBinder(token);
3625 data.writeInt(requestedOrientation);
3626 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3627 reply.readException();
3628 data.recycle();
3629 reply.recycle();
3630 }
3631 public int getRequestedOrientation(IBinder token) throws RemoteException {
3632 Parcel data = Parcel.obtain();
3633 Parcel reply = Parcel.obtain();
3634 data.writeInterfaceToken(IActivityManager.descriptor);
3635 data.writeStrongBinder(token);
3636 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3637 reply.readException();
3638 int res = reply.readInt();
3639 data.recycle();
3640 reply.recycle();
3641 return res;
3642 }
3643 public ComponentName getActivityClassForToken(IBinder token)
3644 throws RemoteException {
3645 Parcel data = Parcel.obtain();
3646 Parcel reply = Parcel.obtain();
3647 data.writeInterfaceToken(IActivityManager.descriptor);
3648 data.writeStrongBinder(token);
3649 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3650 reply.readException();
3651 ComponentName res = ComponentName.readFromParcel(reply);
3652 data.recycle();
3653 reply.recycle();
3654 return res;
3655 }
3656 public String getPackageForToken(IBinder token) throws RemoteException
3657 {
3658 Parcel data = Parcel.obtain();
3659 Parcel reply = Parcel.obtain();
3660 data.writeInterfaceToken(IActivityManager.descriptor);
3661 data.writeStrongBinder(token);
3662 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3663 reply.readException();
3664 String res = reply.readString();
3665 data.recycle();
3666 reply.recycle();
3667 return res;
3668 }
3669 public IIntentSender getIntentSender(int type,
3670 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003671 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003672 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003673 Parcel data = Parcel.obtain();
3674 Parcel reply = Parcel.obtain();
3675 data.writeInterfaceToken(IActivityManager.descriptor);
3676 data.writeInt(type);
3677 data.writeString(packageName);
3678 data.writeStrongBinder(token);
3679 data.writeString(resultWho);
3680 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003681 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003682 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003683 data.writeTypedArray(intents, 0);
3684 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003685 } else {
3686 data.writeInt(0);
3687 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003688 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003689 if (options != null) {
3690 data.writeInt(1);
3691 options.writeToParcel(data, 0);
3692 } else {
3693 data.writeInt(0);
3694 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003695 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003696 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3697 reply.readException();
3698 IIntentSender res = IIntentSender.Stub.asInterface(
3699 reply.readStrongBinder());
3700 data.recycle();
3701 reply.recycle();
3702 return res;
3703 }
3704 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3705 Parcel data = Parcel.obtain();
3706 Parcel reply = Parcel.obtain();
3707 data.writeInterfaceToken(IActivityManager.descriptor);
3708 data.writeStrongBinder(sender.asBinder());
3709 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3710 reply.readException();
3711 data.recycle();
3712 reply.recycle();
3713 }
3714 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3715 Parcel data = Parcel.obtain();
3716 Parcel reply = Parcel.obtain();
3717 data.writeInterfaceToken(IActivityManager.descriptor);
3718 data.writeStrongBinder(sender.asBinder());
3719 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3720 reply.readException();
3721 String res = reply.readString();
3722 data.recycle();
3723 reply.recycle();
3724 return res;
3725 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003726 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3727 Parcel data = Parcel.obtain();
3728 Parcel reply = Parcel.obtain();
3729 data.writeInterfaceToken(IActivityManager.descriptor);
3730 data.writeStrongBinder(sender.asBinder());
3731 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3732 reply.readException();
3733 int res = reply.readInt();
3734 data.recycle();
3735 reply.recycle();
3736 return res;
3737 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003738 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3739 boolean requireFull, String name, String callerPackage) throws RemoteException {
3740 Parcel data = Parcel.obtain();
3741 Parcel reply = Parcel.obtain();
3742 data.writeInterfaceToken(IActivityManager.descriptor);
3743 data.writeInt(callingPid);
3744 data.writeInt(callingUid);
3745 data.writeInt(userId);
3746 data.writeInt(allowAll ? 1 : 0);
3747 data.writeInt(requireFull ? 1 : 0);
3748 data.writeString(name);
3749 data.writeString(callerPackage);
3750 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3751 reply.readException();
3752 int res = reply.readInt();
3753 data.recycle();
3754 reply.recycle();
3755 return res;
3756 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003757 public void setProcessLimit(int max) throws RemoteException
3758 {
3759 Parcel data = Parcel.obtain();
3760 Parcel reply = Parcel.obtain();
3761 data.writeInterfaceToken(IActivityManager.descriptor);
3762 data.writeInt(max);
3763 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3764 reply.readException();
3765 data.recycle();
3766 reply.recycle();
3767 }
3768 public int getProcessLimit() throws RemoteException
3769 {
3770 Parcel data = Parcel.obtain();
3771 Parcel reply = Parcel.obtain();
3772 data.writeInterfaceToken(IActivityManager.descriptor);
3773 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3774 reply.readException();
3775 int res = reply.readInt();
3776 data.recycle();
3777 reply.recycle();
3778 return res;
3779 }
3780 public void setProcessForeground(IBinder token, int pid,
3781 boolean isForeground) throws RemoteException {
3782 Parcel data = Parcel.obtain();
3783 Parcel reply = Parcel.obtain();
3784 data.writeInterfaceToken(IActivityManager.descriptor);
3785 data.writeStrongBinder(token);
3786 data.writeInt(pid);
3787 data.writeInt(isForeground ? 1 : 0);
3788 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3789 reply.readException();
3790 data.recycle();
3791 reply.recycle();
3792 }
3793 public int checkPermission(String permission, int pid, int uid)
3794 throws RemoteException {
3795 Parcel data = Parcel.obtain();
3796 Parcel reply = Parcel.obtain();
3797 data.writeInterfaceToken(IActivityManager.descriptor);
3798 data.writeString(permission);
3799 data.writeInt(pid);
3800 data.writeInt(uid);
3801 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3802 reply.readException();
3803 int res = reply.readInt();
3804 data.recycle();
3805 reply.recycle();
3806 return res;
3807 }
3808 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003809 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003810 Parcel data = Parcel.obtain();
3811 Parcel reply = Parcel.obtain();
3812 data.writeInterfaceToken(IActivityManager.descriptor);
3813 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003814 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003815 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003816 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3817 reply.readException();
3818 boolean res = reply.readInt() != 0;
3819 data.recycle();
3820 reply.recycle();
3821 return res;
3822 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003823 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003824 throws RemoteException {
3825 Parcel data = Parcel.obtain();
3826 Parcel reply = Parcel.obtain();
3827 data.writeInterfaceToken(IActivityManager.descriptor);
3828 uri.writeToParcel(data, 0);
3829 data.writeInt(pid);
3830 data.writeInt(uid);
3831 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003832 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003833 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3834 reply.readException();
3835 int res = reply.readInt();
3836 data.recycle();
3837 reply.recycle();
3838 return res;
3839 }
3840 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003841 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003842 Parcel data = Parcel.obtain();
3843 Parcel reply = Parcel.obtain();
3844 data.writeInterfaceToken(IActivityManager.descriptor);
3845 data.writeStrongBinder(caller.asBinder());
3846 data.writeString(targetPkg);
3847 uri.writeToParcel(data, 0);
3848 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003849 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003850 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3851 reply.readException();
3852 data.recycle();
3853 reply.recycle();
3854 }
3855 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003856 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003857 Parcel data = Parcel.obtain();
3858 Parcel reply = Parcel.obtain();
3859 data.writeInterfaceToken(IActivityManager.descriptor);
3860 data.writeStrongBinder(caller.asBinder());
3861 uri.writeToParcel(data, 0);
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(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3865 reply.readException();
3866 data.recycle();
3867 reply.recycle();
3868 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003869
3870 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003871 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3872 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003873 Parcel data = Parcel.obtain();
3874 Parcel reply = Parcel.obtain();
3875 data.writeInterfaceToken(IActivityManager.descriptor);
3876 uri.writeToParcel(data, 0);
3877 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003878 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003879 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3880 reply.readException();
3881 data.recycle();
3882 reply.recycle();
3883 }
3884
3885 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003886 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3887 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003888 Parcel data = Parcel.obtain();
3889 Parcel reply = Parcel.obtain();
3890 data.writeInterfaceToken(IActivityManager.descriptor);
3891 uri.writeToParcel(data, 0);
3892 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003893 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003894 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3895 reply.readException();
3896 data.recycle();
3897 reply.recycle();
3898 }
3899
3900 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003901 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3902 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003903 Parcel data = Parcel.obtain();
3904 Parcel reply = Parcel.obtain();
3905 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003906 data.writeString(packageName);
3907 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003908 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3909 reply.readException();
3910 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3911 reply);
3912 data.recycle();
3913 reply.recycle();
3914 return perms;
3915 }
3916
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003917 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3918 throws RemoteException {
3919 Parcel data = Parcel.obtain();
3920 Parcel reply = Parcel.obtain();
3921 data.writeInterfaceToken(IActivityManager.descriptor);
3922 data.writeStrongBinder(who.asBinder());
3923 data.writeInt(waiting ? 1 : 0);
3924 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3925 reply.readException();
3926 data.recycle();
3927 reply.recycle();
3928 }
3929 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3930 Parcel data = Parcel.obtain();
3931 Parcel reply = Parcel.obtain();
3932 data.writeInterfaceToken(IActivityManager.descriptor);
3933 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3934 reply.readException();
3935 outInfo.readFromParcel(reply);
3936 data.recycle();
3937 reply.recycle();
3938 }
3939 public void unhandledBack() throws RemoteException
3940 {
3941 Parcel data = Parcel.obtain();
3942 Parcel reply = Parcel.obtain();
3943 data.writeInterfaceToken(IActivityManager.descriptor);
3944 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3945 reply.readException();
3946 data.recycle();
3947 reply.recycle();
3948 }
3949 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3950 {
3951 Parcel data = Parcel.obtain();
3952 Parcel reply = Parcel.obtain();
3953 data.writeInterfaceToken(IActivityManager.descriptor);
3954 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3955 reply.readException();
3956 ParcelFileDescriptor pfd = null;
3957 if (reply.readInt() != 0) {
3958 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3959 }
3960 data.recycle();
3961 reply.recycle();
3962 return pfd;
3963 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003964 public void setLockScreenShown(boolean shown) throws RemoteException
3965 {
3966 Parcel data = Parcel.obtain();
3967 Parcel reply = Parcel.obtain();
3968 data.writeInterfaceToken(IActivityManager.descriptor);
3969 data.writeInt(shown ? 1 : 0);
3970 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3971 reply.readException();
3972 data.recycle();
3973 reply.recycle();
3974 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003975 public void setDebugApp(
3976 String packageName, boolean waitForDebugger, boolean persistent)
3977 throws RemoteException
3978 {
3979 Parcel data = Parcel.obtain();
3980 Parcel reply = Parcel.obtain();
3981 data.writeInterfaceToken(IActivityManager.descriptor);
3982 data.writeString(packageName);
3983 data.writeInt(waitForDebugger ? 1 : 0);
3984 data.writeInt(persistent ? 1 : 0);
3985 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3986 reply.readException();
3987 data.recycle();
3988 reply.recycle();
3989 }
3990 public void setAlwaysFinish(boolean enabled) throws RemoteException
3991 {
3992 Parcel data = Parcel.obtain();
3993 Parcel reply = Parcel.obtain();
3994 data.writeInterfaceToken(IActivityManager.descriptor);
3995 data.writeInt(enabled ? 1 : 0);
3996 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3997 reply.readException();
3998 data.recycle();
3999 reply.recycle();
4000 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004001 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004002 {
4003 Parcel data = Parcel.obtain();
4004 Parcel reply = Parcel.obtain();
4005 data.writeInterfaceToken(IActivityManager.descriptor);
4006 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004007 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004008 reply.readException();
4009 data.recycle();
4010 reply.recycle();
4011 }
4012 public void enterSafeMode() throws RemoteException {
4013 Parcel data = Parcel.obtain();
4014 data.writeInterfaceToken(IActivityManager.descriptor);
4015 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4016 data.recycle();
4017 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08004018 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
4019 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004020 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004021 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004022 data.writeStrongBinder(sender.asBinder());
4023 data.writeInt(sourceUid);
4024 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004025 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4026 data.recycle();
4027 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004028 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004029 Parcel data = Parcel.obtain();
4030 Parcel reply = Parcel.obtain();
4031 data.writeInterfaceToken(IActivityManager.descriptor);
4032 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004033 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004034 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004035 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004036 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004037 boolean res = reply.readInt() != 0;
4038 data.recycle();
4039 reply.recycle();
4040 return res;
4041 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004042 @Override
4043 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4044 Parcel data = Parcel.obtain();
4045 Parcel reply = Parcel.obtain();
4046 data.writeInterfaceToken(IActivityManager.descriptor);
4047 data.writeString(reason);
4048 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4049 boolean res = reply.readInt() != 0;
4050 data.recycle();
4051 reply.recycle();
4052 return res;
4053 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004054 public boolean testIsSystemReady()
4055 {
4056 /* this base class version is never called */
4057 return true;
4058 }
Dan Egnor60d87622009-12-16 16:32:58 -08004059 public void handleApplicationCrash(IBinder app,
4060 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4061 {
4062 Parcel data = Parcel.obtain();
4063 Parcel reply = Parcel.obtain();
4064 data.writeInterfaceToken(IActivityManager.descriptor);
4065 data.writeStrongBinder(app);
4066 crashInfo.writeToParcel(data, 0);
4067 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4068 reply.readException();
4069 reply.recycle();
4070 data.recycle();
4071 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004072
Dianne Hackborn52322712014-08-26 22:47:26 -07004073 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004074 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004075 {
4076 Parcel data = Parcel.obtain();
4077 Parcel reply = Parcel.obtain();
4078 data.writeInterfaceToken(IActivityManager.descriptor);
4079 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004080 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004081 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004082 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004083 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004084 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004085 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004086 reply.recycle();
4087 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004088 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004089 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004090
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004091 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004092 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004093 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004094 {
4095 Parcel data = Parcel.obtain();
4096 Parcel reply = Parcel.obtain();
4097 data.writeInterfaceToken(IActivityManager.descriptor);
4098 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004099 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004100 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004101 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4102 reply.readException();
4103 reply.recycle();
4104 data.recycle();
4105 }
4106
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004107 public void signalPersistentProcesses(int sig) throws RemoteException {
4108 Parcel data = Parcel.obtain();
4109 Parcel reply = Parcel.obtain();
4110 data.writeInterfaceToken(IActivityManager.descriptor);
4111 data.writeInt(sig);
4112 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4113 reply.readException();
4114 data.recycle();
4115 reply.recycle();
4116 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004117
Dianne Hackborn1676c852012-09-10 14:52:30 -07004118 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004119 Parcel data = Parcel.obtain();
4120 Parcel reply = Parcel.obtain();
4121 data.writeInterfaceToken(IActivityManager.descriptor);
4122 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004123 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004124 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4125 reply.readException();
4126 data.recycle();
4127 reply.recycle();
4128 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004129
4130 public void killAllBackgroundProcesses() throws RemoteException {
4131 Parcel data = Parcel.obtain();
4132 Parcel reply = Parcel.obtain();
4133 data.writeInterfaceToken(IActivityManager.descriptor);
4134 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4135 reply.readException();
4136 data.recycle();
4137 reply.recycle();
4138 }
4139
Dianne Hackborn1676c852012-09-10 14:52:30 -07004140 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004141 Parcel data = Parcel.obtain();
4142 Parcel reply = Parcel.obtain();
4143 data.writeInterfaceToken(IActivityManager.descriptor);
4144 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004145 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004146 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004147 reply.readException();
4148 data.recycle();
4149 reply.recycle();
4150 }
4151
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004152 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4153 throws RemoteException
4154 {
4155 Parcel data = Parcel.obtain();
4156 Parcel reply = Parcel.obtain();
4157 data.writeInterfaceToken(IActivityManager.descriptor);
4158 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4159 reply.readException();
4160 outInfo.readFromParcel(reply);
4161 reply.recycle();
4162 data.recycle();
4163 }
4164
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004165 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4166 {
4167 Parcel data = Parcel.obtain();
4168 Parcel reply = Parcel.obtain();
4169 data.writeInterfaceToken(IActivityManager.descriptor);
4170 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4171 reply.readException();
4172 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4173 reply.recycle();
4174 data.recycle();
4175 return res;
4176 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004177
Dianne Hackborn1676c852012-09-10 14:52:30 -07004178 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004179 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004180 {
4181 Parcel data = Parcel.obtain();
4182 Parcel reply = Parcel.obtain();
4183 data.writeInterfaceToken(IActivityManager.descriptor);
4184 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004185 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004186 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004187 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004188 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004189 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004190 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004191 } else {
4192 data.writeInt(0);
4193 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004194 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4195 reply.readException();
4196 boolean res = reply.readInt() != 0;
4197 reply.recycle();
4198 data.recycle();
4199 return res;
4200 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004201
Dianne Hackborn55280a92009-05-07 15:53:46 -07004202 public boolean shutdown(int timeout) throws RemoteException
4203 {
4204 Parcel data = Parcel.obtain();
4205 Parcel reply = Parcel.obtain();
4206 data.writeInterfaceToken(IActivityManager.descriptor);
4207 data.writeInt(timeout);
4208 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4209 reply.readException();
4210 boolean res = reply.readInt() != 0;
4211 reply.recycle();
4212 data.recycle();
4213 return res;
4214 }
4215
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004216 public void stopAppSwitches() throws RemoteException {
4217 Parcel data = Parcel.obtain();
4218 Parcel reply = Parcel.obtain();
4219 data.writeInterfaceToken(IActivityManager.descriptor);
4220 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4221 reply.readException();
4222 reply.recycle();
4223 data.recycle();
4224 }
4225
4226 public void resumeAppSwitches() throws RemoteException {
4227 Parcel data = Parcel.obtain();
4228 Parcel reply = Parcel.obtain();
4229 data.writeInterfaceToken(IActivityManager.descriptor);
4230 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4231 reply.readException();
4232 reply.recycle();
4233 data.recycle();
4234 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004235
4236 public void addPackageDependency(String packageName) throws RemoteException {
4237 Parcel data = Parcel.obtain();
4238 Parcel reply = Parcel.obtain();
4239 data.writeInterfaceToken(IActivityManager.descriptor);
4240 data.writeString(packageName);
4241 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4242 reply.readException();
4243 data.recycle();
4244 reply.recycle();
4245 }
4246
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004247 public void killApplicationWithAppId(String pkg, int appid, String reason)
4248 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004249 Parcel data = Parcel.obtain();
4250 Parcel reply = Parcel.obtain();
4251 data.writeInterfaceToken(IActivityManager.descriptor);
4252 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004253 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004254 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004255 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004256 reply.readException();
4257 data.recycle();
4258 reply.recycle();
4259 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004260
4261 public void closeSystemDialogs(String reason) throws RemoteException {
4262 Parcel data = Parcel.obtain();
4263 Parcel reply = Parcel.obtain();
4264 data.writeInterfaceToken(IActivityManager.descriptor);
4265 data.writeString(reason);
4266 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4267 reply.readException();
4268 data.recycle();
4269 reply.recycle();
4270 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004271
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004272 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004273 throws RemoteException {
4274 Parcel data = Parcel.obtain();
4275 Parcel reply = Parcel.obtain();
4276 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004277 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004278 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4279 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004280 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004281 data.recycle();
4282 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004283 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004284 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004285
4286 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4287 Parcel data = Parcel.obtain();
4288 Parcel reply = Parcel.obtain();
4289 data.writeInterfaceToken(IActivityManager.descriptor);
4290 data.writeString(processName);
4291 data.writeInt(uid);
4292 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4293 reply.readException();
4294 data.recycle();
4295 reply.recycle();
4296 }
4297
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004298 public void overridePendingTransition(IBinder token, String packageName,
4299 int enterAnim, int exitAnim) throws RemoteException {
4300 Parcel data = Parcel.obtain();
4301 Parcel reply = Parcel.obtain();
4302 data.writeInterfaceToken(IActivityManager.descriptor);
4303 data.writeStrongBinder(token);
4304 data.writeString(packageName);
4305 data.writeInt(enterAnim);
4306 data.writeInt(exitAnim);
4307 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4308 reply.readException();
4309 data.recycle();
4310 reply.recycle();
4311 }
4312
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004313 public boolean isUserAMonkey() throws RemoteException {
4314 Parcel data = Parcel.obtain();
4315 Parcel reply = Parcel.obtain();
4316 data.writeInterfaceToken(IActivityManager.descriptor);
4317 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4318 reply.readException();
4319 boolean res = reply.readInt() != 0;
4320 data.recycle();
4321 reply.recycle();
4322 return res;
4323 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004324
4325 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4326 Parcel data = Parcel.obtain();
4327 Parcel reply = Parcel.obtain();
4328 data.writeInterfaceToken(IActivityManager.descriptor);
4329 data.writeInt(monkey ? 1 : 0);
4330 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4331 reply.readException();
4332 data.recycle();
4333 reply.recycle();
4334 }
4335
Dianne Hackborn860755f2010-06-03 18:47:52 -07004336 public void finishHeavyWeightApp() throws RemoteException {
4337 Parcel data = Parcel.obtain();
4338 Parcel reply = Parcel.obtain();
4339 data.writeInterfaceToken(IActivityManager.descriptor);
4340 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4341 reply.readException();
4342 data.recycle();
4343 reply.recycle();
4344 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004345
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004346 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004347 throws RemoteException {
4348 Parcel data = Parcel.obtain();
4349 Parcel reply = Parcel.obtain();
4350 data.writeInterfaceToken(IActivityManager.descriptor);
4351 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004352 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4353 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004354 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004355 data.recycle();
4356 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004357 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004358 }
4359
Craig Mautner233ceee2014-05-09 17:05:11 -07004360 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004361 throws RemoteException {
4362 Parcel data = Parcel.obtain();
4363 Parcel reply = Parcel.obtain();
4364 data.writeInterfaceToken(IActivityManager.descriptor);
4365 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004366 if (options == null) {
4367 data.writeInt(0);
4368 } else {
4369 data.writeInt(1);
4370 data.writeBundle(options.toBundle());
4371 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004372 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004373 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004374 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004375 data.recycle();
4376 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004377 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004378 }
4379
Craig Mautner233ceee2014-05-09 17:05:11 -07004380 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4381 Parcel data = Parcel.obtain();
4382 Parcel reply = Parcel.obtain();
4383 data.writeInterfaceToken(IActivityManager.descriptor);
4384 data.writeStrongBinder(token);
4385 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4386 reply.readException();
4387 Bundle bundle = reply.readBundle();
4388 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4389 data.recycle();
4390 reply.recycle();
4391 return options;
4392 }
4393
Daniel Sandler69a48172010-06-23 16:29:36 -04004394 public void setImmersive(IBinder token, boolean immersive)
4395 throws RemoteException {
4396 Parcel data = Parcel.obtain();
4397 Parcel reply = Parcel.obtain();
4398 data.writeInterfaceToken(IActivityManager.descriptor);
4399 data.writeStrongBinder(token);
4400 data.writeInt(immersive ? 1 : 0);
4401 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4402 reply.readException();
4403 data.recycle();
4404 reply.recycle();
4405 }
4406
4407 public boolean isImmersive(IBinder token)
4408 throws RemoteException {
4409 Parcel data = Parcel.obtain();
4410 Parcel reply = Parcel.obtain();
4411 data.writeInterfaceToken(IActivityManager.descriptor);
4412 data.writeStrongBinder(token);
4413 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004414 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004415 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004416 data.recycle();
4417 reply.recycle();
4418 return res;
4419 }
4420
Craig Mautnerd61dc202014-07-07 11:09:11 -07004421 public boolean isTopOfTask(IBinder token) throws RemoteException {
4422 Parcel data = Parcel.obtain();
4423 Parcel reply = Parcel.obtain();
4424 data.writeInterfaceToken(IActivityManager.descriptor);
4425 data.writeStrongBinder(token);
4426 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4427 reply.readException();
4428 boolean res = reply.readInt() == 1;
4429 data.recycle();
4430 reply.recycle();
4431 return res;
4432 }
4433
Daniel Sandler69a48172010-06-23 16:29:36 -04004434 public boolean isTopActivityImmersive()
4435 throws RemoteException {
4436 Parcel data = Parcel.obtain();
4437 Parcel reply = Parcel.obtain();
4438 data.writeInterfaceToken(IActivityManager.descriptor);
4439 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004440 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004441 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004442 data.recycle();
4443 reply.recycle();
4444 return res;
4445 }
4446
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004447 public void crashApplication(int uid, int initialPid, String packageName,
4448 String message) throws RemoteException {
4449 Parcel data = Parcel.obtain();
4450 Parcel reply = Parcel.obtain();
4451 data.writeInterfaceToken(IActivityManager.descriptor);
4452 data.writeInt(uid);
4453 data.writeInt(initialPid);
4454 data.writeString(packageName);
4455 data.writeString(message);
4456 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4457 reply.readException();
4458 data.recycle();
4459 reply.recycle();
4460 }
Andy McFadden824c5102010-07-09 16:26:57 -07004461
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004462 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004463 Parcel data = Parcel.obtain();
4464 Parcel reply = Parcel.obtain();
4465 data.writeInterfaceToken(IActivityManager.descriptor);
4466 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004467 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004468 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4469 reply.readException();
4470 String res = reply.readString();
4471 data.recycle();
4472 reply.recycle();
4473 return res;
4474 }
4475
Dianne Hackborn7e269642010-08-25 19:50:20 -07004476 public IBinder newUriPermissionOwner(String name)
4477 throws RemoteException {
4478 Parcel data = Parcel.obtain();
4479 Parcel reply = Parcel.obtain();
4480 data.writeInterfaceToken(IActivityManager.descriptor);
4481 data.writeString(name);
4482 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4483 reply.readException();
4484 IBinder res = reply.readStrongBinder();
4485 data.recycle();
4486 reply.recycle();
4487 return res;
4488 }
4489
4490 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004491 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004492 Parcel data = Parcel.obtain();
4493 Parcel reply = Parcel.obtain();
4494 data.writeInterfaceToken(IActivityManager.descriptor);
4495 data.writeStrongBinder(owner);
4496 data.writeInt(fromUid);
4497 data.writeString(targetPkg);
4498 uri.writeToParcel(data, 0);
4499 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004500 data.writeInt(sourceUserId);
4501 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004502 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4503 reply.readException();
4504 data.recycle();
4505 reply.recycle();
4506 }
4507
4508 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004509 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004510 Parcel data = Parcel.obtain();
4511 Parcel reply = Parcel.obtain();
4512 data.writeInterfaceToken(IActivityManager.descriptor);
4513 data.writeStrongBinder(owner);
4514 if (uri != null) {
4515 data.writeInt(1);
4516 uri.writeToParcel(data, 0);
4517 } else {
4518 data.writeInt(0);
4519 }
4520 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004521 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004522 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4523 reply.readException();
4524 data.recycle();
4525 reply.recycle();
4526 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004527
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004528 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004529 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004530 Parcel data = Parcel.obtain();
4531 Parcel reply = Parcel.obtain();
4532 data.writeInterfaceToken(IActivityManager.descriptor);
4533 data.writeInt(callingUid);
4534 data.writeString(targetPkg);
4535 uri.writeToParcel(data, 0);
4536 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004537 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004538 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4539 reply.readException();
4540 int res = reply.readInt();
4541 data.recycle();
4542 reply.recycle();
4543 return res;
4544 }
4545
Dianne Hackborn1676c852012-09-10 14:52:30 -07004546 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004547 String path, ParcelFileDescriptor fd) throws RemoteException {
4548 Parcel data = Parcel.obtain();
4549 Parcel reply = Parcel.obtain();
4550 data.writeInterfaceToken(IActivityManager.descriptor);
4551 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004552 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004553 data.writeInt(managed ? 1 : 0);
4554 data.writeString(path);
4555 if (fd != null) {
4556 data.writeInt(1);
4557 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4558 } else {
4559 data.writeInt(0);
4560 }
4561 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4562 reply.readException();
4563 boolean res = reply.readInt() != 0;
4564 reply.recycle();
4565 data.recycle();
4566 return res;
4567 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004568
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004569 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004570 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004571 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004572 Parcel data = Parcel.obtain();
4573 Parcel reply = Parcel.obtain();
4574 data.writeInterfaceToken(IActivityManager.descriptor);
4575 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004576 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004577 data.writeTypedArray(intents, 0);
4578 data.writeStringArray(resolvedTypes);
4579 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004580 if (options != null) {
4581 data.writeInt(1);
4582 options.writeToParcel(data, 0);
4583 } else {
4584 data.writeInt(0);
4585 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004586 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004587 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4588 reply.readException();
4589 int result = reply.readInt();
4590 reply.recycle();
4591 data.recycle();
4592 return result;
4593 }
4594
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004595 public int getFrontActivityScreenCompatMode() throws RemoteException {
4596 Parcel data = Parcel.obtain();
4597 Parcel reply = Parcel.obtain();
4598 data.writeInterfaceToken(IActivityManager.descriptor);
4599 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4600 reply.readException();
4601 int mode = reply.readInt();
4602 reply.recycle();
4603 data.recycle();
4604 return mode;
4605 }
4606
4607 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4608 Parcel data = Parcel.obtain();
4609 Parcel reply = Parcel.obtain();
4610 data.writeInterfaceToken(IActivityManager.descriptor);
4611 data.writeInt(mode);
4612 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4613 reply.readException();
4614 reply.recycle();
4615 data.recycle();
4616 }
4617
4618 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4619 Parcel data = Parcel.obtain();
4620 Parcel reply = Parcel.obtain();
4621 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004622 data.writeString(packageName);
4623 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004624 reply.readException();
4625 int mode = reply.readInt();
4626 reply.recycle();
4627 data.recycle();
4628 return mode;
4629 }
4630
4631 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004632 throws RemoteException {
4633 Parcel data = Parcel.obtain();
4634 Parcel reply = Parcel.obtain();
4635 data.writeInterfaceToken(IActivityManager.descriptor);
4636 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004637 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004638 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4639 reply.readException();
4640 reply.recycle();
4641 data.recycle();
4642 }
4643
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004644 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4645 Parcel data = Parcel.obtain();
4646 Parcel reply = Parcel.obtain();
4647 data.writeInterfaceToken(IActivityManager.descriptor);
4648 data.writeString(packageName);
4649 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4650 reply.readException();
4651 boolean ask = reply.readInt() != 0;
4652 reply.recycle();
4653 data.recycle();
4654 return ask;
4655 }
4656
4657 public void setPackageAskScreenCompat(String packageName, boolean ask)
4658 throws RemoteException {
4659 Parcel data = Parcel.obtain();
4660 Parcel reply = Parcel.obtain();
4661 data.writeInterfaceToken(IActivityManager.descriptor);
4662 data.writeString(packageName);
4663 data.writeInt(ask ? 1 : 0);
4664 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4665 reply.readException();
4666 reply.recycle();
4667 data.recycle();
4668 }
4669
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004670 public boolean switchUser(int userid) throws RemoteException {
4671 Parcel data = Parcel.obtain();
4672 Parcel reply = Parcel.obtain();
4673 data.writeInterfaceToken(IActivityManager.descriptor);
4674 data.writeInt(userid);
4675 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4676 reply.readException();
4677 boolean result = reply.readInt() != 0;
4678 reply.recycle();
4679 data.recycle();
4680 return result;
4681 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004682
Kenny Guy08488bf2014-02-21 17:40:37 +00004683 public boolean startUserInBackground(int userid) throws RemoteException {
4684 Parcel data = Parcel.obtain();
4685 Parcel reply = Parcel.obtain();
4686 data.writeInterfaceToken(IActivityManager.descriptor);
4687 data.writeInt(userid);
4688 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4689 reply.readException();
4690 boolean result = reply.readInt() != 0;
4691 reply.recycle();
4692 data.recycle();
4693 return result;
4694 }
4695
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004696 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4697 Parcel data = Parcel.obtain();
4698 Parcel reply = Parcel.obtain();
4699 data.writeInterfaceToken(IActivityManager.descriptor);
4700 data.writeInt(userid);
4701 data.writeStrongInterface(callback);
4702 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4703 reply.readException();
4704 int result = reply.readInt();
4705 reply.recycle();
4706 data.recycle();
4707 return result;
4708 }
4709
Amith Yamasani52f1d752012-03-28 18:19:29 -07004710 public UserInfo getCurrentUser() throws RemoteException {
4711 Parcel data = Parcel.obtain();
4712 Parcel reply = Parcel.obtain();
4713 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004714 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004715 reply.readException();
4716 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4717 reply.recycle();
4718 data.recycle();
4719 return userInfo;
4720 }
4721
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004722 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004723 Parcel data = Parcel.obtain();
4724 Parcel reply = Parcel.obtain();
4725 data.writeInterfaceToken(IActivityManager.descriptor);
4726 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004727 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004728 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4729 reply.readException();
4730 boolean result = reply.readInt() != 0;
4731 reply.recycle();
4732 data.recycle();
4733 return result;
4734 }
4735
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004736 public int[] getRunningUserIds() throws RemoteException {
4737 Parcel data = Parcel.obtain();
4738 Parcel reply = Parcel.obtain();
4739 data.writeInterfaceToken(IActivityManager.descriptor);
4740 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4741 reply.readException();
4742 int[] result = reply.createIntArray();
4743 reply.recycle();
4744 data.recycle();
4745 return result;
4746 }
4747
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004748 public boolean removeTask(int taskId, int flags) throws RemoteException {
4749 Parcel data = Parcel.obtain();
4750 Parcel reply = Parcel.obtain();
4751 data.writeInterfaceToken(IActivityManager.descriptor);
4752 data.writeInt(taskId);
4753 data.writeInt(flags);
4754 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4755 reply.readException();
4756 boolean result = reply.readInt() != 0;
4757 reply.recycle();
4758 data.recycle();
4759 return result;
4760 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004761
Jeff Sharkeya4620792011-05-20 15:29:23 -07004762 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4763 Parcel data = Parcel.obtain();
4764 Parcel reply = Parcel.obtain();
4765 data.writeInterfaceToken(IActivityManager.descriptor);
4766 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4767 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4768 reply.readException();
4769 data.recycle();
4770 reply.recycle();
4771 }
4772
4773 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4774 Parcel data = Parcel.obtain();
4775 Parcel reply = Parcel.obtain();
4776 data.writeInterfaceToken(IActivityManager.descriptor);
4777 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4778 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4779 reply.readException();
4780 data.recycle();
4781 reply.recycle();
4782 }
4783
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004784 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4785 Parcel data = Parcel.obtain();
4786 Parcel reply = Parcel.obtain();
4787 data.writeInterfaceToken(IActivityManager.descriptor);
4788 data.writeStrongBinder(sender.asBinder());
4789 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4790 reply.readException();
4791 boolean res = reply.readInt() != 0;
4792 data.recycle();
4793 reply.recycle();
4794 return res;
4795 }
4796
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004797 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4798 Parcel data = Parcel.obtain();
4799 Parcel reply = Parcel.obtain();
4800 data.writeInterfaceToken(IActivityManager.descriptor);
4801 data.writeStrongBinder(sender.asBinder());
4802 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4803 reply.readException();
4804 boolean res = reply.readInt() != 0;
4805 data.recycle();
4806 reply.recycle();
4807 return res;
4808 }
4809
Dianne Hackborn81038902012-11-26 17:04:09 -08004810 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4811 Parcel data = Parcel.obtain();
4812 Parcel reply = Parcel.obtain();
4813 data.writeInterfaceToken(IActivityManager.descriptor);
4814 data.writeStrongBinder(sender.asBinder());
4815 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4816 reply.readException();
4817 Intent res = reply.readInt() != 0
4818 ? Intent.CREATOR.createFromParcel(reply) : null;
4819 data.recycle();
4820 reply.recycle();
4821 return res;
4822 }
4823
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004824 public String getTagForIntentSender(IIntentSender sender, String prefix)
4825 throws RemoteException {
4826 Parcel data = Parcel.obtain();
4827 Parcel reply = Parcel.obtain();
4828 data.writeInterfaceToken(IActivityManager.descriptor);
4829 data.writeStrongBinder(sender.asBinder());
4830 data.writeString(prefix);
4831 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4832 reply.readException();
4833 String res = reply.readString();
4834 data.recycle();
4835 reply.recycle();
4836 return res;
4837 }
4838
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004839 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4840 {
4841 Parcel data = Parcel.obtain();
4842 Parcel reply = Parcel.obtain();
4843 data.writeInterfaceToken(IActivityManager.descriptor);
4844 values.writeToParcel(data, 0);
4845 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4846 reply.readException();
4847 data.recycle();
4848 reply.recycle();
4849 }
4850
Dianne Hackbornb437e092011-08-05 17:50:29 -07004851 public long[] getProcessPss(int[] pids) throws RemoteException {
4852 Parcel data = Parcel.obtain();
4853 Parcel reply = Parcel.obtain();
4854 data.writeInterfaceToken(IActivityManager.descriptor);
4855 data.writeIntArray(pids);
4856 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4857 reply.readException();
4858 long[] res = reply.createLongArray();
4859 data.recycle();
4860 reply.recycle();
4861 return res;
4862 }
4863
Dianne Hackborn661cd522011-08-22 00:26:20 -07004864 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4865 Parcel data = Parcel.obtain();
4866 Parcel reply = Parcel.obtain();
4867 data.writeInterfaceToken(IActivityManager.descriptor);
4868 TextUtils.writeToParcel(msg, data, 0);
4869 data.writeInt(always ? 1 : 0);
4870 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4871 reply.readException();
4872 data.recycle();
4873 reply.recycle();
4874 }
4875
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004876 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004877 Parcel data = Parcel.obtain();
4878 Parcel reply = Parcel.obtain();
4879 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004880 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004881 reply.readException();
4882 data.recycle();
4883 reply.recycle();
4884 }
4885
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004886 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07004887 throws RemoteException {
4888 Parcel data = Parcel.obtain();
4889 Parcel reply = Parcel.obtain();
4890 data.writeInterfaceToken(IActivityManager.descriptor);
4891 data.writeStrongBinder(token);
4892 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004893 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07004894 reply.readException();
4895 boolean result = reply.readInt() != 0;
4896 data.recycle();
4897 reply.recycle();
4898 return result;
4899 }
4900
4901 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4902 throws RemoteException {
4903 Parcel data = Parcel.obtain();
4904 Parcel reply = Parcel.obtain();
4905 data.writeInterfaceToken(IActivityManager.descriptor);
4906 data.writeStrongBinder(token);
4907 target.writeToParcel(data, 0);
4908 data.writeInt(resultCode);
4909 if (resultData != null) {
4910 data.writeInt(1);
4911 resultData.writeToParcel(data, 0);
4912 } else {
4913 data.writeInt(0);
4914 }
4915 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4916 reply.readException();
4917 boolean result = reply.readInt() != 0;
4918 data.recycle();
4919 reply.recycle();
4920 return result;
4921 }
4922
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004923 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4924 Parcel data = Parcel.obtain();
4925 Parcel reply = Parcel.obtain();
4926 data.writeInterfaceToken(IActivityManager.descriptor);
4927 data.writeStrongBinder(activityToken);
4928 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4929 reply.readException();
4930 int result = reply.readInt();
4931 data.recycle();
4932 reply.recycle();
4933 return result;
4934 }
4935
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004936 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4937 Parcel data = Parcel.obtain();
4938 Parcel reply = Parcel.obtain();
4939 data.writeInterfaceToken(IActivityManager.descriptor);
4940 data.writeStrongBinder(activityToken);
4941 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4942 reply.readException();
4943 String result = reply.readString();
4944 data.recycle();
4945 reply.recycle();
4946 return result;
4947 }
4948
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004949 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4950 Parcel data = Parcel.obtain();
4951 Parcel reply = Parcel.obtain();
4952 data.writeInterfaceToken(IActivityManager.descriptor);
4953 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4954 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4955 reply.readException();
4956 data.recycle();
4957 reply.recycle();
4958 }
4959
4960 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4961 Parcel data = Parcel.obtain();
4962 Parcel reply = Parcel.obtain();
4963 data.writeInterfaceToken(IActivityManager.descriptor);
4964 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4965 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4966 reply.readException();
4967 data.recycle();
4968 reply.recycle();
4969 }
4970
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004971 public void requestBugReport() throws RemoteException {
4972 Parcel data = Parcel.obtain();
4973 Parcel reply = Parcel.obtain();
4974 data.writeInterfaceToken(IActivityManager.descriptor);
4975 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4976 reply.readException();
4977 data.recycle();
4978 reply.recycle();
4979 }
4980
Jeff Brownbd181bb2013-09-10 16:44:24 -07004981 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4982 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004983 Parcel data = Parcel.obtain();
4984 Parcel reply = Parcel.obtain();
4985 data.writeInterfaceToken(IActivityManager.descriptor);
4986 data.writeInt(pid);
4987 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004988 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004989 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4990 reply.readException();
4991 long res = reply.readInt();
4992 data.recycle();
4993 reply.recycle();
4994 return res;
4995 }
4996
Adam Skorydfc7fd72013-08-05 19:23:41 -07004997 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004998 Parcel data = Parcel.obtain();
4999 Parcel reply = Parcel.obtain();
5000 data.writeInterfaceToken(IActivityManager.descriptor);
5001 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005002 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005003 reply.readException();
5004 Bundle res = reply.readBundle();
5005 data.recycle();
5006 reply.recycle();
5007 return res;
5008 }
5009
Adam Skory7140a252013-09-11 12:04:58 +01005010 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005011 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005012 Parcel data = Parcel.obtain();
5013 Parcel reply = Parcel.obtain();
5014 data.writeInterfaceToken(IActivityManager.descriptor);
5015 data.writeStrongBinder(token);
5016 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005017 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005018 reply.readException();
5019 data.recycle();
5020 reply.recycle();
5021 }
5022
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005023 public void killUid(int uid, String reason) throws RemoteException {
5024 Parcel data = Parcel.obtain();
5025 Parcel reply = Parcel.obtain();
5026 data.writeInterfaceToken(IActivityManager.descriptor);
5027 data.writeInt(uid);
5028 data.writeString(reason);
5029 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5030 reply.readException();
5031 data.recycle();
5032 reply.recycle();
5033 }
5034
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005035 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5036 Parcel data = Parcel.obtain();
5037 Parcel reply = Parcel.obtain();
5038 data.writeInterfaceToken(IActivityManager.descriptor);
5039 data.writeStrongBinder(who);
5040 data.writeInt(allowRestart ? 1 : 0);
5041 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5042 reply.readException();
5043 data.recycle();
5044 reply.recycle();
5045 }
5046
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005047 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5048 Parcel data = Parcel.obtain();
5049 Parcel reply = Parcel.obtain();
5050 data.writeInterfaceToken(IActivityManager.descriptor);
5051 data.writeStrongBinder(token);
5052 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5053 reply.readException();
5054 data.recycle();
5055 reply.recycle();
5056 }
5057
Craig Mautner5eda9b32013-07-02 11:58:16 -07005058 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5059 Parcel data = Parcel.obtain();
5060 Parcel reply = Parcel.obtain();
5061 data.writeInterfaceToken(IActivityManager.descriptor);
5062 data.writeStrongBinder(token);
5063 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5064 reply.readException();
5065 data.recycle();
5066 reply.recycle();
5067 }
5068
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005069 public void restart() throws RemoteException {
5070 Parcel data = Parcel.obtain();
5071 Parcel reply = Parcel.obtain();
5072 data.writeInterfaceToken(IActivityManager.descriptor);
5073 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5074 reply.readException();
5075 data.recycle();
5076 reply.recycle();
5077 }
5078
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005079 public void performIdleMaintenance() throws RemoteException {
5080 Parcel data = Parcel.obtain();
5081 Parcel reply = Parcel.obtain();
5082 data.writeInterfaceToken(IActivityManager.descriptor);
5083 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5084 reply.readException();
5085 data.recycle();
5086 reply.recycle();
5087 }
5088
Craig Mautner4a1cb222013-12-04 16:14:06 -08005089 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
5090 IActivityContainerCallback callback) throws RemoteException {
5091 Parcel data = Parcel.obtain();
5092 Parcel reply = Parcel.obtain();
5093 data.writeInterfaceToken(IActivityManager.descriptor);
5094 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005095 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08005096 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5097 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005098 final int result = reply.readInt();
5099 final IActivityContainer res;
5100 if (result == 1) {
5101 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5102 } else {
5103 res = null;
5104 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005105 data.recycle();
5106 reply.recycle();
5107 return res;
5108 }
5109
Craig Mautner95da1082014-02-24 17:54:35 -08005110 public void deleteActivityContainer(IActivityContainer activityContainer)
5111 throws RemoteException {
5112 Parcel data = Parcel.obtain();
5113 Parcel reply = Parcel.obtain();
5114 data.writeInterfaceToken(IActivityManager.descriptor);
5115 data.writeStrongBinder(activityContainer.asBinder());
5116 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5117 reply.readException();
5118 data.recycle();
5119 reply.recycle();
5120 }
5121
Craig Mautnere0a38842013-12-16 16:14:02 -08005122 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
5123 throws RemoteException {
5124 Parcel data = Parcel.obtain();
5125 Parcel reply = Parcel.obtain();
5126 data.writeInterfaceToken(IActivityManager.descriptor);
5127 data.writeStrongBinder(activityToken);
5128 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5129 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005130 final int result = reply.readInt();
5131 final IActivityContainer res;
5132 if (result == 1) {
5133 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5134 } else {
5135 res = null;
5136 }
Craig Mautnere0a38842013-12-16 16:14:02 -08005137 data.recycle();
5138 reply.recycle();
5139 return res;
5140 }
5141
Craig Mautner4a1cb222013-12-04 16:14:06 -08005142 public IBinder getHomeActivityToken() throws RemoteException {
5143 Parcel data = Parcel.obtain();
5144 Parcel reply = Parcel.obtain();
5145 data.writeInterfaceToken(IActivityManager.descriptor);
5146 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5147 reply.readException();
5148 IBinder res = reply.readStrongBinder();
5149 data.recycle();
5150 reply.recycle();
5151 return res;
5152 }
5153
Craig Mautneraea74a52014-03-08 14:23:10 -08005154 @Override
5155 public void startLockTaskMode(int taskId) throws RemoteException {
5156 Parcel data = Parcel.obtain();
5157 Parcel reply = Parcel.obtain();
5158 data.writeInterfaceToken(IActivityManager.descriptor);
5159 data.writeInt(taskId);
5160 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5161 reply.readException();
5162 data.recycle();
5163 reply.recycle();
5164 }
5165
5166 @Override
5167 public void startLockTaskMode(IBinder token) throws RemoteException {
5168 Parcel data = Parcel.obtain();
5169 Parcel reply = Parcel.obtain();
5170 data.writeInterfaceToken(IActivityManager.descriptor);
5171 data.writeStrongBinder(token);
5172 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5173 reply.readException();
5174 data.recycle();
5175 reply.recycle();
5176 }
5177
5178 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005179 public void startLockTaskModeOnCurrent() throws RemoteException {
5180 Parcel data = Parcel.obtain();
5181 Parcel reply = Parcel.obtain();
5182 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005183 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005184 reply.readException();
5185 data.recycle();
5186 reply.recycle();
5187 }
5188
5189 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005190 public void stopLockTaskMode() throws RemoteException {
5191 Parcel data = Parcel.obtain();
5192 Parcel reply = Parcel.obtain();
5193 data.writeInterfaceToken(IActivityManager.descriptor);
5194 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5195 reply.readException();
5196 data.recycle();
5197 reply.recycle();
5198 }
5199
5200 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005201 public void stopLockTaskModeOnCurrent() throws RemoteException {
5202 Parcel data = Parcel.obtain();
5203 Parcel reply = Parcel.obtain();
5204 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005205 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005206 reply.readException();
5207 data.recycle();
5208 reply.recycle();
5209 }
5210
5211 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005212 public boolean isInLockTaskMode() throws RemoteException {
5213 Parcel data = Parcel.obtain();
5214 Parcel reply = Parcel.obtain();
5215 data.writeInterfaceToken(IActivityManager.descriptor);
5216 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5217 reply.readException();
5218 boolean isInLockTaskMode = reply.readInt() == 1;
5219 data.recycle();
5220 reply.recycle();
5221 return isInLockTaskMode;
5222 }
5223
Craig Mautner688b5102014-03-27 16:55:03 -07005224 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005225 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005226 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005227 Parcel data = Parcel.obtain();
5228 Parcel reply = Parcel.obtain();
5229 data.writeInterfaceToken(IActivityManager.descriptor);
5230 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005231 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005232 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005233 reply.readException();
5234 data.recycle();
5235 reply.recycle();
5236 }
5237
Craig Mautneree2e45a2014-06-27 12:10:03 -07005238 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005239 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005240 Parcel data = Parcel.obtain();
5241 Parcel reply = Parcel.obtain();
5242 data.writeInterfaceToken(IActivityManager.descriptor);
5243 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005244 data.writeInt(visible ? 1 : 0);
5245 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005246 reply.readException();
5247 boolean success = reply.readInt() > 0;
5248 data.recycle();
5249 reply.recycle();
5250 return success;
5251 }
5252
5253 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005254 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005255 Parcel data = Parcel.obtain();
5256 Parcel reply = Parcel.obtain();
5257 data.writeInterfaceToken(IActivityManager.descriptor);
5258 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005259 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005260 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005261 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005262 data.recycle();
5263 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005264 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005265 }
5266
5267 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005268 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005269 Parcel data = Parcel.obtain();
5270 Parcel reply = Parcel.obtain();
5271 data.writeInterfaceToken(IActivityManager.descriptor);
5272 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005273 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5274 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005275 reply.readException();
5276 data.recycle();
5277 reply.recycle();
5278 }
5279
5280 @Override
5281 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5282 Parcel data = Parcel.obtain();
5283 Parcel reply = Parcel.obtain();
5284 data.writeInterfaceToken(IActivityManager.descriptor);
5285 data.writeStrongBinder(token);
5286 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5287 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005288 reply.readException();
5289 data.recycle();
5290 reply.recycle();
5291 }
5292
Craig Mautner8746a472014-07-24 15:12:54 -07005293 @Override
5294 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5295 Parcel data = Parcel.obtain();
5296 Parcel reply = Parcel.obtain();
5297 data.writeInterfaceToken(IActivityManager.descriptor);
5298 data.writeStrongBinder(token);
5299 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5300 IBinder.FLAG_ONEWAY);
5301 reply.readException();
5302 data.recycle();
5303 reply.recycle();
5304 }
5305
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005306 private IBinder mRemote;
5307}