blob: 677fcef8d01a983536b12b3d5942740c69a5f87f [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
Jeff Hao1b012d32014-08-20 10:35:34 -070020import android.app.ProfilerInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070022import android.content.IIntentReceiver;
23import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.content.Intent;
25import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070026import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070027import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070028import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.pm.ConfigurationInfo;
30import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070031import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070032import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070034import android.graphics.Bitmap;
35import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080036import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080037import android.net.Uri;
38import android.os.Binder;
39import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070040import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.os.IBinder;
42import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070043import android.os.ParcelFileDescriptor;
44import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070045import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070046import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070048import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070049import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080052import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070053import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055import java.util.ArrayList;
56import java.util.List;
57
58/** {@hide} */
59public abstract class ActivityManagerNative extends Binder implements IActivityManager
60{
61 /**
62 * Cast a Binder object into an activity manager interface, generating
63 * a proxy if needed.
64 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 if (obj == null) {
67 return null;
68 }
69 IActivityManager in =
70 (IActivityManager)obj.queryLocalInterface(descriptor);
71 if (in != null) {
72 return in;
73 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 return new ActivityManagerProxy(obj);
76 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080077
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 /**
79 * Retrieve the system's default/global activity manager.
80 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080081 static public IActivityManager getDefault() {
82 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 }
84
85 /**
86 * Convenience for checking whether the system is ready. For internal use only.
87 */
88 static public boolean isSystemReady() {
89 if (!sSystemReady) {
90 sSystemReady = getDefault().testIsSystemReady();
91 }
92 return sSystemReady;
93 }
94 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080095
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 /**
97 * Convenience for sending a sticky broadcast. For internal use only.
98 * If you don't care about permission, use null.
99 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -0700100 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800101 try {
102 getDefault().broadcastIntent(
103 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800104 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105 } catch (RemoteException ex) {
106 }
107 }
108
Dianne Hackborn099bc622014-01-22 13:39:16 -0800109 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800111 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800116 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117 attachInterface(this, descriptor);
118 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700119
120 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800121 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
122 throws RemoteException {
123 switch (code) {
124 case START_ACTIVITY_TRANSACTION:
125 {
126 data.enforceInterface(IActivityManager.descriptor);
127 IBinder b = data.readStrongBinder();
128 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800129 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 Intent intent = Intent.CREATOR.createFromParcel(data);
131 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800133 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700135 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700136 ProfilerInfo profilerInfo = data.readInt() != 0
137 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700138 Bundle options = data.readInt() != 0
139 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800140 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700141 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 reply.writeNoException();
143 reply.writeInt(result);
144 return true;
145 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700146
Amith Yamasani82644082012-08-03 13:09:11 -0700147 case START_ACTIVITY_AS_USER_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
155 IBinder resultTo = data.readStrongBinder();
156 String resultWho = data.readString();
157 int requestCode = data.readInt();
158 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700159 ProfilerInfo profilerInfo = data.readInt() != 0
160 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
163 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800164 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700165 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700166 reply.writeNoException();
167 reply.writeInt(result);
168 return true;
169 }
170
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700171 case START_ACTIVITY_AS_CALLER_TRANSACTION:
172 {
173 data.enforceInterface(IActivityManager.descriptor);
174 IBinder b = data.readStrongBinder();
175 IApplicationThread app = ApplicationThreadNative.asInterface(b);
176 String callingPackage = data.readString();
177 Intent intent = Intent.CREATOR.createFromParcel(data);
178 String resolvedType = data.readString();
179 IBinder resultTo = data.readStrongBinder();
180 String resultWho = data.readString();
181 int requestCode = data.readInt();
182 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700183 ProfilerInfo profilerInfo = data.readInt() != 0
184 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700185 Bundle options = data.readInt() != 0
186 ? Bundle.CREATOR.createFromParcel(data) : null;
187 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700188 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700189 reply.writeNoException();
190 reply.writeInt(result);
191 return true;
192 }
193
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800194 case START_ACTIVITY_AND_WAIT_TRANSACTION:
195 {
196 data.enforceInterface(IActivityManager.descriptor);
197 IBinder b = data.readStrongBinder();
198 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800199 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800200 Intent intent = Intent.CREATOR.createFromParcel(data);
201 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800202 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800203 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800204 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700205 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700206 ProfilerInfo profilerInfo = data.readInt() != 0
207 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700208 Bundle options = data.readInt() != 0
209 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700210 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800211 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700212 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800213 reply.writeNoException();
214 result.writeToParcel(reply, 0);
215 return true;
216 }
217
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700218 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
219 {
220 data.enforceInterface(IActivityManager.descriptor);
221 IBinder b = data.readStrongBinder();
222 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800223 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700224 Intent intent = Intent.CREATOR.createFromParcel(data);
225 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700226 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700227 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700228 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700229 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700230 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 Bundle options = data.readInt() != 0
232 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700233 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800234 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700235 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700236 reply.writeNoException();
237 reply.writeInt(result);
238 return true;
239 }
240
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700241 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700242 {
243 data.enforceInterface(IActivityManager.descriptor);
244 IBinder b = data.readStrongBinder();
245 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700246 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700247 Intent fillInIntent = null;
248 if (data.readInt() != 0) {
249 fillInIntent = Intent.CREATOR.createFromParcel(data);
250 }
251 String resolvedType = data.readString();
252 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700253 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700254 int requestCode = data.readInt();
255 int flagsMask = data.readInt();
256 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700257 Bundle options = data.readInt() != 0
258 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700259 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700260 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700261 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700262 reply.writeNoException();
263 reply.writeInt(result);
264 return true;
265 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700266
Dianne Hackborn91097de2014-04-04 18:02:06 -0700267 case START_VOICE_ACTIVITY_TRANSACTION:
268 {
269 data.enforceInterface(IActivityManager.descriptor);
270 String callingPackage = data.readString();
271 int callingPid = data.readInt();
272 int callingUid = data.readInt();
273 Intent intent = Intent.CREATOR.createFromParcel(data);
274 String resolvedType = data.readString();
275 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
276 data.readStrongBinder());
277 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
278 data.readStrongBinder());
279 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700280 ProfilerInfo profilerInfo = data.readInt() != 0
281 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700282 Bundle options = data.readInt() != 0
283 ? Bundle.CREATOR.createFromParcel(data) : null;
284 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700285 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
286 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700287 reply.writeNoException();
288 reply.writeInt(result);
289 return true;
290 }
291
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800292 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
293 {
294 data.enforceInterface(IActivityManager.descriptor);
295 IBinder callingActivity = data.readStrongBinder();
296 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700297 Bundle options = data.readInt() != 0
298 ? Bundle.CREATOR.createFromParcel(data) : null;
299 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800300 reply.writeNoException();
301 reply.writeInt(result ? 1 : 0);
302 return true;
303 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700304
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700305 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
306 {
307 data.enforceInterface(IActivityManager.descriptor);
308 int taskId = data.readInt();
309 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
310 int result = startActivityFromRecents(taskId, options);
311 reply.writeNoException();
312 reply.writeInt(result);
313 return true;
314 }
315
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800316 case FINISH_ACTIVITY_TRANSACTION: {
317 data.enforceInterface(IActivityManager.descriptor);
318 IBinder token = data.readStrongBinder();
319 Intent resultData = null;
320 int resultCode = data.readInt();
321 if (data.readInt() != 0) {
322 resultData = Intent.CREATOR.createFromParcel(data);
323 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700324 boolean finishTask = (data.readInt() != 0);
325 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 reply.writeNoException();
327 reply.writeInt(res ? 1 : 0);
328 return true;
329 }
330
331 case FINISH_SUB_ACTIVITY_TRANSACTION: {
332 data.enforceInterface(IActivityManager.descriptor);
333 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700334 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800335 int requestCode = data.readInt();
336 finishSubActivity(token, resultWho, requestCode);
337 reply.writeNoException();
338 return true;
339 }
340
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700341 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
342 data.enforceInterface(IActivityManager.descriptor);
343 IBinder token = data.readStrongBinder();
344 boolean res = finishActivityAffinity(token);
345 reply.writeNoException();
346 reply.writeInt(res ? 1 : 0);
347 return true;
348 }
349
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700350 case FINISH_VOICE_TASK_TRANSACTION: {
351 data.enforceInterface(IActivityManager.descriptor);
352 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
353 data.readStrongBinder());
354 finishVoiceTask(session);
355 reply.writeNoException();
356 return true;
357 }
358
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700359 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
360 data.enforceInterface(IActivityManager.descriptor);
361 IBinder token = data.readStrongBinder();
362 boolean res = releaseActivityInstance(token);
363 reply.writeNoException();
364 reply.writeInt(res ? 1 : 0);
365 return true;
366 }
367
368 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
369 data.enforceInterface(IActivityManager.descriptor);
370 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
371 releaseSomeActivities(app);
372 reply.writeNoException();
373 return true;
374 }
375
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800376 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
377 data.enforceInterface(IActivityManager.descriptor);
378 IBinder token = data.readStrongBinder();
379 boolean res = willActivityBeVisible(token);
380 reply.writeNoException();
381 reply.writeInt(res ? 1 : 0);
382 return true;
383 }
384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 case REGISTER_RECEIVER_TRANSACTION:
386 {
387 data.enforceInterface(IActivityManager.descriptor);
388 IBinder b = data.readStrongBinder();
389 IApplicationThread app =
390 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700391 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800392 b = data.readStrongBinder();
393 IIntentReceiver rec
394 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
395 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
396 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700397 int userId = data.readInt();
398 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800399 reply.writeNoException();
400 if (intent != null) {
401 reply.writeInt(1);
402 intent.writeToParcel(reply, 0);
403 } else {
404 reply.writeInt(0);
405 }
406 return true;
407 }
408
409 case UNREGISTER_RECEIVER_TRANSACTION:
410 {
411 data.enforceInterface(IActivityManager.descriptor);
412 IBinder b = data.readStrongBinder();
413 if (b == null) {
414 return true;
415 }
416 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
417 unregisterReceiver(rec);
418 reply.writeNoException();
419 return true;
420 }
421
422 case BROADCAST_INTENT_TRANSACTION:
423 {
424 data.enforceInterface(IActivityManager.descriptor);
425 IBinder b = data.readStrongBinder();
426 IApplicationThread app =
427 b != null ? ApplicationThreadNative.asInterface(b) : null;
428 Intent intent = Intent.CREATOR.createFromParcel(data);
429 String resolvedType = data.readString();
430 b = data.readStrongBinder();
431 IIntentReceiver resultTo =
432 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
433 int resultCode = data.readInt();
434 String resultData = data.readString();
435 Bundle resultExtras = data.readBundle();
436 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800437 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800438 boolean serialized = data.readInt() != 0;
439 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700440 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800441 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800442 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700443 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800444 reply.writeNoException();
445 reply.writeInt(res);
446 return true;
447 }
448
449 case UNBROADCAST_INTENT_TRANSACTION:
450 {
451 data.enforceInterface(IActivityManager.descriptor);
452 IBinder b = data.readStrongBinder();
453 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
454 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700455 int userId = data.readInt();
456 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800457 reply.writeNoException();
458 return true;
459 }
460
461 case FINISH_RECEIVER_TRANSACTION: {
462 data.enforceInterface(IActivityManager.descriptor);
463 IBinder who = data.readStrongBinder();
464 int resultCode = data.readInt();
465 String resultData = data.readString();
466 Bundle resultExtras = data.readBundle();
467 boolean resultAbort = data.readInt() != 0;
468 if (who != null) {
469 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
470 }
471 reply.writeNoException();
472 return true;
473 }
474
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800475 case ATTACH_APPLICATION_TRANSACTION: {
476 data.enforceInterface(IActivityManager.descriptor);
477 IApplicationThread app = ApplicationThreadNative.asInterface(
478 data.readStrongBinder());
479 if (app != null) {
480 attachApplication(app);
481 }
482 reply.writeNoException();
483 return true;
484 }
485
486 case ACTIVITY_IDLE_TRANSACTION: {
487 data.enforceInterface(IActivityManager.descriptor);
488 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700489 Configuration config = null;
490 if (data.readInt() != 0) {
491 config = Configuration.CREATOR.createFromParcel(data);
492 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700493 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700495 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800496 }
497 reply.writeNoException();
498 return true;
499 }
500
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700501 case ACTIVITY_RESUMED_TRANSACTION: {
502 data.enforceInterface(IActivityManager.descriptor);
503 IBinder token = data.readStrongBinder();
504 activityResumed(token);
505 reply.writeNoException();
506 return true;
507 }
508
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800509 case ACTIVITY_PAUSED_TRANSACTION: {
510 data.enforceInterface(IActivityManager.descriptor);
511 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700512 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800513 reply.writeNoException();
514 return true;
515 }
516
517 case ACTIVITY_STOPPED_TRANSACTION: {
518 data.enforceInterface(IActivityManager.descriptor);
519 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800520 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700521 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800522 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700523 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800524 reply.writeNoException();
525 return true;
526 }
527
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800528 case ACTIVITY_SLEPT_TRANSACTION: {
529 data.enforceInterface(IActivityManager.descriptor);
530 IBinder token = data.readStrongBinder();
531 activitySlept(token);
532 reply.writeNoException();
533 return true;
534 }
535
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800536 case ACTIVITY_DESTROYED_TRANSACTION: {
537 data.enforceInterface(IActivityManager.descriptor);
538 IBinder token = data.readStrongBinder();
539 activityDestroyed(token);
540 reply.writeNoException();
541 return true;
542 }
543
544 case GET_CALLING_PACKAGE_TRANSACTION: {
545 data.enforceInterface(IActivityManager.descriptor);
546 IBinder token = data.readStrongBinder();
547 String res = token != null ? getCallingPackage(token) : null;
548 reply.writeNoException();
549 reply.writeString(res);
550 return true;
551 }
552
553 case GET_CALLING_ACTIVITY_TRANSACTION: {
554 data.enforceInterface(IActivityManager.descriptor);
555 IBinder token = data.readStrongBinder();
556 ComponentName cn = getCallingActivity(token);
557 reply.writeNoException();
558 ComponentName.writeToParcel(cn, reply);
559 return true;
560 }
561
Winson Chung1147c402014-05-14 11:05:00 -0700562 case GET_APP_TASKS_TRANSACTION: {
563 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700564 String callingPackage = data.readString();
565 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700566 reply.writeNoException();
567 int N = list != null ? list.size() : -1;
568 reply.writeInt(N);
569 int i;
570 for (i=0; i<N; i++) {
571 IAppTask task = list.get(i);
572 reply.writeStrongBinder(task.asBinder());
573 }
574 return true;
575 }
576
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700577 case ADD_APP_TASK_TRANSACTION: {
578 data.enforceInterface(IActivityManager.descriptor);
579 IBinder activityToken = data.readStrongBinder();
580 Intent intent = Intent.CREATOR.createFromParcel(data);
581 ActivityManager.TaskDescription descr
582 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
583 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
584 int res = addAppTask(activityToken, intent, descr, thumbnail);
585 reply.writeNoException();
586 reply.writeInt(res);
587 return true;
588 }
589
590 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
591 data.enforceInterface(IActivityManager.descriptor);
592 Point size = getAppTaskThumbnailSize();
593 reply.writeNoException();
594 size.writeToParcel(reply, 0);
595 return true;
596 }
597
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800598 case GET_TASKS_TRANSACTION: {
599 data.enforceInterface(IActivityManager.descriptor);
600 int maxNum = data.readInt();
601 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700602 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800603 reply.writeNoException();
604 int N = list != null ? list.size() : -1;
605 reply.writeInt(N);
606 int i;
607 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700608 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800609 info.writeToParcel(reply, 0);
610 }
611 return true;
612 }
613
614 case GET_RECENT_TASKS_TRANSACTION: {
615 data.enforceInterface(IActivityManager.descriptor);
616 int maxNum = data.readInt();
617 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700618 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800619 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700620 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800621 reply.writeNoException();
622 reply.writeTypedList(list);
623 return true;
624 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700625
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700626 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800627 data.enforceInterface(IActivityManager.descriptor);
628 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700629 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800630 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700631 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800632 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700633 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700634 } else {
635 reply.writeInt(0);
636 }
637 return true;
638 }
639
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 case GET_SERVICES_TRANSACTION: {
641 data.enforceInterface(IActivityManager.descriptor);
642 int maxNum = data.readInt();
643 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700644 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800645 reply.writeNoException();
646 int N = list != null ? list.size() : -1;
647 reply.writeInt(N);
648 int i;
649 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700650 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800651 info.writeToParcel(reply, 0);
652 }
653 return true;
654 }
655
656 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
657 data.enforceInterface(IActivityManager.descriptor);
658 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
659 reply.writeNoException();
660 reply.writeTypedList(list);
661 return true;
662 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700663
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800664 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
665 data.enforceInterface(IActivityManager.descriptor);
666 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
667 reply.writeNoException();
668 reply.writeTypedList(list);
669 return true;
670 }
671
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700672 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
673 data.enforceInterface(IActivityManager.descriptor);
674 List<ApplicationInfo> list = getRunningExternalApplications();
675 reply.writeNoException();
676 reply.writeTypedList(list);
677 return true;
678 }
679
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800680 case MOVE_TASK_TO_FRONT_TRANSACTION: {
681 data.enforceInterface(IActivityManager.descriptor);
682 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800683 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700684 Bundle options = data.readInt() != 0
685 ? Bundle.CREATOR.createFromParcel(data) : null;
686 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800687 reply.writeNoException();
688 return true;
689 }
690
691 case MOVE_TASK_TO_BACK_TRANSACTION: {
692 data.enforceInterface(IActivityManager.descriptor);
693 int task = data.readInt();
694 moveTaskToBack(task);
695 reply.writeNoException();
696 return true;
697 }
698
699 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
700 data.enforceInterface(IActivityManager.descriptor);
701 IBinder token = data.readStrongBinder();
702 boolean nonRoot = data.readInt() != 0;
703 boolean res = moveActivityTaskToBack(token, nonRoot);
704 reply.writeNoException();
705 reply.writeInt(res ? 1 : 0);
706 return true;
707 }
708
709 case MOVE_TASK_BACKWARDS_TRANSACTION: {
710 data.enforceInterface(IActivityManager.descriptor);
711 int task = data.readInt();
712 moveTaskBackwards(task);
713 reply.writeNoException();
714 return true;
715 }
716
Craig Mautnerc00204b2013-03-05 15:02:14 -0800717 case MOVE_TASK_TO_STACK_TRANSACTION: {
718 data.enforceInterface(IActivityManager.descriptor);
719 int taskId = data.readInt();
720 int stackId = data.readInt();
721 boolean toTop = data.readInt() != 0;
722 moveTaskToStack(taskId, stackId, toTop);
723 reply.writeNoException();
724 return true;
725 }
726
727 case RESIZE_STACK_TRANSACTION: {
728 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800729 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800730 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800731 Rect r = Rect.CREATOR.createFromParcel(data);
732 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800733 reply.writeNoException();
734 return true;
735 }
736
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800737 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700738 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800739 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700740 reply.writeNoException();
741 reply.writeTypedList(list);
742 return true;
743 }
744
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800745 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700746 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800747 int stackId = data.readInt();
748 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700749 reply.writeNoException();
750 if (info != null) {
751 reply.writeInt(1);
752 info.writeToParcel(reply, 0);
753 } else {
754 reply.writeInt(0);
755 }
756 return true;
757 }
758
Winson Chung303e1ff2014-03-07 15:06:19 -0800759 case IS_IN_HOME_STACK_TRANSACTION: {
760 data.enforceInterface(IActivityManager.descriptor);
761 int taskId = data.readInt();
762 boolean isInHomeStack = isInHomeStack(taskId);
763 reply.writeNoException();
764 reply.writeInt(isInHomeStack ? 1 : 0);
765 return true;
766 }
767
Craig Mautnercf910b02013-04-23 11:23:27 -0700768 case SET_FOCUSED_STACK_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 int stackId = data.readInt();
771 setFocusedStack(stackId);
772 reply.writeNoException();
773 return true;
774 }
775
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800776 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
777 data.enforceInterface(IActivityManager.descriptor);
778 IBinder token = data.readStrongBinder();
779 boolean onlyRoot = data.readInt() != 0;
780 int res = token != null
781 ? getTaskForActivity(token, onlyRoot) : -1;
782 reply.writeNoException();
783 reply.writeInt(res);
784 return true;
785 }
786
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800787 case GET_CONTENT_PROVIDER_TRANSACTION: {
788 data.enforceInterface(IActivityManager.descriptor);
789 IBinder b = data.readStrongBinder();
790 IApplicationThread app = ApplicationThreadNative.asInterface(b);
791 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700792 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700793 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700794 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800795 reply.writeNoException();
796 if (cph != null) {
797 reply.writeInt(1);
798 cph.writeToParcel(reply, 0);
799 } else {
800 reply.writeInt(0);
801 }
802 return true;
803 }
804
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800805 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
806 data.enforceInterface(IActivityManager.descriptor);
807 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700808 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800809 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700810 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800811 reply.writeNoException();
812 if (cph != null) {
813 reply.writeInt(1);
814 cph.writeToParcel(reply, 0);
815 } else {
816 reply.writeInt(0);
817 }
818 return true;
819 }
820
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800821 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
822 data.enforceInterface(IActivityManager.descriptor);
823 IBinder b = data.readStrongBinder();
824 IApplicationThread app = ApplicationThreadNative.asInterface(b);
825 ArrayList<ContentProviderHolder> providers =
826 data.createTypedArrayList(ContentProviderHolder.CREATOR);
827 publishContentProviders(app, providers);
828 reply.writeNoException();
829 return true;
830 }
831
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700832 case REF_CONTENT_PROVIDER_TRANSACTION: {
833 data.enforceInterface(IActivityManager.descriptor);
834 IBinder b = data.readStrongBinder();
835 int stable = data.readInt();
836 int unstable = data.readInt();
837 boolean res = refContentProvider(b, stable, unstable);
838 reply.writeNoException();
839 reply.writeInt(res ? 1 : 0);
840 return true;
841 }
842
843 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
844 data.enforceInterface(IActivityManager.descriptor);
845 IBinder b = data.readStrongBinder();
846 unstableProviderDied(b);
847 reply.writeNoException();
848 return true;
849 }
850
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700851 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
852 data.enforceInterface(IActivityManager.descriptor);
853 IBinder b = data.readStrongBinder();
854 appNotRespondingViaProvider(b);
855 reply.writeNoException();
856 return true;
857 }
858
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800859 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
860 data.enforceInterface(IActivityManager.descriptor);
861 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700862 boolean stable = data.readInt() != 0;
863 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800864 reply.writeNoException();
865 return true;
866 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800867
868 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
869 data.enforceInterface(IActivityManager.descriptor);
870 String name = data.readString();
871 IBinder token = data.readStrongBinder();
872 removeContentProviderExternal(name, token);
873 reply.writeNoException();
874 return true;
875 }
876
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700877 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
878 data.enforceInterface(IActivityManager.descriptor);
879 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
880 PendingIntent pi = getRunningServiceControlPanel(comp);
881 reply.writeNoException();
882 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
883 return true;
884 }
885
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800886 case START_SERVICE_TRANSACTION: {
887 data.enforceInterface(IActivityManager.descriptor);
888 IBinder b = data.readStrongBinder();
889 IApplicationThread app = ApplicationThreadNative.asInterface(b);
890 Intent service = Intent.CREATOR.createFromParcel(data);
891 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700892 int userId = data.readInt();
893 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800894 reply.writeNoException();
895 ComponentName.writeToParcel(cn, reply);
896 return true;
897 }
898
899 case STOP_SERVICE_TRANSACTION: {
900 data.enforceInterface(IActivityManager.descriptor);
901 IBinder b = data.readStrongBinder();
902 IApplicationThread app = ApplicationThreadNative.asInterface(b);
903 Intent service = Intent.CREATOR.createFromParcel(data);
904 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700905 int userId = data.readInt();
906 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800907 reply.writeNoException();
908 reply.writeInt(res);
909 return true;
910 }
911
912 case STOP_SERVICE_TOKEN_TRANSACTION: {
913 data.enforceInterface(IActivityManager.descriptor);
914 ComponentName className = ComponentName.readFromParcel(data);
915 IBinder token = data.readStrongBinder();
916 int startId = data.readInt();
917 boolean res = stopServiceToken(className, token, startId);
918 reply.writeNoException();
919 reply.writeInt(res ? 1 : 0);
920 return true;
921 }
922
923 case SET_SERVICE_FOREGROUND_TRANSACTION: {
924 data.enforceInterface(IActivityManager.descriptor);
925 ComponentName className = ComponentName.readFromParcel(data);
926 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700927 int id = data.readInt();
928 Notification notification = null;
929 if (data.readInt() != 0) {
930 notification = Notification.CREATOR.createFromParcel(data);
931 }
932 boolean removeNotification = data.readInt() != 0;
933 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800934 reply.writeNoException();
935 return true;
936 }
937
938 case BIND_SERVICE_TRANSACTION: {
939 data.enforceInterface(IActivityManager.descriptor);
940 IBinder b = data.readStrongBinder();
941 IApplicationThread app = ApplicationThreadNative.asInterface(b);
942 IBinder token = data.readStrongBinder();
943 Intent service = Intent.CREATOR.createFromParcel(data);
944 String resolvedType = data.readString();
945 b = data.readStrongBinder();
946 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800947 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800948 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800949 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800950 reply.writeNoException();
951 reply.writeInt(res);
952 return true;
953 }
954
955 case UNBIND_SERVICE_TRANSACTION: {
956 data.enforceInterface(IActivityManager.descriptor);
957 IBinder b = data.readStrongBinder();
958 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
959 boolean res = unbindService(conn);
960 reply.writeNoException();
961 reply.writeInt(res ? 1 : 0);
962 return true;
963 }
964
965 case PUBLISH_SERVICE_TRANSACTION: {
966 data.enforceInterface(IActivityManager.descriptor);
967 IBinder token = data.readStrongBinder();
968 Intent intent = Intent.CREATOR.createFromParcel(data);
969 IBinder service = data.readStrongBinder();
970 publishService(token, intent, service);
971 reply.writeNoException();
972 return true;
973 }
974
975 case UNBIND_FINISHED_TRANSACTION: {
976 data.enforceInterface(IActivityManager.descriptor);
977 IBinder token = data.readStrongBinder();
978 Intent intent = Intent.CREATOR.createFromParcel(data);
979 boolean doRebind = data.readInt() != 0;
980 unbindFinished(token, intent, doRebind);
981 reply.writeNoException();
982 return true;
983 }
984
985 case SERVICE_DONE_EXECUTING_TRANSACTION: {
986 data.enforceInterface(IActivityManager.descriptor);
987 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700988 int type = data.readInt();
989 int startId = data.readInt();
990 int res = data.readInt();
991 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800992 reply.writeNoException();
993 return true;
994 }
995
996 case START_INSTRUMENTATION_TRANSACTION: {
997 data.enforceInterface(IActivityManager.descriptor);
998 ComponentName className = ComponentName.readFromParcel(data);
999 String profileFile = data.readString();
1000 int fl = data.readInt();
1001 Bundle arguments = data.readBundle();
1002 IBinder b = data.readStrongBinder();
1003 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001004 b = data.readStrongBinder();
1005 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001006 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001007 String abiOverride = data.readString();
1008 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1009 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001010 reply.writeNoException();
1011 reply.writeInt(res ? 1 : 0);
1012 return true;
1013 }
1014
1015
1016 case FINISH_INSTRUMENTATION_TRANSACTION: {
1017 data.enforceInterface(IActivityManager.descriptor);
1018 IBinder b = data.readStrongBinder();
1019 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1020 int resultCode = data.readInt();
1021 Bundle results = data.readBundle();
1022 finishInstrumentation(app, resultCode, results);
1023 reply.writeNoException();
1024 return true;
1025 }
1026
1027 case GET_CONFIGURATION_TRANSACTION: {
1028 data.enforceInterface(IActivityManager.descriptor);
1029 Configuration config = getConfiguration();
1030 reply.writeNoException();
1031 config.writeToParcel(reply, 0);
1032 return true;
1033 }
1034
1035 case UPDATE_CONFIGURATION_TRANSACTION: {
1036 data.enforceInterface(IActivityManager.descriptor);
1037 Configuration config = Configuration.CREATOR.createFromParcel(data);
1038 updateConfiguration(config);
1039 reply.writeNoException();
1040 return true;
1041 }
1042
1043 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1044 data.enforceInterface(IActivityManager.descriptor);
1045 IBinder token = data.readStrongBinder();
1046 int requestedOrientation = data.readInt();
1047 setRequestedOrientation(token, requestedOrientation);
1048 reply.writeNoException();
1049 return true;
1050 }
1051
1052 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1053 data.enforceInterface(IActivityManager.descriptor);
1054 IBinder token = data.readStrongBinder();
1055 int req = getRequestedOrientation(token);
1056 reply.writeNoException();
1057 reply.writeInt(req);
1058 return true;
1059 }
1060
1061 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1062 data.enforceInterface(IActivityManager.descriptor);
1063 IBinder token = data.readStrongBinder();
1064 ComponentName cn = getActivityClassForToken(token);
1065 reply.writeNoException();
1066 ComponentName.writeToParcel(cn, reply);
1067 return true;
1068 }
1069
1070 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1071 data.enforceInterface(IActivityManager.descriptor);
1072 IBinder token = data.readStrongBinder();
1073 reply.writeNoException();
1074 reply.writeString(getPackageForToken(token));
1075 return true;
1076 }
1077
1078 case GET_INTENT_SENDER_TRANSACTION: {
1079 data.enforceInterface(IActivityManager.descriptor);
1080 int type = data.readInt();
1081 String packageName = data.readString();
1082 IBinder token = data.readStrongBinder();
1083 String resultWho = data.readString();
1084 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001085 Intent[] requestIntents;
1086 String[] requestResolvedTypes;
1087 if (data.readInt() != 0) {
1088 requestIntents = data.createTypedArray(Intent.CREATOR);
1089 requestResolvedTypes = data.createStringArray();
1090 } else {
1091 requestIntents = null;
1092 requestResolvedTypes = null;
1093 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001094 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001095 Bundle options = data.readInt() != 0
1096 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001097 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001098 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001099 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001100 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001101 reply.writeNoException();
1102 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1103 return true;
1104 }
1105
1106 case CANCEL_INTENT_SENDER_TRANSACTION: {
1107 data.enforceInterface(IActivityManager.descriptor);
1108 IIntentSender r = IIntentSender.Stub.asInterface(
1109 data.readStrongBinder());
1110 cancelIntentSender(r);
1111 reply.writeNoException();
1112 return true;
1113 }
1114
1115 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1116 data.enforceInterface(IActivityManager.descriptor);
1117 IIntentSender r = IIntentSender.Stub.asInterface(
1118 data.readStrongBinder());
1119 String res = getPackageForIntentSender(r);
1120 reply.writeNoException();
1121 reply.writeString(res);
1122 return true;
1123 }
1124
Christopher Tatec4a07d12012-04-06 14:19:13 -07001125 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1126 data.enforceInterface(IActivityManager.descriptor);
1127 IIntentSender r = IIntentSender.Stub.asInterface(
1128 data.readStrongBinder());
1129 int res = getUidForIntentSender(r);
1130 reply.writeNoException();
1131 reply.writeInt(res);
1132 return true;
1133 }
1134
Dianne Hackborn41203752012-08-31 14:05:51 -07001135 case HANDLE_INCOMING_USER_TRANSACTION: {
1136 data.enforceInterface(IActivityManager.descriptor);
1137 int callingPid = data.readInt();
1138 int callingUid = data.readInt();
1139 int userId = data.readInt();
1140 boolean allowAll = data.readInt() != 0 ;
1141 boolean requireFull = data.readInt() != 0;
1142 String name = data.readString();
1143 String callerPackage = data.readString();
1144 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1145 requireFull, name, callerPackage);
1146 reply.writeNoException();
1147 reply.writeInt(res);
1148 return true;
1149 }
1150
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 case SET_PROCESS_LIMIT_TRANSACTION: {
1152 data.enforceInterface(IActivityManager.descriptor);
1153 int max = data.readInt();
1154 setProcessLimit(max);
1155 reply.writeNoException();
1156 return true;
1157 }
1158
1159 case GET_PROCESS_LIMIT_TRANSACTION: {
1160 data.enforceInterface(IActivityManager.descriptor);
1161 int limit = getProcessLimit();
1162 reply.writeNoException();
1163 reply.writeInt(limit);
1164 return true;
1165 }
1166
1167 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1168 data.enforceInterface(IActivityManager.descriptor);
1169 IBinder token = data.readStrongBinder();
1170 int pid = data.readInt();
1171 boolean isForeground = data.readInt() != 0;
1172 setProcessForeground(token, pid, isForeground);
1173 reply.writeNoException();
1174 return true;
1175 }
1176
1177 case CHECK_PERMISSION_TRANSACTION: {
1178 data.enforceInterface(IActivityManager.descriptor);
1179 String perm = data.readString();
1180 int pid = data.readInt();
1181 int uid = data.readInt();
1182 int res = checkPermission(perm, pid, uid);
1183 reply.writeNoException();
1184 reply.writeInt(res);
1185 return true;
1186 }
1187
1188 case CHECK_URI_PERMISSION_TRANSACTION: {
1189 data.enforceInterface(IActivityManager.descriptor);
1190 Uri uri = Uri.CREATOR.createFromParcel(data);
1191 int pid = data.readInt();
1192 int uid = data.readInt();
1193 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001194 int userId = data.readInt();
1195 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001196 reply.writeNoException();
1197 reply.writeInt(res);
1198 return true;
1199 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001200
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001201 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001202 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001203 String packageName = data.readString();
1204 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1205 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001206 int userId = data.readInt();
1207 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001208 reply.writeNoException();
1209 reply.writeInt(res ? 1 : 0);
1210 return true;
1211 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001212
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 case GRANT_URI_PERMISSION_TRANSACTION: {
1214 data.enforceInterface(IActivityManager.descriptor);
1215 IBinder b = data.readStrongBinder();
1216 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1217 String targetPkg = data.readString();
1218 Uri uri = Uri.CREATOR.createFromParcel(data);
1219 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001220 int userId = data.readInt();
1221 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001222 reply.writeNoException();
1223 return true;
1224 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001225
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001226 case REVOKE_URI_PERMISSION_TRANSACTION: {
1227 data.enforceInterface(IActivityManager.descriptor);
1228 IBinder b = data.readStrongBinder();
1229 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1230 Uri uri = Uri.CREATOR.createFromParcel(data);
1231 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001232 int userId = data.readInt();
1233 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001234 reply.writeNoException();
1235 return true;
1236 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001237
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001238 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1239 data.enforceInterface(IActivityManager.descriptor);
1240 Uri uri = Uri.CREATOR.createFromParcel(data);
1241 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001242 int userId = data.readInt();
1243 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001244 reply.writeNoException();
1245 return true;
1246 }
1247
1248 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 Uri uri = Uri.CREATOR.createFromParcel(data);
1251 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001252 int userId = data.readInt();
1253 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001254 reply.writeNoException();
1255 return true;
1256 }
1257
1258 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1259 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001260 final String packageName = data.readString();
1261 final boolean incoming = data.readInt() != 0;
1262 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1263 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001264 reply.writeNoException();
1265 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1266 return true;
1267 }
1268
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001269 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1270 data.enforceInterface(IActivityManager.descriptor);
1271 IBinder b = data.readStrongBinder();
1272 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1273 boolean waiting = data.readInt() != 0;
1274 showWaitingForDebugger(app, waiting);
1275 reply.writeNoException();
1276 return true;
1277 }
1278
1279 case GET_MEMORY_INFO_TRANSACTION: {
1280 data.enforceInterface(IActivityManager.descriptor);
1281 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1282 getMemoryInfo(mi);
1283 reply.writeNoException();
1284 mi.writeToParcel(reply, 0);
1285 return true;
1286 }
1287
1288 case UNHANDLED_BACK_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 unhandledBack();
1291 reply.writeNoException();
1292 return true;
1293 }
1294
1295 case OPEN_CONTENT_URI_TRANSACTION: {
1296 data.enforceInterface(IActivityManager.descriptor);
1297 Uri uri = Uri.parse(data.readString());
1298 ParcelFileDescriptor pfd = openContentUri(uri);
1299 reply.writeNoException();
1300 if (pfd != null) {
1301 reply.writeInt(1);
1302 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1303 } else {
1304 reply.writeInt(0);
1305 }
1306 return true;
1307 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001308
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001309 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1310 data.enforceInterface(IActivityManager.descriptor);
1311 setLockScreenShown(data.readInt() != 0);
1312 reply.writeNoException();
1313 return true;
1314 }
1315
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001316 case SET_DEBUG_APP_TRANSACTION: {
1317 data.enforceInterface(IActivityManager.descriptor);
1318 String pn = data.readString();
1319 boolean wfd = data.readInt() != 0;
1320 boolean per = data.readInt() != 0;
1321 setDebugApp(pn, wfd, per);
1322 reply.writeNoException();
1323 return true;
1324 }
1325
1326 case SET_ALWAYS_FINISH_TRANSACTION: {
1327 data.enforceInterface(IActivityManager.descriptor);
1328 boolean enabled = data.readInt() != 0;
1329 setAlwaysFinish(enabled);
1330 reply.writeNoException();
1331 return true;
1332 }
1333
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001334 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001335 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001336 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001337 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001338 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001339 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001340 return true;
1341 }
1342
1343 case ENTER_SAFE_MODE_TRANSACTION: {
1344 data.enforceInterface(IActivityManager.descriptor);
1345 enterSafeMode();
1346 reply.writeNoException();
1347 return true;
1348 }
1349
1350 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1351 data.enforceInterface(IActivityManager.descriptor);
1352 IIntentSender is = IIntentSender.Stub.asInterface(
1353 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001354 int sourceUid = data.readInt();
1355 String sourcePkg = data.readString();
1356 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001357 reply.writeNoException();
1358 return true;
1359 }
1360
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001361 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001362 data.enforceInterface(IActivityManager.descriptor);
1363 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001364 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001365 boolean secure = data.readInt() != 0;
1366 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001367 reply.writeNoException();
1368 reply.writeInt(res ? 1 : 0);
1369 return true;
1370 }
1371
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001372 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
1374 String reason = data.readString();
1375 boolean res = killProcessesBelowForeground(reason);
1376 reply.writeNoException();
1377 reply.writeInt(res ? 1 : 0);
1378 return true;
1379 }
1380
Dan Egnor60d87622009-12-16 16:32:58 -08001381 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1382 data.enforceInterface(IActivityManager.descriptor);
1383 IBinder app = data.readStrongBinder();
1384 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1385 handleApplicationCrash(app, ci);
1386 reply.writeNoException();
1387 return true;
1388 }
1389
1390 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001391 data.enforceInterface(IActivityManager.descriptor);
1392 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001393 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001394 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001395 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001396 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001397 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001398 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001399 return true;
1400 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001401
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001402 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1403 data.enforceInterface(IActivityManager.descriptor);
1404 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001405 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001406 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1407 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001408 reply.writeNoException();
1409 return true;
1410 }
1411
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001412 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1413 data.enforceInterface(IActivityManager.descriptor);
1414 int sig = data.readInt();
1415 signalPersistentProcesses(sig);
1416 reply.writeNoException();
1417 return true;
1418 }
1419
Dianne Hackborn03abb812010-01-04 18:43:19 -08001420 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1421 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001423 int userId = data.readInt();
1424 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001425 reply.writeNoException();
1426 return true;
1427 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001428
1429 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1430 data.enforceInterface(IActivityManager.descriptor);
1431 killAllBackgroundProcesses();
1432 reply.writeNoException();
1433 return true;
1434 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001435
Dianne Hackborn03abb812010-01-04 18:43:19 -08001436 case FORCE_STOP_PACKAGE_TRANSACTION: {
1437 data.enforceInterface(IActivityManager.descriptor);
1438 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001439 int userId = data.readInt();
1440 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001441 reply.writeNoException();
1442 return true;
1443 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001444
1445 case GET_MY_MEMORY_STATE_TRANSACTION: {
1446 data.enforceInterface(IActivityManager.descriptor);
1447 ActivityManager.RunningAppProcessInfo info =
1448 new ActivityManager.RunningAppProcessInfo();
1449 getMyMemoryState(info);
1450 reply.writeNoException();
1451 info.writeToParcel(reply, 0);
1452 return true;
1453 }
1454
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001455 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1456 data.enforceInterface(IActivityManager.descriptor);
1457 ConfigurationInfo config = getDeviceConfigurationInfo();
1458 reply.writeNoException();
1459 config.writeToParcel(reply, 0);
1460 return true;
1461 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001462
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001463 case PROFILE_CONTROL_TRANSACTION: {
1464 data.enforceInterface(IActivityManager.descriptor);
1465 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001466 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001467 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001468 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001469 ProfilerInfo profilerInfo = data.readInt() != 0
1470 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1471 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001472 reply.writeNoException();
1473 reply.writeInt(res ? 1 : 0);
1474 return true;
1475 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001476
Dianne Hackborn55280a92009-05-07 15:53:46 -07001477 case SHUTDOWN_TRANSACTION: {
1478 data.enforceInterface(IActivityManager.descriptor);
1479 boolean res = shutdown(data.readInt());
1480 reply.writeNoException();
1481 reply.writeInt(res ? 1 : 0);
1482 return true;
1483 }
1484
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001485 case STOP_APP_SWITCHES_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 stopAppSwitches();
1488 reply.writeNoException();
1489 return true;
1490 }
1491
1492 case RESUME_APP_SWITCHES_TRANSACTION: {
1493 data.enforceInterface(IActivityManager.descriptor);
1494 resumeAppSwitches();
1495 reply.writeNoException();
1496 return true;
1497 }
1498
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001499 case PEEK_SERVICE_TRANSACTION: {
1500 data.enforceInterface(IActivityManager.descriptor);
1501 Intent service = Intent.CREATOR.createFromParcel(data);
1502 String resolvedType = data.readString();
1503 IBinder binder = peekService(service, resolvedType);
1504 reply.writeNoException();
1505 reply.writeStrongBinder(binder);
1506 return true;
1507 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001508
1509 case START_BACKUP_AGENT_TRANSACTION: {
1510 data.enforceInterface(IActivityManager.descriptor);
1511 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1512 int backupRestoreMode = data.readInt();
1513 boolean success = bindBackupAgent(info, backupRestoreMode);
1514 reply.writeNoException();
1515 reply.writeInt(success ? 1 : 0);
1516 return true;
1517 }
1518
1519 case BACKUP_AGENT_CREATED_TRANSACTION: {
1520 data.enforceInterface(IActivityManager.descriptor);
1521 String packageName = data.readString();
1522 IBinder agent = data.readStrongBinder();
1523 backupAgentCreated(packageName, agent);
1524 reply.writeNoException();
1525 return true;
1526 }
1527
1528 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1529 data.enforceInterface(IActivityManager.descriptor);
1530 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1531 unbindBackupAgent(info);
1532 reply.writeNoException();
1533 return true;
1534 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001535
1536 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1537 data.enforceInterface(IActivityManager.descriptor);
1538 String packageName = data.readString();
1539 addPackageDependency(packageName);
1540 reply.writeNoException();
1541 return true;
1542 }
1543
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001544 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001545 data.enforceInterface(IActivityManager.descriptor);
1546 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001547 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001548 String reason = data.readString();
1549 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001550 reply.writeNoException();
1551 return true;
1552 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001553
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001554 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1555 data.enforceInterface(IActivityManager.descriptor);
1556 String reason = data.readString();
1557 closeSystemDialogs(reason);
1558 reply.writeNoException();
1559 return true;
1560 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001561
1562 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1563 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001564 int[] pids = data.createIntArray();
1565 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001566 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001567 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001568 return true;
1569 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001570
1571 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1572 data.enforceInterface(IActivityManager.descriptor);
1573 String processName = data.readString();
1574 int uid = data.readInt();
1575 killApplicationProcess(processName, uid);
1576 reply.writeNoException();
1577 return true;
1578 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001579
1580 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1581 data.enforceInterface(IActivityManager.descriptor);
1582 IBinder token = data.readStrongBinder();
1583 String packageName = data.readString();
1584 int enterAnim = data.readInt();
1585 int exitAnim = data.readInt();
1586 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001587 reply.writeNoException();
1588 return true;
1589 }
1590
1591 case IS_USER_A_MONKEY_TRANSACTION: {
1592 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001593 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001594 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001595 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001596 return true;
1597 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001598
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001599 case SET_USER_IS_MONKEY_TRANSACTION: {
1600 data.enforceInterface(IActivityManager.descriptor);
1601 final boolean monkey = (data.readInt() == 1);
1602 setUserIsMonkey(monkey);
1603 reply.writeNoException();
1604 return true;
1605 }
1606
Dianne Hackborn860755f2010-06-03 18:47:52 -07001607 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1608 data.enforceInterface(IActivityManager.descriptor);
1609 finishHeavyWeightApp();
1610 reply.writeNoException();
1611 return true;
1612 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001613
1614 case IS_IMMERSIVE_TRANSACTION: {
1615 data.enforceInterface(IActivityManager.descriptor);
1616 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001617 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001618 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001619 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001620 return true;
1621 }
1622
Craig Mautnerd61dc202014-07-07 11:09:11 -07001623 case IS_TOP_OF_TASK_TRANSACTION: {
1624 data.enforceInterface(IActivityManager.descriptor);
1625 IBinder token = data.readStrongBinder();
1626 final boolean isTopOfTask = isTopOfTask(token);
1627 reply.writeNoException();
1628 reply.writeInt(isTopOfTask ? 1 : 0);
1629 return true;
1630 }
1631
Craig Mautner5eda9b32013-07-02 11:58:16 -07001632 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001633 data.enforceInterface(IActivityManager.descriptor);
1634 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001635 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001636 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001637 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001638 return true;
1639 }
1640
1641 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1642 data.enforceInterface(IActivityManager.descriptor);
1643 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001644 final Bundle bundle;
1645 if (data.readInt() == 0) {
1646 bundle = null;
1647 } else {
1648 bundle = data.readBundle();
1649 }
1650 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1651 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001652 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001653 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001654 return true;
1655 }
1656
Craig Mautner233ceee2014-05-09 17:05:11 -07001657 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1658 data.enforceInterface(IActivityManager.descriptor);
1659 IBinder token = data.readStrongBinder();
1660 final ActivityOptions options = getActivityOptions(token);
1661 reply.writeNoException();
1662 reply.writeBundle(options == null ? null : options.toBundle());
1663 return true;
1664 }
1665
Daniel Sandler69a48172010-06-23 16:29:36 -04001666 case SET_IMMERSIVE_TRANSACTION: {
1667 data.enforceInterface(IActivityManager.descriptor);
1668 IBinder token = data.readStrongBinder();
1669 boolean imm = data.readInt() == 1;
1670 setImmersive(token, imm);
1671 reply.writeNoException();
1672 return true;
1673 }
1674
1675 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1676 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001677 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001678 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001679 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001680 return true;
1681 }
1682
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001683 case CRASH_APPLICATION_TRANSACTION: {
1684 data.enforceInterface(IActivityManager.descriptor);
1685 int uid = data.readInt();
1686 int initialPid = data.readInt();
1687 String packageName = data.readString();
1688 String message = data.readString();
1689 crashApplication(uid, initialPid, packageName, message);
1690 reply.writeNoException();
1691 return true;
1692 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001693
1694 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1695 data.enforceInterface(IActivityManager.descriptor);
1696 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001697 int userId = data.readInt();
1698 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001699 reply.writeNoException();
1700 reply.writeString(type);
1701 return true;
1702 }
1703
Dianne Hackborn7e269642010-08-25 19:50:20 -07001704 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1705 data.enforceInterface(IActivityManager.descriptor);
1706 String name = data.readString();
1707 IBinder perm = newUriPermissionOwner(name);
1708 reply.writeNoException();
1709 reply.writeStrongBinder(perm);
1710 return true;
1711 }
1712
1713 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1714 data.enforceInterface(IActivityManager.descriptor);
1715 IBinder owner = data.readStrongBinder();
1716 int fromUid = data.readInt();
1717 String targetPkg = data.readString();
1718 Uri uri = Uri.CREATOR.createFromParcel(data);
1719 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001720 int sourceUserId = data.readInt();
1721 int targetUserId = data.readInt();
1722 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1723 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001724 reply.writeNoException();
1725 return true;
1726 }
1727
1728 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1729 data.enforceInterface(IActivityManager.descriptor);
1730 IBinder owner = data.readStrongBinder();
1731 Uri uri = null;
1732 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001733 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001734 }
1735 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001736 int userId = data.readInt();
1737 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001738 reply.writeNoException();
1739 return true;
1740 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001741
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001742 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 int callingUid = data.readInt();
1745 String targetPkg = data.readString();
1746 Uri uri = Uri.CREATOR.createFromParcel(data);
1747 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001748 int userId = data.readInt();
1749 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001750 reply.writeNoException();
1751 reply.writeInt(res);
1752 return true;
1753 }
1754
Andy McFadden824c5102010-07-09 16:26:57 -07001755 case DUMP_HEAP_TRANSACTION: {
1756 data.enforceInterface(IActivityManager.descriptor);
1757 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001758 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001759 boolean managed = data.readInt() != 0;
1760 String path = data.readString();
1761 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001762 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001763 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001764 reply.writeNoException();
1765 reply.writeInt(res ? 1 : 0);
1766 return true;
1767 }
1768
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001769 case START_ACTIVITIES_TRANSACTION:
1770 {
1771 data.enforceInterface(IActivityManager.descriptor);
1772 IBinder b = data.readStrongBinder();
1773 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001774 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001775 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1776 String[] resolvedTypes = data.createStringArray();
1777 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001778 Bundle options = data.readInt() != 0
1779 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001780 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001781 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001782 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001783 reply.writeNoException();
1784 reply.writeInt(result);
1785 return true;
1786 }
1787
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001788 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1789 {
1790 data.enforceInterface(IActivityManager.descriptor);
1791 int mode = getFrontActivityScreenCompatMode();
1792 reply.writeNoException();
1793 reply.writeInt(mode);
1794 return true;
1795 }
1796
1797 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1798 {
1799 data.enforceInterface(IActivityManager.descriptor);
1800 int mode = data.readInt();
1801 setFrontActivityScreenCompatMode(mode);
1802 reply.writeNoException();
1803 reply.writeInt(mode);
1804 return true;
1805 }
1806
1807 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1808 {
1809 data.enforceInterface(IActivityManager.descriptor);
1810 String pkg = data.readString();
1811 int mode = getPackageScreenCompatMode(pkg);
1812 reply.writeNoException();
1813 reply.writeInt(mode);
1814 return true;
1815 }
1816
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001817 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1818 {
1819 data.enforceInterface(IActivityManager.descriptor);
1820 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001821 int mode = data.readInt();
1822 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001823 reply.writeNoException();
1824 return true;
1825 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001826
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001827 case SWITCH_USER_TRANSACTION: {
1828 data.enforceInterface(IActivityManager.descriptor);
1829 int userid = data.readInt();
1830 boolean result = switchUser(userid);
1831 reply.writeNoException();
1832 reply.writeInt(result ? 1 : 0);
1833 return true;
1834 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001835
Kenny Guy08488bf2014-02-21 17:40:37 +00001836 case START_USER_IN_BACKGROUND_TRANSACTION: {
1837 data.enforceInterface(IActivityManager.descriptor);
1838 int userid = data.readInt();
1839 boolean result = startUserInBackground(userid);
1840 reply.writeNoException();
1841 reply.writeInt(result ? 1 : 0);
1842 return true;
1843 }
1844
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001845 case STOP_USER_TRANSACTION: {
1846 data.enforceInterface(IActivityManager.descriptor);
1847 int userid = data.readInt();
1848 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1849 data.readStrongBinder());
1850 int result = stopUser(userid, callback);
1851 reply.writeNoException();
1852 reply.writeInt(result);
1853 return true;
1854 }
1855
Amith Yamasani52f1d752012-03-28 18:19:29 -07001856 case GET_CURRENT_USER_TRANSACTION: {
1857 data.enforceInterface(IActivityManager.descriptor);
1858 UserInfo userInfo = getCurrentUser();
1859 reply.writeNoException();
1860 userInfo.writeToParcel(reply, 0);
1861 return true;
1862 }
1863
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001864 case IS_USER_RUNNING_TRANSACTION: {
1865 data.enforceInterface(IActivityManager.descriptor);
1866 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001867 boolean orStopping = data.readInt() != 0;
1868 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001869 reply.writeNoException();
1870 reply.writeInt(result ? 1 : 0);
1871 return true;
1872 }
1873
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001874 case GET_RUNNING_USER_IDS_TRANSACTION: {
1875 data.enforceInterface(IActivityManager.descriptor);
1876 int[] result = getRunningUserIds();
1877 reply.writeNoException();
1878 reply.writeIntArray(result);
1879 return true;
1880 }
1881
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001882 case REMOVE_TASK_TRANSACTION:
1883 {
1884 data.enforceInterface(IActivityManager.descriptor);
1885 int taskId = data.readInt();
1886 int fl = data.readInt();
1887 boolean result = removeTask(taskId, fl);
1888 reply.writeNoException();
1889 reply.writeInt(result ? 1 : 0);
1890 return true;
1891 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001892
Jeff Sharkeya4620792011-05-20 15:29:23 -07001893 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1894 data.enforceInterface(IActivityManager.descriptor);
1895 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1896 data.readStrongBinder());
1897 registerProcessObserver(observer);
1898 return true;
1899 }
1900
1901 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1902 data.enforceInterface(IActivityManager.descriptor);
1903 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1904 data.readStrongBinder());
1905 unregisterProcessObserver(observer);
1906 return true;
1907 }
1908
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001909 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1910 {
1911 data.enforceInterface(IActivityManager.descriptor);
1912 String pkg = data.readString();
1913 boolean ask = getPackageAskScreenCompat(pkg);
1914 reply.writeNoException();
1915 reply.writeInt(ask ? 1 : 0);
1916 return true;
1917 }
1918
1919 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1920 {
1921 data.enforceInterface(IActivityManager.descriptor);
1922 String pkg = data.readString();
1923 boolean ask = data.readInt() != 0;
1924 setPackageAskScreenCompat(pkg, ask);
1925 reply.writeNoException();
1926 return true;
1927 }
1928
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001929 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1930 data.enforceInterface(IActivityManager.descriptor);
1931 IIntentSender r = IIntentSender.Stub.asInterface(
1932 data.readStrongBinder());
1933 boolean res = isIntentSenderTargetedToPackage(r);
1934 reply.writeNoException();
1935 reply.writeInt(res ? 1 : 0);
1936 return true;
1937 }
1938
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001939 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1940 data.enforceInterface(IActivityManager.descriptor);
1941 IIntentSender r = IIntentSender.Stub.asInterface(
1942 data.readStrongBinder());
1943 boolean res = isIntentSenderAnActivity(r);
1944 reply.writeNoException();
1945 reply.writeInt(res ? 1 : 0);
1946 return true;
1947 }
1948
Dianne Hackborn81038902012-11-26 17:04:09 -08001949 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1950 data.enforceInterface(IActivityManager.descriptor);
1951 IIntentSender r = IIntentSender.Stub.asInterface(
1952 data.readStrongBinder());
1953 Intent intent = getIntentForIntentSender(r);
1954 reply.writeNoException();
1955 if (intent != null) {
1956 reply.writeInt(1);
1957 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1958 } else {
1959 reply.writeInt(0);
1960 }
1961 return true;
1962 }
1963
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001964 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1965 data.enforceInterface(IActivityManager.descriptor);
1966 IIntentSender r = IIntentSender.Stub.asInterface(
1967 data.readStrongBinder());
1968 String prefix = data.readString();
1969 String tag = getTagForIntentSender(r, prefix);
1970 reply.writeNoException();
1971 reply.writeString(tag);
1972 return true;
1973 }
1974
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001975 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1976 data.enforceInterface(IActivityManager.descriptor);
1977 Configuration config = Configuration.CREATOR.createFromParcel(data);
1978 updatePersistentConfiguration(config);
1979 reply.writeNoException();
1980 return true;
1981 }
1982
Dianne Hackbornb437e092011-08-05 17:50:29 -07001983 case GET_PROCESS_PSS_TRANSACTION: {
1984 data.enforceInterface(IActivityManager.descriptor);
1985 int[] pids = data.createIntArray();
1986 long[] pss = getProcessPss(pids);
1987 reply.writeNoException();
1988 reply.writeLongArray(pss);
1989 return true;
1990 }
1991
Dianne Hackborn661cd522011-08-22 00:26:20 -07001992 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1993 data.enforceInterface(IActivityManager.descriptor);
1994 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1995 boolean always = data.readInt() != 0;
1996 showBootMessage(msg, always);
1997 reply.writeNoException();
1998 return true;
1999 }
2000
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002001 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002002 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002003 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002004 reply.writeNoException();
2005 return true;
2006 }
2007
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002008 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002009 data.enforceInterface(IActivityManager.descriptor);
2010 IBinder token = data.readStrongBinder();
2011 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002012 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002013 reply.writeNoException();
2014 reply.writeInt(res ? 1 : 0);
2015 return true;
2016 }
2017
2018 case NAVIGATE_UP_TO_TRANSACTION: {
2019 data.enforceInterface(IActivityManager.descriptor);
2020 IBinder token = data.readStrongBinder();
2021 Intent target = Intent.CREATOR.createFromParcel(data);
2022 int resultCode = data.readInt();
2023 Intent resultData = null;
2024 if (data.readInt() != 0) {
2025 resultData = Intent.CREATOR.createFromParcel(data);
2026 }
2027 boolean res = navigateUpTo(token, target, resultCode, resultData);
2028 reply.writeNoException();
2029 reply.writeInt(res ? 1 : 0);
2030 return true;
2031 }
2032
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002033 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2034 data.enforceInterface(IActivityManager.descriptor);
2035 IBinder token = data.readStrongBinder();
2036 int res = getLaunchedFromUid(token);
2037 reply.writeNoException();
2038 reply.writeInt(res);
2039 return true;
2040 }
2041
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002042 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2043 data.enforceInterface(IActivityManager.descriptor);
2044 IBinder token = data.readStrongBinder();
2045 String res = getLaunchedFromPackage(token);
2046 reply.writeNoException();
2047 reply.writeString(res);
2048 return true;
2049 }
2050
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002051 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2052 data.enforceInterface(IActivityManager.descriptor);
2053 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2054 data.readStrongBinder());
2055 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002056 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002057 return true;
2058 }
2059
2060 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2061 data.enforceInterface(IActivityManager.descriptor);
2062 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2063 data.readStrongBinder());
2064 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002065 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002066 return true;
2067 }
2068
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002069 case REQUEST_BUG_REPORT_TRANSACTION: {
2070 data.enforceInterface(IActivityManager.descriptor);
2071 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002072 reply.writeNoException();
2073 return true;
2074 }
2075
2076 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2077 data.enforceInterface(IActivityManager.descriptor);
2078 int pid = data.readInt();
2079 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002080 String reason = data.readString();
2081 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002082 reply.writeNoException();
2083 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002084 return true;
2085 }
2086
Adam Skorydfc7fd72013-08-05 19:23:41 -07002087 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002088 data.enforceInterface(IActivityManager.descriptor);
2089 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002090 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002091 reply.writeNoException();
2092 reply.writeBundle(res);
2093 return true;
2094 }
2095
Adam Skorydfc7fd72013-08-05 19:23:41 -07002096 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002097 data.enforceInterface(IActivityManager.descriptor);
2098 IBinder token = data.readStrongBinder();
2099 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002100 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002101 reply.writeNoException();
2102 return true;
2103 }
2104
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002105 case KILL_UID_TRANSACTION: {
2106 data.enforceInterface(IActivityManager.descriptor);
2107 int uid = data.readInt();
2108 String reason = data.readString();
2109 killUid(uid, reason);
2110 reply.writeNoException();
2111 return true;
2112 }
2113
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002114 case HANG_TRANSACTION: {
2115 data.enforceInterface(IActivityManager.descriptor);
2116 IBinder who = data.readStrongBinder();
2117 boolean allowRestart = data.readInt() != 0;
2118 hang(who, allowRestart);
2119 reply.writeNoException();
2120 return true;
2121 }
2122
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002123 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2124 data.enforceInterface(IActivityManager.descriptor);
2125 IBinder token = data.readStrongBinder();
2126 reportActivityFullyDrawn(token);
2127 reply.writeNoException();
2128 return true;
2129 }
2130
Craig Mautner5eda9b32013-07-02 11:58:16 -07002131 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2132 data.enforceInterface(IActivityManager.descriptor);
2133 IBinder token = data.readStrongBinder();
2134 notifyActivityDrawn(token);
2135 reply.writeNoException();
2136 return true;
2137 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002138
2139 case RESTART_TRANSACTION: {
2140 data.enforceInterface(IActivityManager.descriptor);
2141 restart();
2142 reply.writeNoException();
2143 return true;
2144 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002145
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002146 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2147 data.enforceInterface(IActivityManager.descriptor);
2148 performIdleMaintenance();
2149 reply.writeNoException();
2150 return true;
2151 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002152
2153 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2154 data.enforceInterface(IActivityManager.descriptor);
2155 IBinder parentActivityToken = data.readStrongBinder();
2156 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002157 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002158 IActivityContainer activityContainer =
2159 createActivityContainer(parentActivityToken, callback);
2160 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002161 if (activityContainer != null) {
2162 reply.writeInt(1);
2163 reply.writeStrongBinder(activityContainer.asBinder());
2164 } else {
2165 reply.writeInt(0);
2166 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002167 return true;
2168 }
2169
Craig Mautner95da1082014-02-24 17:54:35 -08002170 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2171 data.enforceInterface(IActivityManager.descriptor);
2172 IActivityContainer activityContainer =
2173 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2174 deleteActivityContainer(activityContainer);
2175 reply.writeNoException();
2176 return true;
2177 }
2178
Craig Mautnere0a38842013-12-16 16:14:02 -08002179 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2180 data.enforceInterface(IActivityManager.descriptor);
2181 IBinder activityToken = data.readStrongBinder();
2182 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2183 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002184 if (activityContainer != null) {
2185 reply.writeInt(1);
2186 reply.writeStrongBinder(activityContainer.asBinder());
2187 } else {
2188 reply.writeInt(0);
2189 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002190 return true;
2191 }
2192
Craig Mautner4a1cb222013-12-04 16:14:06 -08002193 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2194 data.enforceInterface(IActivityManager.descriptor);
2195 IBinder homeActivityToken = getHomeActivityToken();
2196 reply.writeNoException();
2197 reply.writeStrongBinder(homeActivityToken);
2198 return true;
2199 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002200
2201 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2202 data.enforceInterface(IActivityManager.descriptor);
2203 final int taskId = data.readInt();
2204 startLockTaskMode(taskId);
2205 reply.writeNoException();
2206 return true;
2207 }
2208
2209 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2210 data.enforceInterface(IActivityManager.descriptor);
2211 IBinder token = data.readStrongBinder();
2212 startLockTaskMode(token);
2213 reply.writeNoException();
2214 return true;
2215 }
2216
Craig Mautnerd61dc202014-07-07 11:09:11 -07002217 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002218 data.enforceInterface(IActivityManager.descriptor);
2219 startLockTaskModeOnCurrent();
2220 reply.writeNoException();
2221 return true;
2222 }
2223
Craig Mautneraea74a52014-03-08 14:23:10 -08002224 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2225 data.enforceInterface(IActivityManager.descriptor);
2226 stopLockTaskMode();
2227 reply.writeNoException();
2228 return true;
2229 }
2230
Craig Mautnerd61dc202014-07-07 11:09:11 -07002231 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002232 data.enforceInterface(IActivityManager.descriptor);
2233 stopLockTaskModeOnCurrent();
2234 reply.writeNoException();
2235 return true;
2236 }
2237
Craig Mautneraea74a52014-03-08 14:23:10 -08002238 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2239 data.enforceInterface(IActivityManager.descriptor);
2240 final boolean isInLockTaskMode = isInLockTaskMode();
2241 reply.writeNoException();
2242 reply.writeInt(isInLockTaskMode ? 1 : 0);
2243 return true;
2244 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002245
Winson Chunga449dc02014-05-16 11:15:04 -07002246 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002247 data.enforceInterface(IActivityManager.descriptor);
2248 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002249 ActivityManager.TaskDescription values =
2250 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2251 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002252 reply.writeNoException();
2253 return true;
2254 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002255
Jose Lima4b6c6692014-08-12 17:41:12 -07002256 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002257 data.enforceInterface(IActivityManager.descriptor);
2258 IBinder token = data.readStrongBinder();
2259 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002260 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002261 reply.writeNoException();
2262 reply.writeInt(success ? 1 : 0);
2263 return true;
2264 }
2265
Jose Lima4b6c6692014-08-12 17:41:12 -07002266 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002267 data.enforceInterface(IActivityManager.descriptor);
2268 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002269 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002270 reply.writeNoException();
2271 reply.writeInt(enabled ? 1 : 0);
2272 return true;
2273 }
2274
Jose Lima4b6c6692014-08-12 17:41:12 -07002275 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002276 data.enforceInterface(IActivityManager.descriptor);
2277 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002278 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002279 reply.writeNoException();
2280 return true;
2281 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002282
2283 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2284 data.enforceInterface(IActivityManager.descriptor);
2285 IBinder token = data.readStrongBinder();
2286 notifyLaunchTaskBehindComplete(token);
2287 reply.writeNoException();
2288 return true;
2289 }
Craig Mautner8746a472014-07-24 15:12:54 -07002290
2291 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2292 data.enforceInterface(IActivityManager.descriptor);
2293 IBinder token = data.readStrongBinder();
2294 notifyEnterAnimationComplete(token);
2295 reply.writeNoException();
2296 return true;
2297 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002298
2299 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2300 data.enforceInterface(IActivityManager.descriptor);
2301 bootAnimationComplete();
2302 reply.writeNoException();
2303 return true;
2304 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002305 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002306
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002307 return super.onTransact(code, data, reply, flags);
2308 }
2309
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002310 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002311 return this;
2312 }
2313
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002314 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2315 protected IActivityManager create() {
2316 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002317 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002318 Log.v("ActivityManager", "default service binder = " + b);
2319 }
2320 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002321 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002322 Log.v("ActivityManager", "default service = " + am);
2323 }
2324 return am;
2325 }
2326 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002327}
2328
2329class ActivityManagerProxy implements IActivityManager
2330{
2331 public ActivityManagerProxy(IBinder remote)
2332 {
2333 mRemote = remote;
2334 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002335
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002336 public IBinder asBinder()
2337 {
2338 return mRemote;
2339 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002340
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002341 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002342 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002343 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002344 Parcel data = Parcel.obtain();
2345 Parcel reply = Parcel.obtain();
2346 data.writeInterfaceToken(IActivityManager.descriptor);
2347 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002348 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002349 intent.writeToParcel(data, 0);
2350 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002351 data.writeStrongBinder(resultTo);
2352 data.writeString(resultWho);
2353 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002354 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002355 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002356 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002357 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002358 } else {
2359 data.writeInt(0);
2360 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002361 if (options != null) {
2362 data.writeInt(1);
2363 options.writeToParcel(data, 0);
2364 } else {
2365 data.writeInt(0);
2366 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002367 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2368 reply.readException();
2369 int result = reply.readInt();
2370 reply.recycle();
2371 data.recycle();
2372 return result;
2373 }
Amith Yamasani82644082012-08-03 13:09:11 -07002374
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002375 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002376 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002377 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2378 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002379 Parcel data = Parcel.obtain();
2380 Parcel reply = Parcel.obtain();
2381 data.writeInterfaceToken(IActivityManager.descriptor);
2382 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002383 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002384 intent.writeToParcel(data, 0);
2385 data.writeString(resolvedType);
2386 data.writeStrongBinder(resultTo);
2387 data.writeString(resultWho);
2388 data.writeInt(requestCode);
2389 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002390 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002391 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002392 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002393 } else {
2394 data.writeInt(0);
2395 }
2396 if (options != null) {
2397 data.writeInt(1);
2398 options.writeToParcel(data, 0);
2399 } else {
2400 data.writeInt(0);
2401 }
2402 data.writeInt(userId);
2403 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2404 reply.readException();
2405 int result = reply.readInt();
2406 reply.recycle();
2407 data.recycle();
2408 return result;
2409 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002410 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2411 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002412 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002413 Parcel data = Parcel.obtain();
2414 Parcel reply = Parcel.obtain();
2415 data.writeInterfaceToken(IActivityManager.descriptor);
2416 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2417 data.writeString(callingPackage);
2418 intent.writeToParcel(data, 0);
2419 data.writeString(resolvedType);
2420 data.writeStrongBinder(resultTo);
2421 data.writeString(resultWho);
2422 data.writeInt(requestCode);
2423 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002424 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002425 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002426 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002427 } else {
2428 data.writeInt(0);
2429 }
2430 if (options != null) {
2431 data.writeInt(1);
2432 options.writeToParcel(data, 0);
2433 } else {
2434 data.writeInt(0);
2435 }
2436 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2437 reply.readException();
2438 int result = reply.readInt();
2439 reply.recycle();
2440 data.recycle();
2441 return result;
2442 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002443 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2444 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002445 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2446 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002447 Parcel data = Parcel.obtain();
2448 Parcel reply = Parcel.obtain();
2449 data.writeInterfaceToken(IActivityManager.descriptor);
2450 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002451 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002452 intent.writeToParcel(data, 0);
2453 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002454 data.writeStrongBinder(resultTo);
2455 data.writeString(resultWho);
2456 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002457 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002458 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002459 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002460 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002461 } else {
2462 data.writeInt(0);
2463 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002464 if (options != null) {
2465 data.writeInt(1);
2466 options.writeToParcel(data, 0);
2467 } else {
2468 data.writeInt(0);
2469 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002470 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002471 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2472 reply.readException();
2473 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2474 reply.recycle();
2475 data.recycle();
2476 return result;
2477 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002478 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2479 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002480 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002481 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002482 Parcel data = Parcel.obtain();
2483 Parcel reply = Parcel.obtain();
2484 data.writeInterfaceToken(IActivityManager.descriptor);
2485 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002486 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002487 intent.writeToParcel(data, 0);
2488 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002489 data.writeStrongBinder(resultTo);
2490 data.writeString(resultWho);
2491 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002492 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002493 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002494 if (options != null) {
2495 data.writeInt(1);
2496 options.writeToParcel(data, 0);
2497 } else {
2498 data.writeInt(0);
2499 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002500 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002501 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2502 reply.readException();
2503 int result = reply.readInt();
2504 reply.recycle();
2505 data.recycle();
2506 return result;
2507 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002508 public int startActivityIntentSender(IApplicationThread caller,
2509 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002510 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002511 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002512 Parcel data = Parcel.obtain();
2513 Parcel reply = Parcel.obtain();
2514 data.writeInterfaceToken(IActivityManager.descriptor);
2515 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2516 intent.writeToParcel(data, 0);
2517 if (fillInIntent != null) {
2518 data.writeInt(1);
2519 fillInIntent.writeToParcel(data, 0);
2520 } else {
2521 data.writeInt(0);
2522 }
2523 data.writeString(resolvedType);
2524 data.writeStrongBinder(resultTo);
2525 data.writeString(resultWho);
2526 data.writeInt(requestCode);
2527 data.writeInt(flagsMask);
2528 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002529 if (options != null) {
2530 data.writeInt(1);
2531 options.writeToParcel(data, 0);
2532 } else {
2533 data.writeInt(0);
2534 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002535 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002536 reply.readException();
2537 int result = reply.readInt();
2538 reply.recycle();
2539 data.recycle();
2540 return result;
2541 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002542 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2543 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002544 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2545 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002546 Parcel data = Parcel.obtain();
2547 Parcel reply = Parcel.obtain();
2548 data.writeInterfaceToken(IActivityManager.descriptor);
2549 data.writeString(callingPackage);
2550 data.writeInt(callingPid);
2551 data.writeInt(callingUid);
2552 intent.writeToParcel(data, 0);
2553 data.writeString(resolvedType);
2554 data.writeStrongBinder(session.asBinder());
2555 data.writeStrongBinder(interactor.asBinder());
2556 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002557 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002558 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002559 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002560 } else {
2561 data.writeInt(0);
2562 }
2563 if (options != null) {
2564 data.writeInt(1);
2565 options.writeToParcel(data, 0);
2566 } else {
2567 data.writeInt(0);
2568 }
2569 data.writeInt(userId);
2570 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2571 reply.readException();
2572 int result = reply.readInt();
2573 reply.recycle();
2574 data.recycle();
2575 return result;
2576 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002577 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002578 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002579 Parcel data = Parcel.obtain();
2580 Parcel reply = Parcel.obtain();
2581 data.writeInterfaceToken(IActivityManager.descriptor);
2582 data.writeStrongBinder(callingActivity);
2583 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002584 if (options != null) {
2585 data.writeInt(1);
2586 options.writeToParcel(data, 0);
2587 } else {
2588 data.writeInt(0);
2589 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002590 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2591 reply.readException();
2592 int result = reply.readInt();
2593 reply.recycle();
2594 data.recycle();
2595 return result != 0;
2596 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002597 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2598 Parcel data = Parcel.obtain();
2599 Parcel reply = Parcel.obtain();
2600 data.writeInterfaceToken(IActivityManager.descriptor);
2601 data.writeInt(taskId);
2602 if (options == null) {
2603 data.writeInt(0);
2604 } else {
2605 data.writeInt(1);
2606 options.writeToParcel(data, 0);
2607 }
2608 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2609 reply.readException();
2610 int result = reply.readInt();
2611 reply.recycle();
2612 data.recycle();
2613 return result;
2614 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002615 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002616 throws RemoteException {
2617 Parcel data = Parcel.obtain();
2618 Parcel reply = Parcel.obtain();
2619 data.writeInterfaceToken(IActivityManager.descriptor);
2620 data.writeStrongBinder(token);
2621 data.writeInt(resultCode);
2622 if (resultData != null) {
2623 data.writeInt(1);
2624 resultData.writeToParcel(data, 0);
2625 } else {
2626 data.writeInt(0);
2627 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002628 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002629 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2630 reply.readException();
2631 boolean res = reply.readInt() != 0;
2632 data.recycle();
2633 reply.recycle();
2634 return res;
2635 }
2636 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2637 {
2638 Parcel data = Parcel.obtain();
2639 Parcel reply = Parcel.obtain();
2640 data.writeInterfaceToken(IActivityManager.descriptor);
2641 data.writeStrongBinder(token);
2642 data.writeString(resultWho);
2643 data.writeInt(requestCode);
2644 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2645 reply.readException();
2646 data.recycle();
2647 reply.recycle();
2648 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002649 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2650 Parcel data = Parcel.obtain();
2651 Parcel reply = Parcel.obtain();
2652 data.writeInterfaceToken(IActivityManager.descriptor);
2653 data.writeStrongBinder(token);
2654 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2655 reply.readException();
2656 boolean res = reply.readInt() != 0;
2657 data.recycle();
2658 reply.recycle();
2659 return res;
2660 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002661 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2662 Parcel data = Parcel.obtain();
2663 Parcel reply = Parcel.obtain();
2664 data.writeInterfaceToken(IActivityManager.descriptor);
2665 data.writeStrongBinder(session.asBinder());
2666 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2667 reply.readException();
2668 data.recycle();
2669 reply.recycle();
2670 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002671 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2672 Parcel data = Parcel.obtain();
2673 Parcel reply = Parcel.obtain();
2674 data.writeInterfaceToken(IActivityManager.descriptor);
2675 data.writeStrongBinder(token);
2676 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2677 reply.readException();
2678 boolean res = reply.readInt() != 0;
2679 data.recycle();
2680 reply.recycle();
2681 return res;
2682 }
2683 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2684 Parcel data = Parcel.obtain();
2685 Parcel reply = Parcel.obtain();
2686 data.writeInterfaceToken(IActivityManager.descriptor);
2687 data.writeStrongBinder(app.asBinder());
2688 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2689 reply.readException();
2690 data.recycle();
2691 reply.recycle();
2692 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002693 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2694 Parcel data = Parcel.obtain();
2695 Parcel reply = Parcel.obtain();
2696 data.writeInterfaceToken(IActivityManager.descriptor);
2697 data.writeStrongBinder(token);
2698 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2699 reply.readException();
2700 boolean res = reply.readInt() != 0;
2701 data.recycle();
2702 reply.recycle();
2703 return res;
2704 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002705 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002706 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002707 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002708 {
2709 Parcel data = Parcel.obtain();
2710 Parcel reply = Parcel.obtain();
2711 data.writeInterfaceToken(IActivityManager.descriptor);
2712 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002713 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002714 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2715 filter.writeToParcel(data, 0);
2716 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002717 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002718 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2719 reply.readException();
2720 Intent intent = null;
2721 int haveIntent = reply.readInt();
2722 if (haveIntent != 0) {
2723 intent = Intent.CREATOR.createFromParcel(reply);
2724 }
2725 reply.recycle();
2726 data.recycle();
2727 return intent;
2728 }
2729 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2730 {
2731 Parcel data = Parcel.obtain();
2732 Parcel reply = Parcel.obtain();
2733 data.writeInterfaceToken(IActivityManager.descriptor);
2734 data.writeStrongBinder(receiver.asBinder());
2735 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2736 reply.readException();
2737 data.recycle();
2738 reply.recycle();
2739 }
2740 public int broadcastIntent(IApplicationThread caller,
2741 Intent intent, String resolvedType, IIntentReceiver resultTo,
2742 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002743 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002744 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002745 {
2746 Parcel data = Parcel.obtain();
2747 Parcel reply = Parcel.obtain();
2748 data.writeInterfaceToken(IActivityManager.descriptor);
2749 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2750 intent.writeToParcel(data, 0);
2751 data.writeString(resolvedType);
2752 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2753 data.writeInt(resultCode);
2754 data.writeString(resultData);
2755 data.writeBundle(map);
2756 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002757 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002758 data.writeInt(serialized ? 1 : 0);
2759 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002760 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002761 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2762 reply.readException();
2763 int res = reply.readInt();
2764 reply.recycle();
2765 data.recycle();
2766 return res;
2767 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002768 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2769 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002770 {
2771 Parcel data = Parcel.obtain();
2772 Parcel reply = Parcel.obtain();
2773 data.writeInterfaceToken(IActivityManager.descriptor);
2774 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2775 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002776 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002777 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2778 reply.readException();
2779 data.recycle();
2780 reply.recycle();
2781 }
2782 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2783 {
2784 Parcel data = Parcel.obtain();
2785 Parcel reply = Parcel.obtain();
2786 data.writeInterfaceToken(IActivityManager.descriptor);
2787 data.writeStrongBinder(who);
2788 data.writeInt(resultCode);
2789 data.writeString(resultData);
2790 data.writeBundle(map);
2791 data.writeInt(abortBroadcast ? 1 : 0);
2792 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2793 reply.readException();
2794 data.recycle();
2795 reply.recycle();
2796 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002797 public void attachApplication(IApplicationThread app) throws RemoteException
2798 {
2799 Parcel data = Parcel.obtain();
2800 Parcel reply = Parcel.obtain();
2801 data.writeInterfaceToken(IActivityManager.descriptor);
2802 data.writeStrongBinder(app.asBinder());
2803 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2804 reply.readException();
2805 data.recycle();
2806 reply.recycle();
2807 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002808 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2809 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002810 {
2811 Parcel data = Parcel.obtain();
2812 Parcel reply = Parcel.obtain();
2813 data.writeInterfaceToken(IActivityManager.descriptor);
2814 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002815 if (config != null) {
2816 data.writeInt(1);
2817 config.writeToParcel(data, 0);
2818 } else {
2819 data.writeInt(0);
2820 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002821 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002822 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2823 reply.readException();
2824 data.recycle();
2825 reply.recycle();
2826 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002827 public void activityResumed(IBinder token) throws RemoteException
2828 {
2829 Parcel data = Parcel.obtain();
2830 Parcel reply = Parcel.obtain();
2831 data.writeInterfaceToken(IActivityManager.descriptor);
2832 data.writeStrongBinder(token);
2833 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2834 reply.readException();
2835 data.recycle();
2836 reply.recycle();
2837 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07002838 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002839 {
2840 Parcel data = Parcel.obtain();
2841 Parcel reply = Parcel.obtain();
2842 data.writeInterfaceToken(IActivityManager.descriptor);
2843 data.writeStrongBinder(token);
2844 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2845 reply.readException();
2846 data.recycle();
2847 reply.recycle();
2848 }
2849 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002850 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002851 {
2852 Parcel data = Parcel.obtain();
2853 Parcel reply = Parcel.obtain();
2854 data.writeInterfaceToken(IActivityManager.descriptor);
2855 data.writeStrongBinder(token);
2856 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002857 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002858 TextUtils.writeToParcel(description, data, 0);
2859 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2860 reply.readException();
2861 data.recycle();
2862 reply.recycle();
2863 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002864 public void activitySlept(IBinder token) throws RemoteException
2865 {
2866 Parcel data = Parcel.obtain();
2867 Parcel reply = Parcel.obtain();
2868 data.writeInterfaceToken(IActivityManager.descriptor);
2869 data.writeStrongBinder(token);
2870 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2871 reply.readException();
2872 data.recycle();
2873 reply.recycle();
2874 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002875 public void activityDestroyed(IBinder token) throws RemoteException
2876 {
2877 Parcel data = Parcel.obtain();
2878 Parcel reply = Parcel.obtain();
2879 data.writeInterfaceToken(IActivityManager.descriptor);
2880 data.writeStrongBinder(token);
2881 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2882 reply.readException();
2883 data.recycle();
2884 reply.recycle();
2885 }
2886 public String getCallingPackage(IBinder token) throws RemoteException
2887 {
2888 Parcel data = Parcel.obtain();
2889 Parcel reply = Parcel.obtain();
2890 data.writeInterfaceToken(IActivityManager.descriptor);
2891 data.writeStrongBinder(token);
2892 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2893 reply.readException();
2894 String res = reply.readString();
2895 data.recycle();
2896 reply.recycle();
2897 return res;
2898 }
2899 public ComponentName getCallingActivity(IBinder token)
2900 throws RemoteException {
2901 Parcel data = Parcel.obtain();
2902 Parcel reply = Parcel.obtain();
2903 data.writeInterfaceToken(IActivityManager.descriptor);
2904 data.writeStrongBinder(token);
2905 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2906 reply.readException();
2907 ComponentName res = ComponentName.readFromParcel(reply);
2908 data.recycle();
2909 reply.recycle();
2910 return res;
2911 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002912 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07002913 Parcel data = Parcel.obtain();
2914 Parcel reply = Parcel.obtain();
2915 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002916 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07002917 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2918 reply.readException();
2919 ArrayList<IAppTask> list = null;
2920 int N = reply.readInt();
2921 if (N >= 0) {
2922 list = new ArrayList<IAppTask>();
2923 while (N > 0) {
2924 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2925 list.add(task);
2926 N--;
2927 }
2928 }
2929 data.recycle();
2930 reply.recycle();
2931 return list;
2932 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07002933 public int addAppTask(IBinder activityToken, Intent intent,
2934 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
2935 Parcel data = Parcel.obtain();
2936 Parcel reply = Parcel.obtain();
2937 data.writeInterfaceToken(IActivityManager.descriptor);
2938 data.writeStrongBinder(activityToken);
2939 intent.writeToParcel(data, 0);
2940 description.writeToParcel(data, 0);
2941 thumbnail.writeToParcel(data, 0);
2942 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
2943 reply.readException();
2944 int res = reply.readInt();
2945 data.recycle();
2946 reply.recycle();
2947 return res;
2948 }
2949 public Point getAppTaskThumbnailSize() throws RemoteException {
2950 Parcel data = Parcel.obtain();
2951 Parcel reply = Parcel.obtain();
2952 data.writeInterfaceToken(IActivityManager.descriptor);
2953 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
2954 reply.readException();
2955 Point size = Point.CREATOR.createFromParcel(reply);
2956 data.recycle();
2957 reply.recycle();
2958 return size;
2959 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002960 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002961 Parcel data = Parcel.obtain();
2962 Parcel reply = Parcel.obtain();
2963 data.writeInterfaceToken(IActivityManager.descriptor);
2964 data.writeInt(maxNum);
2965 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002966 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2967 reply.readException();
2968 ArrayList list = null;
2969 int N = reply.readInt();
2970 if (N >= 0) {
2971 list = new ArrayList();
2972 while (N > 0) {
2973 ActivityManager.RunningTaskInfo info =
2974 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002975 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002976 list.add(info);
2977 N--;
2978 }
2979 }
2980 data.recycle();
2981 reply.recycle();
2982 return list;
2983 }
2984 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002985 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002986 Parcel data = Parcel.obtain();
2987 Parcel reply = Parcel.obtain();
2988 data.writeInterfaceToken(IActivityManager.descriptor);
2989 data.writeInt(maxNum);
2990 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002991 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002992 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2993 reply.readException();
2994 ArrayList<ActivityManager.RecentTaskInfo> list
2995 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2996 data.recycle();
2997 reply.recycle();
2998 return list;
2999 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003000 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003001 Parcel data = Parcel.obtain();
3002 Parcel reply = Parcel.obtain();
3003 data.writeInterfaceToken(IActivityManager.descriptor);
3004 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003005 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003006 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003007 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003008 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003009 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003010 }
3011 data.recycle();
3012 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003013 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003014 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003015 public List getServices(int maxNum, int flags) throws RemoteException {
3016 Parcel data = Parcel.obtain();
3017 Parcel reply = Parcel.obtain();
3018 data.writeInterfaceToken(IActivityManager.descriptor);
3019 data.writeInt(maxNum);
3020 data.writeInt(flags);
3021 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3022 reply.readException();
3023 ArrayList list = null;
3024 int N = reply.readInt();
3025 if (N >= 0) {
3026 list = new ArrayList();
3027 while (N > 0) {
3028 ActivityManager.RunningServiceInfo info =
3029 ActivityManager.RunningServiceInfo.CREATOR
3030 .createFromParcel(reply);
3031 list.add(info);
3032 N--;
3033 }
3034 }
3035 data.recycle();
3036 reply.recycle();
3037 return list;
3038 }
3039 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3040 throws RemoteException {
3041 Parcel data = Parcel.obtain();
3042 Parcel reply = Parcel.obtain();
3043 data.writeInterfaceToken(IActivityManager.descriptor);
3044 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3045 reply.readException();
3046 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3047 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3048 data.recycle();
3049 reply.recycle();
3050 return list;
3051 }
3052 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3053 throws RemoteException {
3054 Parcel data = Parcel.obtain();
3055 Parcel reply = Parcel.obtain();
3056 data.writeInterfaceToken(IActivityManager.descriptor);
3057 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3058 reply.readException();
3059 ArrayList<ActivityManager.RunningAppProcessInfo> list
3060 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3061 data.recycle();
3062 reply.recycle();
3063 return list;
3064 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003065 public List<ApplicationInfo> getRunningExternalApplications()
3066 throws RemoteException {
3067 Parcel data = Parcel.obtain();
3068 Parcel reply = Parcel.obtain();
3069 data.writeInterfaceToken(IActivityManager.descriptor);
3070 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3071 reply.readException();
3072 ArrayList<ApplicationInfo> list
3073 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3074 data.recycle();
3075 reply.recycle();
3076 return list;
3077 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003078 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003079 {
3080 Parcel data = Parcel.obtain();
3081 Parcel reply = Parcel.obtain();
3082 data.writeInterfaceToken(IActivityManager.descriptor);
3083 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003084 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003085 if (options != null) {
3086 data.writeInt(1);
3087 options.writeToParcel(data, 0);
3088 } else {
3089 data.writeInt(0);
3090 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003091 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3092 reply.readException();
3093 data.recycle();
3094 reply.recycle();
3095 }
3096 public void moveTaskToBack(int task) throws RemoteException
3097 {
3098 Parcel data = Parcel.obtain();
3099 Parcel reply = Parcel.obtain();
3100 data.writeInterfaceToken(IActivityManager.descriptor);
3101 data.writeInt(task);
3102 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3103 reply.readException();
3104 data.recycle();
3105 reply.recycle();
3106 }
3107 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3108 throws RemoteException {
3109 Parcel data = Parcel.obtain();
3110 Parcel reply = Parcel.obtain();
3111 data.writeInterfaceToken(IActivityManager.descriptor);
3112 data.writeStrongBinder(token);
3113 data.writeInt(nonRoot ? 1 : 0);
3114 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3115 reply.readException();
3116 boolean res = reply.readInt() != 0;
3117 data.recycle();
3118 reply.recycle();
3119 return res;
3120 }
3121 public void moveTaskBackwards(int task) throws RemoteException
3122 {
3123 Parcel data = Parcel.obtain();
3124 Parcel reply = Parcel.obtain();
3125 data.writeInterfaceToken(IActivityManager.descriptor);
3126 data.writeInt(task);
3127 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3128 reply.readException();
3129 data.recycle();
3130 reply.recycle();
3131 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003132 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003133 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3134 {
3135 Parcel data = Parcel.obtain();
3136 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003137 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003138 data.writeInt(taskId);
3139 data.writeInt(stackId);
3140 data.writeInt(toTop ? 1 : 0);
3141 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3142 reply.readException();
3143 data.recycle();
3144 reply.recycle();
3145 }
3146 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003147 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003148 {
3149 Parcel data = Parcel.obtain();
3150 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003151 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003152 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003153 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003154 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003155 reply.readException();
3156 data.recycle();
3157 reply.recycle();
3158 }
Craig Mautner967212c2013-04-13 21:10:58 -07003159 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003160 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003161 {
3162 Parcel data = Parcel.obtain();
3163 Parcel reply = Parcel.obtain();
3164 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003165 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003166 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003167 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003168 data.recycle();
3169 reply.recycle();
3170 return list;
3171 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003172 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003173 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003174 {
3175 Parcel data = Parcel.obtain();
3176 Parcel reply = Parcel.obtain();
3177 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003178 data.writeInt(stackId);
3179 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003180 reply.readException();
3181 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003182 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003183 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003184 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003185 }
3186 data.recycle();
3187 reply.recycle();
3188 return info;
3189 }
3190 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003191 public boolean isInHomeStack(int taskId) throws RemoteException {
3192 Parcel data = Parcel.obtain();
3193 Parcel reply = Parcel.obtain();
3194 data.writeInterfaceToken(IActivityManager.descriptor);
3195 data.writeInt(taskId);
3196 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3197 reply.readException();
3198 boolean isInHomeStack = reply.readInt() > 0;
3199 data.recycle();
3200 reply.recycle();
3201 return isInHomeStack;
3202 }
3203 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003204 public void setFocusedStack(int stackId) throws RemoteException
3205 {
3206 Parcel data = Parcel.obtain();
3207 Parcel reply = Parcel.obtain();
3208 data.writeInterfaceToken(IActivityManager.descriptor);
3209 data.writeInt(stackId);
3210 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3211 reply.readException();
3212 data.recycle();
3213 reply.recycle();
3214 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003215 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3216 {
3217 Parcel data = Parcel.obtain();
3218 Parcel reply = Parcel.obtain();
3219 data.writeInterfaceToken(IActivityManager.descriptor);
3220 data.writeStrongBinder(token);
3221 data.writeInt(onlyRoot ? 1 : 0);
3222 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3223 reply.readException();
3224 int res = reply.readInt();
3225 data.recycle();
3226 reply.recycle();
3227 return res;
3228 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003229 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003230 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003231 Parcel data = Parcel.obtain();
3232 Parcel reply = Parcel.obtain();
3233 data.writeInterfaceToken(IActivityManager.descriptor);
3234 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3235 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003236 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003237 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003238 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3239 reply.readException();
3240 int res = reply.readInt();
3241 ContentProviderHolder cph = null;
3242 if (res != 0) {
3243 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3244 }
3245 data.recycle();
3246 reply.recycle();
3247 return cph;
3248 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003249 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3250 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003251 Parcel data = Parcel.obtain();
3252 Parcel reply = Parcel.obtain();
3253 data.writeInterfaceToken(IActivityManager.descriptor);
3254 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003255 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003256 data.writeStrongBinder(token);
3257 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3258 reply.readException();
3259 int res = reply.readInt();
3260 ContentProviderHolder cph = null;
3261 if (res != 0) {
3262 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3263 }
3264 data.recycle();
3265 reply.recycle();
3266 return cph;
3267 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003268 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003269 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003270 {
3271 Parcel data = Parcel.obtain();
3272 Parcel reply = Parcel.obtain();
3273 data.writeInterfaceToken(IActivityManager.descriptor);
3274 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3275 data.writeTypedList(providers);
3276 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3277 reply.readException();
3278 data.recycle();
3279 reply.recycle();
3280 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003281 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3282 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003283 Parcel data = Parcel.obtain();
3284 Parcel reply = Parcel.obtain();
3285 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003286 data.writeStrongBinder(connection);
3287 data.writeInt(stable);
3288 data.writeInt(unstable);
3289 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3290 reply.readException();
3291 boolean res = reply.readInt() != 0;
3292 data.recycle();
3293 reply.recycle();
3294 return res;
3295 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003296
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003297 public void unstableProviderDied(IBinder connection) throws RemoteException {
3298 Parcel data = Parcel.obtain();
3299 Parcel reply = Parcel.obtain();
3300 data.writeInterfaceToken(IActivityManager.descriptor);
3301 data.writeStrongBinder(connection);
3302 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3303 reply.readException();
3304 data.recycle();
3305 reply.recycle();
3306 }
3307
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003308 @Override
3309 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3310 Parcel data = Parcel.obtain();
3311 Parcel reply = Parcel.obtain();
3312 data.writeInterfaceToken(IActivityManager.descriptor);
3313 data.writeStrongBinder(connection);
3314 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3315 reply.readException();
3316 data.recycle();
3317 reply.recycle();
3318 }
3319
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003320 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3321 Parcel data = Parcel.obtain();
3322 Parcel reply = Parcel.obtain();
3323 data.writeInterfaceToken(IActivityManager.descriptor);
3324 data.writeStrongBinder(connection);
3325 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003326 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3327 reply.readException();
3328 data.recycle();
3329 reply.recycle();
3330 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003331
3332 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3333 Parcel data = Parcel.obtain();
3334 Parcel reply = Parcel.obtain();
3335 data.writeInterfaceToken(IActivityManager.descriptor);
3336 data.writeString(name);
3337 data.writeStrongBinder(token);
3338 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3339 reply.readException();
3340 data.recycle();
3341 reply.recycle();
3342 }
3343
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003344 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3345 throws RemoteException
3346 {
3347 Parcel data = Parcel.obtain();
3348 Parcel reply = Parcel.obtain();
3349 data.writeInterfaceToken(IActivityManager.descriptor);
3350 service.writeToParcel(data, 0);
3351 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3352 reply.readException();
3353 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3354 data.recycle();
3355 reply.recycle();
3356 return res;
3357 }
3358
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003359 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003360 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003361 {
3362 Parcel data = Parcel.obtain();
3363 Parcel reply = Parcel.obtain();
3364 data.writeInterfaceToken(IActivityManager.descriptor);
3365 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3366 service.writeToParcel(data, 0);
3367 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003368 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003369 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3370 reply.readException();
3371 ComponentName res = ComponentName.readFromParcel(reply);
3372 data.recycle();
3373 reply.recycle();
3374 return res;
3375 }
3376 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003377 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003378 {
3379 Parcel data = Parcel.obtain();
3380 Parcel reply = Parcel.obtain();
3381 data.writeInterfaceToken(IActivityManager.descriptor);
3382 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3383 service.writeToParcel(data, 0);
3384 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003385 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003386 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3387 reply.readException();
3388 int res = reply.readInt();
3389 reply.recycle();
3390 data.recycle();
3391 return res;
3392 }
3393 public boolean stopServiceToken(ComponentName className, IBinder token,
3394 int startId) throws RemoteException {
3395 Parcel data = Parcel.obtain();
3396 Parcel reply = Parcel.obtain();
3397 data.writeInterfaceToken(IActivityManager.descriptor);
3398 ComponentName.writeToParcel(className, data);
3399 data.writeStrongBinder(token);
3400 data.writeInt(startId);
3401 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3402 reply.readException();
3403 boolean res = reply.readInt() != 0;
3404 data.recycle();
3405 reply.recycle();
3406 return res;
3407 }
3408 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003409 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003410 Parcel data = Parcel.obtain();
3411 Parcel reply = Parcel.obtain();
3412 data.writeInterfaceToken(IActivityManager.descriptor);
3413 ComponentName.writeToParcel(className, data);
3414 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003415 data.writeInt(id);
3416 if (notification != null) {
3417 data.writeInt(1);
3418 notification.writeToParcel(data, 0);
3419 } else {
3420 data.writeInt(0);
3421 }
3422 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003423 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3424 reply.readException();
3425 data.recycle();
3426 reply.recycle();
3427 }
3428 public int bindService(IApplicationThread caller, IBinder token,
3429 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003430 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003431 Parcel data = Parcel.obtain();
3432 Parcel reply = Parcel.obtain();
3433 data.writeInterfaceToken(IActivityManager.descriptor);
3434 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3435 data.writeStrongBinder(token);
3436 service.writeToParcel(data, 0);
3437 data.writeString(resolvedType);
3438 data.writeStrongBinder(connection.asBinder());
3439 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003440 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003441 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3442 reply.readException();
3443 int res = reply.readInt();
3444 data.recycle();
3445 reply.recycle();
3446 return res;
3447 }
3448 public boolean unbindService(IServiceConnection connection) throws RemoteException
3449 {
3450 Parcel data = Parcel.obtain();
3451 Parcel reply = Parcel.obtain();
3452 data.writeInterfaceToken(IActivityManager.descriptor);
3453 data.writeStrongBinder(connection.asBinder());
3454 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3455 reply.readException();
3456 boolean res = reply.readInt() != 0;
3457 data.recycle();
3458 reply.recycle();
3459 return res;
3460 }
3461
3462 public void publishService(IBinder token,
3463 Intent intent, IBinder service) throws RemoteException {
3464 Parcel data = Parcel.obtain();
3465 Parcel reply = Parcel.obtain();
3466 data.writeInterfaceToken(IActivityManager.descriptor);
3467 data.writeStrongBinder(token);
3468 intent.writeToParcel(data, 0);
3469 data.writeStrongBinder(service);
3470 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3471 reply.readException();
3472 data.recycle();
3473 reply.recycle();
3474 }
3475
3476 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3477 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.writeInt(doRebind ? 1 : 0);
3484 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3485 reply.readException();
3486 data.recycle();
3487 reply.recycle();
3488 }
3489
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003490 public void serviceDoneExecuting(IBinder token, int type, int startId,
3491 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003492 Parcel data = Parcel.obtain();
3493 Parcel reply = Parcel.obtain();
3494 data.writeInterfaceToken(IActivityManager.descriptor);
3495 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003496 data.writeInt(type);
3497 data.writeInt(startId);
3498 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003499 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3500 reply.readException();
3501 data.recycle();
3502 reply.recycle();
3503 }
3504
3505 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3506 Parcel data = Parcel.obtain();
3507 Parcel reply = Parcel.obtain();
3508 data.writeInterfaceToken(IActivityManager.descriptor);
3509 service.writeToParcel(data, 0);
3510 data.writeString(resolvedType);
3511 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3512 reply.readException();
3513 IBinder binder = reply.readStrongBinder();
3514 reply.recycle();
3515 data.recycle();
3516 return binder;
3517 }
3518
Christopher Tate181fafa2009-05-14 11:12:14 -07003519 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3520 throws RemoteException {
3521 Parcel data = Parcel.obtain();
3522 Parcel reply = Parcel.obtain();
3523 data.writeInterfaceToken(IActivityManager.descriptor);
3524 app.writeToParcel(data, 0);
3525 data.writeInt(backupRestoreMode);
3526 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3527 reply.readException();
3528 boolean success = reply.readInt() != 0;
3529 reply.recycle();
3530 data.recycle();
3531 return success;
3532 }
3533
Christopher Tate346acb12012-10-15 19:20:25 -07003534 public void clearPendingBackup() throws RemoteException {
3535 Parcel data = Parcel.obtain();
3536 Parcel reply = Parcel.obtain();
3537 data.writeInterfaceToken(IActivityManager.descriptor);
3538 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3539 reply.recycle();
3540 data.recycle();
3541 }
3542
Christopher Tate181fafa2009-05-14 11:12:14 -07003543 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3544 Parcel data = Parcel.obtain();
3545 Parcel reply = Parcel.obtain();
3546 data.writeInterfaceToken(IActivityManager.descriptor);
3547 data.writeString(packageName);
3548 data.writeStrongBinder(agent);
3549 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3550 reply.recycle();
3551 data.recycle();
3552 }
3553
3554 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3555 Parcel data = Parcel.obtain();
3556 Parcel reply = Parcel.obtain();
3557 data.writeInterfaceToken(IActivityManager.descriptor);
3558 app.writeToParcel(data, 0);
3559 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3560 reply.readException();
3561 reply.recycle();
3562 data.recycle();
3563 }
3564
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003565 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003566 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003567 IUiAutomationConnection connection, int userId, String instructionSet)
3568 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003569 Parcel data = Parcel.obtain();
3570 Parcel reply = Parcel.obtain();
3571 data.writeInterfaceToken(IActivityManager.descriptor);
3572 ComponentName.writeToParcel(className, data);
3573 data.writeString(profileFile);
3574 data.writeInt(flags);
3575 data.writeBundle(arguments);
3576 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003577 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003578 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003579 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003580 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3581 reply.readException();
3582 boolean res = reply.readInt() != 0;
3583 reply.recycle();
3584 data.recycle();
3585 return res;
3586 }
3587
3588 public void finishInstrumentation(IApplicationThread target,
3589 int resultCode, Bundle results) throws RemoteException {
3590 Parcel data = Parcel.obtain();
3591 Parcel reply = Parcel.obtain();
3592 data.writeInterfaceToken(IActivityManager.descriptor);
3593 data.writeStrongBinder(target != null ? target.asBinder() : null);
3594 data.writeInt(resultCode);
3595 data.writeBundle(results);
3596 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3597 reply.readException();
3598 data.recycle();
3599 reply.recycle();
3600 }
3601 public Configuration getConfiguration() throws RemoteException
3602 {
3603 Parcel data = Parcel.obtain();
3604 Parcel reply = Parcel.obtain();
3605 data.writeInterfaceToken(IActivityManager.descriptor);
3606 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3607 reply.readException();
3608 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3609 reply.recycle();
3610 data.recycle();
3611 return res;
3612 }
3613 public void updateConfiguration(Configuration values) throws RemoteException
3614 {
3615 Parcel data = Parcel.obtain();
3616 Parcel reply = Parcel.obtain();
3617 data.writeInterfaceToken(IActivityManager.descriptor);
3618 values.writeToParcel(data, 0);
3619 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3620 reply.readException();
3621 data.recycle();
3622 reply.recycle();
3623 }
3624 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3625 throws RemoteException {
3626 Parcel data = Parcel.obtain();
3627 Parcel reply = Parcel.obtain();
3628 data.writeInterfaceToken(IActivityManager.descriptor);
3629 data.writeStrongBinder(token);
3630 data.writeInt(requestedOrientation);
3631 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3632 reply.readException();
3633 data.recycle();
3634 reply.recycle();
3635 }
3636 public int getRequestedOrientation(IBinder token) throws RemoteException {
3637 Parcel data = Parcel.obtain();
3638 Parcel reply = Parcel.obtain();
3639 data.writeInterfaceToken(IActivityManager.descriptor);
3640 data.writeStrongBinder(token);
3641 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3642 reply.readException();
3643 int res = reply.readInt();
3644 data.recycle();
3645 reply.recycle();
3646 return res;
3647 }
3648 public ComponentName getActivityClassForToken(IBinder token)
3649 throws RemoteException {
3650 Parcel data = Parcel.obtain();
3651 Parcel reply = Parcel.obtain();
3652 data.writeInterfaceToken(IActivityManager.descriptor);
3653 data.writeStrongBinder(token);
3654 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3655 reply.readException();
3656 ComponentName res = ComponentName.readFromParcel(reply);
3657 data.recycle();
3658 reply.recycle();
3659 return res;
3660 }
3661 public String getPackageForToken(IBinder token) throws RemoteException
3662 {
3663 Parcel data = Parcel.obtain();
3664 Parcel reply = Parcel.obtain();
3665 data.writeInterfaceToken(IActivityManager.descriptor);
3666 data.writeStrongBinder(token);
3667 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3668 reply.readException();
3669 String res = reply.readString();
3670 data.recycle();
3671 reply.recycle();
3672 return res;
3673 }
3674 public IIntentSender getIntentSender(int type,
3675 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003676 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003677 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003678 Parcel data = Parcel.obtain();
3679 Parcel reply = Parcel.obtain();
3680 data.writeInterfaceToken(IActivityManager.descriptor);
3681 data.writeInt(type);
3682 data.writeString(packageName);
3683 data.writeStrongBinder(token);
3684 data.writeString(resultWho);
3685 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003686 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003687 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003688 data.writeTypedArray(intents, 0);
3689 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003690 } else {
3691 data.writeInt(0);
3692 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003693 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003694 if (options != null) {
3695 data.writeInt(1);
3696 options.writeToParcel(data, 0);
3697 } else {
3698 data.writeInt(0);
3699 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003700 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003701 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3702 reply.readException();
3703 IIntentSender res = IIntentSender.Stub.asInterface(
3704 reply.readStrongBinder());
3705 data.recycle();
3706 reply.recycle();
3707 return res;
3708 }
3709 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3710 Parcel data = Parcel.obtain();
3711 Parcel reply = Parcel.obtain();
3712 data.writeInterfaceToken(IActivityManager.descriptor);
3713 data.writeStrongBinder(sender.asBinder());
3714 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3715 reply.readException();
3716 data.recycle();
3717 reply.recycle();
3718 }
3719 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3720 Parcel data = Parcel.obtain();
3721 Parcel reply = Parcel.obtain();
3722 data.writeInterfaceToken(IActivityManager.descriptor);
3723 data.writeStrongBinder(sender.asBinder());
3724 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3725 reply.readException();
3726 String res = reply.readString();
3727 data.recycle();
3728 reply.recycle();
3729 return res;
3730 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003731 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3732 Parcel data = Parcel.obtain();
3733 Parcel reply = Parcel.obtain();
3734 data.writeInterfaceToken(IActivityManager.descriptor);
3735 data.writeStrongBinder(sender.asBinder());
3736 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3737 reply.readException();
3738 int res = reply.readInt();
3739 data.recycle();
3740 reply.recycle();
3741 return res;
3742 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003743 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3744 boolean requireFull, String name, String callerPackage) throws RemoteException {
3745 Parcel data = Parcel.obtain();
3746 Parcel reply = Parcel.obtain();
3747 data.writeInterfaceToken(IActivityManager.descriptor);
3748 data.writeInt(callingPid);
3749 data.writeInt(callingUid);
3750 data.writeInt(userId);
3751 data.writeInt(allowAll ? 1 : 0);
3752 data.writeInt(requireFull ? 1 : 0);
3753 data.writeString(name);
3754 data.writeString(callerPackage);
3755 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3756 reply.readException();
3757 int res = reply.readInt();
3758 data.recycle();
3759 reply.recycle();
3760 return res;
3761 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003762 public void setProcessLimit(int max) throws RemoteException
3763 {
3764 Parcel data = Parcel.obtain();
3765 Parcel reply = Parcel.obtain();
3766 data.writeInterfaceToken(IActivityManager.descriptor);
3767 data.writeInt(max);
3768 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3769 reply.readException();
3770 data.recycle();
3771 reply.recycle();
3772 }
3773 public int getProcessLimit() throws RemoteException
3774 {
3775 Parcel data = Parcel.obtain();
3776 Parcel reply = Parcel.obtain();
3777 data.writeInterfaceToken(IActivityManager.descriptor);
3778 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3779 reply.readException();
3780 int res = reply.readInt();
3781 data.recycle();
3782 reply.recycle();
3783 return res;
3784 }
3785 public void setProcessForeground(IBinder token, int pid,
3786 boolean isForeground) throws RemoteException {
3787 Parcel data = Parcel.obtain();
3788 Parcel reply = Parcel.obtain();
3789 data.writeInterfaceToken(IActivityManager.descriptor);
3790 data.writeStrongBinder(token);
3791 data.writeInt(pid);
3792 data.writeInt(isForeground ? 1 : 0);
3793 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3794 reply.readException();
3795 data.recycle();
3796 reply.recycle();
3797 }
3798 public int checkPermission(String permission, int pid, int uid)
3799 throws RemoteException {
3800 Parcel data = Parcel.obtain();
3801 Parcel reply = Parcel.obtain();
3802 data.writeInterfaceToken(IActivityManager.descriptor);
3803 data.writeString(permission);
3804 data.writeInt(pid);
3805 data.writeInt(uid);
3806 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3807 reply.readException();
3808 int res = reply.readInt();
3809 data.recycle();
3810 reply.recycle();
3811 return res;
3812 }
3813 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003814 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003815 Parcel data = Parcel.obtain();
3816 Parcel reply = Parcel.obtain();
3817 data.writeInterfaceToken(IActivityManager.descriptor);
3818 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003819 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003820 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003821 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3822 reply.readException();
3823 boolean res = reply.readInt() != 0;
3824 data.recycle();
3825 reply.recycle();
3826 return res;
3827 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003828 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003829 throws RemoteException {
3830 Parcel data = Parcel.obtain();
3831 Parcel reply = Parcel.obtain();
3832 data.writeInterfaceToken(IActivityManager.descriptor);
3833 uri.writeToParcel(data, 0);
3834 data.writeInt(pid);
3835 data.writeInt(uid);
3836 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003837 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003838 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3839 reply.readException();
3840 int res = reply.readInt();
3841 data.recycle();
3842 reply.recycle();
3843 return res;
3844 }
3845 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003846 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003847 Parcel data = Parcel.obtain();
3848 Parcel reply = Parcel.obtain();
3849 data.writeInterfaceToken(IActivityManager.descriptor);
3850 data.writeStrongBinder(caller.asBinder());
3851 data.writeString(targetPkg);
3852 uri.writeToParcel(data, 0);
3853 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003854 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003855 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3856 reply.readException();
3857 data.recycle();
3858 reply.recycle();
3859 }
3860 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003861 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003862 Parcel data = Parcel.obtain();
3863 Parcel reply = Parcel.obtain();
3864 data.writeInterfaceToken(IActivityManager.descriptor);
3865 data.writeStrongBinder(caller.asBinder());
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(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3870 reply.readException();
3871 data.recycle();
3872 reply.recycle();
3873 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003874
3875 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003876 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3877 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003878 Parcel data = Parcel.obtain();
3879 Parcel reply = Parcel.obtain();
3880 data.writeInterfaceToken(IActivityManager.descriptor);
3881 uri.writeToParcel(data, 0);
3882 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003883 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003884 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3885 reply.readException();
3886 data.recycle();
3887 reply.recycle();
3888 }
3889
3890 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003891 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3892 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003893 Parcel data = Parcel.obtain();
3894 Parcel reply = Parcel.obtain();
3895 data.writeInterfaceToken(IActivityManager.descriptor);
3896 uri.writeToParcel(data, 0);
3897 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003898 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003899 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3900 reply.readException();
3901 data.recycle();
3902 reply.recycle();
3903 }
3904
3905 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003906 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3907 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003908 Parcel data = Parcel.obtain();
3909 Parcel reply = Parcel.obtain();
3910 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003911 data.writeString(packageName);
3912 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003913 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3914 reply.readException();
3915 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3916 reply);
3917 data.recycle();
3918 reply.recycle();
3919 return perms;
3920 }
3921
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003922 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3923 throws RemoteException {
3924 Parcel data = Parcel.obtain();
3925 Parcel reply = Parcel.obtain();
3926 data.writeInterfaceToken(IActivityManager.descriptor);
3927 data.writeStrongBinder(who.asBinder());
3928 data.writeInt(waiting ? 1 : 0);
3929 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3930 reply.readException();
3931 data.recycle();
3932 reply.recycle();
3933 }
3934 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3935 Parcel data = Parcel.obtain();
3936 Parcel reply = Parcel.obtain();
3937 data.writeInterfaceToken(IActivityManager.descriptor);
3938 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3939 reply.readException();
3940 outInfo.readFromParcel(reply);
3941 data.recycle();
3942 reply.recycle();
3943 }
3944 public void unhandledBack() throws RemoteException
3945 {
3946 Parcel data = Parcel.obtain();
3947 Parcel reply = Parcel.obtain();
3948 data.writeInterfaceToken(IActivityManager.descriptor);
3949 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3950 reply.readException();
3951 data.recycle();
3952 reply.recycle();
3953 }
3954 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3955 {
3956 Parcel data = Parcel.obtain();
3957 Parcel reply = Parcel.obtain();
3958 data.writeInterfaceToken(IActivityManager.descriptor);
3959 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3960 reply.readException();
3961 ParcelFileDescriptor pfd = null;
3962 if (reply.readInt() != 0) {
3963 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3964 }
3965 data.recycle();
3966 reply.recycle();
3967 return pfd;
3968 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003969 public void setLockScreenShown(boolean shown) throws RemoteException
3970 {
3971 Parcel data = Parcel.obtain();
3972 Parcel reply = Parcel.obtain();
3973 data.writeInterfaceToken(IActivityManager.descriptor);
3974 data.writeInt(shown ? 1 : 0);
3975 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3976 reply.readException();
3977 data.recycle();
3978 reply.recycle();
3979 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003980 public void setDebugApp(
3981 String packageName, boolean waitForDebugger, boolean persistent)
3982 throws RemoteException
3983 {
3984 Parcel data = Parcel.obtain();
3985 Parcel reply = Parcel.obtain();
3986 data.writeInterfaceToken(IActivityManager.descriptor);
3987 data.writeString(packageName);
3988 data.writeInt(waitForDebugger ? 1 : 0);
3989 data.writeInt(persistent ? 1 : 0);
3990 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3991 reply.readException();
3992 data.recycle();
3993 reply.recycle();
3994 }
3995 public void setAlwaysFinish(boolean enabled) throws RemoteException
3996 {
3997 Parcel data = Parcel.obtain();
3998 Parcel reply = Parcel.obtain();
3999 data.writeInterfaceToken(IActivityManager.descriptor);
4000 data.writeInt(enabled ? 1 : 0);
4001 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4002 reply.readException();
4003 data.recycle();
4004 reply.recycle();
4005 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004006 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004007 {
4008 Parcel data = Parcel.obtain();
4009 Parcel reply = Parcel.obtain();
4010 data.writeInterfaceToken(IActivityManager.descriptor);
4011 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004012 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004013 reply.readException();
4014 data.recycle();
4015 reply.recycle();
4016 }
4017 public void enterSafeMode() throws RemoteException {
4018 Parcel data = Parcel.obtain();
4019 data.writeInterfaceToken(IActivityManager.descriptor);
4020 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4021 data.recycle();
4022 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08004023 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
4024 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004025 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004026 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004027 data.writeStrongBinder(sender.asBinder());
4028 data.writeInt(sourceUid);
4029 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004030 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4031 data.recycle();
4032 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004033 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004034 Parcel data = Parcel.obtain();
4035 Parcel reply = Parcel.obtain();
4036 data.writeInterfaceToken(IActivityManager.descriptor);
4037 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004038 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004039 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004040 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004041 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004042 boolean res = reply.readInt() != 0;
4043 data.recycle();
4044 reply.recycle();
4045 return res;
4046 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004047 @Override
4048 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4049 Parcel data = Parcel.obtain();
4050 Parcel reply = Parcel.obtain();
4051 data.writeInterfaceToken(IActivityManager.descriptor);
4052 data.writeString(reason);
4053 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4054 boolean res = reply.readInt() != 0;
4055 data.recycle();
4056 reply.recycle();
4057 return res;
4058 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004059 public boolean testIsSystemReady()
4060 {
4061 /* this base class version is never called */
4062 return true;
4063 }
Dan Egnor60d87622009-12-16 16:32:58 -08004064 public void handleApplicationCrash(IBinder app,
4065 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4066 {
4067 Parcel data = Parcel.obtain();
4068 Parcel reply = Parcel.obtain();
4069 data.writeInterfaceToken(IActivityManager.descriptor);
4070 data.writeStrongBinder(app);
4071 crashInfo.writeToParcel(data, 0);
4072 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4073 reply.readException();
4074 reply.recycle();
4075 data.recycle();
4076 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004077
Dianne Hackborn52322712014-08-26 22:47:26 -07004078 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004079 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004080 {
4081 Parcel data = Parcel.obtain();
4082 Parcel reply = Parcel.obtain();
4083 data.writeInterfaceToken(IActivityManager.descriptor);
4084 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004085 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004086 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004087 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004088 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004089 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004090 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004091 reply.recycle();
4092 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004093 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004094 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004095
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004096 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004097 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004098 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004099 {
4100 Parcel data = Parcel.obtain();
4101 Parcel reply = Parcel.obtain();
4102 data.writeInterfaceToken(IActivityManager.descriptor);
4103 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004104 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004105 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004106 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4107 reply.readException();
4108 reply.recycle();
4109 data.recycle();
4110 }
4111
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004112 public void signalPersistentProcesses(int sig) throws RemoteException {
4113 Parcel data = Parcel.obtain();
4114 Parcel reply = Parcel.obtain();
4115 data.writeInterfaceToken(IActivityManager.descriptor);
4116 data.writeInt(sig);
4117 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4118 reply.readException();
4119 data.recycle();
4120 reply.recycle();
4121 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004122
Dianne Hackborn1676c852012-09-10 14:52:30 -07004123 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004124 Parcel data = Parcel.obtain();
4125 Parcel reply = Parcel.obtain();
4126 data.writeInterfaceToken(IActivityManager.descriptor);
4127 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004128 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004129 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4130 reply.readException();
4131 data.recycle();
4132 reply.recycle();
4133 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004134
4135 public void killAllBackgroundProcesses() throws RemoteException {
4136 Parcel data = Parcel.obtain();
4137 Parcel reply = Parcel.obtain();
4138 data.writeInterfaceToken(IActivityManager.descriptor);
4139 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4140 reply.readException();
4141 data.recycle();
4142 reply.recycle();
4143 }
4144
Dianne Hackborn1676c852012-09-10 14:52:30 -07004145 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004146 Parcel data = Parcel.obtain();
4147 Parcel reply = Parcel.obtain();
4148 data.writeInterfaceToken(IActivityManager.descriptor);
4149 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004150 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004151 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004152 reply.readException();
4153 data.recycle();
4154 reply.recycle();
4155 }
4156
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004157 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4158 throws RemoteException
4159 {
4160 Parcel data = Parcel.obtain();
4161 Parcel reply = Parcel.obtain();
4162 data.writeInterfaceToken(IActivityManager.descriptor);
4163 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4164 reply.readException();
4165 outInfo.readFromParcel(reply);
4166 reply.recycle();
4167 data.recycle();
4168 }
4169
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004170 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4171 {
4172 Parcel data = Parcel.obtain();
4173 Parcel reply = Parcel.obtain();
4174 data.writeInterfaceToken(IActivityManager.descriptor);
4175 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4176 reply.readException();
4177 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4178 reply.recycle();
4179 data.recycle();
4180 return res;
4181 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004182
Dianne Hackborn1676c852012-09-10 14:52:30 -07004183 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004184 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004185 {
4186 Parcel data = Parcel.obtain();
4187 Parcel reply = Parcel.obtain();
4188 data.writeInterfaceToken(IActivityManager.descriptor);
4189 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004190 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004191 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004192 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004193 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004194 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004195 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004196 } else {
4197 data.writeInt(0);
4198 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004199 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4200 reply.readException();
4201 boolean res = reply.readInt() != 0;
4202 reply.recycle();
4203 data.recycle();
4204 return res;
4205 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004206
Dianne Hackborn55280a92009-05-07 15:53:46 -07004207 public boolean shutdown(int timeout) throws RemoteException
4208 {
4209 Parcel data = Parcel.obtain();
4210 Parcel reply = Parcel.obtain();
4211 data.writeInterfaceToken(IActivityManager.descriptor);
4212 data.writeInt(timeout);
4213 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4214 reply.readException();
4215 boolean res = reply.readInt() != 0;
4216 reply.recycle();
4217 data.recycle();
4218 return res;
4219 }
4220
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004221 public void stopAppSwitches() throws RemoteException {
4222 Parcel data = Parcel.obtain();
4223 Parcel reply = Parcel.obtain();
4224 data.writeInterfaceToken(IActivityManager.descriptor);
4225 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4226 reply.readException();
4227 reply.recycle();
4228 data.recycle();
4229 }
4230
4231 public void resumeAppSwitches() throws RemoteException {
4232 Parcel data = Parcel.obtain();
4233 Parcel reply = Parcel.obtain();
4234 data.writeInterfaceToken(IActivityManager.descriptor);
4235 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4236 reply.readException();
4237 reply.recycle();
4238 data.recycle();
4239 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004240
4241 public void addPackageDependency(String packageName) throws RemoteException {
4242 Parcel data = Parcel.obtain();
4243 Parcel reply = Parcel.obtain();
4244 data.writeInterfaceToken(IActivityManager.descriptor);
4245 data.writeString(packageName);
4246 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4247 reply.readException();
4248 data.recycle();
4249 reply.recycle();
4250 }
4251
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004252 public void killApplicationWithAppId(String pkg, int appid, String reason)
4253 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004254 Parcel data = Parcel.obtain();
4255 Parcel reply = Parcel.obtain();
4256 data.writeInterfaceToken(IActivityManager.descriptor);
4257 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004258 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004259 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004260 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004261 reply.readException();
4262 data.recycle();
4263 reply.recycle();
4264 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004265
4266 public void closeSystemDialogs(String reason) throws RemoteException {
4267 Parcel data = Parcel.obtain();
4268 Parcel reply = Parcel.obtain();
4269 data.writeInterfaceToken(IActivityManager.descriptor);
4270 data.writeString(reason);
4271 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4272 reply.readException();
4273 data.recycle();
4274 reply.recycle();
4275 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004276
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004277 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004278 throws RemoteException {
4279 Parcel data = Parcel.obtain();
4280 Parcel reply = Parcel.obtain();
4281 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004282 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004283 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4284 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004285 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004286 data.recycle();
4287 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004288 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004289 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004290
4291 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4292 Parcel data = Parcel.obtain();
4293 Parcel reply = Parcel.obtain();
4294 data.writeInterfaceToken(IActivityManager.descriptor);
4295 data.writeString(processName);
4296 data.writeInt(uid);
4297 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4298 reply.readException();
4299 data.recycle();
4300 reply.recycle();
4301 }
4302
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004303 public void overridePendingTransition(IBinder token, String packageName,
4304 int enterAnim, int exitAnim) throws RemoteException {
4305 Parcel data = Parcel.obtain();
4306 Parcel reply = Parcel.obtain();
4307 data.writeInterfaceToken(IActivityManager.descriptor);
4308 data.writeStrongBinder(token);
4309 data.writeString(packageName);
4310 data.writeInt(enterAnim);
4311 data.writeInt(exitAnim);
4312 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4313 reply.readException();
4314 data.recycle();
4315 reply.recycle();
4316 }
4317
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004318 public boolean isUserAMonkey() throws RemoteException {
4319 Parcel data = Parcel.obtain();
4320 Parcel reply = Parcel.obtain();
4321 data.writeInterfaceToken(IActivityManager.descriptor);
4322 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4323 reply.readException();
4324 boolean res = reply.readInt() != 0;
4325 data.recycle();
4326 reply.recycle();
4327 return res;
4328 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004329
4330 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4331 Parcel data = Parcel.obtain();
4332 Parcel reply = Parcel.obtain();
4333 data.writeInterfaceToken(IActivityManager.descriptor);
4334 data.writeInt(monkey ? 1 : 0);
4335 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4336 reply.readException();
4337 data.recycle();
4338 reply.recycle();
4339 }
4340
Dianne Hackborn860755f2010-06-03 18:47:52 -07004341 public void finishHeavyWeightApp() throws RemoteException {
4342 Parcel data = Parcel.obtain();
4343 Parcel reply = Parcel.obtain();
4344 data.writeInterfaceToken(IActivityManager.descriptor);
4345 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4346 reply.readException();
4347 data.recycle();
4348 reply.recycle();
4349 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004350
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004351 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004352 throws RemoteException {
4353 Parcel data = Parcel.obtain();
4354 Parcel reply = Parcel.obtain();
4355 data.writeInterfaceToken(IActivityManager.descriptor);
4356 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004357 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4358 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004359 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004360 data.recycle();
4361 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004362 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004363 }
4364
Craig Mautner233ceee2014-05-09 17:05:11 -07004365 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004366 throws RemoteException {
4367 Parcel data = Parcel.obtain();
4368 Parcel reply = Parcel.obtain();
4369 data.writeInterfaceToken(IActivityManager.descriptor);
4370 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004371 if (options == null) {
4372 data.writeInt(0);
4373 } else {
4374 data.writeInt(1);
4375 data.writeBundle(options.toBundle());
4376 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004377 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004378 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004379 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004380 data.recycle();
4381 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004382 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004383 }
4384
Craig Mautner233ceee2014-05-09 17:05:11 -07004385 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4386 Parcel data = Parcel.obtain();
4387 Parcel reply = Parcel.obtain();
4388 data.writeInterfaceToken(IActivityManager.descriptor);
4389 data.writeStrongBinder(token);
4390 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4391 reply.readException();
4392 Bundle bundle = reply.readBundle();
4393 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4394 data.recycle();
4395 reply.recycle();
4396 return options;
4397 }
4398
Daniel Sandler69a48172010-06-23 16:29:36 -04004399 public void setImmersive(IBinder token, boolean immersive)
4400 throws RemoteException {
4401 Parcel data = Parcel.obtain();
4402 Parcel reply = Parcel.obtain();
4403 data.writeInterfaceToken(IActivityManager.descriptor);
4404 data.writeStrongBinder(token);
4405 data.writeInt(immersive ? 1 : 0);
4406 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4407 reply.readException();
4408 data.recycle();
4409 reply.recycle();
4410 }
4411
4412 public boolean isImmersive(IBinder token)
4413 throws RemoteException {
4414 Parcel data = Parcel.obtain();
4415 Parcel reply = Parcel.obtain();
4416 data.writeInterfaceToken(IActivityManager.descriptor);
4417 data.writeStrongBinder(token);
4418 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004419 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004420 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004421 data.recycle();
4422 reply.recycle();
4423 return res;
4424 }
4425
Craig Mautnerd61dc202014-07-07 11:09:11 -07004426 public boolean isTopOfTask(IBinder token) throws RemoteException {
4427 Parcel data = Parcel.obtain();
4428 Parcel reply = Parcel.obtain();
4429 data.writeInterfaceToken(IActivityManager.descriptor);
4430 data.writeStrongBinder(token);
4431 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4432 reply.readException();
4433 boolean res = reply.readInt() == 1;
4434 data.recycle();
4435 reply.recycle();
4436 return res;
4437 }
4438
Daniel Sandler69a48172010-06-23 16:29:36 -04004439 public boolean isTopActivityImmersive()
4440 throws RemoteException {
4441 Parcel data = Parcel.obtain();
4442 Parcel reply = Parcel.obtain();
4443 data.writeInterfaceToken(IActivityManager.descriptor);
4444 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004445 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004446 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004447 data.recycle();
4448 reply.recycle();
4449 return res;
4450 }
4451
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004452 public void crashApplication(int uid, int initialPid, String packageName,
4453 String message) throws RemoteException {
4454 Parcel data = Parcel.obtain();
4455 Parcel reply = Parcel.obtain();
4456 data.writeInterfaceToken(IActivityManager.descriptor);
4457 data.writeInt(uid);
4458 data.writeInt(initialPid);
4459 data.writeString(packageName);
4460 data.writeString(message);
4461 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4462 reply.readException();
4463 data.recycle();
4464 reply.recycle();
4465 }
Andy McFadden824c5102010-07-09 16:26:57 -07004466
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004467 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004468 Parcel data = Parcel.obtain();
4469 Parcel reply = Parcel.obtain();
4470 data.writeInterfaceToken(IActivityManager.descriptor);
4471 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004472 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004473 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4474 reply.readException();
4475 String res = reply.readString();
4476 data.recycle();
4477 reply.recycle();
4478 return res;
4479 }
4480
Dianne Hackborn7e269642010-08-25 19:50:20 -07004481 public IBinder newUriPermissionOwner(String name)
4482 throws RemoteException {
4483 Parcel data = Parcel.obtain();
4484 Parcel reply = Parcel.obtain();
4485 data.writeInterfaceToken(IActivityManager.descriptor);
4486 data.writeString(name);
4487 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4488 reply.readException();
4489 IBinder res = reply.readStrongBinder();
4490 data.recycle();
4491 reply.recycle();
4492 return res;
4493 }
4494
4495 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004496 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004497 Parcel data = Parcel.obtain();
4498 Parcel reply = Parcel.obtain();
4499 data.writeInterfaceToken(IActivityManager.descriptor);
4500 data.writeStrongBinder(owner);
4501 data.writeInt(fromUid);
4502 data.writeString(targetPkg);
4503 uri.writeToParcel(data, 0);
4504 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004505 data.writeInt(sourceUserId);
4506 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004507 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4508 reply.readException();
4509 data.recycle();
4510 reply.recycle();
4511 }
4512
4513 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004514 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004515 Parcel data = Parcel.obtain();
4516 Parcel reply = Parcel.obtain();
4517 data.writeInterfaceToken(IActivityManager.descriptor);
4518 data.writeStrongBinder(owner);
4519 if (uri != null) {
4520 data.writeInt(1);
4521 uri.writeToParcel(data, 0);
4522 } else {
4523 data.writeInt(0);
4524 }
4525 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004526 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004527 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4528 reply.readException();
4529 data.recycle();
4530 reply.recycle();
4531 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004532
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004533 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004534 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004535 Parcel data = Parcel.obtain();
4536 Parcel reply = Parcel.obtain();
4537 data.writeInterfaceToken(IActivityManager.descriptor);
4538 data.writeInt(callingUid);
4539 data.writeString(targetPkg);
4540 uri.writeToParcel(data, 0);
4541 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004542 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004543 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4544 reply.readException();
4545 int res = reply.readInt();
4546 data.recycle();
4547 reply.recycle();
4548 return res;
4549 }
4550
Dianne Hackborn1676c852012-09-10 14:52:30 -07004551 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004552 String path, ParcelFileDescriptor fd) throws RemoteException {
4553 Parcel data = Parcel.obtain();
4554 Parcel reply = Parcel.obtain();
4555 data.writeInterfaceToken(IActivityManager.descriptor);
4556 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004557 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004558 data.writeInt(managed ? 1 : 0);
4559 data.writeString(path);
4560 if (fd != null) {
4561 data.writeInt(1);
4562 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4563 } else {
4564 data.writeInt(0);
4565 }
4566 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4567 reply.readException();
4568 boolean res = reply.readInt() != 0;
4569 reply.recycle();
4570 data.recycle();
4571 return res;
4572 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004573
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004574 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004575 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004576 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004577 Parcel data = Parcel.obtain();
4578 Parcel reply = Parcel.obtain();
4579 data.writeInterfaceToken(IActivityManager.descriptor);
4580 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004581 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004582 data.writeTypedArray(intents, 0);
4583 data.writeStringArray(resolvedTypes);
4584 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004585 if (options != null) {
4586 data.writeInt(1);
4587 options.writeToParcel(data, 0);
4588 } else {
4589 data.writeInt(0);
4590 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004591 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004592 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4593 reply.readException();
4594 int result = reply.readInt();
4595 reply.recycle();
4596 data.recycle();
4597 return result;
4598 }
4599
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004600 public int getFrontActivityScreenCompatMode() throws RemoteException {
4601 Parcel data = Parcel.obtain();
4602 Parcel reply = Parcel.obtain();
4603 data.writeInterfaceToken(IActivityManager.descriptor);
4604 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4605 reply.readException();
4606 int mode = reply.readInt();
4607 reply.recycle();
4608 data.recycle();
4609 return mode;
4610 }
4611
4612 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4613 Parcel data = Parcel.obtain();
4614 Parcel reply = Parcel.obtain();
4615 data.writeInterfaceToken(IActivityManager.descriptor);
4616 data.writeInt(mode);
4617 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4618 reply.readException();
4619 reply.recycle();
4620 data.recycle();
4621 }
4622
4623 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4624 Parcel data = Parcel.obtain();
4625 Parcel reply = Parcel.obtain();
4626 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004627 data.writeString(packageName);
4628 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004629 reply.readException();
4630 int mode = reply.readInt();
4631 reply.recycle();
4632 data.recycle();
4633 return mode;
4634 }
4635
4636 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004637 throws RemoteException {
4638 Parcel data = Parcel.obtain();
4639 Parcel reply = Parcel.obtain();
4640 data.writeInterfaceToken(IActivityManager.descriptor);
4641 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004642 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004643 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4644 reply.readException();
4645 reply.recycle();
4646 data.recycle();
4647 }
4648
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004649 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4650 Parcel data = Parcel.obtain();
4651 Parcel reply = Parcel.obtain();
4652 data.writeInterfaceToken(IActivityManager.descriptor);
4653 data.writeString(packageName);
4654 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4655 reply.readException();
4656 boolean ask = reply.readInt() != 0;
4657 reply.recycle();
4658 data.recycle();
4659 return ask;
4660 }
4661
4662 public void setPackageAskScreenCompat(String packageName, boolean ask)
4663 throws RemoteException {
4664 Parcel data = Parcel.obtain();
4665 Parcel reply = Parcel.obtain();
4666 data.writeInterfaceToken(IActivityManager.descriptor);
4667 data.writeString(packageName);
4668 data.writeInt(ask ? 1 : 0);
4669 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4670 reply.readException();
4671 reply.recycle();
4672 data.recycle();
4673 }
4674
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004675 public boolean switchUser(int userid) throws RemoteException {
4676 Parcel data = Parcel.obtain();
4677 Parcel reply = Parcel.obtain();
4678 data.writeInterfaceToken(IActivityManager.descriptor);
4679 data.writeInt(userid);
4680 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4681 reply.readException();
4682 boolean result = reply.readInt() != 0;
4683 reply.recycle();
4684 data.recycle();
4685 return result;
4686 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004687
Kenny Guy08488bf2014-02-21 17:40:37 +00004688 public boolean startUserInBackground(int userid) throws RemoteException {
4689 Parcel data = Parcel.obtain();
4690 Parcel reply = Parcel.obtain();
4691 data.writeInterfaceToken(IActivityManager.descriptor);
4692 data.writeInt(userid);
4693 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4694 reply.readException();
4695 boolean result = reply.readInt() != 0;
4696 reply.recycle();
4697 data.recycle();
4698 return result;
4699 }
4700
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004701 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4702 Parcel data = Parcel.obtain();
4703 Parcel reply = Parcel.obtain();
4704 data.writeInterfaceToken(IActivityManager.descriptor);
4705 data.writeInt(userid);
4706 data.writeStrongInterface(callback);
4707 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4708 reply.readException();
4709 int result = reply.readInt();
4710 reply.recycle();
4711 data.recycle();
4712 return result;
4713 }
4714
Amith Yamasani52f1d752012-03-28 18:19:29 -07004715 public UserInfo getCurrentUser() throws RemoteException {
4716 Parcel data = Parcel.obtain();
4717 Parcel reply = Parcel.obtain();
4718 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004719 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004720 reply.readException();
4721 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4722 reply.recycle();
4723 data.recycle();
4724 return userInfo;
4725 }
4726
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004727 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004728 Parcel data = Parcel.obtain();
4729 Parcel reply = Parcel.obtain();
4730 data.writeInterfaceToken(IActivityManager.descriptor);
4731 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004732 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004733 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4734 reply.readException();
4735 boolean result = reply.readInt() != 0;
4736 reply.recycle();
4737 data.recycle();
4738 return result;
4739 }
4740
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004741 public int[] getRunningUserIds() throws RemoteException {
4742 Parcel data = Parcel.obtain();
4743 Parcel reply = Parcel.obtain();
4744 data.writeInterfaceToken(IActivityManager.descriptor);
4745 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4746 reply.readException();
4747 int[] result = reply.createIntArray();
4748 reply.recycle();
4749 data.recycle();
4750 return result;
4751 }
4752
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004753 public boolean removeTask(int taskId, int flags) throws RemoteException {
4754 Parcel data = Parcel.obtain();
4755 Parcel reply = Parcel.obtain();
4756 data.writeInterfaceToken(IActivityManager.descriptor);
4757 data.writeInt(taskId);
4758 data.writeInt(flags);
4759 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4760 reply.readException();
4761 boolean result = reply.readInt() != 0;
4762 reply.recycle();
4763 data.recycle();
4764 return result;
4765 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004766
Jeff Sharkeya4620792011-05-20 15:29:23 -07004767 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4768 Parcel data = Parcel.obtain();
4769 Parcel reply = Parcel.obtain();
4770 data.writeInterfaceToken(IActivityManager.descriptor);
4771 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4772 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4773 reply.readException();
4774 data.recycle();
4775 reply.recycle();
4776 }
4777
4778 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4779 Parcel data = Parcel.obtain();
4780 Parcel reply = Parcel.obtain();
4781 data.writeInterfaceToken(IActivityManager.descriptor);
4782 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4783 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4784 reply.readException();
4785 data.recycle();
4786 reply.recycle();
4787 }
4788
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004789 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4790 Parcel data = Parcel.obtain();
4791 Parcel reply = Parcel.obtain();
4792 data.writeInterfaceToken(IActivityManager.descriptor);
4793 data.writeStrongBinder(sender.asBinder());
4794 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4795 reply.readException();
4796 boolean res = reply.readInt() != 0;
4797 data.recycle();
4798 reply.recycle();
4799 return res;
4800 }
4801
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004802 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4803 Parcel data = Parcel.obtain();
4804 Parcel reply = Parcel.obtain();
4805 data.writeInterfaceToken(IActivityManager.descriptor);
4806 data.writeStrongBinder(sender.asBinder());
4807 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4808 reply.readException();
4809 boolean res = reply.readInt() != 0;
4810 data.recycle();
4811 reply.recycle();
4812 return res;
4813 }
4814
Dianne Hackborn81038902012-11-26 17:04:09 -08004815 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4816 Parcel data = Parcel.obtain();
4817 Parcel reply = Parcel.obtain();
4818 data.writeInterfaceToken(IActivityManager.descriptor);
4819 data.writeStrongBinder(sender.asBinder());
4820 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4821 reply.readException();
4822 Intent res = reply.readInt() != 0
4823 ? Intent.CREATOR.createFromParcel(reply) : null;
4824 data.recycle();
4825 reply.recycle();
4826 return res;
4827 }
4828
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004829 public String getTagForIntentSender(IIntentSender sender, String prefix)
4830 throws RemoteException {
4831 Parcel data = Parcel.obtain();
4832 Parcel reply = Parcel.obtain();
4833 data.writeInterfaceToken(IActivityManager.descriptor);
4834 data.writeStrongBinder(sender.asBinder());
4835 data.writeString(prefix);
4836 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4837 reply.readException();
4838 String res = reply.readString();
4839 data.recycle();
4840 reply.recycle();
4841 return res;
4842 }
4843
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004844 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4845 {
4846 Parcel data = Parcel.obtain();
4847 Parcel reply = Parcel.obtain();
4848 data.writeInterfaceToken(IActivityManager.descriptor);
4849 values.writeToParcel(data, 0);
4850 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4851 reply.readException();
4852 data.recycle();
4853 reply.recycle();
4854 }
4855
Dianne Hackbornb437e092011-08-05 17:50:29 -07004856 public long[] getProcessPss(int[] pids) throws RemoteException {
4857 Parcel data = Parcel.obtain();
4858 Parcel reply = Parcel.obtain();
4859 data.writeInterfaceToken(IActivityManager.descriptor);
4860 data.writeIntArray(pids);
4861 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4862 reply.readException();
4863 long[] res = reply.createLongArray();
4864 data.recycle();
4865 reply.recycle();
4866 return res;
4867 }
4868
Dianne Hackborn661cd522011-08-22 00:26:20 -07004869 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4870 Parcel data = Parcel.obtain();
4871 Parcel reply = Parcel.obtain();
4872 data.writeInterfaceToken(IActivityManager.descriptor);
4873 TextUtils.writeToParcel(msg, data, 0);
4874 data.writeInt(always ? 1 : 0);
4875 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4876 reply.readException();
4877 data.recycle();
4878 reply.recycle();
4879 }
4880
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004881 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004882 Parcel data = Parcel.obtain();
4883 Parcel reply = Parcel.obtain();
4884 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004885 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004886 reply.readException();
4887 data.recycle();
4888 reply.recycle();
4889 }
4890
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004891 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07004892 throws RemoteException {
4893 Parcel data = Parcel.obtain();
4894 Parcel reply = Parcel.obtain();
4895 data.writeInterfaceToken(IActivityManager.descriptor);
4896 data.writeStrongBinder(token);
4897 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004898 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07004899 reply.readException();
4900 boolean result = reply.readInt() != 0;
4901 data.recycle();
4902 reply.recycle();
4903 return result;
4904 }
4905
4906 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4907 throws RemoteException {
4908 Parcel data = Parcel.obtain();
4909 Parcel reply = Parcel.obtain();
4910 data.writeInterfaceToken(IActivityManager.descriptor);
4911 data.writeStrongBinder(token);
4912 target.writeToParcel(data, 0);
4913 data.writeInt(resultCode);
4914 if (resultData != null) {
4915 data.writeInt(1);
4916 resultData.writeToParcel(data, 0);
4917 } else {
4918 data.writeInt(0);
4919 }
4920 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4921 reply.readException();
4922 boolean result = reply.readInt() != 0;
4923 data.recycle();
4924 reply.recycle();
4925 return result;
4926 }
4927
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004928 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4929 Parcel data = Parcel.obtain();
4930 Parcel reply = Parcel.obtain();
4931 data.writeInterfaceToken(IActivityManager.descriptor);
4932 data.writeStrongBinder(activityToken);
4933 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4934 reply.readException();
4935 int result = reply.readInt();
4936 data.recycle();
4937 reply.recycle();
4938 return result;
4939 }
4940
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004941 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4942 Parcel data = Parcel.obtain();
4943 Parcel reply = Parcel.obtain();
4944 data.writeInterfaceToken(IActivityManager.descriptor);
4945 data.writeStrongBinder(activityToken);
4946 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4947 reply.readException();
4948 String result = reply.readString();
4949 data.recycle();
4950 reply.recycle();
4951 return result;
4952 }
4953
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004954 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4955 Parcel data = Parcel.obtain();
4956 Parcel reply = Parcel.obtain();
4957 data.writeInterfaceToken(IActivityManager.descriptor);
4958 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4959 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4960 reply.readException();
4961 data.recycle();
4962 reply.recycle();
4963 }
4964
4965 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4966 Parcel data = Parcel.obtain();
4967 Parcel reply = Parcel.obtain();
4968 data.writeInterfaceToken(IActivityManager.descriptor);
4969 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4970 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4971 reply.readException();
4972 data.recycle();
4973 reply.recycle();
4974 }
4975
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004976 public void requestBugReport() throws RemoteException {
4977 Parcel data = Parcel.obtain();
4978 Parcel reply = Parcel.obtain();
4979 data.writeInterfaceToken(IActivityManager.descriptor);
4980 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4981 reply.readException();
4982 data.recycle();
4983 reply.recycle();
4984 }
4985
Jeff Brownbd181bb2013-09-10 16:44:24 -07004986 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4987 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004988 Parcel data = Parcel.obtain();
4989 Parcel reply = Parcel.obtain();
4990 data.writeInterfaceToken(IActivityManager.descriptor);
4991 data.writeInt(pid);
4992 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004993 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004994 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4995 reply.readException();
4996 long res = reply.readInt();
4997 data.recycle();
4998 reply.recycle();
4999 return res;
5000 }
5001
Adam Skorydfc7fd72013-08-05 19:23:41 -07005002 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005003 Parcel data = Parcel.obtain();
5004 Parcel reply = Parcel.obtain();
5005 data.writeInterfaceToken(IActivityManager.descriptor);
5006 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005007 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005008 reply.readException();
5009 Bundle res = reply.readBundle();
5010 data.recycle();
5011 reply.recycle();
5012 return res;
5013 }
5014
Adam Skory7140a252013-09-11 12:04:58 +01005015 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005016 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.writeStrongBinder(token);
5021 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005022 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005023 reply.readException();
5024 data.recycle();
5025 reply.recycle();
5026 }
5027
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005028 public void killUid(int uid, String reason) throws RemoteException {
5029 Parcel data = Parcel.obtain();
5030 Parcel reply = Parcel.obtain();
5031 data.writeInterfaceToken(IActivityManager.descriptor);
5032 data.writeInt(uid);
5033 data.writeString(reason);
5034 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5035 reply.readException();
5036 data.recycle();
5037 reply.recycle();
5038 }
5039
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005040 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5041 Parcel data = Parcel.obtain();
5042 Parcel reply = Parcel.obtain();
5043 data.writeInterfaceToken(IActivityManager.descriptor);
5044 data.writeStrongBinder(who);
5045 data.writeInt(allowRestart ? 1 : 0);
5046 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5047 reply.readException();
5048 data.recycle();
5049 reply.recycle();
5050 }
5051
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005052 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5053 Parcel data = Parcel.obtain();
5054 Parcel reply = Parcel.obtain();
5055 data.writeInterfaceToken(IActivityManager.descriptor);
5056 data.writeStrongBinder(token);
5057 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5058 reply.readException();
5059 data.recycle();
5060 reply.recycle();
5061 }
5062
Craig Mautner5eda9b32013-07-02 11:58:16 -07005063 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5064 Parcel data = Parcel.obtain();
5065 Parcel reply = Parcel.obtain();
5066 data.writeInterfaceToken(IActivityManager.descriptor);
5067 data.writeStrongBinder(token);
5068 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5069 reply.readException();
5070 data.recycle();
5071 reply.recycle();
5072 }
5073
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005074 public void restart() throws RemoteException {
5075 Parcel data = Parcel.obtain();
5076 Parcel reply = Parcel.obtain();
5077 data.writeInterfaceToken(IActivityManager.descriptor);
5078 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5079 reply.readException();
5080 data.recycle();
5081 reply.recycle();
5082 }
5083
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005084 public void performIdleMaintenance() throws RemoteException {
5085 Parcel data = Parcel.obtain();
5086 Parcel reply = Parcel.obtain();
5087 data.writeInterfaceToken(IActivityManager.descriptor);
5088 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5089 reply.readException();
5090 data.recycle();
5091 reply.recycle();
5092 }
5093
Craig Mautner4a1cb222013-12-04 16:14:06 -08005094 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
5095 IActivityContainerCallback callback) throws RemoteException {
5096 Parcel data = Parcel.obtain();
5097 Parcel reply = Parcel.obtain();
5098 data.writeInterfaceToken(IActivityManager.descriptor);
5099 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005100 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08005101 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5102 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005103 final int result = reply.readInt();
5104 final IActivityContainer res;
5105 if (result == 1) {
5106 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5107 } else {
5108 res = null;
5109 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005110 data.recycle();
5111 reply.recycle();
5112 return res;
5113 }
5114
Craig Mautner95da1082014-02-24 17:54:35 -08005115 public void deleteActivityContainer(IActivityContainer activityContainer)
5116 throws RemoteException {
5117 Parcel data = Parcel.obtain();
5118 Parcel reply = Parcel.obtain();
5119 data.writeInterfaceToken(IActivityManager.descriptor);
5120 data.writeStrongBinder(activityContainer.asBinder());
5121 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5122 reply.readException();
5123 data.recycle();
5124 reply.recycle();
5125 }
5126
Craig Mautnere0a38842013-12-16 16:14:02 -08005127 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
5128 throws RemoteException {
5129 Parcel data = Parcel.obtain();
5130 Parcel reply = Parcel.obtain();
5131 data.writeInterfaceToken(IActivityManager.descriptor);
5132 data.writeStrongBinder(activityToken);
5133 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5134 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005135 final int result = reply.readInt();
5136 final IActivityContainer res;
5137 if (result == 1) {
5138 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5139 } else {
5140 res = null;
5141 }
Craig Mautnere0a38842013-12-16 16:14:02 -08005142 data.recycle();
5143 reply.recycle();
5144 return res;
5145 }
5146
Craig Mautner4a1cb222013-12-04 16:14:06 -08005147 public IBinder getHomeActivityToken() throws RemoteException {
5148 Parcel data = Parcel.obtain();
5149 Parcel reply = Parcel.obtain();
5150 data.writeInterfaceToken(IActivityManager.descriptor);
5151 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5152 reply.readException();
5153 IBinder res = reply.readStrongBinder();
5154 data.recycle();
5155 reply.recycle();
5156 return res;
5157 }
5158
Craig Mautneraea74a52014-03-08 14:23:10 -08005159 @Override
5160 public void startLockTaskMode(int taskId) throws RemoteException {
5161 Parcel data = Parcel.obtain();
5162 Parcel reply = Parcel.obtain();
5163 data.writeInterfaceToken(IActivityManager.descriptor);
5164 data.writeInt(taskId);
5165 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5166 reply.readException();
5167 data.recycle();
5168 reply.recycle();
5169 }
5170
5171 @Override
5172 public void startLockTaskMode(IBinder token) throws RemoteException {
5173 Parcel data = Parcel.obtain();
5174 Parcel reply = Parcel.obtain();
5175 data.writeInterfaceToken(IActivityManager.descriptor);
5176 data.writeStrongBinder(token);
5177 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5178 reply.readException();
5179 data.recycle();
5180 reply.recycle();
5181 }
5182
5183 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005184 public void startLockTaskModeOnCurrent() throws RemoteException {
5185 Parcel data = Parcel.obtain();
5186 Parcel reply = Parcel.obtain();
5187 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005188 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005189 reply.readException();
5190 data.recycle();
5191 reply.recycle();
5192 }
5193
5194 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005195 public void stopLockTaskMode() throws RemoteException {
5196 Parcel data = Parcel.obtain();
5197 Parcel reply = Parcel.obtain();
5198 data.writeInterfaceToken(IActivityManager.descriptor);
5199 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5200 reply.readException();
5201 data.recycle();
5202 reply.recycle();
5203 }
5204
5205 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005206 public void stopLockTaskModeOnCurrent() throws RemoteException {
5207 Parcel data = Parcel.obtain();
5208 Parcel reply = Parcel.obtain();
5209 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005210 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005211 reply.readException();
5212 data.recycle();
5213 reply.recycle();
5214 }
5215
5216 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005217 public boolean isInLockTaskMode() throws RemoteException {
5218 Parcel data = Parcel.obtain();
5219 Parcel reply = Parcel.obtain();
5220 data.writeInterfaceToken(IActivityManager.descriptor);
5221 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5222 reply.readException();
5223 boolean isInLockTaskMode = reply.readInt() == 1;
5224 data.recycle();
5225 reply.recycle();
5226 return isInLockTaskMode;
5227 }
5228
Craig Mautner688b5102014-03-27 16:55:03 -07005229 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005230 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005231 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005232 Parcel data = Parcel.obtain();
5233 Parcel reply = Parcel.obtain();
5234 data.writeInterfaceToken(IActivityManager.descriptor);
5235 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005236 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005237 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005238 reply.readException();
5239 data.recycle();
5240 reply.recycle();
5241 }
5242
Craig Mautneree2e45a2014-06-27 12:10:03 -07005243 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005244 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005245 Parcel data = Parcel.obtain();
5246 Parcel reply = Parcel.obtain();
5247 data.writeInterfaceToken(IActivityManager.descriptor);
5248 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005249 data.writeInt(visible ? 1 : 0);
5250 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005251 reply.readException();
5252 boolean success = reply.readInt() > 0;
5253 data.recycle();
5254 reply.recycle();
5255 return success;
5256 }
5257
5258 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005259 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005260 Parcel data = Parcel.obtain();
5261 Parcel reply = Parcel.obtain();
5262 data.writeInterfaceToken(IActivityManager.descriptor);
5263 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005264 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005265 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005266 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005267 data.recycle();
5268 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005269 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005270 }
5271
5272 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005273 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005274 Parcel data = Parcel.obtain();
5275 Parcel reply = Parcel.obtain();
5276 data.writeInterfaceToken(IActivityManager.descriptor);
5277 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005278 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5279 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005280 reply.readException();
5281 data.recycle();
5282 reply.recycle();
5283 }
5284
5285 @Override
5286 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5287 Parcel data = Parcel.obtain();
5288 Parcel reply = Parcel.obtain();
5289 data.writeInterfaceToken(IActivityManager.descriptor);
5290 data.writeStrongBinder(token);
5291 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5292 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005293 reply.readException();
5294 data.recycle();
5295 reply.recycle();
5296 }
5297
Craig Mautner8746a472014-07-24 15:12:54 -07005298 @Override
5299 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5300 Parcel data = Parcel.obtain();
5301 Parcel reply = Parcel.obtain();
5302 data.writeInterfaceToken(IActivityManager.descriptor);
5303 data.writeStrongBinder(token);
5304 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5305 IBinder.FLAG_ONEWAY);
5306 reply.readException();
5307 data.recycle();
5308 reply.recycle();
5309 }
5310
Craig Mautner6e2f3952014-09-09 14:26:41 -07005311 @Override
5312 public void bootAnimationComplete() throws RemoteException {
5313 Parcel data = Parcel.obtain();
5314 Parcel reply = Parcel.obtain();
5315 data.writeInterfaceToken(IActivityManager.descriptor);
5316 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5317 reply.readException();
5318 data.recycle();
5319 reply.recycle();
5320 }
5321
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005322 private IBinder mRemote;
5323}