blob: ec2868afc2c78d407d488f6e60985ad26b266a2c [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
509 case GET_TASKS_TRANSACTION: {
510 data.enforceInterface(IActivityManager.descriptor);
511 int maxNum = data.readInt();
512 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700513 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800514 reply.writeNoException();
515 int N = list != null ? list.size() : -1;
516 reply.writeInt(N);
517 int i;
518 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700519 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800520 info.writeToParcel(reply, 0);
521 }
522 return true;
523 }
524
525 case GET_RECENT_TASKS_TRANSACTION: {
526 data.enforceInterface(IActivityManager.descriptor);
527 int maxNum = data.readInt();
528 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700529 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800530 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700531 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800532 reply.writeNoException();
533 reply.writeTypedList(list);
534 return true;
535 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700536
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700537 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800538 data.enforceInterface(IActivityManager.descriptor);
539 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700540 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800541 reply.writeNoException();
542 if (bm != null) {
543 reply.writeInt(1);
544 bm.writeToParcel(reply, 0);
545 } else {
546 reply.writeInt(0);
547 }
548 return true;
549 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700550
551 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
552 data.enforceInterface(IActivityManager.descriptor);
553 int id = data.readInt();
554 Bitmap bm = getTaskTopThumbnail(id);
555 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 }
564
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800565 case GET_SERVICES_TRANSACTION: {
566 data.enforceInterface(IActivityManager.descriptor);
567 int maxNum = data.readInt();
568 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700569 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800570 reply.writeNoException();
571 int N = list != null ? list.size() : -1;
572 reply.writeInt(N);
573 int i;
574 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700575 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800576 info.writeToParcel(reply, 0);
577 }
578 return true;
579 }
580
581 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
582 data.enforceInterface(IActivityManager.descriptor);
583 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
584 reply.writeNoException();
585 reply.writeTypedList(list);
586 return true;
587 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700588
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800589 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
590 data.enforceInterface(IActivityManager.descriptor);
591 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
592 reply.writeNoException();
593 reply.writeTypedList(list);
594 return true;
595 }
596
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700597 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
598 data.enforceInterface(IActivityManager.descriptor);
599 List<ApplicationInfo> list = getRunningExternalApplications();
600 reply.writeNoException();
601 reply.writeTypedList(list);
602 return true;
603 }
604
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800605 case MOVE_TASK_TO_FRONT_TRANSACTION: {
606 data.enforceInterface(IActivityManager.descriptor);
607 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800608 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700609 Bundle options = data.readInt() != 0
610 ? Bundle.CREATOR.createFromParcel(data) : null;
611 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800612 reply.writeNoException();
613 return true;
614 }
615
616 case MOVE_TASK_TO_BACK_TRANSACTION: {
617 data.enforceInterface(IActivityManager.descriptor);
618 int task = data.readInt();
619 moveTaskToBack(task);
620 reply.writeNoException();
621 return true;
622 }
623
624 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
625 data.enforceInterface(IActivityManager.descriptor);
626 IBinder token = data.readStrongBinder();
627 boolean nonRoot = data.readInt() != 0;
628 boolean res = moveActivityTaskToBack(token, nonRoot);
629 reply.writeNoException();
630 reply.writeInt(res ? 1 : 0);
631 return true;
632 }
633
634 case MOVE_TASK_BACKWARDS_TRANSACTION: {
635 data.enforceInterface(IActivityManager.descriptor);
636 int task = data.readInt();
637 moveTaskBackwards(task);
638 reply.writeNoException();
639 return true;
640 }
641
Craig Mautnerc00204b2013-03-05 15:02:14 -0800642 case MOVE_TASK_TO_STACK_TRANSACTION: {
643 data.enforceInterface(IActivityManager.descriptor);
644 int taskId = data.readInt();
645 int stackId = data.readInt();
646 boolean toTop = data.readInt() != 0;
647 moveTaskToStack(taskId, stackId, toTop);
648 reply.writeNoException();
649 return true;
650 }
651
652 case RESIZE_STACK_TRANSACTION: {
653 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800654 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800655 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800656 Rect r = Rect.CREATOR.createFromParcel(data);
657 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800658 reply.writeNoException();
659 return true;
660 }
661
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800662 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700663 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800664 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700665 reply.writeNoException();
666 reply.writeTypedList(list);
667 return true;
668 }
669
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800670 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700671 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800672 int stackId = data.readInt();
673 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700674 reply.writeNoException();
675 if (info != null) {
676 reply.writeInt(1);
677 info.writeToParcel(reply, 0);
678 } else {
679 reply.writeInt(0);
680 }
681 return true;
682 }
683
Winson Chung303e1ff2014-03-07 15:06:19 -0800684 case IS_IN_HOME_STACK_TRANSACTION: {
685 data.enforceInterface(IActivityManager.descriptor);
686 int taskId = data.readInt();
687 boolean isInHomeStack = isInHomeStack(taskId);
688 reply.writeNoException();
689 reply.writeInt(isInHomeStack ? 1 : 0);
690 return true;
691 }
692
Craig Mautnercf910b02013-04-23 11:23:27 -0700693 case SET_FOCUSED_STACK_TRANSACTION: {
694 data.enforceInterface(IActivityManager.descriptor);
695 int stackId = data.readInt();
696 setFocusedStack(stackId);
697 reply.writeNoException();
698 return true;
699 }
700
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
702 data.enforceInterface(IActivityManager.descriptor);
703 IBinder token = data.readStrongBinder();
704 boolean onlyRoot = data.readInt() != 0;
705 int res = token != null
706 ? getTaskForActivity(token, onlyRoot) : -1;
707 reply.writeNoException();
708 reply.writeInt(res);
709 return true;
710 }
711
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800712 case GET_CONTENT_PROVIDER_TRANSACTION: {
713 data.enforceInterface(IActivityManager.descriptor);
714 IBinder b = data.readStrongBinder();
715 IApplicationThread app = ApplicationThreadNative.asInterface(b);
716 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700717 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700718 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700719 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800720 reply.writeNoException();
721 if (cph != null) {
722 reply.writeInt(1);
723 cph.writeToParcel(reply, 0);
724 } else {
725 reply.writeInt(0);
726 }
727 return true;
728 }
729
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800730 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
731 data.enforceInterface(IActivityManager.descriptor);
732 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700733 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800734 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700735 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800736 reply.writeNoException();
737 if (cph != null) {
738 reply.writeInt(1);
739 cph.writeToParcel(reply, 0);
740 } else {
741 reply.writeInt(0);
742 }
743 return true;
744 }
745
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800746 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
747 data.enforceInterface(IActivityManager.descriptor);
748 IBinder b = data.readStrongBinder();
749 IApplicationThread app = ApplicationThreadNative.asInterface(b);
750 ArrayList<ContentProviderHolder> providers =
751 data.createTypedArrayList(ContentProviderHolder.CREATOR);
752 publishContentProviders(app, providers);
753 reply.writeNoException();
754 return true;
755 }
756
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700757 case REF_CONTENT_PROVIDER_TRANSACTION: {
758 data.enforceInterface(IActivityManager.descriptor);
759 IBinder b = data.readStrongBinder();
760 int stable = data.readInt();
761 int unstable = data.readInt();
762 boolean res = refContentProvider(b, stable, unstable);
763 reply.writeNoException();
764 reply.writeInt(res ? 1 : 0);
765 return true;
766 }
767
768 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 IBinder b = data.readStrongBinder();
771 unstableProviderDied(b);
772 reply.writeNoException();
773 return true;
774 }
775
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700776 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
777 data.enforceInterface(IActivityManager.descriptor);
778 IBinder b = data.readStrongBinder();
779 appNotRespondingViaProvider(b);
780 reply.writeNoException();
781 return true;
782 }
783
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800784 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
785 data.enforceInterface(IActivityManager.descriptor);
786 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700787 boolean stable = data.readInt() != 0;
788 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800789 reply.writeNoException();
790 return true;
791 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800792
793 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
794 data.enforceInterface(IActivityManager.descriptor);
795 String name = data.readString();
796 IBinder token = data.readStrongBinder();
797 removeContentProviderExternal(name, token);
798 reply.writeNoException();
799 return true;
800 }
801
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700802 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
803 data.enforceInterface(IActivityManager.descriptor);
804 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
805 PendingIntent pi = getRunningServiceControlPanel(comp);
806 reply.writeNoException();
807 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
808 return true;
809 }
810
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800811 case START_SERVICE_TRANSACTION: {
812 data.enforceInterface(IActivityManager.descriptor);
813 IBinder b = data.readStrongBinder();
814 IApplicationThread app = ApplicationThreadNative.asInterface(b);
815 Intent service = Intent.CREATOR.createFromParcel(data);
816 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700817 int userId = data.readInt();
818 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800819 reply.writeNoException();
820 ComponentName.writeToParcel(cn, reply);
821 return true;
822 }
823
824 case STOP_SERVICE_TRANSACTION: {
825 data.enforceInterface(IActivityManager.descriptor);
826 IBinder b = data.readStrongBinder();
827 IApplicationThread app = ApplicationThreadNative.asInterface(b);
828 Intent service = Intent.CREATOR.createFromParcel(data);
829 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700830 int userId = data.readInt();
831 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800832 reply.writeNoException();
833 reply.writeInt(res);
834 return true;
835 }
836
837 case STOP_SERVICE_TOKEN_TRANSACTION: {
838 data.enforceInterface(IActivityManager.descriptor);
839 ComponentName className = ComponentName.readFromParcel(data);
840 IBinder token = data.readStrongBinder();
841 int startId = data.readInt();
842 boolean res = stopServiceToken(className, token, startId);
843 reply.writeNoException();
844 reply.writeInt(res ? 1 : 0);
845 return true;
846 }
847
848 case SET_SERVICE_FOREGROUND_TRANSACTION: {
849 data.enforceInterface(IActivityManager.descriptor);
850 ComponentName className = ComponentName.readFromParcel(data);
851 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700852 int id = data.readInt();
853 Notification notification = null;
854 if (data.readInt() != 0) {
855 notification = Notification.CREATOR.createFromParcel(data);
856 }
857 boolean removeNotification = data.readInt() != 0;
858 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800859 reply.writeNoException();
860 return true;
861 }
862
863 case BIND_SERVICE_TRANSACTION: {
864 data.enforceInterface(IActivityManager.descriptor);
865 IBinder b = data.readStrongBinder();
866 IApplicationThread app = ApplicationThreadNative.asInterface(b);
867 IBinder token = data.readStrongBinder();
868 Intent service = Intent.CREATOR.createFromParcel(data);
869 String resolvedType = data.readString();
870 b = data.readStrongBinder();
871 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800872 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800874 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800875 reply.writeNoException();
876 reply.writeInt(res);
877 return true;
878 }
879
880 case UNBIND_SERVICE_TRANSACTION: {
881 data.enforceInterface(IActivityManager.descriptor);
882 IBinder b = data.readStrongBinder();
883 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
884 boolean res = unbindService(conn);
885 reply.writeNoException();
886 reply.writeInt(res ? 1 : 0);
887 return true;
888 }
889
890 case PUBLISH_SERVICE_TRANSACTION: {
891 data.enforceInterface(IActivityManager.descriptor);
892 IBinder token = data.readStrongBinder();
893 Intent intent = Intent.CREATOR.createFromParcel(data);
894 IBinder service = data.readStrongBinder();
895 publishService(token, intent, service);
896 reply.writeNoException();
897 return true;
898 }
899
900 case UNBIND_FINISHED_TRANSACTION: {
901 data.enforceInterface(IActivityManager.descriptor);
902 IBinder token = data.readStrongBinder();
903 Intent intent = Intent.CREATOR.createFromParcel(data);
904 boolean doRebind = data.readInt() != 0;
905 unbindFinished(token, intent, doRebind);
906 reply.writeNoException();
907 return true;
908 }
909
910 case SERVICE_DONE_EXECUTING_TRANSACTION: {
911 data.enforceInterface(IActivityManager.descriptor);
912 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700913 int type = data.readInt();
914 int startId = data.readInt();
915 int res = data.readInt();
916 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 reply.writeNoException();
918 return true;
919 }
920
921 case START_INSTRUMENTATION_TRANSACTION: {
922 data.enforceInterface(IActivityManager.descriptor);
923 ComponentName className = ComponentName.readFromParcel(data);
924 String profileFile = data.readString();
925 int fl = data.readInt();
926 Bundle arguments = data.readBundle();
927 IBinder b = data.readStrongBinder();
928 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800929 b = data.readStrongBinder();
930 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700931 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800932 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800933 reply.writeNoException();
934 reply.writeInt(res ? 1 : 0);
935 return true;
936 }
937
938
939 case FINISH_INSTRUMENTATION_TRANSACTION: {
940 data.enforceInterface(IActivityManager.descriptor);
941 IBinder b = data.readStrongBinder();
942 IApplicationThread app = ApplicationThreadNative.asInterface(b);
943 int resultCode = data.readInt();
944 Bundle results = data.readBundle();
945 finishInstrumentation(app, resultCode, results);
946 reply.writeNoException();
947 return true;
948 }
949
950 case GET_CONFIGURATION_TRANSACTION: {
951 data.enforceInterface(IActivityManager.descriptor);
952 Configuration config = getConfiguration();
953 reply.writeNoException();
954 config.writeToParcel(reply, 0);
955 return true;
956 }
957
958 case UPDATE_CONFIGURATION_TRANSACTION: {
959 data.enforceInterface(IActivityManager.descriptor);
960 Configuration config = Configuration.CREATOR.createFromParcel(data);
961 updateConfiguration(config);
962 reply.writeNoException();
963 return true;
964 }
965
966 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
967 data.enforceInterface(IActivityManager.descriptor);
968 IBinder token = data.readStrongBinder();
969 int requestedOrientation = data.readInt();
970 setRequestedOrientation(token, requestedOrientation);
971 reply.writeNoException();
972 return true;
973 }
974
975 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
976 data.enforceInterface(IActivityManager.descriptor);
977 IBinder token = data.readStrongBinder();
978 int req = getRequestedOrientation(token);
979 reply.writeNoException();
980 reply.writeInt(req);
981 return true;
982 }
983
984 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
985 data.enforceInterface(IActivityManager.descriptor);
986 IBinder token = data.readStrongBinder();
987 ComponentName cn = getActivityClassForToken(token);
988 reply.writeNoException();
989 ComponentName.writeToParcel(cn, reply);
990 return true;
991 }
992
993 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
994 data.enforceInterface(IActivityManager.descriptor);
995 IBinder token = data.readStrongBinder();
996 reply.writeNoException();
997 reply.writeString(getPackageForToken(token));
998 return true;
999 }
1000
1001 case GET_INTENT_SENDER_TRANSACTION: {
1002 data.enforceInterface(IActivityManager.descriptor);
1003 int type = data.readInt();
1004 String packageName = data.readString();
1005 IBinder token = data.readStrongBinder();
1006 String resultWho = data.readString();
1007 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001008 Intent[] requestIntents;
1009 String[] requestResolvedTypes;
1010 if (data.readInt() != 0) {
1011 requestIntents = data.createTypedArray(Intent.CREATOR);
1012 requestResolvedTypes = data.createStringArray();
1013 } else {
1014 requestIntents = null;
1015 requestResolvedTypes = null;
1016 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001017 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001018 Bundle options = data.readInt() != 0
1019 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001020 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001021 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001022 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001023 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001024 reply.writeNoException();
1025 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1026 return true;
1027 }
1028
1029 case CANCEL_INTENT_SENDER_TRANSACTION: {
1030 data.enforceInterface(IActivityManager.descriptor);
1031 IIntentSender r = IIntentSender.Stub.asInterface(
1032 data.readStrongBinder());
1033 cancelIntentSender(r);
1034 reply.writeNoException();
1035 return true;
1036 }
1037
1038 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1039 data.enforceInterface(IActivityManager.descriptor);
1040 IIntentSender r = IIntentSender.Stub.asInterface(
1041 data.readStrongBinder());
1042 String res = getPackageForIntentSender(r);
1043 reply.writeNoException();
1044 reply.writeString(res);
1045 return true;
1046 }
1047
Christopher Tatec4a07d12012-04-06 14:19:13 -07001048 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1049 data.enforceInterface(IActivityManager.descriptor);
1050 IIntentSender r = IIntentSender.Stub.asInterface(
1051 data.readStrongBinder());
1052 int res = getUidForIntentSender(r);
1053 reply.writeNoException();
1054 reply.writeInt(res);
1055 return true;
1056 }
1057
Dianne Hackborn41203752012-08-31 14:05:51 -07001058 case HANDLE_INCOMING_USER_TRANSACTION: {
1059 data.enforceInterface(IActivityManager.descriptor);
1060 int callingPid = data.readInt();
1061 int callingUid = data.readInt();
1062 int userId = data.readInt();
1063 boolean allowAll = data.readInt() != 0 ;
1064 boolean requireFull = data.readInt() != 0;
1065 String name = data.readString();
1066 String callerPackage = data.readString();
1067 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1068 requireFull, name, callerPackage);
1069 reply.writeNoException();
1070 reply.writeInt(res);
1071 return true;
1072 }
1073
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001074 case SET_PROCESS_LIMIT_TRANSACTION: {
1075 data.enforceInterface(IActivityManager.descriptor);
1076 int max = data.readInt();
1077 setProcessLimit(max);
1078 reply.writeNoException();
1079 return true;
1080 }
1081
1082 case GET_PROCESS_LIMIT_TRANSACTION: {
1083 data.enforceInterface(IActivityManager.descriptor);
1084 int limit = getProcessLimit();
1085 reply.writeNoException();
1086 reply.writeInt(limit);
1087 return true;
1088 }
1089
1090 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1091 data.enforceInterface(IActivityManager.descriptor);
1092 IBinder token = data.readStrongBinder();
1093 int pid = data.readInt();
1094 boolean isForeground = data.readInt() != 0;
1095 setProcessForeground(token, pid, isForeground);
1096 reply.writeNoException();
1097 return true;
1098 }
1099
1100 case CHECK_PERMISSION_TRANSACTION: {
1101 data.enforceInterface(IActivityManager.descriptor);
1102 String perm = data.readString();
1103 int pid = data.readInt();
1104 int uid = data.readInt();
1105 int res = checkPermission(perm, pid, uid);
1106 reply.writeNoException();
1107 reply.writeInt(res);
1108 return true;
1109 }
1110
1111 case CHECK_URI_PERMISSION_TRANSACTION: {
1112 data.enforceInterface(IActivityManager.descriptor);
1113 Uri uri = Uri.CREATOR.createFromParcel(data);
1114 int pid = data.readInt();
1115 int uid = data.readInt();
1116 int mode = data.readInt();
1117 int res = checkUriPermission(uri, pid, uid, mode);
1118 reply.writeNoException();
1119 reply.writeInt(res);
1120 return true;
1121 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001122
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001123 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001124 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001125 String packageName = data.readString();
1126 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1127 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001128 int userId = data.readInt();
1129 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001130 reply.writeNoException();
1131 reply.writeInt(res ? 1 : 0);
1132 return true;
1133 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001134
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001135 case GRANT_URI_PERMISSION_TRANSACTION: {
1136 data.enforceInterface(IActivityManager.descriptor);
1137 IBinder b = data.readStrongBinder();
1138 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1139 String targetPkg = data.readString();
1140 Uri uri = Uri.CREATOR.createFromParcel(data);
1141 int mode = data.readInt();
1142 grantUriPermission(app, targetPkg, uri, mode);
1143 reply.writeNoException();
1144 return true;
1145 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001146
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147 case REVOKE_URI_PERMISSION_TRANSACTION: {
1148 data.enforceInterface(IActivityManager.descriptor);
1149 IBinder b = data.readStrongBinder();
1150 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1151 Uri uri = Uri.CREATOR.createFromParcel(data);
1152 int mode = data.readInt();
1153 revokeUriPermission(app, uri, mode);
1154 reply.writeNoException();
1155 return true;
1156 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001157
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001158 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1159 data.enforceInterface(IActivityManager.descriptor);
1160 Uri uri = Uri.CREATOR.createFromParcel(data);
1161 int mode = data.readInt();
1162 takePersistableUriPermission(uri, mode);
1163 reply.writeNoException();
1164 return true;
1165 }
1166
1167 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1168 data.enforceInterface(IActivityManager.descriptor);
1169 Uri uri = Uri.CREATOR.createFromParcel(data);
1170 int mode = data.readInt();
1171 releasePersistableUriPermission(uri, mode);
1172 reply.writeNoException();
1173 return true;
1174 }
1175
1176 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1177 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001178 final String packageName = data.readString();
1179 final boolean incoming = data.readInt() != 0;
1180 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1181 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001182 reply.writeNoException();
1183 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1184 return true;
1185 }
1186
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001187 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1188 data.enforceInterface(IActivityManager.descriptor);
1189 IBinder b = data.readStrongBinder();
1190 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1191 boolean waiting = data.readInt() != 0;
1192 showWaitingForDebugger(app, waiting);
1193 reply.writeNoException();
1194 return true;
1195 }
1196
1197 case GET_MEMORY_INFO_TRANSACTION: {
1198 data.enforceInterface(IActivityManager.descriptor);
1199 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1200 getMemoryInfo(mi);
1201 reply.writeNoException();
1202 mi.writeToParcel(reply, 0);
1203 return true;
1204 }
1205
1206 case UNHANDLED_BACK_TRANSACTION: {
1207 data.enforceInterface(IActivityManager.descriptor);
1208 unhandledBack();
1209 reply.writeNoException();
1210 return true;
1211 }
1212
1213 case OPEN_CONTENT_URI_TRANSACTION: {
1214 data.enforceInterface(IActivityManager.descriptor);
1215 Uri uri = Uri.parse(data.readString());
1216 ParcelFileDescriptor pfd = openContentUri(uri);
1217 reply.writeNoException();
1218 if (pfd != null) {
1219 reply.writeInt(1);
1220 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1221 } else {
1222 reply.writeInt(0);
1223 }
1224 return true;
1225 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001226
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001227 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1228 data.enforceInterface(IActivityManager.descriptor);
1229 setLockScreenShown(data.readInt() != 0);
1230 reply.writeNoException();
1231 return true;
1232 }
1233
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001234 case SET_DEBUG_APP_TRANSACTION: {
1235 data.enforceInterface(IActivityManager.descriptor);
1236 String pn = data.readString();
1237 boolean wfd = data.readInt() != 0;
1238 boolean per = data.readInt() != 0;
1239 setDebugApp(pn, wfd, per);
1240 reply.writeNoException();
1241 return true;
1242 }
1243
1244 case SET_ALWAYS_FINISH_TRANSACTION: {
1245 data.enforceInterface(IActivityManager.descriptor);
1246 boolean enabled = data.readInt() != 0;
1247 setAlwaysFinish(enabled);
1248 reply.writeNoException();
1249 return true;
1250 }
1251
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001252 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001254 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001255 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001256 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001257 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001258 return true;
1259 }
1260
1261 case ENTER_SAFE_MODE_TRANSACTION: {
1262 data.enforceInterface(IActivityManager.descriptor);
1263 enterSafeMode();
1264 reply.writeNoException();
1265 return true;
1266 }
1267
1268 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1269 data.enforceInterface(IActivityManager.descriptor);
1270 IIntentSender is = IIntentSender.Stub.asInterface(
1271 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001272 int sourceUid = data.readInt();
1273 String sourcePkg = data.readString();
1274 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001275 reply.writeNoException();
1276 return true;
1277 }
1278
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001279 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001280 data.enforceInterface(IActivityManager.descriptor);
1281 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001282 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001283 boolean secure = data.readInt() != 0;
1284 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001285 reply.writeNoException();
1286 reply.writeInt(res ? 1 : 0);
1287 return true;
1288 }
1289
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001290 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1291 data.enforceInterface(IActivityManager.descriptor);
1292 String reason = data.readString();
1293 boolean res = killProcessesBelowForeground(reason);
1294 reply.writeNoException();
1295 reply.writeInt(res ? 1 : 0);
1296 return true;
1297 }
1298
Dan Egnor60d87622009-12-16 16:32:58 -08001299 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1300 data.enforceInterface(IActivityManager.descriptor);
1301 IBinder app = data.readStrongBinder();
1302 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1303 handleApplicationCrash(app, ci);
1304 reply.writeNoException();
1305 return true;
1306 }
1307
1308 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001309 data.enforceInterface(IActivityManager.descriptor);
1310 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001311 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001312 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001313 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001314 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001315 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001316 return true;
1317 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001318
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001319 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1320 data.enforceInterface(IActivityManager.descriptor);
1321 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001322 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001323 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1324 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001325 reply.writeNoException();
1326 return true;
1327 }
1328
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001329 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1330 data.enforceInterface(IActivityManager.descriptor);
1331 int sig = data.readInt();
1332 signalPersistentProcesses(sig);
1333 reply.writeNoException();
1334 return true;
1335 }
1336
Dianne Hackborn03abb812010-01-04 18:43:19 -08001337 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1338 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001339 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001340 int userId = data.readInt();
1341 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001342 reply.writeNoException();
1343 return true;
1344 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001345
1346 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1347 data.enforceInterface(IActivityManager.descriptor);
1348 killAllBackgroundProcesses();
1349 reply.writeNoException();
1350 return true;
1351 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001352
Dianne Hackborn03abb812010-01-04 18:43:19 -08001353 case FORCE_STOP_PACKAGE_TRANSACTION: {
1354 data.enforceInterface(IActivityManager.descriptor);
1355 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001356 int userId = data.readInt();
1357 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001358 reply.writeNoException();
1359 return true;
1360 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001361
1362 case GET_MY_MEMORY_STATE_TRANSACTION: {
1363 data.enforceInterface(IActivityManager.descriptor);
1364 ActivityManager.RunningAppProcessInfo info =
1365 new ActivityManager.RunningAppProcessInfo();
1366 getMyMemoryState(info);
1367 reply.writeNoException();
1368 info.writeToParcel(reply, 0);
1369 return true;
1370 }
1371
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001372 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
1374 ConfigurationInfo config = getDeviceConfigurationInfo();
1375 reply.writeNoException();
1376 config.writeToParcel(reply, 0);
1377 return true;
1378 }
1379
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001380 case PROFILE_CONTROL_TRANSACTION: {
1381 data.enforceInterface(IActivityManager.descriptor);
1382 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001383 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001384 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001385 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001386 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001387 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001388 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001389 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001390 reply.writeNoException();
1391 reply.writeInt(res ? 1 : 0);
1392 return true;
1393 }
1394
Dianne Hackborn55280a92009-05-07 15:53:46 -07001395 case SHUTDOWN_TRANSACTION: {
1396 data.enforceInterface(IActivityManager.descriptor);
1397 boolean res = shutdown(data.readInt());
1398 reply.writeNoException();
1399 reply.writeInt(res ? 1 : 0);
1400 return true;
1401 }
1402
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001403 case STOP_APP_SWITCHES_TRANSACTION: {
1404 data.enforceInterface(IActivityManager.descriptor);
1405 stopAppSwitches();
1406 reply.writeNoException();
1407 return true;
1408 }
1409
1410 case RESUME_APP_SWITCHES_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 resumeAppSwitches();
1413 reply.writeNoException();
1414 return true;
1415 }
1416
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001417 case PEEK_SERVICE_TRANSACTION: {
1418 data.enforceInterface(IActivityManager.descriptor);
1419 Intent service = Intent.CREATOR.createFromParcel(data);
1420 String resolvedType = data.readString();
1421 IBinder binder = peekService(service, resolvedType);
1422 reply.writeNoException();
1423 reply.writeStrongBinder(binder);
1424 return true;
1425 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001426
1427 case START_BACKUP_AGENT_TRANSACTION: {
1428 data.enforceInterface(IActivityManager.descriptor);
1429 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1430 int backupRestoreMode = data.readInt();
1431 boolean success = bindBackupAgent(info, backupRestoreMode);
1432 reply.writeNoException();
1433 reply.writeInt(success ? 1 : 0);
1434 return true;
1435 }
1436
1437 case BACKUP_AGENT_CREATED_TRANSACTION: {
1438 data.enforceInterface(IActivityManager.descriptor);
1439 String packageName = data.readString();
1440 IBinder agent = data.readStrongBinder();
1441 backupAgentCreated(packageName, agent);
1442 reply.writeNoException();
1443 return true;
1444 }
1445
1446 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
1448 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1449 unbindBackupAgent(info);
1450 reply.writeNoException();
1451 return true;
1452 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001453
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001454 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001455 data.enforceInterface(IActivityManager.descriptor);
1456 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001457 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001458 String reason = data.readString();
1459 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001460 reply.writeNoException();
1461 return true;
1462 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001463
1464 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1465 data.enforceInterface(IActivityManager.descriptor);
1466 String reason = data.readString();
1467 closeSystemDialogs(reason);
1468 reply.writeNoException();
1469 return true;
1470 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001471
1472 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1473 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001474 int[] pids = data.createIntArray();
1475 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001476 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001477 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001478 return true;
1479 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001480
1481 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1482 data.enforceInterface(IActivityManager.descriptor);
1483 String processName = data.readString();
1484 int uid = data.readInt();
1485 killApplicationProcess(processName, uid);
1486 reply.writeNoException();
1487 return true;
1488 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001489
1490 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1491 data.enforceInterface(IActivityManager.descriptor);
1492 IBinder token = data.readStrongBinder();
1493 String packageName = data.readString();
1494 int enterAnim = data.readInt();
1495 int exitAnim = data.readInt();
1496 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001497 reply.writeNoException();
1498 return true;
1499 }
1500
1501 case IS_USER_A_MONKEY_TRANSACTION: {
1502 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001503 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001504 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001505 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001506 return true;
1507 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001508
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001509 case SET_USER_IS_MONKEY_TRANSACTION: {
1510 data.enforceInterface(IActivityManager.descriptor);
1511 final boolean monkey = (data.readInt() == 1);
1512 setUserIsMonkey(monkey);
1513 reply.writeNoException();
1514 return true;
1515 }
1516
Dianne Hackborn860755f2010-06-03 18:47:52 -07001517 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1518 data.enforceInterface(IActivityManager.descriptor);
1519 finishHeavyWeightApp();
1520 reply.writeNoException();
1521 return true;
1522 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001523
1524 case IS_IMMERSIVE_TRANSACTION: {
1525 data.enforceInterface(IActivityManager.descriptor);
1526 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001527 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001528 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001529 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001530 return true;
1531 }
1532
Craig Mautner5eda9b32013-07-02 11:58:16 -07001533 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001534 data.enforceInterface(IActivityManager.descriptor);
1535 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001536 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001537 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001538 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001539 return true;
1540 }
1541
1542 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1543 data.enforceInterface(IActivityManager.descriptor);
1544 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001545 boolean converted = convertToTranslucent(token);
Craig Mautner4addfc52013-06-25 08:05:45 -07001546 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001547 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001548 return true;
1549 }
1550
Daniel Sandler69a48172010-06-23 16:29:36 -04001551 case SET_IMMERSIVE_TRANSACTION: {
1552 data.enforceInterface(IActivityManager.descriptor);
1553 IBinder token = data.readStrongBinder();
1554 boolean imm = data.readInt() == 1;
1555 setImmersive(token, imm);
1556 reply.writeNoException();
1557 return true;
1558 }
1559
1560 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1561 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001562 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001563 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001564 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001565 return true;
1566 }
1567
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001568 case CRASH_APPLICATION_TRANSACTION: {
1569 data.enforceInterface(IActivityManager.descriptor);
1570 int uid = data.readInt();
1571 int initialPid = data.readInt();
1572 String packageName = data.readString();
1573 String message = data.readString();
1574 crashApplication(uid, initialPid, packageName, message);
1575 reply.writeNoException();
1576 return true;
1577 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001578
1579 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1580 data.enforceInterface(IActivityManager.descriptor);
1581 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001582 int userId = data.readInt();
1583 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001584 reply.writeNoException();
1585 reply.writeString(type);
1586 return true;
1587 }
1588
Dianne Hackborn7e269642010-08-25 19:50:20 -07001589 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1590 data.enforceInterface(IActivityManager.descriptor);
1591 String name = data.readString();
1592 IBinder perm = newUriPermissionOwner(name);
1593 reply.writeNoException();
1594 reply.writeStrongBinder(perm);
1595 return true;
1596 }
1597
1598 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1599 data.enforceInterface(IActivityManager.descriptor);
1600 IBinder owner = data.readStrongBinder();
1601 int fromUid = data.readInt();
1602 String targetPkg = data.readString();
1603 Uri uri = Uri.CREATOR.createFromParcel(data);
1604 int mode = data.readInt();
1605 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1606 reply.writeNoException();
1607 return true;
1608 }
1609
1610 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1611 data.enforceInterface(IActivityManager.descriptor);
1612 IBinder owner = data.readStrongBinder();
1613 Uri uri = null;
1614 if (data.readInt() != 0) {
1615 Uri.CREATOR.createFromParcel(data);
1616 }
1617 int mode = data.readInt();
1618 revokeUriPermissionFromOwner(owner, uri, mode);
1619 reply.writeNoException();
1620 return true;
1621 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001622
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001623 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1624 data.enforceInterface(IActivityManager.descriptor);
1625 int callingUid = data.readInt();
1626 String targetPkg = data.readString();
1627 Uri uri = Uri.CREATOR.createFromParcel(data);
1628 int modeFlags = data.readInt();
1629 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1630 reply.writeNoException();
1631 reply.writeInt(res);
1632 return true;
1633 }
1634
Andy McFadden824c5102010-07-09 16:26:57 -07001635 case DUMP_HEAP_TRANSACTION: {
1636 data.enforceInterface(IActivityManager.descriptor);
1637 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001638 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001639 boolean managed = data.readInt() != 0;
1640 String path = data.readString();
1641 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001642 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001643 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001644 reply.writeNoException();
1645 reply.writeInt(res ? 1 : 0);
1646 return true;
1647 }
1648
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001649 case START_ACTIVITIES_TRANSACTION:
1650 {
1651 data.enforceInterface(IActivityManager.descriptor);
1652 IBinder b = data.readStrongBinder();
1653 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001654 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001655 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1656 String[] resolvedTypes = data.createStringArray();
1657 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001658 Bundle options = data.readInt() != 0
1659 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001660 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001661 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001662 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001663 reply.writeNoException();
1664 reply.writeInt(result);
1665 return true;
1666 }
1667
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001668 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1669 {
1670 data.enforceInterface(IActivityManager.descriptor);
1671 int mode = getFrontActivityScreenCompatMode();
1672 reply.writeNoException();
1673 reply.writeInt(mode);
1674 return true;
1675 }
1676
1677 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1678 {
1679 data.enforceInterface(IActivityManager.descriptor);
1680 int mode = data.readInt();
1681 setFrontActivityScreenCompatMode(mode);
1682 reply.writeNoException();
1683 reply.writeInt(mode);
1684 return true;
1685 }
1686
1687 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1688 {
1689 data.enforceInterface(IActivityManager.descriptor);
1690 String pkg = data.readString();
1691 int mode = getPackageScreenCompatMode(pkg);
1692 reply.writeNoException();
1693 reply.writeInt(mode);
1694 return true;
1695 }
1696
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001697 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1698 {
1699 data.enforceInterface(IActivityManager.descriptor);
1700 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001701 int mode = data.readInt();
1702 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001703 reply.writeNoException();
1704 return true;
1705 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001706
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001707 case SWITCH_USER_TRANSACTION: {
1708 data.enforceInterface(IActivityManager.descriptor);
1709 int userid = data.readInt();
1710 boolean result = switchUser(userid);
1711 reply.writeNoException();
1712 reply.writeInt(result ? 1 : 0);
1713 return true;
1714 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001715
Kenny Guy08488bf2014-02-21 17:40:37 +00001716 case START_USER_IN_BACKGROUND_TRANSACTION: {
1717 data.enforceInterface(IActivityManager.descriptor);
1718 int userid = data.readInt();
1719 boolean result = startUserInBackground(userid);
1720 reply.writeNoException();
1721 reply.writeInt(result ? 1 : 0);
1722 return true;
1723 }
1724
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001725 case STOP_USER_TRANSACTION: {
1726 data.enforceInterface(IActivityManager.descriptor);
1727 int userid = data.readInt();
1728 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1729 data.readStrongBinder());
1730 int result = stopUser(userid, callback);
1731 reply.writeNoException();
1732 reply.writeInt(result);
1733 return true;
1734 }
1735
Amith Yamasani52f1d752012-03-28 18:19:29 -07001736 case GET_CURRENT_USER_TRANSACTION: {
1737 data.enforceInterface(IActivityManager.descriptor);
1738 UserInfo userInfo = getCurrentUser();
1739 reply.writeNoException();
1740 userInfo.writeToParcel(reply, 0);
1741 return true;
1742 }
1743
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001744 case IS_USER_RUNNING_TRANSACTION: {
1745 data.enforceInterface(IActivityManager.descriptor);
1746 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001747 boolean orStopping = data.readInt() != 0;
1748 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001749 reply.writeNoException();
1750 reply.writeInt(result ? 1 : 0);
1751 return true;
1752 }
1753
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001754 case GET_RUNNING_USER_IDS_TRANSACTION: {
1755 data.enforceInterface(IActivityManager.descriptor);
1756 int[] result = getRunningUserIds();
1757 reply.writeNoException();
1758 reply.writeIntArray(result);
1759 return true;
1760 }
1761
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001762 case REMOVE_SUB_TASK_TRANSACTION:
1763 {
1764 data.enforceInterface(IActivityManager.descriptor);
1765 int taskId = data.readInt();
1766 int subTaskIndex = data.readInt();
1767 boolean result = removeSubTask(taskId, subTaskIndex);
1768 reply.writeNoException();
1769 reply.writeInt(result ? 1 : 0);
1770 return true;
1771 }
1772
1773 case REMOVE_TASK_TRANSACTION:
1774 {
1775 data.enforceInterface(IActivityManager.descriptor);
1776 int taskId = data.readInt();
1777 int fl = data.readInt();
1778 boolean result = removeTask(taskId, fl);
1779 reply.writeNoException();
1780 reply.writeInt(result ? 1 : 0);
1781 return true;
1782 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001783
Jeff Sharkeya4620792011-05-20 15:29:23 -07001784 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1785 data.enforceInterface(IActivityManager.descriptor);
1786 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1787 data.readStrongBinder());
1788 registerProcessObserver(observer);
1789 return true;
1790 }
1791
1792 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1793 data.enforceInterface(IActivityManager.descriptor);
1794 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1795 data.readStrongBinder());
1796 unregisterProcessObserver(observer);
1797 return true;
1798 }
1799
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001800 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1801 {
1802 data.enforceInterface(IActivityManager.descriptor);
1803 String pkg = data.readString();
1804 boolean ask = getPackageAskScreenCompat(pkg);
1805 reply.writeNoException();
1806 reply.writeInt(ask ? 1 : 0);
1807 return true;
1808 }
1809
1810 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1811 {
1812 data.enforceInterface(IActivityManager.descriptor);
1813 String pkg = data.readString();
1814 boolean ask = data.readInt() != 0;
1815 setPackageAskScreenCompat(pkg, ask);
1816 reply.writeNoException();
1817 return true;
1818 }
1819
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001820 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 IIntentSender r = IIntentSender.Stub.asInterface(
1823 data.readStrongBinder());
1824 boolean res = isIntentSenderTargetedToPackage(r);
1825 reply.writeNoException();
1826 reply.writeInt(res ? 1 : 0);
1827 return true;
1828 }
1829
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001830 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1831 data.enforceInterface(IActivityManager.descriptor);
1832 IIntentSender r = IIntentSender.Stub.asInterface(
1833 data.readStrongBinder());
1834 boolean res = isIntentSenderAnActivity(r);
1835 reply.writeNoException();
1836 reply.writeInt(res ? 1 : 0);
1837 return true;
1838 }
1839
Dianne Hackborn81038902012-11-26 17:04:09 -08001840 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1841 data.enforceInterface(IActivityManager.descriptor);
1842 IIntentSender r = IIntentSender.Stub.asInterface(
1843 data.readStrongBinder());
1844 Intent intent = getIntentForIntentSender(r);
1845 reply.writeNoException();
1846 if (intent != null) {
1847 reply.writeInt(1);
1848 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1849 } else {
1850 reply.writeInt(0);
1851 }
1852 return true;
1853 }
1854
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001855 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1856 data.enforceInterface(IActivityManager.descriptor);
1857 IIntentSender r = IIntentSender.Stub.asInterface(
1858 data.readStrongBinder());
1859 String prefix = data.readString();
1860 String tag = getTagForIntentSender(r, prefix);
1861 reply.writeNoException();
1862 reply.writeString(tag);
1863 return true;
1864 }
1865
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001866 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1867 data.enforceInterface(IActivityManager.descriptor);
1868 Configuration config = Configuration.CREATOR.createFromParcel(data);
1869 updatePersistentConfiguration(config);
1870 reply.writeNoException();
1871 return true;
1872 }
1873
Dianne Hackbornb437e092011-08-05 17:50:29 -07001874 case GET_PROCESS_PSS_TRANSACTION: {
1875 data.enforceInterface(IActivityManager.descriptor);
1876 int[] pids = data.createIntArray();
1877 long[] pss = getProcessPss(pids);
1878 reply.writeNoException();
1879 reply.writeLongArray(pss);
1880 return true;
1881 }
1882
Dianne Hackborn661cd522011-08-22 00:26:20 -07001883 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1884 data.enforceInterface(IActivityManager.descriptor);
1885 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1886 boolean always = data.readInt() != 0;
1887 showBootMessage(msg, always);
1888 reply.writeNoException();
1889 return true;
1890 }
1891
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001892 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1893 data.enforceInterface(IActivityManager.descriptor);
1894 dismissKeyguardOnNextActivity();
1895 reply.writeNoException();
1896 return true;
1897 }
1898
Adam Powelldd8fab22012-03-22 17:47:27 -07001899 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1900 data.enforceInterface(IActivityManager.descriptor);
1901 IBinder token = data.readStrongBinder();
1902 String destAffinity = data.readString();
1903 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1904 reply.writeNoException();
1905 reply.writeInt(res ? 1 : 0);
1906 return true;
1907 }
1908
1909 case NAVIGATE_UP_TO_TRANSACTION: {
1910 data.enforceInterface(IActivityManager.descriptor);
1911 IBinder token = data.readStrongBinder();
1912 Intent target = Intent.CREATOR.createFromParcel(data);
1913 int resultCode = data.readInt();
1914 Intent resultData = null;
1915 if (data.readInt() != 0) {
1916 resultData = Intent.CREATOR.createFromParcel(data);
1917 }
1918 boolean res = navigateUpTo(token, target, resultCode, resultData);
1919 reply.writeNoException();
1920 reply.writeInt(res ? 1 : 0);
1921 return true;
1922 }
1923
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001924 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1925 data.enforceInterface(IActivityManager.descriptor);
1926 IBinder token = data.readStrongBinder();
1927 int res = getLaunchedFromUid(token);
1928 reply.writeNoException();
1929 reply.writeInt(res);
1930 return true;
1931 }
1932
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001933 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1934 data.enforceInterface(IActivityManager.descriptor);
1935 IBinder token = data.readStrongBinder();
1936 String res = getLaunchedFromPackage(token);
1937 reply.writeNoException();
1938 reply.writeString(res);
1939 return true;
1940 }
1941
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001942 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1943 data.enforceInterface(IActivityManager.descriptor);
1944 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1945 data.readStrongBinder());
1946 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001947 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001948 return true;
1949 }
1950
1951 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1952 data.enforceInterface(IActivityManager.descriptor);
1953 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1954 data.readStrongBinder());
1955 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001956 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001957 return true;
1958 }
1959
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001960 case REQUEST_BUG_REPORT_TRANSACTION: {
1961 data.enforceInterface(IActivityManager.descriptor);
1962 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001963 reply.writeNoException();
1964 return true;
1965 }
1966
1967 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1968 data.enforceInterface(IActivityManager.descriptor);
1969 int pid = data.readInt();
1970 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07001971 String reason = data.readString();
1972 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001973 reply.writeNoException();
1974 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001975 return true;
1976 }
1977
Adam Skorydfc7fd72013-08-05 19:23:41 -07001978 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001979 data.enforceInterface(IActivityManager.descriptor);
1980 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07001981 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001982 reply.writeNoException();
1983 reply.writeBundle(res);
1984 return true;
1985 }
1986
Adam Skorydfc7fd72013-08-05 19:23:41 -07001987 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001988 data.enforceInterface(IActivityManager.descriptor);
1989 IBinder token = data.readStrongBinder();
1990 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01001991 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001992 reply.writeNoException();
1993 return true;
1994 }
1995
Dianne Hackbornf1b78242013-04-08 22:28:59 -07001996 case KILL_UID_TRANSACTION: {
1997 data.enforceInterface(IActivityManager.descriptor);
1998 int uid = data.readInt();
1999 String reason = data.readString();
2000 killUid(uid, reason);
2001 reply.writeNoException();
2002 return true;
2003 }
2004
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002005 case HANG_TRANSACTION: {
2006 data.enforceInterface(IActivityManager.descriptor);
2007 IBinder who = data.readStrongBinder();
2008 boolean allowRestart = data.readInt() != 0;
2009 hang(who, allowRestart);
2010 reply.writeNoException();
2011 return true;
2012 }
2013
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002014 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2015 data.enforceInterface(IActivityManager.descriptor);
2016 IBinder token = data.readStrongBinder();
2017 reportActivityFullyDrawn(token);
2018 reply.writeNoException();
2019 return true;
2020 }
2021
Craig Mautner5eda9b32013-07-02 11:58:16 -07002022 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2023 data.enforceInterface(IActivityManager.descriptor);
2024 IBinder token = data.readStrongBinder();
2025 notifyActivityDrawn(token);
2026 reply.writeNoException();
2027 return true;
2028 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002029
2030 case RESTART_TRANSACTION: {
2031 data.enforceInterface(IActivityManager.descriptor);
2032 restart();
2033 reply.writeNoException();
2034 return true;
2035 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002036
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002037 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2038 data.enforceInterface(IActivityManager.descriptor);
2039 performIdleMaintenance();
2040 reply.writeNoException();
2041 return true;
2042 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002043
2044 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2045 data.enforceInterface(IActivityManager.descriptor);
2046 IBinder parentActivityToken = data.readStrongBinder();
2047 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002048 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002049 IActivityContainer activityContainer =
2050 createActivityContainer(parentActivityToken, callback);
2051 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002052 if (activityContainer != null) {
2053 reply.writeInt(1);
2054 reply.writeStrongBinder(activityContainer.asBinder());
2055 } else {
2056 reply.writeInt(0);
2057 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002058 return true;
2059 }
2060
Craig Mautner95da1082014-02-24 17:54:35 -08002061 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2062 data.enforceInterface(IActivityManager.descriptor);
2063 IActivityContainer activityContainer =
2064 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2065 deleteActivityContainer(activityContainer);
2066 reply.writeNoException();
2067 return true;
2068 }
2069
Craig Mautnere0a38842013-12-16 16:14:02 -08002070 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2071 data.enforceInterface(IActivityManager.descriptor);
2072 IBinder activityToken = data.readStrongBinder();
2073 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2074 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002075 if (activityContainer != null) {
2076 reply.writeInt(1);
2077 reply.writeStrongBinder(activityContainer.asBinder());
2078 } else {
2079 reply.writeInt(0);
2080 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002081 return true;
2082 }
2083
Craig Mautner4a1cb222013-12-04 16:14:06 -08002084 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2085 data.enforceInterface(IActivityManager.descriptor);
2086 IBinder homeActivityToken = getHomeActivityToken();
2087 reply.writeNoException();
2088 reply.writeStrongBinder(homeActivityToken);
2089 return true;
2090 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002091
2092 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2093 data.enforceInterface(IActivityManager.descriptor);
2094 final int taskId = data.readInt();
2095 startLockTaskMode(taskId);
2096 reply.writeNoException();
2097 return true;
2098 }
2099
2100 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2101 data.enforceInterface(IActivityManager.descriptor);
2102 IBinder token = data.readStrongBinder();
2103 startLockTaskMode(token);
2104 reply.writeNoException();
2105 return true;
2106 }
2107
2108 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2109 data.enforceInterface(IActivityManager.descriptor);
2110 stopLockTaskMode();
2111 reply.writeNoException();
2112 return true;
2113 }
2114
2115 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2116 data.enforceInterface(IActivityManager.descriptor);
2117 final boolean isInLockTaskMode = isInLockTaskMode();
2118 reply.writeNoException();
2119 reply.writeInt(isInLockTaskMode ? 1 : 0);
2120 return true;
2121 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002122
Winson Chung03a9bae2014-05-02 09:56:12 -07002123 case SET_RECENTS_ACTIVITY_VALUES_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002124 data.enforceInterface(IActivityManager.descriptor);
2125 IBinder token = data.readStrongBinder();
Winson Chung03a9bae2014-05-02 09:56:12 -07002126 ActivityManager.RecentsActivityValues values =
2127 ActivityManager.RecentsActivityValues.CREATOR.createFromParcel(data);
2128 setRecentsActivityValues(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002129 reply.writeNoException();
2130 return true;
2131 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002132 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002133
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002134 return super.onTransact(code, data, reply, flags);
2135 }
2136
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002137 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002138 return this;
2139 }
2140
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002141 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2142 protected IActivityManager create() {
2143 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002144 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002145 Log.v("ActivityManager", "default service binder = " + b);
2146 }
2147 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002148 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002149 Log.v("ActivityManager", "default service = " + am);
2150 }
2151 return am;
2152 }
2153 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002154}
2155
2156class ActivityManagerProxy implements IActivityManager
2157{
2158 public ActivityManagerProxy(IBinder remote)
2159 {
2160 mRemote = remote;
2161 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002162
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002163 public IBinder asBinder()
2164 {
2165 return mRemote;
2166 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002167
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002168 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002169 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2170 int startFlags, String profileFile,
2171 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002172 Parcel data = Parcel.obtain();
2173 Parcel reply = Parcel.obtain();
2174 data.writeInterfaceToken(IActivityManager.descriptor);
2175 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002176 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002177 intent.writeToParcel(data, 0);
2178 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002179 data.writeStrongBinder(resultTo);
2180 data.writeString(resultWho);
2181 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002182 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002183 data.writeString(profileFile);
2184 if (profileFd != null) {
2185 data.writeInt(1);
2186 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2187 } else {
2188 data.writeInt(0);
2189 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002190 if (options != null) {
2191 data.writeInt(1);
2192 options.writeToParcel(data, 0);
2193 } else {
2194 data.writeInt(0);
2195 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002196 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2197 reply.readException();
2198 int result = reply.readInt();
2199 reply.recycle();
2200 data.recycle();
2201 return result;
2202 }
Amith Yamasani82644082012-08-03 13:09:11 -07002203
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002204 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002205 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2206 int startFlags, String profileFile,
2207 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2208 Parcel data = Parcel.obtain();
2209 Parcel reply = Parcel.obtain();
2210 data.writeInterfaceToken(IActivityManager.descriptor);
2211 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002212 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002213 intent.writeToParcel(data, 0);
2214 data.writeString(resolvedType);
2215 data.writeStrongBinder(resultTo);
2216 data.writeString(resultWho);
2217 data.writeInt(requestCode);
2218 data.writeInt(startFlags);
2219 data.writeString(profileFile);
2220 if (profileFd != null) {
2221 data.writeInt(1);
2222 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2223 } else {
2224 data.writeInt(0);
2225 }
2226 if (options != null) {
2227 data.writeInt(1);
2228 options.writeToParcel(data, 0);
2229 } else {
2230 data.writeInt(0);
2231 }
2232 data.writeInt(userId);
2233 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2234 reply.readException();
2235 int result = reply.readInt();
2236 reply.recycle();
2237 data.recycle();
2238 return result;
2239 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002240 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2241 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002242 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002243 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002244 Parcel data = Parcel.obtain();
2245 Parcel reply = Parcel.obtain();
2246 data.writeInterfaceToken(IActivityManager.descriptor);
2247 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002248 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002249 intent.writeToParcel(data, 0);
2250 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002251 data.writeStrongBinder(resultTo);
2252 data.writeString(resultWho);
2253 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002254 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002255 data.writeString(profileFile);
2256 if (profileFd != null) {
2257 data.writeInt(1);
2258 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2259 } else {
2260 data.writeInt(0);
2261 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002262 if (options != null) {
2263 data.writeInt(1);
2264 options.writeToParcel(data, 0);
2265 } else {
2266 data.writeInt(0);
2267 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002268 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002269 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2270 reply.readException();
2271 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2272 reply.recycle();
2273 data.recycle();
2274 return result;
2275 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002276 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2277 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002278 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002279 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002280 Parcel data = Parcel.obtain();
2281 Parcel reply = Parcel.obtain();
2282 data.writeInterfaceToken(IActivityManager.descriptor);
2283 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002284 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002285 intent.writeToParcel(data, 0);
2286 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002287 data.writeStrongBinder(resultTo);
2288 data.writeString(resultWho);
2289 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002290 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002291 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002292 if (options != null) {
2293 data.writeInt(1);
2294 options.writeToParcel(data, 0);
2295 } else {
2296 data.writeInt(0);
2297 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002298 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002299 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2300 reply.readException();
2301 int result = reply.readInt();
2302 reply.recycle();
2303 data.recycle();
2304 return result;
2305 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002306 public int startActivityIntentSender(IApplicationThread caller,
2307 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002308 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002309 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002310 Parcel data = Parcel.obtain();
2311 Parcel reply = Parcel.obtain();
2312 data.writeInterfaceToken(IActivityManager.descriptor);
2313 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2314 intent.writeToParcel(data, 0);
2315 if (fillInIntent != null) {
2316 data.writeInt(1);
2317 fillInIntent.writeToParcel(data, 0);
2318 } else {
2319 data.writeInt(0);
2320 }
2321 data.writeString(resolvedType);
2322 data.writeStrongBinder(resultTo);
2323 data.writeString(resultWho);
2324 data.writeInt(requestCode);
2325 data.writeInt(flagsMask);
2326 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002327 if (options != null) {
2328 data.writeInt(1);
2329 options.writeToParcel(data, 0);
2330 } else {
2331 data.writeInt(0);
2332 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002333 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002334 reply.readException();
2335 int result = reply.readInt();
2336 reply.recycle();
2337 data.recycle();
2338 return result;
2339 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002340 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2341 Intent intent, String resolvedType, IVoiceInteractionSession session,
2342 IVoiceInteractor interactor, int startFlags, String profileFile,
2343 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2344 Parcel data = Parcel.obtain();
2345 Parcel reply = Parcel.obtain();
2346 data.writeInterfaceToken(IActivityManager.descriptor);
2347 data.writeString(callingPackage);
2348 data.writeInt(callingPid);
2349 data.writeInt(callingUid);
2350 intent.writeToParcel(data, 0);
2351 data.writeString(resolvedType);
2352 data.writeStrongBinder(session.asBinder());
2353 data.writeStrongBinder(interactor.asBinder());
2354 data.writeInt(startFlags);
2355 data.writeString(profileFile);
2356 if (profileFd != null) {
2357 data.writeInt(1);
2358 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2359 } else {
2360 data.writeInt(0);
2361 }
2362 if (options != null) {
2363 data.writeInt(1);
2364 options.writeToParcel(data, 0);
2365 } else {
2366 data.writeInt(0);
2367 }
2368 data.writeInt(userId);
2369 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2370 reply.readException();
2371 int result = reply.readInt();
2372 reply.recycle();
2373 data.recycle();
2374 return result;
2375 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002376 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002377 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002378 Parcel data = Parcel.obtain();
2379 Parcel reply = Parcel.obtain();
2380 data.writeInterfaceToken(IActivityManager.descriptor);
2381 data.writeStrongBinder(callingActivity);
2382 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002383 if (options != null) {
2384 data.writeInt(1);
2385 options.writeToParcel(data, 0);
2386 } else {
2387 data.writeInt(0);
2388 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002389 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2390 reply.readException();
2391 int result = reply.readInt();
2392 reply.recycle();
2393 data.recycle();
2394 return result != 0;
2395 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002396 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002397 throws RemoteException {
2398 Parcel data = Parcel.obtain();
2399 Parcel reply = Parcel.obtain();
2400 data.writeInterfaceToken(IActivityManager.descriptor);
2401 data.writeStrongBinder(token);
2402 data.writeInt(resultCode);
2403 if (resultData != null) {
2404 data.writeInt(1);
2405 resultData.writeToParcel(data, 0);
2406 } else {
2407 data.writeInt(0);
2408 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002409 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002410 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2411 reply.readException();
2412 boolean res = reply.readInt() != 0;
2413 data.recycle();
2414 reply.recycle();
2415 return res;
2416 }
2417 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2418 {
2419 Parcel data = Parcel.obtain();
2420 Parcel reply = Parcel.obtain();
2421 data.writeInterfaceToken(IActivityManager.descriptor);
2422 data.writeStrongBinder(token);
2423 data.writeString(resultWho);
2424 data.writeInt(requestCode);
2425 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2426 reply.readException();
2427 data.recycle();
2428 reply.recycle();
2429 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002430 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2431 Parcel data = Parcel.obtain();
2432 Parcel reply = Parcel.obtain();
2433 data.writeInterfaceToken(IActivityManager.descriptor);
2434 data.writeStrongBinder(token);
2435 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2436 reply.readException();
2437 boolean res = reply.readInt() != 0;
2438 data.recycle();
2439 reply.recycle();
2440 return res;
2441 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002442 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2443 Parcel data = Parcel.obtain();
2444 Parcel reply = Parcel.obtain();
2445 data.writeInterfaceToken(IActivityManager.descriptor);
2446 data.writeStrongBinder(token);
2447 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2448 reply.readException();
2449 boolean res = reply.readInt() != 0;
2450 data.recycle();
2451 reply.recycle();
2452 return res;
2453 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002454 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002455 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002456 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002457 {
2458 Parcel data = Parcel.obtain();
2459 Parcel reply = Parcel.obtain();
2460 data.writeInterfaceToken(IActivityManager.descriptor);
2461 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002462 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002463 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2464 filter.writeToParcel(data, 0);
2465 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002466 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002467 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2468 reply.readException();
2469 Intent intent = null;
2470 int haveIntent = reply.readInt();
2471 if (haveIntent != 0) {
2472 intent = Intent.CREATOR.createFromParcel(reply);
2473 }
2474 reply.recycle();
2475 data.recycle();
2476 return intent;
2477 }
2478 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2479 {
2480 Parcel data = Parcel.obtain();
2481 Parcel reply = Parcel.obtain();
2482 data.writeInterfaceToken(IActivityManager.descriptor);
2483 data.writeStrongBinder(receiver.asBinder());
2484 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2485 reply.readException();
2486 data.recycle();
2487 reply.recycle();
2488 }
2489 public int broadcastIntent(IApplicationThread caller,
2490 Intent intent, String resolvedType, IIntentReceiver resultTo,
2491 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002492 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002493 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002494 {
2495 Parcel data = Parcel.obtain();
2496 Parcel reply = Parcel.obtain();
2497 data.writeInterfaceToken(IActivityManager.descriptor);
2498 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2499 intent.writeToParcel(data, 0);
2500 data.writeString(resolvedType);
2501 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2502 data.writeInt(resultCode);
2503 data.writeString(resultData);
2504 data.writeBundle(map);
2505 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002506 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002507 data.writeInt(serialized ? 1 : 0);
2508 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002509 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002510 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2511 reply.readException();
2512 int res = reply.readInt();
2513 reply.recycle();
2514 data.recycle();
2515 return res;
2516 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002517 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2518 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002519 {
2520 Parcel data = Parcel.obtain();
2521 Parcel reply = Parcel.obtain();
2522 data.writeInterfaceToken(IActivityManager.descriptor);
2523 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2524 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002525 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002526 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2527 reply.readException();
2528 data.recycle();
2529 reply.recycle();
2530 }
2531 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2532 {
2533 Parcel data = Parcel.obtain();
2534 Parcel reply = Parcel.obtain();
2535 data.writeInterfaceToken(IActivityManager.descriptor);
2536 data.writeStrongBinder(who);
2537 data.writeInt(resultCode);
2538 data.writeString(resultData);
2539 data.writeBundle(map);
2540 data.writeInt(abortBroadcast ? 1 : 0);
2541 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2542 reply.readException();
2543 data.recycle();
2544 reply.recycle();
2545 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002546 public void attachApplication(IApplicationThread app) throws RemoteException
2547 {
2548 Parcel data = Parcel.obtain();
2549 Parcel reply = Parcel.obtain();
2550 data.writeInterfaceToken(IActivityManager.descriptor);
2551 data.writeStrongBinder(app.asBinder());
2552 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2553 reply.readException();
2554 data.recycle();
2555 reply.recycle();
2556 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002557 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2558 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002559 {
2560 Parcel data = Parcel.obtain();
2561 Parcel reply = Parcel.obtain();
2562 data.writeInterfaceToken(IActivityManager.descriptor);
2563 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002564 if (config != null) {
2565 data.writeInt(1);
2566 config.writeToParcel(data, 0);
2567 } else {
2568 data.writeInt(0);
2569 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002570 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002571 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2572 reply.readException();
2573 data.recycle();
2574 reply.recycle();
2575 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002576 public void activityResumed(IBinder token) throws RemoteException
2577 {
2578 Parcel data = Parcel.obtain();
2579 Parcel reply = Parcel.obtain();
2580 data.writeInterfaceToken(IActivityManager.descriptor);
2581 data.writeStrongBinder(token);
2582 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2583 reply.readException();
2584 data.recycle();
2585 reply.recycle();
2586 }
Craig Mautnera0026042014-04-23 11:45:37 -07002587 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002588 {
2589 Parcel data = Parcel.obtain();
2590 Parcel reply = Parcel.obtain();
2591 data.writeInterfaceToken(IActivityManager.descriptor);
2592 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002593 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002594 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2595 reply.readException();
2596 data.recycle();
2597 reply.recycle();
2598 }
2599 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002600 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002601 {
2602 Parcel data = Parcel.obtain();
2603 Parcel reply = Parcel.obtain();
2604 data.writeInterfaceToken(IActivityManager.descriptor);
2605 data.writeStrongBinder(token);
2606 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002607 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002608 TextUtils.writeToParcel(description, data, 0);
2609 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2610 reply.readException();
2611 data.recycle();
2612 reply.recycle();
2613 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002614 public void activitySlept(IBinder token) throws RemoteException
2615 {
2616 Parcel data = Parcel.obtain();
2617 Parcel reply = Parcel.obtain();
2618 data.writeInterfaceToken(IActivityManager.descriptor);
2619 data.writeStrongBinder(token);
2620 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2621 reply.readException();
2622 data.recycle();
2623 reply.recycle();
2624 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002625 public void activityDestroyed(IBinder token) throws RemoteException
2626 {
2627 Parcel data = Parcel.obtain();
2628 Parcel reply = Parcel.obtain();
2629 data.writeInterfaceToken(IActivityManager.descriptor);
2630 data.writeStrongBinder(token);
2631 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2632 reply.readException();
2633 data.recycle();
2634 reply.recycle();
2635 }
2636 public String getCallingPackage(IBinder token) throws RemoteException
2637 {
2638 Parcel data = Parcel.obtain();
2639 Parcel reply = Parcel.obtain();
2640 data.writeInterfaceToken(IActivityManager.descriptor);
2641 data.writeStrongBinder(token);
2642 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2643 reply.readException();
2644 String res = reply.readString();
2645 data.recycle();
2646 reply.recycle();
2647 return res;
2648 }
2649 public ComponentName getCallingActivity(IBinder token)
2650 throws RemoteException {
2651 Parcel data = Parcel.obtain();
2652 Parcel reply = Parcel.obtain();
2653 data.writeInterfaceToken(IActivityManager.descriptor);
2654 data.writeStrongBinder(token);
2655 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2656 reply.readException();
2657 ComponentName res = ComponentName.readFromParcel(reply);
2658 data.recycle();
2659 reply.recycle();
2660 return res;
2661 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002662 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002663 Parcel data = Parcel.obtain();
2664 Parcel reply = Parcel.obtain();
2665 data.writeInterfaceToken(IActivityManager.descriptor);
2666 data.writeInt(maxNum);
2667 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002668 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2669 reply.readException();
2670 ArrayList list = null;
2671 int N = reply.readInt();
2672 if (N >= 0) {
2673 list = new ArrayList();
2674 while (N > 0) {
2675 ActivityManager.RunningTaskInfo info =
2676 ActivityManager.RunningTaskInfo.CREATOR
2677 .createFromParcel(reply);
2678 list.add(info);
2679 N--;
2680 }
2681 }
2682 data.recycle();
2683 reply.recycle();
2684 return list;
2685 }
2686 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002687 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002688 Parcel data = Parcel.obtain();
2689 Parcel reply = Parcel.obtain();
2690 data.writeInterfaceToken(IActivityManager.descriptor);
2691 data.writeInt(maxNum);
2692 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002693 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002694 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2695 reply.readException();
2696 ArrayList<ActivityManager.RecentTaskInfo> list
2697 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2698 data.recycle();
2699 reply.recycle();
2700 return list;
2701 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002702 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002703 Parcel data = Parcel.obtain();
2704 Parcel reply = Parcel.obtain();
2705 data.writeInterfaceToken(IActivityManager.descriptor);
2706 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002707 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002708 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002709 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002710 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002711 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002712 }
2713 data.recycle();
2714 reply.recycle();
2715 return bm;
2716 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002717 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2718 Parcel data = Parcel.obtain();
2719 Parcel reply = Parcel.obtain();
2720 data.writeInterfaceToken(IActivityManager.descriptor);
2721 data.writeInt(id);
2722 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2723 reply.readException();
2724 Bitmap bm = null;
2725 if (reply.readInt() != 0) {
2726 bm = Bitmap.CREATOR.createFromParcel(reply);
2727 }
2728 data.recycle();
2729 reply.recycle();
2730 return bm;
2731 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002732 public List getServices(int maxNum, int flags) throws RemoteException {
2733 Parcel data = Parcel.obtain();
2734 Parcel reply = Parcel.obtain();
2735 data.writeInterfaceToken(IActivityManager.descriptor);
2736 data.writeInt(maxNum);
2737 data.writeInt(flags);
2738 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2739 reply.readException();
2740 ArrayList list = null;
2741 int N = reply.readInt();
2742 if (N >= 0) {
2743 list = new ArrayList();
2744 while (N > 0) {
2745 ActivityManager.RunningServiceInfo info =
2746 ActivityManager.RunningServiceInfo.CREATOR
2747 .createFromParcel(reply);
2748 list.add(info);
2749 N--;
2750 }
2751 }
2752 data.recycle();
2753 reply.recycle();
2754 return list;
2755 }
2756 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2757 throws RemoteException {
2758 Parcel data = Parcel.obtain();
2759 Parcel reply = Parcel.obtain();
2760 data.writeInterfaceToken(IActivityManager.descriptor);
2761 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2762 reply.readException();
2763 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2764 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2765 data.recycle();
2766 reply.recycle();
2767 return list;
2768 }
2769 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2770 throws RemoteException {
2771 Parcel data = Parcel.obtain();
2772 Parcel reply = Parcel.obtain();
2773 data.writeInterfaceToken(IActivityManager.descriptor);
2774 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2775 reply.readException();
2776 ArrayList<ActivityManager.RunningAppProcessInfo> list
2777 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2778 data.recycle();
2779 reply.recycle();
2780 return list;
2781 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002782 public List<ApplicationInfo> getRunningExternalApplications()
2783 throws RemoteException {
2784 Parcel data = Parcel.obtain();
2785 Parcel reply = Parcel.obtain();
2786 data.writeInterfaceToken(IActivityManager.descriptor);
2787 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2788 reply.readException();
2789 ArrayList<ApplicationInfo> list
2790 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2791 data.recycle();
2792 reply.recycle();
2793 return list;
2794 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002795 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002796 {
2797 Parcel data = Parcel.obtain();
2798 Parcel reply = Parcel.obtain();
2799 data.writeInterfaceToken(IActivityManager.descriptor);
2800 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002801 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002802 if (options != null) {
2803 data.writeInt(1);
2804 options.writeToParcel(data, 0);
2805 } else {
2806 data.writeInt(0);
2807 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002808 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2809 reply.readException();
2810 data.recycle();
2811 reply.recycle();
2812 }
2813 public void moveTaskToBack(int task) throws RemoteException
2814 {
2815 Parcel data = Parcel.obtain();
2816 Parcel reply = Parcel.obtain();
2817 data.writeInterfaceToken(IActivityManager.descriptor);
2818 data.writeInt(task);
2819 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2820 reply.readException();
2821 data.recycle();
2822 reply.recycle();
2823 }
2824 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2825 throws RemoteException {
2826 Parcel data = Parcel.obtain();
2827 Parcel reply = Parcel.obtain();
2828 data.writeInterfaceToken(IActivityManager.descriptor);
2829 data.writeStrongBinder(token);
2830 data.writeInt(nonRoot ? 1 : 0);
2831 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2832 reply.readException();
2833 boolean res = reply.readInt() != 0;
2834 data.recycle();
2835 reply.recycle();
2836 return res;
2837 }
2838 public void moveTaskBackwards(int task) throws RemoteException
2839 {
2840 Parcel data = Parcel.obtain();
2841 Parcel reply = Parcel.obtain();
2842 data.writeInterfaceToken(IActivityManager.descriptor);
2843 data.writeInt(task);
2844 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2845 reply.readException();
2846 data.recycle();
2847 reply.recycle();
2848 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002849 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002850 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2851 {
2852 Parcel data = Parcel.obtain();
2853 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002854 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002855 data.writeInt(taskId);
2856 data.writeInt(stackId);
2857 data.writeInt(toTop ? 1 : 0);
2858 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2859 reply.readException();
2860 data.recycle();
2861 reply.recycle();
2862 }
2863 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002864 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002865 {
2866 Parcel data = Parcel.obtain();
2867 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002868 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002869 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002870 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002871 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002872 reply.readException();
2873 data.recycle();
2874 reply.recycle();
2875 }
Craig Mautner967212c2013-04-13 21:10:58 -07002876 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002877 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002878 {
2879 Parcel data = Parcel.obtain();
2880 Parcel reply = Parcel.obtain();
2881 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002882 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002883 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002884 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002885 data.recycle();
2886 reply.recycle();
2887 return list;
2888 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002889 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002890 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002891 {
2892 Parcel data = Parcel.obtain();
2893 Parcel reply = Parcel.obtain();
2894 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002895 data.writeInt(stackId);
2896 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002897 reply.readException();
2898 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002899 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002900 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002901 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002902 }
2903 data.recycle();
2904 reply.recycle();
2905 return info;
2906 }
2907 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08002908 public boolean isInHomeStack(int taskId) throws RemoteException {
2909 Parcel data = Parcel.obtain();
2910 Parcel reply = Parcel.obtain();
2911 data.writeInterfaceToken(IActivityManager.descriptor);
2912 data.writeInt(taskId);
2913 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
2914 reply.readException();
2915 boolean isInHomeStack = reply.readInt() > 0;
2916 data.recycle();
2917 reply.recycle();
2918 return isInHomeStack;
2919 }
2920 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002921 public void setFocusedStack(int stackId) throws RemoteException
2922 {
2923 Parcel data = Parcel.obtain();
2924 Parcel reply = Parcel.obtain();
2925 data.writeInterfaceToken(IActivityManager.descriptor);
2926 data.writeInt(stackId);
2927 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2928 reply.readException();
2929 data.recycle();
2930 reply.recycle();
2931 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002932 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2933 {
2934 Parcel data = Parcel.obtain();
2935 Parcel reply = Parcel.obtain();
2936 data.writeInterfaceToken(IActivityManager.descriptor);
2937 data.writeStrongBinder(token);
2938 data.writeInt(onlyRoot ? 1 : 0);
2939 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2940 reply.readException();
2941 int res = reply.readInt();
2942 data.recycle();
2943 reply.recycle();
2944 return res;
2945 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002946 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002947 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002948 Parcel data = Parcel.obtain();
2949 Parcel reply = Parcel.obtain();
2950 data.writeInterfaceToken(IActivityManager.descriptor);
2951 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2952 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002953 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002954 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002955 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2956 reply.readException();
2957 int res = reply.readInt();
2958 ContentProviderHolder cph = null;
2959 if (res != 0) {
2960 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2961 }
2962 data.recycle();
2963 reply.recycle();
2964 return cph;
2965 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002966 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2967 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002968 Parcel data = Parcel.obtain();
2969 Parcel reply = Parcel.obtain();
2970 data.writeInterfaceToken(IActivityManager.descriptor);
2971 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002972 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002973 data.writeStrongBinder(token);
2974 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2975 reply.readException();
2976 int res = reply.readInt();
2977 ContentProviderHolder cph = null;
2978 if (res != 0) {
2979 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2980 }
2981 data.recycle();
2982 reply.recycle();
2983 return cph;
2984 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002985 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002986 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002987 {
2988 Parcel data = Parcel.obtain();
2989 Parcel reply = Parcel.obtain();
2990 data.writeInterfaceToken(IActivityManager.descriptor);
2991 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2992 data.writeTypedList(providers);
2993 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2994 reply.readException();
2995 data.recycle();
2996 reply.recycle();
2997 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002998 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2999 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003000 Parcel data = Parcel.obtain();
3001 Parcel reply = Parcel.obtain();
3002 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003003 data.writeStrongBinder(connection);
3004 data.writeInt(stable);
3005 data.writeInt(unstable);
3006 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3007 reply.readException();
3008 boolean res = reply.readInt() != 0;
3009 data.recycle();
3010 reply.recycle();
3011 return res;
3012 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003013
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003014 public void unstableProviderDied(IBinder connection) throws RemoteException {
3015 Parcel data = Parcel.obtain();
3016 Parcel reply = Parcel.obtain();
3017 data.writeInterfaceToken(IActivityManager.descriptor);
3018 data.writeStrongBinder(connection);
3019 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3020 reply.readException();
3021 data.recycle();
3022 reply.recycle();
3023 }
3024
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003025 @Override
3026 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3027 Parcel data = Parcel.obtain();
3028 Parcel reply = Parcel.obtain();
3029 data.writeInterfaceToken(IActivityManager.descriptor);
3030 data.writeStrongBinder(connection);
3031 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3032 reply.readException();
3033 data.recycle();
3034 reply.recycle();
3035 }
3036
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003037 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3038 Parcel data = Parcel.obtain();
3039 Parcel reply = Parcel.obtain();
3040 data.writeInterfaceToken(IActivityManager.descriptor);
3041 data.writeStrongBinder(connection);
3042 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003043 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3044 reply.readException();
3045 data.recycle();
3046 reply.recycle();
3047 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003048
3049 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3050 Parcel data = Parcel.obtain();
3051 Parcel reply = Parcel.obtain();
3052 data.writeInterfaceToken(IActivityManager.descriptor);
3053 data.writeString(name);
3054 data.writeStrongBinder(token);
3055 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3056 reply.readException();
3057 data.recycle();
3058 reply.recycle();
3059 }
3060
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003061 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3062 throws RemoteException
3063 {
3064 Parcel data = Parcel.obtain();
3065 Parcel reply = Parcel.obtain();
3066 data.writeInterfaceToken(IActivityManager.descriptor);
3067 service.writeToParcel(data, 0);
3068 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3069 reply.readException();
3070 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3071 data.recycle();
3072 reply.recycle();
3073 return res;
3074 }
3075
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003076 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003077 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003078 {
3079 Parcel data = Parcel.obtain();
3080 Parcel reply = Parcel.obtain();
3081 data.writeInterfaceToken(IActivityManager.descriptor);
3082 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3083 service.writeToParcel(data, 0);
3084 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003085 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003086 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3087 reply.readException();
3088 ComponentName res = ComponentName.readFromParcel(reply);
3089 data.recycle();
3090 reply.recycle();
3091 return res;
3092 }
3093 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003094 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003095 {
3096 Parcel data = Parcel.obtain();
3097 Parcel reply = Parcel.obtain();
3098 data.writeInterfaceToken(IActivityManager.descriptor);
3099 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3100 service.writeToParcel(data, 0);
3101 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003102 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003103 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3104 reply.readException();
3105 int res = reply.readInt();
3106 reply.recycle();
3107 data.recycle();
3108 return res;
3109 }
3110 public boolean stopServiceToken(ComponentName className, IBinder token,
3111 int startId) throws RemoteException {
3112 Parcel data = Parcel.obtain();
3113 Parcel reply = Parcel.obtain();
3114 data.writeInterfaceToken(IActivityManager.descriptor);
3115 ComponentName.writeToParcel(className, data);
3116 data.writeStrongBinder(token);
3117 data.writeInt(startId);
3118 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3119 reply.readException();
3120 boolean res = reply.readInt() != 0;
3121 data.recycle();
3122 reply.recycle();
3123 return res;
3124 }
3125 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003126 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003127 Parcel data = Parcel.obtain();
3128 Parcel reply = Parcel.obtain();
3129 data.writeInterfaceToken(IActivityManager.descriptor);
3130 ComponentName.writeToParcel(className, data);
3131 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003132 data.writeInt(id);
3133 if (notification != null) {
3134 data.writeInt(1);
3135 notification.writeToParcel(data, 0);
3136 } else {
3137 data.writeInt(0);
3138 }
3139 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003140 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3141 reply.readException();
3142 data.recycle();
3143 reply.recycle();
3144 }
3145 public int bindService(IApplicationThread caller, IBinder token,
3146 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003147 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003148 Parcel data = Parcel.obtain();
3149 Parcel reply = Parcel.obtain();
3150 data.writeInterfaceToken(IActivityManager.descriptor);
3151 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3152 data.writeStrongBinder(token);
3153 service.writeToParcel(data, 0);
3154 data.writeString(resolvedType);
3155 data.writeStrongBinder(connection.asBinder());
3156 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003157 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003158 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3159 reply.readException();
3160 int res = reply.readInt();
3161 data.recycle();
3162 reply.recycle();
3163 return res;
3164 }
3165 public boolean unbindService(IServiceConnection connection) throws RemoteException
3166 {
3167 Parcel data = Parcel.obtain();
3168 Parcel reply = Parcel.obtain();
3169 data.writeInterfaceToken(IActivityManager.descriptor);
3170 data.writeStrongBinder(connection.asBinder());
3171 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3172 reply.readException();
3173 boolean res = reply.readInt() != 0;
3174 data.recycle();
3175 reply.recycle();
3176 return res;
3177 }
3178
3179 public void publishService(IBinder token,
3180 Intent intent, IBinder service) throws RemoteException {
3181 Parcel data = Parcel.obtain();
3182 Parcel reply = Parcel.obtain();
3183 data.writeInterfaceToken(IActivityManager.descriptor);
3184 data.writeStrongBinder(token);
3185 intent.writeToParcel(data, 0);
3186 data.writeStrongBinder(service);
3187 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3188 reply.readException();
3189 data.recycle();
3190 reply.recycle();
3191 }
3192
3193 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3194 throws RemoteException {
3195 Parcel data = Parcel.obtain();
3196 Parcel reply = Parcel.obtain();
3197 data.writeInterfaceToken(IActivityManager.descriptor);
3198 data.writeStrongBinder(token);
3199 intent.writeToParcel(data, 0);
3200 data.writeInt(doRebind ? 1 : 0);
3201 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3202 reply.readException();
3203 data.recycle();
3204 reply.recycle();
3205 }
3206
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003207 public void serviceDoneExecuting(IBinder token, int type, int startId,
3208 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003209 Parcel data = Parcel.obtain();
3210 Parcel reply = Parcel.obtain();
3211 data.writeInterfaceToken(IActivityManager.descriptor);
3212 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003213 data.writeInt(type);
3214 data.writeInt(startId);
3215 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003216 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3217 reply.readException();
3218 data.recycle();
3219 reply.recycle();
3220 }
3221
3222 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3223 Parcel data = Parcel.obtain();
3224 Parcel reply = Parcel.obtain();
3225 data.writeInterfaceToken(IActivityManager.descriptor);
3226 service.writeToParcel(data, 0);
3227 data.writeString(resolvedType);
3228 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3229 reply.readException();
3230 IBinder binder = reply.readStrongBinder();
3231 reply.recycle();
3232 data.recycle();
3233 return binder;
3234 }
3235
Christopher Tate181fafa2009-05-14 11:12:14 -07003236 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3237 throws RemoteException {
3238 Parcel data = Parcel.obtain();
3239 Parcel reply = Parcel.obtain();
3240 data.writeInterfaceToken(IActivityManager.descriptor);
3241 app.writeToParcel(data, 0);
3242 data.writeInt(backupRestoreMode);
3243 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3244 reply.readException();
3245 boolean success = reply.readInt() != 0;
3246 reply.recycle();
3247 data.recycle();
3248 return success;
3249 }
3250
Christopher Tate346acb12012-10-15 19:20:25 -07003251 public void clearPendingBackup() throws RemoteException {
3252 Parcel data = Parcel.obtain();
3253 Parcel reply = Parcel.obtain();
3254 data.writeInterfaceToken(IActivityManager.descriptor);
3255 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3256 reply.recycle();
3257 data.recycle();
3258 }
3259
Christopher Tate181fafa2009-05-14 11:12:14 -07003260 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3261 Parcel data = Parcel.obtain();
3262 Parcel reply = Parcel.obtain();
3263 data.writeInterfaceToken(IActivityManager.descriptor);
3264 data.writeString(packageName);
3265 data.writeStrongBinder(agent);
3266 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3267 reply.recycle();
3268 data.recycle();
3269 }
3270
3271 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3272 Parcel data = Parcel.obtain();
3273 Parcel reply = Parcel.obtain();
3274 data.writeInterfaceToken(IActivityManager.descriptor);
3275 app.writeToParcel(data, 0);
3276 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3277 reply.readException();
3278 reply.recycle();
3279 data.recycle();
3280 }
3281
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003282 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003283 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3284 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003285 Parcel data = Parcel.obtain();
3286 Parcel reply = Parcel.obtain();
3287 data.writeInterfaceToken(IActivityManager.descriptor);
3288 ComponentName.writeToParcel(className, data);
3289 data.writeString(profileFile);
3290 data.writeInt(flags);
3291 data.writeBundle(arguments);
3292 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003293 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003294 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003295 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3296 reply.readException();
3297 boolean res = reply.readInt() != 0;
3298 reply.recycle();
3299 data.recycle();
3300 return res;
3301 }
3302
3303 public void finishInstrumentation(IApplicationThread target,
3304 int resultCode, Bundle results) throws RemoteException {
3305 Parcel data = Parcel.obtain();
3306 Parcel reply = Parcel.obtain();
3307 data.writeInterfaceToken(IActivityManager.descriptor);
3308 data.writeStrongBinder(target != null ? target.asBinder() : null);
3309 data.writeInt(resultCode);
3310 data.writeBundle(results);
3311 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3312 reply.readException();
3313 data.recycle();
3314 reply.recycle();
3315 }
3316 public Configuration getConfiguration() throws RemoteException
3317 {
3318 Parcel data = Parcel.obtain();
3319 Parcel reply = Parcel.obtain();
3320 data.writeInterfaceToken(IActivityManager.descriptor);
3321 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3322 reply.readException();
3323 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3324 reply.recycle();
3325 data.recycle();
3326 return res;
3327 }
3328 public void updateConfiguration(Configuration values) throws RemoteException
3329 {
3330 Parcel data = Parcel.obtain();
3331 Parcel reply = Parcel.obtain();
3332 data.writeInterfaceToken(IActivityManager.descriptor);
3333 values.writeToParcel(data, 0);
3334 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3335 reply.readException();
3336 data.recycle();
3337 reply.recycle();
3338 }
3339 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3340 throws RemoteException {
3341 Parcel data = Parcel.obtain();
3342 Parcel reply = Parcel.obtain();
3343 data.writeInterfaceToken(IActivityManager.descriptor);
3344 data.writeStrongBinder(token);
3345 data.writeInt(requestedOrientation);
3346 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3347 reply.readException();
3348 data.recycle();
3349 reply.recycle();
3350 }
3351 public int getRequestedOrientation(IBinder token) throws RemoteException {
3352 Parcel data = Parcel.obtain();
3353 Parcel reply = Parcel.obtain();
3354 data.writeInterfaceToken(IActivityManager.descriptor);
3355 data.writeStrongBinder(token);
3356 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3357 reply.readException();
3358 int res = reply.readInt();
3359 data.recycle();
3360 reply.recycle();
3361 return res;
3362 }
3363 public ComponentName getActivityClassForToken(IBinder token)
3364 throws RemoteException {
3365 Parcel data = Parcel.obtain();
3366 Parcel reply = Parcel.obtain();
3367 data.writeInterfaceToken(IActivityManager.descriptor);
3368 data.writeStrongBinder(token);
3369 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3370 reply.readException();
3371 ComponentName res = ComponentName.readFromParcel(reply);
3372 data.recycle();
3373 reply.recycle();
3374 return res;
3375 }
3376 public String getPackageForToken(IBinder token) throws RemoteException
3377 {
3378 Parcel data = Parcel.obtain();
3379 Parcel reply = Parcel.obtain();
3380 data.writeInterfaceToken(IActivityManager.descriptor);
3381 data.writeStrongBinder(token);
3382 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3383 reply.readException();
3384 String res = reply.readString();
3385 data.recycle();
3386 reply.recycle();
3387 return res;
3388 }
3389 public IIntentSender getIntentSender(int type,
3390 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003391 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003392 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003393 Parcel data = Parcel.obtain();
3394 Parcel reply = Parcel.obtain();
3395 data.writeInterfaceToken(IActivityManager.descriptor);
3396 data.writeInt(type);
3397 data.writeString(packageName);
3398 data.writeStrongBinder(token);
3399 data.writeString(resultWho);
3400 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003401 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003402 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003403 data.writeTypedArray(intents, 0);
3404 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003405 } else {
3406 data.writeInt(0);
3407 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003408 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003409 if (options != null) {
3410 data.writeInt(1);
3411 options.writeToParcel(data, 0);
3412 } else {
3413 data.writeInt(0);
3414 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003415 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003416 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3417 reply.readException();
3418 IIntentSender res = IIntentSender.Stub.asInterface(
3419 reply.readStrongBinder());
3420 data.recycle();
3421 reply.recycle();
3422 return res;
3423 }
3424 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3425 Parcel data = Parcel.obtain();
3426 Parcel reply = Parcel.obtain();
3427 data.writeInterfaceToken(IActivityManager.descriptor);
3428 data.writeStrongBinder(sender.asBinder());
3429 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3430 reply.readException();
3431 data.recycle();
3432 reply.recycle();
3433 }
3434 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3435 Parcel data = Parcel.obtain();
3436 Parcel reply = Parcel.obtain();
3437 data.writeInterfaceToken(IActivityManager.descriptor);
3438 data.writeStrongBinder(sender.asBinder());
3439 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3440 reply.readException();
3441 String res = reply.readString();
3442 data.recycle();
3443 reply.recycle();
3444 return res;
3445 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003446 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3447 Parcel data = Parcel.obtain();
3448 Parcel reply = Parcel.obtain();
3449 data.writeInterfaceToken(IActivityManager.descriptor);
3450 data.writeStrongBinder(sender.asBinder());
3451 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3452 reply.readException();
3453 int res = reply.readInt();
3454 data.recycle();
3455 reply.recycle();
3456 return res;
3457 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003458 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3459 boolean requireFull, String name, String callerPackage) throws RemoteException {
3460 Parcel data = Parcel.obtain();
3461 Parcel reply = Parcel.obtain();
3462 data.writeInterfaceToken(IActivityManager.descriptor);
3463 data.writeInt(callingPid);
3464 data.writeInt(callingUid);
3465 data.writeInt(userId);
3466 data.writeInt(allowAll ? 1 : 0);
3467 data.writeInt(requireFull ? 1 : 0);
3468 data.writeString(name);
3469 data.writeString(callerPackage);
3470 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3471 reply.readException();
3472 int res = reply.readInt();
3473 data.recycle();
3474 reply.recycle();
3475 return res;
3476 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003477 public void setProcessLimit(int max) throws RemoteException
3478 {
3479 Parcel data = Parcel.obtain();
3480 Parcel reply = Parcel.obtain();
3481 data.writeInterfaceToken(IActivityManager.descriptor);
3482 data.writeInt(max);
3483 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3484 reply.readException();
3485 data.recycle();
3486 reply.recycle();
3487 }
3488 public int getProcessLimit() throws RemoteException
3489 {
3490 Parcel data = Parcel.obtain();
3491 Parcel reply = Parcel.obtain();
3492 data.writeInterfaceToken(IActivityManager.descriptor);
3493 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3494 reply.readException();
3495 int res = reply.readInt();
3496 data.recycle();
3497 reply.recycle();
3498 return res;
3499 }
3500 public void setProcessForeground(IBinder token, int pid,
3501 boolean isForeground) throws RemoteException {
3502 Parcel data = Parcel.obtain();
3503 Parcel reply = Parcel.obtain();
3504 data.writeInterfaceToken(IActivityManager.descriptor);
3505 data.writeStrongBinder(token);
3506 data.writeInt(pid);
3507 data.writeInt(isForeground ? 1 : 0);
3508 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3509 reply.readException();
3510 data.recycle();
3511 reply.recycle();
3512 }
3513 public int checkPermission(String permission, int pid, int uid)
3514 throws RemoteException {
3515 Parcel data = Parcel.obtain();
3516 Parcel reply = Parcel.obtain();
3517 data.writeInterfaceToken(IActivityManager.descriptor);
3518 data.writeString(permission);
3519 data.writeInt(pid);
3520 data.writeInt(uid);
3521 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3522 reply.readException();
3523 int res = reply.readInt();
3524 data.recycle();
3525 reply.recycle();
3526 return res;
3527 }
3528 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003529 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003530 Parcel data = Parcel.obtain();
3531 Parcel reply = Parcel.obtain();
3532 data.writeInterfaceToken(IActivityManager.descriptor);
3533 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003534 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003535 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003536 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3537 reply.readException();
3538 boolean res = reply.readInt() != 0;
3539 data.recycle();
3540 reply.recycle();
3541 return res;
3542 }
3543 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3544 throws RemoteException {
3545 Parcel data = Parcel.obtain();
3546 Parcel reply = Parcel.obtain();
3547 data.writeInterfaceToken(IActivityManager.descriptor);
3548 uri.writeToParcel(data, 0);
3549 data.writeInt(pid);
3550 data.writeInt(uid);
3551 data.writeInt(mode);
3552 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3553 reply.readException();
3554 int res = reply.readInt();
3555 data.recycle();
3556 reply.recycle();
3557 return res;
3558 }
3559 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3560 Uri uri, int mode) throws RemoteException {
3561 Parcel data = Parcel.obtain();
3562 Parcel reply = Parcel.obtain();
3563 data.writeInterfaceToken(IActivityManager.descriptor);
3564 data.writeStrongBinder(caller.asBinder());
3565 data.writeString(targetPkg);
3566 uri.writeToParcel(data, 0);
3567 data.writeInt(mode);
3568 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3569 reply.readException();
3570 data.recycle();
3571 reply.recycle();
3572 }
3573 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3574 int mode) throws RemoteException {
3575 Parcel data = Parcel.obtain();
3576 Parcel reply = Parcel.obtain();
3577 data.writeInterfaceToken(IActivityManager.descriptor);
3578 data.writeStrongBinder(caller.asBinder());
3579 uri.writeToParcel(data, 0);
3580 data.writeInt(mode);
3581 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3582 reply.readException();
3583 data.recycle();
3584 reply.recycle();
3585 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003586
3587 @Override
3588 public void takePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3589 Parcel data = Parcel.obtain();
3590 Parcel reply = Parcel.obtain();
3591 data.writeInterfaceToken(IActivityManager.descriptor);
3592 uri.writeToParcel(data, 0);
3593 data.writeInt(mode);
3594 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3595 reply.readException();
3596 data.recycle();
3597 reply.recycle();
3598 }
3599
3600 @Override
3601 public void releasePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3602 Parcel data = Parcel.obtain();
3603 Parcel reply = Parcel.obtain();
3604 data.writeInterfaceToken(IActivityManager.descriptor);
3605 uri.writeToParcel(data, 0);
3606 data.writeInt(mode);
3607 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3608 reply.readException();
3609 data.recycle();
3610 reply.recycle();
3611 }
3612
3613 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003614 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3615 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003616 Parcel data = Parcel.obtain();
3617 Parcel reply = Parcel.obtain();
3618 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003619 data.writeString(packageName);
3620 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003621 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3622 reply.readException();
3623 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3624 reply);
3625 data.recycle();
3626 reply.recycle();
3627 return perms;
3628 }
3629
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003630 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3631 throws RemoteException {
3632 Parcel data = Parcel.obtain();
3633 Parcel reply = Parcel.obtain();
3634 data.writeInterfaceToken(IActivityManager.descriptor);
3635 data.writeStrongBinder(who.asBinder());
3636 data.writeInt(waiting ? 1 : 0);
3637 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3638 reply.readException();
3639 data.recycle();
3640 reply.recycle();
3641 }
3642 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3643 Parcel data = Parcel.obtain();
3644 Parcel reply = Parcel.obtain();
3645 data.writeInterfaceToken(IActivityManager.descriptor);
3646 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3647 reply.readException();
3648 outInfo.readFromParcel(reply);
3649 data.recycle();
3650 reply.recycle();
3651 }
3652 public void unhandledBack() throws RemoteException
3653 {
3654 Parcel data = Parcel.obtain();
3655 Parcel reply = Parcel.obtain();
3656 data.writeInterfaceToken(IActivityManager.descriptor);
3657 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3658 reply.readException();
3659 data.recycle();
3660 reply.recycle();
3661 }
3662 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3663 {
3664 Parcel data = Parcel.obtain();
3665 Parcel reply = Parcel.obtain();
3666 data.writeInterfaceToken(IActivityManager.descriptor);
3667 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3668 reply.readException();
3669 ParcelFileDescriptor pfd = null;
3670 if (reply.readInt() != 0) {
3671 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3672 }
3673 data.recycle();
3674 reply.recycle();
3675 return pfd;
3676 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003677 public void setLockScreenShown(boolean shown) throws RemoteException
3678 {
3679 Parcel data = Parcel.obtain();
3680 Parcel reply = Parcel.obtain();
3681 data.writeInterfaceToken(IActivityManager.descriptor);
3682 data.writeInt(shown ? 1 : 0);
3683 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3684 reply.readException();
3685 data.recycle();
3686 reply.recycle();
3687 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003688 public void setDebugApp(
3689 String packageName, boolean waitForDebugger, boolean persistent)
3690 throws RemoteException
3691 {
3692 Parcel data = Parcel.obtain();
3693 Parcel reply = Parcel.obtain();
3694 data.writeInterfaceToken(IActivityManager.descriptor);
3695 data.writeString(packageName);
3696 data.writeInt(waitForDebugger ? 1 : 0);
3697 data.writeInt(persistent ? 1 : 0);
3698 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3699 reply.readException();
3700 data.recycle();
3701 reply.recycle();
3702 }
3703 public void setAlwaysFinish(boolean enabled) throws RemoteException
3704 {
3705 Parcel data = Parcel.obtain();
3706 Parcel reply = Parcel.obtain();
3707 data.writeInterfaceToken(IActivityManager.descriptor);
3708 data.writeInt(enabled ? 1 : 0);
3709 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3710 reply.readException();
3711 data.recycle();
3712 reply.recycle();
3713 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003714 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003715 {
3716 Parcel data = Parcel.obtain();
3717 Parcel reply = Parcel.obtain();
3718 data.writeInterfaceToken(IActivityManager.descriptor);
3719 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003720 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003721 reply.readException();
3722 data.recycle();
3723 reply.recycle();
3724 }
3725 public void enterSafeMode() throws RemoteException {
3726 Parcel data = Parcel.obtain();
3727 data.writeInterfaceToken(IActivityManager.descriptor);
3728 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3729 data.recycle();
3730 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003731 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3732 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003733 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003734 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003735 data.writeStrongBinder(sender.asBinder());
3736 data.writeInt(sourceUid);
3737 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003738 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3739 data.recycle();
3740 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003741 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003742 Parcel data = Parcel.obtain();
3743 Parcel reply = Parcel.obtain();
3744 data.writeInterfaceToken(IActivityManager.descriptor);
3745 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003746 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003747 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003748 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003749 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003750 boolean res = reply.readInt() != 0;
3751 data.recycle();
3752 reply.recycle();
3753 return res;
3754 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003755 @Override
3756 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3757 Parcel data = Parcel.obtain();
3758 Parcel reply = Parcel.obtain();
3759 data.writeInterfaceToken(IActivityManager.descriptor);
3760 data.writeString(reason);
3761 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3762 boolean res = reply.readInt() != 0;
3763 data.recycle();
3764 reply.recycle();
3765 return res;
3766 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003767 public boolean testIsSystemReady()
3768 {
3769 /* this base class version is never called */
3770 return true;
3771 }
Dan Egnor60d87622009-12-16 16:32:58 -08003772 public void handleApplicationCrash(IBinder app,
3773 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3774 {
3775 Parcel data = Parcel.obtain();
3776 Parcel reply = Parcel.obtain();
3777 data.writeInterfaceToken(IActivityManager.descriptor);
3778 data.writeStrongBinder(app);
3779 crashInfo.writeToParcel(data, 0);
3780 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3781 reply.readException();
3782 reply.recycle();
3783 data.recycle();
3784 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003785
Dan Egnor60d87622009-12-16 16:32:58 -08003786 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003787 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003788 {
3789 Parcel data = Parcel.obtain();
3790 Parcel reply = Parcel.obtain();
3791 data.writeInterfaceToken(IActivityManager.descriptor);
3792 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003793 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003794 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003795 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003796 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003797 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003798 reply.recycle();
3799 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003800 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003801 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003802
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003803 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003804 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003805 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003806 {
3807 Parcel data = Parcel.obtain();
3808 Parcel reply = Parcel.obtain();
3809 data.writeInterfaceToken(IActivityManager.descriptor);
3810 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003811 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003812 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003813 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3814 reply.readException();
3815 reply.recycle();
3816 data.recycle();
3817 }
3818
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003819 public void signalPersistentProcesses(int sig) throws RemoteException {
3820 Parcel data = Parcel.obtain();
3821 Parcel reply = Parcel.obtain();
3822 data.writeInterfaceToken(IActivityManager.descriptor);
3823 data.writeInt(sig);
3824 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3825 reply.readException();
3826 data.recycle();
3827 reply.recycle();
3828 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003829
Dianne Hackborn1676c852012-09-10 14:52:30 -07003830 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003831 Parcel data = Parcel.obtain();
3832 Parcel reply = Parcel.obtain();
3833 data.writeInterfaceToken(IActivityManager.descriptor);
3834 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003835 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003836 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3837 reply.readException();
3838 data.recycle();
3839 reply.recycle();
3840 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003841
3842 public void killAllBackgroundProcesses() throws RemoteException {
3843 Parcel data = Parcel.obtain();
3844 Parcel reply = Parcel.obtain();
3845 data.writeInterfaceToken(IActivityManager.descriptor);
3846 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3847 reply.readException();
3848 data.recycle();
3849 reply.recycle();
3850 }
3851
Dianne Hackborn1676c852012-09-10 14:52:30 -07003852 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003853 Parcel data = Parcel.obtain();
3854 Parcel reply = Parcel.obtain();
3855 data.writeInterfaceToken(IActivityManager.descriptor);
3856 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003857 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003858 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003859 reply.readException();
3860 data.recycle();
3861 reply.recycle();
3862 }
3863
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003864 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3865 throws RemoteException
3866 {
3867 Parcel data = Parcel.obtain();
3868 Parcel reply = Parcel.obtain();
3869 data.writeInterfaceToken(IActivityManager.descriptor);
3870 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3871 reply.readException();
3872 outInfo.readFromParcel(reply);
3873 reply.recycle();
3874 data.recycle();
3875 }
3876
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003877 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3878 {
3879 Parcel data = Parcel.obtain();
3880 Parcel reply = Parcel.obtain();
3881 data.writeInterfaceToken(IActivityManager.descriptor);
3882 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3883 reply.readException();
3884 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3885 reply.recycle();
3886 data.recycle();
3887 return res;
3888 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003889
Dianne Hackborn1676c852012-09-10 14:52:30 -07003890 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003891 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003892 {
3893 Parcel data = Parcel.obtain();
3894 Parcel reply = Parcel.obtain();
3895 data.writeInterfaceToken(IActivityManager.descriptor);
3896 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003897 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003898 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003899 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003900 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003901 if (fd != null) {
3902 data.writeInt(1);
3903 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3904 } else {
3905 data.writeInt(0);
3906 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003907 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3908 reply.readException();
3909 boolean res = reply.readInt() != 0;
3910 reply.recycle();
3911 data.recycle();
3912 return res;
3913 }
3914
Dianne Hackborn55280a92009-05-07 15:53:46 -07003915 public boolean shutdown(int timeout) throws RemoteException
3916 {
3917 Parcel data = Parcel.obtain();
3918 Parcel reply = Parcel.obtain();
3919 data.writeInterfaceToken(IActivityManager.descriptor);
3920 data.writeInt(timeout);
3921 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3922 reply.readException();
3923 boolean res = reply.readInt() != 0;
3924 reply.recycle();
3925 data.recycle();
3926 return res;
3927 }
3928
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003929 public void stopAppSwitches() throws RemoteException {
3930 Parcel data = Parcel.obtain();
3931 Parcel reply = Parcel.obtain();
3932 data.writeInterfaceToken(IActivityManager.descriptor);
3933 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3934 reply.readException();
3935 reply.recycle();
3936 data.recycle();
3937 }
3938
3939 public void resumeAppSwitches() throws RemoteException {
3940 Parcel data = Parcel.obtain();
3941 Parcel reply = Parcel.obtain();
3942 data.writeInterfaceToken(IActivityManager.descriptor);
3943 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3944 reply.readException();
3945 reply.recycle();
3946 data.recycle();
3947 }
3948
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003949 public void killApplicationWithAppId(String pkg, int appid, String reason)
3950 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003951 Parcel data = Parcel.obtain();
3952 Parcel reply = Parcel.obtain();
3953 data.writeInterfaceToken(IActivityManager.descriptor);
3954 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003955 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003956 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003957 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003958 reply.readException();
3959 data.recycle();
3960 reply.recycle();
3961 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003962
3963 public void closeSystemDialogs(String reason) throws RemoteException {
3964 Parcel data = Parcel.obtain();
3965 Parcel reply = Parcel.obtain();
3966 data.writeInterfaceToken(IActivityManager.descriptor);
3967 data.writeString(reason);
3968 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3969 reply.readException();
3970 data.recycle();
3971 reply.recycle();
3972 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003973
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003974 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003975 throws RemoteException {
3976 Parcel data = Parcel.obtain();
3977 Parcel reply = Parcel.obtain();
3978 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003979 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003980 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3981 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003982 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003983 data.recycle();
3984 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003985 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003986 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003987
3988 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3989 Parcel data = Parcel.obtain();
3990 Parcel reply = Parcel.obtain();
3991 data.writeInterfaceToken(IActivityManager.descriptor);
3992 data.writeString(processName);
3993 data.writeInt(uid);
3994 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3995 reply.readException();
3996 data.recycle();
3997 reply.recycle();
3998 }
3999
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004000 public void overridePendingTransition(IBinder token, String packageName,
4001 int enterAnim, int exitAnim) throws RemoteException {
4002 Parcel data = Parcel.obtain();
4003 Parcel reply = Parcel.obtain();
4004 data.writeInterfaceToken(IActivityManager.descriptor);
4005 data.writeStrongBinder(token);
4006 data.writeString(packageName);
4007 data.writeInt(enterAnim);
4008 data.writeInt(exitAnim);
4009 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4010 reply.readException();
4011 data.recycle();
4012 reply.recycle();
4013 }
4014
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004015 public boolean isUserAMonkey() throws RemoteException {
4016 Parcel data = Parcel.obtain();
4017 Parcel reply = Parcel.obtain();
4018 data.writeInterfaceToken(IActivityManager.descriptor);
4019 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4020 reply.readException();
4021 boolean res = reply.readInt() != 0;
4022 data.recycle();
4023 reply.recycle();
4024 return res;
4025 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004026
4027 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4028 Parcel data = Parcel.obtain();
4029 Parcel reply = Parcel.obtain();
4030 data.writeInterfaceToken(IActivityManager.descriptor);
4031 data.writeInt(monkey ? 1 : 0);
4032 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4033 reply.readException();
4034 data.recycle();
4035 reply.recycle();
4036 }
4037
Dianne Hackborn860755f2010-06-03 18:47:52 -07004038 public void finishHeavyWeightApp() throws RemoteException {
4039 Parcel data = Parcel.obtain();
4040 Parcel reply = Parcel.obtain();
4041 data.writeInterfaceToken(IActivityManager.descriptor);
4042 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4043 reply.readException();
4044 data.recycle();
4045 reply.recycle();
4046 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004047
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004048 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004049 throws RemoteException {
4050 Parcel data = Parcel.obtain();
4051 Parcel reply = Parcel.obtain();
4052 data.writeInterfaceToken(IActivityManager.descriptor);
4053 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004054 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4055 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004056 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004057 data.recycle();
4058 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004059 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004060 }
4061
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004062 public boolean convertToTranslucent(IBinder token)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004063 throws RemoteException {
4064 Parcel data = Parcel.obtain();
4065 Parcel reply = Parcel.obtain();
4066 data.writeInterfaceToken(IActivityManager.descriptor);
4067 data.writeStrongBinder(token);
4068 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004069 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004070 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004071 data.recycle();
4072 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004073 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004074 }
4075
Daniel Sandler69a48172010-06-23 16:29:36 -04004076 public void setImmersive(IBinder token, boolean immersive)
4077 throws RemoteException {
4078 Parcel data = Parcel.obtain();
4079 Parcel reply = Parcel.obtain();
4080 data.writeInterfaceToken(IActivityManager.descriptor);
4081 data.writeStrongBinder(token);
4082 data.writeInt(immersive ? 1 : 0);
4083 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4084 reply.readException();
4085 data.recycle();
4086 reply.recycle();
4087 }
4088
4089 public boolean isImmersive(IBinder token)
4090 throws RemoteException {
4091 Parcel data = Parcel.obtain();
4092 Parcel reply = Parcel.obtain();
4093 data.writeInterfaceToken(IActivityManager.descriptor);
4094 data.writeStrongBinder(token);
4095 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004096 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004097 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004098 data.recycle();
4099 reply.recycle();
4100 return res;
4101 }
4102
4103 public boolean isTopActivityImmersive()
4104 throws RemoteException {
4105 Parcel data = Parcel.obtain();
4106 Parcel reply = Parcel.obtain();
4107 data.writeInterfaceToken(IActivityManager.descriptor);
4108 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004109 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004110 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004111 data.recycle();
4112 reply.recycle();
4113 return res;
4114 }
4115
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004116 public void crashApplication(int uid, int initialPid, String packageName,
4117 String message) throws RemoteException {
4118 Parcel data = Parcel.obtain();
4119 Parcel reply = Parcel.obtain();
4120 data.writeInterfaceToken(IActivityManager.descriptor);
4121 data.writeInt(uid);
4122 data.writeInt(initialPid);
4123 data.writeString(packageName);
4124 data.writeString(message);
4125 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4126 reply.readException();
4127 data.recycle();
4128 reply.recycle();
4129 }
Andy McFadden824c5102010-07-09 16:26:57 -07004130
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004131 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004132 Parcel data = Parcel.obtain();
4133 Parcel reply = Parcel.obtain();
4134 data.writeInterfaceToken(IActivityManager.descriptor);
4135 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004136 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004137 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4138 reply.readException();
4139 String res = reply.readString();
4140 data.recycle();
4141 reply.recycle();
4142 return res;
4143 }
4144
Dianne Hackborn7e269642010-08-25 19:50:20 -07004145 public IBinder newUriPermissionOwner(String name)
4146 throws RemoteException {
4147 Parcel data = Parcel.obtain();
4148 Parcel reply = Parcel.obtain();
4149 data.writeInterfaceToken(IActivityManager.descriptor);
4150 data.writeString(name);
4151 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4152 reply.readException();
4153 IBinder res = reply.readStrongBinder();
4154 data.recycle();
4155 reply.recycle();
4156 return res;
4157 }
4158
4159 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
4160 Uri uri, int mode) throws RemoteException {
4161 Parcel data = Parcel.obtain();
4162 Parcel reply = Parcel.obtain();
4163 data.writeInterfaceToken(IActivityManager.descriptor);
4164 data.writeStrongBinder(owner);
4165 data.writeInt(fromUid);
4166 data.writeString(targetPkg);
4167 uri.writeToParcel(data, 0);
4168 data.writeInt(mode);
4169 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4170 reply.readException();
4171 data.recycle();
4172 reply.recycle();
4173 }
4174
4175 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
4176 int mode) throws RemoteException {
4177 Parcel data = Parcel.obtain();
4178 Parcel reply = Parcel.obtain();
4179 data.writeInterfaceToken(IActivityManager.descriptor);
4180 data.writeStrongBinder(owner);
4181 if (uri != null) {
4182 data.writeInt(1);
4183 uri.writeToParcel(data, 0);
4184 } else {
4185 data.writeInt(0);
4186 }
4187 data.writeInt(mode);
4188 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4189 reply.readException();
4190 data.recycle();
4191 reply.recycle();
4192 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004193
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004194 public int checkGrantUriPermission(int callingUid, String targetPkg,
4195 Uri uri, int modeFlags) throws RemoteException {
4196 Parcel data = Parcel.obtain();
4197 Parcel reply = Parcel.obtain();
4198 data.writeInterfaceToken(IActivityManager.descriptor);
4199 data.writeInt(callingUid);
4200 data.writeString(targetPkg);
4201 uri.writeToParcel(data, 0);
4202 data.writeInt(modeFlags);
4203 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4204 reply.readException();
4205 int res = reply.readInt();
4206 data.recycle();
4207 reply.recycle();
4208 return res;
4209 }
4210
Dianne Hackborn1676c852012-09-10 14:52:30 -07004211 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004212 String path, ParcelFileDescriptor fd) throws RemoteException {
4213 Parcel data = Parcel.obtain();
4214 Parcel reply = Parcel.obtain();
4215 data.writeInterfaceToken(IActivityManager.descriptor);
4216 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004217 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004218 data.writeInt(managed ? 1 : 0);
4219 data.writeString(path);
4220 if (fd != null) {
4221 data.writeInt(1);
4222 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4223 } else {
4224 data.writeInt(0);
4225 }
4226 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4227 reply.readException();
4228 boolean res = reply.readInt() != 0;
4229 reply.recycle();
4230 data.recycle();
4231 return res;
4232 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004233
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004234 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004235 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004236 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004237 Parcel data = Parcel.obtain();
4238 Parcel reply = Parcel.obtain();
4239 data.writeInterfaceToken(IActivityManager.descriptor);
4240 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004241 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004242 data.writeTypedArray(intents, 0);
4243 data.writeStringArray(resolvedTypes);
4244 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004245 if (options != null) {
4246 data.writeInt(1);
4247 options.writeToParcel(data, 0);
4248 } else {
4249 data.writeInt(0);
4250 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004251 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004252 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4253 reply.readException();
4254 int result = reply.readInt();
4255 reply.recycle();
4256 data.recycle();
4257 return result;
4258 }
4259
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004260 public int getFrontActivityScreenCompatMode() throws RemoteException {
4261 Parcel data = Parcel.obtain();
4262 Parcel reply = Parcel.obtain();
4263 data.writeInterfaceToken(IActivityManager.descriptor);
4264 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4265 reply.readException();
4266 int mode = reply.readInt();
4267 reply.recycle();
4268 data.recycle();
4269 return mode;
4270 }
4271
4272 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4273 Parcel data = Parcel.obtain();
4274 Parcel reply = Parcel.obtain();
4275 data.writeInterfaceToken(IActivityManager.descriptor);
4276 data.writeInt(mode);
4277 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4278 reply.readException();
4279 reply.recycle();
4280 data.recycle();
4281 }
4282
4283 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4284 Parcel data = Parcel.obtain();
4285 Parcel reply = Parcel.obtain();
4286 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004287 data.writeString(packageName);
4288 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004289 reply.readException();
4290 int mode = reply.readInt();
4291 reply.recycle();
4292 data.recycle();
4293 return mode;
4294 }
4295
4296 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004297 throws RemoteException {
4298 Parcel data = Parcel.obtain();
4299 Parcel reply = Parcel.obtain();
4300 data.writeInterfaceToken(IActivityManager.descriptor);
4301 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004302 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004303 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4304 reply.readException();
4305 reply.recycle();
4306 data.recycle();
4307 }
4308
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004309 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4310 Parcel data = Parcel.obtain();
4311 Parcel reply = Parcel.obtain();
4312 data.writeInterfaceToken(IActivityManager.descriptor);
4313 data.writeString(packageName);
4314 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4315 reply.readException();
4316 boolean ask = reply.readInt() != 0;
4317 reply.recycle();
4318 data.recycle();
4319 return ask;
4320 }
4321
4322 public void setPackageAskScreenCompat(String packageName, boolean ask)
4323 throws RemoteException {
4324 Parcel data = Parcel.obtain();
4325 Parcel reply = Parcel.obtain();
4326 data.writeInterfaceToken(IActivityManager.descriptor);
4327 data.writeString(packageName);
4328 data.writeInt(ask ? 1 : 0);
4329 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4330 reply.readException();
4331 reply.recycle();
4332 data.recycle();
4333 }
4334
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004335 public boolean switchUser(int userid) throws RemoteException {
4336 Parcel data = Parcel.obtain();
4337 Parcel reply = Parcel.obtain();
4338 data.writeInterfaceToken(IActivityManager.descriptor);
4339 data.writeInt(userid);
4340 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4341 reply.readException();
4342 boolean result = reply.readInt() != 0;
4343 reply.recycle();
4344 data.recycle();
4345 return result;
4346 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004347
Kenny Guy08488bf2014-02-21 17:40:37 +00004348 public boolean startUserInBackground(int userid) throws RemoteException {
4349 Parcel data = Parcel.obtain();
4350 Parcel reply = Parcel.obtain();
4351 data.writeInterfaceToken(IActivityManager.descriptor);
4352 data.writeInt(userid);
4353 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4354 reply.readException();
4355 boolean result = reply.readInt() != 0;
4356 reply.recycle();
4357 data.recycle();
4358 return result;
4359 }
4360
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004361 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4362 Parcel data = Parcel.obtain();
4363 Parcel reply = Parcel.obtain();
4364 data.writeInterfaceToken(IActivityManager.descriptor);
4365 data.writeInt(userid);
4366 data.writeStrongInterface(callback);
4367 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4368 reply.readException();
4369 int result = reply.readInt();
4370 reply.recycle();
4371 data.recycle();
4372 return result;
4373 }
4374
Amith Yamasani52f1d752012-03-28 18:19:29 -07004375 public UserInfo getCurrentUser() throws RemoteException {
4376 Parcel data = Parcel.obtain();
4377 Parcel reply = Parcel.obtain();
4378 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004379 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004380 reply.readException();
4381 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4382 reply.recycle();
4383 data.recycle();
4384 return userInfo;
4385 }
4386
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004387 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004388 Parcel data = Parcel.obtain();
4389 Parcel reply = Parcel.obtain();
4390 data.writeInterfaceToken(IActivityManager.descriptor);
4391 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004392 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004393 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4394 reply.readException();
4395 boolean result = reply.readInt() != 0;
4396 reply.recycle();
4397 data.recycle();
4398 return result;
4399 }
4400
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004401 public int[] getRunningUserIds() throws RemoteException {
4402 Parcel data = Parcel.obtain();
4403 Parcel reply = Parcel.obtain();
4404 data.writeInterfaceToken(IActivityManager.descriptor);
4405 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4406 reply.readException();
4407 int[] result = reply.createIntArray();
4408 reply.recycle();
4409 data.recycle();
4410 return result;
4411 }
4412
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004413 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4414 Parcel data = Parcel.obtain();
4415 Parcel reply = Parcel.obtain();
4416 data.writeInterfaceToken(IActivityManager.descriptor);
4417 data.writeInt(taskId);
4418 data.writeInt(subTaskIndex);
4419 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4420 reply.readException();
4421 boolean result = reply.readInt() != 0;
4422 reply.recycle();
4423 data.recycle();
4424 return result;
4425 }
4426
4427 public boolean removeTask(int taskId, int flags) throws RemoteException {
4428 Parcel data = Parcel.obtain();
4429 Parcel reply = Parcel.obtain();
4430 data.writeInterfaceToken(IActivityManager.descriptor);
4431 data.writeInt(taskId);
4432 data.writeInt(flags);
4433 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4434 reply.readException();
4435 boolean result = reply.readInt() != 0;
4436 reply.recycle();
4437 data.recycle();
4438 return result;
4439 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004440
Jeff Sharkeya4620792011-05-20 15:29:23 -07004441 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4442 Parcel data = Parcel.obtain();
4443 Parcel reply = Parcel.obtain();
4444 data.writeInterfaceToken(IActivityManager.descriptor);
4445 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4446 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4447 reply.readException();
4448 data.recycle();
4449 reply.recycle();
4450 }
4451
4452 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4453 Parcel data = Parcel.obtain();
4454 Parcel reply = Parcel.obtain();
4455 data.writeInterfaceToken(IActivityManager.descriptor);
4456 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4457 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4458 reply.readException();
4459 data.recycle();
4460 reply.recycle();
4461 }
4462
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004463 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4464 Parcel data = Parcel.obtain();
4465 Parcel reply = Parcel.obtain();
4466 data.writeInterfaceToken(IActivityManager.descriptor);
4467 data.writeStrongBinder(sender.asBinder());
4468 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4469 reply.readException();
4470 boolean res = reply.readInt() != 0;
4471 data.recycle();
4472 reply.recycle();
4473 return res;
4474 }
4475
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004476 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4477 Parcel data = Parcel.obtain();
4478 Parcel reply = Parcel.obtain();
4479 data.writeInterfaceToken(IActivityManager.descriptor);
4480 data.writeStrongBinder(sender.asBinder());
4481 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4482 reply.readException();
4483 boolean res = reply.readInt() != 0;
4484 data.recycle();
4485 reply.recycle();
4486 return res;
4487 }
4488
Dianne Hackborn81038902012-11-26 17:04:09 -08004489 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4490 Parcel data = Parcel.obtain();
4491 Parcel reply = Parcel.obtain();
4492 data.writeInterfaceToken(IActivityManager.descriptor);
4493 data.writeStrongBinder(sender.asBinder());
4494 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4495 reply.readException();
4496 Intent res = reply.readInt() != 0
4497 ? Intent.CREATOR.createFromParcel(reply) : null;
4498 data.recycle();
4499 reply.recycle();
4500 return res;
4501 }
4502
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004503 public String getTagForIntentSender(IIntentSender sender, String prefix)
4504 throws RemoteException {
4505 Parcel data = Parcel.obtain();
4506 Parcel reply = Parcel.obtain();
4507 data.writeInterfaceToken(IActivityManager.descriptor);
4508 data.writeStrongBinder(sender.asBinder());
4509 data.writeString(prefix);
4510 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4511 reply.readException();
4512 String res = reply.readString();
4513 data.recycle();
4514 reply.recycle();
4515 return res;
4516 }
4517
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004518 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4519 {
4520 Parcel data = Parcel.obtain();
4521 Parcel reply = Parcel.obtain();
4522 data.writeInterfaceToken(IActivityManager.descriptor);
4523 values.writeToParcel(data, 0);
4524 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4525 reply.readException();
4526 data.recycle();
4527 reply.recycle();
4528 }
4529
Dianne Hackbornb437e092011-08-05 17:50:29 -07004530 public long[] getProcessPss(int[] pids) throws RemoteException {
4531 Parcel data = Parcel.obtain();
4532 Parcel reply = Parcel.obtain();
4533 data.writeInterfaceToken(IActivityManager.descriptor);
4534 data.writeIntArray(pids);
4535 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4536 reply.readException();
4537 long[] res = reply.createLongArray();
4538 data.recycle();
4539 reply.recycle();
4540 return res;
4541 }
4542
Dianne Hackborn661cd522011-08-22 00:26:20 -07004543 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4544 Parcel data = Parcel.obtain();
4545 Parcel reply = Parcel.obtain();
4546 data.writeInterfaceToken(IActivityManager.descriptor);
4547 TextUtils.writeToParcel(msg, data, 0);
4548 data.writeInt(always ? 1 : 0);
4549 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4550 reply.readException();
4551 data.recycle();
4552 reply.recycle();
4553 }
4554
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004555 public void dismissKeyguardOnNextActivity() throws RemoteException {
4556 Parcel data = Parcel.obtain();
4557 Parcel reply = Parcel.obtain();
4558 data.writeInterfaceToken(IActivityManager.descriptor);
4559 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4560 reply.readException();
4561 data.recycle();
4562 reply.recycle();
4563 }
4564
Adam Powelldd8fab22012-03-22 17:47:27 -07004565 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4566 throws RemoteException {
4567 Parcel data = Parcel.obtain();
4568 Parcel reply = Parcel.obtain();
4569 data.writeInterfaceToken(IActivityManager.descriptor);
4570 data.writeStrongBinder(token);
4571 data.writeString(destAffinity);
4572 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4573 reply.readException();
4574 boolean result = reply.readInt() != 0;
4575 data.recycle();
4576 reply.recycle();
4577 return result;
4578 }
4579
4580 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4581 throws RemoteException {
4582 Parcel data = Parcel.obtain();
4583 Parcel reply = Parcel.obtain();
4584 data.writeInterfaceToken(IActivityManager.descriptor);
4585 data.writeStrongBinder(token);
4586 target.writeToParcel(data, 0);
4587 data.writeInt(resultCode);
4588 if (resultData != null) {
4589 data.writeInt(1);
4590 resultData.writeToParcel(data, 0);
4591 } else {
4592 data.writeInt(0);
4593 }
4594 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4595 reply.readException();
4596 boolean result = reply.readInt() != 0;
4597 data.recycle();
4598 reply.recycle();
4599 return result;
4600 }
4601
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004602 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4603 Parcel data = Parcel.obtain();
4604 Parcel reply = Parcel.obtain();
4605 data.writeInterfaceToken(IActivityManager.descriptor);
4606 data.writeStrongBinder(activityToken);
4607 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4608 reply.readException();
4609 int result = reply.readInt();
4610 data.recycle();
4611 reply.recycle();
4612 return result;
4613 }
4614
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004615 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4616 Parcel data = Parcel.obtain();
4617 Parcel reply = Parcel.obtain();
4618 data.writeInterfaceToken(IActivityManager.descriptor);
4619 data.writeStrongBinder(activityToken);
4620 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4621 reply.readException();
4622 String result = reply.readString();
4623 data.recycle();
4624 reply.recycle();
4625 return result;
4626 }
4627
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004628 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4629 Parcel data = Parcel.obtain();
4630 Parcel reply = Parcel.obtain();
4631 data.writeInterfaceToken(IActivityManager.descriptor);
4632 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4633 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4634 reply.readException();
4635 data.recycle();
4636 reply.recycle();
4637 }
4638
4639 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4640 Parcel data = Parcel.obtain();
4641 Parcel reply = Parcel.obtain();
4642 data.writeInterfaceToken(IActivityManager.descriptor);
4643 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4644 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4645 reply.readException();
4646 data.recycle();
4647 reply.recycle();
4648 }
4649
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004650 public void requestBugReport() throws RemoteException {
4651 Parcel data = Parcel.obtain();
4652 Parcel reply = Parcel.obtain();
4653 data.writeInterfaceToken(IActivityManager.descriptor);
4654 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4655 reply.readException();
4656 data.recycle();
4657 reply.recycle();
4658 }
4659
Jeff Brownbd181bb2013-09-10 16:44:24 -07004660 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4661 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004662 Parcel data = Parcel.obtain();
4663 Parcel reply = Parcel.obtain();
4664 data.writeInterfaceToken(IActivityManager.descriptor);
4665 data.writeInt(pid);
4666 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004667 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004668 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4669 reply.readException();
4670 long res = reply.readInt();
4671 data.recycle();
4672 reply.recycle();
4673 return res;
4674 }
4675
Adam Skorydfc7fd72013-08-05 19:23:41 -07004676 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004677 Parcel data = Parcel.obtain();
4678 Parcel reply = Parcel.obtain();
4679 data.writeInterfaceToken(IActivityManager.descriptor);
4680 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004681 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004682 reply.readException();
4683 Bundle res = reply.readBundle();
4684 data.recycle();
4685 reply.recycle();
4686 return res;
4687 }
4688
Adam Skory7140a252013-09-11 12:04:58 +01004689 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004690 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004691 Parcel data = Parcel.obtain();
4692 Parcel reply = Parcel.obtain();
4693 data.writeInterfaceToken(IActivityManager.descriptor);
4694 data.writeStrongBinder(token);
4695 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004696 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004697 reply.readException();
4698 data.recycle();
4699 reply.recycle();
4700 }
4701
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004702 public void killUid(int uid, String reason) throws RemoteException {
4703 Parcel data = Parcel.obtain();
4704 Parcel reply = Parcel.obtain();
4705 data.writeInterfaceToken(IActivityManager.descriptor);
4706 data.writeInt(uid);
4707 data.writeString(reason);
4708 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4709 reply.readException();
4710 data.recycle();
4711 reply.recycle();
4712 }
4713
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004714 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4715 Parcel data = Parcel.obtain();
4716 Parcel reply = Parcel.obtain();
4717 data.writeInterfaceToken(IActivityManager.descriptor);
4718 data.writeStrongBinder(who);
4719 data.writeInt(allowRestart ? 1 : 0);
4720 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4721 reply.readException();
4722 data.recycle();
4723 reply.recycle();
4724 }
4725
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004726 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4727 Parcel data = Parcel.obtain();
4728 Parcel reply = Parcel.obtain();
4729 data.writeInterfaceToken(IActivityManager.descriptor);
4730 data.writeStrongBinder(token);
4731 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4732 reply.readException();
4733 data.recycle();
4734 reply.recycle();
4735 }
4736
Craig Mautner5eda9b32013-07-02 11:58:16 -07004737 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4738 Parcel data = Parcel.obtain();
4739 Parcel reply = Parcel.obtain();
4740 data.writeInterfaceToken(IActivityManager.descriptor);
4741 data.writeStrongBinder(token);
4742 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4743 reply.readException();
4744 data.recycle();
4745 reply.recycle();
4746 }
4747
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004748 public void restart() throws RemoteException {
4749 Parcel data = Parcel.obtain();
4750 Parcel reply = Parcel.obtain();
4751 data.writeInterfaceToken(IActivityManager.descriptor);
4752 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4753 reply.readException();
4754 data.recycle();
4755 reply.recycle();
4756 }
4757
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004758 public void performIdleMaintenance() throws RemoteException {
4759 Parcel data = Parcel.obtain();
4760 Parcel reply = Parcel.obtain();
4761 data.writeInterfaceToken(IActivityManager.descriptor);
4762 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4763 reply.readException();
4764 data.recycle();
4765 reply.recycle();
4766 }
4767
Craig Mautner4a1cb222013-12-04 16:14:06 -08004768 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4769 IActivityContainerCallback callback) throws RemoteException {
4770 Parcel data = Parcel.obtain();
4771 Parcel reply = Parcel.obtain();
4772 data.writeInterfaceToken(IActivityManager.descriptor);
4773 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07004774 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08004775 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4776 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004777 final int result = reply.readInt();
4778 final IActivityContainer res;
4779 if (result == 1) {
4780 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4781 } else {
4782 res = null;
4783 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004784 data.recycle();
4785 reply.recycle();
4786 return res;
4787 }
4788
Craig Mautner95da1082014-02-24 17:54:35 -08004789 public void deleteActivityContainer(IActivityContainer activityContainer)
4790 throws RemoteException {
4791 Parcel data = Parcel.obtain();
4792 Parcel reply = Parcel.obtain();
4793 data.writeInterfaceToken(IActivityManager.descriptor);
4794 data.writeStrongBinder(activityContainer.asBinder());
4795 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4796 reply.readException();
4797 data.recycle();
4798 reply.recycle();
4799 }
4800
Craig Mautnere0a38842013-12-16 16:14:02 -08004801 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4802 throws RemoteException {
4803 Parcel data = Parcel.obtain();
4804 Parcel reply = Parcel.obtain();
4805 data.writeInterfaceToken(IActivityManager.descriptor);
4806 data.writeStrongBinder(activityToken);
4807 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4808 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004809 final int result = reply.readInt();
4810 final IActivityContainer res;
4811 if (result == 1) {
4812 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4813 } else {
4814 res = null;
4815 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004816 data.recycle();
4817 reply.recycle();
4818 return res;
4819 }
4820
Craig Mautner4a1cb222013-12-04 16:14:06 -08004821 public IBinder getHomeActivityToken() throws RemoteException {
4822 Parcel data = Parcel.obtain();
4823 Parcel reply = Parcel.obtain();
4824 data.writeInterfaceToken(IActivityManager.descriptor);
4825 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4826 reply.readException();
4827 IBinder res = reply.readStrongBinder();
4828 data.recycle();
4829 reply.recycle();
4830 return res;
4831 }
4832
Craig Mautneraea74a52014-03-08 14:23:10 -08004833 @Override
4834 public void startLockTaskMode(int taskId) throws RemoteException {
4835 Parcel data = Parcel.obtain();
4836 Parcel reply = Parcel.obtain();
4837 data.writeInterfaceToken(IActivityManager.descriptor);
4838 data.writeInt(taskId);
4839 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
4840 reply.readException();
4841 data.recycle();
4842 reply.recycle();
4843 }
4844
4845 @Override
4846 public void startLockTaskMode(IBinder token) throws RemoteException {
4847 Parcel data = Parcel.obtain();
4848 Parcel reply = Parcel.obtain();
4849 data.writeInterfaceToken(IActivityManager.descriptor);
4850 data.writeStrongBinder(token);
4851 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
4852 reply.readException();
4853 data.recycle();
4854 reply.recycle();
4855 }
4856
4857 @Override
4858 public void stopLockTaskMode() throws RemoteException {
4859 Parcel data = Parcel.obtain();
4860 Parcel reply = Parcel.obtain();
4861 data.writeInterfaceToken(IActivityManager.descriptor);
4862 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4863 reply.readException();
4864 data.recycle();
4865 reply.recycle();
4866 }
4867
4868 @Override
4869 public boolean isInLockTaskMode() throws RemoteException {
4870 Parcel data = Parcel.obtain();
4871 Parcel reply = Parcel.obtain();
4872 data.writeInterfaceToken(IActivityManager.descriptor);
4873 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4874 reply.readException();
4875 boolean isInLockTaskMode = reply.readInt() == 1;
4876 data.recycle();
4877 reply.recycle();
4878 return isInLockTaskMode;
4879 }
4880
Craig Mautner688b5102014-03-27 16:55:03 -07004881 @Override
Winson Chung03a9bae2014-05-02 09:56:12 -07004882 public void setRecentsActivityValues(IBinder token, ActivityManager.RecentsActivityValues values)
4883 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07004884 Parcel data = Parcel.obtain();
4885 Parcel reply = Parcel.obtain();
4886 data.writeInterfaceToken(IActivityManager.descriptor);
4887 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07004888 values.writeToParcel(data, 0);
4889 mRemote.transact(SET_RECENTS_ACTIVITY_VALUES_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07004890 reply.readException();
4891 data.recycle();
4892 reply.recycle();
4893 }
4894
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004895 private IBinder mRemote;
4896}