blob: 572d389651d4a97baf680d5b22e7b026acb1a831 [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;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070021import android.content.IIntentReceiver;
22import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.Intent;
24import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070025import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070026import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070027import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.pm.ConfigurationInfo;
29import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070030import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070031import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.content.res.Configuration;
33import android.graphics.Bitmap;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080034import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.net.Uri;
36import android.os.Binder;
37import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070038import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039import android.os.IBinder;
40import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070041import android.os.ParcelFileDescriptor;
42import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070043import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070046import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070047import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080050import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070051import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053import java.util.ArrayList;
54import java.util.List;
55
56/** {@hide} */
57public abstract class ActivityManagerNative extends Binder implements IActivityManager
58{
59 /**
60 * Cast a Binder object into an activity manager interface, generating
61 * a proxy if needed.
62 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080063 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080064 if (obj == null) {
65 return null;
66 }
67 IActivityManager in =
68 (IActivityManager)obj.queryLocalInterface(descriptor);
69 if (in != null) {
70 return in;
71 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080072
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073 return new ActivityManagerProxy(obj);
74 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080075
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076 /**
77 * Retrieve the system's default/global activity manager.
78 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079 static public IActivityManager getDefault() {
80 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080081 }
82
83 /**
84 * Convenience for checking whether the system is ready. For internal use only.
85 */
86 static public boolean isSystemReady() {
87 if (!sSystemReady) {
88 sSystemReady = getDefault().testIsSystemReady();
89 }
90 return sSystemReady;
91 }
92 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080093
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080094 /**
95 * Convenience for sending a sticky broadcast. For internal use only.
96 * If you don't care about permission, use null.
97 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099 try {
100 getDefault().broadcastIntent(
101 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800102 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800103 } catch (RemoteException ex) {
104 }
105 }
106
Dianne Hackborn099bc622014-01-22 13:39:16 -0800107 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800109 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 } catch (RemoteException ex) {
111 }
112 }
113
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800114 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800115 attachInterface(this, descriptor);
116 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700117
118 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800119 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
120 throws RemoteException {
121 switch (code) {
122 case START_ACTIVITY_TRANSACTION:
123 {
124 data.enforceInterface(IActivityManager.descriptor);
125 IBinder b = data.readStrongBinder();
126 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800127 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800128 Intent intent = Intent.CREATOR.createFromParcel(data);
129 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800131 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700133 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700134 String profileFile = data.readString();
135 ParcelFileDescriptor profileFd = data.readInt() != 0
136 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700137 Bundle options = data.readInt() != 0
138 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800139 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700140 resultTo, resultWho, requestCode, startFlags,
141 profileFile, profileFd, 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();
159 String profileFile = data.readString();
160 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700161 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700162 Bundle options = data.readInt() != 0
163 ? Bundle.CREATOR.createFromParcel(data) : null;
164 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800165 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700166 resultTo, resultWho, requestCode, startFlags,
167 profileFile, profileFd, options, userId);
168 reply.writeNoException();
169 reply.writeInt(result);
170 return true;
171 }
172
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 case START_ACTIVITY_AND_WAIT_TRANSACTION:
174 {
175 data.enforceInterface(IActivityManager.descriptor);
176 IBinder b = data.readStrongBinder();
177 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800178 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800179 Intent intent = Intent.CREATOR.createFromParcel(data);
180 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800181 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800182 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800183 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700184 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700185 String profileFile = data.readString();
186 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700187 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700188 Bundle options = data.readInt() != 0
189 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700190 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800191 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700192 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700193 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800194 reply.writeNoException();
195 result.writeToParcel(reply, 0);
196 return true;
197 }
198
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700199 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
200 {
201 data.enforceInterface(IActivityManager.descriptor);
202 IBinder b = data.readStrongBinder();
203 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800204 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700205 Intent intent = Intent.CREATOR.createFromParcel(data);
206 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700207 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700208 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700209 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700210 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700211 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700212 Bundle options = data.readInt() != 0
213 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700214 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800215 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700216 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700217 reply.writeNoException();
218 reply.writeInt(result);
219 return true;
220 }
221
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700222 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700223 {
224 data.enforceInterface(IActivityManager.descriptor);
225 IBinder b = data.readStrongBinder();
226 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700227 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700228 Intent fillInIntent = null;
229 if (data.readInt() != 0) {
230 fillInIntent = Intent.CREATOR.createFromParcel(data);
231 }
232 String resolvedType = data.readString();
233 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700234 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700235 int requestCode = data.readInt();
236 int flagsMask = data.readInt();
237 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700238 Bundle options = data.readInt() != 0
239 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700240 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700241 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700242 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700243 reply.writeNoException();
244 reply.writeInt(result);
245 return true;
246 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700247
Dianne Hackborn91097de2014-04-04 18:02:06 -0700248 case START_VOICE_ACTIVITY_TRANSACTION:
249 {
250 data.enforceInterface(IActivityManager.descriptor);
251 String callingPackage = data.readString();
252 int callingPid = data.readInt();
253 int callingUid = data.readInt();
254 Intent intent = Intent.CREATOR.createFromParcel(data);
255 String resolvedType = data.readString();
256 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
257 data.readStrongBinder());
258 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
259 data.readStrongBinder());
260 int startFlags = data.readInt();
261 String profileFile = data.readString();
262 ParcelFileDescriptor profileFd = data.readInt() != 0
263 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
264 Bundle options = data.readInt() != 0
265 ? Bundle.CREATOR.createFromParcel(data) : null;
266 int userId = data.readInt();
267 int result = startVoiceActivity(callingPackage, callingPid, callingUid,
268 intent, resolvedType, session, interactor, startFlags,
269 profileFile, profileFd, options, userId);
270 reply.writeNoException();
271 reply.writeInt(result);
272 return true;
273 }
274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800275 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
276 {
277 data.enforceInterface(IActivityManager.descriptor);
278 IBinder callingActivity = data.readStrongBinder();
279 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700280 Bundle options = data.readInt() != 0
281 ? Bundle.CREATOR.createFromParcel(data) : null;
282 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800283 reply.writeNoException();
284 reply.writeInt(result ? 1 : 0);
285 return true;
286 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700287
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800288 case FINISH_ACTIVITY_TRANSACTION: {
289 data.enforceInterface(IActivityManager.descriptor);
290 IBinder token = data.readStrongBinder();
291 Intent resultData = null;
292 int resultCode = data.readInt();
293 if (data.readInt() != 0) {
294 resultData = Intent.CREATOR.createFromParcel(data);
295 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700296 boolean finishTask = (data.readInt() != 0);
297 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800298 reply.writeNoException();
299 reply.writeInt(res ? 1 : 0);
300 return true;
301 }
302
303 case FINISH_SUB_ACTIVITY_TRANSACTION: {
304 data.enforceInterface(IActivityManager.descriptor);
305 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700306 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800307 int requestCode = data.readInt();
308 finishSubActivity(token, resultWho, requestCode);
309 reply.writeNoException();
310 return true;
311 }
312
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700313 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
314 data.enforceInterface(IActivityManager.descriptor);
315 IBinder token = data.readStrongBinder();
316 boolean res = finishActivityAffinity(token);
317 reply.writeNoException();
318 reply.writeInt(res ? 1 : 0);
319 return true;
320 }
321
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800322 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
323 data.enforceInterface(IActivityManager.descriptor);
324 IBinder token = data.readStrongBinder();
325 boolean res = willActivityBeVisible(token);
326 reply.writeNoException();
327 reply.writeInt(res ? 1 : 0);
328 return true;
329 }
330
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800331 case REGISTER_RECEIVER_TRANSACTION:
332 {
333 data.enforceInterface(IActivityManager.descriptor);
334 IBinder b = data.readStrongBinder();
335 IApplicationThread app =
336 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700337 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800338 b = data.readStrongBinder();
339 IIntentReceiver rec
340 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
341 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
342 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700343 int userId = data.readInt();
344 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800345 reply.writeNoException();
346 if (intent != null) {
347 reply.writeInt(1);
348 intent.writeToParcel(reply, 0);
349 } else {
350 reply.writeInt(0);
351 }
352 return true;
353 }
354
355 case UNREGISTER_RECEIVER_TRANSACTION:
356 {
357 data.enforceInterface(IActivityManager.descriptor);
358 IBinder b = data.readStrongBinder();
359 if (b == null) {
360 return true;
361 }
362 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
363 unregisterReceiver(rec);
364 reply.writeNoException();
365 return true;
366 }
367
368 case BROADCAST_INTENT_TRANSACTION:
369 {
370 data.enforceInterface(IActivityManager.descriptor);
371 IBinder b = data.readStrongBinder();
372 IApplicationThread app =
373 b != null ? ApplicationThreadNative.asInterface(b) : null;
374 Intent intent = Intent.CREATOR.createFromParcel(data);
375 String resolvedType = data.readString();
376 b = data.readStrongBinder();
377 IIntentReceiver resultTo =
378 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
379 int resultCode = data.readInt();
380 String resultData = data.readString();
381 Bundle resultExtras = data.readBundle();
382 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800383 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 boolean serialized = data.readInt() != 0;
385 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700386 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800388 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700389 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 reply.writeNoException();
391 reply.writeInt(res);
392 return true;
393 }
394
395 case UNBROADCAST_INTENT_TRANSACTION:
396 {
397 data.enforceInterface(IActivityManager.descriptor);
398 IBinder b = data.readStrongBinder();
399 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
400 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700401 int userId = data.readInt();
402 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800403 reply.writeNoException();
404 return true;
405 }
406
407 case FINISH_RECEIVER_TRANSACTION: {
408 data.enforceInterface(IActivityManager.descriptor);
409 IBinder who = data.readStrongBinder();
410 int resultCode = data.readInt();
411 String resultData = data.readString();
412 Bundle resultExtras = data.readBundle();
413 boolean resultAbort = data.readInt() != 0;
414 if (who != null) {
415 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
416 }
417 reply.writeNoException();
418 return true;
419 }
420
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800421 case ATTACH_APPLICATION_TRANSACTION: {
422 data.enforceInterface(IActivityManager.descriptor);
423 IApplicationThread app = ApplicationThreadNative.asInterface(
424 data.readStrongBinder());
425 if (app != null) {
426 attachApplication(app);
427 }
428 reply.writeNoException();
429 return true;
430 }
431
432 case ACTIVITY_IDLE_TRANSACTION: {
433 data.enforceInterface(IActivityManager.descriptor);
434 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700435 Configuration config = null;
436 if (data.readInt() != 0) {
437 config = Configuration.CREATOR.createFromParcel(data);
438 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700439 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700441 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800442 }
443 reply.writeNoException();
444 return true;
445 }
446
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700447 case ACTIVITY_RESUMED_TRANSACTION: {
448 data.enforceInterface(IActivityManager.descriptor);
449 IBinder token = data.readStrongBinder();
450 activityResumed(token);
451 reply.writeNoException();
452 return true;
453 }
454
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800455 case ACTIVITY_PAUSED_TRANSACTION: {
456 data.enforceInterface(IActivityManager.descriptor);
457 IBinder token = data.readStrongBinder();
Craig Mautnera0026042014-04-23 11:45:37 -0700458 PersistableBundle persistentState = data.readPersistableBundle();
459 activityPaused(token, persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800460 reply.writeNoException();
461 return true;
462 }
463
464 case ACTIVITY_STOPPED_TRANSACTION: {
465 data.enforceInterface(IActivityManager.descriptor);
466 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800467 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700468 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800469 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700470 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800471 reply.writeNoException();
472 return true;
473 }
474
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800475 case ACTIVITY_SLEPT_TRANSACTION: {
476 data.enforceInterface(IActivityManager.descriptor);
477 IBinder token = data.readStrongBinder();
478 activitySlept(token);
479 reply.writeNoException();
480 return true;
481 }
482
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800483 case ACTIVITY_DESTROYED_TRANSACTION: {
484 data.enforceInterface(IActivityManager.descriptor);
485 IBinder token = data.readStrongBinder();
486 activityDestroyed(token);
487 reply.writeNoException();
488 return true;
489 }
490
491 case GET_CALLING_PACKAGE_TRANSACTION: {
492 data.enforceInterface(IActivityManager.descriptor);
493 IBinder token = data.readStrongBinder();
494 String res = token != null ? getCallingPackage(token) : null;
495 reply.writeNoException();
496 reply.writeString(res);
497 return true;
498 }
499
500 case GET_CALLING_ACTIVITY_TRANSACTION: {
501 data.enforceInterface(IActivityManager.descriptor);
502 IBinder token = data.readStrongBinder();
503 ComponentName cn = getCallingActivity(token);
504 reply.writeNoException();
505 ComponentName.writeToParcel(cn, reply);
506 return true;
507 }
508
Winson Chung1147c402014-05-14 11:05:00 -0700509 case GET_APP_TASKS_TRANSACTION: {
510 data.enforceInterface(IActivityManager.descriptor);
511 List<IAppTask> list = getAppTasks();
512 reply.writeNoException();
513 int N = list != null ? list.size() : -1;
514 reply.writeInt(N);
515 int i;
516 for (i=0; i<N; i++) {
517 IAppTask task = list.get(i);
518 reply.writeStrongBinder(task.asBinder());
519 }
520 return true;
521 }
522
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800523 case GET_TASKS_TRANSACTION: {
524 data.enforceInterface(IActivityManager.descriptor);
525 int maxNum = data.readInt();
526 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700527 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800528 reply.writeNoException();
529 int N = list != null ? list.size() : -1;
530 reply.writeInt(N);
531 int i;
532 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700533 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800534 info.writeToParcel(reply, 0);
535 }
536 return true;
537 }
538
539 case GET_RECENT_TASKS_TRANSACTION: {
540 data.enforceInterface(IActivityManager.descriptor);
541 int maxNum = data.readInt();
542 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700543 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800544 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700545 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800546 reply.writeNoException();
547 reply.writeTypedList(list);
548 return true;
549 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700550
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700551 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800552 data.enforceInterface(IActivityManager.descriptor);
553 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700554 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800555 reply.writeNoException();
556 if (bm != null) {
557 reply.writeInt(1);
558 bm.writeToParcel(reply, 0);
559 } else {
560 reply.writeInt(0);
561 }
562 return true;
563 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700564
565 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
566 data.enforceInterface(IActivityManager.descriptor);
567 int id = data.readInt();
568 Bitmap bm = getTaskTopThumbnail(id);
569 reply.writeNoException();
570 if (bm != null) {
571 reply.writeInt(1);
572 bm.writeToParcel(reply, 0);
573 } else {
574 reply.writeInt(0);
575 }
576 return true;
577 }
578
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800579 case GET_SERVICES_TRANSACTION: {
580 data.enforceInterface(IActivityManager.descriptor);
581 int maxNum = data.readInt();
582 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700583 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800584 reply.writeNoException();
585 int N = list != null ? list.size() : -1;
586 reply.writeInt(N);
587 int i;
588 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700589 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800590 info.writeToParcel(reply, 0);
591 }
592 return true;
593 }
594
595 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
596 data.enforceInterface(IActivityManager.descriptor);
597 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
598 reply.writeNoException();
599 reply.writeTypedList(list);
600 return true;
601 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700602
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800603 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
604 data.enforceInterface(IActivityManager.descriptor);
605 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
606 reply.writeNoException();
607 reply.writeTypedList(list);
608 return true;
609 }
610
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700611 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
612 data.enforceInterface(IActivityManager.descriptor);
613 List<ApplicationInfo> list = getRunningExternalApplications();
614 reply.writeNoException();
615 reply.writeTypedList(list);
616 return true;
617 }
618
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800619 case MOVE_TASK_TO_FRONT_TRANSACTION: {
620 data.enforceInterface(IActivityManager.descriptor);
621 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800622 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700623 Bundle options = data.readInt() != 0
624 ? Bundle.CREATOR.createFromParcel(data) : null;
625 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800626 reply.writeNoException();
627 return true;
628 }
629
630 case MOVE_TASK_TO_BACK_TRANSACTION: {
631 data.enforceInterface(IActivityManager.descriptor);
632 int task = data.readInt();
633 moveTaskToBack(task);
634 reply.writeNoException();
635 return true;
636 }
637
638 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
639 data.enforceInterface(IActivityManager.descriptor);
640 IBinder token = data.readStrongBinder();
641 boolean nonRoot = data.readInt() != 0;
642 boolean res = moveActivityTaskToBack(token, nonRoot);
643 reply.writeNoException();
644 reply.writeInt(res ? 1 : 0);
645 return true;
646 }
647
648 case MOVE_TASK_BACKWARDS_TRANSACTION: {
649 data.enforceInterface(IActivityManager.descriptor);
650 int task = data.readInt();
651 moveTaskBackwards(task);
652 reply.writeNoException();
653 return true;
654 }
655
Craig Mautnerc00204b2013-03-05 15:02:14 -0800656 case MOVE_TASK_TO_STACK_TRANSACTION: {
657 data.enforceInterface(IActivityManager.descriptor);
658 int taskId = data.readInt();
659 int stackId = data.readInt();
660 boolean toTop = data.readInt() != 0;
661 moveTaskToStack(taskId, stackId, toTop);
662 reply.writeNoException();
663 return true;
664 }
665
666 case RESIZE_STACK_TRANSACTION: {
667 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800668 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800669 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800670 Rect r = Rect.CREATOR.createFromParcel(data);
671 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800672 reply.writeNoException();
673 return true;
674 }
675
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800676 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700677 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800678 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700679 reply.writeNoException();
680 reply.writeTypedList(list);
681 return true;
682 }
683
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800684 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700685 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800686 int stackId = data.readInt();
687 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700688 reply.writeNoException();
689 if (info != null) {
690 reply.writeInt(1);
691 info.writeToParcel(reply, 0);
692 } else {
693 reply.writeInt(0);
694 }
695 return true;
696 }
697
Winson Chung303e1ff2014-03-07 15:06:19 -0800698 case IS_IN_HOME_STACK_TRANSACTION: {
699 data.enforceInterface(IActivityManager.descriptor);
700 int taskId = data.readInt();
701 boolean isInHomeStack = isInHomeStack(taskId);
702 reply.writeNoException();
703 reply.writeInt(isInHomeStack ? 1 : 0);
704 return true;
705 }
706
Craig Mautnercf910b02013-04-23 11:23:27 -0700707 case SET_FOCUSED_STACK_TRANSACTION: {
708 data.enforceInterface(IActivityManager.descriptor);
709 int stackId = data.readInt();
710 setFocusedStack(stackId);
711 reply.writeNoException();
712 return true;
713 }
714
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800715 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
716 data.enforceInterface(IActivityManager.descriptor);
717 IBinder token = data.readStrongBinder();
718 boolean onlyRoot = data.readInt() != 0;
719 int res = token != null
720 ? getTaskForActivity(token, onlyRoot) : -1;
721 reply.writeNoException();
722 reply.writeInt(res);
723 return true;
724 }
725
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800726 case GET_CONTENT_PROVIDER_TRANSACTION: {
727 data.enforceInterface(IActivityManager.descriptor);
728 IBinder b = data.readStrongBinder();
729 IApplicationThread app = ApplicationThreadNative.asInterface(b);
730 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700731 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700732 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700733 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800734 reply.writeNoException();
735 if (cph != null) {
736 reply.writeInt(1);
737 cph.writeToParcel(reply, 0);
738 } else {
739 reply.writeInt(0);
740 }
741 return true;
742 }
743
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800744 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
745 data.enforceInterface(IActivityManager.descriptor);
746 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700747 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800748 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700749 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800750 reply.writeNoException();
751 if (cph != null) {
752 reply.writeInt(1);
753 cph.writeToParcel(reply, 0);
754 } else {
755 reply.writeInt(0);
756 }
757 return true;
758 }
759
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800760 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
761 data.enforceInterface(IActivityManager.descriptor);
762 IBinder b = data.readStrongBinder();
763 IApplicationThread app = ApplicationThreadNative.asInterface(b);
764 ArrayList<ContentProviderHolder> providers =
765 data.createTypedArrayList(ContentProviderHolder.CREATOR);
766 publishContentProviders(app, providers);
767 reply.writeNoException();
768 return true;
769 }
770
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700771 case REF_CONTENT_PROVIDER_TRANSACTION: {
772 data.enforceInterface(IActivityManager.descriptor);
773 IBinder b = data.readStrongBinder();
774 int stable = data.readInt();
775 int unstable = data.readInt();
776 boolean res = refContentProvider(b, stable, unstable);
777 reply.writeNoException();
778 reply.writeInt(res ? 1 : 0);
779 return true;
780 }
781
782 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
783 data.enforceInterface(IActivityManager.descriptor);
784 IBinder b = data.readStrongBinder();
785 unstableProviderDied(b);
786 reply.writeNoException();
787 return true;
788 }
789
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700790 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
791 data.enforceInterface(IActivityManager.descriptor);
792 IBinder b = data.readStrongBinder();
793 appNotRespondingViaProvider(b);
794 reply.writeNoException();
795 return true;
796 }
797
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800798 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
799 data.enforceInterface(IActivityManager.descriptor);
800 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700801 boolean stable = data.readInt() != 0;
802 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800803 reply.writeNoException();
804 return true;
805 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800806
807 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
808 data.enforceInterface(IActivityManager.descriptor);
809 String name = data.readString();
810 IBinder token = data.readStrongBinder();
811 removeContentProviderExternal(name, token);
812 reply.writeNoException();
813 return true;
814 }
815
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700816 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
817 data.enforceInterface(IActivityManager.descriptor);
818 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
819 PendingIntent pi = getRunningServiceControlPanel(comp);
820 reply.writeNoException();
821 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
822 return true;
823 }
824
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800825 case START_SERVICE_TRANSACTION: {
826 data.enforceInterface(IActivityManager.descriptor);
827 IBinder b = data.readStrongBinder();
828 IApplicationThread app = ApplicationThreadNative.asInterface(b);
829 Intent service = Intent.CREATOR.createFromParcel(data);
830 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700831 int userId = data.readInt();
832 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800833 reply.writeNoException();
834 ComponentName.writeToParcel(cn, reply);
835 return true;
836 }
837
838 case STOP_SERVICE_TRANSACTION: {
839 data.enforceInterface(IActivityManager.descriptor);
840 IBinder b = data.readStrongBinder();
841 IApplicationThread app = ApplicationThreadNative.asInterface(b);
842 Intent service = Intent.CREATOR.createFromParcel(data);
843 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700844 int userId = data.readInt();
845 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800846 reply.writeNoException();
847 reply.writeInt(res);
848 return true;
849 }
850
851 case STOP_SERVICE_TOKEN_TRANSACTION: {
852 data.enforceInterface(IActivityManager.descriptor);
853 ComponentName className = ComponentName.readFromParcel(data);
854 IBinder token = data.readStrongBinder();
855 int startId = data.readInt();
856 boolean res = stopServiceToken(className, token, startId);
857 reply.writeNoException();
858 reply.writeInt(res ? 1 : 0);
859 return true;
860 }
861
862 case SET_SERVICE_FOREGROUND_TRANSACTION: {
863 data.enforceInterface(IActivityManager.descriptor);
864 ComponentName className = ComponentName.readFromParcel(data);
865 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700866 int id = data.readInt();
867 Notification notification = null;
868 if (data.readInt() != 0) {
869 notification = Notification.CREATOR.createFromParcel(data);
870 }
871 boolean removeNotification = data.readInt() != 0;
872 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 reply.writeNoException();
874 return true;
875 }
876
877 case BIND_SERVICE_TRANSACTION: {
878 data.enforceInterface(IActivityManager.descriptor);
879 IBinder b = data.readStrongBinder();
880 IApplicationThread app = ApplicationThreadNative.asInterface(b);
881 IBinder token = data.readStrongBinder();
882 Intent service = Intent.CREATOR.createFromParcel(data);
883 String resolvedType = data.readString();
884 b = data.readStrongBinder();
885 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800886 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800887 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800888 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800889 reply.writeNoException();
890 reply.writeInt(res);
891 return true;
892 }
893
894 case UNBIND_SERVICE_TRANSACTION: {
895 data.enforceInterface(IActivityManager.descriptor);
896 IBinder b = data.readStrongBinder();
897 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
898 boolean res = unbindService(conn);
899 reply.writeNoException();
900 reply.writeInt(res ? 1 : 0);
901 return true;
902 }
903
904 case PUBLISH_SERVICE_TRANSACTION: {
905 data.enforceInterface(IActivityManager.descriptor);
906 IBinder token = data.readStrongBinder();
907 Intent intent = Intent.CREATOR.createFromParcel(data);
908 IBinder service = data.readStrongBinder();
909 publishService(token, intent, service);
910 reply.writeNoException();
911 return true;
912 }
913
914 case UNBIND_FINISHED_TRANSACTION: {
915 data.enforceInterface(IActivityManager.descriptor);
916 IBinder token = data.readStrongBinder();
917 Intent intent = Intent.CREATOR.createFromParcel(data);
918 boolean doRebind = data.readInt() != 0;
919 unbindFinished(token, intent, doRebind);
920 reply.writeNoException();
921 return true;
922 }
923
924 case SERVICE_DONE_EXECUTING_TRANSACTION: {
925 data.enforceInterface(IActivityManager.descriptor);
926 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700927 int type = data.readInt();
928 int startId = data.readInt();
929 int res = data.readInt();
930 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800931 reply.writeNoException();
932 return true;
933 }
934
935 case START_INSTRUMENTATION_TRANSACTION: {
936 data.enforceInterface(IActivityManager.descriptor);
937 ComponentName className = ComponentName.readFromParcel(data);
938 String profileFile = data.readString();
939 int fl = data.readInt();
940 Bundle arguments = data.readBundle();
941 IBinder b = data.readStrongBinder();
942 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800943 b = data.readStrongBinder();
944 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700945 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +0100946 String abiOverride = data.readString();
947 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
948 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800949 reply.writeNoException();
950 reply.writeInt(res ? 1 : 0);
951 return true;
952 }
953
954
955 case FINISH_INSTRUMENTATION_TRANSACTION: {
956 data.enforceInterface(IActivityManager.descriptor);
957 IBinder b = data.readStrongBinder();
958 IApplicationThread app = ApplicationThreadNative.asInterface(b);
959 int resultCode = data.readInt();
960 Bundle results = data.readBundle();
961 finishInstrumentation(app, resultCode, results);
962 reply.writeNoException();
963 return true;
964 }
965
966 case GET_CONFIGURATION_TRANSACTION: {
967 data.enforceInterface(IActivityManager.descriptor);
968 Configuration config = getConfiguration();
969 reply.writeNoException();
970 config.writeToParcel(reply, 0);
971 return true;
972 }
973
974 case UPDATE_CONFIGURATION_TRANSACTION: {
975 data.enforceInterface(IActivityManager.descriptor);
976 Configuration config = Configuration.CREATOR.createFromParcel(data);
977 updateConfiguration(config);
978 reply.writeNoException();
979 return true;
980 }
981
982 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
983 data.enforceInterface(IActivityManager.descriptor);
984 IBinder token = data.readStrongBinder();
985 int requestedOrientation = data.readInt();
986 setRequestedOrientation(token, requestedOrientation);
987 reply.writeNoException();
988 return true;
989 }
990
991 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
992 data.enforceInterface(IActivityManager.descriptor);
993 IBinder token = data.readStrongBinder();
994 int req = getRequestedOrientation(token);
995 reply.writeNoException();
996 reply.writeInt(req);
997 return true;
998 }
999
1000 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1001 data.enforceInterface(IActivityManager.descriptor);
1002 IBinder token = data.readStrongBinder();
1003 ComponentName cn = getActivityClassForToken(token);
1004 reply.writeNoException();
1005 ComponentName.writeToParcel(cn, reply);
1006 return true;
1007 }
1008
1009 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1010 data.enforceInterface(IActivityManager.descriptor);
1011 IBinder token = data.readStrongBinder();
1012 reply.writeNoException();
1013 reply.writeString(getPackageForToken(token));
1014 return true;
1015 }
1016
1017 case GET_INTENT_SENDER_TRANSACTION: {
1018 data.enforceInterface(IActivityManager.descriptor);
1019 int type = data.readInt();
1020 String packageName = data.readString();
1021 IBinder token = data.readStrongBinder();
1022 String resultWho = data.readString();
1023 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001024 Intent[] requestIntents;
1025 String[] requestResolvedTypes;
1026 if (data.readInt() != 0) {
1027 requestIntents = data.createTypedArray(Intent.CREATOR);
1028 requestResolvedTypes = data.createStringArray();
1029 } else {
1030 requestIntents = null;
1031 requestResolvedTypes = null;
1032 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001033 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001034 Bundle options = data.readInt() != 0
1035 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001036 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001037 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001038 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001039 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001040 reply.writeNoException();
1041 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1042 return true;
1043 }
1044
1045 case CANCEL_INTENT_SENDER_TRANSACTION: {
1046 data.enforceInterface(IActivityManager.descriptor);
1047 IIntentSender r = IIntentSender.Stub.asInterface(
1048 data.readStrongBinder());
1049 cancelIntentSender(r);
1050 reply.writeNoException();
1051 return true;
1052 }
1053
1054 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1055 data.enforceInterface(IActivityManager.descriptor);
1056 IIntentSender r = IIntentSender.Stub.asInterface(
1057 data.readStrongBinder());
1058 String res = getPackageForIntentSender(r);
1059 reply.writeNoException();
1060 reply.writeString(res);
1061 return true;
1062 }
1063
Christopher Tatec4a07d12012-04-06 14:19:13 -07001064 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1065 data.enforceInterface(IActivityManager.descriptor);
1066 IIntentSender r = IIntentSender.Stub.asInterface(
1067 data.readStrongBinder());
1068 int res = getUidForIntentSender(r);
1069 reply.writeNoException();
1070 reply.writeInt(res);
1071 return true;
1072 }
1073
Dianne Hackborn41203752012-08-31 14:05:51 -07001074 case HANDLE_INCOMING_USER_TRANSACTION: {
1075 data.enforceInterface(IActivityManager.descriptor);
1076 int callingPid = data.readInt();
1077 int callingUid = data.readInt();
1078 int userId = data.readInt();
1079 boolean allowAll = data.readInt() != 0 ;
1080 boolean requireFull = data.readInt() != 0;
1081 String name = data.readString();
1082 String callerPackage = data.readString();
1083 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1084 requireFull, name, callerPackage);
1085 reply.writeNoException();
1086 reply.writeInt(res);
1087 return true;
1088 }
1089
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001090 case SET_PROCESS_LIMIT_TRANSACTION: {
1091 data.enforceInterface(IActivityManager.descriptor);
1092 int max = data.readInt();
1093 setProcessLimit(max);
1094 reply.writeNoException();
1095 return true;
1096 }
1097
1098 case GET_PROCESS_LIMIT_TRANSACTION: {
1099 data.enforceInterface(IActivityManager.descriptor);
1100 int limit = getProcessLimit();
1101 reply.writeNoException();
1102 reply.writeInt(limit);
1103 return true;
1104 }
1105
1106 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1107 data.enforceInterface(IActivityManager.descriptor);
1108 IBinder token = data.readStrongBinder();
1109 int pid = data.readInt();
1110 boolean isForeground = data.readInt() != 0;
1111 setProcessForeground(token, pid, isForeground);
1112 reply.writeNoException();
1113 return true;
1114 }
1115
1116 case CHECK_PERMISSION_TRANSACTION: {
1117 data.enforceInterface(IActivityManager.descriptor);
1118 String perm = data.readString();
1119 int pid = data.readInt();
1120 int uid = data.readInt();
1121 int res = checkPermission(perm, pid, uid);
1122 reply.writeNoException();
1123 reply.writeInt(res);
1124 return true;
1125 }
1126
1127 case CHECK_URI_PERMISSION_TRANSACTION: {
1128 data.enforceInterface(IActivityManager.descriptor);
1129 Uri uri = Uri.CREATOR.createFromParcel(data);
1130 int pid = data.readInt();
1131 int uid = data.readInt();
1132 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001133 int userId = data.readInt();
1134 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001135 reply.writeNoException();
1136 reply.writeInt(res);
1137 return true;
1138 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001139
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001140 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001141 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001142 String packageName = data.readString();
1143 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1144 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001145 int userId = data.readInt();
1146 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147 reply.writeNoException();
1148 reply.writeInt(res ? 1 : 0);
1149 return true;
1150 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001151
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 case GRANT_URI_PERMISSION_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 IBinder b = data.readStrongBinder();
1155 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1156 String targetPkg = data.readString();
1157 Uri uri = Uri.CREATOR.createFromParcel(data);
1158 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001159 int userId = data.readInt();
1160 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001161 reply.writeNoException();
1162 return true;
1163 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001164
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001165 case REVOKE_URI_PERMISSION_TRANSACTION: {
1166 data.enforceInterface(IActivityManager.descriptor);
1167 IBinder b = data.readStrongBinder();
1168 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1169 Uri uri = Uri.CREATOR.createFromParcel(data);
1170 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001171 int userId = data.readInt();
1172 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001173 reply.writeNoException();
1174 return true;
1175 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001176
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001177 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1178 data.enforceInterface(IActivityManager.descriptor);
1179 Uri uri = Uri.CREATOR.createFromParcel(data);
1180 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001181 int userId = data.readInt();
1182 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001183 reply.writeNoException();
1184 return true;
1185 }
1186
1187 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1188 data.enforceInterface(IActivityManager.descriptor);
1189 Uri uri = Uri.CREATOR.createFromParcel(data);
1190 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001191 int userId = data.readInt();
1192 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001193 reply.writeNoException();
1194 return true;
1195 }
1196
1197 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1198 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001199 final String packageName = data.readString();
1200 final boolean incoming = data.readInt() != 0;
1201 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1202 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001203 reply.writeNoException();
1204 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1205 return true;
1206 }
1207
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001208 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1209 data.enforceInterface(IActivityManager.descriptor);
1210 IBinder b = data.readStrongBinder();
1211 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1212 boolean waiting = data.readInt() != 0;
1213 showWaitingForDebugger(app, waiting);
1214 reply.writeNoException();
1215 return true;
1216 }
1217
1218 case GET_MEMORY_INFO_TRANSACTION: {
1219 data.enforceInterface(IActivityManager.descriptor);
1220 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1221 getMemoryInfo(mi);
1222 reply.writeNoException();
1223 mi.writeToParcel(reply, 0);
1224 return true;
1225 }
1226
1227 case UNHANDLED_BACK_TRANSACTION: {
1228 data.enforceInterface(IActivityManager.descriptor);
1229 unhandledBack();
1230 reply.writeNoException();
1231 return true;
1232 }
1233
1234 case OPEN_CONTENT_URI_TRANSACTION: {
1235 data.enforceInterface(IActivityManager.descriptor);
1236 Uri uri = Uri.parse(data.readString());
1237 ParcelFileDescriptor pfd = openContentUri(uri);
1238 reply.writeNoException();
1239 if (pfd != null) {
1240 reply.writeInt(1);
1241 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1242 } else {
1243 reply.writeInt(0);
1244 }
1245 return true;
1246 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001247
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001248 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 setLockScreenShown(data.readInt() != 0);
1251 reply.writeNoException();
1252 return true;
1253 }
1254
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001255 case SET_DEBUG_APP_TRANSACTION: {
1256 data.enforceInterface(IActivityManager.descriptor);
1257 String pn = data.readString();
1258 boolean wfd = data.readInt() != 0;
1259 boolean per = data.readInt() != 0;
1260 setDebugApp(pn, wfd, per);
1261 reply.writeNoException();
1262 return true;
1263 }
1264
1265 case SET_ALWAYS_FINISH_TRANSACTION: {
1266 data.enforceInterface(IActivityManager.descriptor);
1267 boolean enabled = data.readInt() != 0;
1268 setAlwaysFinish(enabled);
1269 reply.writeNoException();
1270 return true;
1271 }
1272
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001273 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001274 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001275 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001276 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001277 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001278 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001279 return true;
1280 }
1281
1282 case ENTER_SAFE_MODE_TRANSACTION: {
1283 data.enforceInterface(IActivityManager.descriptor);
1284 enterSafeMode();
1285 reply.writeNoException();
1286 return true;
1287 }
1288
1289 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1290 data.enforceInterface(IActivityManager.descriptor);
1291 IIntentSender is = IIntentSender.Stub.asInterface(
1292 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001293 int sourceUid = data.readInt();
1294 String sourcePkg = data.readString();
1295 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001296 reply.writeNoException();
1297 return true;
1298 }
1299
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001300 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001301 data.enforceInterface(IActivityManager.descriptor);
1302 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001303 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001304 boolean secure = data.readInt() != 0;
1305 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001306 reply.writeNoException();
1307 reply.writeInt(res ? 1 : 0);
1308 return true;
1309 }
1310
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001311 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1312 data.enforceInterface(IActivityManager.descriptor);
1313 String reason = data.readString();
1314 boolean res = killProcessesBelowForeground(reason);
1315 reply.writeNoException();
1316 reply.writeInt(res ? 1 : 0);
1317 return true;
1318 }
1319
Dan Egnor60d87622009-12-16 16:32:58 -08001320 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1321 data.enforceInterface(IActivityManager.descriptor);
1322 IBinder app = data.readStrongBinder();
1323 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1324 handleApplicationCrash(app, ci);
1325 reply.writeNoException();
1326 return true;
1327 }
1328
1329 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001330 data.enforceInterface(IActivityManager.descriptor);
1331 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001332 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001333 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001334 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001335 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001336 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001337 return true;
1338 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001339
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001340 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1341 data.enforceInterface(IActivityManager.descriptor);
1342 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001343 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001344 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1345 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001346 reply.writeNoException();
1347 return true;
1348 }
1349
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001350 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1351 data.enforceInterface(IActivityManager.descriptor);
1352 int sig = data.readInt();
1353 signalPersistentProcesses(sig);
1354 reply.writeNoException();
1355 return true;
1356 }
1357
Dianne Hackborn03abb812010-01-04 18:43:19 -08001358 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1359 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001360 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001361 int userId = data.readInt();
1362 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001363 reply.writeNoException();
1364 return true;
1365 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001366
1367 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1368 data.enforceInterface(IActivityManager.descriptor);
1369 killAllBackgroundProcesses();
1370 reply.writeNoException();
1371 return true;
1372 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001373
Dianne Hackborn03abb812010-01-04 18:43:19 -08001374 case FORCE_STOP_PACKAGE_TRANSACTION: {
1375 data.enforceInterface(IActivityManager.descriptor);
1376 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001377 int userId = data.readInt();
1378 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001379 reply.writeNoException();
1380 return true;
1381 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001382
1383 case GET_MY_MEMORY_STATE_TRANSACTION: {
1384 data.enforceInterface(IActivityManager.descriptor);
1385 ActivityManager.RunningAppProcessInfo info =
1386 new ActivityManager.RunningAppProcessInfo();
1387 getMyMemoryState(info);
1388 reply.writeNoException();
1389 info.writeToParcel(reply, 0);
1390 return true;
1391 }
1392
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001393 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1394 data.enforceInterface(IActivityManager.descriptor);
1395 ConfigurationInfo config = getDeviceConfigurationInfo();
1396 reply.writeNoException();
1397 config.writeToParcel(reply, 0);
1398 return true;
1399 }
1400
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001401 case PROFILE_CONTROL_TRANSACTION: {
1402 data.enforceInterface(IActivityManager.descriptor);
1403 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001404 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001405 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001406 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001407 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001408 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001409 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001410 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001411 reply.writeNoException();
1412 reply.writeInt(res ? 1 : 0);
1413 return true;
1414 }
1415
Dianne Hackborn55280a92009-05-07 15:53:46 -07001416 case SHUTDOWN_TRANSACTION: {
1417 data.enforceInterface(IActivityManager.descriptor);
1418 boolean res = shutdown(data.readInt());
1419 reply.writeNoException();
1420 reply.writeInt(res ? 1 : 0);
1421 return true;
1422 }
1423
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001424 case STOP_APP_SWITCHES_TRANSACTION: {
1425 data.enforceInterface(IActivityManager.descriptor);
1426 stopAppSwitches();
1427 reply.writeNoException();
1428 return true;
1429 }
1430
1431 case RESUME_APP_SWITCHES_TRANSACTION: {
1432 data.enforceInterface(IActivityManager.descriptor);
1433 resumeAppSwitches();
1434 reply.writeNoException();
1435 return true;
1436 }
1437
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001438 case PEEK_SERVICE_TRANSACTION: {
1439 data.enforceInterface(IActivityManager.descriptor);
1440 Intent service = Intent.CREATOR.createFromParcel(data);
1441 String resolvedType = data.readString();
1442 IBinder binder = peekService(service, resolvedType);
1443 reply.writeNoException();
1444 reply.writeStrongBinder(binder);
1445 return true;
1446 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001447
1448 case START_BACKUP_AGENT_TRANSACTION: {
1449 data.enforceInterface(IActivityManager.descriptor);
1450 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1451 int backupRestoreMode = data.readInt();
1452 boolean success = bindBackupAgent(info, backupRestoreMode);
1453 reply.writeNoException();
1454 reply.writeInt(success ? 1 : 0);
1455 return true;
1456 }
1457
1458 case BACKUP_AGENT_CREATED_TRANSACTION: {
1459 data.enforceInterface(IActivityManager.descriptor);
1460 String packageName = data.readString();
1461 IBinder agent = data.readStrongBinder();
1462 backupAgentCreated(packageName, agent);
1463 reply.writeNoException();
1464 return true;
1465 }
1466
1467 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1468 data.enforceInterface(IActivityManager.descriptor);
1469 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1470 unbindBackupAgent(info);
1471 reply.writeNoException();
1472 return true;
1473 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001474
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001475 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001476 data.enforceInterface(IActivityManager.descriptor);
1477 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001478 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001479 String reason = data.readString();
1480 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001481 reply.writeNoException();
1482 return true;
1483 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001484
1485 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 String reason = data.readString();
1488 closeSystemDialogs(reason);
1489 reply.writeNoException();
1490 return true;
1491 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001492
1493 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1494 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001495 int[] pids = data.createIntArray();
1496 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001497 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001498 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001499 return true;
1500 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001501
1502 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1503 data.enforceInterface(IActivityManager.descriptor);
1504 String processName = data.readString();
1505 int uid = data.readInt();
1506 killApplicationProcess(processName, uid);
1507 reply.writeNoException();
1508 return true;
1509 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001510
1511 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1512 data.enforceInterface(IActivityManager.descriptor);
1513 IBinder token = data.readStrongBinder();
1514 String packageName = data.readString();
1515 int enterAnim = data.readInt();
1516 int exitAnim = data.readInt();
1517 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001518 reply.writeNoException();
1519 return true;
1520 }
1521
1522 case IS_USER_A_MONKEY_TRANSACTION: {
1523 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001524 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001525 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001526 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001527 return true;
1528 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001529
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001530 case SET_USER_IS_MONKEY_TRANSACTION: {
1531 data.enforceInterface(IActivityManager.descriptor);
1532 final boolean monkey = (data.readInt() == 1);
1533 setUserIsMonkey(monkey);
1534 reply.writeNoException();
1535 return true;
1536 }
1537
Dianne Hackborn860755f2010-06-03 18:47:52 -07001538 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1539 data.enforceInterface(IActivityManager.descriptor);
1540 finishHeavyWeightApp();
1541 reply.writeNoException();
1542 return true;
1543 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001544
1545 case IS_IMMERSIVE_TRANSACTION: {
1546 data.enforceInterface(IActivityManager.descriptor);
1547 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001548 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001549 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001550 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001551 return true;
1552 }
1553
Craig Mautner5eda9b32013-07-02 11:58:16 -07001554 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001555 data.enforceInterface(IActivityManager.descriptor);
1556 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001557 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001558 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001559 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001560 return true;
1561 }
1562
1563 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1564 data.enforceInterface(IActivityManager.descriptor);
1565 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001566 final Bundle bundle;
1567 if (data.readInt() == 0) {
1568 bundle = null;
1569 } else {
1570 bundle = data.readBundle();
1571 }
1572 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1573 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001574 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001575 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001576 return true;
1577 }
1578
Craig Mautner233ceee2014-05-09 17:05:11 -07001579 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1580 data.enforceInterface(IActivityManager.descriptor);
1581 IBinder token = data.readStrongBinder();
1582 final ActivityOptions options = getActivityOptions(token);
1583 reply.writeNoException();
1584 reply.writeBundle(options == null ? null : options.toBundle());
1585 return true;
1586 }
1587
Daniel Sandler69a48172010-06-23 16:29:36 -04001588 case SET_IMMERSIVE_TRANSACTION: {
1589 data.enforceInterface(IActivityManager.descriptor);
1590 IBinder token = data.readStrongBinder();
1591 boolean imm = data.readInt() == 1;
1592 setImmersive(token, imm);
1593 reply.writeNoException();
1594 return true;
1595 }
1596
1597 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1598 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001599 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001600 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001601 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001602 return true;
1603 }
1604
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001605 case CRASH_APPLICATION_TRANSACTION: {
1606 data.enforceInterface(IActivityManager.descriptor);
1607 int uid = data.readInt();
1608 int initialPid = data.readInt();
1609 String packageName = data.readString();
1610 String message = data.readString();
1611 crashApplication(uid, initialPid, packageName, message);
1612 reply.writeNoException();
1613 return true;
1614 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001615
1616 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1617 data.enforceInterface(IActivityManager.descriptor);
1618 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001619 int userId = data.readInt();
1620 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001621 reply.writeNoException();
1622 reply.writeString(type);
1623 return true;
1624 }
1625
Dianne Hackborn7e269642010-08-25 19:50:20 -07001626 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1627 data.enforceInterface(IActivityManager.descriptor);
1628 String name = data.readString();
1629 IBinder perm = newUriPermissionOwner(name);
1630 reply.writeNoException();
1631 reply.writeStrongBinder(perm);
1632 return true;
1633 }
1634
1635 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1636 data.enforceInterface(IActivityManager.descriptor);
1637 IBinder owner = data.readStrongBinder();
1638 int fromUid = data.readInt();
1639 String targetPkg = data.readString();
1640 Uri uri = Uri.CREATOR.createFromParcel(data);
1641 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001642 int userId = data.readInt();
1643 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001644 reply.writeNoException();
1645 return true;
1646 }
1647
1648 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1649 data.enforceInterface(IActivityManager.descriptor);
1650 IBinder owner = data.readStrongBinder();
1651 Uri uri = null;
1652 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001653 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001654 }
1655 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001656 int userId = data.readInt();
1657 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001658 reply.writeNoException();
1659 return true;
1660 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001661
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001662 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1663 data.enforceInterface(IActivityManager.descriptor);
1664 int callingUid = data.readInt();
1665 String targetPkg = data.readString();
1666 Uri uri = Uri.CREATOR.createFromParcel(data);
1667 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001668 int userId = data.readInt();
1669 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001670 reply.writeNoException();
1671 reply.writeInt(res);
1672 return true;
1673 }
1674
Andy McFadden824c5102010-07-09 16:26:57 -07001675 case DUMP_HEAP_TRANSACTION: {
1676 data.enforceInterface(IActivityManager.descriptor);
1677 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001678 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001679 boolean managed = data.readInt() != 0;
1680 String path = data.readString();
1681 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001682 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001683 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001684 reply.writeNoException();
1685 reply.writeInt(res ? 1 : 0);
1686 return true;
1687 }
1688
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001689 case START_ACTIVITIES_TRANSACTION:
1690 {
1691 data.enforceInterface(IActivityManager.descriptor);
1692 IBinder b = data.readStrongBinder();
1693 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001694 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001695 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1696 String[] resolvedTypes = data.createStringArray();
1697 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001698 Bundle options = data.readInt() != 0
1699 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001700 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001701 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001702 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001703 reply.writeNoException();
1704 reply.writeInt(result);
1705 return true;
1706 }
1707
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001708 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1709 {
1710 data.enforceInterface(IActivityManager.descriptor);
1711 int mode = getFrontActivityScreenCompatMode();
1712 reply.writeNoException();
1713 reply.writeInt(mode);
1714 return true;
1715 }
1716
1717 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1718 {
1719 data.enforceInterface(IActivityManager.descriptor);
1720 int mode = data.readInt();
1721 setFrontActivityScreenCompatMode(mode);
1722 reply.writeNoException();
1723 reply.writeInt(mode);
1724 return true;
1725 }
1726
1727 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1728 {
1729 data.enforceInterface(IActivityManager.descriptor);
1730 String pkg = data.readString();
1731 int mode = getPackageScreenCompatMode(pkg);
1732 reply.writeNoException();
1733 reply.writeInt(mode);
1734 return true;
1735 }
1736
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001737 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1738 {
1739 data.enforceInterface(IActivityManager.descriptor);
1740 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001741 int mode = data.readInt();
1742 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001743 reply.writeNoException();
1744 return true;
1745 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001746
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001747 case SWITCH_USER_TRANSACTION: {
1748 data.enforceInterface(IActivityManager.descriptor);
1749 int userid = data.readInt();
1750 boolean result = switchUser(userid);
1751 reply.writeNoException();
1752 reply.writeInt(result ? 1 : 0);
1753 return true;
1754 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001755
Kenny Guy08488bf2014-02-21 17:40:37 +00001756 case START_USER_IN_BACKGROUND_TRANSACTION: {
1757 data.enforceInterface(IActivityManager.descriptor);
1758 int userid = data.readInt();
1759 boolean result = startUserInBackground(userid);
1760 reply.writeNoException();
1761 reply.writeInt(result ? 1 : 0);
1762 return true;
1763 }
1764
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001765 case STOP_USER_TRANSACTION: {
1766 data.enforceInterface(IActivityManager.descriptor);
1767 int userid = data.readInt();
1768 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1769 data.readStrongBinder());
1770 int result = stopUser(userid, callback);
1771 reply.writeNoException();
1772 reply.writeInt(result);
1773 return true;
1774 }
1775
Amith Yamasani52f1d752012-03-28 18:19:29 -07001776 case GET_CURRENT_USER_TRANSACTION: {
1777 data.enforceInterface(IActivityManager.descriptor);
1778 UserInfo userInfo = getCurrentUser();
1779 reply.writeNoException();
1780 userInfo.writeToParcel(reply, 0);
1781 return true;
1782 }
1783
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001784 case IS_USER_RUNNING_TRANSACTION: {
1785 data.enforceInterface(IActivityManager.descriptor);
1786 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001787 boolean orStopping = data.readInt() != 0;
1788 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001789 reply.writeNoException();
1790 reply.writeInt(result ? 1 : 0);
1791 return true;
1792 }
1793
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001794 case GET_RUNNING_USER_IDS_TRANSACTION: {
1795 data.enforceInterface(IActivityManager.descriptor);
1796 int[] result = getRunningUserIds();
1797 reply.writeNoException();
1798 reply.writeIntArray(result);
1799 return true;
1800 }
1801
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001802 case REMOVE_SUB_TASK_TRANSACTION:
1803 {
1804 data.enforceInterface(IActivityManager.descriptor);
1805 int taskId = data.readInt();
1806 int subTaskIndex = data.readInt();
1807 boolean result = removeSubTask(taskId, subTaskIndex);
1808 reply.writeNoException();
1809 reply.writeInt(result ? 1 : 0);
1810 return true;
1811 }
1812
1813 case REMOVE_TASK_TRANSACTION:
1814 {
1815 data.enforceInterface(IActivityManager.descriptor);
1816 int taskId = data.readInt();
1817 int fl = data.readInt();
1818 boolean result = removeTask(taskId, fl);
1819 reply.writeNoException();
1820 reply.writeInt(result ? 1 : 0);
1821 return true;
1822 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001823
Jeff Sharkeya4620792011-05-20 15:29:23 -07001824 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1825 data.enforceInterface(IActivityManager.descriptor);
1826 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1827 data.readStrongBinder());
1828 registerProcessObserver(observer);
1829 return true;
1830 }
1831
1832 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1833 data.enforceInterface(IActivityManager.descriptor);
1834 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1835 data.readStrongBinder());
1836 unregisterProcessObserver(observer);
1837 return true;
1838 }
1839
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001840 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1841 {
1842 data.enforceInterface(IActivityManager.descriptor);
1843 String pkg = data.readString();
1844 boolean ask = getPackageAskScreenCompat(pkg);
1845 reply.writeNoException();
1846 reply.writeInt(ask ? 1 : 0);
1847 return true;
1848 }
1849
1850 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1851 {
1852 data.enforceInterface(IActivityManager.descriptor);
1853 String pkg = data.readString();
1854 boolean ask = data.readInt() != 0;
1855 setPackageAskScreenCompat(pkg, ask);
1856 reply.writeNoException();
1857 return true;
1858 }
1859
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001860 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1861 data.enforceInterface(IActivityManager.descriptor);
1862 IIntentSender r = IIntentSender.Stub.asInterface(
1863 data.readStrongBinder());
1864 boolean res = isIntentSenderTargetedToPackage(r);
1865 reply.writeNoException();
1866 reply.writeInt(res ? 1 : 0);
1867 return true;
1868 }
1869
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001870 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1871 data.enforceInterface(IActivityManager.descriptor);
1872 IIntentSender r = IIntentSender.Stub.asInterface(
1873 data.readStrongBinder());
1874 boolean res = isIntentSenderAnActivity(r);
1875 reply.writeNoException();
1876 reply.writeInt(res ? 1 : 0);
1877 return true;
1878 }
1879
Dianne Hackborn81038902012-11-26 17:04:09 -08001880 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1881 data.enforceInterface(IActivityManager.descriptor);
1882 IIntentSender r = IIntentSender.Stub.asInterface(
1883 data.readStrongBinder());
1884 Intent intent = getIntentForIntentSender(r);
1885 reply.writeNoException();
1886 if (intent != null) {
1887 reply.writeInt(1);
1888 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1889 } else {
1890 reply.writeInt(0);
1891 }
1892 return true;
1893 }
1894
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001895 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1896 data.enforceInterface(IActivityManager.descriptor);
1897 IIntentSender r = IIntentSender.Stub.asInterface(
1898 data.readStrongBinder());
1899 String prefix = data.readString();
1900 String tag = getTagForIntentSender(r, prefix);
1901 reply.writeNoException();
1902 reply.writeString(tag);
1903 return true;
1904 }
1905
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001906 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1907 data.enforceInterface(IActivityManager.descriptor);
1908 Configuration config = Configuration.CREATOR.createFromParcel(data);
1909 updatePersistentConfiguration(config);
1910 reply.writeNoException();
1911 return true;
1912 }
1913
Dianne Hackbornb437e092011-08-05 17:50:29 -07001914 case GET_PROCESS_PSS_TRANSACTION: {
1915 data.enforceInterface(IActivityManager.descriptor);
1916 int[] pids = data.createIntArray();
1917 long[] pss = getProcessPss(pids);
1918 reply.writeNoException();
1919 reply.writeLongArray(pss);
1920 return true;
1921 }
1922
Dianne Hackborn661cd522011-08-22 00:26:20 -07001923 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1924 data.enforceInterface(IActivityManager.descriptor);
1925 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1926 boolean always = data.readInt() != 0;
1927 showBootMessage(msg, always);
1928 reply.writeNoException();
1929 return true;
1930 }
1931
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001932 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1933 data.enforceInterface(IActivityManager.descriptor);
1934 dismissKeyguardOnNextActivity();
1935 reply.writeNoException();
1936 return true;
1937 }
1938
Adam Powelldd8fab22012-03-22 17:47:27 -07001939 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1940 data.enforceInterface(IActivityManager.descriptor);
1941 IBinder token = data.readStrongBinder();
1942 String destAffinity = data.readString();
1943 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1944 reply.writeNoException();
1945 reply.writeInt(res ? 1 : 0);
1946 return true;
1947 }
1948
1949 case NAVIGATE_UP_TO_TRANSACTION: {
1950 data.enforceInterface(IActivityManager.descriptor);
1951 IBinder token = data.readStrongBinder();
1952 Intent target = Intent.CREATOR.createFromParcel(data);
1953 int resultCode = data.readInt();
1954 Intent resultData = null;
1955 if (data.readInt() != 0) {
1956 resultData = Intent.CREATOR.createFromParcel(data);
1957 }
1958 boolean res = navigateUpTo(token, target, resultCode, resultData);
1959 reply.writeNoException();
1960 reply.writeInt(res ? 1 : 0);
1961 return true;
1962 }
1963
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001964 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1965 data.enforceInterface(IActivityManager.descriptor);
1966 IBinder token = data.readStrongBinder();
1967 int res = getLaunchedFromUid(token);
1968 reply.writeNoException();
1969 reply.writeInt(res);
1970 return true;
1971 }
1972
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001973 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1974 data.enforceInterface(IActivityManager.descriptor);
1975 IBinder token = data.readStrongBinder();
1976 String res = getLaunchedFromPackage(token);
1977 reply.writeNoException();
1978 reply.writeString(res);
1979 return true;
1980 }
1981
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001982 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1983 data.enforceInterface(IActivityManager.descriptor);
1984 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1985 data.readStrongBinder());
1986 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001987 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001988 return true;
1989 }
1990
1991 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1992 data.enforceInterface(IActivityManager.descriptor);
1993 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1994 data.readStrongBinder());
1995 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001996 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001997 return true;
1998 }
1999
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002000 case REQUEST_BUG_REPORT_TRANSACTION: {
2001 data.enforceInterface(IActivityManager.descriptor);
2002 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002003 reply.writeNoException();
2004 return true;
2005 }
2006
2007 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2008 data.enforceInterface(IActivityManager.descriptor);
2009 int pid = data.readInt();
2010 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002011 String reason = data.readString();
2012 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002013 reply.writeNoException();
2014 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002015 return true;
2016 }
2017
Adam Skorydfc7fd72013-08-05 19:23:41 -07002018 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002019 data.enforceInterface(IActivityManager.descriptor);
2020 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002021 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002022 reply.writeNoException();
2023 reply.writeBundle(res);
2024 return true;
2025 }
2026
Adam Skorydfc7fd72013-08-05 19:23:41 -07002027 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002028 data.enforceInterface(IActivityManager.descriptor);
2029 IBinder token = data.readStrongBinder();
2030 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002031 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002032 reply.writeNoException();
2033 return true;
2034 }
2035
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002036 case KILL_UID_TRANSACTION: {
2037 data.enforceInterface(IActivityManager.descriptor);
2038 int uid = data.readInt();
2039 String reason = data.readString();
2040 killUid(uid, reason);
2041 reply.writeNoException();
2042 return true;
2043 }
2044
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002045 case HANG_TRANSACTION: {
2046 data.enforceInterface(IActivityManager.descriptor);
2047 IBinder who = data.readStrongBinder();
2048 boolean allowRestart = data.readInt() != 0;
2049 hang(who, allowRestart);
2050 reply.writeNoException();
2051 return true;
2052 }
2053
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002054 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2055 data.enforceInterface(IActivityManager.descriptor);
2056 IBinder token = data.readStrongBinder();
2057 reportActivityFullyDrawn(token);
2058 reply.writeNoException();
2059 return true;
2060 }
2061
Craig Mautner5eda9b32013-07-02 11:58:16 -07002062 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2063 data.enforceInterface(IActivityManager.descriptor);
2064 IBinder token = data.readStrongBinder();
2065 notifyActivityDrawn(token);
2066 reply.writeNoException();
2067 return true;
2068 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002069
2070 case RESTART_TRANSACTION: {
2071 data.enforceInterface(IActivityManager.descriptor);
2072 restart();
2073 reply.writeNoException();
2074 return true;
2075 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002076
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002077 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2078 data.enforceInterface(IActivityManager.descriptor);
2079 performIdleMaintenance();
2080 reply.writeNoException();
2081 return true;
2082 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002083
2084 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2085 data.enforceInterface(IActivityManager.descriptor);
2086 IBinder parentActivityToken = data.readStrongBinder();
2087 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002088 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002089 IActivityContainer activityContainer =
2090 createActivityContainer(parentActivityToken, callback);
2091 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002092 if (activityContainer != null) {
2093 reply.writeInt(1);
2094 reply.writeStrongBinder(activityContainer.asBinder());
2095 } else {
2096 reply.writeInt(0);
2097 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002098 return true;
2099 }
2100
Craig Mautner95da1082014-02-24 17:54:35 -08002101 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2102 data.enforceInterface(IActivityManager.descriptor);
2103 IActivityContainer activityContainer =
2104 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2105 deleteActivityContainer(activityContainer);
2106 reply.writeNoException();
2107 return true;
2108 }
2109
Craig Mautnere0a38842013-12-16 16:14:02 -08002110 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2111 data.enforceInterface(IActivityManager.descriptor);
2112 IBinder activityToken = data.readStrongBinder();
2113 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2114 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002115 if (activityContainer != null) {
2116 reply.writeInt(1);
2117 reply.writeStrongBinder(activityContainer.asBinder());
2118 } else {
2119 reply.writeInt(0);
2120 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002121 return true;
2122 }
2123
Craig Mautner4a1cb222013-12-04 16:14:06 -08002124 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2125 data.enforceInterface(IActivityManager.descriptor);
2126 IBinder homeActivityToken = getHomeActivityToken();
2127 reply.writeNoException();
2128 reply.writeStrongBinder(homeActivityToken);
2129 return true;
2130 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002131
2132 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2133 data.enforceInterface(IActivityManager.descriptor);
2134 final int taskId = data.readInt();
2135 startLockTaskMode(taskId);
2136 reply.writeNoException();
2137 return true;
2138 }
2139
2140 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2141 data.enforceInterface(IActivityManager.descriptor);
2142 IBinder token = data.readStrongBinder();
2143 startLockTaskMode(token);
2144 reply.writeNoException();
2145 return true;
2146 }
2147
Jason Monk62515be2014-05-21 16:06:19 -04002148 case START_LOCK_TASK_BY_CURRENT: {
2149 data.enforceInterface(IActivityManager.descriptor);
2150 startLockTaskModeOnCurrent();
2151 reply.writeNoException();
2152 return true;
2153 }
2154
Craig Mautneraea74a52014-03-08 14:23:10 -08002155 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2156 data.enforceInterface(IActivityManager.descriptor);
2157 stopLockTaskMode();
2158 reply.writeNoException();
2159 return true;
2160 }
2161
Jason Monk62515be2014-05-21 16:06:19 -04002162 case STOP_LOCK_TASK_BY_CURRENT: {
2163 data.enforceInterface(IActivityManager.descriptor);
2164 stopLockTaskModeOnCurrent();
2165 reply.writeNoException();
2166 return true;
2167 }
2168
Craig Mautneraea74a52014-03-08 14:23:10 -08002169 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2170 data.enforceInterface(IActivityManager.descriptor);
2171 final boolean isInLockTaskMode = isInLockTaskMode();
2172 reply.writeNoException();
2173 reply.writeInt(isInLockTaskMode ? 1 : 0);
2174 return true;
2175 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002176
Winson Chunga449dc02014-05-16 11:15:04 -07002177 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002178 data.enforceInterface(IActivityManager.descriptor);
2179 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002180 ActivityManager.TaskDescription values =
2181 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2182 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002183 reply.writeNoException();
2184 return true;
2185 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002186 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002187
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002188 return super.onTransact(code, data, reply, flags);
2189 }
2190
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002191 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002192 return this;
2193 }
2194
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002195 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2196 protected IActivityManager create() {
2197 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002198 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002199 Log.v("ActivityManager", "default service binder = " + b);
2200 }
2201 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002202 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002203 Log.v("ActivityManager", "default service = " + am);
2204 }
2205 return am;
2206 }
2207 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002208}
2209
2210class ActivityManagerProxy implements IActivityManager
2211{
2212 public ActivityManagerProxy(IBinder remote)
2213 {
2214 mRemote = remote;
2215 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002216
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002217 public IBinder asBinder()
2218 {
2219 return mRemote;
2220 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002221
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002222 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002223 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2224 int startFlags, String profileFile,
2225 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002226 Parcel data = Parcel.obtain();
2227 Parcel reply = Parcel.obtain();
2228 data.writeInterfaceToken(IActivityManager.descriptor);
2229 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002230 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002231 intent.writeToParcel(data, 0);
2232 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002233 data.writeStrongBinder(resultTo);
2234 data.writeString(resultWho);
2235 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002236 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002237 data.writeString(profileFile);
2238 if (profileFd != null) {
2239 data.writeInt(1);
2240 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2241 } else {
2242 data.writeInt(0);
2243 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002244 if (options != null) {
2245 data.writeInt(1);
2246 options.writeToParcel(data, 0);
2247 } else {
2248 data.writeInt(0);
2249 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002250 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2251 reply.readException();
2252 int result = reply.readInt();
2253 reply.recycle();
2254 data.recycle();
2255 return result;
2256 }
Amith Yamasani82644082012-08-03 13:09:11 -07002257
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002258 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002259 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2260 int startFlags, String profileFile,
2261 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2262 Parcel data = Parcel.obtain();
2263 Parcel reply = Parcel.obtain();
2264 data.writeInterfaceToken(IActivityManager.descriptor);
2265 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002266 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002267 intent.writeToParcel(data, 0);
2268 data.writeString(resolvedType);
2269 data.writeStrongBinder(resultTo);
2270 data.writeString(resultWho);
2271 data.writeInt(requestCode);
2272 data.writeInt(startFlags);
2273 data.writeString(profileFile);
2274 if (profileFd != null) {
2275 data.writeInt(1);
2276 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2277 } else {
2278 data.writeInt(0);
2279 }
2280 if (options != null) {
2281 data.writeInt(1);
2282 options.writeToParcel(data, 0);
2283 } else {
2284 data.writeInt(0);
2285 }
2286 data.writeInt(userId);
2287 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2288 reply.readException();
2289 int result = reply.readInt();
2290 reply.recycle();
2291 data.recycle();
2292 return result;
2293 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002294 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2295 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002296 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002297 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002298 Parcel data = Parcel.obtain();
2299 Parcel reply = Parcel.obtain();
2300 data.writeInterfaceToken(IActivityManager.descriptor);
2301 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002302 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002303 intent.writeToParcel(data, 0);
2304 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002305 data.writeStrongBinder(resultTo);
2306 data.writeString(resultWho);
2307 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002308 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002309 data.writeString(profileFile);
2310 if (profileFd != null) {
2311 data.writeInt(1);
2312 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2313 } else {
2314 data.writeInt(0);
2315 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002316 if (options != null) {
2317 data.writeInt(1);
2318 options.writeToParcel(data, 0);
2319 } else {
2320 data.writeInt(0);
2321 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002322 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002323 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2324 reply.readException();
2325 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2326 reply.recycle();
2327 data.recycle();
2328 return result;
2329 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002330 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2331 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002332 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002333 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002334 Parcel data = Parcel.obtain();
2335 Parcel reply = Parcel.obtain();
2336 data.writeInterfaceToken(IActivityManager.descriptor);
2337 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002338 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002339 intent.writeToParcel(data, 0);
2340 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002341 data.writeStrongBinder(resultTo);
2342 data.writeString(resultWho);
2343 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002344 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002345 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002346 if (options != null) {
2347 data.writeInt(1);
2348 options.writeToParcel(data, 0);
2349 } else {
2350 data.writeInt(0);
2351 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002352 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002353 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2354 reply.readException();
2355 int result = reply.readInt();
2356 reply.recycle();
2357 data.recycle();
2358 return result;
2359 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002360 public int startActivityIntentSender(IApplicationThread caller,
2361 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002362 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002363 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002364 Parcel data = Parcel.obtain();
2365 Parcel reply = Parcel.obtain();
2366 data.writeInterfaceToken(IActivityManager.descriptor);
2367 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2368 intent.writeToParcel(data, 0);
2369 if (fillInIntent != null) {
2370 data.writeInt(1);
2371 fillInIntent.writeToParcel(data, 0);
2372 } else {
2373 data.writeInt(0);
2374 }
2375 data.writeString(resolvedType);
2376 data.writeStrongBinder(resultTo);
2377 data.writeString(resultWho);
2378 data.writeInt(requestCode);
2379 data.writeInt(flagsMask);
2380 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002381 if (options != null) {
2382 data.writeInt(1);
2383 options.writeToParcel(data, 0);
2384 } else {
2385 data.writeInt(0);
2386 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002387 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002388 reply.readException();
2389 int result = reply.readInt();
2390 reply.recycle();
2391 data.recycle();
2392 return result;
2393 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002394 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2395 Intent intent, String resolvedType, IVoiceInteractionSession session,
2396 IVoiceInteractor interactor, int startFlags, String profileFile,
2397 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2398 Parcel data = Parcel.obtain();
2399 Parcel reply = Parcel.obtain();
2400 data.writeInterfaceToken(IActivityManager.descriptor);
2401 data.writeString(callingPackage);
2402 data.writeInt(callingPid);
2403 data.writeInt(callingUid);
2404 intent.writeToParcel(data, 0);
2405 data.writeString(resolvedType);
2406 data.writeStrongBinder(session.asBinder());
2407 data.writeStrongBinder(interactor.asBinder());
2408 data.writeInt(startFlags);
2409 data.writeString(profileFile);
2410 if (profileFd != null) {
2411 data.writeInt(1);
2412 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2413 } else {
2414 data.writeInt(0);
2415 }
2416 if (options != null) {
2417 data.writeInt(1);
2418 options.writeToParcel(data, 0);
2419 } else {
2420 data.writeInt(0);
2421 }
2422 data.writeInt(userId);
2423 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2424 reply.readException();
2425 int result = reply.readInt();
2426 reply.recycle();
2427 data.recycle();
2428 return result;
2429 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002430 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002431 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002432 Parcel data = Parcel.obtain();
2433 Parcel reply = Parcel.obtain();
2434 data.writeInterfaceToken(IActivityManager.descriptor);
2435 data.writeStrongBinder(callingActivity);
2436 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002437 if (options != null) {
2438 data.writeInt(1);
2439 options.writeToParcel(data, 0);
2440 } else {
2441 data.writeInt(0);
2442 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002443 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2444 reply.readException();
2445 int result = reply.readInt();
2446 reply.recycle();
2447 data.recycle();
2448 return result != 0;
2449 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002450 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002451 throws RemoteException {
2452 Parcel data = Parcel.obtain();
2453 Parcel reply = Parcel.obtain();
2454 data.writeInterfaceToken(IActivityManager.descriptor);
2455 data.writeStrongBinder(token);
2456 data.writeInt(resultCode);
2457 if (resultData != null) {
2458 data.writeInt(1);
2459 resultData.writeToParcel(data, 0);
2460 } else {
2461 data.writeInt(0);
2462 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002463 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002464 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2465 reply.readException();
2466 boolean res = reply.readInt() != 0;
2467 data.recycle();
2468 reply.recycle();
2469 return res;
2470 }
2471 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2472 {
2473 Parcel data = Parcel.obtain();
2474 Parcel reply = Parcel.obtain();
2475 data.writeInterfaceToken(IActivityManager.descriptor);
2476 data.writeStrongBinder(token);
2477 data.writeString(resultWho);
2478 data.writeInt(requestCode);
2479 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2480 reply.readException();
2481 data.recycle();
2482 reply.recycle();
2483 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002484 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2485 Parcel data = Parcel.obtain();
2486 Parcel reply = Parcel.obtain();
2487 data.writeInterfaceToken(IActivityManager.descriptor);
2488 data.writeStrongBinder(token);
2489 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2490 reply.readException();
2491 boolean res = reply.readInt() != 0;
2492 data.recycle();
2493 reply.recycle();
2494 return res;
2495 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002496 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2497 Parcel data = Parcel.obtain();
2498 Parcel reply = Parcel.obtain();
2499 data.writeInterfaceToken(IActivityManager.descriptor);
2500 data.writeStrongBinder(token);
2501 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2502 reply.readException();
2503 boolean res = reply.readInt() != 0;
2504 data.recycle();
2505 reply.recycle();
2506 return res;
2507 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002508 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002509 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002510 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002511 {
2512 Parcel data = Parcel.obtain();
2513 Parcel reply = Parcel.obtain();
2514 data.writeInterfaceToken(IActivityManager.descriptor);
2515 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002516 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002517 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2518 filter.writeToParcel(data, 0);
2519 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002520 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002521 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2522 reply.readException();
2523 Intent intent = null;
2524 int haveIntent = reply.readInt();
2525 if (haveIntent != 0) {
2526 intent = Intent.CREATOR.createFromParcel(reply);
2527 }
2528 reply.recycle();
2529 data.recycle();
2530 return intent;
2531 }
2532 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2533 {
2534 Parcel data = Parcel.obtain();
2535 Parcel reply = Parcel.obtain();
2536 data.writeInterfaceToken(IActivityManager.descriptor);
2537 data.writeStrongBinder(receiver.asBinder());
2538 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2539 reply.readException();
2540 data.recycle();
2541 reply.recycle();
2542 }
2543 public int broadcastIntent(IApplicationThread caller,
2544 Intent intent, String resolvedType, IIntentReceiver resultTo,
2545 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002546 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002547 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002548 {
2549 Parcel data = Parcel.obtain();
2550 Parcel reply = Parcel.obtain();
2551 data.writeInterfaceToken(IActivityManager.descriptor);
2552 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2553 intent.writeToParcel(data, 0);
2554 data.writeString(resolvedType);
2555 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2556 data.writeInt(resultCode);
2557 data.writeString(resultData);
2558 data.writeBundle(map);
2559 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002560 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002561 data.writeInt(serialized ? 1 : 0);
2562 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002563 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002564 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2565 reply.readException();
2566 int res = reply.readInt();
2567 reply.recycle();
2568 data.recycle();
2569 return res;
2570 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002571 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2572 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002573 {
2574 Parcel data = Parcel.obtain();
2575 Parcel reply = Parcel.obtain();
2576 data.writeInterfaceToken(IActivityManager.descriptor);
2577 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2578 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002579 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002580 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2581 reply.readException();
2582 data.recycle();
2583 reply.recycle();
2584 }
2585 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2586 {
2587 Parcel data = Parcel.obtain();
2588 Parcel reply = Parcel.obtain();
2589 data.writeInterfaceToken(IActivityManager.descriptor);
2590 data.writeStrongBinder(who);
2591 data.writeInt(resultCode);
2592 data.writeString(resultData);
2593 data.writeBundle(map);
2594 data.writeInt(abortBroadcast ? 1 : 0);
2595 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2596 reply.readException();
2597 data.recycle();
2598 reply.recycle();
2599 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002600 public void attachApplication(IApplicationThread app) throws RemoteException
2601 {
2602 Parcel data = Parcel.obtain();
2603 Parcel reply = Parcel.obtain();
2604 data.writeInterfaceToken(IActivityManager.descriptor);
2605 data.writeStrongBinder(app.asBinder());
2606 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2607 reply.readException();
2608 data.recycle();
2609 reply.recycle();
2610 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002611 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2612 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002613 {
2614 Parcel data = Parcel.obtain();
2615 Parcel reply = Parcel.obtain();
2616 data.writeInterfaceToken(IActivityManager.descriptor);
2617 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002618 if (config != null) {
2619 data.writeInt(1);
2620 config.writeToParcel(data, 0);
2621 } else {
2622 data.writeInt(0);
2623 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002624 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002625 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2626 reply.readException();
2627 data.recycle();
2628 reply.recycle();
2629 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002630 public void activityResumed(IBinder token) throws RemoteException
2631 {
2632 Parcel data = Parcel.obtain();
2633 Parcel reply = Parcel.obtain();
2634 data.writeInterfaceToken(IActivityManager.descriptor);
2635 data.writeStrongBinder(token);
2636 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2637 reply.readException();
2638 data.recycle();
2639 reply.recycle();
2640 }
Craig Mautnera0026042014-04-23 11:45:37 -07002641 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002642 {
2643 Parcel data = Parcel.obtain();
2644 Parcel reply = Parcel.obtain();
2645 data.writeInterfaceToken(IActivityManager.descriptor);
2646 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002647 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002648 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2649 reply.readException();
2650 data.recycle();
2651 reply.recycle();
2652 }
2653 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002654 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002655 {
2656 Parcel data = Parcel.obtain();
2657 Parcel reply = Parcel.obtain();
2658 data.writeInterfaceToken(IActivityManager.descriptor);
2659 data.writeStrongBinder(token);
2660 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002661 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002662 TextUtils.writeToParcel(description, data, 0);
2663 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2664 reply.readException();
2665 data.recycle();
2666 reply.recycle();
2667 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002668 public void activitySlept(IBinder token) throws RemoteException
2669 {
2670 Parcel data = Parcel.obtain();
2671 Parcel reply = Parcel.obtain();
2672 data.writeInterfaceToken(IActivityManager.descriptor);
2673 data.writeStrongBinder(token);
2674 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2675 reply.readException();
2676 data.recycle();
2677 reply.recycle();
2678 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002679 public void activityDestroyed(IBinder token) throws RemoteException
2680 {
2681 Parcel data = Parcel.obtain();
2682 Parcel reply = Parcel.obtain();
2683 data.writeInterfaceToken(IActivityManager.descriptor);
2684 data.writeStrongBinder(token);
2685 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2686 reply.readException();
2687 data.recycle();
2688 reply.recycle();
2689 }
2690 public String getCallingPackage(IBinder token) throws RemoteException
2691 {
2692 Parcel data = Parcel.obtain();
2693 Parcel reply = Parcel.obtain();
2694 data.writeInterfaceToken(IActivityManager.descriptor);
2695 data.writeStrongBinder(token);
2696 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2697 reply.readException();
2698 String res = reply.readString();
2699 data.recycle();
2700 reply.recycle();
2701 return res;
2702 }
2703 public ComponentName getCallingActivity(IBinder token)
2704 throws RemoteException {
2705 Parcel data = Parcel.obtain();
2706 Parcel reply = Parcel.obtain();
2707 data.writeInterfaceToken(IActivityManager.descriptor);
2708 data.writeStrongBinder(token);
2709 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2710 reply.readException();
2711 ComponentName res = ComponentName.readFromParcel(reply);
2712 data.recycle();
2713 reply.recycle();
2714 return res;
2715 }
Winson Chung1147c402014-05-14 11:05:00 -07002716 public List<IAppTask> getAppTasks() throws RemoteException {
2717 Parcel data = Parcel.obtain();
2718 Parcel reply = Parcel.obtain();
2719 data.writeInterfaceToken(IActivityManager.descriptor);
2720 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2721 reply.readException();
2722 ArrayList<IAppTask> list = null;
2723 int N = reply.readInt();
2724 if (N >= 0) {
2725 list = new ArrayList<IAppTask>();
2726 while (N > 0) {
2727 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2728 list.add(task);
2729 N--;
2730 }
2731 }
2732 data.recycle();
2733 reply.recycle();
2734 return list;
2735 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002736 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002737 Parcel data = Parcel.obtain();
2738 Parcel reply = Parcel.obtain();
2739 data.writeInterfaceToken(IActivityManager.descriptor);
2740 data.writeInt(maxNum);
2741 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002742 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2743 reply.readException();
2744 ArrayList list = null;
2745 int N = reply.readInt();
2746 if (N >= 0) {
2747 list = new ArrayList();
2748 while (N > 0) {
2749 ActivityManager.RunningTaskInfo info =
2750 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002751 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002752 list.add(info);
2753 N--;
2754 }
2755 }
2756 data.recycle();
2757 reply.recycle();
2758 return list;
2759 }
2760 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002761 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002762 Parcel data = Parcel.obtain();
2763 Parcel reply = Parcel.obtain();
2764 data.writeInterfaceToken(IActivityManager.descriptor);
2765 data.writeInt(maxNum);
2766 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002767 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002768 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2769 reply.readException();
2770 ArrayList<ActivityManager.RecentTaskInfo> list
2771 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2772 data.recycle();
2773 reply.recycle();
2774 return list;
2775 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002776 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002777 Parcel data = Parcel.obtain();
2778 Parcel reply = Parcel.obtain();
2779 data.writeInterfaceToken(IActivityManager.descriptor);
2780 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002781 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002782 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002783 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002784 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002785 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002786 }
2787 data.recycle();
2788 reply.recycle();
2789 return bm;
2790 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002791 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2792 Parcel data = Parcel.obtain();
2793 Parcel reply = Parcel.obtain();
2794 data.writeInterfaceToken(IActivityManager.descriptor);
2795 data.writeInt(id);
2796 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2797 reply.readException();
2798 Bitmap bm = null;
2799 if (reply.readInt() != 0) {
2800 bm = Bitmap.CREATOR.createFromParcel(reply);
2801 }
2802 data.recycle();
2803 reply.recycle();
2804 return bm;
2805 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002806 public List getServices(int maxNum, int flags) throws RemoteException {
2807 Parcel data = Parcel.obtain();
2808 Parcel reply = Parcel.obtain();
2809 data.writeInterfaceToken(IActivityManager.descriptor);
2810 data.writeInt(maxNum);
2811 data.writeInt(flags);
2812 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2813 reply.readException();
2814 ArrayList list = null;
2815 int N = reply.readInt();
2816 if (N >= 0) {
2817 list = new ArrayList();
2818 while (N > 0) {
2819 ActivityManager.RunningServiceInfo info =
2820 ActivityManager.RunningServiceInfo.CREATOR
2821 .createFromParcel(reply);
2822 list.add(info);
2823 N--;
2824 }
2825 }
2826 data.recycle();
2827 reply.recycle();
2828 return list;
2829 }
2830 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2831 throws RemoteException {
2832 Parcel data = Parcel.obtain();
2833 Parcel reply = Parcel.obtain();
2834 data.writeInterfaceToken(IActivityManager.descriptor);
2835 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2836 reply.readException();
2837 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2838 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2839 data.recycle();
2840 reply.recycle();
2841 return list;
2842 }
2843 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2844 throws RemoteException {
2845 Parcel data = Parcel.obtain();
2846 Parcel reply = Parcel.obtain();
2847 data.writeInterfaceToken(IActivityManager.descriptor);
2848 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2849 reply.readException();
2850 ArrayList<ActivityManager.RunningAppProcessInfo> list
2851 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2852 data.recycle();
2853 reply.recycle();
2854 return list;
2855 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002856 public List<ApplicationInfo> getRunningExternalApplications()
2857 throws RemoteException {
2858 Parcel data = Parcel.obtain();
2859 Parcel reply = Parcel.obtain();
2860 data.writeInterfaceToken(IActivityManager.descriptor);
2861 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2862 reply.readException();
2863 ArrayList<ApplicationInfo> list
2864 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2865 data.recycle();
2866 reply.recycle();
2867 return list;
2868 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002869 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002870 {
2871 Parcel data = Parcel.obtain();
2872 Parcel reply = Parcel.obtain();
2873 data.writeInterfaceToken(IActivityManager.descriptor);
2874 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002875 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002876 if (options != null) {
2877 data.writeInt(1);
2878 options.writeToParcel(data, 0);
2879 } else {
2880 data.writeInt(0);
2881 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002882 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2883 reply.readException();
2884 data.recycle();
2885 reply.recycle();
2886 }
2887 public void moveTaskToBack(int task) throws RemoteException
2888 {
2889 Parcel data = Parcel.obtain();
2890 Parcel reply = Parcel.obtain();
2891 data.writeInterfaceToken(IActivityManager.descriptor);
2892 data.writeInt(task);
2893 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2894 reply.readException();
2895 data.recycle();
2896 reply.recycle();
2897 }
2898 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2899 throws RemoteException {
2900 Parcel data = Parcel.obtain();
2901 Parcel reply = Parcel.obtain();
2902 data.writeInterfaceToken(IActivityManager.descriptor);
2903 data.writeStrongBinder(token);
2904 data.writeInt(nonRoot ? 1 : 0);
2905 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2906 reply.readException();
2907 boolean res = reply.readInt() != 0;
2908 data.recycle();
2909 reply.recycle();
2910 return res;
2911 }
2912 public void moveTaskBackwards(int task) throws RemoteException
2913 {
2914 Parcel data = Parcel.obtain();
2915 Parcel reply = Parcel.obtain();
2916 data.writeInterfaceToken(IActivityManager.descriptor);
2917 data.writeInt(task);
2918 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2919 reply.readException();
2920 data.recycle();
2921 reply.recycle();
2922 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002923 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002924 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2925 {
2926 Parcel data = Parcel.obtain();
2927 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002928 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002929 data.writeInt(taskId);
2930 data.writeInt(stackId);
2931 data.writeInt(toTop ? 1 : 0);
2932 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2933 reply.readException();
2934 data.recycle();
2935 reply.recycle();
2936 }
2937 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002938 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002939 {
2940 Parcel data = Parcel.obtain();
2941 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002942 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002943 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002944 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002945 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002946 reply.readException();
2947 data.recycle();
2948 reply.recycle();
2949 }
Craig Mautner967212c2013-04-13 21:10:58 -07002950 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002951 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002952 {
2953 Parcel data = Parcel.obtain();
2954 Parcel reply = Parcel.obtain();
2955 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002956 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002957 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002958 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002959 data.recycle();
2960 reply.recycle();
2961 return list;
2962 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002963 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002964 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002965 {
2966 Parcel data = Parcel.obtain();
2967 Parcel reply = Parcel.obtain();
2968 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002969 data.writeInt(stackId);
2970 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002971 reply.readException();
2972 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002973 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002974 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002975 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002976 }
2977 data.recycle();
2978 reply.recycle();
2979 return info;
2980 }
2981 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08002982 public boolean isInHomeStack(int taskId) throws RemoteException {
2983 Parcel data = Parcel.obtain();
2984 Parcel reply = Parcel.obtain();
2985 data.writeInterfaceToken(IActivityManager.descriptor);
2986 data.writeInt(taskId);
2987 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
2988 reply.readException();
2989 boolean isInHomeStack = reply.readInt() > 0;
2990 data.recycle();
2991 reply.recycle();
2992 return isInHomeStack;
2993 }
2994 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002995 public void setFocusedStack(int stackId) throws RemoteException
2996 {
2997 Parcel data = Parcel.obtain();
2998 Parcel reply = Parcel.obtain();
2999 data.writeInterfaceToken(IActivityManager.descriptor);
3000 data.writeInt(stackId);
3001 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3002 reply.readException();
3003 data.recycle();
3004 reply.recycle();
3005 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003006 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3007 {
3008 Parcel data = Parcel.obtain();
3009 Parcel reply = Parcel.obtain();
3010 data.writeInterfaceToken(IActivityManager.descriptor);
3011 data.writeStrongBinder(token);
3012 data.writeInt(onlyRoot ? 1 : 0);
3013 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3014 reply.readException();
3015 int res = reply.readInt();
3016 data.recycle();
3017 reply.recycle();
3018 return res;
3019 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003020 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003021 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003022 Parcel data = Parcel.obtain();
3023 Parcel reply = Parcel.obtain();
3024 data.writeInterfaceToken(IActivityManager.descriptor);
3025 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3026 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003027 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003028 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003029 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3030 reply.readException();
3031 int res = reply.readInt();
3032 ContentProviderHolder cph = null;
3033 if (res != 0) {
3034 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3035 }
3036 data.recycle();
3037 reply.recycle();
3038 return cph;
3039 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003040 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3041 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003042 Parcel data = Parcel.obtain();
3043 Parcel reply = Parcel.obtain();
3044 data.writeInterfaceToken(IActivityManager.descriptor);
3045 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003046 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003047 data.writeStrongBinder(token);
3048 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3049 reply.readException();
3050 int res = reply.readInt();
3051 ContentProviderHolder cph = null;
3052 if (res != 0) {
3053 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3054 }
3055 data.recycle();
3056 reply.recycle();
3057 return cph;
3058 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003059 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003060 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003061 {
3062 Parcel data = Parcel.obtain();
3063 Parcel reply = Parcel.obtain();
3064 data.writeInterfaceToken(IActivityManager.descriptor);
3065 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3066 data.writeTypedList(providers);
3067 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3068 reply.readException();
3069 data.recycle();
3070 reply.recycle();
3071 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003072 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3073 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003074 Parcel data = Parcel.obtain();
3075 Parcel reply = Parcel.obtain();
3076 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003077 data.writeStrongBinder(connection);
3078 data.writeInt(stable);
3079 data.writeInt(unstable);
3080 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3081 reply.readException();
3082 boolean res = reply.readInt() != 0;
3083 data.recycle();
3084 reply.recycle();
3085 return res;
3086 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003087
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003088 public void unstableProviderDied(IBinder connection) throws RemoteException {
3089 Parcel data = Parcel.obtain();
3090 Parcel reply = Parcel.obtain();
3091 data.writeInterfaceToken(IActivityManager.descriptor);
3092 data.writeStrongBinder(connection);
3093 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3094 reply.readException();
3095 data.recycle();
3096 reply.recycle();
3097 }
3098
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003099 @Override
3100 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3101 Parcel data = Parcel.obtain();
3102 Parcel reply = Parcel.obtain();
3103 data.writeInterfaceToken(IActivityManager.descriptor);
3104 data.writeStrongBinder(connection);
3105 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3106 reply.readException();
3107 data.recycle();
3108 reply.recycle();
3109 }
3110
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003111 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3112 Parcel data = Parcel.obtain();
3113 Parcel reply = Parcel.obtain();
3114 data.writeInterfaceToken(IActivityManager.descriptor);
3115 data.writeStrongBinder(connection);
3116 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003117 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3118 reply.readException();
3119 data.recycle();
3120 reply.recycle();
3121 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003122
3123 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3124 Parcel data = Parcel.obtain();
3125 Parcel reply = Parcel.obtain();
3126 data.writeInterfaceToken(IActivityManager.descriptor);
3127 data.writeString(name);
3128 data.writeStrongBinder(token);
3129 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3130 reply.readException();
3131 data.recycle();
3132 reply.recycle();
3133 }
3134
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003135 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3136 throws RemoteException
3137 {
3138 Parcel data = Parcel.obtain();
3139 Parcel reply = Parcel.obtain();
3140 data.writeInterfaceToken(IActivityManager.descriptor);
3141 service.writeToParcel(data, 0);
3142 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3143 reply.readException();
3144 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3145 data.recycle();
3146 reply.recycle();
3147 return res;
3148 }
3149
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003150 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003151 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003152 {
3153 Parcel data = Parcel.obtain();
3154 Parcel reply = Parcel.obtain();
3155 data.writeInterfaceToken(IActivityManager.descriptor);
3156 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3157 service.writeToParcel(data, 0);
3158 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003159 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003160 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3161 reply.readException();
3162 ComponentName res = ComponentName.readFromParcel(reply);
3163 data.recycle();
3164 reply.recycle();
3165 return res;
3166 }
3167 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003168 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003169 {
3170 Parcel data = Parcel.obtain();
3171 Parcel reply = Parcel.obtain();
3172 data.writeInterfaceToken(IActivityManager.descriptor);
3173 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3174 service.writeToParcel(data, 0);
3175 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003176 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003177 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3178 reply.readException();
3179 int res = reply.readInt();
3180 reply.recycle();
3181 data.recycle();
3182 return res;
3183 }
3184 public boolean stopServiceToken(ComponentName className, IBinder token,
3185 int startId) throws RemoteException {
3186 Parcel data = Parcel.obtain();
3187 Parcel reply = Parcel.obtain();
3188 data.writeInterfaceToken(IActivityManager.descriptor);
3189 ComponentName.writeToParcel(className, data);
3190 data.writeStrongBinder(token);
3191 data.writeInt(startId);
3192 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3193 reply.readException();
3194 boolean res = reply.readInt() != 0;
3195 data.recycle();
3196 reply.recycle();
3197 return res;
3198 }
3199 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003200 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003201 Parcel data = Parcel.obtain();
3202 Parcel reply = Parcel.obtain();
3203 data.writeInterfaceToken(IActivityManager.descriptor);
3204 ComponentName.writeToParcel(className, data);
3205 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003206 data.writeInt(id);
3207 if (notification != null) {
3208 data.writeInt(1);
3209 notification.writeToParcel(data, 0);
3210 } else {
3211 data.writeInt(0);
3212 }
3213 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003214 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3215 reply.readException();
3216 data.recycle();
3217 reply.recycle();
3218 }
3219 public int bindService(IApplicationThread caller, IBinder token,
3220 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003221 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003222 Parcel data = Parcel.obtain();
3223 Parcel reply = Parcel.obtain();
3224 data.writeInterfaceToken(IActivityManager.descriptor);
3225 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3226 data.writeStrongBinder(token);
3227 service.writeToParcel(data, 0);
3228 data.writeString(resolvedType);
3229 data.writeStrongBinder(connection.asBinder());
3230 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003231 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003232 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3233 reply.readException();
3234 int res = reply.readInt();
3235 data.recycle();
3236 reply.recycle();
3237 return res;
3238 }
3239 public boolean unbindService(IServiceConnection connection) throws RemoteException
3240 {
3241 Parcel data = Parcel.obtain();
3242 Parcel reply = Parcel.obtain();
3243 data.writeInterfaceToken(IActivityManager.descriptor);
3244 data.writeStrongBinder(connection.asBinder());
3245 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3246 reply.readException();
3247 boolean res = reply.readInt() != 0;
3248 data.recycle();
3249 reply.recycle();
3250 return res;
3251 }
3252
3253 public void publishService(IBinder token,
3254 Intent intent, IBinder service) throws RemoteException {
3255 Parcel data = Parcel.obtain();
3256 Parcel reply = Parcel.obtain();
3257 data.writeInterfaceToken(IActivityManager.descriptor);
3258 data.writeStrongBinder(token);
3259 intent.writeToParcel(data, 0);
3260 data.writeStrongBinder(service);
3261 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3262 reply.readException();
3263 data.recycle();
3264 reply.recycle();
3265 }
3266
3267 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3268 throws RemoteException {
3269 Parcel data = Parcel.obtain();
3270 Parcel reply = Parcel.obtain();
3271 data.writeInterfaceToken(IActivityManager.descriptor);
3272 data.writeStrongBinder(token);
3273 intent.writeToParcel(data, 0);
3274 data.writeInt(doRebind ? 1 : 0);
3275 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3276 reply.readException();
3277 data.recycle();
3278 reply.recycle();
3279 }
3280
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003281 public void serviceDoneExecuting(IBinder token, int type, int startId,
3282 int res) 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);
3286 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003287 data.writeInt(type);
3288 data.writeInt(startId);
3289 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003290 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3291 reply.readException();
3292 data.recycle();
3293 reply.recycle();
3294 }
3295
3296 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3297 Parcel data = Parcel.obtain();
3298 Parcel reply = Parcel.obtain();
3299 data.writeInterfaceToken(IActivityManager.descriptor);
3300 service.writeToParcel(data, 0);
3301 data.writeString(resolvedType);
3302 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3303 reply.readException();
3304 IBinder binder = reply.readStrongBinder();
3305 reply.recycle();
3306 data.recycle();
3307 return binder;
3308 }
3309
Christopher Tate181fafa2009-05-14 11:12:14 -07003310 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3311 throws RemoteException {
3312 Parcel data = Parcel.obtain();
3313 Parcel reply = Parcel.obtain();
3314 data.writeInterfaceToken(IActivityManager.descriptor);
3315 app.writeToParcel(data, 0);
3316 data.writeInt(backupRestoreMode);
3317 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3318 reply.readException();
3319 boolean success = reply.readInt() != 0;
3320 reply.recycle();
3321 data.recycle();
3322 return success;
3323 }
3324
Christopher Tate346acb12012-10-15 19:20:25 -07003325 public void clearPendingBackup() throws RemoteException {
3326 Parcel data = Parcel.obtain();
3327 Parcel reply = Parcel.obtain();
3328 data.writeInterfaceToken(IActivityManager.descriptor);
3329 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3330 reply.recycle();
3331 data.recycle();
3332 }
3333
Christopher Tate181fafa2009-05-14 11:12:14 -07003334 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3335 Parcel data = Parcel.obtain();
3336 Parcel reply = Parcel.obtain();
3337 data.writeInterfaceToken(IActivityManager.descriptor);
3338 data.writeString(packageName);
3339 data.writeStrongBinder(agent);
3340 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3341 reply.recycle();
3342 data.recycle();
3343 }
3344
3345 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3346 Parcel data = Parcel.obtain();
3347 Parcel reply = Parcel.obtain();
3348 data.writeInterfaceToken(IActivityManager.descriptor);
3349 app.writeToParcel(data, 0);
3350 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3351 reply.readException();
3352 reply.recycle();
3353 data.recycle();
3354 }
3355
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003356 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003357 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003358 IUiAutomationConnection connection, int userId, String instructionSet)
3359 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003360 Parcel data = Parcel.obtain();
3361 Parcel reply = Parcel.obtain();
3362 data.writeInterfaceToken(IActivityManager.descriptor);
3363 ComponentName.writeToParcel(className, data);
3364 data.writeString(profileFile);
3365 data.writeInt(flags);
3366 data.writeBundle(arguments);
3367 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003368 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003369 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003370 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003371 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3372 reply.readException();
3373 boolean res = reply.readInt() != 0;
3374 reply.recycle();
3375 data.recycle();
3376 return res;
3377 }
3378
3379 public void finishInstrumentation(IApplicationThread target,
3380 int resultCode, Bundle results) throws RemoteException {
3381 Parcel data = Parcel.obtain();
3382 Parcel reply = Parcel.obtain();
3383 data.writeInterfaceToken(IActivityManager.descriptor);
3384 data.writeStrongBinder(target != null ? target.asBinder() : null);
3385 data.writeInt(resultCode);
3386 data.writeBundle(results);
3387 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3388 reply.readException();
3389 data.recycle();
3390 reply.recycle();
3391 }
3392 public Configuration getConfiguration() throws RemoteException
3393 {
3394 Parcel data = Parcel.obtain();
3395 Parcel reply = Parcel.obtain();
3396 data.writeInterfaceToken(IActivityManager.descriptor);
3397 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3398 reply.readException();
3399 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3400 reply.recycle();
3401 data.recycle();
3402 return res;
3403 }
3404 public void updateConfiguration(Configuration values) throws RemoteException
3405 {
3406 Parcel data = Parcel.obtain();
3407 Parcel reply = Parcel.obtain();
3408 data.writeInterfaceToken(IActivityManager.descriptor);
3409 values.writeToParcel(data, 0);
3410 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3411 reply.readException();
3412 data.recycle();
3413 reply.recycle();
3414 }
3415 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3416 throws RemoteException {
3417 Parcel data = Parcel.obtain();
3418 Parcel reply = Parcel.obtain();
3419 data.writeInterfaceToken(IActivityManager.descriptor);
3420 data.writeStrongBinder(token);
3421 data.writeInt(requestedOrientation);
3422 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3423 reply.readException();
3424 data.recycle();
3425 reply.recycle();
3426 }
3427 public int getRequestedOrientation(IBinder token) throws RemoteException {
3428 Parcel data = Parcel.obtain();
3429 Parcel reply = Parcel.obtain();
3430 data.writeInterfaceToken(IActivityManager.descriptor);
3431 data.writeStrongBinder(token);
3432 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3433 reply.readException();
3434 int res = reply.readInt();
3435 data.recycle();
3436 reply.recycle();
3437 return res;
3438 }
3439 public ComponentName getActivityClassForToken(IBinder token)
3440 throws RemoteException {
3441 Parcel data = Parcel.obtain();
3442 Parcel reply = Parcel.obtain();
3443 data.writeInterfaceToken(IActivityManager.descriptor);
3444 data.writeStrongBinder(token);
3445 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3446 reply.readException();
3447 ComponentName res = ComponentName.readFromParcel(reply);
3448 data.recycle();
3449 reply.recycle();
3450 return res;
3451 }
3452 public String getPackageForToken(IBinder token) throws RemoteException
3453 {
3454 Parcel data = Parcel.obtain();
3455 Parcel reply = Parcel.obtain();
3456 data.writeInterfaceToken(IActivityManager.descriptor);
3457 data.writeStrongBinder(token);
3458 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3459 reply.readException();
3460 String res = reply.readString();
3461 data.recycle();
3462 reply.recycle();
3463 return res;
3464 }
3465 public IIntentSender getIntentSender(int type,
3466 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003467 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003468 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003469 Parcel data = Parcel.obtain();
3470 Parcel reply = Parcel.obtain();
3471 data.writeInterfaceToken(IActivityManager.descriptor);
3472 data.writeInt(type);
3473 data.writeString(packageName);
3474 data.writeStrongBinder(token);
3475 data.writeString(resultWho);
3476 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003477 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003478 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003479 data.writeTypedArray(intents, 0);
3480 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003481 } else {
3482 data.writeInt(0);
3483 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003484 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003485 if (options != null) {
3486 data.writeInt(1);
3487 options.writeToParcel(data, 0);
3488 } else {
3489 data.writeInt(0);
3490 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003491 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003492 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3493 reply.readException();
3494 IIntentSender res = IIntentSender.Stub.asInterface(
3495 reply.readStrongBinder());
3496 data.recycle();
3497 reply.recycle();
3498 return res;
3499 }
3500 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3501 Parcel data = Parcel.obtain();
3502 Parcel reply = Parcel.obtain();
3503 data.writeInterfaceToken(IActivityManager.descriptor);
3504 data.writeStrongBinder(sender.asBinder());
3505 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3506 reply.readException();
3507 data.recycle();
3508 reply.recycle();
3509 }
3510 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3511 Parcel data = Parcel.obtain();
3512 Parcel reply = Parcel.obtain();
3513 data.writeInterfaceToken(IActivityManager.descriptor);
3514 data.writeStrongBinder(sender.asBinder());
3515 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3516 reply.readException();
3517 String res = reply.readString();
3518 data.recycle();
3519 reply.recycle();
3520 return res;
3521 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003522 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3523 Parcel data = Parcel.obtain();
3524 Parcel reply = Parcel.obtain();
3525 data.writeInterfaceToken(IActivityManager.descriptor);
3526 data.writeStrongBinder(sender.asBinder());
3527 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3528 reply.readException();
3529 int res = reply.readInt();
3530 data.recycle();
3531 reply.recycle();
3532 return res;
3533 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003534 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3535 boolean requireFull, String name, String callerPackage) throws RemoteException {
3536 Parcel data = Parcel.obtain();
3537 Parcel reply = Parcel.obtain();
3538 data.writeInterfaceToken(IActivityManager.descriptor);
3539 data.writeInt(callingPid);
3540 data.writeInt(callingUid);
3541 data.writeInt(userId);
3542 data.writeInt(allowAll ? 1 : 0);
3543 data.writeInt(requireFull ? 1 : 0);
3544 data.writeString(name);
3545 data.writeString(callerPackage);
3546 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3547 reply.readException();
3548 int res = reply.readInt();
3549 data.recycle();
3550 reply.recycle();
3551 return res;
3552 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003553 public void setProcessLimit(int max) throws RemoteException
3554 {
3555 Parcel data = Parcel.obtain();
3556 Parcel reply = Parcel.obtain();
3557 data.writeInterfaceToken(IActivityManager.descriptor);
3558 data.writeInt(max);
3559 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3560 reply.readException();
3561 data.recycle();
3562 reply.recycle();
3563 }
3564 public int getProcessLimit() throws RemoteException
3565 {
3566 Parcel data = Parcel.obtain();
3567 Parcel reply = Parcel.obtain();
3568 data.writeInterfaceToken(IActivityManager.descriptor);
3569 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3570 reply.readException();
3571 int res = reply.readInt();
3572 data.recycle();
3573 reply.recycle();
3574 return res;
3575 }
3576 public void setProcessForeground(IBinder token, int pid,
3577 boolean isForeground) throws RemoteException {
3578 Parcel data = Parcel.obtain();
3579 Parcel reply = Parcel.obtain();
3580 data.writeInterfaceToken(IActivityManager.descriptor);
3581 data.writeStrongBinder(token);
3582 data.writeInt(pid);
3583 data.writeInt(isForeground ? 1 : 0);
3584 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3585 reply.readException();
3586 data.recycle();
3587 reply.recycle();
3588 }
3589 public int checkPermission(String permission, int pid, int uid)
3590 throws RemoteException {
3591 Parcel data = Parcel.obtain();
3592 Parcel reply = Parcel.obtain();
3593 data.writeInterfaceToken(IActivityManager.descriptor);
3594 data.writeString(permission);
3595 data.writeInt(pid);
3596 data.writeInt(uid);
3597 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3598 reply.readException();
3599 int res = reply.readInt();
3600 data.recycle();
3601 reply.recycle();
3602 return res;
3603 }
3604 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003605 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003606 Parcel data = Parcel.obtain();
3607 Parcel reply = Parcel.obtain();
3608 data.writeInterfaceToken(IActivityManager.descriptor);
3609 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003610 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003611 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003612 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3613 reply.readException();
3614 boolean res = reply.readInt() != 0;
3615 data.recycle();
3616 reply.recycle();
3617 return res;
3618 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003619 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003620 throws RemoteException {
3621 Parcel data = Parcel.obtain();
3622 Parcel reply = Parcel.obtain();
3623 data.writeInterfaceToken(IActivityManager.descriptor);
3624 uri.writeToParcel(data, 0);
3625 data.writeInt(pid);
3626 data.writeInt(uid);
3627 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003628 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003629 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3630 reply.readException();
3631 int res = reply.readInt();
3632 data.recycle();
3633 reply.recycle();
3634 return res;
3635 }
3636 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003637 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003638 Parcel data = Parcel.obtain();
3639 Parcel reply = Parcel.obtain();
3640 data.writeInterfaceToken(IActivityManager.descriptor);
3641 data.writeStrongBinder(caller.asBinder());
3642 data.writeString(targetPkg);
3643 uri.writeToParcel(data, 0);
3644 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003645 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003646 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3647 reply.readException();
3648 data.recycle();
3649 reply.recycle();
3650 }
3651 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003652 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003653 Parcel data = Parcel.obtain();
3654 Parcel reply = Parcel.obtain();
3655 data.writeInterfaceToken(IActivityManager.descriptor);
3656 data.writeStrongBinder(caller.asBinder());
3657 uri.writeToParcel(data, 0);
3658 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003659 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003660 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3661 reply.readException();
3662 data.recycle();
3663 reply.recycle();
3664 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003665
3666 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003667 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3668 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003669 Parcel data = Parcel.obtain();
3670 Parcel reply = Parcel.obtain();
3671 data.writeInterfaceToken(IActivityManager.descriptor);
3672 uri.writeToParcel(data, 0);
3673 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003674 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003675 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3676 reply.readException();
3677 data.recycle();
3678 reply.recycle();
3679 }
3680
3681 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003682 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3683 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003684 Parcel data = Parcel.obtain();
3685 Parcel reply = Parcel.obtain();
3686 data.writeInterfaceToken(IActivityManager.descriptor);
3687 uri.writeToParcel(data, 0);
3688 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003689 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003690 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3691 reply.readException();
3692 data.recycle();
3693 reply.recycle();
3694 }
3695
3696 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003697 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3698 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003699 Parcel data = Parcel.obtain();
3700 Parcel reply = Parcel.obtain();
3701 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003702 data.writeString(packageName);
3703 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003704 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3705 reply.readException();
3706 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3707 reply);
3708 data.recycle();
3709 reply.recycle();
3710 return perms;
3711 }
3712
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003713 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3714 throws RemoteException {
3715 Parcel data = Parcel.obtain();
3716 Parcel reply = Parcel.obtain();
3717 data.writeInterfaceToken(IActivityManager.descriptor);
3718 data.writeStrongBinder(who.asBinder());
3719 data.writeInt(waiting ? 1 : 0);
3720 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3721 reply.readException();
3722 data.recycle();
3723 reply.recycle();
3724 }
3725 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3726 Parcel data = Parcel.obtain();
3727 Parcel reply = Parcel.obtain();
3728 data.writeInterfaceToken(IActivityManager.descriptor);
3729 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3730 reply.readException();
3731 outInfo.readFromParcel(reply);
3732 data.recycle();
3733 reply.recycle();
3734 }
3735 public void unhandledBack() throws RemoteException
3736 {
3737 Parcel data = Parcel.obtain();
3738 Parcel reply = Parcel.obtain();
3739 data.writeInterfaceToken(IActivityManager.descriptor);
3740 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3741 reply.readException();
3742 data.recycle();
3743 reply.recycle();
3744 }
3745 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3746 {
3747 Parcel data = Parcel.obtain();
3748 Parcel reply = Parcel.obtain();
3749 data.writeInterfaceToken(IActivityManager.descriptor);
3750 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3751 reply.readException();
3752 ParcelFileDescriptor pfd = null;
3753 if (reply.readInt() != 0) {
3754 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3755 }
3756 data.recycle();
3757 reply.recycle();
3758 return pfd;
3759 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003760 public void setLockScreenShown(boolean shown) throws RemoteException
3761 {
3762 Parcel data = Parcel.obtain();
3763 Parcel reply = Parcel.obtain();
3764 data.writeInterfaceToken(IActivityManager.descriptor);
3765 data.writeInt(shown ? 1 : 0);
3766 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3767 reply.readException();
3768 data.recycle();
3769 reply.recycle();
3770 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003771 public void setDebugApp(
3772 String packageName, boolean waitForDebugger, boolean persistent)
3773 throws RemoteException
3774 {
3775 Parcel data = Parcel.obtain();
3776 Parcel reply = Parcel.obtain();
3777 data.writeInterfaceToken(IActivityManager.descriptor);
3778 data.writeString(packageName);
3779 data.writeInt(waitForDebugger ? 1 : 0);
3780 data.writeInt(persistent ? 1 : 0);
3781 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3782 reply.readException();
3783 data.recycle();
3784 reply.recycle();
3785 }
3786 public void setAlwaysFinish(boolean enabled) throws RemoteException
3787 {
3788 Parcel data = Parcel.obtain();
3789 Parcel reply = Parcel.obtain();
3790 data.writeInterfaceToken(IActivityManager.descriptor);
3791 data.writeInt(enabled ? 1 : 0);
3792 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3793 reply.readException();
3794 data.recycle();
3795 reply.recycle();
3796 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003797 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003798 {
3799 Parcel data = Parcel.obtain();
3800 Parcel reply = Parcel.obtain();
3801 data.writeInterfaceToken(IActivityManager.descriptor);
3802 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003803 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003804 reply.readException();
3805 data.recycle();
3806 reply.recycle();
3807 }
3808 public void enterSafeMode() throws RemoteException {
3809 Parcel data = Parcel.obtain();
3810 data.writeInterfaceToken(IActivityManager.descriptor);
3811 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3812 data.recycle();
3813 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003814 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3815 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003816 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003817 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003818 data.writeStrongBinder(sender.asBinder());
3819 data.writeInt(sourceUid);
3820 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003821 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3822 data.recycle();
3823 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003824 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003825 Parcel data = Parcel.obtain();
3826 Parcel reply = Parcel.obtain();
3827 data.writeInterfaceToken(IActivityManager.descriptor);
3828 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003829 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003830 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003831 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003832 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003833 boolean res = reply.readInt() != 0;
3834 data.recycle();
3835 reply.recycle();
3836 return res;
3837 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003838 @Override
3839 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3840 Parcel data = Parcel.obtain();
3841 Parcel reply = Parcel.obtain();
3842 data.writeInterfaceToken(IActivityManager.descriptor);
3843 data.writeString(reason);
3844 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3845 boolean res = reply.readInt() != 0;
3846 data.recycle();
3847 reply.recycle();
3848 return res;
3849 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003850 public boolean testIsSystemReady()
3851 {
3852 /* this base class version is never called */
3853 return true;
3854 }
Dan Egnor60d87622009-12-16 16:32:58 -08003855 public void handleApplicationCrash(IBinder app,
3856 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3857 {
3858 Parcel data = Parcel.obtain();
3859 Parcel reply = Parcel.obtain();
3860 data.writeInterfaceToken(IActivityManager.descriptor);
3861 data.writeStrongBinder(app);
3862 crashInfo.writeToParcel(data, 0);
3863 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3864 reply.readException();
3865 reply.recycle();
3866 data.recycle();
3867 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003868
Dan Egnor60d87622009-12-16 16:32:58 -08003869 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003870 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003871 {
3872 Parcel data = Parcel.obtain();
3873 Parcel reply = Parcel.obtain();
3874 data.writeInterfaceToken(IActivityManager.descriptor);
3875 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003876 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003877 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003878 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003879 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003880 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003881 reply.recycle();
3882 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003883 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003884 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003885
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003886 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003887 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003888 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003889 {
3890 Parcel data = Parcel.obtain();
3891 Parcel reply = Parcel.obtain();
3892 data.writeInterfaceToken(IActivityManager.descriptor);
3893 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003894 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003895 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003896 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3897 reply.readException();
3898 reply.recycle();
3899 data.recycle();
3900 }
3901
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003902 public void signalPersistentProcesses(int sig) throws RemoteException {
3903 Parcel data = Parcel.obtain();
3904 Parcel reply = Parcel.obtain();
3905 data.writeInterfaceToken(IActivityManager.descriptor);
3906 data.writeInt(sig);
3907 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3908 reply.readException();
3909 data.recycle();
3910 reply.recycle();
3911 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003912
Dianne Hackborn1676c852012-09-10 14:52:30 -07003913 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003914 Parcel data = Parcel.obtain();
3915 Parcel reply = Parcel.obtain();
3916 data.writeInterfaceToken(IActivityManager.descriptor);
3917 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003918 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003919 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3920 reply.readException();
3921 data.recycle();
3922 reply.recycle();
3923 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003924
3925 public void killAllBackgroundProcesses() throws RemoteException {
3926 Parcel data = Parcel.obtain();
3927 Parcel reply = Parcel.obtain();
3928 data.writeInterfaceToken(IActivityManager.descriptor);
3929 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3930 reply.readException();
3931 data.recycle();
3932 reply.recycle();
3933 }
3934
Dianne Hackborn1676c852012-09-10 14:52:30 -07003935 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003936 Parcel data = Parcel.obtain();
3937 Parcel reply = Parcel.obtain();
3938 data.writeInterfaceToken(IActivityManager.descriptor);
3939 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003940 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003941 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003942 reply.readException();
3943 data.recycle();
3944 reply.recycle();
3945 }
3946
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003947 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3948 throws RemoteException
3949 {
3950 Parcel data = Parcel.obtain();
3951 Parcel reply = Parcel.obtain();
3952 data.writeInterfaceToken(IActivityManager.descriptor);
3953 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3954 reply.readException();
3955 outInfo.readFromParcel(reply);
3956 reply.recycle();
3957 data.recycle();
3958 }
3959
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003960 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3961 {
3962 Parcel data = Parcel.obtain();
3963 Parcel reply = Parcel.obtain();
3964 data.writeInterfaceToken(IActivityManager.descriptor);
3965 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3966 reply.readException();
3967 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3968 reply.recycle();
3969 data.recycle();
3970 return res;
3971 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003972
Dianne Hackborn1676c852012-09-10 14:52:30 -07003973 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003974 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003975 {
3976 Parcel data = Parcel.obtain();
3977 Parcel reply = Parcel.obtain();
3978 data.writeInterfaceToken(IActivityManager.descriptor);
3979 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003980 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003981 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003982 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003983 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003984 if (fd != null) {
3985 data.writeInt(1);
3986 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3987 } else {
3988 data.writeInt(0);
3989 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003990 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3991 reply.readException();
3992 boolean res = reply.readInt() != 0;
3993 reply.recycle();
3994 data.recycle();
3995 return res;
3996 }
3997
Dianne Hackborn55280a92009-05-07 15:53:46 -07003998 public boolean shutdown(int timeout) throws RemoteException
3999 {
4000 Parcel data = Parcel.obtain();
4001 Parcel reply = Parcel.obtain();
4002 data.writeInterfaceToken(IActivityManager.descriptor);
4003 data.writeInt(timeout);
4004 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4005 reply.readException();
4006 boolean res = reply.readInt() != 0;
4007 reply.recycle();
4008 data.recycle();
4009 return res;
4010 }
4011
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004012 public void stopAppSwitches() throws RemoteException {
4013 Parcel data = Parcel.obtain();
4014 Parcel reply = Parcel.obtain();
4015 data.writeInterfaceToken(IActivityManager.descriptor);
4016 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4017 reply.readException();
4018 reply.recycle();
4019 data.recycle();
4020 }
4021
4022 public void resumeAppSwitches() throws RemoteException {
4023 Parcel data = Parcel.obtain();
4024 Parcel reply = Parcel.obtain();
4025 data.writeInterfaceToken(IActivityManager.descriptor);
4026 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4027 reply.readException();
4028 reply.recycle();
4029 data.recycle();
4030 }
4031
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004032 public void killApplicationWithAppId(String pkg, int appid, String reason)
4033 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004034 Parcel data = Parcel.obtain();
4035 Parcel reply = Parcel.obtain();
4036 data.writeInterfaceToken(IActivityManager.descriptor);
4037 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004038 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004039 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004040 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004041 reply.readException();
4042 data.recycle();
4043 reply.recycle();
4044 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004045
4046 public void closeSystemDialogs(String reason) throws RemoteException {
4047 Parcel data = Parcel.obtain();
4048 Parcel reply = Parcel.obtain();
4049 data.writeInterfaceToken(IActivityManager.descriptor);
4050 data.writeString(reason);
4051 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4052 reply.readException();
4053 data.recycle();
4054 reply.recycle();
4055 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004056
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004057 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004058 throws RemoteException {
4059 Parcel data = Parcel.obtain();
4060 Parcel reply = Parcel.obtain();
4061 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004062 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004063 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4064 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004065 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004066 data.recycle();
4067 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004068 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004069 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004070
4071 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4072 Parcel data = Parcel.obtain();
4073 Parcel reply = Parcel.obtain();
4074 data.writeInterfaceToken(IActivityManager.descriptor);
4075 data.writeString(processName);
4076 data.writeInt(uid);
4077 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4078 reply.readException();
4079 data.recycle();
4080 reply.recycle();
4081 }
4082
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004083 public void overridePendingTransition(IBinder token, String packageName,
4084 int enterAnim, int exitAnim) throws RemoteException {
4085 Parcel data = Parcel.obtain();
4086 Parcel reply = Parcel.obtain();
4087 data.writeInterfaceToken(IActivityManager.descriptor);
4088 data.writeStrongBinder(token);
4089 data.writeString(packageName);
4090 data.writeInt(enterAnim);
4091 data.writeInt(exitAnim);
4092 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4093 reply.readException();
4094 data.recycle();
4095 reply.recycle();
4096 }
4097
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004098 public boolean isUserAMonkey() throws RemoteException {
4099 Parcel data = Parcel.obtain();
4100 Parcel reply = Parcel.obtain();
4101 data.writeInterfaceToken(IActivityManager.descriptor);
4102 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4103 reply.readException();
4104 boolean res = reply.readInt() != 0;
4105 data.recycle();
4106 reply.recycle();
4107 return res;
4108 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004109
4110 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4111 Parcel data = Parcel.obtain();
4112 Parcel reply = Parcel.obtain();
4113 data.writeInterfaceToken(IActivityManager.descriptor);
4114 data.writeInt(monkey ? 1 : 0);
4115 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4116 reply.readException();
4117 data.recycle();
4118 reply.recycle();
4119 }
4120
Dianne Hackborn860755f2010-06-03 18:47:52 -07004121 public void finishHeavyWeightApp() throws RemoteException {
4122 Parcel data = Parcel.obtain();
4123 Parcel reply = Parcel.obtain();
4124 data.writeInterfaceToken(IActivityManager.descriptor);
4125 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4126 reply.readException();
4127 data.recycle();
4128 reply.recycle();
4129 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004130
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004131 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004132 throws RemoteException {
4133 Parcel data = Parcel.obtain();
4134 Parcel reply = Parcel.obtain();
4135 data.writeInterfaceToken(IActivityManager.descriptor);
4136 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004137 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4138 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004139 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004140 data.recycle();
4141 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004142 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004143 }
4144
Craig Mautner233ceee2014-05-09 17:05:11 -07004145 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004146 throws RemoteException {
4147 Parcel data = Parcel.obtain();
4148 Parcel reply = Parcel.obtain();
4149 data.writeInterfaceToken(IActivityManager.descriptor);
4150 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004151 if (options == null) {
4152 data.writeInt(0);
4153 } else {
4154 data.writeInt(1);
4155 data.writeBundle(options.toBundle());
4156 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004157 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004158 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004159 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004160 data.recycle();
4161 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004162 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004163 }
4164
Craig Mautner233ceee2014-05-09 17:05:11 -07004165 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4166 Parcel data = Parcel.obtain();
4167 Parcel reply = Parcel.obtain();
4168 data.writeInterfaceToken(IActivityManager.descriptor);
4169 data.writeStrongBinder(token);
4170 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4171 reply.readException();
4172 Bundle bundle = reply.readBundle();
4173 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4174 data.recycle();
4175 reply.recycle();
4176 return options;
4177 }
4178
Daniel Sandler69a48172010-06-23 16:29:36 -04004179 public void setImmersive(IBinder token, boolean immersive)
4180 throws RemoteException {
4181 Parcel data = Parcel.obtain();
4182 Parcel reply = Parcel.obtain();
4183 data.writeInterfaceToken(IActivityManager.descriptor);
4184 data.writeStrongBinder(token);
4185 data.writeInt(immersive ? 1 : 0);
4186 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4187 reply.readException();
4188 data.recycle();
4189 reply.recycle();
4190 }
4191
4192 public boolean isImmersive(IBinder token)
4193 throws RemoteException {
4194 Parcel data = Parcel.obtain();
4195 Parcel reply = Parcel.obtain();
4196 data.writeInterfaceToken(IActivityManager.descriptor);
4197 data.writeStrongBinder(token);
4198 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004199 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004200 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004201 data.recycle();
4202 reply.recycle();
4203 return res;
4204 }
4205
4206 public boolean isTopActivityImmersive()
4207 throws RemoteException {
4208 Parcel data = Parcel.obtain();
4209 Parcel reply = Parcel.obtain();
4210 data.writeInterfaceToken(IActivityManager.descriptor);
4211 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004212 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004213 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004214 data.recycle();
4215 reply.recycle();
4216 return res;
4217 }
4218
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004219 public void crashApplication(int uid, int initialPid, String packageName,
4220 String message) throws RemoteException {
4221 Parcel data = Parcel.obtain();
4222 Parcel reply = Parcel.obtain();
4223 data.writeInterfaceToken(IActivityManager.descriptor);
4224 data.writeInt(uid);
4225 data.writeInt(initialPid);
4226 data.writeString(packageName);
4227 data.writeString(message);
4228 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4229 reply.readException();
4230 data.recycle();
4231 reply.recycle();
4232 }
Andy McFadden824c5102010-07-09 16:26:57 -07004233
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004234 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004235 Parcel data = Parcel.obtain();
4236 Parcel reply = Parcel.obtain();
4237 data.writeInterfaceToken(IActivityManager.descriptor);
4238 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004239 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004240 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4241 reply.readException();
4242 String res = reply.readString();
4243 data.recycle();
4244 reply.recycle();
4245 return res;
4246 }
4247
Dianne Hackborn7e269642010-08-25 19:50:20 -07004248 public IBinder newUriPermissionOwner(String name)
4249 throws RemoteException {
4250 Parcel data = Parcel.obtain();
4251 Parcel reply = Parcel.obtain();
4252 data.writeInterfaceToken(IActivityManager.descriptor);
4253 data.writeString(name);
4254 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4255 reply.readException();
4256 IBinder res = reply.readStrongBinder();
4257 data.recycle();
4258 reply.recycle();
4259 return res;
4260 }
4261
4262 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004263 Uri uri, int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004264 Parcel data = Parcel.obtain();
4265 Parcel reply = Parcel.obtain();
4266 data.writeInterfaceToken(IActivityManager.descriptor);
4267 data.writeStrongBinder(owner);
4268 data.writeInt(fromUid);
4269 data.writeString(targetPkg);
4270 uri.writeToParcel(data, 0);
4271 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004272 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004273 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4274 reply.readException();
4275 data.recycle();
4276 reply.recycle();
4277 }
4278
4279 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004280 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004281 Parcel data = Parcel.obtain();
4282 Parcel reply = Parcel.obtain();
4283 data.writeInterfaceToken(IActivityManager.descriptor);
4284 data.writeStrongBinder(owner);
4285 if (uri != null) {
4286 data.writeInt(1);
4287 uri.writeToParcel(data, 0);
4288 } else {
4289 data.writeInt(0);
4290 }
4291 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004292 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004293 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4294 reply.readException();
4295 data.recycle();
4296 reply.recycle();
4297 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004298
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004299 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004300 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004301 Parcel data = Parcel.obtain();
4302 Parcel reply = Parcel.obtain();
4303 data.writeInterfaceToken(IActivityManager.descriptor);
4304 data.writeInt(callingUid);
4305 data.writeString(targetPkg);
4306 uri.writeToParcel(data, 0);
4307 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004308 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004309 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4310 reply.readException();
4311 int res = reply.readInt();
4312 data.recycle();
4313 reply.recycle();
4314 return res;
4315 }
4316
Dianne Hackborn1676c852012-09-10 14:52:30 -07004317 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004318 String path, ParcelFileDescriptor fd) throws RemoteException {
4319 Parcel data = Parcel.obtain();
4320 Parcel reply = Parcel.obtain();
4321 data.writeInterfaceToken(IActivityManager.descriptor);
4322 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004323 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004324 data.writeInt(managed ? 1 : 0);
4325 data.writeString(path);
4326 if (fd != null) {
4327 data.writeInt(1);
4328 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4329 } else {
4330 data.writeInt(0);
4331 }
4332 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4333 reply.readException();
4334 boolean res = reply.readInt() != 0;
4335 reply.recycle();
4336 data.recycle();
4337 return res;
4338 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004339
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004340 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004341 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004342 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004343 Parcel data = Parcel.obtain();
4344 Parcel reply = Parcel.obtain();
4345 data.writeInterfaceToken(IActivityManager.descriptor);
4346 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004347 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004348 data.writeTypedArray(intents, 0);
4349 data.writeStringArray(resolvedTypes);
4350 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004351 if (options != null) {
4352 data.writeInt(1);
4353 options.writeToParcel(data, 0);
4354 } else {
4355 data.writeInt(0);
4356 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004357 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004358 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4359 reply.readException();
4360 int result = reply.readInt();
4361 reply.recycle();
4362 data.recycle();
4363 return result;
4364 }
4365
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004366 public int getFrontActivityScreenCompatMode() throws RemoteException {
4367 Parcel data = Parcel.obtain();
4368 Parcel reply = Parcel.obtain();
4369 data.writeInterfaceToken(IActivityManager.descriptor);
4370 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4371 reply.readException();
4372 int mode = reply.readInt();
4373 reply.recycle();
4374 data.recycle();
4375 return mode;
4376 }
4377
4378 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4379 Parcel data = Parcel.obtain();
4380 Parcel reply = Parcel.obtain();
4381 data.writeInterfaceToken(IActivityManager.descriptor);
4382 data.writeInt(mode);
4383 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4384 reply.readException();
4385 reply.recycle();
4386 data.recycle();
4387 }
4388
4389 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4390 Parcel data = Parcel.obtain();
4391 Parcel reply = Parcel.obtain();
4392 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004393 data.writeString(packageName);
4394 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004395 reply.readException();
4396 int mode = reply.readInt();
4397 reply.recycle();
4398 data.recycle();
4399 return mode;
4400 }
4401
4402 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004403 throws RemoteException {
4404 Parcel data = Parcel.obtain();
4405 Parcel reply = Parcel.obtain();
4406 data.writeInterfaceToken(IActivityManager.descriptor);
4407 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004408 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004409 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4410 reply.readException();
4411 reply.recycle();
4412 data.recycle();
4413 }
4414
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004415 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4416 Parcel data = Parcel.obtain();
4417 Parcel reply = Parcel.obtain();
4418 data.writeInterfaceToken(IActivityManager.descriptor);
4419 data.writeString(packageName);
4420 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4421 reply.readException();
4422 boolean ask = reply.readInt() != 0;
4423 reply.recycle();
4424 data.recycle();
4425 return ask;
4426 }
4427
4428 public void setPackageAskScreenCompat(String packageName, boolean ask)
4429 throws RemoteException {
4430 Parcel data = Parcel.obtain();
4431 Parcel reply = Parcel.obtain();
4432 data.writeInterfaceToken(IActivityManager.descriptor);
4433 data.writeString(packageName);
4434 data.writeInt(ask ? 1 : 0);
4435 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4436 reply.readException();
4437 reply.recycle();
4438 data.recycle();
4439 }
4440
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004441 public boolean switchUser(int userid) throws RemoteException {
4442 Parcel data = Parcel.obtain();
4443 Parcel reply = Parcel.obtain();
4444 data.writeInterfaceToken(IActivityManager.descriptor);
4445 data.writeInt(userid);
4446 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4447 reply.readException();
4448 boolean result = reply.readInt() != 0;
4449 reply.recycle();
4450 data.recycle();
4451 return result;
4452 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004453
Kenny Guy08488bf2014-02-21 17:40:37 +00004454 public boolean startUserInBackground(int userid) throws RemoteException {
4455 Parcel data = Parcel.obtain();
4456 Parcel reply = Parcel.obtain();
4457 data.writeInterfaceToken(IActivityManager.descriptor);
4458 data.writeInt(userid);
4459 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4460 reply.readException();
4461 boolean result = reply.readInt() != 0;
4462 reply.recycle();
4463 data.recycle();
4464 return result;
4465 }
4466
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004467 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4468 Parcel data = Parcel.obtain();
4469 Parcel reply = Parcel.obtain();
4470 data.writeInterfaceToken(IActivityManager.descriptor);
4471 data.writeInt(userid);
4472 data.writeStrongInterface(callback);
4473 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4474 reply.readException();
4475 int result = reply.readInt();
4476 reply.recycle();
4477 data.recycle();
4478 return result;
4479 }
4480
Amith Yamasani52f1d752012-03-28 18:19:29 -07004481 public UserInfo getCurrentUser() throws RemoteException {
4482 Parcel data = Parcel.obtain();
4483 Parcel reply = Parcel.obtain();
4484 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004485 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004486 reply.readException();
4487 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4488 reply.recycle();
4489 data.recycle();
4490 return userInfo;
4491 }
4492
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004493 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004494 Parcel data = Parcel.obtain();
4495 Parcel reply = Parcel.obtain();
4496 data.writeInterfaceToken(IActivityManager.descriptor);
4497 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004498 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004499 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4500 reply.readException();
4501 boolean result = reply.readInt() != 0;
4502 reply.recycle();
4503 data.recycle();
4504 return result;
4505 }
4506
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004507 public int[] getRunningUserIds() throws RemoteException {
4508 Parcel data = Parcel.obtain();
4509 Parcel reply = Parcel.obtain();
4510 data.writeInterfaceToken(IActivityManager.descriptor);
4511 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4512 reply.readException();
4513 int[] result = reply.createIntArray();
4514 reply.recycle();
4515 data.recycle();
4516 return result;
4517 }
4518
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004519 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4520 Parcel data = Parcel.obtain();
4521 Parcel reply = Parcel.obtain();
4522 data.writeInterfaceToken(IActivityManager.descriptor);
4523 data.writeInt(taskId);
4524 data.writeInt(subTaskIndex);
4525 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4526 reply.readException();
4527 boolean result = reply.readInt() != 0;
4528 reply.recycle();
4529 data.recycle();
4530 return result;
4531 }
4532
4533 public boolean removeTask(int taskId, int flags) throws RemoteException {
4534 Parcel data = Parcel.obtain();
4535 Parcel reply = Parcel.obtain();
4536 data.writeInterfaceToken(IActivityManager.descriptor);
4537 data.writeInt(taskId);
4538 data.writeInt(flags);
4539 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4540 reply.readException();
4541 boolean result = reply.readInt() != 0;
4542 reply.recycle();
4543 data.recycle();
4544 return result;
4545 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004546
Jeff Sharkeya4620792011-05-20 15:29:23 -07004547 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4548 Parcel data = Parcel.obtain();
4549 Parcel reply = Parcel.obtain();
4550 data.writeInterfaceToken(IActivityManager.descriptor);
4551 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4552 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4553 reply.readException();
4554 data.recycle();
4555 reply.recycle();
4556 }
4557
4558 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4559 Parcel data = Parcel.obtain();
4560 Parcel reply = Parcel.obtain();
4561 data.writeInterfaceToken(IActivityManager.descriptor);
4562 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4563 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4564 reply.readException();
4565 data.recycle();
4566 reply.recycle();
4567 }
4568
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004569 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4570 Parcel data = Parcel.obtain();
4571 Parcel reply = Parcel.obtain();
4572 data.writeInterfaceToken(IActivityManager.descriptor);
4573 data.writeStrongBinder(sender.asBinder());
4574 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4575 reply.readException();
4576 boolean res = reply.readInt() != 0;
4577 data.recycle();
4578 reply.recycle();
4579 return res;
4580 }
4581
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004582 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4583 Parcel data = Parcel.obtain();
4584 Parcel reply = Parcel.obtain();
4585 data.writeInterfaceToken(IActivityManager.descriptor);
4586 data.writeStrongBinder(sender.asBinder());
4587 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4588 reply.readException();
4589 boolean res = reply.readInt() != 0;
4590 data.recycle();
4591 reply.recycle();
4592 return res;
4593 }
4594
Dianne Hackborn81038902012-11-26 17:04:09 -08004595 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4596 Parcel data = Parcel.obtain();
4597 Parcel reply = Parcel.obtain();
4598 data.writeInterfaceToken(IActivityManager.descriptor);
4599 data.writeStrongBinder(sender.asBinder());
4600 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4601 reply.readException();
4602 Intent res = reply.readInt() != 0
4603 ? Intent.CREATOR.createFromParcel(reply) : null;
4604 data.recycle();
4605 reply.recycle();
4606 return res;
4607 }
4608
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004609 public String getTagForIntentSender(IIntentSender sender, String prefix)
4610 throws RemoteException {
4611 Parcel data = Parcel.obtain();
4612 Parcel reply = Parcel.obtain();
4613 data.writeInterfaceToken(IActivityManager.descriptor);
4614 data.writeStrongBinder(sender.asBinder());
4615 data.writeString(prefix);
4616 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4617 reply.readException();
4618 String res = reply.readString();
4619 data.recycle();
4620 reply.recycle();
4621 return res;
4622 }
4623
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004624 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4625 {
4626 Parcel data = Parcel.obtain();
4627 Parcel reply = Parcel.obtain();
4628 data.writeInterfaceToken(IActivityManager.descriptor);
4629 values.writeToParcel(data, 0);
4630 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4631 reply.readException();
4632 data.recycle();
4633 reply.recycle();
4634 }
4635
Dianne Hackbornb437e092011-08-05 17:50:29 -07004636 public long[] getProcessPss(int[] pids) throws RemoteException {
4637 Parcel data = Parcel.obtain();
4638 Parcel reply = Parcel.obtain();
4639 data.writeInterfaceToken(IActivityManager.descriptor);
4640 data.writeIntArray(pids);
4641 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4642 reply.readException();
4643 long[] res = reply.createLongArray();
4644 data.recycle();
4645 reply.recycle();
4646 return res;
4647 }
4648
Dianne Hackborn661cd522011-08-22 00:26:20 -07004649 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4650 Parcel data = Parcel.obtain();
4651 Parcel reply = Parcel.obtain();
4652 data.writeInterfaceToken(IActivityManager.descriptor);
4653 TextUtils.writeToParcel(msg, data, 0);
4654 data.writeInt(always ? 1 : 0);
4655 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4656 reply.readException();
4657 data.recycle();
4658 reply.recycle();
4659 }
4660
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004661 public void dismissKeyguardOnNextActivity() throws RemoteException {
4662 Parcel data = Parcel.obtain();
4663 Parcel reply = Parcel.obtain();
4664 data.writeInterfaceToken(IActivityManager.descriptor);
4665 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4666 reply.readException();
4667 data.recycle();
4668 reply.recycle();
4669 }
4670
Adam Powelldd8fab22012-03-22 17:47:27 -07004671 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4672 throws RemoteException {
4673 Parcel data = Parcel.obtain();
4674 Parcel reply = Parcel.obtain();
4675 data.writeInterfaceToken(IActivityManager.descriptor);
4676 data.writeStrongBinder(token);
4677 data.writeString(destAffinity);
4678 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4679 reply.readException();
4680 boolean result = reply.readInt() != 0;
4681 data.recycle();
4682 reply.recycle();
4683 return result;
4684 }
4685
4686 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4687 throws RemoteException {
4688 Parcel data = Parcel.obtain();
4689 Parcel reply = Parcel.obtain();
4690 data.writeInterfaceToken(IActivityManager.descriptor);
4691 data.writeStrongBinder(token);
4692 target.writeToParcel(data, 0);
4693 data.writeInt(resultCode);
4694 if (resultData != null) {
4695 data.writeInt(1);
4696 resultData.writeToParcel(data, 0);
4697 } else {
4698 data.writeInt(0);
4699 }
4700 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4701 reply.readException();
4702 boolean result = reply.readInt() != 0;
4703 data.recycle();
4704 reply.recycle();
4705 return result;
4706 }
4707
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004708 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4709 Parcel data = Parcel.obtain();
4710 Parcel reply = Parcel.obtain();
4711 data.writeInterfaceToken(IActivityManager.descriptor);
4712 data.writeStrongBinder(activityToken);
4713 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4714 reply.readException();
4715 int result = reply.readInt();
4716 data.recycle();
4717 reply.recycle();
4718 return result;
4719 }
4720
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004721 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4722 Parcel data = Parcel.obtain();
4723 Parcel reply = Parcel.obtain();
4724 data.writeInterfaceToken(IActivityManager.descriptor);
4725 data.writeStrongBinder(activityToken);
4726 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4727 reply.readException();
4728 String result = reply.readString();
4729 data.recycle();
4730 reply.recycle();
4731 return result;
4732 }
4733
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004734 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4735 Parcel data = Parcel.obtain();
4736 Parcel reply = Parcel.obtain();
4737 data.writeInterfaceToken(IActivityManager.descriptor);
4738 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4739 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4740 reply.readException();
4741 data.recycle();
4742 reply.recycle();
4743 }
4744
4745 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4746 Parcel data = Parcel.obtain();
4747 Parcel reply = Parcel.obtain();
4748 data.writeInterfaceToken(IActivityManager.descriptor);
4749 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4750 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4751 reply.readException();
4752 data.recycle();
4753 reply.recycle();
4754 }
4755
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004756 public void requestBugReport() throws RemoteException {
4757 Parcel data = Parcel.obtain();
4758 Parcel reply = Parcel.obtain();
4759 data.writeInterfaceToken(IActivityManager.descriptor);
4760 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4761 reply.readException();
4762 data.recycle();
4763 reply.recycle();
4764 }
4765
Jeff Brownbd181bb2013-09-10 16:44:24 -07004766 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4767 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004768 Parcel data = Parcel.obtain();
4769 Parcel reply = Parcel.obtain();
4770 data.writeInterfaceToken(IActivityManager.descriptor);
4771 data.writeInt(pid);
4772 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004773 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004774 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4775 reply.readException();
4776 long res = reply.readInt();
4777 data.recycle();
4778 reply.recycle();
4779 return res;
4780 }
4781
Adam Skorydfc7fd72013-08-05 19:23:41 -07004782 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004783 Parcel data = Parcel.obtain();
4784 Parcel reply = Parcel.obtain();
4785 data.writeInterfaceToken(IActivityManager.descriptor);
4786 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004787 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004788 reply.readException();
4789 Bundle res = reply.readBundle();
4790 data.recycle();
4791 reply.recycle();
4792 return res;
4793 }
4794
Adam Skory7140a252013-09-11 12:04:58 +01004795 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004796 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004797 Parcel data = Parcel.obtain();
4798 Parcel reply = Parcel.obtain();
4799 data.writeInterfaceToken(IActivityManager.descriptor);
4800 data.writeStrongBinder(token);
4801 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004802 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004803 reply.readException();
4804 data.recycle();
4805 reply.recycle();
4806 }
4807
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004808 public void killUid(int uid, String reason) throws RemoteException {
4809 Parcel data = Parcel.obtain();
4810 Parcel reply = Parcel.obtain();
4811 data.writeInterfaceToken(IActivityManager.descriptor);
4812 data.writeInt(uid);
4813 data.writeString(reason);
4814 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4815 reply.readException();
4816 data.recycle();
4817 reply.recycle();
4818 }
4819
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004820 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4821 Parcel data = Parcel.obtain();
4822 Parcel reply = Parcel.obtain();
4823 data.writeInterfaceToken(IActivityManager.descriptor);
4824 data.writeStrongBinder(who);
4825 data.writeInt(allowRestart ? 1 : 0);
4826 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4827 reply.readException();
4828 data.recycle();
4829 reply.recycle();
4830 }
4831
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004832 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4833 Parcel data = Parcel.obtain();
4834 Parcel reply = Parcel.obtain();
4835 data.writeInterfaceToken(IActivityManager.descriptor);
4836 data.writeStrongBinder(token);
4837 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4838 reply.readException();
4839 data.recycle();
4840 reply.recycle();
4841 }
4842
Craig Mautner5eda9b32013-07-02 11:58:16 -07004843 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4844 Parcel data = Parcel.obtain();
4845 Parcel reply = Parcel.obtain();
4846 data.writeInterfaceToken(IActivityManager.descriptor);
4847 data.writeStrongBinder(token);
4848 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4849 reply.readException();
4850 data.recycle();
4851 reply.recycle();
4852 }
4853
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004854 public void restart() throws RemoteException {
4855 Parcel data = Parcel.obtain();
4856 Parcel reply = Parcel.obtain();
4857 data.writeInterfaceToken(IActivityManager.descriptor);
4858 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4859 reply.readException();
4860 data.recycle();
4861 reply.recycle();
4862 }
4863
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004864 public void performIdleMaintenance() throws RemoteException {
4865 Parcel data = Parcel.obtain();
4866 Parcel reply = Parcel.obtain();
4867 data.writeInterfaceToken(IActivityManager.descriptor);
4868 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4869 reply.readException();
4870 data.recycle();
4871 reply.recycle();
4872 }
4873
Craig Mautner4a1cb222013-12-04 16:14:06 -08004874 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4875 IActivityContainerCallback callback) throws RemoteException {
4876 Parcel data = Parcel.obtain();
4877 Parcel reply = Parcel.obtain();
4878 data.writeInterfaceToken(IActivityManager.descriptor);
4879 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07004880 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08004881 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4882 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004883 final int result = reply.readInt();
4884 final IActivityContainer res;
4885 if (result == 1) {
4886 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4887 } else {
4888 res = null;
4889 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004890 data.recycle();
4891 reply.recycle();
4892 return res;
4893 }
4894
Craig Mautner95da1082014-02-24 17:54:35 -08004895 public void deleteActivityContainer(IActivityContainer activityContainer)
4896 throws RemoteException {
4897 Parcel data = Parcel.obtain();
4898 Parcel reply = Parcel.obtain();
4899 data.writeInterfaceToken(IActivityManager.descriptor);
4900 data.writeStrongBinder(activityContainer.asBinder());
4901 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4902 reply.readException();
4903 data.recycle();
4904 reply.recycle();
4905 }
4906
Craig Mautnere0a38842013-12-16 16:14:02 -08004907 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4908 throws RemoteException {
4909 Parcel data = Parcel.obtain();
4910 Parcel reply = Parcel.obtain();
4911 data.writeInterfaceToken(IActivityManager.descriptor);
4912 data.writeStrongBinder(activityToken);
4913 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4914 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004915 final int result = reply.readInt();
4916 final IActivityContainer res;
4917 if (result == 1) {
4918 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4919 } else {
4920 res = null;
4921 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004922 data.recycle();
4923 reply.recycle();
4924 return res;
4925 }
4926
Craig Mautner4a1cb222013-12-04 16:14:06 -08004927 public IBinder getHomeActivityToken() throws RemoteException {
4928 Parcel data = Parcel.obtain();
4929 Parcel reply = Parcel.obtain();
4930 data.writeInterfaceToken(IActivityManager.descriptor);
4931 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4932 reply.readException();
4933 IBinder res = reply.readStrongBinder();
4934 data.recycle();
4935 reply.recycle();
4936 return res;
4937 }
4938
Craig Mautneraea74a52014-03-08 14:23:10 -08004939 @Override
4940 public void startLockTaskMode(int taskId) throws RemoteException {
4941 Parcel data = Parcel.obtain();
4942 Parcel reply = Parcel.obtain();
4943 data.writeInterfaceToken(IActivityManager.descriptor);
4944 data.writeInt(taskId);
4945 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
4946 reply.readException();
4947 data.recycle();
4948 reply.recycle();
4949 }
4950
4951 @Override
4952 public void startLockTaskMode(IBinder token) throws RemoteException {
4953 Parcel data = Parcel.obtain();
4954 Parcel reply = Parcel.obtain();
4955 data.writeInterfaceToken(IActivityManager.descriptor);
4956 data.writeStrongBinder(token);
4957 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
4958 reply.readException();
4959 data.recycle();
4960 reply.recycle();
4961 }
4962
4963 @Override
Jason Monk62515be2014-05-21 16:06:19 -04004964 public void startLockTaskModeOnCurrent() throws RemoteException {
4965 Parcel data = Parcel.obtain();
4966 Parcel reply = Parcel.obtain();
4967 data.writeInterfaceToken(IActivityManager.descriptor);
4968 mRemote.transact(START_LOCK_TASK_BY_CURRENT, data, reply, 0);
4969 reply.readException();
4970 data.recycle();
4971 reply.recycle();
4972 }
4973
4974 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08004975 public void stopLockTaskMode() throws RemoteException {
4976 Parcel data = Parcel.obtain();
4977 Parcel reply = Parcel.obtain();
4978 data.writeInterfaceToken(IActivityManager.descriptor);
4979 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4980 reply.readException();
4981 data.recycle();
4982 reply.recycle();
4983 }
4984
4985 @Override
Jason Monk62515be2014-05-21 16:06:19 -04004986 public void stopLockTaskModeOnCurrent() throws RemoteException {
4987 Parcel data = Parcel.obtain();
4988 Parcel reply = Parcel.obtain();
4989 data.writeInterfaceToken(IActivityManager.descriptor);
4990 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT, data, reply, 0);
4991 reply.readException();
4992 data.recycle();
4993 reply.recycle();
4994 }
4995
4996 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08004997 public boolean isInLockTaskMode() throws RemoteException {
4998 Parcel data = Parcel.obtain();
4999 Parcel reply = Parcel.obtain();
5000 data.writeInterfaceToken(IActivityManager.descriptor);
5001 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5002 reply.readException();
5003 boolean isInLockTaskMode = reply.readInt() == 1;
5004 data.recycle();
5005 reply.recycle();
5006 return isInLockTaskMode;
5007 }
5008
Craig Mautner688b5102014-03-27 16:55:03 -07005009 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005010 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005011 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005012 Parcel data = Parcel.obtain();
5013 Parcel reply = Parcel.obtain();
5014 data.writeInterfaceToken(IActivityManager.descriptor);
5015 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005016 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005017 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005018 reply.readException();
5019 data.recycle();
5020 reply.recycle();
5021 }
5022
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005023 private IBinder mRemote;
5024}