blob: 318a520594c5ce3394a916c28622c4168327d9b9 [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
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700287 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
288 {
289 data.enforceInterface(IActivityManager.descriptor);
290 int taskId = data.readInt();
291 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
292 int result = startActivityFromRecents(taskId, options);
293 reply.writeNoException();
294 reply.writeInt(result);
295 return true;
296 }
297
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800298 case FINISH_ACTIVITY_TRANSACTION: {
299 data.enforceInterface(IActivityManager.descriptor);
300 IBinder token = data.readStrongBinder();
301 Intent resultData = null;
302 int resultCode = data.readInt();
303 if (data.readInt() != 0) {
304 resultData = Intent.CREATOR.createFromParcel(data);
305 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700306 boolean finishTask = (data.readInt() != 0);
307 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800308 reply.writeNoException();
309 reply.writeInt(res ? 1 : 0);
310 return true;
311 }
312
313 case FINISH_SUB_ACTIVITY_TRANSACTION: {
314 data.enforceInterface(IActivityManager.descriptor);
315 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700316 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800317 int requestCode = data.readInt();
318 finishSubActivity(token, resultWho, requestCode);
319 reply.writeNoException();
320 return true;
321 }
322
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700323 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
324 data.enforceInterface(IActivityManager.descriptor);
325 IBinder token = data.readStrongBinder();
326 boolean res = finishActivityAffinity(token);
327 reply.writeNoException();
328 reply.writeInt(res ? 1 : 0);
329 return true;
330 }
331
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700332 case FINISH_VOICE_TASK_TRANSACTION: {
333 data.enforceInterface(IActivityManager.descriptor);
334 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
335 data.readStrongBinder());
336 finishVoiceTask(session);
337 reply.writeNoException();
338 return true;
339 }
340
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800341 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
342 data.enforceInterface(IActivityManager.descriptor);
343 IBinder token = data.readStrongBinder();
344 boolean res = willActivityBeVisible(token);
345 reply.writeNoException();
346 reply.writeInt(res ? 1 : 0);
347 return true;
348 }
349
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800350 case REGISTER_RECEIVER_TRANSACTION:
351 {
352 data.enforceInterface(IActivityManager.descriptor);
353 IBinder b = data.readStrongBinder();
354 IApplicationThread app =
355 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700356 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800357 b = data.readStrongBinder();
358 IIntentReceiver rec
359 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
360 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
361 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700362 int userId = data.readInt();
363 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800364 reply.writeNoException();
365 if (intent != null) {
366 reply.writeInt(1);
367 intent.writeToParcel(reply, 0);
368 } else {
369 reply.writeInt(0);
370 }
371 return true;
372 }
373
374 case UNREGISTER_RECEIVER_TRANSACTION:
375 {
376 data.enforceInterface(IActivityManager.descriptor);
377 IBinder b = data.readStrongBinder();
378 if (b == null) {
379 return true;
380 }
381 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
382 unregisterReceiver(rec);
383 reply.writeNoException();
384 return true;
385 }
386
387 case BROADCAST_INTENT_TRANSACTION:
388 {
389 data.enforceInterface(IActivityManager.descriptor);
390 IBinder b = data.readStrongBinder();
391 IApplicationThread app =
392 b != null ? ApplicationThreadNative.asInterface(b) : null;
393 Intent intent = Intent.CREATOR.createFromParcel(data);
394 String resolvedType = data.readString();
395 b = data.readStrongBinder();
396 IIntentReceiver resultTo =
397 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
398 int resultCode = data.readInt();
399 String resultData = data.readString();
400 Bundle resultExtras = data.readBundle();
401 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800402 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800403 boolean serialized = data.readInt() != 0;
404 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700405 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800407 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700408 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800409 reply.writeNoException();
410 reply.writeInt(res);
411 return true;
412 }
413
414 case UNBROADCAST_INTENT_TRANSACTION:
415 {
416 data.enforceInterface(IActivityManager.descriptor);
417 IBinder b = data.readStrongBinder();
418 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
419 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700420 int userId = data.readInt();
421 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800422 reply.writeNoException();
423 return true;
424 }
425
426 case FINISH_RECEIVER_TRANSACTION: {
427 data.enforceInterface(IActivityManager.descriptor);
428 IBinder who = data.readStrongBinder();
429 int resultCode = data.readInt();
430 String resultData = data.readString();
431 Bundle resultExtras = data.readBundle();
432 boolean resultAbort = data.readInt() != 0;
433 if (who != null) {
434 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
435 }
436 reply.writeNoException();
437 return true;
438 }
439
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440 case ATTACH_APPLICATION_TRANSACTION: {
441 data.enforceInterface(IActivityManager.descriptor);
442 IApplicationThread app = ApplicationThreadNative.asInterface(
443 data.readStrongBinder());
444 if (app != null) {
445 attachApplication(app);
446 }
447 reply.writeNoException();
448 return true;
449 }
450
451 case ACTIVITY_IDLE_TRANSACTION: {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700454 Configuration config = null;
455 if (data.readInt() != 0) {
456 config = Configuration.CREATOR.createFromParcel(data);
457 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700458 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800459 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700460 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800461 }
462 reply.writeNoException();
463 return true;
464 }
465
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700466 case ACTIVITY_RESUMED_TRANSACTION: {
467 data.enforceInterface(IActivityManager.descriptor);
468 IBinder token = data.readStrongBinder();
469 activityResumed(token);
470 reply.writeNoException();
471 return true;
472 }
473
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800474 case ACTIVITY_PAUSED_TRANSACTION: {
475 data.enforceInterface(IActivityManager.descriptor);
476 IBinder token = data.readStrongBinder();
Craig Mautnera0026042014-04-23 11:45:37 -0700477 PersistableBundle persistentState = data.readPersistableBundle();
478 activityPaused(token, persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800479 reply.writeNoException();
480 return true;
481 }
482
483 case ACTIVITY_STOPPED_TRANSACTION: {
484 data.enforceInterface(IActivityManager.descriptor);
485 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800486 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700487 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800488 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700489 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800490 reply.writeNoException();
491 return true;
492 }
493
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800494 case ACTIVITY_SLEPT_TRANSACTION: {
495 data.enforceInterface(IActivityManager.descriptor);
496 IBinder token = data.readStrongBinder();
497 activitySlept(token);
498 reply.writeNoException();
499 return true;
500 }
501
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800502 case ACTIVITY_DESTROYED_TRANSACTION: {
503 data.enforceInterface(IActivityManager.descriptor);
504 IBinder token = data.readStrongBinder();
505 activityDestroyed(token);
506 reply.writeNoException();
507 return true;
508 }
509
510 case GET_CALLING_PACKAGE_TRANSACTION: {
511 data.enforceInterface(IActivityManager.descriptor);
512 IBinder token = data.readStrongBinder();
513 String res = token != null ? getCallingPackage(token) : null;
514 reply.writeNoException();
515 reply.writeString(res);
516 return true;
517 }
518
519 case GET_CALLING_ACTIVITY_TRANSACTION: {
520 data.enforceInterface(IActivityManager.descriptor);
521 IBinder token = data.readStrongBinder();
522 ComponentName cn = getCallingActivity(token);
523 reply.writeNoException();
524 ComponentName.writeToParcel(cn, reply);
525 return true;
526 }
527
Winson Chung1147c402014-05-14 11:05:00 -0700528 case GET_APP_TASKS_TRANSACTION: {
529 data.enforceInterface(IActivityManager.descriptor);
530 List<IAppTask> list = getAppTasks();
531 reply.writeNoException();
532 int N = list != null ? list.size() : -1;
533 reply.writeInt(N);
534 int i;
535 for (i=0; i<N; i++) {
536 IAppTask task = list.get(i);
537 reply.writeStrongBinder(task.asBinder());
538 }
539 return true;
540 }
541
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800542 case GET_TASKS_TRANSACTION: {
543 data.enforceInterface(IActivityManager.descriptor);
544 int maxNum = data.readInt();
545 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700546 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800547 reply.writeNoException();
548 int N = list != null ? list.size() : -1;
549 reply.writeInt(N);
550 int i;
551 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700552 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800553 info.writeToParcel(reply, 0);
554 }
555 return true;
556 }
557
558 case GET_RECENT_TASKS_TRANSACTION: {
559 data.enforceInterface(IActivityManager.descriptor);
560 int maxNum = data.readInt();
561 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700562 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800563 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700564 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800565 reply.writeNoException();
566 reply.writeTypedList(list);
567 return true;
568 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700569
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700570 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800571 data.enforceInterface(IActivityManager.descriptor);
572 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700573 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800574 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700575 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800576 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700577 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700578 } else {
579 reply.writeInt(0);
580 }
581 return true;
582 }
583
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800584 case GET_SERVICES_TRANSACTION: {
585 data.enforceInterface(IActivityManager.descriptor);
586 int maxNum = data.readInt();
587 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700588 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800589 reply.writeNoException();
590 int N = list != null ? list.size() : -1;
591 reply.writeInt(N);
592 int i;
593 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700594 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800595 info.writeToParcel(reply, 0);
596 }
597 return true;
598 }
599
600 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
601 data.enforceInterface(IActivityManager.descriptor);
602 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
603 reply.writeNoException();
604 reply.writeTypedList(list);
605 return true;
606 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700607
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800608 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
609 data.enforceInterface(IActivityManager.descriptor);
610 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
611 reply.writeNoException();
612 reply.writeTypedList(list);
613 return true;
614 }
615
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700616 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
617 data.enforceInterface(IActivityManager.descriptor);
618 List<ApplicationInfo> list = getRunningExternalApplications();
619 reply.writeNoException();
620 reply.writeTypedList(list);
621 return true;
622 }
623
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800624 case MOVE_TASK_TO_FRONT_TRANSACTION: {
625 data.enforceInterface(IActivityManager.descriptor);
626 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800627 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700628 Bundle options = data.readInt() != 0
629 ? Bundle.CREATOR.createFromParcel(data) : null;
630 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800631 reply.writeNoException();
632 return true;
633 }
634
635 case MOVE_TASK_TO_BACK_TRANSACTION: {
636 data.enforceInterface(IActivityManager.descriptor);
637 int task = data.readInt();
638 moveTaskToBack(task);
639 reply.writeNoException();
640 return true;
641 }
642
643 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
644 data.enforceInterface(IActivityManager.descriptor);
645 IBinder token = data.readStrongBinder();
646 boolean nonRoot = data.readInt() != 0;
647 boolean res = moveActivityTaskToBack(token, nonRoot);
648 reply.writeNoException();
649 reply.writeInt(res ? 1 : 0);
650 return true;
651 }
652
653 case MOVE_TASK_BACKWARDS_TRANSACTION: {
654 data.enforceInterface(IActivityManager.descriptor);
655 int task = data.readInt();
656 moveTaskBackwards(task);
657 reply.writeNoException();
658 return true;
659 }
660
Craig Mautnerc00204b2013-03-05 15:02:14 -0800661 case MOVE_TASK_TO_STACK_TRANSACTION: {
662 data.enforceInterface(IActivityManager.descriptor);
663 int taskId = data.readInt();
664 int stackId = data.readInt();
665 boolean toTop = data.readInt() != 0;
666 moveTaskToStack(taskId, stackId, toTop);
667 reply.writeNoException();
668 return true;
669 }
670
671 case RESIZE_STACK_TRANSACTION: {
672 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800673 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800674 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800675 Rect r = Rect.CREATOR.createFromParcel(data);
676 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800677 reply.writeNoException();
678 return true;
679 }
680
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800681 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700682 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800683 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700684 reply.writeNoException();
685 reply.writeTypedList(list);
686 return true;
687 }
688
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800689 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700690 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800691 int stackId = data.readInt();
692 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700693 reply.writeNoException();
694 if (info != null) {
695 reply.writeInt(1);
696 info.writeToParcel(reply, 0);
697 } else {
698 reply.writeInt(0);
699 }
700 return true;
701 }
702
Winson Chung303e1ff2014-03-07 15:06:19 -0800703 case IS_IN_HOME_STACK_TRANSACTION: {
704 data.enforceInterface(IActivityManager.descriptor);
705 int taskId = data.readInt();
706 boolean isInHomeStack = isInHomeStack(taskId);
707 reply.writeNoException();
708 reply.writeInt(isInHomeStack ? 1 : 0);
709 return true;
710 }
711
Craig Mautnercf910b02013-04-23 11:23:27 -0700712 case SET_FOCUSED_STACK_TRANSACTION: {
713 data.enforceInterface(IActivityManager.descriptor);
714 int stackId = data.readInt();
715 setFocusedStack(stackId);
716 reply.writeNoException();
717 return true;
718 }
719
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800720 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
721 data.enforceInterface(IActivityManager.descriptor);
722 IBinder token = data.readStrongBinder();
723 boolean onlyRoot = data.readInt() != 0;
724 int res = token != null
725 ? getTaskForActivity(token, onlyRoot) : -1;
726 reply.writeNoException();
727 reply.writeInt(res);
728 return true;
729 }
730
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800731 case GET_CONTENT_PROVIDER_TRANSACTION: {
732 data.enforceInterface(IActivityManager.descriptor);
733 IBinder b = data.readStrongBinder();
734 IApplicationThread app = ApplicationThreadNative.asInterface(b);
735 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700736 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700737 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700738 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800739 reply.writeNoException();
740 if (cph != null) {
741 reply.writeInt(1);
742 cph.writeToParcel(reply, 0);
743 } else {
744 reply.writeInt(0);
745 }
746 return true;
747 }
748
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800749 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
750 data.enforceInterface(IActivityManager.descriptor);
751 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700752 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800753 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700754 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800755 reply.writeNoException();
756 if (cph != null) {
757 reply.writeInt(1);
758 cph.writeToParcel(reply, 0);
759 } else {
760 reply.writeInt(0);
761 }
762 return true;
763 }
764
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800765 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
766 data.enforceInterface(IActivityManager.descriptor);
767 IBinder b = data.readStrongBinder();
768 IApplicationThread app = ApplicationThreadNative.asInterface(b);
769 ArrayList<ContentProviderHolder> providers =
770 data.createTypedArrayList(ContentProviderHolder.CREATOR);
771 publishContentProviders(app, providers);
772 reply.writeNoException();
773 return true;
774 }
775
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700776 case REF_CONTENT_PROVIDER_TRANSACTION: {
777 data.enforceInterface(IActivityManager.descriptor);
778 IBinder b = data.readStrongBinder();
779 int stable = data.readInt();
780 int unstable = data.readInt();
781 boolean res = refContentProvider(b, stable, unstable);
782 reply.writeNoException();
783 reply.writeInt(res ? 1 : 0);
784 return true;
785 }
786
787 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
788 data.enforceInterface(IActivityManager.descriptor);
789 IBinder b = data.readStrongBinder();
790 unstableProviderDied(b);
791 reply.writeNoException();
792 return true;
793 }
794
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700795 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
796 data.enforceInterface(IActivityManager.descriptor);
797 IBinder b = data.readStrongBinder();
798 appNotRespondingViaProvider(b);
799 reply.writeNoException();
800 return true;
801 }
802
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800803 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
804 data.enforceInterface(IActivityManager.descriptor);
805 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700806 boolean stable = data.readInt() != 0;
807 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800808 reply.writeNoException();
809 return true;
810 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800811
812 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
813 data.enforceInterface(IActivityManager.descriptor);
814 String name = data.readString();
815 IBinder token = data.readStrongBinder();
816 removeContentProviderExternal(name, token);
817 reply.writeNoException();
818 return true;
819 }
820
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700821 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
822 data.enforceInterface(IActivityManager.descriptor);
823 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
824 PendingIntent pi = getRunningServiceControlPanel(comp);
825 reply.writeNoException();
826 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
827 return true;
828 }
829
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800830 case START_SERVICE_TRANSACTION: {
831 data.enforceInterface(IActivityManager.descriptor);
832 IBinder b = data.readStrongBinder();
833 IApplicationThread app = ApplicationThreadNative.asInterface(b);
834 Intent service = Intent.CREATOR.createFromParcel(data);
835 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700836 int userId = data.readInt();
837 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800838 reply.writeNoException();
839 ComponentName.writeToParcel(cn, reply);
840 return true;
841 }
842
843 case STOP_SERVICE_TRANSACTION: {
844 data.enforceInterface(IActivityManager.descriptor);
845 IBinder b = data.readStrongBinder();
846 IApplicationThread app = ApplicationThreadNative.asInterface(b);
847 Intent service = Intent.CREATOR.createFromParcel(data);
848 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700849 int userId = data.readInt();
850 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800851 reply.writeNoException();
852 reply.writeInt(res);
853 return true;
854 }
855
856 case STOP_SERVICE_TOKEN_TRANSACTION: {
857 data.enforceInterface(IActivityManager.descriptor);
858 ComponentName className = ComponentName.readFromParcel(data);
859 IBinder token = data.readStrongBinder();
860 int startId = data.readInt();
861 boolean res = stopServiceToken(className, token, startId);
862 reply.writeNoException();
863 reply.writeInt(res ? 1 : 0);
864 return true;
865 }
866
867 case SET_SERVICE_FOREGROUND_TRANSACTION: {
868 data.enforceInterface(IActivityManager.descriptor);
869 ComponentName className = ComponentName.readFromParcel(data);
870 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700871 int id = data.readInt();
872 Notification notification = null;
873 if (data.readInt() != 0) {
874 notification = Notification.CREATOR.createFromParcel(data);
875 }
876 boolean removeNotification = data.readInt() != 0;
877 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800878 reply.writeNoException();
879 return true;
880 }
881
882 case BIND_SERVICE_TRANSACTION: {
883 data.enforceInterface(IActivityManager.descriptor);
884 IBinder b = data.readStrongBinder();
885 IApplicationThread app = ApplicationThreadNative.asInterface(b);
886 IBinder token = data.readStrongBinder();
887 Intent service = Intent.CREATOR.createFromParcel(data);
888 String resolvedType = data.readString();
889 b = data.readStrongBinder();
890 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800891 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800892 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800893 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800894 reply.writeNoException();
895 reply.writeInt(res);
896 return true;
897 }
898
899 case UNBIND_SERVICE_TRANSACTION: {
900 data.enforceInterface(IActivityManager.descriptor);
901 IBinder b = data.readStrongBinder();
902 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
903 boolean res = unbindService(conn);
904 reply.writeNoException();
905 reply.writeInt(res ? 1 : 0);
906 return true;
907 }
908
909 case PUBLISH_SERVICE_TRANSACTION: {
910 data.enforceInterface(IActivityManager.descriptor);
911 IBinder token = data.readStrongBinder();
912 Intent intent = Intent.CREATOR.createFromParcel(data);
913 IBinder service = data.readStrongBinder();
914 publishService(token, intent, service);
915 reply.writeNoException();
916 return true;
917 }
918
919 case UNBIND_FINISHED_TRANSACTION: {
920 data.enforceInterface(IActivityManager.descriptor);
921 IBinder token = data.readStrongBinder();
922 Intent intent = Intent.CREATOR.createFromParcel(data);
923 boolean doRebind = data.readInt() != 0;
924 unbindFinished(token, intent, doRebind);
925 reply.writeNoException();
926 return true;
927 }
928
929 case SERVICE_DONE_EXECUTING_TRANSACTION: {
930 data.enforceInterface(IActivityManager.descriptor);
931 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700932 int type = data.readInt();
933 int startId = data.readInt();
934 int res = data.readInt();
935 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800936 reply.writeNoException();
937 return true;
938 }
939
940 case START_INSTRUMENTATION_TRANSACTION: {
941 data.enforceInterface(IActivityManager.descriptor);
942 ComponentName className = ComponentName.readFromParcel(data);
943 String profileFile = data.readString();
944 int fl = data.readInt();
945 Bundle arguments = data.readBundle();
946 IBinder b = data.readStrongBinder();
947 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800948 b = data.readStrongBinder();
949 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700950 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +0100951 String abiOverride = data.readString();
952 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
953 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800954 reply.writeNoException();
955 reply.writeInt(res ? 1 : 0);
956 return true;
957 }
958
959
960 case FINISH_INSTRUMENTATION_TRANSACTION: {
961 data.enforceInterface(IActivityManager.descriptor);
962 IBinder b = data.readStrongBinder();
963 IApplicationThread app = ApplicationThreadNative.asInterface(b);
964 int resultCode = data.readInt();
965 Bundle results = data.readBundle();
966 finishInstrumentation(app, resultCode, results);
967 reply.writeNoException();
968 return true;
969 }
970
971 case GET_CONFIGURATION_TRANSACTION: {
972 data.enforceInterface(IActivityManager.descriptor);
973 Configuration config = getConfiguration();
974 reply.writeNoException();
975 config.writeToParcel(reply, 0);
976 return true;
977 }
978
979 case UPDATE_CONFIGURATION_TRANSACTION: {
980 data.enforceInterface(IActivityManager.descriptor);
981 Configuration config = Configuration.CREATOR.createFromParcel(data);
982 updateConfiguration(config);
983 reply.writeNoException();
984 return true;
985 }
986
987 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
988 data.enforceInterface(IActivityManager.descriptor);
989 IBinder token = data.readStrongBinder();
990 int requestedOrientation = data.readInt();
991 setRequestedOrientation(token, requestedOrientation);
992 reply.writeNoException();
993 return true;
994 }
995
996 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
997 data.enforceInterface(IActivityManager.descriptor);
998 IBinder token = data.readStrongBinder();
999 int req = getRequestedOrientation(token);
1000 reply.writeNoException();
1001 reply.writeInt(req);
1002 return true;
1003 }
1004
1005 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1006 data.enforceInterface(IActivityManager.descriptor);
1007 IBinder token = data.readStrongBinder();
1008 ComponentName cn = getActivityClassForToken(token);
1009 reply.writeNoException();
1010 ComponentName.writeToParcel(cn, reply);
1011 return true;
1012 }
1013
1014 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1015 data.enforceInterface(IActivityManager.descriptor);
1016 IBinder token = data.readStrongBinder();
1017 reply.writeNoException();
1018 reply.writeString(getPackageForToken(token));
1019 return true;
1020 }
1021
1022 case GET_INTENT_SENDER_TRANSACTION: {
1023 data.enforceInterface(IActivityManager.descriptor);
1024 int type = data.readInt();
1025 String packageName = data.readString();
1026 IBinder token = data.readStrongBinder();
1027 String resultWho = data.readString();
1028 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001029 Intent[] requestIntents;
1030 String[] requestResolvedTypes;
1031 if (data.readInt() != 0) {
1032 requestIntents = data.createTypedArray(Intent.CREATOR);
1033 requestResolvedTypes = data.createStringArray();
1034 } else {
1035 requestIntents = null;
1036 requestResolvedTypes = null;
1037 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001038 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001039 Bundle options = data.readInt() != 0
1040 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001041 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001042 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001043 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001044 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001045 reply.writeNoException();
1046 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1047 return true;
1048 }
1049
1050 case CANCEL_INTENT_SENDER_TRANSACTION: {
1051 data.enforceInterface(IActivityManager.descriptor);
1052 IIntentSender r = IIntentSender.Stub.asInterface(
1053 data.readStrongBinder());
1054 cancelIntentSender(r);
1055 reply.writeNoException();
1056 return true;
1057 }
1058
1059 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1060 data.enforceInterface(IActivityManager.descriptor);
1061 IIntentSender r = IIntentSender.Stub.asInterface(
1062 data.readStrongBinder());
1063 String res = getPackageForIntentSender(r);
1064 reply.writeNoException();
1065 reply.writeString(res);
1066 return true;
1067 }
1068
Christopher Tatec4a07d12012-04-06 14:19:13 -07001069 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1070 data.enforceInterface(IActivityManager.descriptor);
1071 IIntentSender r = IIntentSender.Stub.asInterface(
1072 data.readStrongBinder());
1073 int res = getUidForIntentSender(r);
1074 reply.writeNoException();
1075 reply.writeInt(res);
1076 return true;
1077 }
1078
Dianne Hackborn41203752012-08-31 14:05:51 -07001079 case HANDLE_INCOMING_USER_TRANSACTION: {
1080 data.enforceInterface(IActivityManager.descriptor);
1081 int callingPid = data.readInt();
1082 int callingUid = data.readInt();
1083 int userId = data.readInt();
1084 boolean allowAll = data.readInt() != 0 ;
1085 boolean requireFull = data.readInt() != 0;
1086 String name = data.readString();
1087 String callerPackage = data.readString();
1088 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1089 requireFull, name, callerPackage);
1090 reply.writeNoException();
1091 reply.writeInt(res);
1092 return true;
1093 }
1094
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001095 case SET_PROCESS_LIMIT_TRANSACTION: {
1096 data.enforceInterface(IActivityManager.descriptor);
1097 int max = data.readInt();
1098 setProcessLimit(max);
1099 reply.writeNoException();
1100 return true;
1101 }
1102
1103 case GET_PROCESS_LIMIT_TRANSACTION: {
1104 data.enforceInterface(IActivityManager.descriptor);
1105 int limit = getProcessLimit();
1106 reply.writeNoException();
1107 reply.writeInt(limit);
1108 return true;
1109 }
1110
1111 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1112 data.enforceInterface(IActivityManager.descriptor);
1113 IBinder token = data.readStrongBinder();
1114 int pid = data.readInt();
1115 boolean isForeground = data.readInt() != 0;
1116 setProcessForeground(token, pid, isForeground);
1117 reply.writeNoException();
1118 return true;
1119 }
1120
1121 case CHECK_PERMISSION_TRANSACTION: {
1122 data.enforceInterface(IActivityManager.descriptor);
1123 String perm = data.readString();
1124 int pid = data.readInt();
1125 int uid = data.readInt();
1126 int res = checkPermission(perm, pid, uid);
1127 reply.writeNoException();
1128 reply.writeInt(res);
1129 return true;
1130 }
1131
1132 case CHECK_URI_PERMISSION_TRANSACTION: {
1133 data.enforceInterface(IActivityManager.descriptor);
1134 Uri uri = Uri.CREATOR.createFromParcel(data);
1135 int pid = data.readInt();
1136 int uid = data.readInt();
1137 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001138 int userId = data.readInt();
1139 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001140 reply.writeNoException();
1141 reply.writeInt(res);
1142 return true;
1143 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001144
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001145 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001146 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147 String packageName = data.readString();
1148 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1149 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001150 int userId = data.readInt();
1151 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 reply.writeNoException();
1153 reply.writeInt(res ? 1 : 0);
1154 return true;
1155 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001156
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001157 case GRANT_URI_PERMISSION_TRANSACTION: {
1158 data.enforceInterface(IActivityManager.descriptor);
1159 IBinder b = data.readStrongBinder();
1160 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1161 String targetPkg = data.readString();
1162 Uri uri = Uri.CREATOR.createFromParcel(data);
1163 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001164 int userId = data.readInt();
1165 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001166 reply.writeNoException();
1167 return true;
1168 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001169
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001170 case REVOKE_URI_PERMISSION_TRANSACTION: {
1171 data.enforceInterface(IActivityManager.descriptor);
1172 IBinder b = data.readStrongBinder();
1173 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1174 Uri uri = Uri.CREATOR.createFromParcel(data);
1175 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001176 int userId = data.readInt();
1177 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001178 reply.writeNoException();
1179 return true;
1180 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001181
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001182 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1183 data.enforceInterface(IActivityManager.descriptor);
1184 Uri uri = Uri.CREATOR.createFromParcel(data);
1185 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001186 int userId = data.readInt();
1187 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001188 reply.writeNoException();
1189 return true;
1190 }
1191
1192 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1193 data.enforceInterface(IActivityManager.descriptor);
1194 Uri uri = Uri.CREATOR.createFromParcel(data);
1195 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001196 int userId = data.readInt();
1197 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001198 reply.writeNoException();
1199 return true;
1200 }
1201
1202 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1203 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001204 final String packageName = data.readString();
1205 final boolean incoming = data.readInt() != 0;
1206 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1207 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001208 reply.writeNoException();
1209 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1210 return true;
1211 }
1212
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1214 data.enforceInterface(IActivityManager.descriptor);
1215 IBinder b = data.readStrongBinder();
1216 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1217 boolean waiting = data.readInt() != 0;
1218 showWaitingForDebugger(app, waiting);
1219 reply.writeNoException();
1220 return true;
1221 }
1222
1223 case GET_MEMORY_INFO_TRANSACTION: {
1224 data.enforceInterface(IActivityManager.descriptor);
1225 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1226 getMemoryInfo(mi);
1227 reply.writeNoException();
1228 mi.writeToParcel(reply, 0);
1229 return true;
1230 }
1231
1232 case UNHANDLED_BACK_TRANSACTION: {
1233 data.enforceInterface(IActivityManager.descriptor);
1234 unhandledBack();
1235 reply.writeNoException();
1236 return true;
1237 }
1238
1239 case OPEN_CONTENT_URI_TRANSACTION: {
1240 data.enforceInterface(IActivityManager.descriptor);
1241 Uri uri = Uri.parse(data.readString());
1242 ParcelFileDescriptor pfd = openContentUri(uri);
1243 reply.writeNoException();
1244 if (pfd != null) {
1245 reply.writeInt(1);
1246 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1247 } else {
1248 reply.writeInt(0);
1249 }
1250 return true;
1251 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001252
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001253 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1254 data.enforceInterface(IActivityManager.descriptor);
1255 setLockScreenShown(data.readInt() != 0);
1256 reply.writeNoException();
1257 return true;
1258 }
1259
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001260 case SET_DEBUG_APP_TRANSACTION: {
1261 data.enforceInterface(IActivityManager.descriptor);
1262 String pn = data.readString();
1263 boolean wfd = data.readInt() != 0;
1264 boolean per = data.readInt() != 0;
1265 setDebugApp(pn, wfd, per);
1266 reply.writeNoException();
1267 return true;
1268 }
1269
1270 case SET_ALWAYS_FINISH_TRANSACTION: {
1271 data.enforceInterface(IActivityManager.descriptor);
1272 boolean enabled = data.readInt() != 0;
1273 setAlwaysFinish(enabled);
1274 reply.writeNoException();
1275 return true;
1276 }
1277
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001278 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001279 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001280 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001281 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001282 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001283 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001284 return true;
1285 }
1286
1287 case ENTER_SAFE_MODE_TRANSACTION: {
1288 data.enforceInterface(IActivityManager.descriptor);
1289 enterSafeMode();
1290 reply.writeNoException();
1291 return true;
1292 }
1293
1294 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1295 data.enforceInterface(IActivityManager.descriptor);
1296 IIntentSender is = IIntentSender.Stub.asInterface(
1297 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001298 int sourceUid = data.readInt();
1299 String sourcePkg = data.readString();
1300 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001301 reply.writeNoException();
1302 return true;
1303 }
1304
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001305 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001306 data.enforceInterface(IActivityManager.descriptor);
1307 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001308 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001309 boolean secure = data.readInt() != 0;
1310 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001311 reply.writeNoException();
1312 reply.writeInt(res ? 1 : 0);
1313 return true;
1314 }
1315
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001316 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1317 data.enforceInterface(IActivityManager.descriptor);
1318 String reason = data.readString();
1319 boolean res = killProcessesBelowForeground(reason);
1320 reply.writeNoException();
1321 reply.writeInt(res ? 1 : 0);
1322 return true;
1323 }
1324
Dan Egnor60d87622009-12-16 16:32:58 -08001325 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1326 data.enforceInterface(IActivityManager.descriptor);
1327 IBinder app = data.readStrongBinder();
1328 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1329 handleApplicationCrash(app, ci);
1330 reply.writeNoException();
1331 return true;
1332 }
1333
1334 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001335 data.enforceInterface(IActivityManager.descriptor);
1336 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001337 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001338 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001339 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001340 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001341 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001342 return true;
1343 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001344
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001345 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1346 data.enforceInterface(IActivityManager.descriptor);
1347 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001348 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001349 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1350 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001351 reply.writeNoException();
1352 return true;
1353 }
1354
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001355 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1356 data.enforceInterface(IActivityManager.descriptor);
1357 int sig = data.readInt();
1358 signalPersistentProcesses(sig);
1359 reply.writeNoException();
1360 return true;
1361 }
1362
Dianne Hackborn03abb812010-01-04 18:43:19 -08001363 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1364 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001365 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001366 int userId = data.readInt();
1367 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001368 reply.writeNoException();
1369 return true;
1370 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001371
1372 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
1374 killAllBackgroundProcesses();
1375 reply.writeNoException();
1376 return true;
1377 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001378
Dianne Hackborn03abb812010-01-04 18:43:19 -08001379 case FORCE_STOP_PACKAGE_TRANSACTION: {
1380 data.enforceInterface(IActivityManager.descriptor);
1381 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001382 int userId = data.readInt();
1383 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001384 reply.writeNoException();
1385 return true;
1386 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001387
1388 case GET_MY_MEMORY_STATE_TRANSACTION: {
1389 data.enforceInterface(IActivityManager.descriptor);
1390 ActivityManager.RunningAppProcessInfo info =
1391 new ActivityManager.RunningAppProcessInfo();
1392 getMyMemoryState(info);
1393 reply.writeNoException();
1394 info.writeToParcel(reply, 0);
1395 return true;
1396 }
1397
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001398 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1399 data.enforceInterface(IActivityManager.descriptor);
1400 ConfigurationInfo config = getDeviceConfigurationInfo();
1401 reply.writeNoException();
1402 config.writeToParcel(reply, 0);
1403 return true;
1404 }
1405
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001406 case PROFILE_CONTROL_TRANSACTION: {
1407 data.enforceInterface(IActivityManager.descriptor);
1408 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001409 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001410 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001411 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001412 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001413 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001414 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001415 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001416 reply.writeNoException();
1417 reply.writeInt(res ? 1 : 0);
1418 return true;
1419 }
1420
Dianne Hackborn55280a92009-05-07 15:53:46 -07001421 case SHUTDOWN_TRANSACTION: {
1422 data.enforceInterface(IActivityManager.descriptor);
1423 boolean res = shutdown(data.readInt());
1424 reply.writeNoException();
1425 reply.writeInt(res ? 1 : 0);
1426 return true;
1427 }
1428
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001429 case STOP_APP_SWITCHES_TRANSACTION: {
1430 data.enforceInterface(IActivityManager.descriptor);
1431 stopAppSwitches();
1432 reply.writeNoException();
1433 return true;
1434 }
1435
1436 case RESUME_APP_SWITCHES_TRANSACTION: {
1437 data.enforceInterface(IActivityManager.descriptor);
1438 resumeAppSwitches();
1439 reply.writeNoException();
1440 return true;
1441 }
1442
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001443 case PEEK_SERVICE_TRANSACTION: {
1444 data.enforceInterface(IActivityManager.descriptor);
1445 Intent service = Intent.CREATOR.createFromParcel(data);
1446 String resolvedType = data.readString();
1447 IBinder binder = peekService(service, resolvedType);
1448 reply.writeNoException();
1449 reply.writeStrongBinder(binder);
1450 return true;
1451 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001452
1453 case START_BACKUP_AGENT_TRANSACTION: {
1454 data.enforceInterface(IActivityManager.descriptor);
1455 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1456 int backupRestoreMode = data.readInt();
1457 boolean success = bindBackupAgent(info, backupRestoreMode);
1458 reply.writeNoException();
1459 reply.writeInt(success ? 1 : 0);
1460 return true;
1461 }
1462
1463 case BACKUP_AGENT_CREATED_TRANSACTION: {
1464 data.enforceInterface(IActivityManager.descriptor);
1465 String packageName = data.readString();
1466 IBinder agent = data.readStrongBinder();
1467 backupAgentCreated(packageName, agent);
1468 reply.writeNoException();
1469 return true;
1470 }
1471
1472 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1473 data.enforceInterface(IActivityManager.descriptor);
1474 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1475 unbindBackupAgent(info);
1476 reply.writeNoException();
1477 return true;
1478 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001479
1480 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1481 data.enforceInterface(IActivityManager.descriptor);
1482 String packageName = data.readString();
1483 addPackageDependency(packageName);
1484 reply.writeNoException();
1485 return true;
1486 }
1487
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001488 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001489 data.enforceInterface(IActivityManager.descriptor);
1490 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001491 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001492 String reason = data.readString();
1493 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001494 reply.writeNoException();
1495 return true;
1496 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001497
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001498 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1499 data.enforceInterface(IActivityManager.descriptor);
1500 String reason = data.readString();
1501 closeSystemDialogs(reason);
1502 reply.writeNoException();
1503 return true;
1504 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001505
1506 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1507 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001508 int[] pids = data.createIntArray();
1509 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001510 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001511 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001512 return true;
1513 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001514
1515 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1516 data.enforceInterface(IActivityManager.descriptor);
1517 String processName = data.readString();
1518 int uid = data.readInt();
1519 killApplicationProcess(processName, uid);
1520 reply.writeNoException();
1521 return true;
1522 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001523
1524 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1525 data.enforceInterface(IActivityManager.descriptor);
1526 IBinder token = data.readStrongBinder();
1527 String packageName = data.readString();
1528 int enterAnim = data.readInt();
1529 int exitAnim = data.readInt();
1530 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001531 reply.writeNoException();
1532 return true;
1533 }
1534
1535 case IS_USER_A_MONKEY_TRANSACTION: {
1536 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001537 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001538 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001539 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001540 return true;
1541 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001542
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001543 case SET_USER_IS_MONKEY_TRANSACTION: {
1544 data.enforceInterface(IActivityManager.descriptor);
1545 final boolean monkey = (data.readInt() == 1);
1546 setUserIsMonkey(monkey);
1547 reply.writeNoException();
1548 return true;
1549 }
1550
Dianne Hackborn860755f2010-06-03 18:47:52 -07001551 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1552 data.enforceInterface(IActivityManager.descriptor);
1553 finishHeavyWeightApp();
1554 reply.writeNoException();
1555 return true;
1556 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001557
1558 case IS_IMMERSIVE_TRANSACTION: {
1559 data.enforceInterface(IActivityManager.descriptor);
1560 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001561 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001562 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001563 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001564 return true;
1565 }
1566
Craig Mautnerd61dc202014-07-07 11:09:11 -07001567 case IS_TOP_OF_TASK_TRANSACTION: {
1568 data.enforceInterface(IActivityManager.descriptor);
1569 IBinder token = data.readStrongBinder();
1570 final boolean isTopOfTask = isTopOfTask(token);
1571 reply.writeNoException();
1572 reply.writeInt(isTopOfTask ? 1 : 0);
1573 return true;
1574 }
1575
Craig Mautner5eda9b32013-07-02 11:58:16 -07001576 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001577 data.enforceInterface(IActivityManager.descriptor);
1578 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001579 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001580 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001581 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001582 return true;
1583 }
1584
1585 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1586 data.enforceInterface(IActivityManager.descriptor);
1587 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001588 final Bundle bundle;
1589 if (data.readInt() == 0) {
1590 bundle = null;
1591 } else {
1592 bundle = data.readBundle();
1593 }
1594 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1595 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001596 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001597 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001598 return true;
1599 }
1600
Craig Mautner233ceee2014-05-09 17:05:11 -07001601 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1602 data.enforceInterface(IActivityManager.descriptor);
1603 IBinder token = data.readStrongBinder();
1604 final ActivityOptions options = getActivityOptions(token);
1605 reply.writeNoException();
1606 reply.writeBundle(options == null ? null : options.toBundle());
1607 return true;
1608 }
1609
Daniel Sandler69a48172010-06-23 16:29:36 -04001610 case SET_IMMERSIVE_TRANSACTION: {
1611 data.enforceInterface(IActivityManager.descriptor);
1612 IBinder token = data.readStrongBinder();
1613 boolean imm = data.readInt() == 1;
1614 setImmersive(token, imm);
1615 reply.writeNoException();
1616 return true;
1617 }
1618
1619 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1620 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001621 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001622 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001623 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001624 return true;
1625 }
1626
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001627 case CRASH_APPLICATION_TRANSACTION: {
1628 data.enforceInterface(IActivityManager.descriptor);
1629 int uid = data.readInt();
1630 int initialPid = data.readInt();
1631 String packageName = data.readString();
1632 String message = data.readString();
1633 crashApplication(uid, initialPid, packageName, message);
1634 reply.writeNoException();
1635 return true;
1636 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001637
1638 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1639 data.enforceInterface(IActivityManager.descriptor);
1640 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001641 int userId = data.readInt();
1642 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001643 reply.writeNoException();
1644 reply.writeString(type);
1645 return true;
1646 }
1647
Dianne Hackborn7e269642010-08-25 19:50:20 -07001648 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1649 data.enforceInterface(IActivityManager.descriptor);
1650 String name = data.readString();
1651 IBinder perm = newUriPermissionOwner(name);
1652 reply.writeNoException();
1653 reply.writeStrongBinder(perm);
1654 return true;
1655 }
1656
1657 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1658 data.enforceInterface(IActivityManager.descriptor);
1659 IBinder owner = data.readStrongBinder();
1660 int fromUid = data.readInt();
1661 String targetPkg = data.readString();
1662 Uri uri = Uri.CREATOR.createFromParcel(data);
1663 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001664 int sourceUserId = data.readInt();
1665 int targetUserId = data.readInt();
1666 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1667 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001668 reply.writeNoException();
1669 return true;
1670 }
1671
1672 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1673 data.enforceInterface(IActivityManager.descriptor);
1674 IBinder owner = data.readStrongBinder();
1675 Uri uri = null;
1676 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001677 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001678 }
1679 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001680 int userId = data.readInt();
1681 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001682 reply.writeNoException();
1683 return true;
1684 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001685
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001686 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1687 data.enforceInterface(IActivityManager.descriptor);
1688 int callingUid = data.readInt();
1689 String targetPkg = data.readString();
1690 Uri uri = Uri.CREATOR.createFromParcel(data);
1691 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001692 int userId = data.readInt();
1693 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001694 reply.writeNoException();
1695 reply.writeInt(res);
1696 return true;
1697 }
1698
Andy McFadden824c5102010-07-09 16:26:57 -07001699 case DUMP_HEAP_TRANSACTION: {
1700 data.enforceInterface(IActivityManager.descriptor);
1701 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001702 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001703 boolean managed = data.readInt() != 0;
1704 String path = data.readString();
1705 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001706 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001707 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001708 reply.writeNoException();
1709 reply.writeInt(res ? 1 : 0);
1710 return true;
1711 }
1712
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001713 case START_ACTIVITIES_TRANSACTION:
1714 {
1715 data.enforceInterface(IActivityManager.descriptor);
1716 IBinder b = data.readStrongBinder();
1717 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001718 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001719 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1720 String[] resolvedTypes = data.createStringArray();
1721 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001722 Bundle options = data.readInt() != 0
1723 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001724 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001725 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001726 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001727 reply.writeNoException();
1728 reply.writeInt(result);
1729 return true;
1730 }
1731
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001732 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1733 {
1734 data.enforceInterface(IActivityManager.descriptor);
1735 int mode = getFrontActivityScreenCompatMode();
1736 reply.writeNoException();
1737 reply.writeInt(mode);
1738 return true;
1739 }
1740
1741 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1742 {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 int mode = data.readInt();
1745 setFrontActivityScreenCompatMode(mode);
1746 reply.writeNoException();
1747 reply.writeInt(mode);
1748 return true;
1749 }
1750
1751 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1752 {
1753 data.enforceInterface(IActivityManager.descriptor);
1754 String pkg = data.readString();
1755 int mode = getPackageScreenCompatMode(pkg);
1756 reply.writeNoException();
1757 reply.writeInt(mode);
1758 return true;
1759 }
1760
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001761 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1762 {
1763 data.enforceInterface(IActivityManager.descriptor);
1764 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001765 int mode = data.readInt();
1766 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001767 reply.writeNoException();
1768 return true;
1769 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001770
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001771 case SWITCH_USER_TRANSACTION: {
1772 data.enforceInterface(IActivityManager.descriptor);
1773 int userid = data.readInt();
1774 boolean result = switchUser(userid);
1775 reply.writeNoException();
1776 reply.writeInt(result ? 1 : 0);
1777 return true;
1778 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001779
Kenny Guy08488bf2014-02-21 17:40:37 +00001780 case START_USER_IN_BACKGROUND_TRANSACTION: {
1781 data.enforceInterface(IActivityManager.descriptor);
1782 int userid = data.readInt();
1783 boolean result = startUserInBackground(userid);
1784 reply.writeNoException();
1785 reply.writeInt(result ? 1 : 0);
1786 return true;
1787 }
1788
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001789 case STOP_USER_TRANSACTION: {
1790 data.enforceInterface(IActivityManager.descriptor);
1791 int userid = data.readInt();
1792 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1793 data.readStrongBinder());
1794 int result = stopUser(userid, callback);
1795 reply.writeNoException();
1796 reply.writeInt(result);
1797 return true;
1798 }
1799
Amith Yamasani52f1d752012-03-28 18:19:29 -07001800 case GET_CURRENT_USER_TRANSACTION: {
1801 data.enforceInterface(IActivityManager.descriptor);
1802 UserInfo userInfo = getCurrentUser();
1803 reply.writeNoException();
1804 userInfo.writeToParcel(reply, 0);
1805 return true;
1806 }
1807
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001808 case IS_USER_RUNNING_TRANSACTION: {
1809 data.enforceInterface(IActivityManager.descriptor);
1810 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001811 boolean orStopping = data.readInt() != 0;
1812 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001813 reply.writeNoException();
1814 reply.writeInt(result ? 1 : 0);
1815 return true;
1816 }
1817
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001818 case GET_RUNNING_USER_IDS_TRANSACTION: {
1819 data.enforceInterface(IActivityManager.descriptor);
1820 int[] result = getRunningUserIds();
1821 reply.writeNoException();
1822 reply.writeIntArray(result);
1823 return true;
1824 }
1825
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001826 case REMOVE_TASK_TRANSACTION:
1827 {
1828 data.enforceInterface(IActivityManager.descriptor);
1829 int taskId = data.readInt();
1830 int fl = data.readInt();
1831 boolean result = removeTask(taskId, fl);
1832 reply.writeNoException();
1833 reply.writeInt(result ? 1 : 0);
1834 return true;
1835 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001836
Jeff Sharkeya4620792011-05-20 15:29:23 -07001837 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1838 data.enforceInterface(IActivityManager.descriptor);
1839 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1840 data.readStrongBinder());
1841 registerProcessObserver(observer);
1842 return true;
1843 }
1844
1845 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1846 data.enforceInterface(IActivityManager.descriptor);
1847 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1848 data.readStrongBinder());
1849 unregisterProcessObserver(observer);
1850 return true;
1851 }
1852
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001853 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1854 {
1855 data.enforceInterface(IActivityManager.descriptor);
1856 String pkg = data.readString();
1857 boolean ask = getPackageAskScreenCompat(pkg);
1858 reply.writeNoException();
1859 reply.writeInt(ask ? 1 : 0);
1860 return true;
1861 }
1862
1863 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1864 {
1865 data.enforceInterface(IActivityManager.descriptor);
1866 String pkg = data.readString();
1867 boolean ask = data.readInt() != 0;
1868 setPackageAskScreenCompat(pkg, ask);
1869 reply.writeNoException();
1870 return true;
1871 }
1872
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001873 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1874 data.enforceInterface(IActivityManager.descriptor);
1875 IIntentSender r = IIntentSender.Stub.asInterface(
1876 data.readStrongBinder());
1877 boolean res = isIntentSenderTargetedToPackage(r);
1878 reply.writeNoException();
1879 reply.writeInt(res ? 1 : 0);
1880 return true;
1881 }
1882
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001883 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1884 data.enforceInterface(IActivityManager.descriptor);
1885 IIntentSender r = IIntentSender.Stub.asInterface(
1886 data.readStrongBinder());
1887 boolean res = isIntentSenderAnActivity(r);
1888 reply.writeNoException();
1889 reply.writeInt(res ? 1 : 0);
1890 return true;
1891 }
1892
Dianne Hackborn81038902012-11-26 17:04:09 -08001893 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1894 data.enforceInterface(IActivityManager.descriptor);
1895 IIntentSender r = IIntentSender.Stub.asInterface(
1896 data.readStrongBinder());
1897 Intent intent = getIntentForIntentSender(r);
1898 reply.writeNoException();
1899 if (intent != null) {
1900 reply.writeInt(1);
1901 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1902 } else {
1903 reply.writeInt(0);
1904 }
1905 return true;
1906 }
1907
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001908 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1909 data.enforceInterface(IActivityManager.descriptor);
1910 IIntentSender r = IIntentSender.Stub.asInterface(
1911 data.readStrongBinder());
1912 String prefix = data.readString();
1913 String tag = getTagForIntentSender(r, prefix);
1914 reply.writeNoException();
1915 reply.writeString(tag);
1916 return true;
1917 }
1918
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001919 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1920 data.enforceInterface(IActivityManager.descriptor);
1921 Configuration config = Configuration.CREATOR.createFromParcel(data);
1922 updatePersistentConfiguration(config);
1923 reply.writeNoException();
1924 return true;
1925 }
1926
Dianne Hackbornb437e092011-08-05 17:50:29 -07001927 case GET_PROCESS_PSS_TRANSACTION: {
1928 data.enforceInterface(IActivityManager.descriptor);
1929 int[] pids = data.createIntArray();
1930 long[] pss = getProcessPss(pids);
1931 reply.writeNoException();
1932 reply.writeLongArray(pss);
1933 return true;
1934 }
1935
Dianne Hackborn661cd522011-08-22 00:26:20 -07001936 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1937 data.enforceInterface(IActivityManager.descriptor);
1938 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1939 boolean always = data.readInt() != 0;
1940 showBootMessage(msg, always);
1941 reply.writeNoException();
1942 return true;
1943 }
1944
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001945 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1946 data.enforceInterface(IActivityManager.descriptor);
1947 dismissKeyguardOnNextActivity();
1948 reply.writeNoException();
1949 return true;
1950 }
1951
Adam Powelldd8fab22012-03-22 17:47:27 -07001952 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1953 data.enforceInterface(IActivityManager.descriptor);
1954 IBinder token = data.readStrongBinder();
1955 String destAffinity = data.readString();
1956 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1957 reply.writeNoException();
1958 reply.writeInt(res ? 1 : 0);
1959 return true;
1960 }
1961
1962 case NAVIGATE_UP_TO_TRANSACTION: {
1963 data.enforceInterface(IActivityManager.descriptor);
1964 IBinder token = data.readStrongBinder();
1965 Intent target = Intent.CREATOR.createFromParcel(data);
1966 int resultCode = data.readInt();
1967 Intent resultData = null;
1968 if (data.readInt() != 0) {
1969 resultData = Intent.CREATOR.createFromParcel(data);
1970 }
1971 boolean res = navigateUpTo(token, target, resultCode, resultData);
1972 reply.writeNoException();
1973 reply.writeInt(res ? 1 : 0);
1974 return true;
1975 }
1976
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001977 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1978 data.enforceInterface(IActivityManager.descriptor);
1979 IBinder token = data.readStrongBinder();
1980 int res = getLaunchedFromUid(token);
1981 reply.writeNoException();
1982 reply.writeInt(res);
1983 return true;
1984 }
1985
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001986 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1987 data.enforceInterface(IActivityManager.descriptor);
1988 IBinder token = data.readStrongBinder();
1989 String res = getLaunchedFromPackage(token);
1990 reply.writeNoException();
1991 reply.writeString(res);
1992 return true;
1993 }
1994
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001995 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1996 data.enforceInterface(IActivityManager.descriptor);
1997 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1998 data.readStrongBinder());
1999 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002000 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002001 return true;
2002 }
2003
2004 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2005 data.enforceInterface(IActivityManager.descriptor);
2006 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2007 data.readStrongBinder());
2008 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002009 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002010 return true;
2011 }
2012
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002013 case REQUEST_BUG_REPORT_TRANSACTION: {
2014 data.enforceInterface(IActivityManager.descriptor);
2015 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002016 reply.writeNoException();
2017 return true;
2018 }
2019
2020 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2021 data.enforceInterface(IActivityManager.descriptor);
2022 int pid = data.readInt();
2023 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002024 String reason = data.readString();
2025 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002026 reply.writeNoException();
2027 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002028 return true;
2029 }
2030
Adam Skorydfc7fd72013-08-05 19:23:41 -07002031 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002032 data.enforceInterface(IActivityManager.descriptor);
2033 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002034 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002035 reply.writeNoException();
2036 reply.writeBundle(res);
2037 return true;
2038 }
2039
Adam Skorydfc7fd72013-08-05 19:23:41 -07002040 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002041 data.enforceInterface(IActivityManager.descriptor);
2042 IBinder token = data.readStrongBinder();
2043 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002044 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002045 reply.writeNoException();
2046 return true;
2047 }
2048
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002049 case KILL_UID_TRANSACTION: {
2050 data.enforceInterface(IActivityManager.descriptor);
2051 int uid = data.readInt();
2052 String reason = data.readString();
2053 killUid(uid, reason);
2054 reply.writeNoException();
2055 return true;
2056 }
2057
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002058 case HANG_TRANSACTION: {
2059 data.enforceInterface(IActivityManager.descriptor);
2060 IBinder who = data.readStrongBinder();
2061 boolean allowRestart = data.readInt() != 0;
2062 hang(who, allowRestart);
2063 reply.writeNoException();
2064 return true;
2065 }
2066
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002067 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2068 data.enforceInterface(IActivityManager.descriptor);
2069 IBinder token = data.readStrongBinder();
2070 reportActivityFullyDrawn(token);
2071 reply.writeNoException();
2072 return true;
2073 }
2074
Craig Mautner5eda9b32013-07-02 11:58:16 -07002075 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2076 data.enforceInterface(IActivityManager.descriptor);
2077 IBinder token = data.readStrongBinder();
2078 notifyActivityDrawn(token);
2079 reply.writeNoException();
2080 return true;
2081 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002082
2083 case RESTART_TRANSACTION: {
2084 data.enforceInterface(IActivityManager.descriptor);
2085 restart();
2086 reply.writeNoException();
2087 return true;
2088 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002089
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002090 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2091 data.enforceInterface(IActivityManager.descriptor);
2092 performIdleMaintenance();
2093 reply.writeNoException();
2094 return true;
2095 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002096
2097 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2098 data.enforceInterface(IActivityManager.descriptor);
2099 IBinder parentActivityToken = data.readStrongBinder();
2100 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002101 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002102 IActivityContainer activityContainer =
2103 createActivityContainer(parentActivityToken, callback);
2104 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002105 if (activityContainer != null) {
2106 reply.writeInt(1);
2107 reply.writeStrongBinder(activityContainer.asBinder());
2108 } else {
2109 reply.writeInt(0);
2110 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002111 return true;
2112 }
2113
Craig Mautner95da1082014-02-24 17:54:35 -08002114 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2115 data.enforceInterface(IActivityManager.descriptor);
2116 IActivityContainer activityContainer =
2117 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2118 deleteActivityContainer(activityContainer);
2119 reply.writeNoException();
2120 return true;
2121 }
2122
Craig Mautnere0a38842013-12-16 16:14:02 -08002123 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2124 data.enforceInterface(IActivityManager.descriptor);
2125 IBinder activityToken = data.readStrongBinder();
2126 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2127 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002128 if (activityContainer != null) {
2129 reply.writeInt(1);
2130 reply.writeStrongBinder(activityContainer.asBinder());
2131 } else {
2132 reply.writeInt(0);
2133 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002134 return true;
2135 }
2136
Craig Mautner4a1cb222013-12-04 16:14:06 -08002137 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2138 data.enforceInterface(IActivityManager.descriptor);
2139 IBinder homeActivityToken = getHomeActivityToken();
2140 reply.writeNoException();
2141 reply.writeStrongBinder(homeActivityToken);
2142 return true;
2143 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002144
2145 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2146 data.enforceInterface(IActivityManager.descriptor);
2147 final int taskId = data.readInt();
2148 startLockTaskMode(taskId);
2149 reply.writeNoException();
2150 return true;
2151 }
2152
2153 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2154 data.enforceInterface(IActivityManager.descriptor);
2155 IBinder token = data.readStrongBinder();
2156 startLockTaskMode(token);
2157 reply.writeNoException();
2158 return true;
2159 }
2160
Craig Mautnerd61dc202014-07-07 11:09:11 -07002161 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002162 data.enforceInterface(IActivityManager.descriptor);
2163 startLockTaskModeOnCurrent();
2164 reply.writeNoException();
2165 return true;
2166 }
2167
Craig Mautneraea74a52014-03-08 14:23:10 -08002168 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2169 data.enforceInterface(IActivityManager.descriptor);
2170 stopLockTaskMode();
2171 reply.writeNoException();
2172 return true;
2173 }
2174
Craig Mautnerd61dc202014-07-07 11:09:11 -07002175 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002176 data.enforceInterface(IActivityManager.descriptor);
2177 stopLockTaskModeOnCurrent();
2178 reply.writeNoException();
2179 return true;
2180 }
2181
Craig Mautneraea74a52014-03-08 14:23:10 -08002182 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2183 data.enforceInterface(IActivityManager.descriptor);
2184 final boolean isInLockTaskMode = isInLockTaskMode();
2185 reply.writeNoException();
2186 reply.writeInt(isInLockTaskMode ? 1 : 0);
2187 return true;
2188 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002189
Winson Chunga449dc02014-05-16 11:15:04 -07002190 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002191 data.enforceInterface(IActivityManager.descriptor);
2192 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002193 ActivityManager.TaskDescription values =
2194 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2195 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002196 reply.writeNoException();
2197 return true;
2198 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002199
2200 case SET_MEDIA_PLAYING_TRANSACTION: {
2201 data.enforceInterface(IActivityManager.descriptor);
2202 IBinder token = data.readStrongBinder();
2203 boolean enable = data.readInt() > 0;
2204 boolean success = setMediaPlaying(token, enable);
2205 reply.writeNoException();
2206 reply.writeInt(success ? 1 : 0);
2207 return true;
2208 }
2209
2210 case IS_BG_MEDIA_PLAYING_TRANSACTION: {
2211 data.enforceInterface(IActivityManager.descriptor);
2212 IBinder token = data.readStrongBinder();
2213 final boolean enabled = isBackgroundMediaPlaying(token);
2214 reply.writeNoException();
2215 reply.writeInt(enabled ? 1 : 0);
2216 return true;
2217 }
2218
Craig Mautnerbb742462014-07-07 15:28:55 -07002219 case MEDIA_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002220 data.enforceInterface(IActivityManager.descriptor);
2221 IBinder token = data.readStrongBinder();
2222 mediaResourcesReleased(token);
2223 reply.writeNoException();
2224 return true;
2225 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002226
2227 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2228 data.enforceInterface(IActivityManager.descriptor);
2229 IBinder token = data.readStrongBinder();
2230 notifyLaunchTaskBehindComplete(token);
2231 reply.writeNoException();
2232 return true;
2233 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002234 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002235
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002236 return super.onTransact(code, data, reply, flags);
2237 }
2238
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002239 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002240 return this;
2241 }
2242
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002243 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2244 protected IActivityManager create() {
2245 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002246 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002247 Log.v("ActivityManager", "default service binder = " + b);
2248 }
2249 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002250 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002251 Log.v("ActivityManager", "default service = " + am);
2252 }
2253 return am;
2254 }
2255 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002256}
2257
2258class ActivityManagerProxy implements IActivityManager
2259{
2260 public ActivityManagerProxy(IBinder remote)
2261 {
2262 mRemote = remote;
2263 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002264
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002265 public IBinder asBinder()
2266 {
2267 return mRemote;
2268 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002269
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002270 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002271 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2272 int startFlags, String profileFile,
2273 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002274 Parcel data = Parcel.obtain();
2275 Parcel reply = Parcel.obtain();
2276 data.writeInterfaceToken(IActivityManager.descriptor);
2277 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002278 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002279 intent.writeToParcel(data, 0);
2280 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002281 data.writeStrongBinder(resultTo);
2282 data.writeString(resultWho);
2283 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002284 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002285 data.writeString(profileFile);
2286 if (profileFd != null) {
2287 data.writeInt(1);
2288 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2289 } else {
2290 data.writeInt(0);
2291 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002292 if (options != null) {
2293 data.writeInt(1);
2294 options.writeToParcel(data, 0);
2295 } else {
2296 data.writeInt(0);
2297 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002298 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2299 reply.readException();
2300 int result = reply.readInt();
2301 reply.recycle();
2302 data.recycle();
2303 return result;
2304 }
Amith Yamasani82644082012-08-03 13:09:11 -07002305
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002306 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002307 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2308 int startFlags, String profileFile,
2309 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2310 Parcel data = Parcel.obtain();
2311 Parcel reply = Parcel.obtain();
2312 data.writeInterfaceToken(IActivityManager.descriptor);
2313 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002314 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002315 intent.writeToParcel(data, 0);
2316 data.writeString(resolvedType);
2317 data.writeStrongBinder(resultTo);
2318 data.writeString(resultWho);
2319 data.writeInt(requestCode);
2320 data.writeInt(startFlags);
2321 data.writeString(profileFile);
2322 if (profileFd != null) {
2323 data.writeInt(1);
2324 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2325 } else {
2326 data.writeInt(0);
2327 }
2328 if (options != null) {
2329 data.writeInt(1);
2330 options.writeToParcel(data, 0);
2331 } else {
2332 data.writeInt(0);
2333 }
2334 data.writeInt(userId);
2335 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2336 reply.readException();
2337 int result = reply.readInt();
2338 reply.recycle();
2339 data.recycle();
2340 return result;
2341 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002342 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2343 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002344 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002345 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002346 Parcel data = Parcel.obtain();
2347 Parcel reply = Parcel.obtain();
2348 data.writeInterfaceToken(IActivityManager.descriptor);
2349 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002350 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002351 intent.writeToParcel(data, 0);
2352 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002353 data.writeStrongBinder(resultTo);
2354 data.writeString(resultWho);
2355 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002356 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002357 data.writeString(profileFile);
2358 if (profileFd != null) {
2359 data.writeInt(1);
2360 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2361 } else {
2362 data.writeInt(0);
2363 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002364 if (options != null) {
2365 data.writeInt(1);
2366 options.writeToParcel(data, 0);
2367 } else {
2368 data.writeInt(0);
2369 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002370 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002371 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2372 reply.readException();
2373 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2374 reply.recycle();
2375 data.recycle();
2376 return result;
2377 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002378 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2379 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002380 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002381 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002382 Parcel data = Parcel.obtain();
2383 Parcel reply = Parcel.obtain();
2384 data.writeInterfaceToken(IActivityManager.descriptor);
2385 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002386 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002387 intent.writeToParcel(data, 0);
2388 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002389 data.writeStrongBinder(resultTo);
2390 data.writeString(resultWho);
2391 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002392 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002393 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002394 if (options != null) {
2395 data.writeInt(1);
2396 options.writeToParcel(data, 0);
2397 } else {
2398 data.writeInt(0);
2399 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002400 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002401 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2402 reply.readException();
2403 int result = reply.readInt();
2404 reply.recycle();
2405 data.recycle();
2406 return result;
2407 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002408 public int startActivityIntentSender(IApplicationThread caller,
2409 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002410 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002411 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002412 Parcel data = Parcel.obtain();
2413 Parcel reply = Parcel.obtain();
2414 data.writeInterfaceToken(IActivityManager.descriptor);
2415 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2416 intent.writeToParcel(data, 0);
2417 if (fillInIntent != null) {
2418 data.writeInt(1);
2419 fillInIntent.writeToParcel(data, 0);
2420 } else {
2421 data.writeInt(0);
2422 }
2423 data.writeString(resolvedType);
2424 data.writeStrongBinder(resultTo);
2425 data.writeString(resultWho);
2426 data.writeInt(requestCode);
2427 data.writeInt(flagsMask);
2428 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002429 if (options != null) {
2430 data.writeInt(1);
2431 options.writeToParcel(data, 0);
2432 } else {
2433 data.writeInt(0);
2434 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002435 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002436 reply.readException();
2437 int result = reply.readInt();
2438 reply.recycle();
2439 data.recycle();
2440 return result;
2441 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002442 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2443 Intent intent, String resolvedType, IVoiceInteractionSession session,
2444 IVoiceInteractor interactor, int startFlags, String profileFile,
2445 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2446 Parcel data = Parcel.obtain();
2447 Parcel reply = Parcel.obtain();
2448 data.writeInterfaceToken(IActivityManager.descriptor);
2449 data.writeString(callingPackage);
2450 data.writeInt(callingPid);
2451 data.writeInt(callingUid);
2452 intent.writeToParcel(data, 0);
2453 data.writeString(resolvedType);
2454 data.writeStrongBinder(session.asBinder());
2455 data.writeStrongBinder(interactor.asBinder());
2456 data.writeInt(startFlags);
2457 data.writeString(profileFile);
2458 if (profileFd != null) {
2459 data.writeInt(1);
2460 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2461 } else {
2462 data.writeInt(0);
2463 }
2464 if (options != null) {
2465 data.writeInt(1);
2466 options.writeToParcel(data, 0);
2467 } else {
2468 data.writeInt(0);
2469 }
2470 data.writeInt(userId);
2471 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2472 reply.readException();
2473 int result = reply.readInt();
2474 reply.recycle();
2475 data.recycle();
2476 return result;
2477 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002478 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002479 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002480 Parcel data = Parcel.obtain();
2481 Parcel reply = Parcel.obtain();
2482 data.writeInterfaceToken(IActivityManager.descriptor);
2483 data.writeStrongBinder(callingActivity);
2484 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002485 if (options != null) {
2486 data.writeInt(1);
2487 options.writeToParcel(data, 0);
2488 } else {
2489 data.writeInt(0);
2490 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002491 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2492 reply.readException();
2493 int result = reply.readInt();
2494 reply.recycle();
2495 data.recycle();
2496 return result != 0;
2497 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002498 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2499 Parcel data = Parcel.obtain();
2500 Parcel reply = Parcel.obtain();
2501 data.writeInterfaceToken(IActivityManager.descriptor);
2502 data.writeInt(taskId);
2503 if (options == null) {
2504 data.writeInt(0);
2505 } else {
2506 data.writeInt(1);
2507 options.writeToParcel(data, 0);
2508 }
2509 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2510 reply.readException();
2511 int result = reply.readInt();
2512 reply.recycle();
2513 data.recycle();
2514 return result;
2515 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002516 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002517 throws RemoteException {
2518 Parcel data = Parcel.obtain();
2519 Parcel reply = Parcel.obtain();
2520 data.writeInterfaceToken(IActivityManager.descriptor);
2521 data.writeStrongBinder(token);
2522 data.writeInt(resultCode);
2523 if (resultData != null) {
2524 data.writeInt(1);
2525 resultData.writeToParcel(data, 0);
2526 } else {
2527 data.writeInt(0);
2528 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002529 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002530 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2531 reply.readException();
2532 boolean res = reply.readInt() != 0;
2533 data.recycle();
2534 reply.recycle();
2535 return res;
2536 }
2537 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2538 {
2539 Parcel data = Parcel.obtain();
2540 Parcel reply = Parcel.obtain();
2541 data.writeInterfaceToken(IActivityManager.descriptor);
2542 data.writeStrongBinder(token);
2543 data.writeString(resultWho);
2544 data.writeInt(requestCode);
2545 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2546 reply.readException();
2547 data.recycle();
2548 reply.recycle();
2549 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002550 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2551 Parcel data = Parcel.obtain();
2552 Parcel reply = Parcel.obtain();
2553 data.writeInterfaceToken(IActivityManager.descriptor);
2554 data.writeStrongBinder(token);
2555 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2556 reply.readException();
2557 boolean res = reply.readInt() != 0;
2558 data.recycle();
2559 reply.recycle();
2560 return res;
2561 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002562 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2563 Parcel data = Parcel.obtain();
2564 Parcel reply = Parcel.obtain();
2565 data.writeInterfaceToken(IActivityManager.descriptor);
2566 data.writeStrongBinder(session.asBinder());
2567 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2568 reply.readException();
2569 data.recycle();
2570 reply.recycle();
2571 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002572 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2573 Parcel data = Parcel.obtain();
2574 Parcel reply = Parcel.obtain();
2575 data.writeInterfaceToken(IActivityManager.descriptor);
2576 data.writeStrongBinder(token);
2577 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2578 reply.readException();
2579 boolean res = reply.readInt() != 0;
2580 data.recycle();
2581 reply.recycle();
2582 return res;
2583 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002584 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002585 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002586 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002587 {
2588 Parcel data = Parcel.obtain();
2589 Parcel reply = Parcel.obtain();
2590 data.writeInterfaceToken(IActivityManager.descriptor);
2591 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002592 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002593 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2594 filter.writeToParcel(data, 0);
2595 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002596 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002597 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2598 reply.readException();
2599 Intent intent = null;
2600 int haveIntent = reply.readInt();
2601 if (haveIntent != 0) {
2602 intent = Intent.CREATOR.createFromParcel(reply);
2603 }
2604 reply.recycle();
2605 data.recycle();
2606 return intent;
2607 }
2608 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2609 {
2610 Parcel data = Parcel.obtain();
2611 Parcel reply = Parcel.obtain();
2612 data.writeInterfaceToken(IActivityManager.descriptor);
2613 data.writeStrongBinder(receiver.asBinder());
2614 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2615 reply.readException();
2616 data.recycle();
2617 reply.recycle();
2618 }
2619 public int broadcastIntent(IApplicationThread caller,
2620 Intent intent, String resolvedType, IIntentReceiver resultTo,
2621 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002622 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002623 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002624 {
2625 Parcel data = Parcel.obtain();
2626 Parcel reply = Parcel.obtain();
2627 data.writeInterfaceToken(IActivityManager.descriptor);
2628 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2629 intent.writeToParcel(data, 0);
2630 data.writeString(resolvedType);
2631 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2632 data.writeInt(resultCode);
2633 data.writeString(resultData);
2634 data.writeBundle(map);
2635 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002636 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002637 data.writeInt(serialized ? 1 : 0);
2638 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002639 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002640 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2641 reply.readException();
2642 int res = reply.readInt();
2643 reply.recycle();
2644 data.recycle();
2645 return res;
2646 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002647 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2648 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002649 {
2650 Parcel data = Parcel.obtain();
2651 Parcel reply = Parcel.obtain();
2652 data.writeInterfaceToken(IActivityManager.descriptor);
2653 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2654 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002655 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002656 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2657 reply.readException();
2658 data.recycle();
2659 reply.recycle();
2660 }
2661 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2662 {
2663 Parcel data = Parcel.obtain();
2664 Parcel reply = Parcel.obtain();
2665 data.writeInterfaceToken(IActivityManager.descriptor);
2666 data.writeStrongBinder(who);
2667 data.writeInt(resultCode);
2668 data.writeString(resultData);
2669 data.writeBundle(map);
2670 data.writeInt(abortBroadcast ? 1 : 0);
2671 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2672 reply.readException();
2673 data.recycle();
2674 reply.recycle();
2675 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002676 public void attachApplication(IApplicationThread app) throws RemoteException
2677 {
2678 Parcel data = Parcel.obtain();
2679 Parcel reply = Parcel.obtain();
2680 data.writeInterfaceToken(IActivityManager.descriptor);
2681 data.writeStrongBinder(app.asBinder());
2682 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2683 reply.readException();
2684 data.recycle();
2685 reply.recycle();
2686 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002687 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2688 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002689 {
2690 Parcel data = Parcel.obtain();
2691 Parcel reply = Parcel.obtain();
2692 data.writeInterfaceToken(IActivityManager.descriptor);
2693 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002694 if (config != null) {
2695 data.writeInt(1);
2696 config.writeToParcel(data, 0);
2697 } else {
2698 data.writeInt(0);
2699 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002700 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002701 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2702 reply.readException();
2703 data.recycle();
2704 reply.recycle();
2705 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002706 public void activityResumed(IBinder token) throws RemoteException
2707 {
2708 Parcel data = Parcel.obtain();
2709 Parcel reply = Parcel.obtain();
2710 data.writeInterfaceToken(IActivityManager.descriptor);
2711 data.writeStrongBinder(token);
2712 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2713 reply.readException();
2714 data.recycle();
2715 reply.recycle();
2716 }
Craig Mautnera0026042014-04-23 11:45:37 -07002717 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002718 {
2719 Parcel data = Parcel.obtain();
2720 Parcel reply = Parcel.obtain();
2721 data.writeInterfaceToken(IActivityManager.descriptor);
2722 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002723 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002724 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2725 reply.readException();
2726 data.recycle();
2727 reply.recycle();
2728 }
2729 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002730 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002731 {
2732 Parcel data = Parcel.obtain();
2733 Parcel reply = Parcel.obtain();
2734 data.writeInterfaceToken(IActivityManager.descriptor);
2735 data.writeStrongBinder(token);
2736 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002737 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002738 TextUtils.writeToParcel(description, data, 0);
2739 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2740 reply.readException();
2741 data.recycle();
2742 reply.recycle();
2743 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002744 public void activitySlept(IBinder token) throws RemoteException
2745 {
2746 Parcel data = Parcel.obtain();
2747 Parcel reply = Parcel.obtain();
2748 data.writeInterfaceToken(IActivityManager.descriptor);
2749 data.writeStrongBinder(token);
2750 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2751 reply.readException();
2752 data.recycle();
2753 reply.recycle();
2754 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002755 public void activityDestroyed(IBinder token) throws RemoteException
2756 {
2757 Parcel data = Parcel.obtain();
2758 Parcel reply = Parcel.obtain();
2759 data.writeInterfaceToken(IActivityManager.descriptor);
2760 data.writeStrongBinder(token);
2761 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2762 reply.readException();
2763 data.recycle();
2764 reply.recycle();
2765 }
2766 public String getCallingPackage(IBinder token) throws RemoteException
2767 {
2768 Parcel data = Parcel.obtain();
2769 Parcel reply = Parcel.obtain();
2770 data.writeInterfaceToken(IActivityManager.descriptor);
2771 data.writeStrongBinder(token);
2772 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2773 reply.readException();
2774 String res = reply.readString();
2775 data.recycle();
2776 reply.recycle();
2777 return res;
2778 }
2779 public ComponentName getCallingActivity(IBinder token)
2780 throws RemoteException {
2781 Parcel data = Parcel.obtain();
2782 Parcel reply = Parcel.obtain();
2783 data.writeInterfaceToken(IActivityManager.descriptor);
2784 data.writeStrongBinder(token);
2785 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2786 reply.readException();
2787 ComponentName res = ComponentName.readFromParcel(reply);
2788 data.recycle();
2789 reply.recycle();
2790 return res;
2791 }
Winson Chung1147c402014-05-14 11:05:00 -07002792 public List<IAppTask> getAppTasks() throws RemoteException {
2793 Parcel data = Parcel.obtain();
2794 Parcel reply = Parcel.obtain();
2795 data.writeInterfaceToken(IActivityManager.descriptor);
2796 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2797 reply.readException();
2798 ArrayList<IAppTask> list = null;
2799 int N = reply.readInt();
2800 if (N >= 0) {
2801 list = new ArrayList<IAppTask>();
2802 while (N > 0) {
2803 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2804 list.add(task);
2805 N--;
2806 }
2807 }
2808 data.recycle();
2809 reply.recycle();
2810 return list;
2811 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002812 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002813 Parcel data = Parcel.obtain();
2814 Parcel reply = Parcel.obtain();
2815 data.writeInterfaceToken(IActivityManager.descriptor);
2816 data.writeInt(maxNum);
2817 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002818 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2819 reply.readException();
2820 ArrayList list = null;
2821 int N = reply.readInt();
2822 if (N >= 0) {
2823 list = new ArrayList();
2824 while (N > 0) {
2825 ActivityManager.RunningTaskInfo info =
2826 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002827 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002828 list.add(info);
2829 N--;
2830 }
2831 }
2832 data.recycle();
2833 reply.recycle();
2834 return list;
2835 }
2836 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002837 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002838 Parcel data = Parcel.obtain();
2839 Parcel reply = Parcel.obtain();
2840 data.writeInterfaceToken(IActivityManager.descriptor);
2841 data.writeInt(maxNum);
2842 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002843 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002844 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2845 reply.readException();
2846 ArrayList<ActivityManager.RecentTaskInfo> list
2847 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2848 data.recycle();
2849 reply.recycle();
2850 return list;
2851 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002852 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002853 Parcel data = Parcel.obtain();
2854 Parcel reply = Parcel.obtain();
2855 data.writeInterfaceToken(IActivityManager.descriptor);
2856 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002857 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002858 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002859 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002860 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002861 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002862 }
2863 data.recycle();
2864 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002865 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07002866 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002867 public List getServices(int maxNum, int flags) throws RemoteException {
2868 Parcel data = Parcel.obtain();
2869 Parcel reply = Parcel.obtain();
2870 data.writeInterfaceToken(IActivityManager.descriptor);
2871 data.writeInt(maxNum);
2872 data.writeInt(flags);
2873 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2874 reply.readException();
2875 ArrayList list = null;
2876 int N = reply.readInt();
2877 if (N >= 0) {
2878 list = new ArrayList();
2879 while (N > 0) {
2880 ActivityManager.RunningServiceInfo info =
2881 ActivityManager.RunningServiceInfo.CREATOR
2882 .createFromParcel(reply);
2883 list.add(info);
2884 N--;
2885 }
2886 }
2887 data.recycle();
2888 reply.recycle();
2889 return list;
2890 }
2891 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2892 throws RemoteException {
2893 Parcel data = Parcel.obtain();
2894 Parcel reply = Parcel.obtain();
2895 data.writeInterfaceToken(IActivityManager.descriptor);
2896 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2897 reply.readException();
2898 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2899 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2900 data.recycle();
2901 reply.recycle();
2902 return list;
2903 }
2904 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2905 throws RemoteException {
2906 Parcel data = Parcel.obtain();
2907 Parcel reply = Parcel.obtain();
2908 data.writeInterfaceToken(IActivityManager.descriptor);
2909 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2910 reply.readException();
2911 ArrayList<ActivityManager.RunningAppProcessInfo> list
2912 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2913 data.recycle();
2914 reply.recycle();
2915 return list;
2916 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002917 public List<ApplicationInfo> getRunningExternalApplications()
2918 throws RemoteException {
2919 Parcel data = Parcel.obtain();
2920 Parcel reply = Parcel.obtain();
2921 data.writeInterfaceToken(IActivityManager.descriptor);
2922 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2923 reply.readException();
2924 ArrayList<ApplicationInfo> list
2925 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2926 data.recycle();
2927 reply.recycle();
2928 return list;
2929 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002930 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002931 {
2932 Parcel data = Parcel.obtain();
2933 Parcel reply = Parcel.obtain();
2934 data.writeInterfaceToken(IActivityManager.descriptor);
2935 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002936 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002937 if (options != null) {
2938 data.writeInt(1);
2939 options.writeToParcel(data, 0);
2940 } else {
2941 data.writeInt(0);
2942 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002943 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2944 reply.readException();
2945 data.recycle();
2946 reply.recycle();
2947 }
2948 public void moveTaskToBack(int task) throws RemoteException
2949 {
2950 Parcel data = Parcel.obtain();
2951 Parcel reply = Parcel.obtain();
2952 data.writeInterfaceToken(IActivityManager.descriptor);
2953 data.writeInt(task);
2954 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2955 reply.readException();
2956 data.recycle();
2957 reply.recycle();
2958 }
2959 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2960 throws RemoteException {
2961 Parcel data = Parcel.obtain();
2962 Parcel reply = Parcel.obtain();
2963 data.writeInterfaceToken(IActivityManager.descriptor);
2964 data.writeStrongBinder(token);
2965 data.writeInt(nonRoot ? 1 : 0);
2966 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2967 reply.readException();
2968 boolean res = reply.readInt() != 0;
2969 data.recycle();
2970 reply.recycle();
2971 return res;
2972 }
2973 public void moveTaskBackwards(int task) throws RemoteException
2974 {
2975 Parcel data = Parcel.obtain();
2976 Parcel reply = Parcel.obtain();
2977 data.writeInterfaceToken(IActivityManager.descriptor);
2978 data.writeInt(task);
2979 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2980 reply.readException();
2981 data.recycle();
2982 reply.recycle();
2983 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002984 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002985 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2986 {
2987 Parcel data = Parcel.obtain();
2988 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002989 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002990 data.writeInt(taskId);
2991 data.writeInt(stackId);
2992 data.writeInt(toTop ? 1 : 0);
2993 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2994 reply.readException();
2995 data.recycle();
2996 reply.recycle();
2997 }
2998 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002999 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003000 {
3001 Parcel data = Parcel.obtain();
3002 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003003 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003004 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003005 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003006 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003007 reply.readException();
3008 data.recycle();
3009 reply.recycle();
3010 }
Craig Mautner967212c2013-04-13 21:10:58 -07003011 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003012 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003013 {
3014 Parcel data = Parcel.obtain();
3015 Parcel reply = Parcel.obtain();
3016 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003017 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003018 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003019 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003020 data.recycle();
3021 reply.recycle();
3022 return list;
3023 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003024 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003025 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003026 {
3027 Parcel data = Parcel.obtain();
3028 Parcel reply = Parcel.obtain();
3029 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003030 data.writeInt(stackId);
3031 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003032 reply.readException();
3033 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003034 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003035 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003036 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003037 }
3038 data.recycle();
3039 reply.recycle();
3040 return info;
3041 }
3042 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003043 public boolean isInHomeStack(int taskId) throws RemoteException {
3044 Parcel data = Parcel.obtain();
3045 Parcel reply = Parcel.obtain();
3046 data.writeInterfaceToken(IActivityManager.descriptor);
3047 data.writeInt(taskId);
3048 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3049 reply.readException();
3050 boolean isInHomeStack = reply.readInt() > 0;
3051 data.recycle();
3052 reply.recycle();
3053 return isInHomeStack;
3054 }
3055 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003056 public void setFocusedStack(int stackId) throws RemoteException
3057 {
3058 Parcel data = Parcel.obtain();
3059 Parcel reply = Parcel.obtain();
3060 data.writeInterfaceToken(IActivityManager.descriptor);
3061 data.writeInt(stackId);
3062 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3063 reply.readException();
3064 data.recycle();
3065 reply.recycle();
3066 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003067 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3068 {
3069 Parcel data = Parcel.obtain();
3070 Parcel reply = Parcel.obtain();
3071 data.writeInterfaceToken(IActivityManager.descriptor);
3072 data.writeStrongBinder(token);
3073 data.writeInt(onlyRoot ? 1 : 0);
3074 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3075 reply.readException();
3076 int res = reply.readInt();
3077 data.recycle();
3078 reply.recycle();
3079 return res;
3080 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003081 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003082 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003083 Parcel data = Parcel.obtain();
3084 Parcel reply = Parcel.obtain();
3085 data.writeInterfaceToken(IActivityManager.descriptor);
3086 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3087 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003088 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003089 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003090 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3091 reply.readException();
3092 int res = reply.readInt();
3093 ContentProviderHolder cph = null;
3094 if (res != 0) {
3095 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3096 }
3097 data.recycle();
3098 reply.recycle();
3099 return cph;
3100 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003101 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3102 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003103 Parcel data = Parcel.obtain();
3104 Parcel reply = Parcel.obtain();
3105 data.writeInterfaceToken(IActivityManager.descriptor);
3106 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003107 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003108 data.writeStrongBinder(token);
3109 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3110 reply.readException();
3111 int res = reply.readInt();
3112 ContentProviderHolder cph = null;
3113 if (res != 0) {
3114 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3115 }
3116 data.recycle();
3117 reply.recycle();
3118 return cph;
3119 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003120 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003121 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003122 {
3123 Parcel data = Parcel.obtain();
3124 Parcel reply = Parcel.obtain();
3125 data.writeInterfaceToken(IActivityManager.descriptor);
3126 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3127 data.writeTypedList(providers);
3128 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3129 reply.readException();
3130 data.recycle();
3131 reply.recycle();
3132 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003133 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3134 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003135 Parcel data = Parcel.obtain();
3136 Parcel reply = Parcel.obtain();
3137 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003138 data.writeStrongBinder(connection);
3139 data.writeInt(stable);
3140 data.writeInt(unstable);
3141 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3142 reply.readException();
3143 boolean res = reply.readInt() != 0;
3144 data.recycle();
3145 reply.recycle();
3146 return res;
3147 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003148
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003149 public void unstableProviderDied(IBinder connection) throws RemoteException {
3150 Parcel data = Parcel.obtain();
3151 Parcel reply = Parcel.obtain();
3152 data.writeInterfaceToken(IActivityManager.descriptor);
3153 data.writeStrongBinder(connection);
3154 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3155 reply.readException();
3156 data.recycle();
3157 reply.recycle();
3158 }
3159
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003160 @Override
3161 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3162 Parcel data = Parcel.obtain();
3163 Parcel reply = Parcel.obtain();
3164 data.writeInterfaceToken(IActivityManager.descriptor);
3165 data.writeStrongBinder(connection);
3166 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3167 reply.readException();
3168 data.recycle();
3169 reply.recycle();
3170 }
3171
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003172 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3173 Parcel data = Parcel.obtain();
3174 Parcel reply = Parcel.obtain();
3175 data.writeInterfaceToken(IActivityManager.descriptor);
3176 data.writeStrongBinder(connection);
3177 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003178 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3179 reply.readException();
3180 data.recycle();
3181 reply.recycle();
3182 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003183
3184 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3185 Parcel data = Parcel.obtain();
3186 Parcel reply = Parcel.obtain();
3187 data.writeInterfaceToken(IActivityManager.descriptor);
3188 data.writeString(name);
3189 data.writeStrongBinder(token);
3190 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3191 reply.readException();
3192 data.recycle();
3193 reply.recycle();
3194 }
3195
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003196 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3197 throws RemoteException
3198 {
3199 Parcel data = Parcel.obtain();
3200 Parcel reply = Parcel.obtain();
3201 data.writeInterfaceToken(IActivityManager.descriptor);
3202 service.writeToParcel(data, 0);
3203 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3204 reply.readException();
3205 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3206 data.recycle();
3207 reply.recycle();
3208 return res;
3209 }
3210
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003211 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003212 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003213 {
3214 Parcel data = Parcel.obtain();
3215 Parcel reply = Parcel.obtain();
3216 data.writeInterfaceToken(IActivityManager.descriptor);
3217 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3218 service.writeToParcel(data, 0);
3219 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003220 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003221 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3222 reply.readException();
3223 ComponentName res = ComponentName.readFromParcel(reply);
3224 data.recycle();
3225 reply.recycle();
3226 return res;
3227 }
3228 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003229 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003230 {
3231 Parcel data = Parcel.obtain();
3232 Parcel reply = Parcel.obtain();
3233 data.writeInterfaceToken(IActivityManager.descriptor);
3234 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3235 service.writeToParcel(data, 0);
3236 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003237 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003238 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3239 reply.readException();
3240 int res = reply.readInt();
3241 reply.recycle();
3242 data.recycle();
3243 return res;
3244 }
3245 public boolean stopServiceToken(ComponentName className, IBinder token,
3246 int startId) throws RemoteException {
3247 Parcel data = Parcel.obtain();
3248 Parcel reply = Parcel.obtain();
3249 data.writeInterfaceToken(IActivityManager.descriptor);
3250 ComponentName.writeToParcel(className, data);
3251 data.writeStrongBinder(token);
3252 data.writeInt(startId);
3253 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3254 reply.readException();
3255 boolean res = reply.readInt() != 0;
3256 data.recycle();
3257 reply.recycle();
3258 return res;
3259 }
3260 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003261 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003262 Parcel data = Parcel.obtain();
3263 Parcel reply = Parcel.obtain();
3264 data.writeInterfaceToken(IActivityManager.descriptor);
3265 ComponentName.writeToParcel(className, data);
3266 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003267 data.writeInt(id);
3268 if (notification != null) {
3269 data.writeInt(1);
3270 notification.writeToParcel(data, 0);
3271 } else {
3272 data.writeInt(0);
3273 }
3274 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003275 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3276 reply.readException();
3277 data.recycle();
3278 reply.recycle();
3279 }
3280 public int bindService(IApplicationThread caller, IBinder token,
3281 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003282 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003283 Parcel data = Parcel.obtain();
3284 Parcel reply = Parcel.obtain();
3285 data.writeInterfaceToken(IActivityManager.descriptor);
3286 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3287 data.writeStrongBinder(token);
3288 service.writeToParcel(data, 0);
3289 data.writeString(resolvedType);
3290 data.writeStrongBinder(connection.asBinder());
3291 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003292 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003293 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3294 reply.readException();
3295 int res = reply.readInt();
3296 data.recycle();
3297 reply.recycle();
3298 return res;
3299 }
3300 public boolean unbindService(IServiceConnection connection) throws RemoteException
3301 {
3302 Parcel data = Parcel.obtain();
3303 Parcel reply = Parcel.obtain();
3304 data.writeInterfaceToken(IActivityManager.descriptor);
3305 data.writeStrongBinder(connection.asBinder());
3306 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3307 reply.readException();
3308 boolean res = reply.readInt() != 0;
3309 data.recycle();
3310 reply.recycle();
3311 return res;
3312 }
3313
3314 public void publishService(IBinder token,
3315 Intent intent, IBinder service) throws RemoteException {
3316 Parcel data = Parcel.obtain();
3317 Parcel reply = Parcel.obtain();
3318 data.writeInterfaceToken(IActivityManager.descriptor);
3319 data.writeStrongBinder(token);
3320 intent.writeToParcel(data, 0);
3321 data.writeStrongBinder(service);
3322 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3323 reply.readException();
3324 data.recycle();
3325 reply.recycle();
3326 }
3327
3328 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3329 throws RemoteException {
3330 Parcel data = Parcel.obtain();
3331 Parcel reply = Parcel.obtain();
3332 data.writeInterfaceToken(IActivityManager.descriptor);
3333 data.writeStrongBinder(token);
3334 intent.writeToParcel(data, 0);
3335 data.writeInt(doRebind ? 1 : 0);
3336 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3337 reply.readException();
3338 data.recycle();
3339 reply.recycle();
3340 }
3341
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003342 public void serviceDoneExecuting(IBinder token, int type, int startId,
3343 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003344 Parcel data = Parcel.obtain();
3345 Parcel reply = Parcel.obtain();
3346 data.writeInterfaceToken(IActivityManager.descriptor);
3347 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003348 data.writeInt(type);
3349 data.writeInt(startId);
3350 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003351 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3352 reply.readException();
3353 data.recycle();
3354 reply.recycle();
3355 }
3356
3357 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3358 Parcel data = Parcel.obtain();
3359 Parcel reply = Parcel.obtain();
3360 data.writeInterfaceToken(IActivityManager.descriptor);
3361 service.writeToParcel(data, 0);
3362 data.writeString(resolvedType);
3363 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3364 reply.readException();
3365 IBinder binder = reply.readStrongBinder();
3366 reply.recycle();
3367 data.recycle();
3368 return binder;
3369 }
3370
Christopher Tate181fafa2009-05-14 11:12:14 -07003371 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3372 throws RemoteException {
3373 Parcel data = Parcel.obtain();
3374 Parcel reply = Parcel.obtain();
3375 data.writeInterfaceToken(IActivityManager.descriptor);
3376 app.writeToParcel(data, 0);
3377 data.writeInt(backupRestoreMode);
3378 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3379 reply.readException();
3380 boolean success = reply.readInt() != 0;
3381 reply.recycle();
3382 data.recycle();
3383 return success;
3384 }
3385
Christopher Tate346acb12012-10-15 19:20:25 -07003386 public void clearPendingBackup() throws RemoteException {
3387 Parcel data = Parcel.obtain();
3388 Parcel reply = Parcel.obtain();
3389 data.writeInterfaceToken(IActivityManager.descriptor);
3390 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3391 reply.recycle();
3392 data.recycle();
3393 }
3394
Christopher Tate181fafa2009-05-14 11:12:14 -07003395 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3396 Parcel data = Parcel.obtain();
3397 Parcel reply = Parcel.obtain();
3398 data.writeInterfaceToken(IActivityManager.descriptor);
3399 data.writeString(packageName);
3400 data.writeStrongBinder(agent);
3401 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3402 reply.recycle();
3403 data.recycle();
3404 }
3405
3406 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3407 Parcel data = Parcel.obtain();
3408 Parcel reply = Parcel.obtain();
3409 data.writeInterfaceToken(IActivityManager.descriptor);
3410 app.writeToParcel(data, 0);
3411 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3412 reply.readException();
3413 reply.recycle();
3414 data.recycle();
3415 }
3416
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003417 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003418 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003419 IUiAutomationConnection connection, int userId, String instructionSet)
3420 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003421 Parcel data = Parcel.obtain();
3422 Parcel reply = Parcel.obtain();
3423 data.writeInterfaceToken(IActivityManager.descriptor);
3424 ComponentName.writeToParcel(className, data);
3425 data.writeString(profileFile);
3426 data.writeInt(flags);
3427 data.writeBundle(arguments);
3428 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003429 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003430 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003431 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003432 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3433 reply.readException();
3434 boolean res = reply.readInt() != 0;
3435 reply.recycle();
3436 data.recycle();
3437 return res;
3438 }
3439
3440 public void finishInstrumentation(IApplicationThread target,
3441 int resultCode, Bundle results) throws RemoteException {
3442 Parcel data = Parcel.obtain();
3443 Parcel reply = Parcel.obtain();
3444 data.writeInterfaceToken(IActivityManager.descriptor);
3445 data.writeStrongBinder(target != null ? target.asBinder() : null);
3446 data.writeInt(resultCode);
3447 data.writeBundle(results);
3448 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3449 reply.readException();
3450 data.recycle();
3451 reply.recycle();
3452 }
3453 public Configuration getConfiguration() throws RemoteException
3454 {
3455 Parcel data = Parcel.obtain();
3456 Parcel reply = Parcel.obtain();
3457 data.writeInterfaceToken(IActivityManager.descriptor);
3458 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3459 reply.readException();
3460 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3461 reply.recycle();
3462 data.recycle();
3463 return res;
3464 }
3465 public void updateConfiguration(Configuration values) throws RemoteException
3466 {
3467 Parcel data = Parcel.obtain();
3468 Parcel reply = Parcel.obtain();
3469 data.writeInterfaceToken(IActivityManager.descriptor);
3470 values.writeToParcel(data, 0);
3471 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3472 reply.readException();
3473 data.recycle();
3474 reply.recycle();
3475 }
3476 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3477 throws RemoteException {
3478 Parcel data = Parcel.obtain();
3479 Parcel reply = Parcel.obtain();
3480 data.writeInterfaceToken(IActivityManager.descriptor);
3481 data.writeStrongBinder(token);
3482 data.writeInt(requestedOrientation);
3483 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3484 reply.readException();
3485 data.recycle();
3486 reply.recycle();
3487 }
3488 public int getRequestedOrientation(IBinder token) throws RemoteException {
3489 Parcel data = Parcel.obtain();
3490 Parcel reply = Parcel.obtain();
3491 data.writeInterfaceToken(IActivityManager.descriptor);
3492 data.writeStrongBinder(token);
3493 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3494 reply.readException();
3495 int res = reply.readInt();
3496 data.recycle();
3497 reply.recycle();
3498 return res;
3499 }
3500 public ComponentName getActivityClassForToken(IBinder token)
3501 throws RemoteException {
3502 Parcel data = Parcel.obtain();
3503 Parcel reply = Parcel.obtain();
3504 data.writeInterfaceToken(IActivityManager.descriptor);
3505 data.writeStrongBinder(token);
3506 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3507 reply.readException();
3508 ComponentName res = ComponentName.readFromParcel(reply);
3509 data.recycle();
3510 reply.recycle();
3511 return res;
3512 }
3513 public String getPackageForToken(IBinder token) throws RemoteException
3514 {
3515 Parcel data = Parcel.obtain();
3516 Parcel reply = Parcel.obtain();
3517 data.writeInterfaceToken(IActivityManager.descriptor);
3518 data.writeStrongBinder(token);
3519 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3520 reply.readException();
3521 String res = reply.readString();
3522 data.recycle();
3523 reply.recycle();
3524 return res;
3525 }
3526 public IIntentSender getIntentSender(int type,
3527 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003528 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003529 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003530 Parcel data = Parcel.obtain();
3531 Parcel reply = Parcel.obtain();
3532 data.writeInterfaceToken(IActivityManager.descriptor);
3533 data.writeInt(type);
3534 data.writeString(packageName);
3535 data.writeStrongBinder(token);
3536 data.writeString(resultWho);
3537 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003538 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003539 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003540 data.writeTypedArray(intents, 0);
3541 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003542 } else {
3543 data.writeInt(0);
3544 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003545 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003546 if (options != null) {
3547 data.writeInt(1);
3548 options.writeToParcel(data, 0);
3549 } else {
3550 data.writeInt(0);
3551 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003552 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003553 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3554 reply.readException();
3555 IIntentSender res = IIntentSender.Stub.asInterface(
3556 reply.readStrongBinder());
3557 data.recycle();
3558 reply.recycle();
3559 return res;
3560 }
3561 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3562 Parcel data = Parcel.obtain();
3563 Parcel reply = Parcel.obtain();
3564 data.writeInterfaceToken(IActivityManager.descriptor);
3565 data.writeStrongBinder(sender.asBinder());
3566 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3567 reply.readException();
3568 data.recycle();
3569 reply.recycle();
3570 }
3571 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3572 Parcel data = Parcel.obtain();
3573 Parcel reply = Parcel.obtain();
3574 data.writeInterfaceToken(IActivityManager.descriptor);
3575 data.writeStrongBinder(sender.asBinder());
3576 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3577 reply.readException();
3578 String res = reply.readString();
3579 data.recycle();
3580 reply.recycle();
3581 return res;
3582 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003583 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3584 Parcel data = Parcel.obtain();
3585 Parcel reply = Parcel.obtain();
3586 data.writeInterfaceToken(IActivityManager.descriptor);
3587 data.writeStrongBinder(sender.asBinder());
3588 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3589 reply.readException();
3590 int res = reply.readInt();
3591 data.recycle();
3592 reply.recycle();
3593 return res;
3594 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003595 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3596 boolean requireFull, String name, String callerPackage) throws RemoteException {
3597 Parcel data = Parcel.obtain();
3598 Parcel reply = Parcel.obtain();
3599 data.writeInterfaceToken(IActivityManager.descriptor);
3600 data.writeInt(callingPid);
3601 data.writeInt(callingUid);
3602 data.writeInt(userId);
3603 data.writeInt(allowAll ? 1 : 0);
3604 data.writeInt(requireFull ? 1 : 0);
3605 data.writeString(name);
3606 data.writeString(callerPackage);
3607 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3608 reply.readException();
3609 int res = reply.readInt();
3610 data.recycle();
3611 reply.recycle();
3612 return res;
3613 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003614 public void setProcessLimit(int max) throws RemoteException
3615 {
3616 Parcel data = Parcel.obtain();
3617 Parcel reply = Parcel.obtain();
3618 data.writeInterfaceToken(IActivityManager.descriptor);
3619 data.writeInt(max);
3620 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3621 reply.readException();
3622 data.recycle();
3623 reply.recycle();
3624 }
3625 public int getProcessLimit() throws RemoteException
3626 {
3627 Parcel data = Parcel.obtain();
3628 Parcel reply = Parcel.obtain();
3629 data.writeInterfaceToken(IActivityManager.descriptor);
3630 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3631 reply.readException();
3632 int res = reply.readInt();
3633 data.recycle();
3634 reply.recycle();
3635 return res;
3636 }
3637 public void setProcessForeground(IBinder token, int pid,
3638 boolean isForeground) throws RemoteException {
3639 Parcel data = Parcel.obtain();
3640 Parcel reply = Parcel.obtain();
3641 data.writeInterfaceToken(IActivityManager.descriptor);
3642 data.writeStrongBinder(token);
3643 data.writeInt(pid);
3644 data.writeInt(isForeground ? 1 : 0);
3645 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3646 reply.readException();
3647 data.recycle();
3648 reply.recycle();
3649 }
3650 public int checkPermission(String permission, int pid, int uid)
3651 throws RemoteException {
3652 Parcel data = Parcel.obtain();
3653 Parcel reply = Parcel.obtain();
3654 data.writeInterfaceToken(IActivityManager.descriptor);
3655 data.writeString(permission);
3656 data.writeInt(pid);
3657 data.writeInt(uid);
3658 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3659 reply.readException();
3660 int res = reply.readInt();
3661 data.recycle();
3662 reply.recycle();
3663 return res;
3664 }
3665 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003666 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003667 Parcel data = Parcel.obtain();
3668 Parcel reply = Parcel.obtain();
3669 data.writeInterfaceToken(IActivityManager.descriptor);
3670 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003671 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003672 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003673 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3674 reply.readException();
3675 boolean res = reply.readInt() != 0;
3676 data.recycle();
3677 reply.recycle();
3678 return res;
3679 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003680 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003681 throws RemoteException {
3682 Parcel data = Parcel.obtain();
3683 Parcel reply = Parcel.obtain();
3684 data.writeInterfaceToken(IActivityManager.descriptor);
3685 uri.writeToParcel(data, 0);
3686 data.writeInt(pid);
3687 data.writeInt(uid);
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(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3691 reply.readException();
3692 int res = reply.readInt();
3693 data.recycle();
3694 reply.recycle();
3695 return res;
3696 }
3697 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003698 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003699 Parcel data = Parcel.obtain();
3700 Parcel reply = Parcel.obtain();
3701 data.writeInterfaceToken(IActivityManager.descriptor);
3702 data.writeStrongBinder(caller.asBinder());
3703 data.writeString(targetPkg);
3704 uri.writeToParcel(data, 0);
3705 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003706 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003707 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3708 reply.readException();
3709 data.recycle();
3710 reply.recycle();
3711 }
3712 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003713 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003714 Parcel data = Parcel.obtain();
3715 Parcel reply = Parcel.obtain();
3716 data.writeInterfaceToken(IActivityManager.descriptor);
3717 data.writeStrongBinder(caller.asBinder());
3718 uri.writeToParcel(data, 0);
3719 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003720 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003721 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3722 reply.readException();
3723 data.recycle();
3724 reply.recycle();
3725 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003726
3727 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003728 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3729 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003730 Parcel data = Parcel.obtain();
3731 Parcel reply = Parcel.obtain();
3732 data.writeInterfaceToken(IActivityManager.descriptor);
3733 uri.writeToParcel(data, 0);
3734 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003735 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003736 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3737 reply.readException();
3738 data.recycle();
3739 reply.recycle();
3740 }
3741
3742 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003743 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3744 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003745 Parcel data = Parcel.obtain();
3746 Parcel reply = Parcel.obtain();
3747 data.writeInterfaceToken(IActivityManager.descriptor);
3748 uri.writeToParcel(data, 0);
3749 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003750 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003751 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3752 reply.readException();
3753 data.recycle();
3754 reply.recycle();
3755 }
3756
3757 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003758 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3759 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003760 Parcel data = Parcel.obtain();
3761 Parcel reply = Parcel.obtain();
3762 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003763 data.writeString(packageName);
3764 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003765 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3766 reply.readException();
3767 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3768 reply);
3769 data.recycle();
3770 reply.recycle();
3771 return perms;
3772 }
3773
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003774 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3775 throws RemoteException {
3776 Parcel data = Parcel.obtain();
3777 Parcel reply = Parcel.obtain();
3778 data.writeInterfaceToken(IActivityManager.descriptor);
3779 data.writeStrongBinder(who.asBinder());
3780 data.writeInt(waiting ? 1 : 0);
3781 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3782 reply.readException();
3783 data.recycle();
3784 reply.recycle();
3785 }
3786 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3787 Parcel data = Parcel.obtain();
3788 Parcel reply = Parcel.obtain();
3789 data.writeInterfaceToken(IActivityManager.descriptor);
3790 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3791 reply.readException();
3792 outInfo.readFromParcel(reply);
3793 data.recycle();
3794 reply.recycle();
3795 }
3796 public void unhandledBack() throws RemoteException
3797 {
3798 Parcel data = Parcel.obtain();
3799 Parcel reply = Parcel.obtain();
3800 data.writeInterfaceToken(IActivityManager.descriptor);
3801 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3802 reply.readException();
3803 data.recycle();
3804 reply.recycle();
3805 }
3806 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3807 {
3808 Parcel data = Parcel.obtain();
3809 Parcel reply = Parcel.obtain();
3810 data.writeInterfaceToken(IActivityManager.descriptor);
3811 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3812 reply.readException();
3813 ParcelFileDescriptor pfd = null;
3814 if (reply.readInt() != 0) {
3815 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3816 }
3817 data.recycle();
3818 reply.recycle();
3819 return pfd;
3820 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003821 public void setLockScreenShown(boolean shown) throws RemoteException
3822 {
3823 Parcel data = Parcel.obtain();
3824 Parcel reply = Parcel.obtain();
3825 data.writeInterfaceToken(IActivityManager.descriptor);
3826 data.writeInt(shown ? 1 : 0);
3827 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3828 reply.readException();
3829 data.recycle();
3830 reply.recycle();
3831 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003832 public void setDebugApp(
3833 String packageName, boolean waitForDebugger, boolean persistent)
3834 throws RemoteException
3835 {
3836 Parcel data = Parcel.obtain();
3837 Parcel reply = Parcel.obtain();
3838 data.writeInterfaceToken(IActivityManager.descriptor);
3839 data.writeString(packageName);
3840 data.writeInt(waitForDebugger ? 1 : 0);
3841 data.writeInt(persistent ? 1 : 0);
3842 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3843 reply.readException();
3844 data.recycle();
3845 reply.recycle();
3846 }
3847 public void setAlwaysFinish(boolean enabled) throws RemoteException
3848 {
3849 Parcel data = Parcel.obtain();
3850 Parcel reply = Parcel.obtain();
3851 data.writeInterfaceToken(IActivityManager.descriptor);
3852 data.writeInt(enabled ? 1 : 0);
3853 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3854 reply.readException();
3855 data.recycle();
3856 reply.recycle();
3857 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003858 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003859 {
3860 Parcel data = Parcel.obtain();
3861 Parcel reply = Parcel.obtain();
3862 data.writeInterfaceToken(IActivityManager.descriptor);
3863 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003864 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003865 reply.readException();
3866 data.recycle();
3867 reply.recycle();
3868 }
3869 public void enterSafeMode() throws RemoteException {
3870 Parcel data = Parcel.obtain();
3871 data.writeInterfaceToken(IActivityManager.descriptor);
3872 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3873 data.recycle();
3874 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003875 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3876 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003877 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003878 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003879 data.writeStrongBinder(sender.asBinder());
3880 data.writeInt(sourceUid);
3881 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003882 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3883 data.recycle();
3884 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003885 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003886 Parcel data = Parcel.obtain();
3887 Parcel reply = Parcel.obtain();
3888 data.writeInterfaceToken(IActivityManager.descriptor);
3889 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003890 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003891 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003892 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003893 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003894 boolean res = reply.readInt() != 0;
3895 data.recycle();
3896 reply.recycle();
3897 return res;
3898 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003899 @Override
3900 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3901 Parcel data = Parcel.obtain();
3902 Parcel reply = Parcel.obtain();
3903 data.writeInterfaceToken(IActivityManager.descriptor);
3904 data.writeString(reason);
3905 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3906 boolean res = reply.readInt() != 0;
3907 data.recycle();
3908 reply.recycle();
3909 return res;
3910 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003911 public boolean testIsSystemReady()
3912 {
3913 /* this base class version is never called */
3914 return true;
3915 }
Dan Egnor60d87622009-12-16 16:32:58 -08003916 public void handleApplicationCrash(IBinder app,
3917 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3918 {
3919 Parcel data = Parcel.obtain();
3920 Parcel reply = Parcel.obtain();
3921 data.writeInterfaceToken(IActivityManager.descriptor);
3922 data.writeStrongBinder(app);
3923 crashInfo.writeToParcel(data, 0);
3924 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3925 reply.readException();
3926 reply.recycle();
3927 data.recycle();
3928 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003929
Dan Egnor60d87622009-12-16 16:32:58 -08003930 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003931 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003932 {
3933 Parcel data = Parcel.obtain();
3934 Parcel reply = Parcel.obtain();
3935 data.writeInterfaceToken(IActivityManager.descriptor);
3936 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003937 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003938 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003939 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003940 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003941 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003942 reply.recycle();
3943 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003944 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003945 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003946
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003947 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003948 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003949 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003950 {
3951 Parcel data = Parcel.obtain();
3952 Parcel reply = Parcel.obtain();
3953 data.writeInterfaceToken(IActivityManager.descriptor);
3954 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003955 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003956 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003957 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3958 reply.readException();
3959 reply.recycle();
3960 data.recycle();
3961 }
3962
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003963 public void signalPersistentProcesses(int sig) throws RemoteException {
3964 Parcel data = Parcel.obtain();
3965 Parcel reply = Parcel.obtain();
3966 data.writeInterfaceToken(IActivityManager.descriptor);
3967 data.writeInt(sig);
3968 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3969 reply.readException();
3970 data.recycle();
3971 reply.recycle();
3972 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003973
Dianne Hackborn1676c852012-09-10 14:52:30 -07003974 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003975 Parcel data = Parcel.obtain();
3976 Parcel reply = Parcel.obtain();
3977 data.writeInterfaceToken(IActivityManager.descriptor);
3978 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003979 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003980 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3981 reply.readException();
3982 data.recycle();
3983 reply.recycle();
3984 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003985
3986 public void killAllBackgroundProcesses() throws RemoteException {
3987 Parcel data = Parcel.obtain();
3988 Parcel reply = Parcel.obtain();
3989 data.writeInterfaceToken(IActivityManager.descriptor);
3990 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3991 reply.readException();
3992 data.recycle();
3993 reply.recycle();
3994 }
3995
Dianne Hackborn1676c852012-09-10 14:52:30 -07003996 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003997 Parcel data = Parcel.obtain();
3998 Parcel reply = Parcel.obtain();
3999 data.writeInterfaceToken(IActivityManager.descriptor);
4000 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004001 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004002 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004003 reply.readException();
4004 data.recycle();
4005 reply.recycle();
4006 }
4007
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004008 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4009 throws RemoteException
4010 {
4011 Parcel data = Parcel.obtain();
4012 Parcel reply = Parcel.obtain();
4013 data.writeInterfaceToken(IActivityManager.descriptor);
4014 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4015 reply.readException();
4016 outInfo.readFromParcel(reply);
4017 reply.recycle();
4018 data.recycle();
4019 }
4020
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004021 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4022 {
4023 Parcel data = Parcel.obtain();
4024 Parcel reply = Parcel.obtain();
4025 data.writeInterfaceToken(IActivityManager.descriptor);
4026 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4027 reply.readException();
4028 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4029 reply.recycle();
4030 data.recycle();
4031 return res;
4032 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004033
Dianne Hackborn1676c852012-09-10 14:52:30 -07004034 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07004035 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004036 {
4037 Parcel data = Parcel.obtain();
4038 Parcel reply = Parcel.obtain();
4039 data.writeInterfaceToken(IActivityManager.descriptor);
4040 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004041 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004042 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004043 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004044 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004045 if (fd != null) {
4046 data.writeInt(1);
4047 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4048 } else {
4049 data.writeInt(0);
4050 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004051 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4052 reply.readException();
4053 boolean res = reply.readInt() != 0;
4054 reply.recycle();
4055 data.recycle();
4056 return res;
4057 }
4058
Dianne Hackborn55280a92009-05-07 15:53:46 -07004059 public boolean shutdown(int timeout) throws RemoteException
4060 {
4061 Parcel data = Parcel.obtain();
4062 Parcel reply = Parcel.obtain();
4063 data.writeInterfaceToken(IActivityManager.descriptor);
4064 data.writeInt(timeout);
4065 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4066 reply.readException();
4067 boolean res = reply.readInt() != 0;
4068 reply.recycle();
4069 data.recycle();
4070 return res;
4071 }
4072
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004073 public void stopAppSwitches() throws RemoteException {
4074 Parcel data = Parcel.obtain();
4075 Parcel reply = Parcel.obtain();
4076 data.writeInterfaceToken(IActivityManager.descriptor);
4077 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4078 reply.readException();
4079 reply.recycle();
4080 data.recycle();
4081 }
4082
4083 public void resumeAppSwitches() throws RemoteException {
4084 Parcel data = Parcel.obtain();
4085 Parcel reply = Parcel.obtain();
4086 data.writeInterfaceToken(IActivityManager.descriptor);
4087 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4088 reply.readException();
4089 reply.recycle();
4090 data.recycle();
4091 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004092
4093 public void addPackageDependency(String packageName) throws RemoteException {
4094 Parcel data = Parcel.obtain();
4095 Parcel reply = Parcel.obtain();
4096 data.writeInterfaceToken(IActivityManager.descriptor);
4097 data.writeString(packageName);
4098 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4099 reply.readException();
4100 data.recycle();
4101 reply.recycle();
4102 }
4103
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004104 public void killApplicationWithAppId(String pkg, int appid, String reason)
4105 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004106 Parcel data = Parcel.obtain();
4107 Parcel reply = Parcel.obtain();
4108 data.writeInterfaceToken(IActivityManager.descriptor);
4109 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004110 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004111 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004112 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004113 reply.readException();
4114 data.recycle();
4115 reply.recycle();
4116 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004117
4118 public void closeSystemDialogs(String reason) throws RemoteException {
4119 Parcel data = Parcel.obtain();
4120 Parcel reply = Parcel.obtain();
4121 data.writeInterfaceToken(IActivityManager.descriptor);
4122 data.writeString(reason);
4123 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4124 reply.readException();
4125 data.recycle();
4126 reply.recycle();
4127 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004128
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004129 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004130 throws RemoteException {
4131 Parcel data = Parcel.obtain();
4132 Parcel reply = Parcel.obtain();
4133 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004134 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004135 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4136 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004137 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004138 data.recycle();
4139 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004140 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004141 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004142
4143 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4144 Parcel data = Parcel.obtain();
4145 Parcel reply = Parcel.obtain();
4146 data.writeInterfaceToken(IActivityManager.descriptor);
4147 data.writeString(processName);
4148 data.writeInt(uid);
4149 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4150 reply.readException();
4151 data.recycle();
4152 reply.recycle();
4153 }
4154
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004155 public void overridePendingTransition(IBinder token, String packageName,
4156 int enterAnim, int exitAnim) throws RemoteException {
4157 Parcel data = Parcel.obtain();
4158 Parcel reply = Parcel.obtain();
4159 data.writeInterfaceToken(IActivityManager.descriptor);
4160 data.writeStrongBinder(token);
4161 data.writeString(packageName);
4162 data.writeInt(enterAnim);
4163 data.writeInt(exitAnim);
4164 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4165 reply.readException();
4166 data.recycle();
4167 reply.recycle();
4168 }
4169
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004170 public boolean isUserAMonkey() throws RemoteException {
4171 Parcel data = Parcel.obtain();
4172 Parcel reply = Parcel.obtain();
4173 data.writeInterfaceToken(IActivityManager.descriptor);
4174 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4175 reply.readException();
4176 boolean res = reply.readInt() != 0;
4177 data.recycle();
4178 reply.recycle();
4179 return res;
4180 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004181
4182 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4183 Parcel data = Parcel.obtain();
4184 Parcel reply = Parcel.obtain();
4185 data.writeInterfaceToken(IActivityManager.descriptor);
4186 data.writeInt(monkey ? 1 : 0);
4187 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4188 reply.readException();
4189 data.recycle();
4190 reply.recycle();
4191 }
4192
Dianne Hackborn860755f2010-06-03 18:47:52 -07004193 public void finishHeavyWeightApp() throws RemoteException {
4194 Parcel data = Parcel.obtain();
4195 Parcel reply = Parcel.obtain();
4196 data.writeInterfaceToken(IActivityManager.descriptor);
4197 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4198 reply.readException();
4199 data.recycle();
4200 reply.recycle();
4201 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004202
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004203 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004204 throws RemoteException {
4205 Parcel data = Parcel.obtain();
4206 Parcel reply = Parcel.obtain();
4207 data.writeInterfaceToken(IActivityManager.descriptor);
4208 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004209 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4210 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004211 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004212 data.recycle();
4213 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004214 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004215 }
4216
Craig Mautner233ceee2014-05-09 17:05:11 -07004217 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004218 throws RemoteException {
4219 Parcel data = Parcel.obtain();
4220 Parcel reply = Parcel.obtain();
4221 data.writeInterfaceToken(IActivityManager.descriptor);
4222 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004223 if (options == null) {
4224 data.writeInt(0);
4225 } else {
4226 data.writeInt(1);
4227 data.writeBundle(options.toBundle());
4228 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004229 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004230 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004231 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004232 data.recycle();
4233 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004234 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004235 }
4236
Craig Mautner233ceee2014-05-09 17:05:11 -07004237 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4238 Parcel data = Parcel.obtain();
4239 Parcel reply = Parcel.obtain();
4240 data.writeInterfaceToken(IActivityManager.descriptor);
4241 data.writeStrongBinder(token);
4242 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4243 reply.readException();
4244 Bundle bundle = reply.readBundle();
4245 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4246 data.recycle();
4247 reply.recycle();
4248 return options;
4249 }
4250
Daniel Sandler69a48172010-06-23 16:29:36 -04004251 public void setImmersive(IBinder token, boolean immersive)
4252 throws RemoteException {
4253 Parcel data = Parcel.obtain();
4254 Parcel reply = Parcel.obtain();
4255 data.writeInterfaceToken(IActivityManager.descriptor);
4256 data.writeStrongBinder(token);
4257 data.writeInt(immersive ? 1 : 0);
4258 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4259 reply.readException();
4260 data.recycle();
4261 reply.recycle();
4262 }
4263
4264 public boolean isImmersive(IBinder token)
4265 throws RemoteException {
4266 Parcel data = Parcel.obtain();
4267 Parcel reply = Parcel.obtain();
4268 data.writeInterfaceToken(IActivityManager.descriptor);
4269 data.writeStrongBinder(token);
4270 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004271 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004272 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004273 data.recycle();
4274 reply.recycle();
4275 return res;
4276 }
4277
Craig Mautnerd61dc202014-07-07 11:09:11 -07004278 public boolean isTopOfTask(IBinder token) throws RemoteException {
4279 Parcel data = Parcel.obtain();
4280 Parcel reply = Parcel.obtain();
4281 data.writeInterfaceToken(IActivityManager.descriptor);
4282 data.writeStrongBinder(token);
4283 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4284 reply.readException();
4285 boolean res = reply.readInt() == 1;
4286 data.recycle();
4287 reply.recycle();
4288 return res;
4289 }
4290
Daniel Sandler69a48172010-06-23 16:29:36 -04004291 public boolean isTopActivityImmersive()
4292 throws RemoteException {
4293 Parcel data = Parcel.obtain();
4294 Parcel reply = Parcel.obtain();
4295 data.writeInterfaceToken(IActivityManager.descriptor);
4296 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004297 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004298 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004299 data.recycle();
4300 reply.recycle();
4301 return res;
4302 }
4303
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004304 public void crashApplication(int uid, int initialPid, String packageName,
4305 String message) throws RemoteException {
4306 Parcel data = Parcel.obtain();
4307 Parcel reply = Parcel.obtain();
4308 data.writeInterfaceToken(IActivityManager.descriptor);
4309 data.writeInt(uid);
4310 data.writeInt(initialPid);
4311 data.writeString(packageName);
4312 data.writeString(message);
4313 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4314 reply.readException();
4315 data.recycle();
4316 reply.recycle();
4317 }
Andy McFadden824c5102010-07-09 16:26:57 -07004318
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004319 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004320 Parcel data = Parcel.obtain();
4321 Parcel reply = Parcel.obtain();
4322 data.writeInterfaceToken(IActivityManager.descriptor);
4323 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004324 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004325 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4326 reply.readException();
4327 String res = reply.readString();
4328 data.recycle();
4329 reply.recycle();
4330 return res;
4331 }
4332
Dianne Hackborn7e269642010-08-25 19:50:20 -07004333 public IBinder newUriPermissionOwner(String name)
4334 throws RemoteException {
4335 Parcel data = Parcel.obtain();
4336 Parcel reply = Parcel.obtain();
4337 data.writeInterfaceToken(IActivityManager.descriptor);
4338 data.writeString(name);
4339 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4340 reply.readException();
4341 IBinder res = reply.readStrongBinder();
4342 data.recycle();
4343 reply.recycle();
4344 return res;
4345 }
4346
4347 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004348 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004349 Parcel data = Parcel.obtain();
4350 Parcel reply = Parcel.obtain();
4351 data.writeInterfaceToken(IActivityManager.descriptor);
4352 data.writeStrongBinder(owner);
4353 data.writeInt(fromUid);
4354 data.writeString(targetPkg);
4355 uri.writeToParcel(data, 0);
4356 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004357 data.writeInt(sourceUserId);
4358 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004359 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4360 reply.readException();
4361 data.recycle();
4362 reply.recycle();
4363 }
4364
4365 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004366 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004367 Parcel data = Parcel.obtain();
4368 Parcel reply = Parcel.obtain();
4369 data.writeInterfaceToken(IActivityManager.descriptor);
4370 data.writeStrongBinder(owner);
4371 if (uri != null) {
4372 data.writeInt(1);
4373 uri.writeToParcel(data, 0);
4374 } else {
4375 data.writeInt(0);
4376 }
4377 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004378 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004379 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4380 reply.readException();
4381 data.recycle();
4382 reply.recycle();
4383 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004384
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004385 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004386 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004387 Parcel data = Parcel.obtain();
4388 Parcel reply = Parcel.obtain();
4389 data.writeInterfaceToken(IActivityManager.descriptor);
4390 data.writeInt(callingUid);
4391 data.writeString(targetPkg);
4392 uri.writeToParcel(data, 0);
4393 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004394 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004395 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4396 reply.readException();
4397 int res = reply.readInt();
4398 data.recycle();
4399 reply.recycle();
4400 return res;
4401 }
4402
Dianne Hackborn1676c852012-09-10 14:52:30 -07004403 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004404 String path, ParcelFileDescriptor fd) throws RemoteException {
4405 Parcel data = Parcel.obtain();
4406 Parcel reply = Parcel.obtain();
4407 data.writeInterfaceToken(IActivityManager.descriptor);
4408 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004409 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004410 data.writeInt(managed ? 1 : 0);
4411 data.writeString(path);
4412 if (fd != null) {
4413 data.writeInt(1);
4414 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4415 } else {
4416 data.writeInt(0);
4417 }
4418 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4419 reply.readException();
4420 boolean res = reply.readInt() != 0;
4421 reply.recycle();
4422 data.recycle();
4423 return res;
4424 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004425
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004426 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004427 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004428 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004429 Parcel data = Parcel.obtain();
4430 Parcel reply = Parcel.obtain();
4431 data.writeInterfaceToken(IActivityManager.descriptor);
4432 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004433 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004434 data.writeTypedArray(intents, 0);
4435 data.writeStringArray(resolvedTypes);
4436 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004437 if (options != null) {
4438 data.writeInt(1);
4439 options.writeToParcel(data, 0);
4440 } else {
4441 data.writeInt(0);
4442 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004443 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004444 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4445 reply.readException();
4446 int result = reply.readInt();
4447 reply.recycle();
4448 data.recycle();
4449 return result;
4450 }
4451
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004452 public int getFrontActivityScreenCompatMode() throws RemoteException {
4453 Parcel data = Parcel.obtain();
4454 Parcel reply = Parcel.obtain();
4455 data.writeInterfaceToken(IActivityManager.descriptor);
4456 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4457 reply.readException();
4458 int mode = reply.readInt();
4459 reply.recycle();
4460 data.recycle();
4461 return mode;
4462 }
4463
4464 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4465 Parcel data = Parcel.obtain();
4466 Parcel reply = Parcel.obtain();
4467 data.writeInterfaceToken(IActivityManager.descriptor);
4468 data.writeInt(mode);
4469 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4470 reply.readException();
4471 reply.recycle();
4472 data.recycle();
4473 }
4474
4475 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4476 Parcel data = Parcel.obtain();
4477 Parcel reply = Parcel.obtain();
4478 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004479 data.writeString(packageName);
4480 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004481 reply.readException();
4482 int mode = reply.readInt();
4483 reply.recycle();
4484 data.recycle();
4485 return mode;
4486 }
4487
4488 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004489 throws RemoteException {
4490 Parcel data = Parcel.obtain();
4491 Parcel reply = Parcel.obtain();
4492 data.writeInterfaceToken(IActivityManager.descriptor);
4493 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004494 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004495 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4496 reply.readException();
4497 reply.recycle();
4498 data.recycle();
4499 }
4500
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004501 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4502 Parcel data = Parcel.obtain();
4503 Parcel reply = Parcel.obtain();
4504 data.writeInterfaceToken(IActivityManager.descriptor);
4505 data.writeString(packageName);
4506 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4507 reply.readException();
4508 boolean ask = reply.readInt() != 0;
4509 reply.recycle();
4510 data.recycle();
4511 return ask;
4512 }
4513
4514 public void setPackageAskScreenCompat(String packageName, boolean ask)
4515 throws RemoteException {
4516 Parcel data = Parcel.obtain();
4517 Parcel reply = Parcel.obtain();
4518 data.writeInterfaceToken(IActivityManager.descriptor);
4519 data.writeString(packageName);
4520 data.writeInt(ask ? 1 : 0);
4521 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4522 reply.readException();
4523 reply.recycle();
4524 data.recycle();
4525 }
4526
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004527 public boolean switchUser(int userid) throws RemoteException {
4528 Parcel data = Parcel.obtain();
4529 Parcel reply = Parcel.obtain();
4530 data.writeInterfaceToken(IActivityManager.descriptor);
4531 data.writeInt(userid);
4532 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4533 reply.readException();
4534 boolean result = reply.readInt() != 0;
4535 reply.recycle();
4536 data.recycle();
4537 return result;
4538 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004539
Kenny Guy08488bf2014-02-21 17:40:37 +00004540 public boolean startUserInBackground(int userid) throws RemoteException {
4541 Parcel data = Parcel.obtain();
4542 Parcel reply = Parcel.obtain();
4543 data.writeInterfaceToken(IActivityManager.descriptor);
4544 data.writeInt(userid);
4545 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4546 reply.readException();
4547 boolean result = reply.readInt() != 0;
4548 reply.recycle();
4549 data.recycle();
4550 return result;
4551 }
4552
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004553 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4554 Parcel data = Parcel.obtain();
4555 Parcel reply = Parcel.obtain();
4556 data.writeInterfaceToken(IActivityManager.descriptor);
4557 data.writeInt(userid);
4558 data.writeStrongInterface(callback);
4559 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4560 reply.readException();
4561 int result = reply.readInt();
4562 reply.recycle();
4563 data.recycle();
4564 return result;
4565 }
4566
Amith Yamasani52f1d752012-03-28 18:19:29 -07004567 public UserInfo getCurrentUser() throws RemoteException {
4568 Parcel data = Parcel.obtain();
4569 Parcel reply = Parcel.obtain();
4570 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004571 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004572 reply.readException();
4573 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4574 reply.recycle();
4575 data.recycle();
4576 return userInfo;
4577 }
4578
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004579 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004580 Parcel data = Parcel.obtain();
4581 Parcel reply = Parcel.obtain();
4582 data.writeInterfaceToken(IActivityManager.descriptor);
4583 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004584 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004585 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4586 reply.readException();
4587 boolean result = reply.readInt() != 0;
4588 reply.recycle();
4589 data.recycle();
4590 return result;
4591 }
4592
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004593 public int[] getRunningUserIds() throws RemoteException {
4594 Parcel data = Parcel.obtain();
4595 Parcel reply = Parcel.obtain();
4596 data.writeInterfaceToken(IActivityManager.descriptor);
4597 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4598 reply.readException();
4599 int[] result = reply.createIntArray();
4600 reply.recycle();
4601 data.recycle();
4602 return result;
4603 }
4604
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004605 public boolean removeTask(int taskId, int flags) throws RemoteException {
4606 Parcel data = Parcel.obtain();
4607 Parcel reply = Parcel.obtain();
4608 data.writeInterfaceToken(IActivityManager.descriptor);
4609 data.writeInt(taskId);
4610 data.writeInt(flags);
4611 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4612 reply.readException();
4613 boolean result = reply.readInt() != 0;
4614 reply.recycle();
4615 data.recycle();
4616 return result;
4617 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004618
Jeff Sharkeya4620792011-05-20 15:29:23 -07004619 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4620 Parcel data = Parcel.obtain();
4621 Parcel reply = Parcel.obtain();
4622 data.writeInterfaceToken(IActivityManager.descriptor);
4623 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4624 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4625 reply.readException();
4626 data.recycle();
4627 reply.recycle();
4628 }
4629
4630 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4631 Parcel data = Parcel.obtain();
4632 Parcel reply = Parcel.obtain();
4633 data.writeInterfaceToken(IActivityManager.descriptor);
4634 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4635 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4636 reply.readException();
4637 data.recycle();
4638 reply.recycle();
4639 }
4640
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004641 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4642 Parcel data = Parcel.obtain();
4643 Parcel reply = Parcel.obtain();
4644 data.writeInterfaceToken(IActivityManager.descriptor);
4645 data.writeStrongBinder(sender.asBinder());
4646 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4647 reply.readException();
4648 boolean res = reply.readInt() != 0;
4649 data.recycle();
4650 reply.recycle();
4651 return res;
4652 }
4653
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004654 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4655 Parcel data = Parcel.obtain();
4656 Parcel reply = Parcel.obtain();
4657 data.writeInterfaceToken(IActivityManager.descriptor);
4658 data.writeStrongBinder(sender.asBinder());
4659 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4660 reply.readException();
4661 boolean res = reply.readInt() != 0;
4662 data.recycle();
4663 reply.recycle();
4664 return res;
4665 }
4666
Dianne Hackborn81038902012-11-26 17:04:09 -08004667 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4668 Parcel data = Parcel.obtain();
4669 Parcel reply = Parcel.obtain();
4670 data.writeInterfaceToken(IActivityManager.descriptor);
4671 data.writeStrongBinder(sender.asBinder());
4672 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4673 reply.readException();
4674 Intent res = reply.readInt() != 0
4675 ? Intent.CREATOR.createFromParcel(reply) : null;
4676 data.recycle();
4677 reply.recycle();
4678 return res;
4679 }
4680
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004681 public String getTagForIntentSender(IIntentSender sender, String prefix)
4682 throws RemoteException {
4683 Parcel data = Parcel.obtain();
4684 Parcel reply = Parcel.obtain();
4685 data.writeInterfaceToken(IActivityManager.descriptor);
4686 data.writeStrongBinder(sender.asBinder());
4687 data.writeString(prefix);
4688 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4689 reply.readException();
4690 String res = reply.readString();
4691 data.recycle();
4692 reply.recycle();
4693 return res;
4694 }
4695
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004696 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4697 {
4698 Parcel data = Parcel.obtain();
4699 Parcel reply = Parcel.obtain();
4700 data.writeInterfaceToken(IActivityManager.descriptor);
4701 values.writeToParcel(data, 0);
4702 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4703 reply.readException();
4704 data.recycle();
4705 reply.recycle();
4706 }
4707
Dianne Hackbornb437e092011-08-05 17:50:29 -07004708 public long[] getProcessPss(int[] pids) throws RemoteException {
4709 Parcel data = Parcel.obtain();
4710 Parcel reply = Parcel.obtain();
4711 data.writeInterfaceToken(IActivityManager.descriptor);
4712 data.writeIntArray(pids);
4713 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4714 reply.readException();
4715 long[] res = reply.createLongArray();
4716 data.recycle();
4717 reply.recycle();
4718 return res;
4719 }
4720
Dianne Hackborn661cd522011-08-22 00:26:20 -07004721 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4722 Parcel data = Parcel.obtain();
4723 Parcel reply = Parcel.obtain();
4724 data.writeInterfaceToken(IActivityManager.descriptor);
4725 TextUtils.writeToParcel(msg, data, 0);
4726 data.writeInt(always ? 1 : 0);
4727 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4728 reply.readException();
4729 data.recycle();
4730 reply.recycle();
4731 }
4732
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004733 public void dismissKeyguardOnNextActivity() throws RemoteException {
4734 Parcel data = Parcel.obtain();
4735 Parcel reply = Parcel.obtain();
4736 data.writeInterfaceToken(IActivityManager.descriptor);
4737 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4738 reply.readException();
4739 data.recycle();
4740 reply.recycle();
4741 }
4742
Adam Powelldd8fab22012-03-22 17:47:27 -07004743 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4744 throws RemoteException {
4745 Parcel data = Parcel.obtain();
4746 Parcel reply = Parcel.obtain();
4747 data.writeInterfaceToken(IActivityManager.descriptor);
4748 data.writeStrongBinder(token);
4749 data.writeString(destAffinity);
4750 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4751 reply.readException();
4752 boolean result = reply.readInt() != 0;
4753 data.recycle();
4754 reply.recycle();
4755 return result;
4756 }
4757
4758 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4759 throws RemoteException {
4760 Parcel data = Parcel.obtain();
4761 Parcel reply = Parcel.obtain();
4762 data.writeInterfaceToken(IActivityManager.descriptor);
4763 data.writeStrongBinder(token);
4764 target.writeToParcel(data, 0);
4765 data.writeInt(resultCode);
4766 if (resultData != null) {
4767 data.writeInt(1);
4768 resultData.writeToParcel(data, 0);
4769 } else {
4770 data.writeInt(0);
4771 }
4772 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4773 reply.readException();
4774 boolean result = reply.readInt() != 0;
4775 data.recycle();
4776 reply.recycle();
4777 return result;
4778 }
4779
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004780 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4781 Parcel data = Parcel.obtain();
4782 Parcel reply = Parcel.obtain();
4783 data.writeInterfaceToken(IActivityManager.descriptor);
4784 data.writeStrongBinder(activityToken);
4785 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4786 reply.readException();
4787 int result = reply.readInt();
4788 data.recycle();
4789 reply.recycle();
4790 return result;
4791 }
4792
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004793 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4794 Parcel data = Parcel.obtain();
4795 Parcel reply = Parcel.obtain();
4796 data.writeInterfaceToken(IActivityManager.descriptor);
4797 data.writeStrongBinder(activityToken);
4798 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4799 reply.readException();
4800 String result = reply.readString();
4801 data.recycle();
4802 reply.recycle();
4803 return result;
4804 }
4805
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004806 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4807 Parcel data = Parcel.obtain();
4808 Parcel reply = Parcel.obtain();
4809 data.writeInterfaceToken(IActivityManager.descriptor);
4810 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4811 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4812 reply.readException();
4813 data.recycle();
4814 reply.recycle();
4815 }
4816
4817 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4818 Parcel data = Parcel.obtain();
4819 Parcel reply = Parcel.obtain();
4820 data.writeInterfaceToken(IActivityManager.descriptor);
4821 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4822 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4823 reply.readException();
4824 data.recycle();
4825 reply.recycle();
4826 }
4827
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004828 public void requestBugReport() throws RemoteException {
4829 Parcel data = Parcel.obtain();
4830 Parcel reply = Parcel.obtain();
4831 data.writeInterfaceToken(IActivityManager.descriptor);
4832 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4833 reply.readException();
4834 data.recycle();
4835 reply.recycle();
4836 }
4837
Jeff Brownbd181bb2013-09-10 16:44:24 -07004838 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4839 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004840 Parcel data = Parcel.obtain();
4841 Parcel reply = Parcel.obtain();
4842 data.writeInterfaceToken(IActivityManager.descriptor);
4843 data.writeInt(pid);
4844 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004845 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004846 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4847 reply.readException();
4848 long res = reply.readInt();
4849 data.recycle();
4850 reply.recycle();
4851 return res;
4852 }
4853
Adam Skorydfc7fd72013-08-05 19:23:41 -07004854 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004855 Parcel data = Parcel.obtain();
4856 Parcel reply = Parcel.obtain();
4857 data.writeInterfaceToken(IActivityManager.descriptor);
4858 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004859 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004860 reply.readException();
4861 Bundle res = reply.readBundle();
4862 data.recycle();
4863 reply.recycle();
4864 return res;
4865 }
4866
Adam Skory7140a252013-09-11 12:04:58 +01004867 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004868 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004869 Parcel data = Parcel.obtain();
4870 Parcel reply = Parcel.obtain();
4871 data.writeInterfaceToken(IActivityManager.descriptor);
4872 data.writeStrongBinder(token);
4873 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004874 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004875 reply.readException();
4876 data.recycle();
4877 reply.recycle();
4878 }
4879
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004880 public void killUid(int uid, String reason) throws RemoteException {
4881 Parcel data = Parcel.obtain();
4882 Parcel reply = Parcel.obtain();
4883 data.writeInterfaceToken(IActivityManager.descriptor);
4884 data.writeInt(uid);
4885 data.writeString(reason);
4886 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4887 reply.readException();
4888 data.recycle();
4889 reply.recycle();
4890 }
4891
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004892 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4893 Parcel data = Parcel.obtain();
4894 Parcel reply = Parcel.obtain();
4895 data.writeInterfaceToken(IActivityManager.descriptor);
4896 data.writeStrongBinder(who);
4897 data.writeInt(allowRestart ? 1 : 0);
4898 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4899 reply.readException();
4900 data.recycle();
4901 reply.recycle();
4902 }
4903
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004904 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4905 Parcel data = Parcel.obtain();
4906 Parcel reply = Parcel.obtain();
4907 data.writeInterfaceToken(IActivityManager.descriptor);
4908 data.writeStrongBinder(token);
4909 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4910 reply.readException();
4911 data.recycle();
4912 reply.recycle();
4913 }
4914
Craig Mautner5eda9b32013-07-02 11:58:16 -07004915 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4916 Parcel data = Parcel.obtain();
4917 Parcel reply = Parcel.obtain();
4918 data.writeInterfaceToken(IActivityManager.descriptor);
4919 data.writeStrongBinder(token);
4920 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4921 reply.readException();
4922 data.recycle();
4923 reply.recycle();
4924 }
4925
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004926 public void restart() throws RemoteException {
4927 Parcel data = Parcel.obtain();
4928 Parcel reply = Parcel.obtain();
4929 data.writeInterfaceToken(IActivityManager.descriptor);
4930 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4931 reply.readException();
4932 data.recycle();
4933 reply.recycle();
4934 }
4935
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004936 public void performIdleMaintenance() throws RemoteException {
4937 Parcel data = Parcel.obtain();
4938 Parcel reply = Parcel.obtain();
4939 data.writeInterfaceToken(IActivityManager.descriptor);
4940 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4941 reply.readException();
4942 data.recycle();
4943 reply.recycle();
4944 }
4945
Craig Mautner4a1cb222013-12-04 16:14:06 -08004946 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4947 IActivityContainerCallback callback) throws RemoteException {
4948 Parcel data = Parcel.obtain();
4949 Parcel reply = Parcel.obtain();
4950 data.writeInterfaceToken(IActivityManager.descriptor);
4951 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07004952 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08004953 mRemote.transact(CREATE_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 Mautner4a1cb222013-12-04 16:14:06 -08004962 data.recycle();
4963 reply.recycle();
4964 return res;
4965 }
4966
Craig Mautner95da1082014-02-24 17:54:35 -08004967 public void deleteActivityContainer(IActivityContainer activityContainer)
4968 throws RemoteException {
4969 Parcel data = Parcel.obtain();
4970 Parcel reply = Parcel.obtain();
4971 data.writeInterfaceToken(IActivityManager.descriptor);
4972 data.writeStrongBinder(activityContainer.asBinder());
4973 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4974 reply.readException();
4975 data.recycle();
4976 reply.recycle();
4977 }
4978
Craig Mautnere0a38842013-12-16 16:14:02 -08004979 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4980 throws RemoteException {
4981 Parcel data = Parcel.obtain();
4982 Parcel reply = Parcel.obtain();
4983 data.writeInterfaceToken(IActivityManager.descriptor);
4984 data.writeStrongBinder(activityToken);
4985 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4986 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004987 final int result = reply.readInt();
4988 final IActivityContainer res;
4989 if (result == 1) {
4990 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4991 } else {
4992 res = null;
4993 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004994 data.recycle();
4995 reply.recycle();
4996 return res;
4997 }
4998
Craig Mautner4a1cb222013-12-04 16:14:06 -08004999 public IBinder getHomeActivityToken() throws RemoteException {
5000 Parcel data = Parcel.obtain();
5001 Parcel reply = Parcel.obtain();
5002 data.writeInterfaceToken(IActivityManager.descriptor);
5003 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5004 reply.readException();
5005 IBinder res = reply.readStrongBinder();
5006 data.recycle();
5007 reply.recycle();
5008 return res;
5009 }
5010
Craig Mautneraea74a52014-03-08 14:23:10 -08005011 @Override
5012 public void startLockTaskMode(int taskId) throws RemoteException {
5013 Parcel data = Parcel.obtain();
5014 Parcel reply = Parcel.obtain();
5015 data.writeInterfaceToken(IActivityManager.descriptor);
5016 data.writeInt(taskId);
5017 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5018 reply.readException();
5019 data.recycle();
5020 reply.recycle();
5021 }
5022
5023 @Override
5024 public void startLockTaskMode(IBinder token) throws RemoteException {
5025 Parcel data = Parcel.obtain();
5026 Parcel reply = Parcel.obtain();
5027 data.writeInterfaceToken(IActivityManager.descriptor);
5028 data.writeStrongBinder(token);
5029 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5030 reply.readException();
5031 data.recycle();
5032 reply.recycle();
5033 }
5034
5035 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005036 public void startLockTaskModeOnCurrent() throws RemoteException {
5037 Parcel data = Parcel.obtain();
5038 Parcel reply = Parcel.obtain();
5039 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005040 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005041 reply.readException();
5042 data.recycle();
5043 reply.recycle();
5044 }
5045
5046 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005047 public void stopLockTaskMode() throws RemoteException {
5048 Parcel data = Parcel.obtain();
5049 Parcel reply = Parcel.obtain();
5050 data.writeInterfaceToken(IActivityManager.descriptor);
5051 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5052 reply.readException();
5053 data.recycle();
5054 reply.recycle();
5055 }
5056
5057 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005058 public void stopLockTaskModeOnCurrent() throws RemoteException {
5059 Parcel data = Parcel.obtain();
5060 Parcel reply = Parcel.obtain();
5061 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005062 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005063 reply.readException();
5064 data.recycle();
5065 reply.recycle();
5066 }
5067
5068 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005069 public boolean isInLockTaskMode() throws RemoteException {
5070 Parcel data = Parcel.obtain();
5071 Parcel reply = Parcel.obtain();
5072 data.writeInterfaceToken(IActivityManager.descriptor);
5073 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5074 reply.readException();
5075 boolean isInLockTaskMode = reply.readInt() == 1;
5076 data.recycle();
5077 reply.recycle();
5078 return isInLockTaskMode;
5079 }
5080
Craig Mautner688b5102014-03-27 16:55:03 -07005081 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005082 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005083 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005084 Parcel data = Parcel.obtain();
5085 Parcel reply = Parcel.obtain();
5086 data.writeInterfaceToken(IActivityManager.descriptor);
5087 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005088 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005089 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005090 reply.readException();
5091 data.recycle();
5092 reply.recycle();
5093 }
5094
Craig Mautneree2e45a2014-06-27 12:10:03 -07005095 @Override
5096 public boolean setMediaPlaying(IBinder token, boolean playing) throws RemoteException {
5097 Parcel data = Parcel.obtain();
5098 Parcel reply = Parcel.obtain();
5099 data.writeInterfaceToken(IActivityManager.descriptor);
5100 data.writeStrongBinder(token);
5101 data.writeInt(playing ? 1 : 0);
5102 mRemote.transact(SET_MEDIA_PLAYING_TRANSACTION, data, reply, 0);
5103 reply.readException();
5104 boolean success = reply.readInt() > 0;
5105 data.recycle();
5106 reply.recycle();
5107 return success;
5108 }
5109
5110 @Override
5111 public boolean isBackgroundMediaPlaying(IBinder token) throws RemoteException {
5112 Parcel data = Parcel.obtain();
5113 Parcel reply = Parcel.obtain();
5114 data.writeInterfaceToken(IActivityManager.descriptor);
5115 data.writeStrongBinder(token);
5116 mRemote.transact(IS_BG_MEDIA_PLAYING_TRANSACTION, data, reply, 0);
5117 reply.readException();
5118 final boolean playing = reply.readInt() > 0;
5119 data.recycle();
5120 reply.recycle();
5121 return playing;
5122 }
5123
5124 @Override
5125 public void mediaResourcesReleased(IBinder token) throws RemoteException {
5126 Parcel data = Parcel.obtain();
5127 Parcel reply = Parcel.obtain();
5128 data.writeInterfaceToken(IActivityManager.descriptor);
5129 data.writeStrongBinder(token);
Craig Mautnerbb742462014-07-07 15:28:55 -07005130 mRemote.transact(MEDIA_RESOURCES_RELEASED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5131 reply.readException();
5132 data.recycle();
5133 reply.recycle();
5134 }
5135
5136 @Override
5137 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5138 Parcel data = Parcel.obtain();
5139 Parcel reply = Parcel.obtain();
5140 data.writeInterfaceToken(IActivityManager.descriptor);
5141 data.writeStrongBinder(token);
5142 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5143 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005144 reply.readException();
5145 data.recycle();
5146 reply.recycle();
5147 }
5148
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005149 private IBinder mRemote;
5150}