blob: 11470e336b65d9fd746761a7d4b64ad7b554c248 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
Jeff Hao1b012d32014-08-20 10:35:34 -070020import android.app.ProfilerInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070022import android.content.IIntentReceiver;
23import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.content.Intent;
25import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070026import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070027import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070028import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.pm.ConfigurationInfo;
30import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070031import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070032import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070034import android.graphics.Bitmap;
35import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080036import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080037import android.net.Uri;
38import android.os.Binder;
39import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070040import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.os.IBinder;
42import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070043import android.os.ParcelFileDescriptor;
44import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070045import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070046import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070048import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070049import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080052import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070053import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055import java.util.ArrayList;
56import java.util.List;
57
58/** {@hide} */
59public abstract class ActivityManagerNative extends Binder implements IActivityManager
60{
61 /**
62 * Cast a Binder object into an activity manager interface, generating
63 * a proxy if needed.
64 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 if (obj == null) {
67 return null;
68 }
69 IActivityManager in =
70 (IActivityManager)obj.queryLocalInterface(descriptor);
71 if (in != null) {
72 return in;
73 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 return new ActivityManagerProxy(obj);
76 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080077
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 /**
79 * Retrieve the system's default/global activity manager.
80 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080081 static public IActivityManager getDefault() {
82 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 }
84
85 /**
86 * Convenience for checking whether the system is ready. For internal use only.
87 */
88 static public boolean isSystemReady() {
89 if (!sSystemReady) {
90 sSystemReady = getDefault().testIsSystemReady();
91 }
92 return sSystemReady;
93 }
94 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080095
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 /**
97 * Convenience for sending a sticky broadcast. For internal use only.
98 * If you don't care about permission, use null.
99 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -0700100 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800101 try {
102 getDefault().broadcastIntent(
103 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800104 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105 } catch (RemoteException ex) {
106 }
107 }
108
Dianne Hackborn099bc622014-01-22 13:39:16 -0800109 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800111 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800116 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117 attachInterface(this, descriptor);
118 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700119
120 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800121 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
122 throws RemoteException {
123 switch (code) {
124 case START_ACTIVITY_TRANSACTION:
125 {
126 data.enforceInterface(IActivityManager.descriptor);
127 IBinder b = data.readStrongBinder();
128 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800129 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 Intent intent = Intent.CREATOR.createFromParcel(data);
131 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800133 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700135 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700136 ProfilerInfo profilerInfo = data.readInt() != 0
137 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700138 Bundle options = data.readInt() != 0
139 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800140 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700141 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 reply.writeNoException();
143 reply.writeInt(result);
144 return true;
145 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700146
Amith Yamasani82644082012-08-03 13:09:11 -0700147 case START_ACTIVITY_AS_USER_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
155 IBinder resultTo = data.readStrongBinder();
156 String resultWho = data.readString();
157 int requestCode = data.readInt();
158 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700159 ProfilerInfo profilerInfo = data.readInt() != 0
160 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
163 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800164 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700165 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700166 reply.writeNoException();
167 reply.writeInt(result);
168 return true;
169 }
170
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700171 case START_ACTIVITY_AS_CALLER_TRANSACTION:
172 {
173 data.enforceInterface(IActivityManager.descriptor);
174 IBinder b = data.readStrongBinder();
175 IApplicationThread app = ApplicationThreadNative.asInterface(b);
176 String callingPackage = data.readString();
177 Intent intent = Intent.CREATOR.createFromParcel(data);
178 String resolvedType = data.readString();
179 IBinder resultTo = data.readStrongBinder();
180 String resultWho = data.readString();
181 int requestCode = data.readInt();
182 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700183 ProfilerInfo profilerInfo = data.readInt() != 0
184 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700185 Bundle options = data.readInt() != 0
186 ? Bundle.CREATOR.createFromParcel(data) : null;
187 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700188 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700189 reply.writeNoException();
190 reply.writeInt(result);
191 return true;
192 }
193
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800194 case START_ACTIVITY_AND_WAIT_TRANSACTION:
195 {
196 data.enforceInterface(IActivityManager.descriptor);
197 IBinder b = data.readStrongBinder();
198 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800199 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800200 Intent intent = Intent.CREATOR.createFromParcel(data);
201 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800202 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800203 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800204 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700205 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700206 ProfilerInfo profilerInfo = data.readInt() != 0
207 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700208 Bundle options = data.readInt() != 0
209 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700210 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800211 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700212 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800213 reply.writeNoException();
214 result.writeToParcel(reply, 0);
215 return true;
216 }
217
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700218 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
219 {
220 data.enforceInterface(IActivityManager.descriptor);
221 IBinder b = data.readStrongBinder();
222 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800223 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700224 Intent intent = Intent.CREATOR.createFromParcel(data);
225 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700226 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700227 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700228 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700229 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700230 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 Bundle options = data.readInt() != 0
232 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700233 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800234 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700235 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700236 reply.writeNoException();
237 reply.writeInt(result);
238 return true;
239 }
240
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700241 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700242 {
243 data.enforceInterface(IActivityManager.descriptor);
244 IBinder b = data.readStrongBinder();
245 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700246 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700247 Intent fillInIntent = null;
248 if (data.readInt() != 0) {
249 fillInIntent = Intent.CREATOR.createFromParcel(data);
250 }
251 String resolvedType = data.readString();
252 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700253 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700254 int requestCode = data.readInt();
255 int flagsMask = data.readInt();
256 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700257 Bundle options = data.readInt() != 0
258 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700259 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700260 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700261 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700262 reply.writeNoException();
263 reply.writeInt(result);
264 return true;
265 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700266
Dianne Hackborn91097de2014-04-04 18:02:06 -0700267 case START_VOICE_ACTIVITY_TRANSACTION:
268 {
269 data.enforceInterface(IActivityManager.descriptor);
270 String callingPackage = data.readString();
271 int callingPid = data.readInt();
272 int callingUid = data.readInt();
273 Intent intent = Intent.CREATOR.createFromParcel(data);
274 String resolvedType = data.readString();
275 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
276 data.readStrongBinder());
277 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
278 data.readStrongBinder());
279 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700280 ProfilerInfo profilerInfo = data.readInt() != 0
281 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700282 Bundle options = data.readInt() != 0
283 ? Bundle.CREATOR.createFromParcel(data) : null;
284 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700285 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
286 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700287 reply.writeNoException();
288 reply.writeInt(result);
289 return true;
290 }
291
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800292 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
293 {
294 data.enforceInterface(IActivityManager.descriptor);
295 IBinder callingActivity = data.readStrongBinder();
296 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700297 Bundle options = data.readInt() != 0
298 ? Bundle.CREATOR.createFromParcel(data) : null;
299 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800300 reply.writeNoException();
301 reply.writeInt(result ? 1 : 0);
302 return true;
303 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700304
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700305 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
306 {
307 data.enforceInterface(IActivityManager.descriptor);
308 int taskId = data.readInt();
309 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
310 int result = startActivityFromRecents(taskId, options);
311 reply.writeNoException();
312 reply.writeInt(result);
313 return true;
314 }
315
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800316 case FINISH_ACTIVITY_TRANSACTION: {
317 data.enforceInterface(IActivityManager.descriptor);
318 IBinder token = data.readStrongBinder();
319 Intent resultData = null;
320 int resultCode = data.readInt();
321 if (data.readInt() != 0) {
322 resultData = Intent.CREATOR.createFromParcel(data);
323 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700324 boolean finishTask = (data.readInt() != 0);
325 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 reply.writeNoException();
327 reply.writeInt(res ? 1 : 0);
328 return true;
329 }
330
331 case FINISH_SUB_ACTIVITY_TRANSACTION: {
332 data.enforceInterface(IActivityManager.descriptor);
333 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700334 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800335 int requestCode = data.readInt();
336 finishSubActivity(token, resultWho, requestCode);
337 reply.writeNoException();
338 return true;
339 }
340
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700341 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
342 data.enforceInterface(IActivityManager.descriptor);
343 IBinder token = data.readStrongBinder();
344 boolean res = finishActivityAffinity(token);
345 reply.writeNoException();
346 reply.writeInt(res ? 1 : 0);
347 return true;
348 }
349
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700350 case FINISH_VOICE_TASK_TRANSACTION: {
351 data.enforceInterface(IActivityManager.descriptor);
352 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
353 data.readStrongBinder());
354 finishVoiceTask(session);
355 reply.writeNoException();
356 return true;
357 }
358
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700359 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
360 data.enforceInterface(IActivityManager.descriptor);
361 IBinder token = data.readStrongBinder();
362 boolean res = releaseActivityInstance(token);
363 reply.writeNoException();
364 reply.writeInt(res ? 1 : 0);
365 return true;
366 }
367
368 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
369 data.enforceInterface(IActivityManager.descriptor);
370 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
371 releaseSomeActivities(app);
372 reply.writeNoException();
373 return true;
374 }
375
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800376 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
377 data.enforceInterface(IActivityManager.descriptor);
378 IBinder token = data.readStrongBinder();
379 boolean res = willActivityBeVisible(token);
380 reply.writeNoException();
381 reply.writeInt(res ? 1 : 0);
382 return true;
383 }
384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 case REGISTER_RECEIVER_TRANSACTION:
386 {
387 data.enforceInterface(IActivityManager.descriptor);
388 IBinder b = data.readStrongBinder();
389 IApplicationThread app =
390 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700391 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800392 b = data.readStrongBinder();
393 IIntentReceiver rec
394 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
395 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
396 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700397 int userId = data.readInt();
398 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800399 reply.writeNoException();
400 if (intent != null) {
401 reply.writeInt(1);
402 intent.writeToParcel(reply, 0);
403 } else {
404 reply.writeInt(0);
405 }
406 return true;
407 }
408
409 case UNREGISTER_RECEIVER_TRANSACTION:
410 {
411 data.enforceInterface(IActivityManager.descriptor);
412 IBinder b = data.readStrongBinder();
413 if (b == null) {
414 return true;
415 }
416 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
417 unregisterReceiver(rec);
418 reply.writeNoException();
419 return true;
420 }
421
422 case BROADCAST_INTENT_TRANSACTION:
423 {
424 data.enforceInterface(IActivityManager.descriptor);
425 IBinder b = data.readStrongBinder();
426 IApplicationThread app =
427 b != null ? ApplicationThreadNative.asInterface(b) : null;
428 Intent intent = Intent.CREATOR.createFromParcel(data);
429 String resolvedType = data.readString();
430 b = data.readStrongBinder();
431 IIntentReceiver resultTo =
432 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
433 int resultCode = data.readInt();
434 String resultData = data.readString();
435 Bundle resultExtras = data.readBundle();
436 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800437 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800438 boolean serialized = data.readInt() != 0;
439 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700440 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800441 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800442 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700443 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800444 reply.writeNoException();
445 reply.writeInt(res);
446 return true;
447 }
448
449 case UNBROADCAST_INTENT_TRANSACTION:
450 {
451 data.enforceInterface(IActivityManager.descriptor);
452 IBinder b = data.readStrongBinder();
453 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
454 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700455 int userId = data.readInt();
456 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800457 reply.writeNoException();
458 return true;
459 }
460
461 case FINISH_RECEIVER_TRANSACTION: {
462 data.enforceInterface(IActivityManager.descriptor);
463 IBinder who = data.readStrongBinder();
464 int resultCode = data.readInt();
465 String resultData = data.readString();
466 Bundle resultExtras = data.readBundle();
467 boolean resultAbort = data.readInt() != 0;
468 if (who != null) {
469 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
470 }
471 reply.writeNoException();
472 return true;
473 }
474
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800475 case ATTACH_APPLICATION_TRANSACTION: {
476 data.enforceInterface(IActivityManager.descriptor);
477 IApplicationThread app = ApplicationThreadNative.asInterface(
478 data.readStrongBinder());
479 if (app != null) {
480 attachApplication(app);
481 }
482 reply.writeNoException();
483 return true;
484 }
485
486 case ACTIVITY_IDLE_TRANSACTION: {
487 data.enforceInterface(IActivityManager.descriptor);
488 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700489 Configuration config = null;
490 if (data.readInt() != 0) {
491 config = Configuration.CREATOR.createFromParcel(data);
492 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700493 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700495 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800496 }
497 reply.writeNoException();
498 return true;
499 }
500
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700501 case ACTIVITY_RESUMED_TRANSACTION: {
502 data.enforceInterface(IActivityManager.descriptor);
503 IBinder token = data.readStrongBinder();
504 activityResumed(token);
505 reply.writeNoException();
506 return true;
507 }
508
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800509 case ACTIVITY_PAUSED_TRANSACTION: {
510 data.enforceInterface(IActivityManager.descriptor);
511 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700512 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800513 reply.writeNoException();
514 return true;
515 }
516
517 case ACTIVITY_STOPPED_TRANSACTION: {
518 data.enforceInterface(IActivityManager.descriptor);
519 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800520 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700521 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800522 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700523 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800524 reply.writeNoException();
525 return true;
526 }
527
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800528 case ACTIVITY_SLEPT_TRANSACTION: {
529 data.enforceInterface(IActivityManager.descriptor);
530 IBinder token = data.readStrongBinder();
531 activitySlept(token);
532 reply.writeNoException();
533 return true;
534 }
535
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800536 case ACTIVITY_DESTROYED_TRANSACTION: {
537 data.enforceInterface(IActivityManager.descriptor);
538 IBinder token = data.readStrongBinder();
539 activityDestroyed(token);
540 reply.writeNoException();
541 return true;
542 }
543
544 case GET_CALLING_PACKAGE_TRANSACTION: {
545 data.enforceInterface(IActivityManager.descriptor);
546 IBinder token = data.readStrongBinder();
547 String res = token != null ? getCallingPackage(token) : null;
548 reply.writeNoException();
549 reply.writeString(res);
550 return true;
551 }
552
553 case GET_CALLING_ACTIVITY_TRANSACTION: {
554 data.enforceInterface(IActivityManager.descriptor);
555 IBinder token = data.readStrongBinder();
556 ComponentName cn = getCallingActivity(token);
557 reply.writeNoException();
558 ComponentName.writeToParcel(cn, reply);
559 return true;
560 }
561
Winson Chung1147c402014-05-14 11:05:00 -0700562 case GET_APP_TASKS_TRANSACTION: {
563 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700564 String callingPackage = data.readString();
565 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700566 reply.writeNoException();
567 int N = list != null ? list.size() : -1;
568 reply.writeInt(N);
569 int i;
570 for (i=0; i<N; i++) {
571 IAppTask task = list.get(i);
572 reply.writeStrongBinder(task.asBinder());
573 }
574 return true;
575 }
576
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700577 case ADD_APP_TASK_TRANSACTION: {
578 data.enforceInterface(IActivityManager.descriptor);
579 IBinder activityToken = data.readStrongBinder();
580 Intent intent = Intent.CREATOR.createFromParcel(data);
581 ActivityManager.TaskDescription descr
582 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
583 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
584 int res = addAppTask(activityToken, intent, descr, thumbnail);
585 reply.writeNoException();
586 reply.writeInt(res);
587 return true;
588 }
589
590 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
591 data.enforceInterface(IActivityManager.descriptor);
592 Point size = getAppTaskThumbnailSize();
593 reply.writeNoException();
594 size.writeToParcel(reply, 0);
595 return true;
596 }
597
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800598 case GET_TASKS_TRANSACTION: {
599 data.enforceInterface(IActivityManager.descriptor);
600 int maxNum = data.readInt();
601 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700602 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800603 reply.writeNoException();
604 int N = list != null ? list.size() : -1;
605 reply.writeInt(N);
606 int i;
607 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700608 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800609 info.writeToParcel(reply, 0);
610 }
611 return true;
612 }
613
614 case GET_RECENT_TASKS_TRANSACTION: {
615 data.enforceInterface(IActivityManager.descriptor);
616 int maxNum = data.readInt();
617 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700618 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800619 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700620 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800621 reply.writeNoException();
622 reply.writeTypedList(list);
623 return true;
624 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700625
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700626 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800627 data.enforceInterface(IActivityManager.descriptor);
628 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700629 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800630 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700631 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800632 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700633 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700634 } else {
635 reply.writeInt(0);
636 }
637 return true;
638 }
639
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 case GET_SERVICES_TRANSACTION: {
641 data.enforceInterface(IActivityManager.descriptor);
642 int maxNum = data.readInt();
643 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700644 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800645 reply.writeNoException();
646 int N = list != null ? list.size() : -1;
647 reply.writeInt(N);
648 int i;
649 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700650 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800651 info.writeToParcel(reply, 0);
652 }
653 return true;
654 }
655
656 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
657 data.enforceInterface(IActivityManager.descriptor);
658 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
659 reply.writeNoException();
660 reply.writeTypedList(list);
661 return true;
662 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700663
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800664 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
665 data.enforceInterface(IActivityManager.descriptor);
666 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
667 reply.writeNoException();
668 reply.writeTypedList(list);
669 return true;
670 }
671
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700672 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
673 data.enforceInterface(IActivityManager.descriptor);
674 List<ApplicationInfo> list = getRunningExternalApplications();
675 reply.writeNoException();
676 reply.writeTypedList(list);
677 return true;
678 }
679
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800680 case MOVE_TASK_TO_FRONT_TRANSACTION: {
681 data.enforceInterface(IActivityManager.descriptor);
682 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800683 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700684 Bundle options = data.readInt() != 0
685 ? Bundle.CREATOR.createFromParcel(data) : null;
686 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800687 reply.writeNoException();
688 return true;
689 }
690
691 case MOVE_TASK_TO_BACK_TRANSACTION: {
692 data.enforceInterface(IActivityManager.descriptor);
693 int task = data.readInt();
694 moveTaskToBack(task);
695 reply.writeNoException();
696 return true;
697 }
698
699 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
700 data.enforceInterface(IActivityManager.descriptor);
701 IBinder token = data.readStrongBinder();
702 boolean nonRoot = data.readInt() != 0;
703 boolean res = moveActivityTaskToBack(token, nonRoot);
704 reply.writeNoException();
705 reply.writeInt(res ? 1 : 0);
706 return true;
707 }
708
709 case MOVE_TASK_BACKWARDS_TRANSACTION: {
710 data.enforceInterface(IActivityManager.descriptor);
711 int task = data.readInt();
712 moveTaskBackwards(task);
713 reply.writeNoException();
714 return true;
715 }
716
Craig Mautnerc00204b2013-03-05 15:02:14 -0800717 case MOVE_TASK_TO_STACK_TRANSACTION: {
718 data.enforceInterface(IActivityManager.descriptor);
719 int taskId = data.readInt();
720 int stackId = data.readInt();
721 boolean toTop = data.readInt() != 0;
722 moveTaskToStack(taskId, stackId, toTop);
723 reply.writeNoException();
724 return true;
725 }
726
727 case RESIZE_STACK_TRANSACTION: {
728 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800729 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800730 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800731 Rect r = Rect.CREATOR.createFromParcel(data);
732 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800733 reply.writeNoException();
734 return true;
735 }
736
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800737 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700738 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800739 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700740 reply.writeNoException();
741 reply.writeTypedList(list);
742 return true;
743 }
744
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800745 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700746 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800747 int stackId = data.readInt();
748 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700749 reply.writeNoException();
750 if (info != null) {
751 reply.writeInt(1);
752 info.writeToParcel(reply, 0);
753 } else {
754 reply.writeInt(0);
755 }
756 return true;
757 }
758
Winson Chung303e1ff2014-03-07 15:06:19 -0800759 case IS_IN_HOME_STACK_TRANSACTION: {
760 data.enforceInterface(IActivityManager.descriptor);
761 int taskId = data.readInt();
762 boolean isInHomeStack = isInHomeStack(taskId);
763 reply.writeNoException();
764 reply.writeInt(isInHomeStack ? 1 : 0);
765 return true;
766 }
767
Craig Mautnercf910b02013-04-23 11:23:27 -0700768 case SET_FOCUSED_STACK_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 int stackId = data.readInt();
771 setFocusedStack(stackId);
772 reply.writeNoException();
773 return true;
774 }
775
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800776 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
777 data.enforceInterface(IActivityManager.descriptor);
778 IBinder token = data.readStrongBinder();
779 boolean onlyRoot = data.readInt() != 0;
780 int res = token != null
781 ? getTaskForActivity(token, onlyRoot) : -1;
782 reply.writeNoException();
783 reply.writeInt(res);
784 return true;
785 }
786
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800787 case GET_CONTENT_PROVIDER_TRANSACTION: {
788 data.enforceInterface(IActivityManager.descriptor);
789 IBinder b = data.readStrongBinder();
790 IApplicationThread app = ApplicationThreadNative.asInterface(b);
791 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700792 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700793 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700794 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800795 reply.writeNoException();
796 if (cph != null) {
797 reply.writeInt(1);
798 cph.writeToParcel(reply, 0);
799 } else {
800 reply.writeInt(0);
801 }
802 return true;
803 }
804
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800805 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
806 data.enforceInterface(IActivityManager.descriptor);
807 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700808 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800809 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700810 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800811 reply.writeNoException();
812 if (cph != null) {
813 reply.writeInt(1);
814 cph.writeToParcel(reply, 0);
815 } else {
816 reply.writeInt(0);
817 }
818 return true;
819 }
820
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800821 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
822 data.enforceInterface(IActivityManager.descriptor);
823 IBinder b = data.readStrongBinder();
824 IApplicationThread app = ApplicationThreadNative.asInterface(b);
825 ArrayList<ContentProviderHolder> providers =
826 data.createTypedArrayList(ContentProviderHolder.CREATOR);
827 publishContentProviders(app, providers);
828 reply.writeNoException();
829 return true;
830 }
831
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700832 case REF_CONTENT_PROVIDER_TRANSACTION: {
833 data.enforceInterface(IActivityManager.descriptor);
834 IBinder b = data.readStrongBinder();
835 int stable = data.readInt();
836 int unstable = data.readInt();
837 boolean res = refContentProvider(b, stable, unstable);
838 reply.writeNoException();
839 reply.writeInt(res ? 1 : 0);
840 return true;
841 }
842
843 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
844 data.enforceInterface(IActivityManager.descriptor);
845 IBinder b = data.readStrongBinder();
846 unstableProviderDied(b);
847 reply.writeNoException();
848 return true;
849 }
850
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700851 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
852 data.enforceInterface(IActivityManager.descriptor);
853 IBinder b = data.readStrongBinder();
854 appNotRespondingViaProvider(b);
855 reply.writeNoException();
856 return true;
857 }
858
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800859 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
860 data.enforceInterface(IActivityManager.descriptor);
861 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700862 boolean stable = data.readInt() != 0;
863 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800864 reply.writeNoException();
865 return true;
866 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800867
868 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
869 data.enforceInterface(IActivityManager.descriptor);
870 String name = data.readString();
871 IBinder token = data.readStrongBinder();
872 removeContentProviderExternal(name, token);
873 reply.writeNoException();
874 return true;
875 }
876
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700877 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
878 data.enforceInterface(IActivityManager.descriptor);
879 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
880 PendingIntent pi = getRunningServiceControlPanel(comp);
881 reply.writeNoException();
882 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
883 return true;
884 }
885
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800886 case START_SERVICE_TRANSACTION: {
887 data.enforceInterface(IActivityManager.descriptor);
888 IBinder b = data.readStrongBinder();
889 IApplicationThread app = ApplicationThreadNative.asInterface(b);
890 Intent service = Intent.CREATOR.createFromParcel(data);
891 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700892 int userId = data.readInt();
893 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800894 reply.writeNoException();
895 ComponentName.writeToParcel(cn, reply);
896 return true;
897 }
898
899 case STOP_SERVICE_TRANSACTION: {
900 data.enforceInterface(IActivityManager.descriptor);
901 IBinder b = data.readStrongBinder();
902 IApplicationThread app = ApplicationThreadNative.asInterface(b);
903 Intent service = Intent.CREATOR.createFromParcel(data);
904 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700905 int userId = data.readInt();
906 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800907 reply.writeNoException();
908 reply.writeInt(res);
909 return true;
910 }
911
912 case STOP_SERVICE_TOKEN_TRANSACTION: {
913 data.enforceInterface(IActivityManager.descriptor);
914 ComponentName className = ComponentName.readFromParcel(data);
915 IBinder token = data.readStrongBinder();
916 int startId = data.readInt();
917 boolean res = stopServiceToken(className, token, startId);
918 reply.writeNoException();
919 reply.writeInt(res ? 1 : 0);
920 return true;
921 }
922
923 case SET_SERVICE_FOREGROUND_TRANSACTION: {
924 data.enforceInterface(IActivityManager.descriptor);
925 ComponentName className = ComponentName.readFromParcel(data);
926 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700927 int id = data.readInt();
928 Notification notification = null;
929 if (data.readInt() != 0) {
930 notification = Notification.CREATOR.createFromParcel(data);
931 }
932 boolean removeNotification = data.readInt() != 0;
933 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800934 reply.writeNoException();
935 return true;
936 }
937
938 case BIND_SERVICE_TRANSACTION: {
939 data.enforceInterface(IActivityManager.descriptor);
940 IBinder b = data.readStrongBinder();
941 IApplicationThread app = ApplicationThreadNative.asInterface(b);
942 IBinder token = data.readStrongBinder();
943 Intent service = Intent.CREATOR.createFromParcel(data);
944 String resolvedType = data.readString();
945 b = data.readStrongBinder();
946 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800947 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800948 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800949 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800950 reply.writeNoException();
951 reply.writeInt(res);
952 return true;
953 }
954
955 case UNBIND_SERVICE_TRANSACTION: {
956 data.enforceInterface(IActivityManager.descriptor);
957 IBinder b = data.readStrongBinder();
958 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
959 boolean res = unbindService(conn);
960 reply.writeNoException();
961 reply.writeInt(res ? 1 : 0);
962 return true;
963 }
964
965 case PUBLISH_SERVICE_TRANSACTION: {
966 data.enforceInterface(IActivityManager.descriptor);
967 IBinder token = data.readStrongBinder();
968 Intent intent = Intent.CREATOR.createFromParcel(data);
969 IBinder service = data.readStrongBinder();
970 publishService(token, intent, service);
971 reply.writeNoException();
972 return true;
973 }
974
975 case UNBIND_FINISHED_TRANSACTION: {
976 data.enforceInterface(IActivityManager.descriptor);
977 IBinder token = data.readStrongBinder();
978 Intent intent = Intent.CREATOR.createFromParcel(data);
979 boolean doRebind = data.readInt() != 0;
980 unbindFinished(token, intent, doRebind);
981 reply.writeNoException();
982 return true;
983 }
984
985 case SERVICE_DONE_EXECUTING_TRANSACTION: {
986 data.enforceInterface(IActivityManager.descriptor);
987 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700988 int type = data.readInt();
989 int startId = data.readInt();
990 int res = data.readInt();
991 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800992 reply.writeNoException();
993 return true;
994 }
995
996 case START_INSTRUMENTATION_TRANSACTION: {
997 data.enforceInterface(IActivityManager.descriptor);
998 ComponentName className = ComponentName.readFromParcel(data);
999 String profileFile = data.readString();
1000 int fl = data.readInt();
1001 Bundle arguments = data.readBundle();
1002 IBinder b = data.readStrongBinder();
1003 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001004 b = data.readStrongBinder();
1005 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001006 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001007 String abiOverride = data.readString();
1008 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1009 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001010 reply.writeNoException();
1011 reply.writeInt(res ? 1 : 0);
1012 return true;
1013 }
1014
1015
1016 case FINISH_INSTRUMENTATION_TRANSACTION: {
1017 data.enforceInterface(IActivityManager.descriptor);
1018 IBinder b = data.readStrongBinder();
1019 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1020 int resultCode = data.readInt();
1021 Bundle results = data.readBundle();
1022 finishInstrumentation(app, resultCode, results);
1023 reply.writeNoException();
1024 return true;
1025 }
1026
1027 case GET_CONFIGURATION_TRANSACTION: {
1028 data.enforceInterface(IActivityManager.descriptor);
1029 Configuration config = getConfiguration();
1030 reply.writeNoException();
1031 config.writeToParcel(reply, 0);
1032 return true;
1033 }
1034
1035 case UPDATE_CONFIGURATION_TRANSACTION: {
1036 data.enforceInterface(IActivityManager.descriptor);
1037 Configuration config = Configuration.CREATOR.createFromParcel(data);
1038 updateConfiguration(config);
1039 reply.writeNoException();
1040 return true;
1041 }
1042
1043 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1044 data.enforceInterface(IActivityManager.descriptor);
1045 IBinder token = data.readStrongBinder();
1046 int requestedOrientation = data.readInt();
1047 setRequestedOrientation(token, requestedOrientation);
1048 reply.writeNoException();
1049 return true;
1050 }
1051
1052 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1053 data.enforceInterface(IActivityManager.descriptor);
1054 IBinder token = data.readStrongBinder();
1055 int req = getRequestedOrientation(token);
1056 reply.writeNoException();
1057 reply.writeInt(req);
1058 return true;
1059 }
1060
1061 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1062 data.enforceInterface(IActivityManager.descriptor);
1063 IBinder token = data.readStrongBinder();
1064 ComponentName cn = getActivityClassForToken(token);
1065 reply.writeNoException();
1066 ComponentName.writeToParcel(cn, reply);
1067 return true;
1068 }
1069
1070 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1071 data.enforceInterface(IActivityManager.descriptor);
1072 IBinder token = data.readStrongBinder();
1073 reply.writeNoException();
1074 reply.writeString(getPackageForToken(token));
1075 return true;
1076 }
1077
1078 case GET_INTENT_SENDER_TRANSACTION: {
1079 data.enforceInterface(IActivityManager.descriptor);
1080 int type = data.readInt();
1081 String packageName = data.readString();
1082 IBinder token = data.readStrongBinder();
1083 String resultWho = data.readString();
1084 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001085 Intent[] requestIntents;
1086 String[] requestResolvedTypes;
1087 if (data.readInt() != 0) {
1088 requestIntents = data.createTypedArray(Intent.CREATOR);
1089 requestResolvedTypes = data.createStringArray();
1090 } else {
1091 requestIntents = null;
1092 requestResolvedTypes = null;
1093 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001094 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001095 Bundle options = data.readInt() != 0
1096 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001097 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001098 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001099 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001100 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001101 reply.writeNoException();
1102 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1103 return true;
1104 }
1105
1106 case CANCEL_INTENT_SENDER_TRANSACTION: {
1107 data.enforceInterface(IActivityManager.descriptor);
1108 IIntentSender r = IIntentSender.Stub.asInterface(
1109 data.readStrongBinder());
1110 cancelIntentSender(r);
1111 reply.writeNoException();
1112 return true;
1113 }
1114
1115 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1116 data.enforceInterface(IActivityManager.descriptor);
1117 IIntentSender r = IIntentSender.Stub.asInterface(
1118 data.readStrongBinder());
1119 String res = getPackageForIntentSender(r);
1120 reply.writeNoException();
1121 reply.writeString(res);
1122 return true;
1123 }
1124
Christopher Tatec4a07d12012-04-06 14:19:13 -07001125 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1126 data.enforceInterface(IActivityManager.descriptor);
1127 IIntentSender r = IIntentSender.Stub.asInterface(
1128 data.readStrongBinder());
1129 int res = getUidForIntentSender(r);
1130 reply.writeNoException();
1131 reply.writeInt(res);
1132 return true;
1133 }
1134
Dianne Hackborn41203752012-08-31 14:05:51 -07001135 case HANDLE_INCOMING_USER_TRANSACTION: {
1136 data.enforceInterface(IActivityManager.descriptor);
1137 int callingPid = data.readInt();
1138 int callingUid = data.readInt();
1139 int userId = data.readInt();
1140 boolean allowAll = data.readInt() != 0 ;
1141 boolean requireFull = data.readInt() != 0;
1142 String name = data.readString();
1143 String callerPackage = data.readString();
1144 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1145 requireFull, name, callerPackage);
1146 reply.writeNoException();
1147 reply.writeInt(res);
1148 return true;
1149 }
1150
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 case SET_PROCESS_LIMIT_TRANSACTION: {
1152 data.enforceInterface(IActivityManager.descriptor);
1153 int max = data.readInt();
1154 setProcessLimit(max);
1155 reply.writeNoException();
1156 return true;
1157 }
1158
1159 case GET_PROCESS_LIMIT_TRANSACTION: {
1160 data.enforceInterface(IActivityManager.descriptor);
1161 int limit = getProcessLimit();
1162 reply.writeNoException();
1163 reply.writeInt(limit);
1164 return true;
1165 }
1166
1167 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1168 data.enforceInterface(IActivityManager.descriptor);
1169 IBinder token = data.readStrongBinder();
1170 int pid = data.readInt();
1171 boolean isForeground = data.readInt() != 0;
1172 setProcessForeground(token, pid, isForeground);
1173 reply.writeNoException();
1174 return true;
1175 }
1176
1177 case CHECK_PERMISSION_TRANSACTION: {
1178 data.enforceInterface(IActivityManager.descriptor);
1179 String perm = data.readString();
1180 int pid = data.readInt();
1181 int uid = data.readInt();
1182 int res = checkPermission(perm, pid, uid);
1183 reply.writeNoException();
1184 reply.writeInt(res);
1185 return true;
1186 }
1187
1188 case CHECK_URI_PERMISSION_TRANSACTION: {
1189 data.enforceInterface(IActivityManager.descriptor);
1190 Uri uri = Uri.CREATOR.createFromParcel(data);
1191 int pid = data.readInt();
1192 int uid = data.readInt();
1193 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001194 int userId = data.readInt();
1195 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001196 reply.writeNoException();
1197 reply.writeInt(res);
1198 return true;
1199 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001200
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001201 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001202 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001203 String packageName = data.readString();
1204 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1205 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001206 int userId = data.readInt();
1207 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001208 reply.writeNoException();
1209 reply.writeInt(res ? 1 : 0);
1210 return true;
1211 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001212
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 case GRANT_URI_PERMISSION_TRANSACTION: {
1214 data.enforceInterface(IActivityManager.descriptor);
1215 IBinder b = data.readStrongBinder();
1216 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1217 String targetPkg = data.readString();
1218 Uri uri = Uri.CREATOR.createFromParcel(data);
1219 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001220 int userId = data.readInt();
1221 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001222 reply.writeNoException();
1223 return true;
1224 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001225
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001226 case REVOKE_URI_PERMISSION_TRANSACTION: {
1227 data.enforceInterface(IActivityManager.descriptor);
1228 IBinder b = data.readStrongBinder();
1229 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1230 Uri uri = Uri.CREATOR.createFromParcel(data);
1231 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001232 int userId = data.readInt();
1233 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001234 reply.writeNoException();
1235 return true;
1236 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001237
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001238 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1239 data.enforceInterface(IActivityManager.descriptor);
1240 Uri uri = Uri.CREATOR.createFromParcel(data);
1241 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001242 int userId = data.readInt();
1243 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001244 reply.writeNoException();
1245 return true;
1246 }
1247
1248 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 Uri uri = Uri.CREATOR.createFromParcel(data);
1251 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001252 int userId = data.readInt();
1253 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001254 reply.writeNoException();
1255 return true;
1256 }
1257
1258 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1259 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001260 final String packageName = data.readString();
1261 final boolean incoming = data.readInt() != 0;
1262 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1263 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001264 reply.writeNoException();
1265 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1266 return true;
1267 }
1268
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001269 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1270 data.enforceInterface(IActivityManager.descriptor);
1271 IBinder b = data.readStrongBinder();
1272 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1273 boolean waiting = data.readInt() != 0;
1274 showWaitingForDebugger(app, waiting);
1275 reply.writeNoException();
1276 return true;
1277 }
1278
1279 case GET_MEMORY_INFO_TRANSACTION: {
1280 data.enforceInterface(IActivityManager.descriptor);
1281 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1282 getMemoryInfo(mi);
1283 reply.writeNoException();
1284 mi.writeToParcel(reply, 0);
1285 return true;
1286 }
1287
1288 case UNHANDLED_BACK_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 unhandledBack();
1291 reply.writeNoException();
1292 return true;
1293 }
1294
1295 case OPEN_CONTENT_URI_TRANSACTION: {
1296 data.enforceInterface(IActivityManager.descriptor);
1297 Uri uri = Uri.parse(data.readString());
1298 ParcelFileDescriptor pfd = openContentUri(uri);
1299 reply.writeNoException();
1300 if (pfd != null) {
1301 reply.writeInt(1);
1302 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1303 } else {
1304 reply.writeInt(0);
1305 }
1306 return true;
1307 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001308
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001309 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1310 data.enforceInterface(IActivityManager.descriptor);
1311 setLockScreenShown(data.readInt() != 0);
1312 reply.writeNoException();
1313 return true;
1314 }
1315
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001316 case SET_DEBUG_APP_TRANSACTION: {
1317 data.enforceInterface(IActivityManager.descriptor);
1318 String pn = data.readString();
1319 boolean wfd = data.readInt() != 0;
1320 boolean per = data.readInt() != 0;
1321 setDebugApp(pn, wfd, per);
1322 reply.writeNoException();
1323 return true;
1324 }
1325
1326 case SET_ALWAYS_FINISH_TRANSACTION: {
1327 data.enforceInterface(IActivityManager.descriptor);
1328 boolean enabled = data.readInt() != 0;
1329 setAlwaysFinish(enabled);
1330 reply.writeNoException();
1331 return true;
1332 }
1333
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001334 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001335 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001336 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001337 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001338 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001339 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001340 return true;
1341 }
1342
1343 case ENTER_SAFE_MODE_TRANSACTION: {
1344 data.enforceInterface(IActivityManager.descriptor);
1345 enterSafeMode();
1346 reply.writeNoException();
1347 return true;
1348 }
1349
1350 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1351 data.enforceInterface(IActivityManager.descriptor);
1352 IIntentSender is = IIntentSender.Stub.asInterface(
1353 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001354 int sourceUid = data.readInt();
1355 String sourcePkg = data.readString();
1356 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001357 reply.writeNoException();
1358 return true;
1359 }
1360
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001361 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001362 data.enforceInterface(IActivityManager.descriptor);
1363 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001364 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001365 boolean secure = data.readInt() != 0;
1366 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001367 reply.writeNoException();
1368 reply.writeInt(res ? 1 : 0);
1369 return true;
1370 }
1371
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001372 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
1374 String reason = data.readString();
1375 boolean res = killProcessesBelowForeground(reason);
1376 reply.writeNoException();
1377 reply.writeInt(res ? 1 : 0);
1378 return true;
1379 }
1380
Dan Egnor60d87622009-12-16 16:32:58 -08001381 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1382 data.enforceInterface(IActivityManager.descriptor);
1383 IBinder app = data.readStrongBinder();
1384 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1385 handleApplicationCrash(app, ci);
1386 reply.writeNoException();
1387 return true;
1388 }
1389
1390 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001391 data.enforceInterface(IActivityManager.descriptor);
1392 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001393 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001394 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001395 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001396 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001397 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001398 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001399 return true;
1400 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001401
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001402 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1403 data.enforceInterface(IActivityManager.descriptor);
1404 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001405 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001406 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1407 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001408 reply.writeNoException();
1409 return true;
1410 }
1411
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001412 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1413 data.enforceInterface(IActivityManager.descriptor);
1414 int sig = data.readInt();
1415 signalPersistentProcesses(sig);
1416 reply.writeNoException();
1417 return true;
1418 }
1419
Dianne Hackborn03abb812010-01-04 18:43:19 -08001420 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1421 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001423 int userId = data.readInt();
1424 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001425 reply.writeNoException();
1426 return true;
1427 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001428
1429 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1430 data.enforceInterface(IActivityManager.descriptor);
1431 killAllBackgroundProcesses();
1432 reply.writeNoException();
1433 return true;
1434 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001435
Dianne Hackborn03abb812010-01-04 18:43:19 -08001436 case FORCE_STOP_PACKAGE_TRANSACTION: {
1437 data.enforceInterface(IActivityManager.descriptor);
1438 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001439 int userId = data.readInt();
1440 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001441 reply.writeNoException();
1442 return true;
1443 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001444
1445 case GET_MY_MEMORY_STATE_TRANSACTION: {
1446 data.enforceInterface(IActivityManager.descriptor);
1447 ActivityManager.RunningAppProcessInfo info =
1448 new ActivityManager.RunningAppProcessInfo();
1449 getMyMemoryState(info);
1450 reply.writeNoException();
1451 info.writeToParcel(reply, 0);
1452 return true;
1453 }
1454
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001455 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1456 data.enforceInterface(IActivityManager.descriptor);
1457 ConfigurationInfo config = getDeviceConfigurationInfo();
1458 reply.writeNoException();
1459 config.writeToParcel(reply, 0);
1460 return true;
1461 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001462
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001463 case PROFILE_CONTROL_TRANSACTION: {
1464 data.enforceInterface(IActivityManager.descriptor);
1465 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001466 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001467 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001468 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001469 ProfilerInfo profilerInfo = data.readInt() != 0
1470 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1471 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001472 reply.writeNoException();
1473 reply.writeInt(res ? 1 : 0);
1474 return true;
1475 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001476
Dianne Hackborn55280a92009-05-07 15:53:46 -07001477 case SHUTDOWN_TRANSACTION: {
1478 data.enforceInterface(IActivityManager.descriptor);
1479 boolean res = shutdown(data.readInt());
1480 reply.writeNoException();
1481 reply.writeInt(res ? 1 : 0);
1482 return true;
1483 }
1484
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001485 case STOP_APP_SWITCHES_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 stopAppSwitches();
1488 reply.writeNoException();
1489 return true;
1490 }
1491
1492 case RESUME_APP_SWITCHES_TRANSACTION: {
1493 data.enforceInterface(IActivityManager.descriptor);
1494 resumeAppSwitches();
1495 reply.writeNoException();
1496 return true;
1497 }
1498
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001499 case PEEK_SERVICE_TRANSACTION: {
1500 data.enforceInterface(IActivityManager.descriptor);
1501 Intent service = Intent.CREATOR.createFromParcel(data);
1502 String resolvedType = data.readString();
1503 IBinder binder = peekService(service, resolvedType);
1504 reply.writeNoException();
1505 reply.writeStrongBinder(binder);
1506 return true;
1507 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001508
1509 case START_BACKUP_AGENT_TRANSACTION: {
1510 data.enforceInterface(IActivityManager.descriptor);
1511 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1512 int backupRestoreMode = data.readInt();
1513 boolean success = bindBackupAgent(info, backupRestoreMode);
1514 reply.writeNoException();
1515 reply.writeInt(success ? 1 : 0);
1516 return true;
1517 }
1518
1519 case BACKUP_AGENT_CREATED_TRANSACTION: {
1520 data.enforceInterface(IActivityManager.descriptor);
1521 String packageName = data.readString();
1522 IBinder agent = data.readStrongBinder();
1523 backupAgentCreated(packageName, agent);
1524 reply.writeNoException();
1525 return true;
1526 }
1527
1528 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1529 data.enforceInterface(IActivityManager.descriptor);
1530 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1531 unbindBackupAgent(info);
1532 reply.writeNoException();
1533 return true;
1534 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001535
1536 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1537 data.enforceInterface(IActivityManager.descriptor);
1538 String packageName = data.readString();
1539 addPackageDependency(packageName);
1540 reply.writeNoException();
1541 return true;
1542 }
1543
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001544 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001545 data.enforceInterface(IActivityManager.descriptor);
1546 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001547 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001548 String reason = data.readString();
1549 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001550 reply.writeNoException();
1551 return true;
1552 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001553
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001554 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1555 data.enforceInterface(IActivityManager.descriptor);
1556 String reason = data.readString();
1557 closeSystemDialogs(reason);
1558 reply.writeNoException();
1559 return true;
1560 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001561
1562 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1563 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001564 int[] pids = data.createIntArray();
1565 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001566 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001567 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001568 return true;
1569 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001570
1571 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1572 data.enforceInterface(IActivityManager.descriptor);
1573 String processName = data.readString();
1574 int uid = data.readInt();
1575 killApplicationProcess(processName, uid);
1576 reply.writeNoException();
1577 return true;
1578 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001579
1580 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1581 data.enforceInterface(IActivityManager.descriptor);
1582 IBinder token = data.readStrongBinder();
1583 String packageName = data.readString();
1584 int enterAnim = data.readInt();
1585 int exitAnim = data.readInt();
1586 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001587 reply.writeNoException();
1588 return true;
1589 }
1590
1591 case IS_USER_A_MONKEY_TRANSACTION: {
1592 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001593 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001594 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001595 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001596 return true;
1597 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001598
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001599 case SET_USER_IS_MONKEY_TRANSACTION: {
1600 data.enforceInterface(IActivityManager.descriptor);
1601 final boolean monkey = (data.readInt() == 1);
1602 setUserIsMonkey(monkey);
1603 reply.writeNoException();
1604 return true;
1605 }
1606
Dianne Hackborn860755f2010-06-03 18:47:52 -07001607 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1608 data.enforceInterface(IActivityManager.descriptor);
1609 finishHeavyWeightApp();
1610 reply.writeNoException();
1611 return true;
1612 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001613
1614 case IS_IMMERSIVE_TRANSACTION: {
1615 data.enforceInterface(IActivityManager.descriptor);
1616 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001617 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001618 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001619 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001620 return true;
1621 }
1622
Craig Mautnerd61dc202014-07-07 11:09:11 -07001623 case IS_TOP_OF_TASK_TRANSACTION: {
1624 data.enforceInterface(IActivityManager.descriptor);
1625 IBinder token = data.readStrongBinder();
1626 final boolean isTopOfTask = isTopOfTask(token);
1627 reply.writeNoException();
1628 reply.writeInt(isTopOfTask ? 1 : 0);
1629 return true;
1630 }
1631
Craig Mautner5eda9b32013-07-02 11:58:16 -07001632 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001633 data.enforceInterface(IActivityManager.descriptor);
1634 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001635 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001636 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001637 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001638 return true;
1639 }
1640
1641 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1642 data.enforceInterface(IActivityManager.descriptor);
1643 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001644 final Bundle bundle;
1645 if (data.readInt() == 0) {
1646 bundle = null;
1647 } else {
1648 bundle = data.readBundle();
1649 }
1650 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1651 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001652 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001653 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001654 return true;
1655 }
1656
Craig Mautner233ceee2014-05-09 17:05:11 -07001657 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1658 data.enforceInterface(IActivityManager.descriptor);
1659 IBinder token = data.readStrongBinder();
1660 final ActivityOptions options = getActivityOptions(token);
1661 reply.writeNoException();
1662 reply.writeBundle(options == null ? null : options.toBundle());
1663 return true;
1664 }
1665
Daniel Sandler69a48172010-06-23 16:29:36 -04001666 case SET_IMMERSIVE_TRANSACTION: {
1667 data.enforceInterface(IActivityManager.descriptor);
1668 IBinder token = data.readStrongBinder();
1669 boolean imm = data.readInt() == 1;
1670 setImmersive(token, imm);
1671 reply.writeNoException();
1672 return true;
1673 }
1674
1675 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1676 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001677 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001678 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001679 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001680 return true;
1681 }
1682
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001683 case CRASH_APPLICATION_TRANSACTION: {
1684 data.enforceInterface(IActivityManager.descriptor);
1685 int uid = data.readInt();
1686 int initialPid = data.readInt();
1687 String packageName = data.readString();
1688 String message = data.readString();
1689 crashApplication(uid, initialPid, packageName, message);
1690 reply.writeNoException();
1691 return true;
1692 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001693
1694 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1695 data.enforceInterface(IActivityManager.descriptor);
1696 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001697 int userId = data.readInt();
1698 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001699 reply.writeNoException();
1700 reply.writeString(type);
1701 return true;
1702 }
1703
Dianne Hackborn7e269642010-08-25 19:50:20 -07001704 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1705 data.enforceInterface(IActivityManager.descriptor);
1706 String name = data.readString();
1707 IBinder perm = newUriPermissionOwner(name);
1708 reply.writeNoException();
1709 reply.writeStrongBinder(perm);
1710 return true;
1711 }
1712
1713 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1714 data.enforceInterface(IActivityManager.descriptor);
1715 IBinder owner = data.readStrongBinder();
1716 int fromUid = data.readInt();
1717 String targetPkg = data.readString();
1718 Uri uri = Uri.CREATOR.createFromParcel(data);
1719 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001720 int sourceUserId = data.readInt();
1721 int targetUserId = data.readInt();
1722 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1723 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001724 reply.writeNoException();
1725 return true;
1726 }
1727
1728 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1729 data.enforceInterface(IActivityManager.descriptor);
1730 IBinder owner = data.readStrongBinder();
1731 Uri uri = null;
1732 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001733 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001734 }
1735 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001736 int userId = data.readInt();
1737 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001738 reply.writeNoException();
1739 return true;
1740 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001741
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001742 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 int callingUid = data.readInt();
1745 String targetPkg = data.readString();
1746 Uri uri = Uri.CREATOR.createFromParcel(data);
1747 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001748 int userId = data.readInt();
1749 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001750 reply.writeNoException();
1751 reply.writeInt(res);
1752 return true;
1753 }
1754
Andy McFadden824c5102010-07-09 16:26:57 -07001755 case DUMP_HEAP_TRANSACTION: {
1756 data.enforceInterface(IActivityManager.descriptor);
1757 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001758 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001759 boolean managed = data.readInt() != 0;
1760 String path = data.readString();
1761 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001762 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001763 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001764 reply.writeNoException();
1765 reply.writeInt(res ? 1 : 0);
1766 return true;
1767 }
1768
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001769 case START_ACTIVITIES_TRANSACTION:
1770 {
1771 data.enforceInterface(IActivityManager.descriptor);
1772 IBinder b = data.readStrongBinder();
1773 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001774 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001775 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1776 String[] resolvedTypes = data.createStringArray();
1777 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001778 Bundle options = data.readInt() != 0
1779 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001780 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001781 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001782 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001783 reply.writeNoException();
1784 reply.writeInt(result);
1785 return true;
1786 }
1787
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001788 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1789 {
1790 data.enforceInterface(IActivityManager.descriptor);
1791 int mode = getFrontActivityScreenCompatMode();
1792 reply.writeNoException();
1793 reply.writeInt(mode);
1794 return true;
1795 }
1796
1797 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1798 {
1799 data.enforceInterface(IActivityManager.descriptor);
1800 int mode = data.readInt();
1801 setFrontActivityScreenCompatMode(mode);
1802 reply.writeNoException();
1803 reply.writeInt(mode);
1804 return true;
1805 }
1806
1807 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1808 {
1809 data.enforceInterface(IActivityManager.descriptor);
1810 String pkg = data.readString();
1811 int mode = getPackageScreenCompatMode(pkg);
1812 reply.writeNoException();
1813 reply.writeInt(mode);
1814 return true;
1815 }
1816
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001817 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1818 {
1819 data.enforceInterface(IActivityManager.descriptor);
1820 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001821 int mode = data.readInt();
1822 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001823 reply.writeNoException();
1824 return true;
1825 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001826
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001827 case SWITCH_USER_TRANSACTION: {
1828 data.enforceInterface(IActivityManager.descriptor);
1829 int userid = data.readInt();
1830 boolean result = switchUser(userid);
1831 reply.writeNoException();
1832 reply.writeInt(result ? 1 : 0);
1833 return true;
1834 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001835
Kenny Guy08488bf2014-02-21 17:40:37 +00001836 case START_USER_IN_BACKGROUND_TRANSACTION: {
1837 data.enforceInterface(IActivityManager.descriptor);
1838 int userid = data.readInt();
1839 boolean result = startUserInBackground(userid);
1840 reply.writeNoException();
1841 reply.writeInt(result ? 1 : 0);
1842 return true;
1843 }
1844
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001845 case STOP_USER_TRANSACTION: {
1846 data.enforceInterface(IActivityManager.descriptor);
1847 int userid = data.readInt();
1848 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1849 data.readStrongBinder());
1850 int result = stopUser(userid, callback);
1851 reply.writeNoException();
1852 reply.writeInt(result);
1853 return true;
1854 }
1855
Amith Yamasani52f1d752012-03-28 18:19:29 -07001856 case GET_CURRENT_USER_TRANSACTION: {
1857 data.enforceInterface(IActivityManager.descriptor);
1858 UserInfo userInfo = getCurrentUser();
1859 reply.writeNoException();
1860 userInfo.writeToParcel(reply, 0);
1861 return true;
1862 }
1863
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001864 case IS_USER_RUNNING_TRANSACTION: {
1865 data.enforceInterface(IActivityManager.descriptor);
1866 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001867 boolean orStopping = data.readInt() != 0;
1868 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001869 reply.writeNoException();
1870 reply.writeInt(result ? 1 : 0);
1871 return true;
1872 }
1873
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001874 case GET_RUNNING_USER_IDS_TRANSACTION: {
1875 data.enforceInterface(IActivityManager.descriptor);
1876 int[] result = getRunningUserIds();
1877 reply.writeNoException();
1878 reply.writeIntArray(result);
1879 return true;
1880 }
1881
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001882 case REMOVE_TASK_TRANSACTION:
1883 {
1884 data.enforceInterface(IActivityManager.descriptor);
1885 int taskId = data.readInt();
1886 int fl = data.readInt();
1887 boolean result = removeTask(taskId, fl);
1888 reply.writeNoException();
1889 reply.writeInt(result ? 1 : 0);
1890 return true;
1891 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001892
Jeff Sharkeya4620792011-05-20 15:29:23 -07001893 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1894 data.enforceInterface(IActivityManager.descriptor);
1895 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1896 data.readStrongBinder());
1897 registerProcessObserver(observer);
1898 return true;
1899 }
1900
1901 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1902 data.enforceInterface(IActivityManager.descriptor);
1903 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1904 data.readStrongBinder());
1905 unregisterProcessObserver(observer);
1906 return true;
1907 }
1908
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001909 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1910 {
1911 data.enforceInterface(IActivityManager.descriptor);
1912 String pkg = data.readString();
1913 boolean ask = getPackageAskScreenCompat(pkg);
1914 reply.writeNoException();
1915 reply.writeInt(ask ? 1 : 0);
1916 return true;
1917 }
1918
1919 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1920 {
1921 data.enforceInterface(IActivityManager.descriptor);
1922 String pkg = data.readString();
1923 boolean ask = data.readInt() != 0;
1924 setPackageAskScreenCompat(pkg, ask);
1925 reply.writeNoException();
1926 return true;
1927 }
1928
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001929 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1930 data.enforceInterface(IActivityManager.descriptor);
1931 IIntentSender r = IIntentSender.Stub.asInterface(
1932 data.readStrongBinder());
1933 boolean res = isIntentSenderTargetedToPackage(r);
1934 reply.writeNoException();
1935 reply.writeInt(res ? 1 : 0);
1936 return true;
1937 }
1938
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001939 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1940 data.enforceInterface(IActivityManager.descriptor);
1941 IIntentSender r = IIntentSender.Stub.asInterface(
1942 data.readStrongBinder());
1943 boolean res = isIntentSenderAnActivity(r);
1944 reply.writeNoException();
1945 reply.writeInt(res ? 1 : 0);
1946 return true;
1947 }
1948
Dianne Hackborn81038902012-11-26 17:04:09 -08001949 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1950 data.enforceInterface(IActivityManager.descriptor);
1951 IIntentSender r = IIntentSender.Stub.asInterface(
1952 data.readStrongBinder());
1953 Intent intent = getIntentForIntentSender(r);
1954 reply.writeNoException();
1955 if (intent != null) {
1956 reply.writeInt(1);
1957 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1958 } else {
1959 reply.writeInt(0);
1960 }
1961 return true;
1962 }
1963
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001964 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1965 data.enforceInterface(IActivityManager.descriptor);
1966 IIntentSender r = IIntentSender.Stub.asInterface(
1967 data.readStrongBinder());
1968 String prefix = data.readString();
1969 String tag = getTagForIntentSender(r, prefix);
1970 reply.writeNoException();
1971 reply.writeString(tag);
1972 return true;
1973 }
1974
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001975 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1976 data.enforceInterface(IActivityManager.descriptor);
1977 Configuration config = Configuration.CREATOR.createFromParcel(data);
1978 updatePersistentConfiguration(config);
1979 reply.writeNoException();
1980 return true;
1981 }
1982
Dianne Hackbornb437e092011-08-05 17:50:29 -07001983 case GET_PROCESS_PSS_TRANSACTION: {
1984 data.enforceInterface(IActivityManager.descriptor);
1985 int[] pids = data.createIntArray();
1986 long[] pss = getProcessPss(pids);
1987 reply.writeNoException();
1988 reply.writeLongArray(pss);
1989 return true;
1990 }
1991
Dianne Hackborn661cd522011-08-22 00:26:20 -07001992 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1993 data.enforceInterface(IActivityManager.descriptor);
1994 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1995 boolean always = data.readInt() != 0;
1996 showBootMessage(msg, always);
1997 reply.writeNoException();
1998 return true;
1999 }
2000
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002001 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002002 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002003 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002004 reply.writeNoException();
2005 return true;
2006 }
2007
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002008 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002009 data.enforceInterface(IActivityManager.descriptor);
2010 IBinder token = data.readStrongBinder();
2011 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002012 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002013 reply.writeNoException();
2014 reply.writeInt(res ? 1 : 0);
2015 return true;
2016 }
2017
2018 case NAVIGATE_UP_TO_TRANSACTION: {
2019 data.enforceInterface(IActivityManager.descriptor);
2020 IBinder token = data.readStrongBinder();
2021 Intent target = Intent.CREATOR.createFromParcel(data);
2022 int resultCode = data.readInt();
2023 Intent resultData = null;
2024 if (data.readInt() != 0) {
2025 resultData = Intent.CREATOR.createFromParcel(data);
2026 }
2027 boolean res = navigateUpTo(token, target, resultCode, resultData);
2028 reply.writeNoException();
2029 reply.writeInt(res ? 1 : 0);
2030 return true;
2031 }
2032
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002033 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2034 data.enforceInterface(IActivityManager.descriptor);
2035 IBinder token = data.readStrongBinder();
2036 int res = getLaunchedFromUid(token);
2037 reply.writeNoException();
2038 reply.writeInt(res);
2039 return true;
2040 }
2041
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002042 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2043 data.enforceInterface(IActivityManager.descriptor);
2044 IBinder token = data.readStrongBinder();
2045 String res = getLaunchedFromPackage(token);
2046 reply.writeNoException();
2047 reply.writeString(res);
2048 return true;
2049 }
2050
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002051 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2052 data.enforceInterface(IActivityManager.descriptor);
2053 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2054 data.readStrongBinder());
2055 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002056 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002057 return true;
2058 }
2059
2060 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2061 data.enforceInterface(IActivityManager.descriptor);
2062 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2063 data.readStrongBinder());
2064 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002065 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002066 return true;
2067 }
2068
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002069 case REQUEST_BUG_REPORT_TRANSACTION: {
2070 data.enforceInterface(IActivityManager.descriptor);
2071 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002072 reply.writeNoException();
2073 return true;
2074 }
2075
2076 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2077 data.enforceInterface(IActivityManager.descriptor);
2078 int pid = data.readInt();
2079 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002080 String reason = data.readString();
2081 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002082 reply.writeNoException();
2083 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002084 return true;
2085 }
2086
Adam Skorydfc7fd72013-08-05 19:23:41 -07002087 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002088 data.enforceInterface(IActivityManager.descriptor);
2089 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002090 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002091 reply.writeNoException();
2092 reply.writeBundle(res);
2093 return true;
2094 }
2095
Adam Skorydfc7fd72013-08-05 19:23:41 -07002096 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002097 data.enforceInterface(IActivityManager.descriptor);
2098 IBinder token = data.readStrongBinder();
2099 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002100 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002101 reply.writeNoException();
2102 return true;
2103 }
2104
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002105 case KILL_UID_TRANSACTION: {
2106 data.enforceInterface(IActivityManager.descriptor);
2107 int uid = data.readInt();
2108 String reason = data.readString();
2109 killUid(uid, reason);
2110 reply.writeNoException();
2111 return true;
2112 }
2113
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002114 case HANG_TRANSACTION: {
2115 data.enforceInterface(IActivityManager.descriptor);
2116 IBinder who = data.readStrongBinder();
2117 boolean allowRestart = data.readInt() != 0;
2118 hang(who, allowRestart);
2119 reply.writeNoException();
2120 return true;
2121 }
2122
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002123 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2124 data.enforceInterface(IActivityManager.descriptor);
2125 IBinder token = data.readStrongBinder();
2126 reportActivityFullyDrawn(token);
2127 reply.writeNoException();
2128 return true;
2129 }
2130
Craig Mautner5eda9b32013-07-02 11:58:16 -07002131 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2132 data.enforceInterface(IActivityManager.descriptor);
2133 IBinder token = data.readStrongBinder();
2134 notifyActivityDrawn(token);
2135 reply.writeNoException();
2136 return true;
2137 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002138
2139 case RESTART_TRANSACTION: {
2140 data.enforceInterface(IActivityManager.descriptor);
2141 restart();
2142 reply.writeNoException();
2143 return true;
2144 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002145
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002146 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2147 data.enforceInterface(IActivityManager.descriptor);
2148 performIdleMaintenance();
2149 reply.writeNoException();
2150 return true;
2151 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002152
2153 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2154 data.enforceInterface(IActivityManager.descriptor);
2155 IBinder parentActivityToken = data.readStrongBinder();
2156 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002157 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002158 IActivityContainer activityContainer =
2159 createActivityContainer(parentActivityToken, callback);
2160 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002161 if (activityContainer != null) {
2162 reply.writeInt(1);
2163 reply.writeStrongBinder(activityContainer.asBinder());
2164 } else {
2165 reply.writeInt(0);
2166 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002167 return true;
2168 }
2169
Craig Mautner95da1082014-02-24 17:54:35 -08002170 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2171 data.enforceInterface(IActivityManager.descriptor);
2172 IActivityContainer activityContainer =
2173 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2174 deleteActivityContainer(activityContainer);
2175 reply.writeNoException();
2176 return true;
2177 }
2178
Craig Mautnere0a38842013-12-16 16:14:02 -08002179 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2180 data.enforceInterface(IActivityManager.descriptor);
2181 IBinder activityToken = data.readStrongBinder();
2182 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2183 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002184 if (activityContainer != null) {
2185 reply.writeInt(1);
2186 reply.writeStrongBinder(activityContainer.asBinder());
2187 } else {
2188 reply.writeInt(0);
2189 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002190 return true;
2191 }
2192
Craig Mautner4a1cb222013-12-04 16:14:06 -08002193 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2194 data.enforceInterface(IActivityManager.descriptor);
2195 IBinder homeActivityToken = getHomeActivityToken();
2196 reply.writeNoException();
2197 reply.writeStrongBinder(homeActivityToken);
2198 return true;
2199 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002200
2201 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2202 data.enforceInterface(IActivityManager.descriptor);
2203 final int taskId = data.readInt();
2204 startLockTaskMode(taskId);
2205 reply.writeNoException();
2206 return true;
2207 }
2208
2209 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2210 data.enforceInterface(IActivityManager.descriptor);
2211 IBinder token = data.readStrongBinder();
2212 startLockTaskMode(token);
2213 reply.writeNoException();
2214 return true;
2215 }
2216
Craig Mautnerd61dc202014-07-07 11:09:11 -07002217 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002218 data.enforceInterface(IActivityManager.descriptor);
2219 startLockTaskModeOnCurrent();
2220 reply.writeNoException();
2221 return true;
2222 }
2223
Craig Mautneraea74a52014-03-08 14:23:10 -08002224 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2225 data.enforceInterface(IActivityManager.descriptor);
2226 stopLockTaskMode();
2227 reply.writeNoException();
2228 return true;
2229 }
2230
Craig Mautnerd61dc202014-07-07 11:09:11 -07002231 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002232 data.enforceInterface(IActivityManager.descriptor);
2233 stopLockTaskModeOnCurrent();
2234 reply.writeNoException();
2235 return true;
2236 }
2237
Craig Mautneraea74a52014-03-08 14:23:10 -08002238 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2239 data.enforceInterface(IActivityManager.descriptor);
2240 final boolean isInLockTaskMode = isInLockTaskMode();
2241 reply.writeNoException();
2242 reply.writeInt(isInLockTaskMode ? 1 : 0);
2243 return true;
2244 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002245
Winson Chunga449dc02014-05-16 11:15:04 -07002246 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002247 data.enforceInterface(IActivityManager.descriptor);
2248 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002249 ActivityManager.TaskDescription values =
2250 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2251 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002252 reply.writeNoException();
2253 return true;
2254 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002255
Craig Mautner648f69b2014-09-18 14:16:26 -07002256 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2257 data.enforceInterface(IActivityManager.descriptor);
2258 String filename = data.readString();
2259 Bitmap icon = getTaskDescriptionIcon(filename);
2260 reply.writeNoException();
2261 if (icon == null) {
2262 reply.writeInt(0);
2263 } else {
2264 reply.writeInt(1);
2265 icon.writeToParcel(reply, 0);
2266 }
2267 return true;
2268 }
2269
Jose Lima4b6c6692014-08-12 17:41:12 -07002270 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002271 data.enforceInterface(IActivityManager.descriptor);
2272 IBinder token = data.readStrongBinder();
2273 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002274 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002275 reply.writeNoException();
2276 reply.writeInt(success ? 1 : 0);
2277 return true;
2278 }
2279
Jose Lima4b6c6692014-08-12 17:41:12 -07002280 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002281 data.enforceInterface(IActivityManager.descriptor);
2282 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002283 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002284 reply.writeNoException();
2285 reply.writeInt(enabled ? 1 : 0);
2286 return true;
2287 }
2288
Jose Lima4b6c6692014-08-12 17:41:12 -07002289 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002290 data.enforceInterface(IActivityManager.descriptor);
2291 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002292 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002293 reply.writeNoException();
2294 return true;
2295 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002296
2297 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2298 data.enforceInterface(IActivityManager.descriptor);
2299 IBinder token = data.readStrongBinder();
2300 notifyLaunchTaskBehindComplete(token);
2301 reply.writeNoException();
2302 return true;
2303 }
Craig Mautner8746a472014-07-24 15:12:54 -07002304
2305 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2306 data.enforceInterface(IActivityManager.descriptor);
2307 IBinder token = data.readStrongBinder();
2308 notifyEnterAnimationComplete(token);
2309 reply.writeNoException();
2310 return true;
2311 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002312
2313 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2314 data.enforceInterface(IActivityManager.descriptor);
2315 bootAnimationComplete();
2316 reply.writeNoException();
2317 return true;
2318 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002319 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002320
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002321 return super.onTransact(code, data, reply, flags);
2322 }
2323
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002324 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002325 return this;
2326 }
2327
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002328 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2329 protected IActivityManager create() {
2330 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002331 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002332 Log.v("ActivityManager", "default service binder = " + b);
2333 }
2334 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002335 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002336 Log.v("ActivityManager", "default service = " + am);
2337 }
2338 return am;
2339 }
2340 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002341}
2342
2343class ActivityManagerProxy implements IActivityManager
2344{
2345 public ActivityManagerProxy(IBinder remote)
2346 {
2347 mRemote = remote;
2348 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002349
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002350 public IBinder asBinder()
2351 {
2352 return mRemote;
2353 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002354
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002355 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002356 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002357 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002358 Parcel data = Parcel.obtain();
2359 Parcel reply = Parcel.obtain();
2360 data.writeInterfaceToken(IActivityManager.descriptor);
2361 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002362 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002363 intent.writeToParcel(data, 0);
2364 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002365 data.writeStrongBinder(resultTo);
2366 data.writeString(resultWho);
2367 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002368 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002369 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002370 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002371 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002372 } else {
2373 data.writeInt(0);
2374 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002375 if (options != null) {
2376 data.writeInt(1);
2377 options.writeToParcel(data, 0);
2378 } else {
2379 data.writeInt(0);
2380 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002381 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2382 reply.readException();
2383 int result = reply.readInt();
2384 reply.recycle();
2385 data.recycle();
2386 return result;
2387 }
Amith Yamasani82644082012-08-03 13:09:11 -07002388
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002389 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002390 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002391 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2392 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002393 Parcel data = Parcel.obtain();
2394 Parcel reply = Parcel.obtain();
2395 data.writeInterfaceToken(IActivityManager.descriptor);
2396 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002397 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002398 intent.writeToParcel(data, 0);
2399 data.writeString(resolvedType);
2400 data.writeStrongBinder(resultTo);
2401 data.writeString(resultWho);
2402 data.writeInt(requestCode);
2403 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002404 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002405 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002406 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002407 } else {
2408 data.writeInt(0);
2409 }
2410 if (options != null) {
2411 data.writeInt(1);
2412 options.writeToParcel(data, 0);
2413 } else {
2414 data.writeInt(0);
2415 }
2416 data.writeInt(userId);
2417 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2418 reply.readException();
2419 int result = reply.readInt();
2420 reply.recycle();
2421 data.recycle();
2422 return result;
2423 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002424 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2425 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002426 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002427 Parcel data = Parcel.obtain();
2428 Parcel reply = Parcel.obtain();
2429 data.writeInterfaceToken(IActivityManager.descriptor);
2430 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2431 data.writeString(callingPackage);
2432 intent.writeToParcel(data, 0);
2433 data.writeString(resolvedType);
2434 data.writeStrongBinder(resultTo);
2435 data.writeString(resultWho);
2436 data.writeInt(requestCode);
2437 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002438 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002439 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002440 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002441 } else {
2442 data.writeInt(0);
2443 }
2444 if (options != null) {
2445 data.writeInt(1);
2446 options.writeToParcel(data, 0);
2447 } else {
2448 data.writeInt(0);
2449 }
2450 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2451 reply.readException();
2452 int result = reply.readInt();
2453 reply.recycle();
2454 data.recycle();
2455 return result;
2456 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002457 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2458 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002459 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2460 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002461 Parcel data = Parcel.obtain();
2462 Parcel reply = Parcel.obtain();
2463 data.writeInterfaceToken(IActivityManager.descriptor);
2464 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002465 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002466 intent.writeToParcel(data, 0);
2467 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002468 data.writeStrongBinder(resultTo);
2469 data.writeString(resultWho);
2470 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002471 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002472 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002473 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002474 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002475 } else {
2476 data.writeInt(0);
2477 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002478 if (options != null) {
2479 data.writeInt(1);
2480 options.writeToParcel(data, 0);
2481 } else {
2482 data.writeInt(0);
2483 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002484 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002485 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2486 reply.readException();
2487 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2488 reply.recycle();
2489 data.recycle();
2490 return result;
2491 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002492 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2493 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002494 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002495 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002496 Parcel data = Parcel.obtain();
2497 Parcel reply = Parcel.obtain();
2498 data.writeInterfaceToken(IActivityManager.descriptor);
2499 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002500 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002501 intent.writeToParcel(data, 0);
2502 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002503 data.writeStrongBinder(resultTo);
2504 data.writeString(resultWho);
2505 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002506 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002507 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002508 if (options != null) {
2509 data.writeInt(1);
2510 options.writeToParcel(data, 0);
2511 } else {
2512 data.writeInt(0);
2513 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002514 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002515 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2516 reply.readException();
2517 int result = reply.readInt();
2518 reply.recycle();
2519 data.recycle();
2520 return result;
2521 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002522 public int startActivityIntentSender(IApplicationThread caller,
2523 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002524 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002525 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002526 Parcel data = Parcel.obtain();
2527 Parcel reply = Parcel.obtain();
2528 data.writeInterfaceToken(IActivityManager.descriptor);
2529 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2530 intent.writeToParcel(data, 0);
2531 if (fillInIntent != null) {
2532 data.writeInt(1);
2533 fillInIntent.writeToParcel(data, 0);
2534 } else {
2535 data.writeInt(0);
2536 }
2537 data.writeString(resolvedType);
2538 data.writeStrongBinder(resultTo);
2539 data.writeString(resultWho);
2540 data.writeInt(requestCode);
2541 data.writeInt(flagsMask);
2542 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002543 if (options != null) {
2544 data.writeInt(1);
2545 options.writeToParcel(data, 0);
2546 } else {
2547 data.writeInt(0);
2548 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002549 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002550 reply.readException();
2551 int result = reply.readInt();
2552 reply.recycle();
2553 data.recycle();
2554 return result;
2555 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002556 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2557 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002558 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2559 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002560 Parcel data = Parcel.obtain();
2561 Parcel reply = Parcel.obtain();
2562 data.writeInterfaceToken(IActivityManager.descriptor);
2563 data.writeString(callingPackage);
2564 data.writeInt(callingPid);
2565 data.writeInt(callingUid);
2566 intent.writeToParcel(data, 0);
2567 data.writeString(resolvedType);
2568 data.writeStrongBinder(session.asBinder());
2569 data.writeStrongBinder(interactor.asBinder());
2570 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002571 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002572 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002573 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002574 } else {
2575 data.writeInt(0);
2576 }
2577 if (options != null) {
2578 data.writeInt(1);
2579 options.writeToParcel(data, 0);
2580 } else {
2581 data.writeInt(0);
2582 }
2583 data.writeInt(userId);
2584 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2585 reply.readException();
2586 int result = reply.readInt();
2587 reply.recycle();
2588 data.recycle();
2589 return result;
2590 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002591 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002592 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002593 Parcel data = Parcel.obtain();
2594 Parcel reply = Parcel.obtain();
2595 data.writeInterfaceToken(IActivityManager.descriptor);
2596 data.writeStrongBinder(callingActivity);
2597 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002598 if (options != null) {
2599 data.writeInt(1);
2600 options.writeToParcel(data, 0);
2601 } else {
2602 data.writeInt(0);
2603 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002604 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2605 reply.readException();
2606 int result = reply.readInt();
2607 reply.recycle();
2608 data.recycle();
2609 return result != 0;
2610 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002611 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2612 Parcel data = Parcel.obtain();
2613 Parcel reply = Parcel.obtain();
2614 data.writeInterfaceToken(IActivityManager.descriptor);
2615 data.writeInt(taskId);
2616 if (options == null) {
2617 data.writeInt(0);
2618 } else {
2619 data.writeInt(1);
2620 options.writeToParcel(data, 0);
2621 }
2622 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2623 reply.readException();
2624 int result = reply.readInt();
2625 reply.recycle();
2626 data.recycle();
2627 return result;
2628 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002629 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002630 throws RemoteException {
2631 Parcel data = Parcel.obtain();
2632 Parcel reply = Parcel.obtain();
2633 data.writeInterfaceToken(IActivityManager.descriptor);
2634 data.writeStrongBinder(token);
2635 data.writeInt(resultCode);
2636 if (resultData != null) {
2637 data.writeInt(1);
2638 resultData.writeToParcel(data, 0);
2639 } else {
2640 data.writeInt(0);
2641 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002642 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002643 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2644 reply.readException();
2645 boolean res = reply.readInt() != 0;
2646 data.recycle();
2647 reply.recycle();
2648 return res;
2649 }
2650 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2651 {
2652 Parcel data = Parcel.obtain();
2653 Parcel reply = Parcel.obtain();
2654 data.writeInterfaceToken(IActivityManager.descriptor);
2655 data.writeStrongBinder(token);
2656 data.writeString(resultWho);
2657 data.writeInt(requestCode);
2658 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2659 reply.readException();
2660 data.recycle();
2661 reply.recycle();
2662 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002663 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2664 Parcel data = Parcel.obtain();
2665 Parcel reply = Parcel.obtain();
2666 data.writeInterfaceToken(IActivityManager.descriptor);
2667 data.writeStrongBinder(token);
2668 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2669 reply.readException();
2670 boolean res = reply.readInt() != 0;
2671 data.recycle();
2672 reply.recycle();
2673 return res;
2674 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002675 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2676 Parcel data = Parcel.obtain();
2677 Parcel reply = Parcel.obtain();
2678 data.writeInterfaceToken(IActivityManager.descriptor);
2679 data.writeStrongBinder(session.asBinder());
2680 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2681 reply.readException();
2682 data.recycle();
2683 reply.recycle();
2684 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002685 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2686 Parcel data = Parcel.obtain();
2687 Parcel reply = Parcel.obtain();
2688 data.writeInterfaceToken(IActivityManager.descriptor);
2689 data.writeStrongBinder(token);
2690 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2691 reply.readException();
2692 boolean res = reply.readInt() != 0;
2693 data.recycle();
2694 reply.recycle();
2695 return res;
2696 }
2697 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2698 Parcel data = Parcel.obtain();
2699 Parcel reply = Parcel.obtain();
2700 data.writeInterfaceToken(IActivityManager.descriptor);
2701 data.writeStrongBinder(app.asBinder());
2702 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2703 reply.readException();
2704 data.recycle();
2705 reply.recycle();
2706 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002707 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2708 Parcel data = Parcel.obtain();
2709 Parcel reply = Parcel.obtain();
2710 data.writeInterfaceToken(IActivityManager.descriptor);
2711 data.writeStrongBinder(token);
2712 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2713 reply.readException();
2714 boolean res = reply.readInt() != 0;
2715 data.recycle();
2716 reply.recycle();
2717 return res;
2718 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002719 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002720 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002721 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002722 {
2723 Parcel data = Parcel.obtain();
2724 Parcel reply = Parcel.obtain();
2725 data.writeInterfaceToken(IActivityManager.descriptor);
2726 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002727 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002728 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2729 filter.writeToParcel(data, 0);
2730 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002731 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002732 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2733 reply.readException();
2734 Intent intent = null;
2735 int haveIntent = reply.readInt();
2736 if (haveIntent != 0) {
2737 intent = Intent.CREATOR.createFromParcel(reply);
2738 }
2739 reply.recycle();
2740 data.recycle();
2741 return intent;
2742 }
2743 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2744 {
2745 Parcel data = Parcel.obtain();
2746 Parcel reply = Parcel.obtain();
2747 data.writeInterfaceToken(IActivityManager.descriptor);
2748 data.writeStrongBinder(receiver.asBinder());
2749 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2750 reply.readException();
2751 data.recycle();
2752 reply.recycle();
2753 }
2754 public int broadcastIntent(IApplicationThread caller,
2755 Intent intent, String resolvedType, IIntentReceiver resultTo,
2756 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002757 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002758 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002759 {
2760 Parcel data = Parcel.obtain();
2761 Parcel reply = Parcel.obtain();
2762 data.writeInterfaceToken(IActivityManager.descriptor);
2763 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2764 intent.writeToParcel(data, 0);
2765 data.writeString(resolvedType);
2766 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2767 data.writeInt(resultCode);
2768 data.writeString(resultData);
2769 data.writeBundle(map);
2770 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002771 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002772 data.writeInt(serialized ? 1 : 0);
2773 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002774 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002775 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2776 reply.readException();
2777 int res = reply.readInt();
2778 reply.recycle();
2779 data.recycle();
2780 return res;
2781 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002782 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2783 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002784 {
2785 Parcel data = Parcel.obtain();
2786 Parcel reply = Parcel.obtain();
2787 data.writeInterfaceToken(IActivityManager.descriptor);
2788 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2789 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002790 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002791 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2792 reply.readException();
2793 data.recycle();
2794 reply.recycle();
2795 }
2796 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2797 {
2798 Parcel data = Parcel.obtain();
2799 Parcel reply = Parcel.obtain();
2800 data.writeInterfaceToken(IActivityManager.descriptor);
2801 data.writeStrongBinder(who);
2802 data.writeInt(resultCode);
2803 data.writeString(resultData);
2804 data.writeBundle(map);
2805 data.writeInt(abortBroadcast ? 1 : 0);
2806 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2807 reply.readException();
2808 data.recycle();
2809 reply.recycle();
2810 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002811 public void attachApplication(IApplicationThread app) throws RemoteException
2812 {
2813 Parcel data = Parcel.obtain();
2814 Parcel reply = Parcel.obtain();
2815 data.writeInterfaceToken(IActivityManager.descriptor);
2816 data.writeStrongBinder(app.asBinder());
2817 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2818 reply.readException();
2819 data.recycle();
2820 reply.recycle();
2821 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002822 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2823 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002824 {
2825 Parcel data = Parcel.obtain();
2826 Parcel reply = Parcel.obtain();
2827 data.writeInterfaceToken(IActivityManager.descriptor);
2828 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002829 if (config != null) {
2830 data.writeInt(1);
2831 config.writeToParcel(data, 0);
2832 } else {
2833 data.writeInt(0);
2834 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002835 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002836 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2837 reply.readException();
2838 data.recycle();
2839 reply.recycle();
2840 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002841 public void activityResumed(IBinder token) throws RemoteException
2842 {
2843 Parcel data = Parcel.obtain();
2844 Parcel reply = Parcel.obtain();
2845 data.writeInterfaceToken(IActivityManager.descriptor);
2846 data.writeStrongBinder(token);
2847 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2848 reply.readException();
2849 data.recycle();
2850 reply.recycle();
2851 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07002852 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002853 {
2854 Parcel data = Parcel.obtain();
2855 Parcel reply = Parcel.obtain();
2856 data.writeInterfaceToken(IActivityManager.descriptor);
2857 data.writeStrongBinder(token);
2858 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2859 reply.readException();
2860 data.recycle();
2861 reply.recycle();
2862 }
2863 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002864 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002865 {
2866 Parcel data = Parcel.obtain();
2867 Parcel reply = Parcel.obtain();
2868 data.writeInterfaceToken(IActivityManager.descriptor);
2869 data.writeStrongBinder(token);
2870 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002871 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002872 TextUtils.writeToParcel(description, data, 0);
2873 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2874 reply.readException();
2875 data.recycle();
2876 reply.recycle();
2877 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002878 public void activitySlept(IBinder token) throws RemoteException
2879 {
2880 Parcel data = Parcel.obtain();
2881 Parcel reply = Parcel.obtain();
2882 data.writeInterfaceToken(IActivityManager.descriptor);
2883 data.writeStrongBinder(token);
2884 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2885 reply.readException();
2886 data.recycle();
2887 reply.recycle();
2888 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002889 public void activityDestroyed(IBinder token) throws RemoteException
2890 {
2891 Parcel data = Parcel.obtain();
2892 Parcel reply = Parcel.obtain();
2893 data.writeInterfaceToken(IActivityManager.descriptor);
2894 data.writeStrongBinder(token);
2895 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2896 reply.readException();
2897 data.recycle();
2898 reply.recycle();
2899 }
2900 public String getCallingPackage(IBinder token) throws RemoteException
2901 {
2902 Parcel data = Parcel.obtain();
2903 Parcel reply = Parcel.obtain();
2904 data.writeInterfaceToken(IActivityManager.descriptor);
2905 data.writeStrongBinder(token);
2906 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2907 reply.readException();
2908 String res = reply.readString();
2909 data.recycle();
2910 reply.recycle();
2911 return res;
2912 }
2913 public ComponentName getCallingActivity(IBinder token)
2914 throws RemoteException {
2915 Parcel data = Parcel.obtain();
2916 Parcel reply = Parcel.obtain();
2917 data.writeInterfaceToken(IActivityManager.descriptor);
2918 data.writeStrongBinder(token);
2919 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2920 reply.readException();
2921 ComponentName res = ComponentName.readFromParcel(reply);
2922 data.recycle();
2923 reply.recycle();
2924 return res;
2925 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002926 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07002927 Parcel data = Parcel.obtain();
2928 Parcel reply = Parcel.obtain();
2929 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002930 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07002931 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2932 reply.readException();
2933 ArrayList<IAppTask> list = null;
2934 int N = reply.readInt();
2935 if (N >= 0) {
2936 list = new ArrayList<IAppTask>();
2937 while (N > 0) {
2938 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2939 list.add(task);
2940 N--;
2941 }
2942 }
2943 data.recycle();
2944 reply.recycle();
2945 return list;
2946 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07002947 public int addAppTask(IBinder activityToken, Intent intent,
2948 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
2949 Parcel data = Parcel.obtain();
2950 Parcel reply = Parcel.obtain();
2951 data.writeInterfaceToken(IActivityManager.descriptor);
2952 data.writeStrongBinder(activityToken);
2953 intent.writeToParcel(data, 0);
2954 description.writeToParcel(data, 0);
2955 thumbnail.writeToParcel(data, 0);
2956 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
2957 reply.readException();
2958 int res = reply.readInt();
2959 data.recycle();
2960 reply.recycle();
2961 return res;
2962 }
2963 public Point getAppTaskThumbnailSize() throws RemoteException {
2964 Parcel data = Parcel.obtain();
2965 Parcel reply = Parcel.obtain();
2966 data.writeInterfaceToken(IActivityManager.descriptor);
2967 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
2968 reply.readException();
2969 Point size = Point.CREATOR.createFromParcel(reply);
2970 data.recycle();
2971 reply.recycle();
2972 return size;
2973 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002974 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002975 Parcel data = Parcel.obtain();
2976 Parcel reply = Parcel.obtain();
2977 data.writeInterfaceToken(IActivityManager.descriptor);
2978 data.writeInt(maxNum);
2979 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002980 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2981 reply.readException();
2982 ArrayList list = null;
2983 int N = reply.readInt();
2984 if (N >= 0) {
2985 list = new ArrayList();
2986 while (N > 0) {
2987 ActivityManager.RunningTaskInfo info =
2988 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002989 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002990 list.add(info);
2991 N--;
2992 }
2993 }
2994 data.recycle();
2995 reply.recycle();
2996 return list;
2997 }
2998 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002999 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003000 Parcel data = Parcel.obtain();
3001 Parcel reply = Parcel.obtain();
3002 data.writeInterfaceToken(IActivityManager.descriptor);
3003 data.writeInt(maxNum);
3004 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003005 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003006 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3007 reply.readException();
3008 ArrayList<ActivityManager.RecentTaskInfo> list
3009 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3010 data.recycle();
3011 reply.recycle();
3012 return list;
3013 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003014 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003015 Parcel data = Parcel.obtain();
3016 Parcel reply = Parcel.obtain();
3017 data.writeInterfaceToken(IActivityManager.descriptor);
3018 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003019 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003020 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003021 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003022 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003023 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003024 }
3025 data.recycle();
3026 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003027 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003028 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003029 public List getServices(int maxNum, int flags) throws RemoteException {
3030 Parcel data = Parcel.obtain();
3031 Parcel reply = Parcel.obtain();
3032 data.writeInterfaceToken(IActivityManager.descriptor);
3033 data.writeInt(maxNum);
3034 data.writeInt(flags);
3035 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3036 reply.readException();
3037 ArrayList list = null;
3038 int N = reply.readInt();
3039 if (N >= 0) {
3040 list = new ArrayList();
3041 while (N > 0) {
3042 ActivityManager.RunningServiceInfo info =
3043 ActivityManager.RunningServiceInfo.CREATOR
3044 .createFromParcel(reply);
3045 list.add(info);
3046 N--;
3047 }
3048 }
3049 data.recycle();
3050 reply.recycle();
3051 return list;
3052 }
3053 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3054 throws RemoteException {
3055 Parcel data = Parcel.obtain();
3056 Parcel reply = Parcel.obtain();
3057 data.writeInterfaceToken(IActivityManager.descriptor);
3058 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3059 reply.readException();
3060 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3061 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3062 data.recycle();
3063 reply.recycle();
3064 return list;
3065 }
3066 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3067 throws RemoteException {
3068 Parcel data = Parcel.obtain();
3069 Parcel reply = Parcel.obtain();
3070 data.writeInterfaceToken(IActivityManager.descriptor);
3071 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3072 reply.readException();
3073 ArrayList<ActivityManager.RunningAppProcessInfo> list
3074 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3075 data.recycle();
3076 reply.recycle();
3077 return list;
3078 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003079 public List<ApplicationInfo> getRunningExternalApplications()
3080 throws RemoteException {
3081 Parcel data = Parcel.obtain();
3082 Parcel reply = Parcel.obtain();
3083 data.writeInterfaceToken(IActivityManager.descriptor);
3084 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3085 reply.readException();
3086 ArrayList<ApplicationInfo> list
3087 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3088 data.recycle();
3089 reply.recycle();
3090 return list;
3091 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003092 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003093 {
3094 Parcel data = Parcel.obtain();
3095 Parcel reply = Parcel.obtain();
3096 data.writeInterfaceToken(IActivityManager.descriptor);
3097 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003098 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003099 if (options != null) {
3100 data.writeInt(1);
3101 options.writeToParcel(data, 0);
3102 } else {
3103 data.writeInt(0);
3104 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003105 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3106 reply.readException();
3107 data.recycle();
3108 reply.recycle();
3109 }
3110 public void moveTaskToBack(int task) throws RemoteException
3111 {
3112 Parcel data = Parcel.obtain();
3113 Parcel reply = Parcel.obtain();
3114 data.writeInterfaceToken(IActivityManager.descriptor);
3115 data.writeInt(task);
3116 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3117 reply.readException();
3118 data.recycle();
3119 reply.recycle();
3120 }
3121 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3122 throws RemoteException {
3123 Parcel data = Parcel.obtain();
3124 Parcel reply = Parcel.obtain();
3125 data.writeInterfaceToken(IActivityManager.descriptor);
3126 data.writeStrongBinder(token);
3127 data.writeInt(nonRoot ? 1 : 0);
3128 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3129 reply.readException();
3130 boolean res = reply.readInt() != 0;
3131 data.recycle();
3132 reply.recycle();
3133 return res;
3134 }
3135 public void moveTaskBackwards(int task) throws RemoteException
3136 {
3137 Parcel data = Parcel.obtain();
3138 Parcel reply = Parcel.obtain();
3139 data.writeInterfaceToken(IActivityManager.descriptor);
3140 data.writeInt(task);
3141 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3142 reply.readException();
3143 data.recycle();
3144 reply.recycle();
3145 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003146 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003147 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3148 {
3149 Parcel data = Parcel.obtain();
3150 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003151 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003152 data.writeInt(taskId);
3153 data.writeInt(stackId);
3154 data.writeInt(toTop ? 1 : 0);
3155 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3156 reply.readException();
3157 data.recycle();
3158 reply.recycle();
3159 }
3160 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003161 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003162 {
3163 Parcel data = Parcel.obtain();
3164 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003165 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003166 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003167 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003168 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003169 reply.readException();
3170 data.recycle();
3171 reply.recycle();
3172 }
Craig Mautner967212c2013-04-13 21:10:58 -07003173 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003174 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003175 {
3176 Parcel data = Parcel.obtain();
3177 Parcel reply = Parcel.obtain();
3178 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003179 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003180 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003181 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003182 data.recycle();
3183 reply.recycle();
3184 return list;
3185 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003186 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003187 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003188 {
3189 Parcel data = Parcel.obtain();
3190 Parcel reply = Parcel.obtain();
3191 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003192 data.writeInt(stackId);
3193 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003194 reply.readException();
3195 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003196 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003197 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003198 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003199 }
3200 data.recycle();
3201 reply.recycle();
3202 return info;
3203 }
3204 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003205 public boolean isInHomeStack(int taskId) throws RemoteException {
3206 Parcel data = Parcel.obtain();
3207 Parcel reply = Parcel.obtain();
3208 data.writeInterfaceToken(IActivityManager.descriptor);
3209 data.writeInt(taskId);
3210 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3211 reply.readException();
3212 boolean isInHomeStack = reply.readInt() > 0;
3213 data.recycle();
3214 reply.recycle();
3215 return isInHomeStack;
3216 }
3217 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003218 public void setFocusedStack(int stackId) throws RemoteException
3219 {
3220 Parcel data = Parcel.obtain();
3221 Parcel reply = Parcel.obtain();
3222 data.writeInterfaceToken(IActivityManager.descriptor);
3223 data.writeInt(stackId);
3224 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3225 reply.readException();
3226 data.recycle();
3227 reply.recycle();
3228 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003229 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3230 {
3231 Parcel data = Parcel.obtain();
3232 Parcel reply = Parcel.obtain();
3233 data.writeInterfaceToken(IActivityManager.descriptor);
3234 data.writeStrongBinder(token);
3235 data.writeInt(onlyRoot ? 1 : 0);
3236 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3237 reply.readException();
3238 int res = reply.readInt();
3239 data.recycle();
3240 reply.recycle();
3241 return res;
3242 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003243 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003244 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003245 Parcel data = Parcel.obtain();
3246 Parcel reply = Parcel.obtain();
3247 data.writeInterfaceToken(IActivityManager.descriptor);
3248 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3249 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003250 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003251 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003252 mRemote.transact(GET_CONTENT_PROVIDER_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 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003263 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3264 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003265 Parcel data = Parcel.obtain();
3266 Parcel reply = Parcel.obtain();
3267 data.writeInterfaceToken(IActivityManager.descriptor);
3268 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003269 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003270 data.writeStrongBinder(token);
3271 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3272 reply.readException();
3273 int res = reply.readInt();
3274 ContentProviderHolder cph = null;
3275 if (res != 0) {
3276 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3277 }
3278 data.recycle();
3279 reply.recycle();
3280 return cph;
3281 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003282 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003283 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003284 {
3285 Parcel data = Parcel.obtain();
3286 Parcel reply = Parcel.obtain();
3287 data.writeInterfaceToken(IActivityManager.descriptor);
3288 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3289 data.writeTypedList(providers);
3290 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3291 reply.readException();
3292 data.recycle();
3293 reply.recycle();
3294 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003295 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3296 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003297 Parcel data = Parcel.obtain();
3298 Parcel reply = Parcel.obtain();
3299 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003300 data.writeStrongBinder(connection);
3301 data.writeInt(stable);
3302 data.writeInt(unstable);
3303 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3304 reply.readException();
3305 boolean res = reply.readInt() != 0;
3306 data.recycle();
3307 reply.recycle();
3308 return res;
3309 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003310
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003311 public void unstableProviderDied(IBinder connection) throws RemoteException {
3312 Parcel data = Parcel.obtain();
3313 Parcel reply = Parcel.obtain();
3314 data.writeInterfaceToken(IActivityManager.descriptor);
3315 data.writeStrongBinder(connection);
3316 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3317 reply.readException();
3318 data.recycle();
3319 reply.recycle();
3320 }
3321
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003322 @Override
3323 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3324 Parcel data = Parcel.obtain();
3325 Parcel reply = Parcel.obtain();
3326 data.writeInterfaceToken(IActivityManager.descriptor);
3327 data.writeStrongBinder(connection);
3328 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3329 reply.readException();
3330 data.recycle();
3331 reply.recycle();
3332 }
3333
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003334 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3335 Parcel data = Parcel.obtain();
3336 Parcel reply = Parcel.obtain();
3337 data.writeInterfaceToken(IActivityManager.descriptor);
3338 data.writeStrongBinder(connection);
3339 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003340 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3341 reply.readException();
3342 data.recycle();
3343 reply.recycle();
3344 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003345
3346 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3347 Parcel data = Parcel.obtain();
3348 Parcel reply = Parcel.obtain();
3349 data.writeInterfaceToken(IActivityManager.descriptor);
3350 data.writeString(name);
3351 data.writeStrongBinder(token);
3352 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3353 reply.readException();
3354 data.recycle();
3355 reply.recycle();
3356 }
3357
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003358 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3359 throws RemoteException
3360 {
3361 Parcel data = Parcel.obtain();
3362 Parcel reply = Parcel.obtain();
3363 data.writeInterfaceToken(IActivityManager.descriptor);
3364 service.writeToParcel(data, 0);
3365 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3366 reply.readException();
3367 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3368 data.recycle();
3369 reply.recycle();
3370 return res;
3371 }
3372
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003373 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003374 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003375 {
3376 Parcel data = Parcel.obtain();
3377 Parcel reply = Parcel.obtain();
3378 data.writeInterfaceToken(IActivityManager.descriptor);
3379 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3380 service.writeToParcel(data, 0);
3381 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003382 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003383 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3384 reply.readException();
3385 ComponentName res = ComponentName.readFromParcel(reply);
3386 data.recycle();
3387 reply.recycle();
3388 return res;
3389 }
3390 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003391 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003392 {
3393 Parcel data = Parcel.obtain();
3394 Parcel reply = Parcel.obtain();
3395 data.writeInterfaceToken(IActivityManager.descriptor);
3396 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3397 service.writeToParcel(data, 0);
3398 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003399 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003400 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3401 reply.readException();
3402 int res = reply.readInt();
3403 reply.recycle();
3404 data.recycle();
3405 return res;
3406 }
3407 public boolean stopServiceToken(ComponentName className, IBinder token,
3408 int startId) throws RemoteException {
3409 Parcel data = Parcel.obtain();
3410 Parcel reply = Parcel.obtain();
3411 data.writeInterfaceToken(IActivityManager.descriptor);
3412 ComponentName.writeToParcel(className, data);
3413 data.writeStrongBinder(token);
3414 data.writeInt(startId);
3415 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3416 reply.readException();
3417 boolean res = reply.readInt() != 0;
3418 data.recycle();
3419 reply.recycle();
3420 return res;
3421 }
3422 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003423 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003424 Parcel data = Parcel.obtain();
3425 Parcel reply = Parcel.obtain();
3426 data.writeInterfaceToken(IActivityManager.descriptor);
3427 ComponentName.writeToParcel(className, data);
3428 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003429 data.writeInt(id);
3430 if (notification != null) {
3431 data.writeInt(1);
3432 notification.writeToParcel(data, 0);
3433 } else {
3434 data.writeInt(0);
3435 }
3436 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003437 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3438 reply.readException();
3439 data.recycle();
3440 reply.recycle();
3441 }
3442 public int bindService(IApplicationThread caller, IBinder token,
3443 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003444 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003445 Parcel data = Parcel.obtain();
3446 Parcel reply = Parcel.obtain();
3447 data.writeInterfaceToken(IActivityManager.descriptor);
3448 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3449 data.writeStrongBinder(token);
3450 service.writeToParcel(data, 0);
3451 data.writeString(resolvedType);
3452 data.writeStrongBinder(connection.asBinder());
3453 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003454 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003455 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3456 reply.readException();
3457 int res = reply.readInt();
3458 data.recycle();
3459 reply.recycle();
3460 return res;
3461 }
3462 public boolean unbindService(IServiceConnection connection) throws RemoteException
3463 {
3464 Parcel data = Parcel.obtain();
3465 Parcel reply = Parcel.obtain();
3466 data.writeInterfaceToken(IActivityManager.descriptor);
3467 data.writeStrongBinder(connection.asBinder());
3468 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3469 reply.readException();
3470 boolean res = reply.readInt() != 0;
3471 data.recycle();
3472 reply.recycle();
3473 return res;
3474 }
3475
3476 public void publishService(IBinder token,
3477 Intent intent, IBinder service) throws RemoteException {
3478 Parcel data = Parcel.obtain();
3479 Parcel reply = Parcel.obtain();
3480 data.writeInterfaceToken(IActivityManager.descriptor);
3481 data.writeStrongBinder(token);
3482 intent.writeToParcel(data, 0);
3483 data.writeStrongBinder(service);
3484 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3485 reply.readException();
3486 data.recycle();
3487 reply.recycle();
3488 }
3489
3490 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3491 throws RemoteException {
3492 Parcel data = Parcel.obtain();
3493 Parcel reply = Parcel.obtain();
3494 data.writeInterfaceToken(IActivityManager.descriptor);
3495 data.writeStrongBinder(token);
3496 intent.writeToParcel(data, 0);
3497 data.writeInt(doRebind ? 1 : 0);
3498 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3499 reply.readException();
3500 data.recycle();
3501 reply.recycle();
3502 }
3503
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003504 public void serviceDoneExecuting(IBinder token, int type, int startId,
3505 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003506 Parcel data = Parcel.obtain();
3507 Parcel reply = Parcel.obtain();
3508 data.writeInterfaceToken(IActivityManager.descriptor);
3509 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003510 data.writeInt(type);
3511 data.writeInt(startId);
3512 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003513 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3514 reply.readException();
3515 data.recycle();
3516 reply.recycle();
3517 }
3518
3519 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3520 Parcel data = Parcel.obtain();
3521 Parcel reply = Parcel.obtain();
3522 data.writeInterfaceToken(IActivityManager.descriptor);
3523 service.writeToParcel(data, 0);
3524 data.writeString(resolvedType);
3525 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3526 reply.readException();
3527 IBinder binder = reply.readStrongBinder();
3528 reply.recycle();
3529 data.recycle();
3530 return binder;
3531 }
3532
Christopher Tate181fafa2009-05-14 11:12:14 -07003533 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3534 throws RemoteException {
3535 Parcel data = Parcel.obtain();
3536 Parcel reply = Parcel.obtain();
3537 data.writeInterfaceToken(IActivityManager.descriptor);
3538 app.writeToParcel(data, 0);
3539 data.writeInt(backupRestoreMode);
3540 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3541 reply.readException();
3542 boolean success = reply.readInt() != 0;
3543 reply.recycle();
3544 data.recycle();
3545 return success;
3546 }
3547
Christopher Tate346acb12012-10-15 19:20:25 -07003548 public void clearPendingBackup() throws RemoteException {
3549 Parcel data = Parcel.obtain();
3550 Parcel reply = Parcel.obtain();
3551 data.writeInterfaceToken(IActivityManager.descriptor);
3552 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3553 reply.recycle();
3554 data.recycle();
3555 }
3556
Christopher Tate181fafa2009-05-14 11:12:14 -07003557 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3558 Parcel data = Parcel.obtain();
3559 Parcel reply = Parcel.obtain();
3560 data.writeInterfaceToken(IActivityManager.descriptor);
3561 data.writeString(packageName);
3562 data.writeStrongBinder(agent);
3563 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3564 reply.recycle();
3565 data.recycle();
3566 }
3567
3568 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3569 Parcel data = Parcel.obtain();
3570 Parcel reply = Parcel.obtain();
3571 data.writeInterfaceToken(IActivityManager.descriptor);
3572 app.writeToParcel(data, 0);
3573 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3574 reply.readException();
3575 reply.recycle();
3576 data.recycle();
3577 }
3578
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003579 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003580 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003581 IUiAutomationConnection connection, int userId, String instructionSet)
3582 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003583 Parcel data = Parcel.obtain();
3584 Parcel reply = Parcel.obtain();
3585 data.writeInterfaceToken(IActivityManager.descriptor);
3586 ComponentName.writeToParcel(className, data);
3587 data.writeString(profileFile);
3588 data.writeInt(flags);
3589 data.writeBundle(arguments);
3590 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003591 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003592 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003593 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003594 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3595 reply.readException();
3596 boolean res = reply.readInt() != 0;
3597 reply.recycle();
3598 data.recycle();
3599 return res;
3600 }
3601
3602 public void finishInstrumentation(IApplicationThread target,
3603 int resultCode, Bundle results) throws RemoteException {
3604 Parcel data = Parcel.obtain();
3605 Parcel reply = Parcel.obtain();
3606 data.writeInterfaceToken(IActivityManager.descriptor);
3607 data.writeStrongBinder(target != null ? target.asBinder() : null);
3608 data.writeInt(resultCode);
3609 data.writeBundle(results);
3610 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3611 reply.readException();
3612 data.recycle();
3613 reply.recycle();
3614 }
3615 public Configuration getConfiguration() throws RemoteException
3616 {
3617 Parcel data = Parcel.obtain();
3618 Parcel reply = Parcel.obtain();
3619 data.writeInterfaceToken(IActivityManager.descriptor);
3620 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3621 reply.readException();
3622 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3623 reply.recycle();
3624 data.recycle();
3625 return res;
3626 }
3627 public void updateConfiguration(Configuration values) throws RemoteException
3628 {
3629 Parcel data = Parcel.obtain();
3630 Parcel reply = Parcel.obtain();
3631 data.writeInterfaceToken(IActivityManager.descriptor);
3632 values.writeToParcel(data, 0);
3633 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3634 reply.readException();
3635 data.recycle();
3636 reply.recycle();
3637 }
3638 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3639 throws RemoteException {
3640 Parcel data = Parcel.obtain();
3641 Parcel reply = Parcel.obtain();
3642 data.writeInterfaceToken(IActivityManager.descriptor);
3643 data.writeStrongBinder(token);
3644 data.writeInt(requestedOrientation);
3645 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3646 reply.readException();
3647 data.recycle();
3648 reply.recycle();
3649 }
3650 public int getRequestedOrientation(IBinder token) throws RemoteException {
3651 Parcel data = Parcel.obtain();
3652 Parcel reply = Parcel.obtain();
3653 data.writeInterfaceToken(IActivityManager.descriptor);
3654 data.writeStrongBinder(token);
3655 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3656 reply.readException();
3657 int res = reply.readInt();
3658 data.recycle();
3659 reply.recycle();
3660 return res;
3661 }
3662 public ComponentName getActivityClassForToken(IBinder token)
3663 throws RemoteException {
3664 Parcel data = Parcel.obtain();
3665 Parcel reply = Parcel.obtain();
3666 data.writeInterfaceToken(IActivityManager.descriptor);
3667 data.writeStrongBinder(token);
3668 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3669 reply.readException();
3670 ComponentName res = ComponentName.readFromParcel(reply);
3671 data.recycle();
3672 reply.recycle();
3673 return res;
3674 }
3675 public String getPackageForToken(IBinder token) throws RemoteException
3676 {
3677 Parcel data = Parcel.obtain();
3678 Parcel reply = Parcel.obtain();
3679 data.writeInterfaceToken(IActivityManager.descriptor);
3680 data.writeStrongBinder(token);
3681 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3682 reply.readException();
3683 String res = reply.readString();
3684 data.recycle();
3685 reply.recycle();
3686 return res;
3687 }
3688 public IIntentSender getIntentSender(int type,
3689 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003690 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003691 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003692 Parcel data = Parcel.obtain();
3693 Parcel reply = Parcel.obtain();
3694 data.writeInterfaceToken(IActivityManager.descriptor);
3695 data.writeInt(type);
3696 data.writeString(packageName);
3697 data.writeStrongBinder(token);
3698 data.writeString(resultWho);
3699 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003700 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003701 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003702 data.writeTypedArray(intents, 0);
3703 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003704 } else {
3705 data.writeInt(0);
3706 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003707 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003708 if (options != null) {
3709 data.writeInt(1);
3710 options.writeToParcel(data, 0);
3711 } else {
3712 data.writeInt(0);
3713 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003714 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003715 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3716 reply.readException();
3717 IIntentSender res = IIntentSender.Stub.asInterface(
3718 reply.readStrongBinder());
3719 data.recycle();
3720 reply.recycle();
3721 return res;
3722 }
3723 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3724 Parcel data = Parcel.obtain();
3725 Parcel reply = Parcel.obtain();
3726 data.writeInterfaceToken(IActivityManager.descriptor);
3727 data.writeStrongBinder(sender.asBinder());
3728 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3729 reply.readException();
3730 data.recycle();
3731 reply.recycle();
3732 }
3733 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3734 Parcel data = Parcel.obtain();
3735 Parcel reply = Parcel.obtain();
3736 data.writeInterfaceToken(IActivityManager.descriptor);
3737 data.writeStrongBinder(sender.asBinder());
3738 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3739 reply.readException();
3740 String res = reply.readString();
3741 data.recycle();
3742 reply.recycle();
3743 return res;
3744 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003745 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3746 Parcel data = Parcel.obtain();
3747 Parcel reply = Parcel.obtain();
3748 data.writeInterfaceToken(IActivityManager.descriptor);
3749 data.writeStrongBinder(sender.asBinder());
3750 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3751 reply.readException();
3752 int res = reply.readInt();
3753 data.recycle();
3754 reply.recycle();
3755 return res;
3756 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003757 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3758 boolean requireFull, String name, String callerPackage) throws RemoteException {
3759 Parcel data = Parcel.obtain();
3760 Parcel reply = Parcel.obtain();
3761 data.writeInterfaceToken(IActivityManager.descriptor);
3762 data.writeInt(callingPid);
3763 data.writeInt(callingUid);
3764 data.writeInt(userId);
3765 data.writeInt(allowAll ? 1 : 0);
3766 data.writeInt(requireFull ? 1 : 0);
3767 data.writeString(name);
3768 data.writeString(callerPackage);
3769 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3770 reply.readException();
3771 int res = reply.readInt();
3772 data.recycle();
3773 reply.recycle();
3774 return res;
3775 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003776 public void setProcessLimit(int max) throws RemoteException
3777 {
3778 Parcel data = Parcel.obtain();
3779 Parcel reply = Parcel.obtain();
3780 data.writeInterfaceToken(IActivityManager.descriptor);
3781 data.writeInt(max);
3782 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3783 reply.readException();
3784 data.recycle();
3785 reply.recycle();
3786 }
3787 public int getProcessLimit() throws RemoteException
3788 {
3789 Parcel data = Parcel.obtain();
3790 Parcel reply = Parcel.obtain();
3791 data.writeInterfaceToken(IActivityManager.descriptor);
3792 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3793 reply.readException();
3794 int res = reply.readInt();
3795 data.recycle();
3796 reply.recycle();
3797 return res;
3798 }
3799 public void setProcessForeground(IBinder token, int pid,
3800 boolean isForeground) throws RemoteException {
3801 Parcel data = Parcel.obtain();
3802 Parcel reply = Parcel.obtain();
3803 data.writeInterfaceToken(IActivityManager.descriptor);
3804 data.writeStrongBinder(token);
3805 data.writeInt(pid);
3806 data.writeInt(isForeground ? 1 : 0);
3807 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3808 reply.readException();
3809 data.recycle();
3810 reply.recycle();
3811 }
3812 public int checkPermission(String permission, int pid, int uid)
3813 throws RemoteException {
3814 Parcel data = Parcel.obtain();
3815 Parcel reply = Parcel.obtain();
3816 data.writeInterfaceToken(IActivityManager.descriptor);
3817 data.writeString(permission);
3818 data.writeInt(pid);
3819 data.writeInt(uid);
3820 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3821 reply.readException();
3822 int res = reply.readInt();
3823 data.recycle();
3824 reply.recycle();
3825 return res;
3826 }
3827 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003828 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003829 Parcel data = Parcel.obtain();
3830 Parcel reply = Parcel.obtain();
3831 data.writeInterfaceToken(IActivityManager.descriptor);
3832 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003833 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003834 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003835 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3836 reply.readException();
3837 boolean res = reply.readInt() != 0;
3838 data.recycle();
3839 reply.recycle();
3840 return res;
3841 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003842 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003843 throws RemoteException {
3844 Parcel data = Parcel.obtain();
3845 Parcel reply = Parcel.obtain();
3846 data.writeInterfaceToken(IActivityManager.descriptor);
3847 uri.writeToParcel(data, 0);
3848 data.writeInt(pid);
3849 data.writeInt(uid);
3850 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003851 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003852 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3853 reply.readException();
3854 int res = reply.readInt();
3855 data.recycle();
3856 reply.recycle();
3857 return res;
3858 }
3859 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003860 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003861 Parcel data = Parcel.obtain();
3862 Parcel reply = Parcel.obtain();
3863 data.writeInterfaceToken(IActivityManager.descriptor);
3864 data.writeStrongBinder(caller.asBinder());
3865 data.writeString(targetPkg);
3866 uri.writeToParcel(data, 0);
3867 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003868 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003869 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3870 reply.readException();
3871 data.recycle();
3872 reply.recycle();
3873 }
3874 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003875 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003876 Parcel data = Parcel.obtain();
3877 Parcel reply = Parcel.obtain();
3878 data.writeInterfaceToken(IActivityManager.descriptor);
3879 data.writeStrongBinder(caller.asBinder());
3880 uri.writeToParcel(data, 0);
3881 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003882 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003883 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3884 reply.readException();
3885 data.recycle();
3886 reply.recycle();
3887 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003888
3889 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003890 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3891 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003892 Parcel data = Parcel.obtain();
3893 Parcel reply = Parcel.obtain();
3894 data.writeInterfaceToken(IActivityManager.descriptor);
3895 uri.writeToParcel(data, 0);
3896 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003897 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003898 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3899 reply.readException();
3900 data.recycle();
3901 reply.recycle();
3902 }
3903
3904 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003905 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3906 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003907 Parcel data = Parcel.obtain();
3908 Parcel reply = Parcel.obtain();
3909 data.writeInterfaceToken(IActivityManager.descriptor);
3910 uri.writeToParcel(data, 0);
3911 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003912 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003913 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3914 reply.readException();
3915 data.recycle();
3916 reply.recycle();
3917 }
3918
3919 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003920 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3921 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003922 Parcel data = Parcel.obtain();
3923 Parcel reply = Parcel.obtain();
3924 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003925 data.writeString(packageName);
3926 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003927 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3928 reply.readException();
3929 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3930 reply);
3931 data.recycle();
3932 reply.recycle();
3933 return perms;
3934 }
3935
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003936 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3937 throws RemoteException {
3938 Parcel data = Parcel.obtain();
3939 Parcel reply = Parcel.obtain();
3940 data.writeInterfaceToken(IActivityManager.descriptor);
3941 data.writeStrongBinder(who.asBinder());
3942 data.writeInt(waiting ? 1 : 0);
3943 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3944 reply.readException();
3945 data.recycle();
3946 reply.recycle();
3947 }
3948 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3949 Parcel data = Parcel.obtain();
3950 Parcel reply = Parcel.obtain();
3951 data.writeInterfaceToken(IActivityManager.descriptor);
3952 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3953 reply.readException();
3954 outInfo.readFromParcel(reply);
3955 data.recycle();
3956 reply.recycle();
3957 }
3958 public void unhandledBack() throws RemoteException
3959 {
3960 Parcel data = Parcel.obtain();
3961 Parcel reply = Parcel.obtain();
3962 data.writeInterfaceToken(IActivityManager.descriptor);
3963 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3964 reply.readException();
3965 data.recycle();
3966 reply.recycle();
3967 }
3968 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3969 {
3970 Parcel data = Parcel.obtain();
3971 Parcel reply = Parcel.obtain();
3972 data.writeInterfaceToken(IActivityManager.descriptor);
3973 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3974 reply.readException();
3975 ParcelFileDescriptor pfd = null;
3976 if (reply.readInt() != 0) {
3977 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3978 }
3979 data.recycle();
3980 reply.recycle();
3981 return pfd;
3982 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003983 public void setLockScreenShown(boolean shown) throws RemoteException
3984 {
3985 Parcel data = Parcel.obtain();
3986 Parcel reply = Parcel.obtain();
3987 data.writeInterfaceToken(IActivityManager.descriptor);
3988 data.writeInt(shown ? 1 : 0);
3989 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3990 reply.readException();
3991 data.recycle();
3992 reply.recycle();
3993 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003994 public void setDebugApp(
3995 String packageName, boolean waitForDebugger, boolean persistent)
3996 throws RemoteException
3997 {
3998 Parcel data = Parcel.obtain();
3999 Parcel reply = Parcel.obtain();
4000 data.writeInterfaceToken(IActivityManager.descriptor);
4001 data.writeString(packageName);
4002 data.writeInt(waitForDebugger ? 1 : 0);
4003 data.writeInt(persistent ? 1 : 0);
4004 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4005 reply.readException();
4006 data.recycle();
4007 reply.recycle();
4008 }
4009 public void setAlwaysFinish(boolean enabled) throws RemoteException
4010 {
4011 Parcel data = Parcel.obtain();
4012 Parcel reply = Parcel.obtain();
4013 data.writeInterfaceToken(IActivityManager.descriptor);
4014 data.writeInt(enabled ? 1 : 0);
4015 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4016 reply.readException();
4017 data.recycle();
4018 reply.recycle();
4019 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004020 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004021 {
4022 Parcel data = Parcel.obtain();
4023 Parcel reply = Parcel.obtain();
4024 data.writeInterfaceToken(IActivityManager.descriptor);
4025 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004026 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004027 reply.readException();
4028 data.recycle();
4029 reply.recycle();
4030 }
4031 public void enterSafeMode() throws RemoteException {
4032 Parcel data = Parcel.obtain();
4033 data.writeInterfaceToken(IActivityManager.descriptor);
4034 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4035 data.recycle();
4036 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08004037 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
4038 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004039 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004040 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004041 data.writeStrongBinder(sender.asBinder());
4042 data.writeInt(sourceUid);
4043 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004044 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4045 data.recycle();
4046 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004047 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004048 Parcel data = Parcel.obtain();
4049 Parcel reply = Parcel.obtain();
4050 data.writeInterfaceToken(IActivityManager.descriptor);
4051 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004052 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004053 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004054 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004055 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004056 boolean res = reply.readInt() != 0;
4057 data.recycle();
4058 reply.recycle();
4059 return res;
4060 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004061 @Override
4062 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4063 Parcel data = Parcel.obtain();
4064 Parcel reply = Parcel.obtain();
4065 data.writeInterfaceToken(IActivityManager.descriptor);
4066 data.writeString(reason);
4067 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4068 boolean res = reply.readInt() != 0;
4069 data.recycle();
4070 reply.recycle();
4071 return res;
4072 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004073 public boolean testIsSystemReady()
4074 {
4075 /* this base class version is never called */
4076 return true;
4077 }
Dan Egnor60d87622009-12-16 16:32:58 -08004078 public void handleApplicationCrash(IBinder app,
4079 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4080 {
4081 Parcel data = Parcel.obtain();
4082 Parcel reply = Parcel.obtain();
4083 data.writeInterfaceToken(IActivityManager.descriptor);
4084 data.writeStrongBinder(app);
4085 crashInfo.writeToParcel(data, 0);
4086 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4087 reply.readException();
4088 reply.recycle();
4089 data.recycle();
4090 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004091
Dianne Hackborn52322712014-08-26 22:47:26 -07004092 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004093 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004094 {
4095 Parcel data = Parcel.obtain();
4096 Parcel reply = Parcel.obtain();
4097 data.writeInterfaceToken(IActivityManager.descriptor);
4098 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004099 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004100 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004101 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004102 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004103 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004104 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004105 reply.recycle();
4106 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004107 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004108 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004109
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004110 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004111 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004112 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004113 {
4114 Parcel data = Parcel.obtain();
4115 Parcel reply = Parcel.obtain();
4116 data.writeInterfaceToken(IActivityManager.descriptor);
4117 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004118 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004119 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004120 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4121 reply.readException();
4122 reply.recycle();
4123 data.recycle();
4124 }
4125
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004126 public void signalPersistentProcesses(int sig) throws RemoteException {
4127 Parcel data = Parcel.obtain();
4128 Parcel reply = Parcel.obtain();
4129 data.writeInterfaceToken(IActivityManager.descriptor);
4130 data.writeInt(sig);
4131 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4132 reply.readException();
4133 data.recycle();
4134 reply.recycle();
4135 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004136
Dianne Hackborn1676c852012-09-10 14:52:30 -07004137 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004138 Parcel data = Parcel.obtain();
4139 Parcel reply = Parcel.obtain();
4140 data.writeInterfaceToken(IActivityManager.descriptor);
4141 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004142 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004143 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4144 reply.readException();
4145 data.recycle();
4146 reply.recycle();
4147 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004148
4149 public void killAllBackgroundProcesses() throws RemoteException {
4150 Parcel data = Parcel.obtain();
4151 Parcel reply = Parcel.obtain();
4152 data.writeInterfaceToken(IActivityManager.descriptor);
4153 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4154 reply.readException();
4155 data.recycle();
4156 reply.recycle();
4157 }
4158
Dianne Hackborn1676c852012-09-10 14:52:30 -07004159 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004160 Parcel data = Parcel.obtain();
4161 Parcel reply = Parcel.obtain();
4162 data.writeInterfaceToken(IActivityManager.descriptor);
4163 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004164 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004165 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004166 reply.readException();
4167 data.recycle();
4168 reply.recycle();
4169 }
4170
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004171 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4172 throws RemoteException
4173 {
4174 Parcel data = Parcel.obtain();
4175 Parcel reply = Parcel.obtain();
4176 data.writeInterfaceToken(IActivityManager.descriptor);
4177 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4178 reply.readException();
4179 outInfo.readFromParcel(reply);
4180 reply.recycle();
4181 data.recycle();
4182 }
4183
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004184 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4185 {
4186 Parcel data = Parcel.obtain();
4187 Parcel reply = Parcel.obtain();
4188 data.writeInterfaceToken(IActivityManager.descriptor);
4189 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4190 reply.readException();
4191 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4192 reply.recycle();
4193 data.recycle();
4194 return res;
4195 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004196
Dianne Hackborn1676c852012-09-10 14:52:30 -07004197 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004198 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004199 {
4200 Parcel data = Parcel.obtain();
4201 Parcel reply = Parcel.obtain();
4202 data.writeInterfaceToken(IActivityManager.descriptor);
4203 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004204 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004205 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004206 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004207 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004208 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004209 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004210 } else {
4211 data.writeInt(0);
4212 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004213 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4214 reply.readException();
4215 boolean res = reply.readInt() != 0;
4216 reply.recycle();
4217 data.recycle();
4218 return res;
4219 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004220
Dianne Hackborn55280a92009-05-07 15:53:46 -07004221 public boolean shutdown(int timeout) throws RemoteException
4222 {
4223 Parcel data = Parcel.obtain();
4224 Parcel reply = Parcel.obtain();
4225 data.writeInterfaceToken(IActivityManager.descriptor);
4226 data.writeInt(timeout);
4227 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4228 reply.readException();
4229 boolean res = reply.readInt() != 0;
4230 reply.recycle();
4231 data.recycle();
4232 return res;
4233 }
4234
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004235 public void stopAppSwitches() throws RemoteException {
4236 Parcel data = Parcel.obtain();
4237 Parcel reply = Parcel.obtain();
4238 data.writeInterfaceToken(IActivityManager.descriptor);
4239 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4240 reply.readException();
4241 reply.recycle();
4242 data.recycle();
4243 }
4244
4245 public void resumeAppSwitches() throws RemoteException {
4246 Parcel data = Parcel.obtain();
4247 Parcel reply = Parcel.obtain();
4248 data.writeInterfaceToken(IActivityManager.descriptor);
4249 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4250 reply.readException();
4251 reply.recycle();
4252 data.recycle();
4253 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004254
4255 public void addPackageDependency(String packageName) throws RemoteException {
4256 Parcel data = Parcel.obtain();
4257 Parcel reply = Parcel.obtain();
4258 data.writeInterfaceToken(IActivityManager.descriptor);
4259 data.writeString(packageName);
4260 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4261 reply.readException();
4262 data.recycle();
4263 reply.recycle();
4264 }
4265
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004266 public void killApplicationWithAppId(String pkg, int appid, String reason)
4267 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004268 Parcel data = Parcel.obtain();
4269 Parcel reply = Parcel.obtain();
4270 data.writeInterfaceToken(IActivityManager.descriptor);
4271 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004272 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004273 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004274 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004275 reply.readException();
4276 data.recycle();
4277 reply.recycle();
4278 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004279
4280 public void closeSystemDialogs(String reason) throws RemoteException {
4281 Parcel data = Parcel.obtain();
4282 Parcel reply = Parcel.obtain();
4283 data.writeInterfaceToken(IActivityManager.descriptor);
4284 data.writeString(reason);
4285 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4286 reply.readException();
4287 data.recycle();
4288 reply.recycle();
4289 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004290
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004291 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004292 throws RemoteException {
4293 Parcel data = Parcel.obtain();
4294 Parcel reply = Parcel.obtain();
4295 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004296 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004297 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4298 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004299 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004300 data.recycle();
4301 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004302 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004303 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004304
4305 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4306 Parcel data = Parcel.obtain();
4307 Parcel reply = Parcel.obtain();
4308 data.writeInterfaceToken(IActivityManager.descriptor);
4309 data.writeString(processName);
4310 data.writeInt(uid);
4311 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4312 reply.readException();
4313 data.recycle();
4314 reply.recycle();
4315 }
4316
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004317 public void overridePendingTransition(IBinder token, String packageName,
4318 int enterAnim, int exitAnim) throws RemoteException {
4319 Parcel data = Parcel.obtain();
4320 Parcel reply = Parcel.obtain();
4321 data.writeInterfaceToken(IActivityManager.descriptor);
4322 data.writeStrongBinder(token);
4323 data.writeString(packageName);
4324 data.writeInt(enterAnim);
4325 data.writeInt(exitAnim);
4326 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4327 reply.readException();
4328 data.recycle();
4329 reply.recycle();
4330 }
4331
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004332 public boolean isUserAMonkey() throws RemoteException {
4333 Parcel data = Parcel.obtain();
4334 Parcel reply = Parcel.obtain();
4335 data.writeInterfaceToken(IActivityManager.descriptor);
4336 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4337 reply.readException();
4338 boolean res = reply.readInt() != 0;
4339 data.recycle();
4340 reply.recycle();
4341 return res;
4342 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004343
4344 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4345 Parcel data = Parcel.obtain();
4346 Parcel reply = Parcel.obtain();
4347 data.writeInterfaceToken(IActivityManager.descriptor);
4348 data.writeInt(monkey ? 1 : 0);
4349 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4350 reply.readException();
4351 data.recycle();
4352 reply.recycle();
4353 }
4354
Dianne Hackborn860755f2010-06-03 18:47:52 -07004355 public void finishHeavyWeightApp() throws RemoteException {
4356 Parcel data = Parcel.obtain();
4357 Parcel reply = Parcel.obtain();
4358 data.writeInterfaceToken(IActivityManager.descriptor);
4359 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4360 reply.readException();
4361 data.recycle();
4362 reply.recycle();
4363 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004364
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004365 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004366 throws RemoteException {
4367 Parcel data = Parcel.obtain();
4368 Parcel reply = Parcel.obtain();
4369 data.writeInterfaceToken(IActivityManager.descriptor);
4370 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004371 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4372 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004373 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004374 data.recycle();
4375 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004376 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004377 }
4378
Craig Mautner233ceee2014-05-09 17:05:11 -07004379 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004380 throws RemoteException {
4381 Parcel data = Parcel.obtain();
4382 Parcel reply = Parcel.obtain();
4383 data.writeInterfaceToken(IActivityManager.descriptor);
4384 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004385 if (options == null) {
4386 data.writeInt(0);
4387 } else {
4388 data.writeInt(1);
4389 data.writeBundle(options.toBundle());
4390 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004391 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004392 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004393 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004394 data.recycle();
4395 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004396 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004397 }
4398
Craig Mautner233ceee2014-05-09 17:05:11 -07004399 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4400 Parcel data = Parcel.obtain();
4401 Parcel reply = Parcel.obtain();
4402 data.writeInterfaceToken(IActivityManager.descriptor);
4403 data.writeStrongBinder(token);
4404 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4405 reply.readException();
4406 Bundle bundle = reply.readBundle();
4407 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4408 data.recycle();
4409 reply.recycle();
4410 return options;
4411 }
4412
Daniel Sandler69a48172010-06-23 16:29:36 -04004413 public void setImmersive(IBinder token, boolean immersive)
4414 throws RemoteException {
4415 Parcel data = Parcel.obtain();
4416 Parcel reply = Parcel.obtain();
4417 data.writeInterfaceToken(IActivityManager.descriptor);
4418 data.writeStrongBinder(token);
4419 data.writeInt(immersive ? 1 : 0);
4420 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4421 reply.readException();
4422 data.recycle();
4423 reply.recycle();
4424 }
4425
4426 public boolean isImmersive(IBinder token)
4427 throws RemoteException {
4428 Parcel data = Parcel.obtain();
4429 Parcel reply = Parcel.obtain();
4430 data.writeInterfaceToken(IActivityManager.descriptor);
4431 data.writeStrongBinder(token);
4432 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004433 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004434 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004435 data.recycle();
4436 reply.recycle();
4437 return res;
4438 }
4439
Craig Mautnerd61dc202014-07-07 11:09:11 -07004440 public boolean isTopOfTask(IBinder token) throws RemoteException {
4441 Parcel data = Parcel.obtain();
4442 Parcel reply = Parcel.obtain();
4443 data.writeInterfaceToken(IActivityManager.descriptor);
4444 data.writeStrongBinder(token);
4445 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4446 reply.readException();
4447 boolean res = reply.readInt() == 1;
4448 data.recycle();
4449 reply.recycle();
4450 return res;
4451 }
4452
Daniel Sandler69a48172010-06-23 16:29:36 -04004453 public boolean isTopActivityImmersive()
4454 throws RemoteException {
4455 Parcel data = Parcel.obtain();
4456 Parcel reply = Parcel.obtain();
4457 data.writeInterfaceToken(IActivityManager.descriptor);
4458 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004459 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004460 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004461 data.recycle();
4462 reply.recycle();
4463 return res;
4464 }
4465
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004466 public void crashApplication(int uid, int initialPid, String packageName,
4467 String message) throws RemoteException {
4468 Parcel data = Parcel.obtain();
4469 Parcel reply = Parcel.obtain();
4470 data.writeInterfaceToken(IActivityManager.descriptor);
4471 data.writeInt(uid);
4472 data.writeInt(initialPid);
4473 data.writeString(packageName);
4474 data.writeString(message);
4475 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4476 reply.readException();
4477 data.recycle();
4478 reply.recycle();
4479 }
Andy McFadden824c5102010-07-09 16:26:57 -07004480
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004481 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004482 Parcel data = Parcel.obtain();
4483 Parcel reply = Parcel.obtain();
4484 data.writeInterfaceToken(IActivityManager.descriptor);
4485 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004486 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004487 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4488 reply.readException();
4489 String res = reply.readString();
4490 data.recycle();
4491 reply.recycle();
4492 return res;
4493 }
4494
Dianne Hackborn7e269642010-08-25 19:50:20 -07004495 public IBinder newUriPermissionOwner(String name)
4496 throws RemoteException {
4497 Parcel data = Parcel.obtain();
4498 Parcel reply = Parcel.obtain();
4499 data.writeInterfaceToken(IActivityManager.descriptor);
4500 data.writeString(name);
4501 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4502 reply.readException();
4503 IBinder res = reply.readStrongBinder();
4504 data.recycle();
4505 reply.recycle();
4506 return res;
4507 }
4508
4509 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004510 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004511 Parcel data = Parcel.obtain();
4512 Parcel reply = Parcel.obtain();
4513 data.writeInterfaceToken(IActivityManager.descriptor);
4514 data.writeStrongBinder(owner);
4515 data.writeInt(fromUid);
4516 data.writeString(targetPkg);
4517 uri.writeToParcel(data, 0);
4518 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004519 data.writeInt(sourceUserId);
4520 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004521 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4522 reply.readException();
4523 data.recycle();
4524 reply.recycle();
4525 }
4526
4527 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004528 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004529 Parcel data = Parcel.obtain();
4530 Parcel reply = Parcel.obtain();
4531 data.writeInterfaceToken(IActivityManager.descriptor);
4532 data.writeStrongBinder(owner);
4533 if (uri != null) {
4534 data.writeInt(1);
4535 uri.writeToParcel(data, 0);
4536 } else {
4537 data.writeInt(0);
4538 }
4539 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004540 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004541 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4542 reply.readException();
4543 data.recycle();
4544 reply.recycle();
4545 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004546
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004547 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004548 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004549 Parcel data = Parcel.obtain();
4550 Parcel reply = Parcel.obtain();
4551 data.writeInterfaceToken(IActivityManager.descriptor);
4552 data.writeInt(callingUid);
4553 data.writeString(targetPkg);
4554 uri.writeToParcel(data, 0);
4555 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004556 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004557 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4558 reply.readException();
4559 int res = reply.readInt();
4560 data.recycle();
4561 reply.recycle();
4562 return res;
4563 }
4564
Dianne Hackborn1676c852012-09-10 14:52:30 -07004565 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004566 String path, ParcelFileDescriptor fd) throws RemoteException {
4567 Parcel data = Parcel.obtain();
4568 Parcel reply = Parcel.obtain();
4569 data.writeInterfaceToken(IActivityManager.descriptor);
4570 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004571 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004572 data.writeInt(managed ? 1 : 0);
4573 data.writeString(path);
4574 if (fd != null) {
4575 data.writeInt(1);
4576 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4577 } else {
4578 data.writeInt(0);
4579 }
4580 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4581 reply.readException();
4582 boolean res = reply.readInt() != 0;
4583 reply.recycle();
4584 data.recycle();
4585 return res;
4586 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004587
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004588 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004589 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004590 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004591 Parcel data = Parcel.obtain();
4592 Parcel reply = Parcel.obtain();
4593 data.writeInterfaceToken(IActivityManager.descriptor);
4594 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004595 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004596 data.writeTypedArray(intents, 0);
4597 data.writeStringArray(resolvedTypes);
4598 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004599 if (options != null) {
4600 data.writeInt(1);
4601 options.writeToParcel(data, 0);
4602 } else {
4603 data.writeInt(0);
4604 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004605 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004606 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4607 reply.readException();
4608 int result = reply.readInt();
4609 reply.recycle();
4610 data.recycle();
4611 return result;
4612 }
4613
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004614 public int getFrontActivityScreenCompatMode() throws RemoteException {
4615 Parcel data = Parcel.obtain();
4616 Parcel reply = Parcel.obtain();
4617 data.writeInterfaceToken(IActivityManager.descriptor);
4618 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4619 reply.readException();
4620 int mode = reply.readInt();
4621 reply.recycle();
4622 data.recycle();
4623 return mode;
4624 }
4625
4626 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4627 Parcel data = Parcel.obtain();
4628 Parcel reply = Parcel.obtain();
4629 data.writeInterfaceToken(IActivityManager.descriptor);
4630 data.writeInt(mode);
4631 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4632 reply.readException();
4633 reply.recycle();
4634 data.recycle();
4635 }
4636
4637 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4638 Parcel data = Parcel.obtain();
4639 Parcel reply = Parcel.obtain();
4640 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004641 data.writeString(packageName);
4642 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004643 reply.readException();
4644 int mode = reply.readInt();
4645 reply.recycle();
4646 data.recycle();
4647 return mode;
4648 }
4649
4650 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004651 throws RemoteException {
4652 Parcel data = Parcel.obtain();
4653 Parcel reply = Parcel.obtain();
4654 data.writeInterfaceToken(IActivityManager.descriptor);
4655 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004656 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004657 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4658 reply.readException();
4659 reply.recycle();
4660 data.recycle();
4661 }
4662
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004663 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4664 Parcel data = Parcel.obtain();
4665 Parcel reply = Parcel.obtain();
4666 data.writeInterfaceToken(IActivityManager.descriptor);
4667 data.writeString(packageName);
4668 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4669 reply.readException();
4670 boolean ask = reply.readInt() != 0;
4671 reply.recycle();
4672 data.recycle();
4673 return ask;
4674 }
4675
4676 public void setPackageAskScreenCompat(String packageName, boolean ask)
4677 throws RemoteException {
4678 Parcel data = Parcel.obtain();
4679 Parcel reply = Parcel.obtain();
4680 data.writeInterfaceToken(IActivityManager.descriptor);
4681 data.writeString(packageName);
4682 data.writeInt(ask ? 1 : 0);
4683 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4684 reply.readException();
4685 reply.recycle();
4686 data.recycle();
4687 }
4688
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004689 public boolean switchUser(int userid) throws RemoteException {
4690 Parcel data = Parcel.obtain();
4691 Parcel reply = Parcel.obtain();
4692 data.writeInterfaceToken(IActivityManager.descriptor);
4693 data.writeInt(userid);
4694 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4695 reply.readException();
4696 boolean result = reply.readInt() != 0;
4697 reply.recycle();
4698 data.recycle();
4699 return result;
4700 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004701
Kenny Guy08488bf2014-02-21 17:40:37 +00004702 public boolean startUserInBackground(int userid) throws RemoteException {
4703 Parcel data = Parcel.obtain();
4704 Parcel reply = Parcel.obtain();
4705 data.writeInterfaceToken(IActivityManager.descriptor);
4706 data.writeInt(userid);
4707 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4708 reply.readException();
4709 boolean result = reply.readInt() != 0;
4710 reply.recycle();
4711 data.recycle();
4712 return result;
4713 }
4714
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004715 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4716 Parcel data = Parcel.obtain();
4717 Parcel reply = Parcel.obtain();
4718 data.writeInterfaceToken(IActivityManager.descriptor);
4719 data.writeInt(userid);
4720 data.writeStrongInterface(callback);
4721 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4722 reply.readException();
4723 int result = reply.readInt();
4724 reply.recycle();
4725 data.recycle();
4726 return result;
4727 }
4728
Amith Yamasani52f1d752012-03-28 18:19:29 -07004729 public UserInfo getCurrentUser() throws RemoteException {
4730 Parcel data = Parcel.obtain();
4731 Parcel reply = Parcel.obtain();
4732 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004733 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004734 reply.readException();
4735 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4736 reply.recycle();
4737 data.recycle();
4738 return userInfo;
4739 }
4740
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004741 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004742 Parcel data = Parcel.obtain();
4743 Parcel reply = Parcel.obtain();
4744 data.writeInterfaceToken(IActivityManager.descriptor);
4745 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004746 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004747 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4748 reply.readException();
4749 boolean result = reply.readInt() != 0;
4750 reply.recycle();
4751 data.recycle();
4752 return result;
4753 }
4754
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004755 public int[] getRunningUserIds() throws RemoteException {
4756 Parcel data = Parcel.obtain();
4757 Parcel reply = Parcel.obtain();
4758 data.writeInterfaceToken(IActivityManager.descriptor);
4759 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4760 reply.readException();
4761 int[] result = reply.createIntArray();
4762 reply.recycle();
4763 data.recycle();
4764 return result;
4765 }
4766
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004767 public boolean removeTask(int taskId, int flags) throws RemoteException {
4768 Parcel data = Parcel.obtain();
4769 Parcel reply = Parcel.obtain();
4770 data.writeInterfaceToken(IActivityManager.descriptor);
4771 data.writeInt(taskId);
4772 data.writeInt(flags);
4773 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4774 reply.readException();
4775 boolean result = reply.readInt() != 0;
4776 reply.recycle();
4777 data.recycle();
4778 return result;
4779 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004780
Jeff Sharkeya4620792011-05-20 15:29:23 -07004781 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4782 Parcel data = Parcel.obtain();
4783 Parcel reply = Parcel.obtain();
4784 data.writeInterfaceToken(IActivityManager.descriptor);
4785 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4786 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4787 reply.readException();
4788 data.recycle();
4789 reply.recycle();
4790 }
4791
4792 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4793 Parcel data = Parcel.obtain();
4794 Parcel reply = Parcel.obtain();
4795 data.writeInterfaceToken(IActivityManager.descriptor);
4796 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4797 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4798 reply.readException();
4799 data.recycle();
4800 reply.recycle();
4801 }
4802
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004803 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4804 Parcel data = Parcel.obtain();
4805 Parcel reply = Parcel.obtain();
4806 data.writeInterfaceToken(IActivityManager.descriptor);
4807 data.writeStrongBinder(sender.asBinder());
4808 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4809 reply.readException();
4810 boolean res = reply.readInt() != 0;
4811 data.recycle();
4812 reply.recycle();
4813 return res;
4814 }
4815
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004816 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4817 Parcel data = Parcel.obtain();
4818 Parcel reply = Parcel.obtain();
4819 data.writeInterfaceToken(IActivityManager.descriptor);
4820 data.writeStrongBinder(sender.asBinder());
4821 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4822 reply.readException();
4823 boolean res = reply.readInt() != 0;
4824 data.recycle();
4825 reply.recycle();
4826 return res;
4827 }
4828
Dianne Hackborn81038902012-11-26 17:04:09 -08004829 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4830 Parcel data = Parcel.obtain();
4831 Parcel reply = Parcel.obtain();
4832 data.writeInterfaceToken(IActivityManager.descriptor);
4833 data.writeStrongBinder(sender.asBinder());
4834 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4835 reply.readException();
4836 Intent res = reply.readInt() != 0
4837 ? Intent.CREATOR.createFromParcel(reply) : null;
4838 data.recycle();
4839 reply.recycle();
4840 return res;
4841 }
4842
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004843 public String getTagForIntentSender(IIntentSender sender, String prefix)
4844 throws RemoteException {
4845 Parcel data = Parcel.obtain();
4846 Parcel reply = Parcel.obtain();
4847 data.writeInterfaceToken(IActivityManager.descriptor);
4848 data.writeStrongBinder(sender.asBinder());
4849 data.writeString(prefix);
4850 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4851 reply.readException();
4852 String res = reply.readString();
4853 data.recycle();
4854 reply.recycle();
4855 return res;
4856 }
4857
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004858 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4859 {
4860 Parcel data = Parcel.obtain();
4861 Parcel reply = Parcel.obtain();
4862 data.writeInterfaceToken(IActivityManager.descriptor);
4863 values.writeToParcel(data, 0);
4864 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4865 reply.readException();
4866 data.recycle();
4867 reply.recycle();
4868 }
4869
Dianne Hackbornb437e092011-08-05 17:50:29 -07004870 public long[] getProcessPss(int[] pids) throws RemoteException {
4871 Parcel data = Parcel.obtain();
4872 Parcel reply = Parcel.obtain();
4873 data.writeInterfaceToken(IActivityManager.descriptor);
4874 data.writeIntArray(pids);
4875 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4876 reply.readException();
4877 long[] res = reply.createLongArray();
4878 data.recycle();
4879 reply.recycle();
4880 return res;
4881 }
4882
Dianne Hackborn661cd522011-08-22 00:26:20 -07004883 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4884 Parcel data = Parcel.obtain();
4885 Parcel reply = Parcel.obtain();
4886 data.writeInterfaceToken(IActivityManager.descriptor);
4887 TextUtils.writeToParcel(msg, data, 0);
4888 data.writeInt(always ? 1 : 0);
4889 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4890 reply.readException();
4891 data.recycle();
4892 reply.recycle();
4893 }
4894
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004895 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004896 Parcel data = Parcel.obtain();
4897 Parcel reply = Parcel.obtain();
4898 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004899 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004900 reply.readException();
4901 data.recycle();
4902 reply.recycle();
4903 }
4904
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004905 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07004906 throws RemoteException {
4907 Parcel data = Parcel.obtain();
4908 Parcel reply = Parcel.obtain();
4909 data.writeInterfaceToken(IActivityManager.descriptor);
4910 data.writeStrongBinder(token);
4911 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004912 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07004913 reply.readException();
4914 boolean result = reply.readInt() != 0;
4915 data.recycle();
4916 reply.recycle();
4917 return result;
4918 }
4919
4920 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4921 throws RemoteException {
4922 Parcel data = Parcel.obtain();
4923 Parcel reply = Parcel.obtain();
4924 data.writeInterfaceToken(IActivityManager.descriptor);
4925 data.writeStrongBinder(token);
4926 target.writeToParcel(data, 0);
4927 data.writeInt(resultCode);
4928 if (resultData != null) {
4929 data.writeInt(1);
4930 resultData.writeToParcel(data, 0);
4931 } else {
4932 data.writeInt(0);
4933 }
4934 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4935 reply.readException();
4936 boolean result = reply.readInt() != 0;
4937 data.recycle();
4938 reply.recycle();
4939 return result;
4940 }
4941
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004942 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4943 Parcel data = Parcel.obtain();
4944 Parcel reply = Parcel.obtain();
4945 data.writeInterfaceToken(IActivityManager.descriptor);
4946 data.writeStrongBinder(activityToken);
4947 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4948 reply.readException();
4949 int result = reply.readInt();
4950 data.recycle();
4951 reply.recycle();
4952 return result;
4953 }
4954
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004955 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4956 Parcel data = Parcel.obtain();
4957 Parcel reply = Parcel.obtain();
4958 data.writeInterfaceToken(IActivityManager.descriptor);
4959 data.writeStrongBinder(activityToken);
4960 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4961 reply.readException();
4962 String result = reply.readString();
4963 data.recycle();
4964 reply.recycle();
4965 return result;
4966 }
4967
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004968 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4969 Parcel data = Parcel.obtain();
4970 Parcel reply = Parcel.obtain();
4971 data.writeInterfaceToken(IActivityManager.descriptor);
4972 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4973 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4974 reply.readException();
4975 data.recycle();
4976 reply.recycle();
4977 }
4978
4979 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4980 Parcel data = Parcel.obtain();
4981 Parcel reply = Parcel.obtain();
4982 data.writeInterfaceToken(IActivityManager.descriptor);
4983 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4984 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4985 reply.readException();
4986 data.recycle();
4987 reply.recycle();
4988 }
4989
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004990 public void requestBugReport() throws RemoteException {
4991 Parcel data = Parcel.obtain();
4992 Parcel reply = Parcel.obtain();
4993 data.writeInterfaceToken(IActivityManager.descriptor);
4994 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4995 reply.readException();
4996 data.recycle();
4997 reply.recycle();
4998 }
4999
Jeff Brownbd181bb2013-09-10 16:44:24 -07005000 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5001 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005002 Parcel data = Parcel.obtain();
5003 Parcel reply = Parcel.obtain();
5004 data.writeInterfaceToken(IActivityManager.descriptor);
5005 data.writeInt(pid);
5006 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005007 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005008 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5009 reply.readException();
5010 long res = reply.readInt();
5011 data.recycle();
5012 reply.recycle();
5013 return res;
5014 }
5015
Adam Skorydfc7fd72013-08-05 19:23:41 -07005016 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005017 Parcel data = Parcel.obtain();
5018 Parcel reply = Parcel.obtain();
5019 data.writeInterfaceToken(IActivityManager.descriptor);
5020 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005021 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005022 reply.readException();
5023 Bundle res = reply.readBundle();
5024 data.recycle();
5025 reply.recycle();
5026 return res;
5027 }
5028
Adam Skory7140a252013-09-11 12:04:58 +01005029 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005030 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005031 Parcel data = Parcel.obtain();
5032 Parcel reply = Parcel.obtain();
5033 data.writeInterfaceToken(IActivityManager.descriptor);
5034 data.writeStrongBinder(token);
5035 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005036 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005037 reply.readException();
5038 data.recycle();
5039 reply.recycle();
5040 }
5041
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005042 public void killUid(int uid, String reason) throws RemoteException {
5043 Parcel data = Parcel.obtain();
5044 Parcel reply = Parcel.obtain();
5045 data.writeInterfaceToken(IActivityManager.descriptor);
5046 data.writeInt(uid);
5047 data.writeString(reason);
5048 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5049 reply.readException();
5050 data.recycle();
5051 reply.recycle();
5052 }
5053
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005054 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5055 Parcel data = Parcel.obtain();
5056 Parcel reply = Parcel.obtain();
5057 data.writeInterfaceToken(IActivityManager.descriptor);
5058 data.writeStrongBinder(who);
5059 data.writeInt(allowRestart ? 1 : 0);
5060 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5061 reply.readException();
5062 data.recycle();
5063 reply.recycle();
5064 }
5065
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005066 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5067 Parcel data = Parcel.obtain();
5068 Parcel reply = Parcel.obtain();
5069 data.writeInterfaceToken(IActivityManager.descriptor);
5070 data.writeStrongBinder(token);
5071 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5072 reply.readException();
5073 data.recycle();
5074 reply.recycle();
5075 }
5076
Craig Mautner5eda9b32013-07-02 11:58:16 -07005077 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5078 Parcel data = Parcel.obtain();
5079 Parcel reply = Parcel.obtain();
5080 data.writeInterfaceToken(IActivityManager.descriptor);
5081 data.writeStrongBinder(token);
5082 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5083 reply.readException();
5084 data.recycle();
5085 reply.recycle();
5086 }
5087
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005088 public void restart() throws RemoteException {
5089 Parcel data = Parcel.obtain();
5090 Parcel reply = Parcel.obtain();
5091 data.writeInterfaceToken(IActivityManager.descriptor);
5092 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5093 reply.readException();
5094 data.recycle();
5095 reply.recycle();
5096 }
5097
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005098 public void performIdleMaintenance() throws RemoteException {
5099 Parcel data = Parcel.obtain();
5100 Parcel reply = Parcel.obtain();
5101 data.writeInterfaceToken(IActivityManager.descriptor);
5102 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5103 reply.readException();
5104 data.recycle();
5105 reply.recycle();
5106 }
5107
Craig Mautner4a1cb222013-12-04 16:14:06 -08005108 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
5109 IActivityContainerCallback callback) throws RemoteException {
5110 Parcel data = Parcel.obtain();
5111 Parcel reply = Parcel.obtain();
5112 data.writeInterfaceToken(IActivityManager.descriptor);
5113 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005114 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08005115 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5116 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005117 final int result = reply.readInt();
5118 final IActivityContainer res;
5119 if (result == 1) {
5120 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5121 } else {
5122 res = null;
5123 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005124 data.recycle();
5125 reply.recycle();
5126 return res;
5127 }
5128
Craig Mautner95da1082014-02-24 17:54:35 -08005129 public void deleteActivityContainer(IActivityContainer activityContainer)
5130 throws RemoteException {
5131 Parcel data = Parcel.obtain();
5132 Parcel reply = Parcel.obtain();
5133 data.writeInterfaceToken(IActivityManager.descriptor);
5134 data.writeStrongBinder(activityContainer.asBinder());
5135 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5136 reply.readException();
5137 data.recycle();
5138 reply.recycle();
5139 }
5140
Craig Mautnere0a38842013-12-16 16:14:02 -08005141 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
5142 throws RemoteException {
5143 Parcel data = Parcel.obtain();
5144 Parcel reply = Parcel.obtain();
5145 data.writeInterfaceToken(IActivityManager.descriptor);
5146 data.writeStrongBinder(activityToken);
5147 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5148 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005149 final int result = reply.readInt();
5150 final IActivityContainer res;
5151 if (result == 1) {
5152 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5153 } else {
5154 res = null;
5155 }
Craig Mautnere0a38842013-12-16 16:14:02 -08005156 data.recycle();
5157 reply.recycle();
5158 return res;
5159 }
5160
Craig Mautner4a1cb222013-12-04 16:14:06 -08005161 public IBinder getHomeActivityToken() throws RemoteException {
5162 Parcel data = Parcel.obtain();
5163 Parcel reply = Parcel.obtain();
5164 data.writeInterfaceToken(IActivityManager.descriptor);
5165 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5166 reply.readException();
5167 IBinder res = reply.readStrongBinder();
5168 data.recycle();
5169 reply.recycle();
5170 return res;
5171 }
5172
Craig Mautneraea74a52014-03-08 14:23:10 -08005173 @Override
5174 public void startLockTaskMode(int taskId) throws RemoteException {
5175 Parcel data = Parcel.obtain();
5176 Parcel reply = Parcel.obtain();
5177 data.writeInterfaceToken(IActivityManager.descriptor);
5178 data.writeInt(taskId);
5179 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5180 reply.readException();
5181 data.recycle();
5182 reply.recycle();
5183 }
5184
5185 @Override
5186 public void startLockTaskMode(IBinder token) throws RemoteException {
5187 Parcel data = Parcel.obtain();
5188 Parcel reply = Parcel.obtain();
5189 data.writeInterfaceToken(IActivityManager.descriptor);
5190 data.writeStrongBinder(token);
5191 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5192 reply.readException();
5193 data.recycle();
5194 reply.recycle();
5195 }
5196
5197 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005198 public void startLockTaskModeOnCurrent() throws RemoteException {
5199 Parcel data = Parcel.obtain();
5200 Parcel reply = Parcel.obtain();
5201 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005202 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005203 reply.readException();
5204 data.recycle();
5205 reply.recycle();
5206 }
5207
5208 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005209 public void stopLockTaskMode() throws RemoteException {
5210 Parcel data = Parcel.obtain();
5211 Parcel reply = Parcel.obtain();
5212 data.writeInterfaceToken(IActivityManager.descriptor);
5213 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5214 reply.readException();
5215 data.recycle();
5216 reply.recycle();
5217 }
5218
5219 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005220 public void stopLockTaskModeOnCurrent() throws RemoteException {
5221 Parcel data = Parcel.obtain();
5222 Parcel reply = Parcel.obtain();
5223 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005224 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005225 reply.readException();
5226 data.recycle();
5227 reply.recycle();
5228 }
5229
5230 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005231 public boolean isInLockTaskMode() throws RemoteException {
5232 Parcel data = Parcel.obtain();
5233 Parcel reply = Parcel.obtain();
5234 data.writeInterfaceToken(IActivityManager.descriptor);
5235 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5236 reply.readException();
5237 boolean isInLockTaskMode = reply.readInt() == 1;
5238 data.recycle();
5239 reply.recycle();
5240 return isInLockTaskMode;
5241 }
5242
Craig Mautner688b5102014-03-27 16:55:03 -07005243 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005244 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005245 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005246 Parcel data = Parcel.obtain();
5247 Parcel reply = Parcel.obtain();
5248 data.writeInterfaceToken(IActivityManager.descriptor);
5249 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005250 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005251 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005252 reply.readException();
5253 data.recycle();
5254 reply.recycle();
5255 }
5256
Craig Mautneree2e45a2014-06-27 12:10:03 -07005257 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005258 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5259 Parcel data = Parcel.obtain();
5260 Parcel reply = Parcel.obtain();
5261 data.writeInterfaceToken(IActivityManager.descriptor);
5262 data.writeString(filename);
5263 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5264 reply.readException();
5265 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5266 data.recycle();
5267 reply.recycle();
5268 return icon;
5269 }
5270
5271 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005272 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005273 Parcel data = Parcel.obtain();
5274 Parcel reply = Parcel.obtain();
5275 data.writeInterfaceToken(IActivityManager.descriptor);
5276 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005277 data.writeInt(visible ? 1 : 0);
5278 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005279 reply.readException();
5280 boolean success = reply.readInt() > 0;
5281 data.recycle();
5282 reply.recycle();
5283 return success;
5284 }
5285
5286 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005287 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005288 Parcel data = Parcel.obtain();
5289 Parcel reply = Parcel.obtain();
5290 data.writeInterfaceToken(IActivityManager.descriptor);
5291 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005292 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005293 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005294 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005295 data.recycle();
5296 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005297 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005298 }
5299
5300 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005301 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005302 Parcel data = Parcel.obtain();
5303 Parcel reply = Parcel.obtain();
5304 data.writeInterfaceToken(IActivityManager.descriptor);
5305 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005306 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5307 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005308 reply.readException();
5309 data.recycle();
5310 reply.recycle();
5311 }
5312
5313 @Override
5314 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5315 Parcel data = Parcel.obtain();
5316 Parcel reply = Parcel.obtain();
5317 data.writeInterfaceToken(IActivityManager.descriptor);
5318 data.writeStrongBinder(token);
5319 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5320 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005321 reply.readException();
5322 data.recycle();
5323 reply.recycle();
5324 }
5325
Craig Mautner8746a472014-07-24 15:12:54 -07005326 @Override
5327 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5328 Parcel data = Parcel.obtain();
5329 Parcel reply = Parcel.obtain();
5330 data.writeInterfaceToken(IActivityManager.descriptor);
5331 data.writeStrongBinder(token);
5332 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5333 IBinder.FLAG_ONEWAY);
5334 reply.readException();
5335 data.recycle();
5336 reply.recycle();
5337 }
5338
Craig Mautner6e2f3952014-09-09 14:26:41 -07005339 @Override
5340 public void bootAnimationComplete() throws RemoteException {
5341 Parcel data = Parcel.obtain();
5342 Parcel reply = Parcel.obtain();
5343 data.writeInterfaceToken(IActivityManager.descriptor);
5344 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5345 reply.readException();
5346 data.recycle();
5347 reply.recycle();
5348 }
5349
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005350 private IBinder mRemote;
5351}