blob: fb70098d695975a41630e7acd5f9daa6b22b8271 [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;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080033import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.net.Uri;
35import android.os.Binder;
36import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070037import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.os.IBinder;
39import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070040import android.os.ParcelFileDescriptor;
41import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070042import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070043import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070045import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070046import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080049import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070050import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import java.util.ArrayList;
53import java.util.List;
54
55/** {@hide} */
56public abstract class ActivityManagerNative extends Binder implements IActivityManager
57{
58 /**
59 * Cast a Binder object into an activity manager interface, generating
60 * a proxy if needed.
61 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080062 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080063 if (obj == null) {
64 return null;
65 }
66 IActivityManager in =
67 (IActivityManager)obj.queryLocalInterface(descriptor);
68 if (in != null) {
69 return in;
70 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080071
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072 return new ActivityManagerProxy(obj);
73 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 /**
76 * Retrieve the system's default/global activity manager.
77 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080078 static public IActivityManager getDefault() {
79 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 }
81
82 /**
83 * Convenience for checking whether the system is ready. For internal use only.
84 */
85 static public boolean isSystemReady() {
86 if (!sSystemReady) {
87 sSystemReady = getDefault().testIsSystemReady();
88 }
89 return sSystemReady;
90 }
91 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080092
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 /**
94 * Convenience for sending a sticky broadcast. For internal use only.
95 * If you don't care about permission, use null.
96 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070097 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080098 try {
99 getDefault().broadcastIntent(
100 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800101 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 } catch (RemoteException ex) {
103 }
104 }
105
Dianne Hackborn099bc622014-01-22 13:39:16 -0800106 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800108 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 } catch (RemoteException ex) {
110 }
111 }
112
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800113 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800114 attachInterface(this, descriptor);
115 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700116
117 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
119 throws RemoteException {
120 switch (code) {
121 case START_ACTIVITY_TRANSACTION:
122 {
123 data.enforceInterface(IActivityManager.descriptor);
124 IBinder b = data.readStrongBinder();
125 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800126 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800127 Intent intent = Intent.CREATOR.createFromParcel(data);
128 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800130 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700132 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700133 String profileFile = data.readString();
134 ParcelFileDescriptor profileFd = data.readInt() != 0
135 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700136 Bundle options = data.readInt() != 0
137 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800138 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700139 resultTo, resultWho, requestCode, startFlags,
140 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800141 reply.writeNoException();
142 reply.writeInt(result);
143 return true;
144 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700145
Amith Yamasani82644082012-08-03 13:09:11 -0700146 case START_ACTIVITY_AS_USER_TRANSACTION:
147 {
148 data.enforceInterface(IActivityManager.descriptor);
149 IBinder b = data.readStrongBinder();
150 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800151 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700152 Intent intent = Intent.CREATOR.createFromParcel(data);
153 String resolvedType = data.readString();
154 IBinder resultTo = data.readStrongBinder();
155 String resultWho = data.readString();
156 int requestCode = data.readInt();
157 int startFlags = data.readInt();
158 String profileFile = data.readString();
159 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700160 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
163 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800164 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700165 resultTo, resultWho, requestCode, startFlags,
166 profileFile, profileFd, options, userId);
167 reply.writeNoException();
168 reply.writeInt(result);
169 return true;
170 }
171
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800172 case START_ACTIVITY_AND_WAIT_TRANSACTION:
173 {
174 data.enforceInterface(IActivityManager.descriptor);
175 IBinder b = data.readStrongBinder();
176 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800177 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800178 Intent intent = Intent.CREATOR.createFromParcel(data);
179 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800180 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800181 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800182 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700183 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700184 String profileFile = data.readString();
185 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700186 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700187 Bundle options = data.readInt() != 0
188 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700189 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800190 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700191 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700192 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800193 reply.writeNoException();
194 result.writeToParcel(reply, 0);
195 return true;
196 }
197
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700198 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
199 {
200 data.enforceInterface(IActivityManager.descriptor);
201 IBinder b = data.readStrongBinder();
202 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800203 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700204 Intent intent = Intent.CREATOR.createFromParcel(data);
205 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700206 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700207 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700208 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700209 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700210 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700211 Bundle options = data.readInt() != 0
212 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700213 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800214 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700215 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700216 reply.writeNoException();
217 reply.writeInt(result);
218 return true;
219 }
220
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700221 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700222 {
223 data.enforceInterface(IActivityManager.descriptor);
224 IBinder b = data.readStrongBinder();
225 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700226 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700227 Intent fillInIntent = null;
228 if (data.readInt() != 0) {
229 fillInIntent = Intent.CREATOR.createFromParcel(data);
230 }
231 String resolvedType = data.readString();
232 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700233 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700234 int requestCode = data.readInt();
235 int flagsMask = data.readInt();
236 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700237 Bundle options = data.readInt() != 0
238 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700239 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700240 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700241 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700242 reply.writeNoException();
243 reply.writeInt(result);
244 return true;
245 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700246
Dianne Hackborn91097de2014-04-04 18:02:06 -0700247 case START_VOICE_ACTIVITY_TRANSACTION:
248 {
249 data.enforceInterface(IActivityManager.descriptor);
250 String callingPackage = data.readString();
251 int callingPid = data.readInt();
252 int callingUid = data.readInt();
253 Intent intent = Intent.CREATOR.createFromParcel(data);
254 String resolvedType = data.readString();
255 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
256 data.readStrongBinder());
257 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
258 data.readStrongBinder());
259 int startFlags = data.readInt();
260 String profileFile = data.readString();
261 ParcelFileDescriptor profileFd = data.readInt() != 0
262 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
263 Bundle options = data.readInt() != 0
264 ? Bundle.CREATOR.createFromParcel(data) : null;
265 int userId = data.readInt();
266 int result = startVoiceActivity(callingPackage, callingPid, callingUid,
267 intent, resolvedType, session, interactor, startFlags,
268 profileFile, profileFd, options, userId);
269 reply.writeNoException();
270 reply.writeInt(result);
271 return true;
272 }
273
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800274 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
275 {
276 data.enforceInterface(IActivityManager.descriptor);
277 IBinder callingActivity = data.readStrongBinder();
278 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700279 Bundle options = data.readInt() != 0
280 ? Bundle.CREATOR.createFromParcel(data) : null;
281 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800282 reply.writeNoException();
283 reply.writeInt(result ? 1 : 0);
284 return true;
285 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700286
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800287 case FINISH_ACTIVITY_TRANSACTION: {
288 data.enforceInterface(IActivityManager.descriptor);
289 IBinder token = data.readStrongBinder();
290 Intent resultData = null;
291 int resultCode = data.readInt();
292 if (data.readInt() != 0) {
293 resultData = Intent.CREATOR.createFromParcel(data);
294 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700295 boolean finishTask = (data.readInt() != 0);
296 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800297 reply.writeNoException();
298 reply.writeInt(res ? 1 : 0);
299 return true;
300 }
301
302 case FINISH_SUB_ACTIVITY_TRANSACTION: {
303 data.enforceInterface(IActivityManager.descriptor);
304 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700305 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800306 int requestCode = data.readInt();
307 finishSubActivity(token, resultWho, requestCode);
308 reply.writeNoException();
309 return true;
310 }
311
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700312 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
313 data.enforceInterface(IActivityManager.descriptor);
314 IBinder token = data.readStrongBinder();
315 boolean res = finishActivityAffinity(token);
316 reply.writeNoException();
317 reply.writeInt(res ? 1 : 0);
318 return true;
319 }
320
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700321 case FINISH_VOICE_TASK_TRANSACTION: {
322 data.enforceInterface(IActivityManager.descriptor);
323 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
324 data.readStrongBinder());
325 finishVoiceTask(session);
326 reply.writeNoException();
327 return true;
328 }
329
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800330 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
331 data.enforceInterface(IActivityManager.descriptor);
332 IBinder token = data.readStrongBinder();
333 boolean res = willActivityBeVisible(token);
334 reply.writeNoException();
335 reply.writeInt(res ? 1 : 0);
336 return true;
337 }
338
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800339 case REGISTER_RECEIVER_TRANSACTION:
340 {
341 data.enforceInterface(IActivityManager.descriptor);
342 IBinder b = data.readStrongBinder();
343 IApplicationThread app =
344 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700345 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800346 b = data.readStrongBinder();
347 IIntentReceiver rec
348 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
349 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
350 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700351 int userId = data.readInt();
352 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800353 reply.writeNoException();
354 if (intent != null) {
355 reply.writeInt(1);
356 intent.writeToParcel(reply, 0);
357 } else {
358 reply.writeInt(0);
359 }
360 return true;
361 }
362
363 case UNREGISTER_RECEIVER_TRANSACTION:
364 {
365 data.enforceInterface(IActivityManager.descriptor);
366 IBinder b = data.readStrongBinder();
367 if (b == null) {
368 return true;
369 }
370 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
371 unregisterReceiver(rec);
372 reply.writeNoException();
373 return true;
374 }
375
376 case BROADCAST_INTENT_TRANSACTION:
377 {
378 data.enforceInterface(IActivityManager.descriptor);
379 IBinder b = data.readStrongBinder();
380 IApplicationThread app =
381 b != null ? ApplicationThreadNative.asInterface(b) : null;
382 Intent intent = Intent.CREATOR.createFromParcel(data);
383 String resolvedType = data.readString();
384 b = data.readStrongBinder();
385 IIntentReceiver resultTo =
386 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
387 int resultCode = data.readInt();
388 String resultData = data.readString();
389 Bundle resultExtras = data.readBundle();
390 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800391 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800392 boolean serialized = data.readInt() != 0;
393 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700394 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800395 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800396 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700397 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800398 reply.writeNoException();
399 reply.writeInt(res);
400 return true;
401 }
402
403 case UNBROADCAST_INTENT_TRANSACTION:
404 {
405 data.enforceInterface(IActivityManager.descriptor);
406 IBinder b = data.readStrongBinder();
407 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
408 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700409 int userId = data.readInt();
410 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800411 reply.writeNoException();
412 return true;
413 }
414
415 case FINISH_RECEIVER_TRANSACTION: {
416 data.enforceInterface(IActivityManager.descriptor);
417 IBinder who = data.readStrongBinder();
418 int resultCode = data.readInt();
419 String resultData = data.readString();
420 Bundle resultExtras = data.readBundle();
421 boolean resultAbort = data.readInt() != 0;
422 if (who != null) {
423 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
424 }
425 reply.writeNoException();
426 return true;
427 }
428
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800429 case ATTACH_APPLICATION_TRANSACTION: {
430 data.enforceInterface(IActivityManager.descriptor);
431 IApplicationThread app = ApplicationThreadNative.asInterface(
432 data.readStrongBinder());
433 if (app != null) {
434 attachApplication(app);
435 }
436 reply.writeNoException();
437 return true;
438 }
439
440 case ACTIVITY_IDLE_TRANSACTION: {
441 data.enforceInterface(IActivityManager.descriptor);
442 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700443 Configuration config = null;
444 if (data.readInt() != 0) {
445 config = Configuration.CREATOR.createFromParcel(data);
446 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700447 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800448 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700449 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800450 }
451 reply.writeNoException();
452 return true;
453 }
454
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700455 case ACTIVITY_RESUMED_TRANSACTION: {
456 data.enforceInterface(IActivityManager.descriptor);
457 IBinder token = data.readStrongBinder();
458 activityResumed(token);
459 reply.writeNoException();
460 return true;
461 }
462
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800463 case ACTIVITY_PAUSED_TRANSACTION: {
464 data.enforceInterface(IActivityManager.descriptor);
465 IBinder token = data.readStrongBinder();
Craig Mautnera0026042014-04-23 11:45:37 -0700466 PersistableBundle persistentState = data.readPersistableBundle();
467 activityPaused(token, persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800468 reply.writeNoException();
469 return true;
470 }
471
472 case ACTIVITY_STOPPED_TRANSACTION: {
473 data.enforceInterface(IActivityManager.descriptor);
474 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800475 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700476 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800477 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700478 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800479 reply.writeNoException();
480 return true;
481 }
482
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800483 case ACTIVITY_SLEPT_TRANSACTION: {
484 data.enforceInterface(IActivityManager.descriptor);
485 IBinder token = data.readStrongBinder();
486 activitySlept(token);
487 reply.writeNoException();
488 return true;
489 }
490
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800491 case ACTIVITY_DESTROYED_TRANSACTION: {
492 data.enforceInterface(IActivityManager.descriptor);
493 IBinder token = data.readStrongBinder();
494 activityDestroyed(token);
495 reply.writeNoException();
496 return true;
497 }
498
499 case GET_CALLING_PACKAGE_TRANSACTION: {
500 data.enforceInterface(IActivityManager.descriptor);
501 IBinder token = data.readStrongBinder();
502 String res = token != null ? getCallingPackage(token) : null;
503 reply.writeNoException();
504 reply.writeString(res);
505 return true;
506 }
507
508 case GET_CALLING_ACTIVITY_TRANSACTION: {
509 data.enforceInterface(IActivityManager.descriptor);
510 IBinder token = data.readStrongBinder();
511 ComponentName cn = getCallingActivity(token);
512 reply.writeNoException();
513 ComponentName.writeToParcel(cn, reply);
514 return true;
515 }
516
Winson Chung1147c402014-05-14 11:05:00 -0700517 case GET_APP_TASKS_TRANSACTION: {
518 data.enforceInterface(IActivityManager.descriptor);
519 List<IAppTask> list = getAppTasks();
520 reply.writeNoException();
521 int N = list != null ? list.size() : -1;
522 reply.writeInt(N);
523 int i;
524 for (i=0; i<N; i++) {
525 IAppTask task = list.get(i);
526 reply.writeStrongBinder(task.asBinder());
527 }
528 return true;
529 }
530
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800531 case GET_TASKS_TRANSACTION: {
532 data.enforceInterface(IActivityManager.descriptor);
533 int maxNum = data.readInt();
534 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700535 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800536 reply.writeNoException();
537 int N = list != null ? list.size() : -1;
538 reply.writeInt(N);
539 int i;
540 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700541 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800542 info.writeToParcel(reply, 0);
543 }
544 return true;
545 }
546
547 case GET_RECENT_TASKS_TRANSACTION: {
548 data.enforceInterface(IActivityManager.descriptor);
549 int maxNum = data.readInt();
550 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700551 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800552 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700553 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554 reply.writeNoException();
555 reply.writeTypedList(list);
556 return true;
557 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700558
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700559 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800560 data.enforceInterface(IActivityManager.descriptor);
561 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700562 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800563 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700564 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800565 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700566 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700567 } else {
568 reply.writeInt(0);
569 }
570 return true;
571 }
572
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800573 case GET_SERVICES_TRANSACTION: {
574 data.enforceInterface(IActivityManager.descriptor);
575 int maxNum = data.readInt();
576 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700577 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800578 reply.writeNoException();
579 int N = list != null ? list.size() : -1;
580 reply.writeInt(N);
581 int i;
582 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700583 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800584 info.writeToParcel(reply, 0);
585 }
586 return true;
587 }
588
589 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
590 data.enforceInterface(IActivityManager.descriptor);
591 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
592 reply.writeNoException();
593 reply.writeTypedList(list);
594 return true;
595 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700596
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800597 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
598 data.enforceInterface(IActivityManager.descriptor);
599 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
600 reply.writeNoException();
601 reply.writeTypedList(list);
602 return true;
603 }
604
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700605 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
606 data.enforceInterface(IActivityManager.descriptor);
607 List<ApplicationInfo> list = getRunningExternalApplications();
608 reply.writeNoException();
609 reply.writeTypedList(list);
610 return true;
611 }
612
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800613 case MOVE_TASK_TO_FRONT_TRANSACTION: {
614 data.enforceInterface(IActivityManager.descriptor);
615 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800616 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700617 Bundle options = data.readInt() != 0
618 ? Bundle.CREATOR.createFromParcel(data) : null;
619 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800620 reply.writeNoException();
621 return true;
622 }
623
624 case MOVE_TASK_TO_BACK_TRANSACTION: {
625 data.enforceInterface(IActivityManager.descriptor);
626 int task = data.readInt();
627 moveTaskToBack(task);
628 reply.writeNoException();
629 return true;
630 }
631
632 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
633 data.enforceInterface(IActivityManager.descriptor);
634 IBinder token = data.readStrongBinder();
635 boolean nonRoot = data.readInt() != 0;
636 boolean res = moveActivityTaskToBack(token, nonRoot);
637 reply.writeNoException();
638 reply.writeInt(res ? 1 : 0);
639 return true;
640 }
641
642 case MOVE_TASK_BACKWARDS_TRANSACTION: {
643 data.enforceInterface(IActivityManager.descriptor);
644 int task = data.readInt();
645 moveTaskBackwards(task);
646 reply.writeNoException();
647 return true;
648 }
649
Craig Mautnerc00204b2013-03-05 15:02:14 -0800650 case MOVE_TASK_TO_STACK_TRANSACTION: {
651 data.enforceInterface(IActivityManager.descriptor);
652 int taskId = data.readInt();
653 int stackId = data.readInt();
654 boolean toTop = data.readInt() != 0;
655 moveTaskToStack(taskId, stackId, toTop);
656 reply.writeNoException();
657 return true;
658 }
659
660 case RESIZE_STACK_TRANSACTION: {
661 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800662 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800663 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800664 Rect r = Rect.CREATOR.createFromParcel(data);
665 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800666 reply.writeNoException();
667 return true;
668 }
669
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800670 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700671 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800672 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700673 reply.writeNoException();
674 reply.writeTypedList(list);
675 return true;
676 }
677
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800678 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700679 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800680 int stackId = data.readInt();
681 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700682 reply.writeNoException();
683 if (info != null) {
684 reply.writeInt(1);
685 info.writeToParcel(reply, 0);
686 } else {
687 reply.writeInt(0);
688 }
689 return true;
690 }
691
Winson Chung303e1ff2014-03-07 15:06:19 -0800692 case IS_IN_HOME_STACK_TRANSACTION: {
693 data.enforceInterface(IActivityManager.descriptor);
694 int taskId = data.readInt();
695 boolean isInHomeStack = isInHomeStack(taskId);
696 reply.writeNoException();
697 reply.writeInt(isInHomeStack ? 1 : 0);
698 return true;
699 }
700
Craig Mautnercf910b02013-04-23 11:23:27 -0700701 case SET_FOCUSED_STACK_TRANSACTION: {
702 data.enforceInterface(IActivityManager.descriptor);
703 int stackId = data.readInt();
704 setFocusedStack(stackId);
705 reply.writeNoException();
706 return true;
707 }
708
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800709 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
710 data.enforceInterface(IActivityManager.descriptor);
711 IBinder token = data.readStrongBinder();
712 boolean onlyRoot = data.readInt() != 0;
713 int res = token != null
714 ? getTaskForActivity(token, onlyRoot) : -1;
715 reply.writeNoException();
716 reply.writeInt(res);
717 return true;
718 }
719
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800720 case GET_CONTENT_PROVIDER_TRANSACTION: {
721 data.enforceInterface(IActivityManager.descriptor);
722 IBinder b = data.readStrongBinder();
723 IApplicationThread app = ApplicationThreadNative.asInterface(b);
724 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700725 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700726 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700727 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800728 reply.writeNoException();
729 if (cph != null) {
730 reply.writeInt(1);
731 cph.writeToParcel(reply, 0);
732 } else {
733 reply.writeInt(0);
734 }
735 return true;
736 }
737
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800738 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
739 data.enforceInterface(IActivityManager.descriptor);
740 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700741 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800742 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700743 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800744 reply.writeNoException();
745 if (cph != null) {
746 reply.writeInt(1);
747 cph.writeToParcel(reply, 0);
748 } else {
749 reply.writeInt(0);
750 }
751 return true;
752 }
753
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800754 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
755 data.enforceInterface(IActivityManager.descriptor);
756 IBinder b = data.readStrongBinder();
757 IApplicationThread app = ApplicationThreadNative.asInterface(b);
758 ArrayList<ContentProviderHolder> providers =
759 data.createTypedArrayList(ContentProviderHolder.CREATOR);
760 publishContentProviders(app, providers);
761 reply.writeNoException();
762 return true;
763 }
764
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700765 case REF_CONTENT_PROVIDER_TRANSACTION: {
766 data.enforceInterface(IActivityManager.descriptor);
767 IBinder b = data.readStrongBinder();
768 int stable = data.readInt();
769 int unstable = data.readInt();
770 boolean res = refContentProvider(b, stable, unstable);
771 reply.writeNoException();
772 reply.writeInt(res ? 1 : 0);
773 return true;
774 }
775
776 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
777 data.enforceInterface(IActivityManager.descriptor);
778 IBinder b = data.readStrongBinder();
779 unstableProviderDied(b);
780 reply.writeNoException();
781 return true;
782 }
783
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700784 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
785 data.enforceInterface(IActivityManager.descriptor);
786 IBinder b = data.readStrongBinder();
787 appNotRespondingViaProvider(b);
788 reply.writeNoException();
789 return true;
790 }
791
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800792 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
793 data.enforceInterface(IActivityManager.descriptor);
794 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700795 boolean stable = data.readInt() != 0;
796 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800797 reply.writeNoException();
798 return true;
799 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800800
801 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
802 data.enforceInterface(IActivityManager.descriptor);
803 String name = data.readString();
804 IBinder token = data.readStrongBinder();
805 removeContentProviderExternal(name, token);
806 reply.writeNoException();
807 return true;
808 }
809
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700810 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
811 data.enforceInterface(IActivityManager.descriptor);
812 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
813 PendingIntent pi = getRunningServiceControlPanel(comp);
814 reply.writeNoException();
815 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
816 return true;
817 }
818
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800819 case START_SERVICE_TRANSACTION: {
820 data.enforceInterface(IActivityManager.descriptor);
821 IBinder b = data.readStrongBinder();
822 IApplicationThread app = ApplicationThreadNative.asInterface(b);
823 Intent service = Intent.CREATOR.createFromParcel(data);
824 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700825 int userId = data.readInt();
826 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800827 reply.writeNoException();
828 ComponentName.writeToParcel(cn, reply);
829 return true;
830 }
831
832 case STOP_SERVICE_TRANSACTION: {
833 data.enforceInterface(IActivityManager.descriptor);
834 IBinder b = data.readStrongBinder();
835 IApplicationThread app = ApplicationThreadNative.asInterface(b);
836 Intent service = Intent.CREATOR.createFromParcel(data);
837 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700838 int userId = data.readInt();
839 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800840 reply.writeNoException();
841 reply.writeInt(res);
842 return true;
843 }
844
845 case STOP_SERVICE_TOKEN_TRANSACTION: {
846 data.enforceInterface(IActivityManager.descriptor);
847 ComponentName className = ComponentName.readFromParcel(data);
848 IBinder token = data.readStrongBinder();
849 int startId = data.readInt();
850 boolean res = stopServiceToken(className, token, startId);
851 reply.writeNoException();
852 reply.writeInt(res ? 1 : 0);
853 return true;
854 }
855
856 case SET_SERVICE_FOREGROUND_TRANSACTION: {
857 data.enforceInterface(IActivityManager.descriptor);
858 ComponentName className = ComponentName.readFromParcel(data);
859 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700860 int id = data.readInt();
861 Notification notification = null;
862 if (data.readInt() != 0) {
863 notification = Notification.CREATOR.createFromParcel(data);
864 }
865 boolean removeNotification = data.readInt() != 0;
866 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800867 reply.writeNoException();
868 return true;
869 }
870
871 case BIND_SERVICE_TRANSACTION: {
872 data.enforceInterface(IActivityManager.descriptor);
873 IBinder b = data.readStrongBinder();
874 IApplicationThread app = ApplicationThreadNative.asInterface(b);
875 IBinder token = data.readStrongBinder();
876 Intent service = Intent.CREATOR.createFromParcel(data);
877 String resolvedType = data.readString();
878 b = data.readStrongBinder();
879 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800880 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800881 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800882 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800883 reply.writeNoException();
884 reply.writeInt(res);
885 return true;
886 }
887
888 case UNBIND_SERVICE_TRANSACTION: {
889 data.enforceInterface(IActivityManager.descriptor);
890 IBinder b = data.readStrongBinder();
891 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
892 boolean res = unbindService(conn);
893 reply.writeNoException();
894 reply.writeInt(res ? 1 : 0);
895 return true;
896 }
897
898 case PUBLISH_SERVICE_TRANSACTION: {
899 data.enforceInterface(IActivityManager.descriptor);
900 IBinder token = data.readStrongBinder();
901 Intent intent = Intent.CREATOR.createFromParcel(data);
902 IBinder service = data.readStrongBinder();
903 publishService(token, intent, service);
904 reply.writeNoException();
905 return true;
906 }
907
908 case UNBIND_FINISHED_TRANSACTION: {
909 data.enforceInterface(IActivityManager.descriptor);
910 IBinder token = data.readStrongBinder();
911 Intent intent = Intent.CREATOR.createFromParcel(data);
912 boolean doRebind = data.readInt() != 0;
913 unbindFinished(token, intent, doRebind);
914 reply.writeNoException();
915 return true;
916 }
917
918 case SERVICE_DONE_EXECUTING_TRANSACTION: {
919 data.enforceInterface(IActivityManager.descriptor);
920 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700921 int type = data.readInt();
922 int startId = data.readInt();
923 int res = data.readInt();
924 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800925 reply.writeNoException();
926 return true;
927 }
928
929 case START_INSTRUMENTATION_TRANSACTION: {
930 data.enforceInterface(IActivityManager.descriptor);
931 ComponentName className = ComponentName.readFromParcel(data);
932 String profileFile = data.readString();
933 int fl = data.readInt();
934 Bundle arguments = data.readBundle();
935 IBinder b = data.readStrongBinder();
936 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800937 b = data.readStrongBinder();
938 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700939 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +0100940 String abiOverride = data.readString();
941 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
942 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800943 reply.writeNoException();
944 reply.writeInt(res ? 1 : 0);
945 return true;
946 }
947
948
949 case FINISH_INSTRUMENTATION_TRANSACTION: {
950 data.enforceInterface(IActivityManager.descriptor);
951 IBinder b = data.readStrongBinder();
952 IApplicationThread app = ApplicationThreadNative.asInterface(b);
953 int resultCode = data.readInt();
954 Bundle results = data.readBundle();
955 finishInstrumentation(app, resultCode, results);
956 reply.writeNoException();
957 return true;
958 }
959
960 case GET_CONFIGURATION_TRANSACTION: {
961 data.enforceInterface(IActivityManager.descriptor);
962 Configuration config = getConfiguration();
963 reply.writeNoException();
964 config.writeToParcel(reply, 0);
965 return true;
966 }
967
968 case UPDATE_CONFIGURATION_TRANSACTION: {
969 data.enforceInterface(IActivityManager.descriptor);
970 Configuration config = Configuration.CREATOR.createFromParcel(data);
971 updateConfiguration(config);
972 reply.writeNoException();
973 return true;
974 }
975
976 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
977 data.enforceInterface(IActivityManager.descriptor);
978 IBinder token = data.readStrongBinder();
979 int requestedOrientation = data.readInt();
980 setRequestedOrientation(token, requestedOrientation);
981 reply.writeNoException();
982 return true;
983 }
984
985 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
986 data.enforceInterface(IActivityManager.descriptor);
987 IBinder token = data.readStrongBinder();
988 int req = getRequestedOrientation(token);
989 reply.writeNoException();
990 reply.writeInt(req);
991 return true;
992 }
993
994 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
995 data.enforceInterface(IActivityManager.descriptor);
996 IBinder token = data.readStrongBinder();
997 ComponentName cn = getActivityClassForToken(token);
998 reply.writeNoException();
999 ComponentName.writeToParcel(cn, reply);
1000 return true;
1001 }
1002
1003 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1004 data.enforceInterface(IActivityManager.descriptor);
1005 IBinder token = data.readStrongBinder();
1006 reply.writeNoException();
1007 reply.writeString(getPackageForToken(token));
1008 return true;
1009 }
1010
1011 case GET_INTENT_SENDER_TRANSACTION: {
1012 data.enforceInterface(IActivityManager.descriptor);
1013 int type = data.readInt();
1014 String packageName = data.readString();
1015 IBinder token = data.readStrongBinder();
1016 String resultWho = data.readString();
1017 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001018 Intent[] requestIntents;
1019 String[] requestResolvedTypes;
1020 if (data.readInt() != 0) {
1021 requestIntents = data.createTypedArray(Intent.CREATOR);
1022 requestResolvedTypes = data.createStringArray();
1023 } else {
1024 requestIntents = null;
1025 requestResolvedTypes = null;
1026 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001027 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001028 Bundle options = data.readInt() != 0
1029 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001030 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001031 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001032 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001033 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001034 reply.writeNoException();
1035 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1036 return true;
1037 }
1038
1039 case CANCEL_INTENT_SENDER_TRANSACTION: {
1040 data.enforceInterface(IActivityManager.descriptor);
1041 IIntentSender r = IIntentSender.Stub.asInterface(
1042 data.readStrongBinder());
1043 cancelIntentSender(r);
1044 reply.writeNoException();
1045 return true;
1046 }
1047
1048 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1049 data.enforceInterface(IActivityManager.descriptor);
1050 IIntentSender r = IIntentSender.Stub.asInterface(
1051 data.readStrongBinder());
1052 String res = getPackageForIntentSender(r);
1053 reply.writeNoException();
1054 reply.writeString(res);
1055 return true;
1056 }
1057
Christopher Tatec4a07d12012-04-06 14:19:13 -07001058 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1059 data.enforceInterface(IActivityManager.descriptor);
1060 IIntentSender r = IIntentSender.Stub.asInterface(
1061 data.readStrongBinder());
1062 int res = getUidForIntentSender(r);
1063 reply.writeNoException();
1064 reply.writeInt(res);
1065 return true;
1066 }
1067
Dianne Hackborn41203752012-08-31 14:05:51 -07001068 case HANDLE_INCOMING_USER_TRANSACTION: {
1069 data.enforceInterface(IActivityManager.descriptor);
1070 int callingPid = data.readInt();
1071 int callingUid = data.readInt();
1072 int userId = data.readInt();
1073 boolean allowAll = data.readInt() != 0 ;
1074 boolean requireFull = data.readInt() != 0;
1075 String name = data.readString();
1076 String callerPackage = data.readString();
1077 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1078 requireFull, name, callerPackage);
1079 reply.writeNoException();
1080 reply.writeInt(res);
1081 return true;
1082 }
1083
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001084 case SET_PROCESS_LIMIT_TRANSACTION: {
1085 data.enforceInterface(IActivityManager.descriptor);
1086 int max = data.readInt();
1087 setProcessLimit(max);
1088 reply.writeNoException();
1089 return true;
1090 }
1091
1092 case GET_PROCESS_LIMIT_TRANSACTION: {
1093 data.enforceInterface(IActivityManager.descriptor);
1094 int limit = getProcessLimit();
1095 reply.writeNoException();
1096 reply.writeInt(limit);
1097 return true;
1098 }
1099
1100 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1101 data.enforceInterface(IActivityManager.descriptor);
1102 IBinder token = data.readStrongBinder();
1103 int pid = data.readInt();
1104 boolean isForeground = data.readInt() != 0;
1105 setProcessForeground(token, pid, isForeground);
1106 reply.writeNoException();
1107 return true;
1108 }
1109
1110 case CHECK_PERMISSION_TRANSACTION: {
1111 data.enforceInterface(IActivityManager.descriptor);
1112 String perm = data.readString();
1113 int pid = data.readInt();
1114 int uid = data.readInt();
1115 int res = checkPermission(perm, pid, uid);
1116 reply.writeNoException();
1117 reply.writeInt(res);
1118 return true;
1119 }
1120
1121 case CHECK_URI_PERMISSION_TRANSACTION: {
1122 data.enforceInterface(IActivityManager.descriptor);
1123 Uri uri = Uri.CREATOR.createFromParcel(data);
1124 int pid = data.readInt();
1125 int uid = data.readInt();
1126 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001127 int userId = data.readInt();
1128 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001129 reply.writeNoException();
1130 reply.writeInt(res);
1131 return true;
1132 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001133
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001134 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001135 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001136 String packageName = data.readString();
1137 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1138 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001139 int userId = data.readInt();
1140 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001141 reply.writeNoException();
1142 reply.writeInt(res ? 1 : 0);
1143 return true;
1144 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001145
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001146 case GRANT_URI_PERMISSION_TRANSACTION: {
1147 data.enforceInterface(IActivityManager.descriptor);
1148 IBinder b = data.readStrongBinder();
1149 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1150 String targetPkg = data.readString();
1151 Uri uri = Uri.CREATOR.createFromParcel(data);
1152 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001153 int userId = data.readInt();
1154 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001155 reply.writeNoException();
1156 return true;
1157 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001158
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001159 case REVOKE_URI_PERMISSION_TRANSACTION: {
1160 data.enforceInterface(IActivityManager.descriptor);
1161 IBinder b = data.readStrongBinder();
1162 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1163 Uri uri = Uri.CREATOR.createFromParcel(data);
1164 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001165 int userId = data.readInt();
1166 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001167 reply.writeNoException();
1168 return true;
1169 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001170
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001171 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1172 data.enforceInterface(IActivityManager.descriptor);
1173 Uri uri = Uri.CREATOR.createFromParcel(data);
1174 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001175 int userId = data.readInt();
1176 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001177 reply.writeNoException();
1178 return true;
1179 }
1180
1181 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1182 data.enforceInterface(IActivityManager.descriptor);
1183 Uri uri = Uri.CREATOR.createFromParcel(data);
1184 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001185 int userId = data.readInt();
1186 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001187 reply.writeNoException();
1188 return true;
1189 }
1190
1191 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1192 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001193 final String packageName = data.readString();
1194 final boolean incoming = data.readInt() != 0;
1195 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1196 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001197 reply.writeNoException();
1198 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1199 return true;
1200 }
1201
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001202 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1203 data.enforceInterface(IActivityManager.descriptor);
1204 IBinder b = data.readStrongBinder();
1205 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1206 boolean waiting = data.readInt() != 0;
1207 showWaitingForDebugger(app, waiting);
1208 reply.writeNoException();
1209 return true;
1210 }
1211
1212 case GET_MEMORY_INFO_TRANSACTION: {
1213 data.enforceInterface(IActivityManager.descriptor);
1214 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1215 getMemoryInfo(mi);
1216 reply.writeNoException();
1217 mi.writeToParcel(reply, 0);
1218 return true;
1219 }
1220
1221 case UNHANDLED_BACK_TRANSACTION: {
1222 data.enforceInterface(IActivityManager.descriptor);
1223 unhandledBack();
1224 reply.writeNoException();
1225 return true;
1226 }
1227
1228 case OPEN_CONTENT_URI_TRANSACTION: {
1229 data.enforceInterface(IActivityManager.descriptor);
1230 Uri uri = Uri.parse(data.readString());
1231 ParcelFileDescriptor pfd = openContentUri(uri);
1232 reply.writeNoException();
1233 if (pfd != null) {
1234 reply.writeInt(1);
1235 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1236 } else {
1237 reply.writeInt(0);
1238 }
1239 return true;
1240 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001241
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001242 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1243 data.enforceInterface(IActivityManager.descriptor);
1244 setLockScreenShown(data.readInt() != 0);
1245 reply.writeNoException();
1246 return true;
1247 }
1248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001249 case SET_DEBUG_APP_TRANSACTION: {
1250 data.enforceInterface(IActivityManager.descriptor);
1251 String pn = data.readString();
1252 boolean wfd = data.readInt() != 0;
1253 boolean per = data.readInt() != 0;
1254 setDebugApp(pn, wfd, per);
1255 reply.writeNoException();
1256 return true;
1257 }
1258
1259 case SET_ALWAYS_FINISH_TRANSACTION: {
1260 data.enforceInterface(IActivityManager.descriptor);
1261 boolean enabled = data.readInt() != 0;
1262 setAlwaysFinish(enabled);
1263 reply.writeNoException();
1264 return true;
1265 }
1266
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001267 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001268 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001269 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001270 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001271 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001272 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001273 return true;
1274 }
1275
1276 case ENTER_SAFE_MODE_TRANSACTION: {
1277 data.enforceInterface(IActivityManager.descriptor);
1278 enterSafeMode();
1279 reply.writeNoException();
1280 return true;
1281 }
1282
1283 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1284 data.enforceInterface(IActivityManager.descriptor);
1285 IIntentSender is = IIntentSender.Stub.asInterface(
1286 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001287 int sourceUid = data.readInt();
1288 String sourcePkg = data.readString();
1289 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001290 reply.writeNoException();
1291 return true;
1292 }
1293
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001294 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001295 data.enforceInterface(IActivityManager.descriptor);
1296 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001297 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001298 boolean secure = data.readInt() != 0;
1299 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001300 reply.writeNoException();
1301 reply.writeInt(res ? 1 : 0);
1302 return true;
1303 }
1304
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001305 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1306 data.enforceInterface(IActivityManager.descriptor);
1307 String reason = data.readString();
1308 boolean res = killProcessesBelowForeground(reason);
1309 reply.writeNoException();
1310 reply.writeInt(res ? 1 : 0);
1311 return true;
1312 }
1313
Dan Egnor60d87622009-12-16 16:32:58 -08001314 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1315 data.enforceInterface(IActivityManager.descriptor);
1316 IBinder app = data.readStrongBinder();
1317 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1318 handleApplicationCrash(app, ci);
1319 reply.writeNoException();
1320 return true;
1321 }
1322
1323 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001324 data.enforceInterface(IActivityManager.descriptor);
1325 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001326 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001327 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001328 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001329 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001330 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001331 return true;
1332 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001333
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001334 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1335 data.enforceInterface(IActivityManager.descriptor);
1336 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001337 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001338 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1339 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001340 reply.writeNoException();
1341 return true;
1342 }
1343
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001344 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1345 data.enforceInterface(IActivityManager.descriptor);
1346 int sig = data.readInt();
1347 signalPersistentProcesses(sig);
1348 reply.writeNoException();
1349 return true;
1350 }
1351
Dianne Hackborn03abb812010-01-04 18:43:19 -08001352 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1353 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001354 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001355 int userId = data.readInt();
1356 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001357 reply.writeNoException();
1358 return true;
1359 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001360
1361 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1362 data.enforceInterface(IActivityManager.descriptor);
1363 killAllBackgroundProcesses();
1364 reply.writeNoException();
1365 return true;
1366 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001367
Dianne Hackborn03abb812010-01-04 18:43:19 -08001368 case FORCE_STOP_PACKAGE_TRANSACTION: {
1369 data.enforceInterface(IActivityManager.descriptor);
1370 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001371 int userId = data.readInt();
1372 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001373 reply.writeNoException();
1374 return true;
1375 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001376
1377 case GET_MY_MEMORY_STATE_TRANSACTION: {
1378 data.enforceInterface(IActivityManager.descriptor);
1379 ActivityManager.RunningAppProcessInfo info =
1380 new ActivityManager.RunningAppProcessInfo();
1381 getMyMemoryState(info);
1382 reply.writeNoException();
1383 info.writeToParcel(reply, 0);
1384 return true;
1385 }
1386
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001387 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1388 data.enforceInterface(IActivityManager.descriptor);
1389 ConfigurationInfo config = getDeviceConfigurationInfo();
1390 reply.writeNoException();
1391 config.writeToParcel(reply, 0);
1392 return true;
1393 }
1394
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001395 case PROFILE_CONTROL_TRANSACTION: {
1396 data.enforceInterface(IActivityManager.descriptor);
1397 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001398 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001399 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001400 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001401 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001402 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001403 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001404 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001405 reply.writeNoException();
1406 reply.writeInt(res ? 1 : 0);
1407 return true;
1408 }
1409
Dianne Hackborn55280a92009-05-07 15:53:46 -07001410 case SHUTDOWN_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 boolean res = shutdown(data.readInt());
1413 reply.writeNoException();
1414 reply.writeInt(res ? 1 : 0);
1415 return true;
1416 }
1417
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001418 case STOP_APP_SWITCHES_TRANSACTION: {
1419 data.enforceInterface(IActivityManager.descriptor);
1420 stopAppSwitches();
1421 reply.writeNoException();
1422 return true;
1423 }
1424
1425 case RESUME_APP_SWITCHES_TRANSACTION: {
1426 data.enforceInterface(IActivityManager.descriptor);
1427 resumeAppSwitches();
1428 reply.writeNoException();
1429 return true;
1430 }
1431
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001432 case PEEK_SERVICE_TRANSACTION: {
1433 data.enforceInterface(IActivityManager.descriptor);
1434 Intent service = Intent.CREATOR.createFromParcel(data);
1435 String resolvedType = data.readString();
1436 IBinder binder = peekService(service, resolvedType);
1437 reply.writeNoException();
1438 reply.writeStrongBinder(binder);
1439 return true;
1440 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001441
1442 case START_BACKUP_AGENT_TRANSACTION: {
1443 data.enforceInterface(IActivityManager.descriptor);
1444 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1445 int backupRestoreMode = data.readInt();
1446 boolean success = bindBackupAgent(info, backupRestoreMode);
1447 reply.writeNoException();
1448 reply.writeInt(success ? 1 : 0);
1449 return true;
1450 }
1451
1452 case BACKUP_AGENT_CREATED_TRANSACTION: {
1453 data.enforceInterface(IActivityManager.descriptor);
1454 String packageName = data.readString();
1455 IBinder agent = data.readStrongBinder();
1456 backupAgentCreated(packageName, agent);
1457 reply.writeNoException();
1458 return true;
1459 }
1460
1461 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1462 data.enforceInterface(IActivityManager.descriptor);
1463 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1464 unbindBackupAgent(info);
1465 reply.writeNoException();
1466 return true;
1467 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001468
1469 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1470 data.enforceInterface(IActivityManager.descriptor);
1471 String packageName = data.readString();
1472 addPackageDependency(packageName);
1473 reply.writeNoException();
1474 return true;
1475 }
1476
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001477 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001478 data.enforceInterface(IActivityManager.descriptor);
1479 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001480 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001481 String reason = data.readString();
1482 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001483 reply.writeNoException();
1484 return true;
1485 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001486
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001487 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1488 data.enforceInterface(IActivityManager.descriptor);
1489 String reason = data.readString();
1490 closeSystemDialogs(reason);
1491 reply.writeNoException();
1492 return true;
1493 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001494
1495 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1496 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001497 int[] pids = data.createIntArray();
1498 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001499 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001500 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001501 return true;
1502 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001503
1504 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1505 data.enforceInterface(IActivityManager.descriptor);
1506 String processName = data.readString();
1507 int uid = data.readInt();
1508 killApplicationProcess(processName, uid);
1509 reply.writeNoException();
1510 return true;
1511 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001512
1513 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1514 data.enforceInterface(IActivityManager.descriptor);
1515 IBinder token = data.readStrongBinder();
1516 String packageName = data.readString();
1517 int enterAnim = data.readInt();
1518 int exitAnim = data.readInt();
1519 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001520 reply.writeNoException();
1521 return true;
1522 }
1523
1524 case IS_USER_A_MONKEY_TRANSACTION: {
1525 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001526 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001527 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001528 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001529 return true;
1530 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001531
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001532 case SET_USER_IS_MONKEY_TRANSACTION: {
1533 data.enforceInterface(IActivityManager.descriptor);
1534 final boolean monkey = (data.readInt() == 1);
1535 setUserIsMonkey(monkey);
1536 reply.writeNoException();
1537 return true;
1538 }
1539
Dianne Hackborn860755f2010-06-03 18:47:52 -07001540 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1541 data.enforceInterface(IActivityManager.descriptor);
1542 finishHeavyWeightApp();
1543 reply.writeNoException();
1544 return true;
1545 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001546
1547 case IS_IMMERSIVE_TRANSACTION: {
1548 data.enforceInterface(IActivityManager.descriptor);
1549 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001550 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001551 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001552 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001553 return true;
1554 }
1555
Craig Mautnerd61dc202014-07-07 11:09:11 -07001556 case IS_TOP_OF_TASK_TRANSACTION: {
1557 data.enforceInterface(IActivityManager.descriptor);
1558 IBinder token = data.readStrongBinder();
1559 final boolean isTopOfTask = isTopOfTask(token);
1560 reply.writeNoException();
1561 reply.writeInt(isTopOfTask ? 1 : 0);
1562 return true;
1563 }
1564
Craig Mautner5eda9b32013-07-02 11:58:16 -07001565 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001566 data.enforceInterface(IActivityManager.descriptor);
1567 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001568 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001569 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001570 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001571 return true;
1572 }
1573
1574 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1575 data.enforceInterface(IActivityManager.descriptor);
1576 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001577 final Bundle bundle;
1578 if (data.readInt() == 0) {
1579 bundle = null;
1580 } else {
1581 bundle = data.readBundle();
1582 }
1583 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1584 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001585 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001586 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001587 return true;
1588 }
1589
Craig Mautner233ceee2014-05-09 17:05:11 -07001590 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1591 data.enforceInterface(IActivityManager.descriptor);
1592 IBinder token = data.readStrongBinder();
1593 final ActivityOptions options = getActivityOptions(token);
1594 reply.writeNoException();
1595 reply.writeBundle(options == null ? null : options.toBundle());
1596 return true;
1597 }
1598
Daniel Sandler69a48172010-06-23 16:29:36 -04001599 case SET_IMMERSIVE_TRANSACTION: {
1600 data.enforceInterface(IActivityManager.descriptor);
1601 IBinder token = data.readStrongBinder();
1602 boolean imm = data.readInt() == 1;
1603 setImmersive(token, imm);
1604 reply.writeNoException();
1605 return true;
1606 }
1607
1608 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1609 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001610 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001611 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001612 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001613 return true;
1614 }
1615
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001616 case CRASH_APPLICATION_TRANSACTION: {
1617 data.enforceInterface(IActivityManager.descriptor);
1618 int uid = data.readInt();
1619 int initialPid = data.readInt();
1620 String packageName = data.readString();
1621 String message = data.readString();
1622 crashApplication(uid, initialPid, packageName, message);
1623 reply.writeNoException();
1624 return true;
1625 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001626
1627 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1628 data.enforceInterface(IActivityManager.descriptor);
1629 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001630 int userId = data.readInt();
1631 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001632 reply.writeNoException();
1633 reply.writeString(type);
1634 return true;
1635 }
1636
Dianne Hackborn7e269642010-08-25 19:50:20 -07001637 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1638 data.enforceInterface(IActivityManager.descriptor);
1639 String name = data.readString();
1640 IBinder perm = newUriPermissionOwner(name);
1641 reply.writeNoException();
1642 reply.writeStrongBinder(perm);
1643 return true;
1644 }
1645
1646 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1647 data.enforceInterface(IActivityManager.descriptor);
1648 IBinder owner = data.readStrongBinder();
1649 int fromUid = data.readInt();
1650 String targetPkg = data.readString();
1651 Uri uri = Uri.CREATOR.createFromParcel(data);
1652 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001653 int userId = data.readInt();
1654 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001655 reply.writeNoException();
1656 return true;
1657 }
1658
1659 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1660 data.enforceInterface(IActivityManager.descriptor);
1661 IBinder owner = data.readStrongBinder();
1662 Uri uri = null;
1663 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001664 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001665 }
1666 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001667 int userId = data.readInt();
1668 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001669 reply.writeNoException();
1670 return true;
1671 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001672
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001673 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1674 data.enforceInterface(IActivityManager.descriptor);
1675 int callingUid = data.readInt();
1676 String targetPkg = data.readString();
1677 Uri uri = Uri.CREATOR.createFromParcel(data);
1678 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001679 int userId = data.readInt();
1680 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001681 reply.writeNoException();
1682 reply.writeInt(res);
1683 return true;
1684 }
1685
Andy McFadden824c5102010-07-09 16:26:57 -07001686 case DUMP_HEAP_TRANSACTION: {
1687 data.enforceInterface(IActivityManager.descriptor);
1688 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001689 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001690 boolean managed = data.readInt() != 0;
1691 String path = data.readString();
1692 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001693 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001694 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001695 reply.writeNoException();
1696 reply.writeInt(res ? 1 : 0);
1697 return true;
1698 }
1699
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001700 case START_ACTIVITIES_TRANSACTION:
1701 {
1702 data.enforceInterface(IActivityManager.descriptor);
1703 IBinder b = data.readStrongBinder();
1704 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001705 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001706 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1707 String[] resolvedTypes = data.createStringArray();
1708 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001709 Bundle options = data.readInt() != 0
1710 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001711 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001712 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001713 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001714 reply.writeNoException();
1715 reply.writeInt(result);
1716 return true;
1717 }
1718
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001719 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1720 {
1721 data.enforceInterface(IActivityManager.descriptor);
1722 int mode = getFrontActivityScreenCompatMode();
1723 reply.writeNoException();
1724 reply.writeInt(mode);
1725 return true;
1726 }
1727
1728 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1729 {
1730 data.enforceInterface(IActivityManager.descriptor);
1731 int mode = data.readInt();
1732 setFrontActivityScreenCompatMode(mode);
1733 reply.writeNoException();
1734 reply.writeInt(mode);
1735 return true;
1736 }
1737
1738 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1739 {
1740 data.enforceInterface(IActivityManager.descriptor);
1741 String pkg = data.readString();
1742 int mode = getPackageScreenCompatMode(pkg);
1743 reply.writeNoException();
1744 reply.writeInt(mode);
1745 return true;
1746 }
1747
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001748 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1749 {
1750 data.enforceInterface(IActivityManager.descriptor);
1751 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001752 int mode = data.readInt();
1753 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001754 reply.writeNoException();
1755 return true;
1756 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001757
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001758 case SWITCH_USER_TRANSACTION: {
1759 data.enforceInterface(IActivityManager.descriptor);
1760 int userid = data.readInt();
1761 boolean result = switchUser(userid);
1762 reply.writeNoException();
1763 reply.writeInt(result ? 1 : 0);
1764 return true;
1765 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001766
Kenny Guy08488bf2014-02-21 17:40:37 +00001767 case START_USER_IN_BACKGROUND_TRANSACTION: {
1768 data.enforceInterface(IActivityManager.descriptor);
1769 int userid = data.readInt();
1770 boolean result = startUserInBackground(userid);
1771 reply.writeNoException();
1772 reply.writeInt(result ? 1 : 0);
1773 return true;
1774 }
1775
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001776 case STOP_USER_TRANSACTION: {
1777 data.enforceInterface(IActivityManager.descriptor);
1778 int userid = data.readInt();
1779 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1780 data.readStrongBinder());
1781 int result = stopUser(userid, callback);
1782 reply.writeNoException();
1783 reply.writeInt(result);
1784 return true;
1785 }
1786
Amith Yamasani52f1d752012-03-28 18:19:29 -07001787 case GET_CURRENT_USER_TRANSACTION: {
1788 data.enforceInterface(IActivityManager.descriptor);
1789 UserInfo userInfo = getCurrentUser();
1790 reply.writeNoException();
1791 userInfo.writeToParcel(reply, 0);
1792 return true;
1793 }
1794
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001795 case IS_USER_RUNNING_TRANSACTION: {
1796 data.enforceInterface(IActivityManager.descriptor);
1797 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001798 boolean orStopping = data.readInt() != 0;
1799 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001800 reply.writeNoException();
1801 reply.writeInt(result ? 1 : 0);
1802 return true;
1803 }
1804
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001805 case GET_RUNNING_USER_IDS_TRANSACTION: {
1806 data.enforceInterface(IActivityManager.descriptor);
1807 int[] result = getRunningUserIds();
1808 reply.writeNoException();
1809 reply.writeIntArray(result);
1810 return true;
1811 }
1812
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001813 case REMOVE_TASK_TRANSACTION:
1814 {
1815 data.enforceInterface(IActivityManager.descriptor);
1816 int taskId = data.readInt();
1817 int fl = data.readInt();
1818 boolean result = removeTask(taskId, fl);
1819 reply.writeNoException();
1820 reply.writeInt(result ? 1 : 0);
1821 return true;
1822 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001823
Jeff Sharkeya4620792011-05-20 15:29:23 -07001824 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1825 data.enforceInterface(IActivityManager.descriptor);
1826 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1827 data.readStrongBinder());
1828 registerProcessObserver(observer);
1829 return true;
1830 }
1831
1832 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1833 data.enforceInterface(IActivityManager.descriptor);
1834 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1835 data.readStrongBinder());
1836 unregisterProcessObserver(observer);
1837 return true;
1838 }
1839
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001840 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1841 {
1842 data.enforceInterface(IActivityManager.descriptor);
1843 String pkg = data.readString();
1844 boolean ask = getPackageAskScreenCompat(pkg);
1845 reply.writeNoException();
1846 reply.writeInt(ask ? 1 : 0);
1847 return true;
1848 }
1849
1850 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1851 {
1852 data.enforceInterface(IActivityManager.descriptor);
1853 String pkg = data.readString();
1854 boolean ask = data.readInt() != 0;
1855 setPackageAskScreenCompat(pkg, ask);
1856 reply.writeNoException();
1857 return true;
1858 }
1859
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001860 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1861 data.enforceInterface(IActivityManager.descriptor);
1862 IIntentSender r = IIntentSender.Stub.asInterface(
1863 data.readStrongBinder());
1864 boolean res = isIntentSenderTargetedToPackage(r);
1865 reply.writeNoException();
1866 reply.writeInt(res ? 1 : 0);
1867 return true;
1868 }
1869
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001870 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1871 data.enforceInterface(IActivityManager.descriptor);
1872 IIntentSender r = IIntentSender.Stub.asInterface(
1873 data.readStrongBinder());
1874 boolean res = isIntentSenderAnActivity(r);
1875 reply.writeNoException();
1876 reply.writeInt(res ? 1 : 0);
1877 return true;
1878 }
1879
Dianne Hackborn81038902012-11-26 17:04:09 -08001880 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1881 data.enforceInterface(IActivityManager.descriptor);
1882 IIntentSender r = IIntentSender.Stub.asInterface(
1883 data.readStrongBinder());
1884 Intent intent = getIntentForIntentSender(r);
1885 reply.writeNoException();
1886 if (intent != null) {
1887 reply.writeInt(1);
1888 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1889 } else {
1890 reply.writeInt(0);
1891 }
1892 return true;
1893 }
1894
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001895 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1896 data.enforceInterface(IActivityManager.descriptor);
1897 IIntentSender r = IIntentSender.Stub.asInterface(
1898 data.readStrongBinder());
1899 String prefix = data.readString();
1900 String tag = getTagForIntentSender(r, prefix);
1901 reply.writeNoException();
1902 reply.writeString(tag);
1903 return true;
1904 }
1905
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001906 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1907 data.enforceInterface(IActivityManager.descriptor);
1908 Configuration config = Configuration.CREATOR.createFromParcel(data);
1909 updatePersistentConfiguration(config);
1910 reply.writeNoException();
1911 return true;
1912 }
1913
Dianne Hackbornb437e092011-08-05 17:50:29 -07001914 case GET_PROCESS_PSS_TRANSACTION: {
1915 data.enforceInterface(IActivityManager.descriptor);
1916 int[] pids = data.createIntArray();
1917 long[] pss = getProcessPss(pids);
1918 reply.writeNoException();
1919 reply.writeLongArray(pss);
1920 return true;
1921 }
1922
Dianne Hackborn661cd522011-08-22 00:26:20 -07001923 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1924 data.enforceInterface(IActivityManager.descriptor);
1925 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1926 boolean always = data.readInt() != 0;
1927 showBootMessage(msg, always);
1928 reply.writeNoException();
1929 return true;
1930 }
1931
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001932 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1933 data.enforceInterface(IActivityManager.descriptor);
1934 dismissKeyguardOnNextActivity();
1935 reply.writeNoException();
1936 return true;
1937 }
1938
Adam Powelldd8fab22012-03-22 17:47:27 -07001939 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1940 data.enforceInterface(IActivityManager.descriptor);
1941 IBinder token = data.readStrongBinder();
1942 String destAffinity = data.readString();
1943 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1944 reply.writeNoException();
1945 reply.writeInt(res ? 1 : 0);
1946 return true;
1947 }
1948
1949 case NAVIGATE_UP_TO_TRANSACTION: {
1950 data.enforceInterface(IActivityManager.descriptor);
1951 IBinder token = data.readStrongBinder();
1952 Intent target = Intent.CREATOR.createFromParcel(data);
1953 int resultCode = data.readInt();
1954 Intent resultData = null;
1955 if (data.readInt() != 0) {
1956 resultData = Intent.CREATOR.createFromParcel(data);
1957 }
1958 boolean res = navigateUpTo(token, target, resultCode, resultData);
1959 reply.writeNoException();
1960 reply.writeInt(res ? 1 : 0);
1961 return true;
1962 }
1963
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001964 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1965 data.enforceInterface(IActivityManager.descriptor);
1966 IBinder token = data.readStrongBinder();
1967 int res = getLaunchedFromUid(token);
1968 reply.writeNoException();
1969 reply.writeInt(res);
1970 return true;
1971 }
1972
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001973 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1974 data.enforceInterface(IActivityManager.descriptor);
1975 IBinder token = data.readStrongBinder();
1976 String res = getLaunchedFromPackage(token);
1977 reply.writeNoException();
1978 reply.writeString(res);
1979 return true;
1980 }
1981
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001982 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1983 data.enforceInterface(IActivityManager.descriptor);
1984 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1985 data.readStrongBinder());
1986 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001987 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001988 return true;
1989 }
1990
1991 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1992 data.enforceInterface(IActivityManager.descriptor);
1993 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1994 data.readStrongBinder());
1995 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001996 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001997 return true;
1998 }
1999
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002000 case REQUEST_BUG_REPORT_TRANSACTION: {
2001 data.enforceInterface(IActivityManager.descriptor);
2002 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002003 reply.writeNoException();
2004 return true;
2005 }
2006
2007 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2008 data.enforceInterface(IActivityManager.descriptor);
2009 int pid = data.readInt();
2010 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002011 String reason = data.readString();
2012 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002013 reply.writeNoException();
2014 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002015 return true;
2016 }
2017
Adam Skorydfc7fd72013-08-05 19:23:41 -07002018 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002019 data.enforceInterface(IActivityManager.descriptor);
2020 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002021 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002022 reply.writeNoException();
2023 reply.writeBundle(res);
2024 return true;
2025 }
2026
Adam Skorydfc7fd72013-08-05 19:23:41 -07002027 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002028 data.enforceInterface(IActivityManager.descriptor);
2029 IBinder token = data.readStrongBinder();
2030 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002031 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002032 reply.writeNoException();
2033 return true;
2034 }
2035
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002036 case KILL_UID_TRANSACTION: {
2037 data.enforceInterface(IActivityManager.descriptor);
2038 int uid = data.readInt();
2039 String reason = data.readString();
2040 killUid(uid, reason);
2041 reply.writeNoException();
2042 return true;
2043 }
2044
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002045 case HANG_TRANSACTION: {
2046 data.enforceInterface(IActivityManager.descriptor);
2047 IBinder who = data.readStrongBinder();
2048 boolean allowRestart = data.readInt() != 0;
2049 hang(who, allowRestart);
2050 reply.writeNoException();
2051 return true;
2052 }
2053
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002054 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2055 data.enforceInterface(IActivityManager.descriptor);
2056 IBinder token = data.readStrongBinder();
2057 reportActivityFullyDrawn(token);
2058 reply.writeNoException();
2059 return true;
2060 }
2061
Craig Mautner5eda9b32013-07-02 11:58:16 -07002062 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2063 data.enforceInterface(IActivityManager.descriptor);
2064 IBinder token = data.readStrongBinder();
2065 notifyActivityDrawn(token);
2066 reply.writeNoException();
2067 return true;
2068 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002069
2070 case RESTART_TRANSACTION: {
2071 data.enforceInterface(IActivityManager.descriptor);
2072 restart();
2073 reply.writeNoException();
2074 return true;
2075 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002076
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002077 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2078 data.enforceInterface(IActivityManager.descriptor);
2079 performIdleMaintenance();
2080 reply.writeNoException();
2081 return true;
2082 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002083
2084 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2085 data.enforceInterface(IActivityManager.descriptor);
2086 IBinder parentActivityToken = data.readStrongBinder();
2087 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002088 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002089 IActivityContainer activityContainer =
2090 createActivityContainer(parentActivityToken, callback);
2091 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002092 if (activityContainer != null) {
2093 reply.writeInt(1);
2094 reply.writeStrongBinder(activityContainer.asBinder());
2095 } else {
2096 reply.writeInt(0);
2097 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002098 return true;
2099 }
2100
Craig Mautner95da1082014-02-24 17:54:35 -08002101 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2102 data.enforceInterface(IActivityManager.descriptor);
2103 IActivityContainer activityContainer =
2104 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2105 deleteActivityContainer(activityContainer);
2106 reply.writeNoException();
2107 return true;
2108 }
2109
Craig Mautnere0a38842013-12-16 16:14:02 -08002110 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2111 data.enforceInterface(IActivityManager.descriptor);
2112 IBinder activityToken = data.readStrongBinder();
2113 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2114 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002115 if (activityContainer != null) {
2116 reply.writeInt(1);
2117 reply.writeStrongBinder(activityContainer.asBinder());
2118 } else {
2119 reply.writeInt(0);
2120 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002121 return true;
2122 }
2123
Craig Mautner4a1cb222013-12-04 16:14:06 -08002124 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2125 data.enforceInterface(IActivityManager.descriptor);
2126 IBinder homeActivityToken = getHomeActivityToken();
2127 reply.writeNoException();
2128 reply.writeStrongBinder(homeActivityToken);
2129 return true;
2130 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002131
2132 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2133 data.enforceInterface(IActivityManager.descriptor);
2134 final int taskId = data.readInt();
2135 startLockTaskMode(taskId);
2136 reply.writeNoException();
2137 return true;
2138 }
2139
2140 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2141 data.enforceInterface(IActivityManager.descriptor);
2142 IBinder token = data.readStrongBinder();
2143 startLockTaskMode(token);
2144 reply.writeNoException();
2145 return true;
2146 }
2147
Craig Mautnerd61dc202014-07-07 11:09:11 -07002148 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002149 data.enforceInterface(IActivityManager.descriptor);
2150 startLockTaskModeOnCurrent();
2151 reply.writeNoException();
2152 return true;
2153 }
2154
Craig Mautneraea74a52014-03-08 14:23:10 -08002155 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2156 data.enforceInterface(IActivityManager.descriptor);
2157 stopLockTaskMode();
2158 reply.writeNoException();
2159 return true;
2160 }
2161
Craig Mautnerd61dc202014-07-07 11:09:11 -07002162 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002163 data.enforceInterface(IActivityManager.descriptor);
2164 stopLockTaskModeOnCurrent();
2165 reply.writeNoException();
2166 return true;
2167 }
2168
Craig Mautneraea74a52014-03-08 14:23:10 -08002169 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2170 data.enforceInterface(IActivityManager.descriptor);
2171 final boolean isInLockTaskMode = isInLockTaskMode();
2172 reply.writeNoException();
2173 reply.writeInt(isInLockTaskMode ? 1 : 0);
2174 return true;
2175 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002176
Winson Chunga449dc02014-05-16 11:15:04 -07002177 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002178 data.enforceInterface(IActivityManager.descriptor);
2179 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002180 ActivityManager.TaskDescription values =
2181 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2182 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002183 reply.writeNoException();
2184 return true;
2185 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002186
2187 case SET_MEDIA_PLAYING_TRANSACTION: {
2188 data.enforceInterface(IActivityManager.descriptor);
2189 IBinder token = data.readStrongBinder();
2190 boolean enable = data.readInt() > 0;
2191 boolean success = setMediaPlaying(token, enable);
2192 reply.writeNoException();
2193 reply.writeInt(success ? 1 : 0);
2194 return true;
2195 }
2196
2197 case IS_BG_MEDIA_PLAYING_TRANSACTION: {
2198 data.enforceInterface(IActivityManager.descriptor);
2199 IBinder token = data.readStrongBinder();
2200 final boolean enabled = isBackgroundMediaPlaying(token);
2201 reply.writeNoException();
2202 reply.writeInt(enabled ? 1 : 0);
2203 return true;
2204 }
2205
Craig Mautnerbb742462014-07-07 15:28:55 -07002206 case MEDIA_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002207 data.enforceInterface(IActivityManager.descriptor);
2208 IBinder token = data.readStrongBinder();
2209 mediaResourcesReleased(token);
2210 reply.writeNoException();
2211 return true;
2212 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002213
2214 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2215 data.enforceInterface(IActivityManager.descriptor);
2216 IBinder token = data.readStrongBinder();
2217 notifyLaunchTaskBehindComplete(token);
2218 reply.writeNoException();
2219 return true;
2220 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002221 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002222
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002223 return super.onTransact(code, data, reply, flags);
2224 }
2225
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002226 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002227 return this;
2228 }
2229
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002230 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2231 protected IActivityManager create() {
2232 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002233 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002234 Log.v("ActivityManager", "default service binder = " + b);
2235 }
2236 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002237 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002238 Log.v("ActivityManager", "default service = " + am);
2239 }
2240 return am;
2241 }
2242 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002243}
2244
2245class ActivityManagerProxy implements IActivityManager
2246{
2247 public ActivityManagerProxy(IBinder remote)
2248 {
2249 mRemote = remote;
2250 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002251
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002252 public IBinder asBinder()
2253 {
2254 return mRemote;
2255 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002256
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002257 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002258 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2259 int startFlags, String profileFile,
2260 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002261 Parcel data = Parcel.obtain();
2262 Parcel reply = Parcel.obtain();
2263 data.writeInterfaceToken(IActivityManager.descriptor);
2264 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002265 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002266 intent.writeToParcel(data, 0);
2267 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002268 data.writeStrongBinder(resultTo);
2269 data.writeString(resultWho);
2270 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002271 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002272 data.writeString(profileFile);
2273 if (profileFd != null) {
2274 data.writeInt(1);
2275 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2276 } else {
2277 data.writeInt(0);
2278 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002279 if (options != null) {
2280 data.writeInt(1);
2281 options.writeToParcel(data, 0);
2282 } else {
2283 data.writeInt(0);
2284 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002285 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2286 reply.readException();
2287 int result = reply.readInt();
2288 reply.recycle();
2289 data.recycle();
2290 return result;
2291 }
Amith Yamasani82644082012-08-03 13:09:11 -07002292
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002293 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002294 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2295 int startFlags, String profileFile,
2296 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2297 Parcel data = Parcel.obtain();
2298 Parcel reply = Parcel.obtain();
2299 data.writeInterfaceToken(IActivityManager.descriptor);
2300 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002301 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002302 intent.writeToParcel(data, 0);
2303 data.writeString(resolvedType);
2304 data.writeStrongBinder(resultTo);
2305 data.writeString(resultWho);
2306 data.writeInt(requestCode);
2307 data.writeInt(startFlags);
2308 data.writeString(profileFile);
2309 if (profileFd != null) {
2310 data.writeInt(1);
2311 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2312 } else {
2313 data.writeInt(0);
2314 }
2315 if (options != null) {
2316 data.writeInt(1);
2317 options.writeToParcel(data, 0);
2318 } else {
2319 data.writeInt(0);
2320 }
2321 data.writeInt(userId);
2322 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2323 reply.readException();
2324 int result = reply.readInt();
2325 reply.recycle();
2326 data.recycle();
2327 return result;
2328 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002329 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2330 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002331 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002332 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002333 Parcel data = Parcel.obtain();
2334 Parcel reply = Parcel.obtain();
2335 data.writeInterfaceToken(IActivityManager.descriptor);
2336 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002337 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002338 intent.writeToParcel(data, 0);
2339 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002340 data.writeStrongBinder(resultTo);
2341 data.writeString(resultWho);
2342 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002343 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002344 data.writeString(profileFile);
2345 if (profileFd != null) {
2346 data.writeInt(1);
2347 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2348 } else {
2349 data.writeInt(0);
2350 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002351 if (options != null) {
2352 data.writeInt(1);
2353 options.writeToParcel(data, 0);
2354 } else {
2355 data.writeInt(0);
2356 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002357 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002358 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2359 reply.readException();
2360 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2361 reply.recycle();
2362 data.recycle();
2363 return result;
2364 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002365 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2366 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002367 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002368 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002369 Parcel data = Parcel.obtain();
2370 Parcel reply = Parcel.obtain();
2371 data.writeInterfaceToken(IActivityManager.descriptor);
2372 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002373 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002374 intent.writeToParcel(data, 0);
2375 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002376 data.writeStrongBinder(resultTo);
2377 data.writeString(resultWho);
2378 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002379 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002380 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002381 if (options != null) {
2382 data.writeInt(1);
2383 options.writeToParcel(data, 0);
2384 } else {
2385 data.writeInt(0);
2386 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002387 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002388 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2389 reply.readException();
2390 int result = reply.readInt();
2391 reply.recycle();
2392 data.recycle();
2393 return result;
2394 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002395 public int startActivityIntentSender(IApplicationThread caller,
2396 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002397 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002398 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002399 Parcel data = Parcel.obtain();
2400 Parcel reply = Parcel.obtain();
2401 data.writeInterfaceToken(IActivityManager.descriptor);
2402 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2403 intent.writeToParcel(data, 0);
2404 if (fillInIntent != null) {
2405 data.writeInt(1);
2406 fillInIntent.writeToParcel(data, 0);
2407 } else {
2408 data.writeInt(0);
2409 }
2410 data.writeString(resolvedType);
2411 data.writeStrongBinder(resultTo);
2412 data.writeString(resultWho);
2413 data.writeInt(requestCode);
2414 data.writeInt(flagsMask);
2415 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002416 if (options != null) {
2417 data.writeInt(1);
2418 options.writeToParcel(data, 0);
2419 } else {
2420 data.writeInt(0);
2421 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002422 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002423 reply.readException();
2424 int result = reply.readInt();
2425 reply.recycle();
2426 data.recycle();
2427 return result;
2428 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002429 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2430 Intent intent, String resolvedType, IVoiceInteractionSession session,
2431 IVoiceInteractor interactor, int startFlags, String profileFile,
2432 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2433 Parcel data = Parcel.obtain();
2434 Parcel reply = Parcel.obtain();
2435 data.writeInterfaceToken(IActivityManager.descriptor);
2436 data.writeString(callingPackage);
2437 data.writeInt(callingPid);
2438 data.writeInt(callingUid);
2439 intent.writeToParcel(data, 0);
2440 data.writeString(resolvedType);
2441 data.writeStrongBinder(session.asBinder());
2442 data.writeStrongBinder(interactor.asBinder());
2443 data.writeInt(startFlags);
2444 data.writeString(profileFile);
2445 if (profileFd != null) {
2446 data.writeInt(1);
2447 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2448 } else {
2449 data.writeInt(0);
2450 }
2451 if (options != null) {
2452 data.writeInt(1);
2453 options.writeToParcel(data, 0);
2454 } else {
2455 data.writeInt(0);
2456 }
2457 data.writeInt(userId);
2458 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2459 reply.readException();
2460 int result = reply.readInt();
2461 reply.recycle();
2462 data.recycle();
2463 return result;
2464 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002465 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002466 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002467 Parcel data = Parcel.obtain();
2468 Parcel reply = Parcel.obtain();
2469 data.writeInterfaceToken(IActivityManager.descriptor);
2470 data.writeStrongBinder(callingActivity);
2471 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002472 if (options != null) {
2473 data.writeInt(1);
2474 options.writeToParcel(data, 0);
2475 } else {
2476 data.writeInt(0);
2477 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002478 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2479 reply.readException();
2480 int result = reply.readInt();
2481 reply.recycle();
2482 data.recycle();
2483 return result != 0;
2484 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002485 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002486 throws RemoteException {
2487 Parcel data = Parcel.obtain();
2488 Parcel reply = Parcel.obtain();
2489 data.writeInterfaceToken(IActivityManager.descriptor);
2490 data.writeStrongBinder(token);
2491 data.writeInt(resultCode);
2492 if (resultData != null) {
2493 data.writeInt(1);
2494 resultData.writeToParcel(data, 0);
2495 } else {
2496 data.writeInt(0);
2497 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002498 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002499 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2500 reply.readException();
2501 boolean res = reply.readInt() != 0;
2502 data.recycle();
2503 reply.recycle();
2504 return res;
2505 }
2506 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2507 {
2508 Parcel data = Parcel.obtain();
2509 Parcel reply = Parcel.obtain();
2510 data.writeInterfaceToken(IActivityManager.descriptor);
2511 data.writeStrongBinder(token);
2512 data.writeString(resultWho);
2513 data.writeInt(requestCode);
2514 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2515 reply.readException();
2516 data.recycle();
2517 reply.recycle();
2518 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002519 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2520 Parcel data = Parcel.obtain();
2521 Parcel reply = Parcel.obtain();
2522 data.writeInterfaceToken(IActivityManager.descriptor);
2523 data.writeStrongBinder(token);
2524 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2525 reply.readException();
2526 boolean res = reply.readInt() != 0;
2527 data.recycle();
2528 reply.recycle();
2529 return res;
2530 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002531 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2532 Parcel data = Parcel.obtain();
2533 Parcel reply = Parcel.obtain();
2534 data.writeInterfaceToken(IActivityManager.descriptor);
2535 data.writeStrongBinder(session.asBinder());
2536 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2537 reply.readException();
2538 data.recycle();
2539 reply.recycle();
2540 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002541 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2542 Parcel data = Parcel.obtain();
2543 Parcel reply = Parcel.obtain();
2544 data.writeInterfaceToken(IActivityManager.descriptor);
2545 data.writeStrongBinder(token);
2546 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2547 reply.readException();
2548 boolean res = reply.readInt() != 0;
2549 data.recycle();
2550 reply.recycle();
2551 return res;
2552 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002553 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002554 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002555 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002556 {
2557 Parcel data = Parcel.obtain();
2558 Parcel reply = Parcel.obtain();
2559 data.writeInterfaceToken(IActivityManager.descriptor);
2560 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002561 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002562 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2563 filter.writeToParcel(data, 0);
2564 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002565 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002566 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2567 reply.readException();
2568 Intent intent = null;
2569 int haveIntent = reply.readInt();
2570 if (haveIntent != 0) {
2571 intent = Intent.CREATOR.createFromParcel(reply);
2572 }
2573 reply.recycle();
2574 data.recycle();
2575 return intent;
2576 }
2577 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2578 {
2579 Parcel data = Parcel.obtain();
2580 Parcel reply = Parcel.obtain();
2581 data.writeInterfaceToken(IActivityManager.descriptor);
2582 data.writeStrongBinder(receiver.asBinder());
2583 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2584 reply.readException();
2585 data.recycle();
2586 reply.recycle();
2587 }
2588 public int broadcastIntent(IApplicationThread caller,
2589 Intent intent, String resolvedType, IIntentReceiver resultTo,
2590 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002591 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002592 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002593 {
2594 Parcel data = Parcel.obtain();
2595 Parcel reply = Parcel.obtain();
2596 data.writeInterfaceToken(IActivityManager.descriptor);
2597 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2598 intent.writeToParcel(data, 0);
2599 data.writeString(resolvedType);
2600 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2601 data.writeInt(resultCode);
2602 data.writeString(resultData);
2603 data.writeBundle(map);
2604 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002605 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002606 data.writeInt(serialized ? 1 : 0);
2607 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002608 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002609 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2610 reply.readException();
2611 int res = reply.readInt();
2612 reply.recycle();
2613 data.recycle();
2614 return res;
2615 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002616 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2617 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002618 {
2619 Parcel data = Parcel.obtain();
2620 Parcel reply = Parcel.obtain();
2621 data.writeInterfaceToken(IActivityManager.descriptor);
2622 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2623 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002624 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002625 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2626 reply.readException();
2627 data.recycle();
2628 reply.recycle();
2629 }
2630 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2631 {
2632 Parcel data = Parcel.obtain();
2633 Parcel reply = Parcel.obtain();
2634 data.writeInterfaceToken(IActivityManager.descriptor);
2635 data.writeStrongBinder(who);
2636 data.writeInt(resultCode);
2637 data.writeString(resultData);
2638 data.writeBundle(map);
2639 data.writeInt(abortBroadcast ? 1 : 0);
2640 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2641 reply.readException();
2642 data.recycle();
2643 reply.recycle();
2644 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002645 public void attachApplication(IApplicationThread app) throws RemoteException
2646 {
2647 Parcel data = Parcel.obtain();
2648 Parcel reply = Parcel.obtain();
2649 data.writeInterfaceToken(IActivityManager.descriptor);
2650 data.writeStrongBinder(app.asBinder());
2651 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2652 reply.readException();
2653 data.recycle();
2654 reply.recycle();
2655 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002656 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2657 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002658 {
2659 Parcel data = Parcel.obtain();
2660 Parcel reply = Parcel.obtain();
2661 data.writeInterfaceToken(IActivityManager.descriptor);
2662 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002663 if (config != null) {
2664 data.writeInt(1);
2665 config.writeToParcel(data, 0);
2666 } else {
2667 data.writeInt(0);
2668 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002669 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002670 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2671 reply.readException();
2672 data.recycle();
2673 reply.recycle();
2674 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002675 public void activityResumed(IBinder token) throws RemoteException
2676 {
2677 Parcel data = Parcel.obtain();
2678 Parcel reply = Parcel.obtain();
2679 data.writeInterfaceToken(IActivityManager.descriptor);
2680 data.writeStrongBinder(token);
2681 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2682 reply.readException();
2683 data.recycle();
2684 reply.recycle();
2685 }
Craig Mautnera0026042014-04-23 11:45:37 -07002686 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002687 {
2688 Parcel data = Parcel.obtain();
2689 Parcel reply = Parcel.obtain();
2690 data.writeInterfaceToken(IActivityManager.descriptor);
2691 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002692 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002693 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2694 reply.readException();
2695 data.recycle();
2696 reply.recycle();
2697 }
2698 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002699 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002700 {
2701 Parcel data = Parcel.obtain();
2702 Parcel reply = Parcel.obtain();
2703 data.writeInterfaceToken(IActivityManager.descriptor);
2704 data.writeStrongBinder(token);
2705 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002706 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002707 TextUtils.writeToParcel(description, data, 0);
2708 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2709 reply.readException();
2710 data.recycle();
2711 reply.recycle();
2712 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002713 public void activitySlept(IBinder token) throws RemoteException
2714 {
2715 Parcel data = Parcel.obtain();
2716 Parcel reply = Parcel.obtain();
2717 data.writeInterfaceToken(IActivityManager.descriptor);
2718 data.writeStrongBinder(token);
2719 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2720 reply.readException();
2721 data.recycle();
2722 reply.recycle();
2723 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002724 public void activityDestroyed(IBinder token) throws RemoteException
2725 {
2726 Parcel data = Parcel.obtain();
2727 Parcel reply = Parcel.obtain();
2728 data.writeInterfaceToken(IActivityManager.descriptor);
2729 data.writeStrongBinder(token);
2730 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2731 reply.readException();
2732 data.recycle();
2733 reply.recycle();
2734 }
2735 public String getCallingPackage(IBinder token) throws RemoteException
2736 {
2737 Parcel data = Parcel.obtain();
2738 Parcel reply = Parcel.obtain();
2739 data.writeInterfaceToken(IActivityManager.descriptor);
2740 data.writeStrongBinder(token);
2741 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2742 reply.readException();
2743 String res = reply.readString();
2744 data.recycle();
2745 reply.recycle();
2746 return res;
2747 }
2748 public ComponentName getCallingActivity(IBinder token)
2749 throws RemoteException {
2750 Parcel data = Parcel.obtain();
2751 Parcel reply = Parcel.obtain();
2752 data.writeInterfaceToken(IActivityManager.descriptor);
2753 data.writeStrongBinder(token);
2754 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2755 reply.readException();
2756 ComponentName res = ComponentName.readFromParcel(reply);
2757 data.recycle();
2758 reply.recycle();
2759 return res;
2760 }
Winson Chung1147c402014-05-14 11:05:00 -07002761 public List<IAppTask> getAppTasks() throws RemoteException {
2762 Parcel data = Parcel.obtain();
2763 Parcel reply = Parcel.obtain();
2764 data.writeInterfaceToken(IActivityManager.descriptor);
2765 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2766 reply.readException();
2767 ArrayList<IAppTask> list = null;
2768 int N = reply.readInt();
2769 if (N >= 0) {
2770 list = new ArrayList<IAppTask>();
2771 while (N > 0) {
2772 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2773 list.add(task);
2774 N--;
2775 }
2776 }
2777 data.recycle();
2778 reply.recycle();
2779 return list;
2780 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002781 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002782 Parcel data = Parcel.obtain();
2783 Parcel reply = Parcel.obtain();
2784 data.writeInterfaceToken(IActivityManager.descriptor);
2785 data.writeInt(maxNum);
2786 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002787 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2788 reply.readException();
2789 ArrayList list = null;
2790 int N = reply.readInt();
2791 if (N >= 0) {
2792 list = new ArrayList();
2793 while (N > 0) {
2794 ActivityManager.RunningTaskInfo info =
2795 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002796 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002797 list.add(info);
2798 N--;
2799 }
2800 }
2801 data.recycle();
2802 reply.recycle();
2803 return list;
2804 }
2805 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002806 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002807 Parcel data = Parcel.obtain();
2808 Parcel reply = Parcel.obtain();
2809 data.writeInterfaceToken(IActivityManager.descriptor);
2810 data.writeInt(maxNum);
2811 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002812 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002813 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2814 reply.readException();
2815 ArrayList<ActivityManager.RecentTaskInfo> list
2816 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2817 data.recycle();
2818 reply.recycle();
2819 return list;
2820 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002821 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002822 Parcel data = Parcel.obtain();
2823 Parcel reply = Parcel.obtain();
2824 data.writeInterfaceToken(IActivityManager.descriptor);
2825 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002826 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002827 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002828 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002829 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002830 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002831 }
2832 data.recycle();
2833 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002834 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07002835 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002836 public List getServices(int maxNum, int flags) throws RemoteException {
2837 Parcel data = Parcel.obtain();
2838 Parcel reply = Parcel.obtain();
2839 data.writeInterfaceToken(IActivityManager.descriptor);
2840 data.writeInt(maxNum);
2841 data.writeInt(flags);
2842 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2843 reply.readException();
2844 ArrayList list = null;
2845 int N = reply.readInt();
2846 if (N >= 0) {
2847 list = new ArrayList();
2848 while (N > 0) {
2849 ActivityManager.RunningServiceInfo info =
2850 ActivityManager.RunningServiceInfo.CREATOR
2851 .createFromParcel(reply);
2852 list.add(info);
2853 N--;
2854 }
2855 }
2856 data.recycle();
2857 reply.recycle();
2858 return list;
2859 }
2860 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2861 throws RemoteException {
2862 Parcel data = Parcel.obtain();
2863 Parcel reply = Parcel.obtain();
2864 data.writeInterfaceToken(IActivityManager.descriptor);
2865 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2866 reply.readException();
2867 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2868 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2869 data.recycle();
2870 reply.recycle();
2871 return list;
2872 }
2873 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2874 throws RemoteException {
2875 Parcel data = Parcel.obtain();
2876 Parcel reply = Parcel.obtain();
2877 data.writeInterfaceToken(IActivityManager.descriptor);
2878 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2879 reply.readException();
2880 ArrayList<ActivityManager.RunningAppProcessInfo> list
2881 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2882 data.recycle();
2883 reply.recycle();
2884 return list;
2885 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002886 public List<ApplicationInfo> getRunningExternalApplications()
2887 throws RemoteException {
2888 Parcel data = Parcel.obtain();
2889 Parcel reply = Parcel.obtain();
2890 data.writeInterfaceToken(IActivityManager.descriptor);
2891 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2892 reply.readException();
2893 ArrayList<ApplicationInfo> list
2894 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2895 data.recycle();
2896 reply.recycle();
2897 return list;
2898 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002899 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002900 {
2901 Parcel data = Parcel.obtain();
2902 Parcel reply = Parcel.obtain();
2903 data.writeInterfaceToken(IActivityManager.descriptor);
2904 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002905 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002906 if (options != null) {
2907 data.writeInt(1);
2908 options.writeToParcel(data, 0);
2909 } else {
2910 data.writeInt(0);
2911 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002912 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2913 reply.readException();
2914 data.recycle();
2915 reply.recycle();
2916 }
2917 public void moveTaskToBack(int task) throws RemoteException
2918 {
2919 Parcel data = Parcel.obtain();
2920 Parcel reply = Parcel.obtain();
2921 data.writeInterfaceToken(IActivityManager.descriptor);
2922 data.writeInt(task);
2923 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2924 reply.readException();
2925 data.recycle();
2926 reply.recycle();
2927 }
2928 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2929 throws RemoteException {
2930 Parcel data = Parcel.obtain();
2931 Parcel reply = Parcel.obtain();
2932 data.writeInterfaceToken(IActivityManager.descriptor);
2933 data.writeStrongBinder(token);
2934 data.writeInt(nonRoot ? 1 : 0);
2935 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2936 reply.readException();
2937 boolean res = reply.readInt() != 0;
2938 data.recycle();
2939 reply.recycle();
2940 return res;
2941 }
2942 public void moveTaskBackwards(int task) throws RemoteException
2943 {
2944 Parcel data = Parcel.obtain();
2945 Parcel reply = Parcel.obtain();
2946 data.writeInterfaceToken(IActivityManager.descriptor);
2947 data.writeInt(task);
2948 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2949 reply.readException();
2950 data.recycle();
2951 reply.recycle();
2952 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002953 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002954 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2955 {
2956 Parcel data = Parcel.obtain();
2957 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002958 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002959 data.writeInt(taskId);
2960 data.writeInt(stackId);
2961 data.writeInt(toTop ? 1 : 0);
2962 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2963 reply.readException();
2964 data.recycle();
2965 reply.recycle();
2966 }
2967 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002968 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002969 {
2970 Parcel data = Parcel.obtain();
2971 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002972 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002973 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002974 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002975 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002976 reply.readException();
2977 data.recycle();
2978 reply.recycle();
2979 }
Craig Mautner967212c2013-04-13 21:10:58 -07002980 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002981 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002982 {
2983 Parcel data = Parcel.obtain();
2984 Parcel reply = Parcel.obtain();
2985 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002986 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002987 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002988 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002989 data.recycle();
2990 reply.recycle();
2991 return list;
2992 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002993 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002994 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002995 {
2996 Parcel data = Parcel.obtain();
2997 Parcel reply = Parcel.obtain();
2998 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002999 data.writeInt(stackId);
3000 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003001 reply.readException();
3002 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003003 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003004 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003005 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003006 }
3007 data.recycle();
3008 reply.recycle();
3009 return info;
3010 }
3011 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003012 public boolean isInHomeStack(int taskId) throws RemoteException {
3013 Parcel data = Parcel.obtain();
3014 Parcel reply = Parcel.obtain();
3015 data.writeInterfaceToken(IActivityManager.descriptor);
3016 data.writeInt(taskId);
3017 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3018 reply.readException();
3019 boolean isInHomeStack = reply.readInt() > 0;
3020 data.recycle();
3021 reply.recycle();
3022 return isInHomeStack;
3023 }
3024 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003025 public void setFocusedStack(int stackId) throws RemoteException
3026 {
3027 Parcel data = Parcel.obtain();
3028 Parcel reply = Parcel.obtain();
3029 data.writeInterfaceToken(IActivityManager.descriptor);
3030 data.writeInt(stackId);
3031 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3032 reply.readException();
3033 data.recycle();
3034 reply.recycle();
3035 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003036 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3037 {
3038 Parcel data = Parcel.obtain();
3039 Parcel reply = Parcel.obtain();
3040 data.writeInterfaceToken(IActivityManager.descriptor);
3041 data.writeStrongBinder(token);
3042 data.writeInt(onlyRoot ? 1 : 0);
3043 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3044 reply.readException();
3045 int res = reply.readInt();
3046 data.recycle();
3047 reply.recycle();
3048 return res;
3049 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003050 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003051 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003052 Parcel data = Parcel.obtain();
3053 Parcel reply = Parcel.obtain();
3054 data.writeInterfaceToken(IActivityManager.descriptor);
3055 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3056 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003057 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003058 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003059 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3060 reply.readException();
3061 int res = reply.readInt();
3062 ContentProviderHolder cph = null;
3063 if (res != 0) {
3064 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3065 }
3066 data.recycle();
3067 reply.recycle();
3068 return cph;
3069 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003070 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3071 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003072 Parcel data = Parcel.obtain();
3073 Parcel reply = Parcel.obtain();
3074 data.writeInterfaceToken(IActivityManager.descriptor);
3075 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003076 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003077 data.writeStrongBinder(token);
3078 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3079 reply.readException();
3080 int res = reply.readInt();
3081 ContentProviderHolder cph = null;
3082 if (res != 0) {
3083 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3084 }
3085 data.recycle();
3086 reply.recycle();
3087 return cph;
3088 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003089 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003090 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003091 {
3092 Parcel data = Parcel.obtain();
3093 Parcel reply = Parcel.obtain();
3094 data.writeInterfaceToken(IActivityManager.descriptor);
3095 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3096 data.writeTypedList(providers);
3097 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3098 reply.readException();
3099 data.recycle();
3100 reply.recycle();
3101 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003102 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3103 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003104 Parcel data = Parcel.obtain();
3105 Parcel reply = Parcel.obtain();
3106 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003107 data.writeStrongBinder(connection);
3108 data.writeInt(stable);
3109 data.writeInt(unstable);
3110 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3111 reply.readException();
3112 boolean res = reply.readInt() != 0;
3113 data.recycle();
3114 reply.recycle();
3115 return res;
3116 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003117
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003118 public void unstableProviderDied(IBinder connection) throws RemoteException {
3119 Parcel data = Parcel.obtain();
3120 Parcel reply = Parcel.obtain();
3121 data.writeInterfaceToken(IActivityManager.descriptor);
3122 data.writeStrongBinder(connection);
3123 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3124 reply.readException();
3125 data.recycle();
3126 reply.recycle();
3127 }
3128
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003129 @Override
3130 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3131 Parcel data = Parcel.obtain();
3132 Parcel reply = Parcel.obtain();
3133 data.writeInterfaceToken(IActivityManager.descriptor);
3134 data.writeStrongBinder(connection);
3135 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3136 reply.readException();
3137 data.recycle();
3138 reply.recycle();
3139 }
3140
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003141 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3142 Parcel data = Parcel.obtain();
3143 Parcel reply = Parcel.obtain();
3144 data.writeInterfaceToken(IActivityManager.descriptor);
3145 data.writeStrongBinder(connection);
3146 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003147 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3148 reply.readException();
3149 data.recycle();
3150 reply.recycle();
3151 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003152
3153 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3154 Parcel data = Parcel.obtain();
3155 Parcel reply = Parcel.obtain();
3156 data.writeInterfaceToken(IActivityManager.descriptor);
3157 data.writeString(name);
3158 data.writeStrongBinder(token);
3159 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3160 reply.readException();
3161 data.recycle();
3162 reply.recycle();
3163 }
3164
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003165 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3166 throws RemoteException
3167 {
3168 Parcel data = Parcel.obtain();
3169 Parcel reply = Parcel.obtain();
3170 data.writeInterfaceToken(IActivityManager.descriptor);
3171 service.writeToParcel(data, 0);
3172 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3173 reply.readException();
3174 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3175 data.recycle();
3176 reply.recycle();
3177 return res;
3178 }
3179
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003180 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003181 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003182 {
3183 Parcel data = Parcel.obtain();
3184 Parcel reply = Parcel.obtain();
3185 data.writeInterfaceToken(IActivityManager.descriptor);
3186 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3187 service.writeToParcel(data, 0);
3188 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003189 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003190 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3191 reply.readException();
3192 ComponentName res = ComponentName.readFromParcel(reply);
3193 data.recycle();
3194 reply.recycle();
3195 return res;
3196 }
3197 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003198 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003199 {
3200 Parcel data = Parcel.obtain();
3201 Parcel reply = Parcel.obtain();
3202 data.writeInterfaceToken(IActivityManager.descriptor);
3203 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3204 service.writeToParcel(data, 0);
3205 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003206 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003207 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3208 reply.readException();
3209 int res = reply.readInt();
3210 reply.recycle();
3211 data.recycle();
3212 return res;
3213 }
3214 public boolean stopServiceToken(ComponentName className, IBinder token,
3215 int startId) throws RemoteException {
3216 Parcel data = Parcel.obtain();
3217 Parcel reply = Parcel.obtain();
3218 data.writeInterfaceToken(IActivityManager.descriptor);
3219 ComponentName.writeToParcel(className, data);
3220 data.writeStrongBinder(token);
3221 data.writeInt(startId);
3222 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3223 reply.readException();
3224 boolean res = reply.readInt() != 0;
3225 data.recycle();
3226 reply.recycle();
3227 return res;
3228 }
3229 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003230 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003231 Parcel data = Parcel.obtain();
3232 Parcel reply = Parcel.obtain();
3233 data.writeInterfaceToken(IActivityManager.descriptor);
3234 ComponentName.writeToParcel(className, data);
3235 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003236 data.writeInt(id);
3237 if (notification != null) {
3238 data.writeInt(1);
3239 notification.writeToParcel(data, 0);
3240 } else {
3241 data.writeInt(0);
3242 }
3243 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003244 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3245 reply.readException();
3246 data.recycle();
3247 reply.recycle();
3248 }
3249 public int bindService(IApplicationThread caller, IBinder token,
3250 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003251 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003252 Parcel data = Parcel.obtain();
3253 Parcel reply = Parcel.obtain();
3254 data.writeInterfaceToken(IActivityManager.descriptor);
3255 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3256 data.writeStrongBinder(token);
3257 service.writeToParcel(data, 0);
3258 data.writeString(resolvedType);
3259 data.writeStrongBinder(connection.asBinder());
3260 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003261 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003262 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3263 reply.readException();
3264 int res = reply.readInt();
3265 data.recycle();
3266 reply.recycle();
3267 return res;
3268 }
3269 public boolean unbindService(IServiceConnection connection) throws RemoteException
3270 {
3271 Parcel data = Parcel.obtain();
3272 Parcel reply = Parcel.obtain();
3273 data.writeInterfaceToken(IActivityManager.descriptor);
3274 data.writeStrongBinder(connection.asBinder());
3275 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3276 reply.readException();
3277 boolean res = reply.readInt() != 0;
3278 data.recycle();
3279 reply.recycle();
3280 return res;
3281 }
3282
3283 public void publishService(IBinder token,
3284 Intent intent, IBinder service) throws RemoteException {
3285 Parcel data = Parcel.obtain();
3286 Parcel reply = Parcel.obtain();
3287 data.writeInterfaceToken(IActivityManager.descriptor);
3288 data.writeStrongBinder(token);
3289 intent.writeToParcel(data, 0);
3290 data.writeStrongBinder(service);
3291 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3292 reply.readException();
3293 data.recycle();
3294 reply.recycle();
3295 }
3296
3297 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3298 throws RemoteException {
3299 Parcel data = Parcel.obtain();
3300 Parcel reply = Parcel.obtain();
3301 data.writeInterfaceToken(IActivityManager.descriptor);
3302 data.writeStrongBinder(token);
3303 intent.writeToParcel(data, 0);
3304 data.writeInt(doRebind ? 1 : 0);
3305 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3306 reply.readException();
3307 data.recycle();
3308 reply.recycle();
3309 }
3310
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003311 public void serviceDoneExecuting(IBinder token, int type, int startId,
3312 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003313 Parcel data = Parcel.obtain();
3314 Parcel reply = Parcel.obtain();
3315 data.writeInterfaceToken(IActivityManager.descriptor);
3316 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003317 data.writeInt(type);
3318 data.writeInt(startId);
3319 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003320 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3321 reply.readException();
3322 data.recycle();
3323 reply.recycle();
3324 }
3325
3326 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3327 Parcel data = Parcel.obtain();
3328 Parcel reply = Parcel.obtain();
3329 data.writeInterfaceToken(IActivityManager.descriptor);
3330 service.writeToParcel(data, 0);
3331 data.writeString(resolvedType);
3332 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3333 reply.readException();
3334 IBinder binder = reply.readStrongBinder();
3335 reply.recycle();
3336 data.recycle();
3337 return binder;
3338 }
3339
Christopher Tate181fafa2009-05-14 11:12:14 -07003340 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3341 throws RemoteException {
3342 Parcel data = Parcel.obtain();
3343 Parcel reply = Parcel.obtain();
3344 data.writeInterfaceToken(IActivityManager.descriptor);
3345 app.writeToParcel(data, 0);
3346 data.writeInt(backupRestoreMode);
3347 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3348 reply.readException();
3349 boolean success = reply.readInt() != 0;
3350 reply.recycle();
3351 data.recycle();
3352 return success;
3353 }
3354
Christopher Tate346acb12012-10-15 19:20:25 -07003355 public void clearPendingBackup() throws RemoteException {
3356 Parcel data = Parcel.obtain();
3357 Parcel reply = Parcel.obtain();
3358 data.writeInterfaceToken(IActivityManager.descriptor);
3359 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3360 reply.recycle();
3361 data.recycle();
3362 }
3363
Christopher Tate181fafa2009-05-14 11:12:14 -07003364 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3365 Parcel data = Parcel.obtain();
3366 Parcel reply = Parcel.obtain();
3367 data.writeInterfaceToken(IActivityManager.descriptor);
3368 data.writeString(packageName);
3369 data.writeStrongBinder(agent);
3370 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3371 reply.recycle();
3372 data.recycle();
3373 }
3374
3375 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3376 Parcel data = Parcel.obtain();
3377 Parcel reply = Parcel.obtain();
3378 data.writeInterfaceToken(IActivityManager.descriptor);
3379 app.writeToParcel(data, 0);
3380 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3381 reply.readException();
3382 reply.recycle();
3383 data.recycle();
3384 }
3385
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003386 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003387 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003388 IUiAutomationConnection connection, int userId, String instructionSet)
3389 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003390 Parcel data = Parcel.obtain();
3391 Parcel reply = Parcel.obtain();
3392 data.writeInterfaceToken(IActivityManager.descriptor);
3393 ComponentName.writeToParcel(className, data);
3394 data.writeString(profileFile);
3395 data.writeInt(flags);
3396 data.writeBundle(arguments);
3397 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003398 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003399 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003400 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003401 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3402 reply.readException();
3403 boolean res = reply.readInt() != 0;
3404 reply.recycle();
3405 data.recycle();
3406 return res;
3407 }
3408
3409 public void finishInstrumentation(IApplicationThread target,
3410 int resultCode, Bundle results) throws RemoteException {
3411 Parcel data = Parcel.obtain();
3412 Parcel reply = Parcel.obtain();
3413 data.writeInterfaceToken(IActivityManager.descriptor);
3414 data.writeStrongBinder(target != null ? target.asBinder() : null);
3415 data.writeInt(resultCode);
3416 data.writeBundle(results);
3417 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3418 reply.readException();
3419 data.recycle();
3420 reply.recycle();
3421 }
3422 public Configuration getConfiguration() throws RemoteException
3423 {
3424 Parcel data = Parcel.obtain();
3425 Parcel reply = Parcel.obtain();
3426 data.writeInterfaceToken(IActivityManager.descriptor);
3427 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3428 reply.readException();
3429 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3430 reply.recycle();
3431 data.recycle();
3432 return res;
3433 }
3434 public void updateConfiguration(Configuration values) throws RemoteException
3435 {
3436 Parcel data = Parcel.obtain();
3437 Parcel reply = Parcel.obtain();
3438 data.writeInterfaceToken(IActivityManager.descriptor);
3439 values.writeToParcel(data, 0);
3440 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3441 reply.readException();
3442 data.recycle();
3443 reply.recycle();
3444 }
3445 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3446 throws RemoteException {
3447 Parcel data = Parcel.obtain();
3448 Parcel reply = Parcel.obtain();
3449 data.writeInterfaceToken(IActivityManager.descriptor);
3450 data.writeStrongBinder(token);
3451 data.writeInt(requestedOrientation);
3452 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3453 reply.readException();
3454 data.recycle();
3455 reply.recycle();
3456 }
3457 public int getRequestedOrientation(IBinder token) throws RemoteException {
3458 Parcel data = Parcel.obtain();
3459 Parcel reply = Parcel.obtain();
3460 data.writeInterfaceToken(IActivityManager.descriptor);
3461 data.writeStrongBinder(token);
3462 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3463 reply.readException();
3464 int res = reply.readInt();
3465 data.recycle();
3466 reply.recycle();
3467 return res;
3468 }
3469 public ComponentName getActivityClassForToken(IBinder token)
3470 throws RemoteException {
3471 Parcel data = Parcel.obtain();
3472 Parcel reply = Parcel.obtain();
3473 data.writeInterfaceToken(IActivityManager.descriptor);
3474 data.writeStrongBinder(token);
3475 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3476 reply.readException();
3477 ComponentName res = ComponentName.readFromParcel(reply);
3478 data.recycle();
3479 reply.recycle();
3480 return res;
3481 }
3482 public String getPackageForToken(IBinder token) throws RemoteException
3483 {
3484 Parcel data = Parcel.obtain();
3485 Parcel reply = Parcel.obtain();
3486 data.writeInterfaceToken(IActivityManager.descriptor);
3487 data.writeStrongBinder(token);
3488 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3489 reply.readException();
3490 String res = reply.readString();
3491 data.recycle();
3492 reply.recycle();
3493 return res;
3494 }
3495 public IIntentSender getIntentSender(int type,
3496 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003497 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003498 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003499 Parcel data = Parcel.obtain();
3500 Parcel reply = Parcel.obtain();
3501 data.writeInterfaceToken(IActivityManager.descriptor);
3502 data.writeInt(type);
3503 data.writeString(packageName);
3504 data.writeStrongBinder(token);
3505 data.writeString(resultWho);
3506 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003507 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003508 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003509 data.writeTypedArray(intents, 0);
3510 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003511 } else {
3512 data.writeInt(0);
3513 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003514 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003515 if (options != null) {
3516 data.writeInt(1);
3517 options.writeToParcel(data, 0);
3518 } else {
3519 data.writeInt(0);
3520 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003521 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003522 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3523 reply.readException();
3524 IIntentSender res = IIntentSender.Stub.asInterface(
3525 reply.readStrongBinder());
3526 data.recycle();
3527 reply.recycle();
3528 return res;
3529 }
3530 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3531 Parcel data = Parcel.obtain();
3532 Parcel reply = Parcel.obtain();
3533 data.writeInterfaceToken(IActivityManager.descriptor);
3534 data.writeStrongBinder(sender.asBinder());
3535 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3536 reply.readException();
3537 data.recycle();
3538 reply.recycle();
3539 }
3540 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3541 Parcel data = Parcel.obtain();
3542 Parcel reply = Parcel.obtain();
3543 data.writeInterfaceToken(IActivityManager.descriptor);
3544 data.writeStrongBinder(sender.asBinder());
3545 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3546 reply.readException();
3547 String res = reply.readString();
3548 data.recycle();
3549 reply.recycle();
3550 return res;
3551 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003552 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3553 Parcel data = Parcel.obtain();
3554 Parcel reply = Parcel.obtain();
3555 data.writeInterfaceToken(IActivityManager.descriptor);
3556 data.writeStrongBinder(sender.asBinder());
3557 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3558 reply.readException();
3559 int res = reply.readInt();
3560 data.recycle();
3561 reply.recycle();
3562 return res;
3563 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003564 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3565 boolean requireFull, String name, String callerPackage) throws RemoteException {
3566 Parcel data = Parcel.obtain();
3567 Parcel reply = Parcel.obtain();
3568 data.writeInterfaceToken(IActivityManager.descriptor);
3569 data.writeInt(callingPid);
3570 data.writeInt(callingUid);
3571 data.writeInt(userId);
3572 data.writeInt(allowAll ? 1 : 0);
3573 data.writeInt(requireFull ? 1 : 0);
3574 data.writeString(name);
3575 data.writeString(callerPackage);
3576 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3577 reply.readException();
3578 int res = reply.readInt();
3579 data.recycle();
3580 reply.recycle();
3581 return res;
3582 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003583 public void setProcessLimit(int max) throws RemoteException
3584 {
3585 Parcel data = Parcel.obtain();
3586 Parcel reply = Parcel.obtain();
3587 data.writeInterfaceToken(IActivityManager.descriptor);
3588 data.writeInt(max);
3589 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3590 reply.readException();
3591 data.recycle();
3592 reply.recycle();
3593 }
3594 public int getProcessLimit() throws RemoteException
3595 {
3596 Parcel data = Parcel.obtain();
3597 Parcel reply = Parcel.obtain();
3598 data.writeInterfaceToken(IActivityManager.descriptor);
3599 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3600 reply.readException();
3601 int res = reply.readInt();
3602 data.recycle();
3603 reply.recycle();
3604 return res;
3605 }
3606 public void setProcessForeground(IBinder token, int pid,
3607 boolean isForeground) throws RemoteException {
3608 Parcel data = Parcel.obtain();
3609 Parcel reply = Parcel.obtain();
3610 data.writeInterfaceToken(IActivityManager.descriptor);
3611 data.writeStrongBinder(token);
3612 data.writeInt(pid);
3613 data.writeInt(isForeground ? 1 : 0);
3614 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3615 reply.readException();
3616 data.recycle();
3617 reply.recycle();
3618 }
3619 public int checkPermission(String permission, int pid, int uid)
3620 throws RemoteException {
3621 Parcel data = Parcel.obtain();
3622 Parcel reply = Parcel.obtain();
3623 data.writeInterfaceToken(IActivityManager.descriptor);
3624 data.writeString(permission);
3625 data.writeInt(pid);
3626 data.writeInt(uid);
3627 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3628 reply.readException();
3629 int res = reply.readInt();
3630 data.recycle();
3631 reply.recycle();
3632 return res;
3633 }
3634 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003635 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003636 Parcel data = Parcel.obtain();
3637 Parcel reply = Parcel.obtain();
3638 data.writeInterfaceToken(IActivityManager.descriptor);
3639 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003640 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003641 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003642 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3643 reply.readException();
3644 boolean res = reply.readInt() != 0;
3645 data.recycle();
3646 reply.recycle();
3647 return res;
3648 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003649 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003650 throws RemoteException {
3651 Parcel data = Parcel.obtain();
3652 Parcel reply = Parcel.obtain();
3653 data.writeInterfaceToken(IActivityManager.descriptor);
3654 uri.writeToParcel(data, 0);
3655 data.writeInt(pid);
3656 data.writeInt(uid);
3657 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003658 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003659 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3660 reply.readException();
3661 int res = reply.readInt();
3662 data.recycle();
3663 reply.recycle();
3664 return res;
3665 }
3666 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003667 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003668 Parcel data = Parcel.obtain();
3669 Parcel reply = Parcel.obtain();
3670 data.writeInterfaceToken(IActivityManager.descriptor);
3671 data.writeStrongBinder(caller.asBinder());
3672 data.writeString(targetPkg);
3673 uri.writeToParcel(data, 0);
3674 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003675 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003676 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3677 reply.readException();
3678 data.recycle();
3679 reply.recycle();
3680 }
3681 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003682 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003683 Parcel data = Parcel.obtain();
3684 Parcel reply = Parcel.obtain();
3685 data.writeInterfaceToken(IActivityManager.descriptor);
3686 data.writeStrongBinder(caller.asBinder());
3687 uri.writeToParcel(data, 0);
3688 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003689 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003690 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3691 reply.readException();
3692 data.recycle();
3693 reply.recycle();
3694 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003695
3696 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003697 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3698 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003699 Parcel data = Parcel.obtain();
3700 Parcel reply = Parcel.obtain();
3701 data.writeInterfaceToken(IActivityManager.descriptor);
3702 uri.writeToParcel(data, 0);
3703 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003704 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003705 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3706 reply.readException();
3707 data.recycle();
3708 reply.recycle();
3709 }
3710
3711 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003712 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3713 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003714 Parcel data = Parcel.obtain();
3715 Parcel reply = Parcel.obtain();
3716 data.writeInterfaceToken(IActivityManager.descriptor);
3717 uri.writeToParcel(data, 0);
3718 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003719 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003720 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3721 reply.readException();
3722 data.recycle();
3723 reply.recycle();
3724 }
3725
3726 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003727 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3728 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003729 Parcel data = Parcel.obtain();
3730 Parcel reply = Parcel.obtain();
3731 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003732 data.writeString(packageName);
3733 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003734 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3735 reply.readException();
3736 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3737 reply);
3738 data.recycle();
3739 reply.recycle();
3740 return perms;
3741 }
3742
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003743 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3744 throws RemoteException {
3745 Parcel data = Parcel.obtain();
3746 Parcel reply = Parcel.obtain();
3747 data.writeInterfaceToken(IActivityManager.descriptor);
3748 data.writeStrongBinder(who.asBinder());
3749 data.writeInt(waiting ? 1 : 0);
3750 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3751 reply.readException();
3752 data.recycle();
3753 reply.recycle();
3754 }
3755 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3756 Parcel data = Parcel.obtain();
3757 Parcel reply = Parcel.obtain();
3758 data.writeInterfaceToken(IActivityManager.descriptor);
3759 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3760 reply.readException();
3761 outInfo.readFromParcel(reply);
3762 data.recycle();
3763 reply.recycle();
3764 }
3765 public void unhandledBack() throws RemoteException
3766 {
3767 Parcel data = Parcel.obtain();
3768 Parcel reply = Parcel.obtain();
3769 data.writeInterfaceToken(IActivityManager.descriptor);
3770 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3771 reply.readException();
3772 data.recycle();
3773 reply.recycle();
3774 }
3775 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3776 {
3777 Parcel data = Parcel.obtain();
3778 Parcel reply = Parcel.obtain();
3779 data.writeInterfaceToken(IActivityManager.descriptor);
3780 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3781 reply.readException();
3782 ParcelFileDescriptor pfd = null;
3783 if (reply.readInt() != 0) {
3784 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3785 }
3786 data.recycle();
3787 reply.recycle();
3788 return pfd;
3789 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003790 public void setLockScreenShown(boolean shown) throws RemoteException
3791 {
3792 Parcel data = Parcel.obtain();
3793 Parcel reply = Parcel.obtain();
3794 data.writeInterfaceToken(IActivityManager.descriptor);
3795 data.writeInt(shown ? 1 : 0);
3796 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3797 reply.readException();
3798 data.recycle();
3799 reply.recycle();
3800 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003801 public void setDebugApp(
3802 String packageName, boolean waitForDebugger, boolean persistent)
3803 throws RemoteException
3804 {
3805 Parcel data = Parcel.obtain();
3806 Parcel reply = Parcel.obtain();
3807 data.writeInterfaceToken(IActivityManager.descriptor);
3808 data.writeString(packageName);
3809 data.writeInt(waitForDebugger ? 1 : 0);
3810 data.writeInt(persistent ? 1 : 0);
3811 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3812 reply.readException();
3813 data.recycle();
3814 reply.recycle();
3815 }
3816 public void setAlwaysFinish(boolean enabled) throws RemoteException
3817 {
3818 Parcel data = Parcel.obtain();
3819 Parcel reply = Parcel.obtain();
3820 data.writeInterfaceToken(IActivityManager.descriptor);
3821 data.writeInt(enabled ? 1 : 0);
3822 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3823 reply.readException();
3824 data.recycle();
3825 reply.recycle();
3826 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003827 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003828 {
3829 Parcel data = Parcel.obtain();
3830 Parcel reply = Parcel.obtain();
3831 data.writeInterfaceToken(IActivityManager.descriptor);
3832 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003833 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003834 reply.readException();
3835 data.recycle();
3836 reply.recycle();
3837 }
3838 public void enterSafeMode() throws RemoteException {
3839 Parcel data = Parcel.obtain();
3840 data.writeInterfaceToken(IActivityManager.descriptor);
3841 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3842 data.recycle();
3843 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003844 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3845 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003846 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003847 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003848 data.writeStrongBinder(sender.asBinder());
3849 data.writeInt(sourceUid);
3850 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003851 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3852 data.recycle();
3853 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003854 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003855 Parcel data = Parcel.obtain();
3856 Parcel reply = Parcel.obtain();
3857 data.writeInterfaceToken(IActivityManager.descriptor);
3858 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003859 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003860 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003861 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003862 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003863 boolean res = reply.readInt() != 0;
3864 data.recycle();
3865 reply.recycle();
3866 return res;
3867 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003868 @Override
3869 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3870 Parcel data = Parcel.obtain();
3871 Parcel reply = Parcel.obtain();
3872 data.writeInterfaceToken(IActivityManager.descriptor);
3873 data.writeString(reason);
3874 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3875 boolean res = reply.readInt() != 0;
3876 data.recycle();
3877 reply.recycle();
3878 return res;
3879 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003880 public boolean testIsSystemReady()
3881 {
3882 /* this base class version is never called */
3883 return true;
3884 }
Dan Egnor60d87622009-12-16 16:32:58 -08003885 public void handleApplicationCrash(IBinder app,
3886 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3887 {
3888 Parcel data = Parcel.obtain();
3889 Parcel reply = Parcel.obtain();
3890 data.writeInterfaceToken(IActivityManager.descriptor);
3891 data.writeStrongBinder(app);
3892 crashInfo.writeToParcel(data, 0);
3893 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3894 reply.readException();
3895 reply.recycle();
3896 data.recycle();
3897 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003898
Dan Egnor60d87622009-12-16 16:32:58 -08003899 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003900 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003901 {
3902 Parcel data = Parcel.obtain();
3903 Parcel reply = Parcel.obtain();
3904 data.writeInterfaceToken(IActivityManager.descriptor);
3905 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003906 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003907 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003908 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003909 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003910 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003911 reply.recycle();
3912 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003913 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003914 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003915
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003916 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003917 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003918 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003919 {
3920 Parcel data = Parcel.obtain();
3921 Parcel reply = Parcel.obtain();
3922 data.writeInterfaceToken(IActivityManager.descriptor);
3923 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003924 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003925 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003926 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3927 reply.readException();
3928 reply.recycle();
3929 data.recycle();
3930 }
3931
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003932 public void signalPersistentProcesses(int sig) throws RemoteException {
3933 Parcel data = Parcel.obtain();
3934 Parcel reply = Parcel.obtain();
3935 data.writeInterfaceToken(IActivityManager.descriptor);
3936 data.writeInt(sig);
3937 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3938 reply.readException();
3939 data.recycle();
3940 reply.recycle();
3941 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003942
Dianne Hackborn1676c852012-09-10 14:52:30 -07003943 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003944 Parcel data = Parcel.obtain();
3945 Parcel reply = Parcel.obtain();
3946 data.writeInterfaceToken(IActivityManager.descriptor);
3947 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003948 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003949 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3950 reply.readException();
3951 data.recycle();
3952 reply.recycle();
3953 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003954
3955 public void killAllBackgroundProcesses() throws RemoteException {
3956 Parcel data = Parcel.obtain();
3957 Parcel reply = Parcel.obtain();
3958 data.writeInterfaceToken(IActivityManager.descriptor);
3959 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3960 reply.readException();
3961 data.recycle();
3962 reply.recycle();
3963 }
3964
Dianne Hackborn1676c852012-09-10 14:52:30 -07003965 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003966 Parcel data = Parcel.obtain();
3967 Parcel reply = Parcel.obtain();
3968 data.writeInterfaceToken(IActivityManager.descriptor);
3969 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003970 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003971 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003972 reply.readException();
3973 data.recycle();
3974 reply.recycle();
3975 }
3976
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003977 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3978 throws RemoteException
3979 {
3980 Parcel data = Parcel.obtain();
3981 Parcel reply = Parcel.obtain();
3982 data.writeInterfaceToken(IActivityManager.descriptor);
3983 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3984 reply.readException();
3985 outInfo.readFromParcel(reply);
3986 reply.recycle();
3987 data.recycle();
3988 }
3989
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003990 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3991 {
3992 Parcel data = Parcel.obtain();
3993 Parcel reply = Parcel.obtain();
3994 data.writeInterfaceToken(IActivityManager.descriptor);
3995 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3996 reply.readException();
3997 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3998 reply.recycle();
3999 data.recycle();
4000 return res;
4001 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004002
Dianne Hackborn1676c852012-09-10 14:52:30 -07004003 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07004004 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004005 {
4006 Parcel data = Parcel.obtain();
4007 Parcel reply = Parcel.obtain();
4008 data.writeInterfaceToken(IActivityManager.descriptor);
4009 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004010 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004011 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004012 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004013 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004014 if (fd != null) {
4015 data.writeInt(1);
4016 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4017 } else {
4018 data.writeInt(0);
4019 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004020 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4021 reply.readException();
4022 boolean res = reply.readInt() != 0;
4023 reply.recycle();
4024 data.recycle();
4025 return res;
4026 }
4027
Dianne Hackborn55280a92009-05-07 15:53:46 -07004028 public boolean shutdown(int timeout) throws RemoteException
4029 {
4030 Parcel data = Parcel.obtain();
4031 Parcel reply = Parcel.obtain();
4032 data.writeInterfaceToken(IActivityManager.descriptor);
4033 data.writeInt(timeout);
4034 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4035 reply.readException();
4036 boolean res = reply.readInt() != 0;
4037 reply.recycle();
4038 data.recycle();
4039 return res;
4040 }
4041
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004042 public void stopAppSwitches() throws RemoteException {
4043 Parcel data = Parcel.obtain();
4044 Parcel reply = Parcel.obtain();
4045 data.writeInterfaceToken(IActivityManager.descriptor);
4046 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4047 reply.readException();
4048 reply.recycle();
4049 data.recycle();
4050 }
4051
4052 public void resumeAppSwitches() throws RemoteException {
4053 Parcel data = Parcel.obtain();
4054 Parcel reply = Parcel.obtain();
4055 data.writeInterfaceToken(IActivityManager.descriptor);
4056 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4057 reply.readException();
4058 reply.recycle();
4059 data.recycle();
4060 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004061
4062 public void addPackageDependency(String packageName) throws RemoteException {
4063 Parcel data = Parcel.obtain();
4064 Parcel reply = Parcel.obtain();
4065 data.writeInterfaceToken(IActivityManager.descriptor);
4066 data.writeString(packageName);
4067 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4068 reply.readException();
4069 data.recycle();
4070 reply.recycle();
4071 }
4072
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004073 public void killApplicationWithAppId(String pkg, int appid, String reason)
4074 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004075 Parcel data = Parcel.obtain();
4076 Parcel reply = Parcel.obtain();
4077 data.writeInterfaceToken(IActivityManager.descriptor);
4078 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004079 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004080 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004081 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004082 reply.readException();
4083 data.recycle();
4084 reply.recycle();
4085 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004086
4087 public void closeSystemDialogs(String reason) throws RemoteException {
4088 Parcel data = Parcel.obtain();
4089 Parcel reply = Parcel.obtain();
4090 data.writeInterfaceToken(IActivityManager.descriptor);
4091 data.writeString(reason);
4092 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4093 reply.readException();
4094 data.recycle();
4095 reply.recycle();
4096 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004097
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004098 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004099 throws RemoteException {
4100 Parcel data = Parcel.obtain();
4101 Parcel reply = Parcel.obtain();
4102 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004103 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004104 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4105 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004106 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004107 data.recycle();
4108 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004109 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004110 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004111
4112 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4113 Parcel data = Parcel.obtain();
4114 Parcel reply = Parcel.obtain();
4115 data.writeInterfaceToken(IActivityManager.descriptor);
4116 data.writeString(processName);
4117 data.writeInt(uid);
4118 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4119 reply.readException();
4120 data.recycle();
4121 reply.recycle();
4122 }
4123
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004124 public void overridePendingTransition(IBinder token, String packageName,
4125 int enterAnim, int exitAnim) throws RemoteException {
4126 Parcel data = Parcel.obtain();
4127 Parcel reply = Parcel.obtain();
4128 data.writeInterfaceToken(IActivityManager.descriptor);
4129 data.writeStrongBinder(token);
4130 data.writeString(packageName);
4131 data.writeInt(enterAnim);
4132 data.writeInt(exitAnim);
4133 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4134 reply.readException();
4135 data.recycle();
4136 reply.recycle();
4137 }
4138
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004139 public boolean isUserAMonkey() throws RemoteException {
4140 Parcel data = Parcel.obtain();
4141 Parcel reply = Parcel.obtain();
4142 data.writeInterfaceToken(IActivityManager.descriptor);
4143 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4144 reply.readException();
4145 boolean res = reply.readInt() != 0;
4146 data.recycle();
4147 reply.recycle();
4148 return res;
4149 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004150
4151 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4152 Parcel data = Parcel.obtain();
4153 Parcel reply = Parcel.obtain();
4154 data.writeInterfaceToken(IActivityManager.descriptor);
4155 data.writeInt(monkey ? 1 : 0);
4156 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4157 reply.readException();
4158 data.recycle();
4159 reply.recycle();
4160 }
4161
Dianne Hackborn860755f2010-06-03 18:47:52 -07004162 public void finishHeavyWeightApp() throws RemoteException {
4163 Parcel data = Parcel.obtain();
4164 Parcel reply = Parcel.obtain();
4165 data.writeInterfaceToken(IActivityManager.descriptor);
4166 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4167 reply.readException();
4168 data.recycle();
4169 reply.recycle();
4170 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004171
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004172 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004173 throws RemoteException {
4174 Parcel data = Parcel.obtain();
4175 Parcel reply = Parcel.obtain();
4176 data.writeInterfaceToken(IActivityManager.descriptor);
4177 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004178 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4179 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004180 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004181 data.recycle();
4182 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004183 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004184 }
4185
Craig Mautner233ceee2014-05-09 17:05:11 -07004186 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004187 throws RemoteException {
4188 Parcel data = Parcel.obtain();
4189 Parcel reply = Parcel.obtain();
4190 data.writeInterfaceToken(IActivityManager.descriptor);
4191 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004192 if (options == null) {
4193 data.writeInt(0);
4194 } else {
4195 data.writeInt(1);
4196 data.writeBundle(options.toBundle());
4197 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004198 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004199 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004200 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004201 data.recycle();
4202 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004203 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004204 }
4205
Craig Mautner233ceee2014-05-09 17:05:11 -07004206 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4207 Parcel data = Parcel.obtain();
4208 Parcel reply = Parcel.obtain();
4209 data.writeInterfaceToken(IActivityManager.descriptor);
4210 data.writeStrongBinder(token);
4211 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4212 reply.readException();
4213 Bundle bundle = reply.readBundle();
4214 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4215 data.recycle();
4216 reply.recycle();
4217 return options;
4218 }
4219
Daniel Sandler69a48172010-06-23 16:29:36 -04004220 public void setImmersive(IBinder token, boolean immersive)
4221 throws RemoteException {
4222 Parcel data = Parcel.obtain();
4223 Parcel reply = Parcel.obtain();
4224 data.writeInterfaceToken(IActivityManager.descriptor);
4225 data.writeStrongBinder(token);
4226 data.writeInt(immersive ? 1 : 0);
4227 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4228 reply.readException();
4229 data.recycle();
4230 reply.recycle();
4231 }
4232
4233 public boolean isImmersive(IBinder token)
4234 throws RemoteException {
4235 Parcel data = Parcel.obtain();
4236 Parcel reply = Parcel.obtain();
4237 data.writeInterfaceToken(IActivityManager.descriptor);
4238 data.writeStrongBinder(token);
4239 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004240 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004241 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004242 data.recycle();
4243 reply.recycle();
4244 return res;
4245 }
4246
Craig Mautnerd61dc202014-07-07 11:09:11 -07004247 public boolean isTopOfTask(IBinder token) throws RemoteException {
4248 Parcel data = Parcel.obtain();
4249 Parcel reply = Parcel.obtain();
4250 data.writeInterfaceToken(IActivityManager.descriptor);
4251 data.writeStrongBinder(token);
4252 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4253 reply.readException();
4254 boolean res = reply.readInt() == 1;
4255 data.recycle();
4256 reply.recycle();
4257 return res;
4258 }
4259
Daniel Sandler69a48172010-06-23 16:29:36 -04004260 public boolean isTopActivityImmersive()
4261 throws RemoteException {
4262 Parcel data = Parcel.obtain();
4263 Parcel reply = Parcel.obtain();
4264 data.writeInterfaceToken(IActivityManager.descriptor);
4265 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004266 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004267 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004268 data.recycle();
4269 reply.recycle();
4270 return res;
4271 }
4272
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004273 public void crashApplication(int uid, int initialPid, String packageName,
4274 String message) throws RemoteException {
4275 Parcel data = Parcel.obtain();
4276 Parcel reply = Parcel.obtain();
4277 data.writeInterfaceToken(IActivityManager.descriptor);
4278 data.writeInt(uid);
4279 data.writeInt(initialPid);
4280 data.writeString(packageName);
4281 data.writeString(message);
4282 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4283 reply.readException();
4284 data.recycle();
4285 reply.recycle();
4286 }
Andy McFadden824c5102010-07-09 16:26:57 -07004287
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004288 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004289 Parcel data = Parcel.obtain();
4290 Parcel reply = Parcel.obtain();
4291 data.writeInterfaceToken(IActivityManager.descriptor);
4292 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004293 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004294 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4295 reply.readException();
4296 String res = reply.readString();
4297 data.recycle();
4298 reply.recycle();
4299 return res;
4300 }
4301
Dianne Hackborn7e269642010-08-25 19:50:20 -07004302 public IBinder newUriPermissionOwner(String name)
4303 throws RemoteException {
4304 Parcel data = Parcel.obtain();
4305 Parcel reply = Parcel.obtain();
4306 data.writeInterfaceToken(IActivityManager.descriptor);
4307 data.writeString(name);
4308 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4309 reply.readException();
4310 IBinder res = reply.readStrongBinder();
4311 data.recycle();
4312 reply.recycle();
4313 return res;
4314 }
4315
4316 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004317 Uri uri, int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004318 Parcel data = Parcel.obtain();
4319 Parcel reply = Parcel.obtain();
4320 data.writeInterfaceToken(IActivityManager.descriptor);
4321 data.writeStrongBinder(owner);
4322 data.writeInt(fromUid);
4323 data.writeString(targetPkg);
4324 uri.writeToParcel(data, 0);
4325 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004326 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004327 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4328 reply.readException();
4329 data.recycle();
4330 reply.recycle();
4331 }
4332
4333 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004334 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004335 Parcel data = Parcel.obtain();
4336 Parcel reply = Parcel.obtain();
4337 data.writeInterfaceToken(IActivityManager.descriptor);
4338 data.writeStrongBinder(owner);
4339 if (uri != null) {
4340 data.writeInt(1);
4341 uri.writeToParcel(data, 0);
4342 } else {
4343 data.writeInt(0);
4344 }
4345 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004346 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004347 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4348 reply.readException();
4349 data.recycle();
4350 reply.recycle();
4351 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004352
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004353 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004354 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004355 Parcel data = Parcel.obtain();
4356 Parcel reply = Parcel.obtain();
4357 data.writeInterfaceToken(IActivityManager.descriptor);
4358 data.writeInt(callingUid);
4359 data.writeString(targetPkg);
4360 uri.writeToParcel(data, 0);
4361 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004362 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004363 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4364 reply.readException();
4365 int res = reply.readInt();
4366 data.recycle();
4367 reply.recycle();
4368 return res;
4369 }
4370
Dianne Hackborn1676c852012-09-10 14:52:30 -07004371 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004372 String path, ParcelFileDescriptor fd) throws RemoteException {
4373 Parcel data = Parcel.obtain();
4374 Parcel reply = Parcel.obtain();
4375 data.writeInterfaceToken(IActivityManager.descriptor);
4376 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004377 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004378 data.writeInt(managed ? 1 : 0);
4379 data.writeString(path);
4380 if (fd != null) {
4381 data.writeInt(1);
4382 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4383 } else {
4384 data.writeInt(0);
4385 }
4386 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4387 reply.readException();
4388 boolean res = reply.readInt() != 0;
4389 reply.recycle();
4390 data.recycle();
4391 return res;
4392 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004393
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004394 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004395 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004396 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004397 Parcel data = Parcel.obtain();
4398 Parcel reply = Parcel.obtain();
4399 data.writeInterfaceToken(IActivityManager.descriptor);
4400 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004401 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004402 data.writeTypedArray(intents, 0);
4403 data.writeStringArray(resolvedTypes);
4404 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004405 if (options != null) {
4406 data.writeInt(1);
4407 options.writeToParcel(data, 0);
4408 } else {
4409 data.writeInt(0);
4410 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004411 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004412 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4413 reply.readException();
4414 int result = reply.readInt();
4415 reply.recycle();
4416 data.recycle();
4417 return result;
4418 }
4419
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004420 public int getFrontActivityScreenCompatMode() throws RemoteException {
4421 Parcel data = Parcel.obtain();
4422 Parcel reply = Parcel.obtain();
4423 data.writeInterfaceToken(IActivityManager.descriptor);
4424 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4425 reply.readException();
4426 int mode = reply.readInt();
4427 reply.recycle();
4428 data.recycle();
4429 return mode;
4430 }
4431
4432 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4433 Parcel data = Parcel.obtain();
4434 Parcel reply = Parcel.obtain();
4435 data.writeInterfaceToken(IActivityManager.descriptor);
4436 data.writeInt(mode);
4437 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4438 reply.readException();
4439 reply.recycle();
4440 data.recycle();
4441 }
4442
4443 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4444 Parcel data = Parcel.obtain();
4445 Parcel reply = Parcel.obtain();
4446 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004447 data.writeString(packageName);
4448 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004449 reply.readException();
4450 int mode = reply.readInt();
4451 reply.recycle();
4452 data.recycle();
4453 return mode;
4454 }
4455
4456 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004457 throws RemoteException {
4458 Parcel data = Parcel.obtain();
4459 Parcel reply = Parcel.obtain();
4460 data.writeInterfaceToken(IActivityManager.descriptor);
4461 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004462 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004463 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4464 reply.readException();
4465 reply.recycle();
4466 data.recycle();
4467 }
4468
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004469 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4470 Parcel data = Parcel.obtain();
4471 Parcel reply = Parcel.obtain();
4472 data.writeInterfaceToken(IActivityManager.descriptor);
4473 data.writeString(packageName);
4474 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4475 reply.readException();
4476 boolean ask = reply.readInt() != 0;
4477 reply.recycle();
4478 data.recycle();
4479 return ask;
4480 }
4481
4482 public void setPackageAskScreenCompat(String packageName, boolean ask)
4483 throws RemoteException {
4484 Parcel data = Parcel.obtain();
4485 Parcel reply = Parcel.obtain();
4486 data.writeInterfaceToken(IActivityManager.descriptor);
4487 data.writeString(packageName);
4488 data.writeInt(ask ? 1 : 0);
4489 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4490 reply.readException();
4491 reply.recycle();
4492 data.recycle();
4493 }
4494
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004495 public boolean switchUser(int userid) throws RemoteException {
4496 Parcel data = Parcel.obtain();
4497 Parcel reply = Parcel.obtain();
4498 data.writeInterfaceToken(IActivityManager.descriptor);
4499 data.writeInt(userid);
4500 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4501 reply.readException();
4502 boolean result = reply.readInt() != 0;
4503 reply.recycle();
4504 data.recycle();
4505 return result;
4506 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004507
Kenny Guy08488bf2014-02-21 17:40:37 +00004508 public boolean startUserInBackground(int userid) throws RemoteException {
4509 Parcel data = Parcel.obtain();
4510 Parcel reply = Parcel.obtain();
4511 data.writeInterfaceToken(IActivityManager.descriptor);
4512 data.writeInt(userid);
4513 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4514 reply.readException();
4515 boolean result = reply.readInt() != 0;
4516 reply.recycle();
4517 data.recycle();
4518 return result;
4519 }
4520
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004521 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4522 Parcel data = Parcel.obtain();
4523 Parcel reply = Parcel.obtain();
4524 data.writeInterfaceToken(IActivityManager.descriptor);
4525 data.writeInt(userid);
4526 data.writeStrongInterface(callback);
4527 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4528 reply.readException();
4529 int result = reply.readInt();
4530 reply.recycle();
4531 data.recycle();
4532 return result;
4533 }
4534
Amith Yamasani52f1d752012-03-28 18:19:29 -07004535 public UserInfo getCurrentUser() throws RemoteException {
4536 Parcel data = Parcel.obtain();
4537 Parcel reply = Parcel.obtain();
4538 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004539 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004540 reply.readException();
4541 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4542 reply.recycle();
4543 data.recycle();
4544 return userInfo;
4545 }
4546
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004547 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004548 Parcel data = Parcel.obtain();
4549 Parcel reply = Parcel.obtain();
4550 data.writeInterfaceToken(IActivityManager.descriptor);
4551 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004552 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004553 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4554 reply.readException();
4555 boolean result = reply.readInt() != 0;
4556 reply.recycle();
4557 data.recycle();
4558 return result;
4559 }
4560
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004561 public int[] getRunningUserIds() throws RemoteException {
4562 Parcel data = Parcel.obtain();
4563 Parcel reply = Parcel.obtain();
4564 data.writeInterfaceToken(IActivityManager.descriptor);
4565 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4566 reply.readException();
4567 int[] result = reply.createIntArray();
4568 reply.recycle();
4569 data.recycle();
4570 return result;
4571 }
4572
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004573 public boolean removeTask(int taskId, int flags) throws RemoteException {
4574 Parcel data = Parcel.obtain();
4575 Parcel reply = Parcel.obtain();
4576 data.writeInterfaceToken(IActivityManager.descriptor);
4577 data.writeInt(taskId);
4578 data.writeInt(flags);
4579 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4580 reply.readException();
4581 boolean result = reply.readInt() != 0;
4582 reply.recycle();
4583 data.recycle();
4584 return result;
4585 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004586
Jeff Sharkeya4620792011-05-20 15:29:23 -07004587 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4588 Parcel data = Parcel.obtain();
4589 Parcel reply = Parcel.obtain();
4590 data.writeInterfaceToken(IActivityManager.descriptor);
4591 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4592 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4593 reply.readException();
4594 data.recycle();
4595 reply.recycle();
4596 }
4597
4598 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4599 Parcel data = Parcel.obtain();
4600 Parcel reply = Parcel.obtain();
4601 data.writeInterfaceToken(IActivityManager.descriptor);
4602 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4603 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4604 reply.readException();
4605 data.recycle();
4606 reply.recycle();
4607 }
4608
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004609 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4610 Parcel data = Parcel.obtain();
4611 Parcel reply = Parcel.obtain();
4612 data.writeInterfaceToken(IActivityManager.descriptor);
4613 data.writeStrongBinder(sender.asBinder());
4614 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4615 reply.readException();
4616 boolean res = reply.readInt() != 0;
4617 data.recycle();
4618 reply.recycle();
4619 return res;
4620 }
4621
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004622 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4623 Parcel data = Parcel.obtain();
4624 Parcel reply = Parcel.obtain();
4625 data.writeInterfaceToken(IActivityManager.descriptor);
4626 data.writeStrongBinder(sender.asBinder());
4627 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4628 reply.readException();
4629 boolean res = reply.readInt() != 0;
4630 data.recycle();
4631 reply.recycle();
4632 return res;
4633 }
4634
Dianne Hackborn81038902012-11-26 17:04:09 -08004635 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4636 Parcel data = Parcel.obtain();
4637 Parcel reply = Parcel.obtain();
4638 data.writeInterfaceToken(IActivityManager.descriptor);
4639 data.writeStrongBinder(sender.asBinder());
4640 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4641 reply.readException();
4642 Intent res = reply.readInt() != 0
4643 ? Intent.CREATOR.createFromParcel(reply) : null;
4644 data.recycle();
4645 reply.recycle();
4646 return res;
4647 }
4648
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004649 public String getTagForIntentSender(IIntentSender sender, String prefix)
4650 throws RemoteException {
4651 Parcel data = Parcel.obtain();
4652 Parcel reply = Parcel.obtain();
4653 data.writeInterfaceToken(IActivityManager.descriptor);
4654 data.writeStrongBinder(sender.asBinder());
4655 data.writeString(prefix);
4656 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4657 reply.readException();
4658 String res = reply.readString();
4659 data.recycle();
4660 reply.recycle();
4661 return res;
4662 }
4663
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004664 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4665 {
4666 Parcel data = Parcel.obtain();
4667 Parcel reply = Parcel.obtain();
4668 data.writeInterfaceToken(IActivityManager.descriptor);
4669 values.writeToParcel(data, 0);
4670 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4671 reply.readException();
4672 data.recycle();
4673 reply.recycle();
4674 }
4675
Dianne Hackbornb437e092011-08-05 17:50:29 -07004676 public long[] getProcessPss(int[] pids) throws RemoteException {
4677 Parcel data = Parcel.obtain();
4678 Parcel reply = Parcel.obtain();
4679 data.writeInterfaceToken(IActivityManager.descriptor);
4680 data.writeIntArray(pids);
4681 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4682 reply.readException();
4683 long[] res = reply.createLongArray();
4684 data.recycle();
4685 reply.recycle();
4686 return res;
4687 }
4688
Dianne Hackborn661cd522011-08-22 00:26:20 -07004689 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4690 Parcel data = Parcel.obtain();
4691 Parcel reply = Parcel.obtain();
4692 data.writeInterfaceToken(IActivityManager.descriptor);
4693 TextUtils.writeToParcel(msg, data, 0);
4694 data.writeInt(always ? 1 : 0);
4695 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4696 reply.readException();
4697 data.recycle();
4698 reply.recycle();
4699 }
4700
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004701 public void dismissKeyguardOnNextActivity() throws RemoteException {
4702 Parcel data = Parcel.obtain();
4703 Parcel reply = Parcel.obtain();
4704 data.writeInterfaceToken(IActivityManager.descriptor);
4705 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4706 reply.readException();
4707 data.recycle();
4708 reply.recycle();
4709 }
4710
Adam Powelldd8fab22012-03-22 17:47:27 -07004711 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4712 throws RemoteException {
4713 Parcel data = Parcel.obtain();
4714 Parcel reply = Parcel.obtain();
4715 data.writeInterfaceToken(IActivityManager.descriptor);
4716 data.writeStrongBinder(token);
4717 data.writeString(destAffinity);
4718 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4719 reply.readException();
4720 boolean result = reply.readInt() != 0;
4721 data.recycle();
4722 reply.recycle();
4723 return result;
4724 }
4725
4726 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4727 throws RemoteException {
4728 Parcel data = Parcel.obtain();
4729 Parcel reply = Parcel.obtain();
4730 data.writeInterfaceToken(IActivityManager.descriptor);
4731 data.writeStrongBinder(token);
4732 target.writeToParcel(data, 0);
4733 data.writeInt(resultCode);
4734 if (resultData != null) {
4735 data.writeInt(1);
4736 resultData.writeToParcel(data, 0);
4737 } else {
4738 data.writeInt(0);
4739 }
4740 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4741 reply.readException();
4742 boolean result = reply.readInt() != 0;
4743 data.recycle();
4744 reply.recycle();
4745 return result;
4746 }
4747
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004748 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4749 Parcel data = Parcel.obtain();
4750 Parcel reply = Parcel.obtain();
4751 data.writeInterfaceToken(IActivityManager.descriptor);
4752 data.writeStrongBinder(activityToken);
4753 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4754 reply.readException();
4755 int result = reply.readInt();
4756 data.recycle();
4757 reply.recycle();
4758 return result;
4759 }
4760
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004761 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4762 Parcel data = Parcel.obtain();
4763 Parcel reply = Parcel.obtain();
4764 data.writeInterfaceToken(IActivityManager.descriptor);
4765 data.writeStrongBinder(activityToken);
4766 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4767 reply.readException();
4768 String result = reply.readString();
4769 data.recycle();
4770 reply.recycle();
4771 return result;
4772 }
4773
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004774 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4775 Parcel data = Parcel.obtain();
4776 Parcel reply = Parcel.obtain();
4777 data.writeInterfaceToken(IActivityManager.descriptor);
4778 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4779 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4780 reply.readException();
4781 data.recycle();
4782 reply.recycle();
4783 }
4784
4785 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4786 Parcel data = Parcel.obtain();
4787 Parcel reply = Parcel.obtain();
4788 data.writeInterfaceToken(IActivityManager.descriptor);
4789 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4790 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4791 reply.readException();
4792 data.recycle();
4793 reply.recycle();
4794 }
4795
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004796 public void requestBugReport() throws RemoteException {
4797 Parcel data = Parcel.obtain();
4798 Parcel reply = Parcel.obtain();
4799 data.writeInterfaceToken(IActivityManager.descriptor);
4800 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4801 reply.readException();
4802 data.recycle();
4803 reply.recycle();
4804 }
4805
Jeff Brownbd181bb2013-09-10 16:44:24 -07004806 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4807 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004808 Parcel data = Parcel.obtain();
4809 Parcel reply = Parcel.obtain();
4810 data.writeInterfaceToken(IActivityManager.descriptor);
4811 data.writeInt(pid);
4812 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004813 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004814 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4815 reply.readException();
4816 long res = reply.readInt();
4817 data.recycle();
4818 reply.recycle();
4819 return res;
4820 }
4821
Adam Skorydfc7fd72013-08-05 19:23:41 -07004822 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004823 Parcel data = Parcel.obtain();
4824 Parcel reply = Parcel.obtain();
4825 data.writeInterfaceToken(IActivityManager.descriptor);
4826 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004827 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004828 reply.readException();
4829 Bundle res = reply.readBundle();
4830 data.recycle();
4831 reply.recycle();
4832 return res;
4833 }
4834
Adam Skory7140a252013-09-11 12:04:58 +01004835 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004836 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004837 Parcel data = Parcel.obtain();
4838 Parcel reply = Parcel.obtain();
4839 data.writeInterfaceToken(IActivityManager.descriptor);
4840 data.writeStrongBinder(token);
4841 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004842 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004843 reply.readException();
4844 data.recycle();
4845 reply.recycle();
4846 }
4847
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004848 public void killUid(int uid, String reason) throws RemoteException {
4849 Parcel data = Parcel.obtain();
4850 Parcel reply = Parcel.obtain();
4851 data.writeInterfaceToken(IActivityManager.descriptor);
4852 data.writeInt(uid);
4853 data.writeString(reason);
4854 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4855 reply.readException();
4856 data.recycle();
4857 reply.recycle();
4858 }
4859
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004860 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4861 Parcel data = Parcel.obtain();
4862 Parcel reply = Parcel.obtain();
4863 data.writeInterfaceToken(IActivityManager.descriptor);
4864 data.writeStrongBinder(who);
4865 data.writeInt(allowRestart ? 1 : 0);
4866 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4867 reply.readException();
4868 data.recycle();
4869 reply.recycle();
4870 }
4871
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004872 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4873 Parcel data = Parcel.obtain();
4874 Parcel reply = Parcel.obtain();
4875 data.writeInterfaceToken(IActivityManager.descriptor);
4876 data.writeStrongBinder(token);
4877 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4878 reply.readException();
4879 data.recycle();
4880 reply.recycle();
4881 }
4882
Craig Mautner5eda9b32013-07-02 11:58:16 -07004883 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4884 Parcel data = Parcel.obtain();
4885 Parcel reply = Parcel.obtain();
4886 data.writeInterfaceToken(IActivityManager.descriptor);
4887 data.writeStrongBinder(token);
4888 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4889 reply.readException();
4890 data.recycle();
4891 reply.recycle();
4892 }
4893
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004894 public void restart() throws RemoteException {
4895 Parcel data = Parcel.obtain();
4896 Parcel reply = Parcel.obtain();
4897 data.writeInterfaceToken(IActivityManager.descriptor);
4898 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4899 reply.readException();
4900 data.recycle();
4901 reply.recycle();
4902 }
4903
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004904 public void performIdleMaintenance() throws RemoteException {
4905 Parcel data = Parcel.obtain();
4906 Parcel reply = Parcel.obtain();
4907 data.writeInterfaceToken(IActivityManager.descriptor);
4908 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4909 reply.readException();
4910 data.recycle();
4911 reply.recycle();
4912 }
4913
Craig Mautner4a1cb222013-12-04 16:14:06 -08004914 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4915 IActivityContainerCallback callback) throws RemoteException {
4916 Parcel data = Parcel.obtain();
4917 Parcel reply = Parcel.obtain();
4918 data.writeInterfaceToken(IActivityManager.descriptor);
4919 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07004920 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08004921 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4922 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004923 final int result = reply.readInt();
4924 final IActivityContainer res;
4925 if (result == 1) {
4926 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4927 } else {
4928 res = null;
4929 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004930 data.recycle();
4931 reply.recycle();
4932 return res;
4933 }
4934
Craig Mautner95da1082014-02-24 17:54:35 -08004935 public void deleteActivityContainer(IActivityContainer activityContainer)
4936 throws RemoteException {
4937 Parcel data = Parcel.obtain();
4938 Parcel reply = Parcel.obtain();
4939 data.writeInterfaceToken(IActivityManager.descriptor);
4940 data.writeStrongBinder(activityContainer.asBinder());
4941 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4942 reply.readException();
4943 data.recycle();
4944 reply.recycle();
4945 }
4946
Craig Mautnere0a38842013-12-16 16:14:02 -08004947 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4948 throws RemoteException {
4949 Parcel data = Parcel.obtain();
4950 Parcel reply = Parcel.obtain();
4951 data.writeInterfaceToken(IActivityManager.descriptor);
4952 data.writeStrongBinder(activityToken);
4953 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4954 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004955 final int result = reply.readInt();
4956 final IActivityContainer res;
4957 if (result == 1) {
4958 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4959 } else {
4960 res = null;
4961 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004962 data.recycle();
4963 reply.recycle();
4964 return res;
4965 }
4966
Craig Mautner4a1cb222013-12-04 16:14:06 -08004967 public IBinder getHomeActivityToken() throws RemoteException {
4968 Parcel data = Parcel.obtain();
4969 Parcel reply = Parcel.obtain();
4970 data.writeInterfaceToken(IActivityManager.descriptor);
4971 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4972 reply.readException();
4973 IBinder res = reply.readStrongBinder();
4974 data.recycle();
4975 reply.recycle();
4976 return res;
4977 }
4978
Craig Mautneraea74a52014-03-08 14:23:10 -08004979 @Override
4980 public void startLockTaskMode(int taskId) throws RemoteException {
4981 Parcel data = Parcel.obtain();
4982 Parcel reply = Parcel.obtain();
4983 data.writeInterfaceToken(IActivityManager.descriptor);
4984 data.writeInt(taskId);
4985 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
4986 reply.readException();
4987 data.recycle();
4988 reply.recycle();
4989 }
4990
4991 @Override
4992 public void startLockTaskMode(IBinder token) throws RemoteException {
4993 Parcel data = Parcel.obtain();
4994 Parcel reply = Parcel.obtain();
4995 data.writeInterfaceToken(IActivityManager.descriptor);
4996 data.writeStrongBinder(token);
4997 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
4998 reply.readException();
4999 data.recycle();
5000 reply.recycle();
5001 }
5002
5003 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005004 public void startLockTaskModeOnCurrent() throws RemoteException {
5005 Parcel data = Parcel.obtain();
5006 Parcel reply = Parcel.obtain();
5007 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005008 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005009 reply.readException();
5010 data.recycle();
5011 reply.recycle();
5012 }
5013
5014 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005015 public void stopLockTaskMode() throws RemoteException {
5016 Parcel data = Parcel.obtain();
5017 Parcel reply = Parcel.obtain();
5018 data.writeInterfaceToken(IActivityManager.descriptor);
5019 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5020 reply.readException();
5021 data.recycle();
5022 reply.recycle();
5023 }
5024
5025 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005026 public void stopLockTaskModeOnCurrent() throws RemoteException {
5027 Parcel data = Parcel.obtain();
5028 Parcel reply = Parcel.obtain();
5029 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005030 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005031 reply.readException();
5032 data.recycle();
5033 reply.recycle();
5034 }
5035
5036 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005037 public boolean isInLockTaskMode() throws RemoteException {
5038 Parcel data = Parcel.obtain();
5039 Parcel reply = Parcel.obtain();
5040 data.writeInterfaceToken(IActivityManager.descriptor);
5041 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5042 reply.readException();
5043 boolean isInLockTaskMode = reply.readInt() == 1;
5044 data.recycle();
5045 reply.recycle();
5046 return isInLockTaskMode;
5047 }
5048
Craig Mautner688b5102014-03-27 16:55:03 -07005049 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005050 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005051 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005052 Parcel data = Parcel.obtain();
5053 Parcel reply = Parcel.obtain();
5054 data.writeInterfaceToken(IActivityManager.descriptor);
5055 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005056 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005057 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005058 reply.readException();
5059 data.recycle();
5060 reply.recycle();
5061 }
5062
Craig Mautneree2e45a2014-06-27 12:10:03 -07005063 @Override
5064 public boolean setMediaPlaying(IBinder token, boolean playing) throws RemoteException {
5065 Parcel data = Parcel.obtain();
5066 Parcel reply = Parcel.obtain();
5067 data.writeInterfaceToken(IActivityManager.descriptor);
5068 data.writeStrongBinder(token);
5069 data.writeInt(playing ? 1 : 0);
5070 mRemote.transact(SET_MEDIA_PLAYING_TRANSACTION, data, reply, 0);
5071 reply.readException();
5072 boolean success = reply.readInt() > 0;
5073 data.recycle();
5074 reply.recycle();
5075 return success;
5076 }
5077
5078 @Override
5079 public boolean isBackgroundMediaPlaying(IBinder token) throws RemoteException {
5080 Parcel data = Parcel.obtain();
5081 Parcel reply = Parcel.obtain();
5082 data.writeInterfaceToken(IActivityManager.descriptor);
5083 data.writeStrongBinder(token);
5084 mRemote.transact(IS_BG_MEDIA_PLAYING_TRANSACTION, data, reply, 0);
5085 reply.readException();
5086 final boolean playing = reply.readInt() > 0;
5087 data.recycle();
5088 reply.recycle();
5089 return playing;
5090 }
5091
5092 @Override
5093 public void mediaResourcesReleased(IBinder token) throws RemoteException {
5094 Parcel data = Parcel.obtain();
5095 Parcel reply = Parcel.obtain();
5096 data.writeInterfaceToken(IActivityManager.descriptor);
5097 data.writeStrongBinder(token);
Craig Mautnerbb742462014-07-07 15:28:55 -07005098 mRemote.transact(MEDIA_RESOURCES_RELEASED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5099 reply.readException();
5100 data.recycle();
5101 reply.recycle();
5102 }
5103
5104 @Override
5105 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5106 Parcel data = Parcel.obtain();
5107 Parcel reply = Parcel.obtain();
5108 data.writeInterfaceToken(IActivityManager.descriptor);
5109 data.writeStrongBinder(token);
5110 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5111 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005112 reply.readException();
5113 data.recycle();
5114 reply.recycle();
5115 }
5116
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005117 private IBinder mRemote;
5118}