blob: 311a8f55769d098ae6d417713634cf49dfc1312e [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 }
Craig Mautner8746a472014-07-24 15:12:54 -07002234
2235 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2236 data.enforceInterface(IActivityManager.descriptor);
2237 IBinder token = data.readStrongBinder();
2238 notifyEnterAnimationComplete(token);
2239 reply.writeNoException();
2240 return true;
2241 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002242 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002243
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002244 return super.onTransact(code, data, reply, flags);
2245 }
2246
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002247 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002248 return this;
2249 }
2250
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002251 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2252 protected IActivityManager create() {
2253 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002254 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002255 Log.v("ActivityManager", "default service binder = " + b);
2256 }
2257 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002258 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002259 Log.v("ActivityManager", "default service = " + am);
2260 }
2261 return am;
2262 }
2263 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002264}
2265
2266class ActivityManagerProxy implements IActivityManager
2267{
2268 public ActivityManagerProxy(IBinder remote)
2269 {
2270 mRemote = remote;
2271 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002272
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002273 public IBinder asBinder()
2274 {
2275 return mRemote;
2276 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002277
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002278 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002279 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2280 int startFlags, String profileFile,
2281 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002282 Parcel data = Parcel.obtain();
2283 Parcel reply = Parcel.obtain();
2284 data.writeInterfaceToken(IActivityManager.descriptor);
2285 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002286 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002287 intent.writeToParcel(data, 0);
2288 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002289 data.writeStrongBinder(resultTo);
2290 data.writeString(resultWho);
2291 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002292 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002293 data.writeString(profileFile);
2294 if (profileFd != null) {
2295 data.writeInt(1);
2296 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2297 } else {
2298 data.writeInt(0);
2299 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002300 if (options != null) {
2301 data.writeInt(1);
2302 options.writeToParcel(data, 0);
2303 } else {
2304 data.writeInt(0);
2305 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002306 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2307 reply.readException();
2308 int result = reply.readInt();
2309 reply.recycle();
2310 data.recycle();
2311 return result;
2312 }
Amith Yamasani82644082012-08-03 13:09:11 -07002313
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002314 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002315 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2316 int startFlags, String profileFile,
2317 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2318 Parcel data = Parcel.obtain();
2319 Parcel reply = Parcel.obtain();
2320 data.writeInterfaceToken(IActivityManager.descriptor);
2321 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002322 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002323 intent.writeToParcel(data, 0);
2324 data.writeString(resolvedType);
2325 data.writeStrongBinder(resultTo);
2326 data.writeString(resultWho);
2327 data.writeInt(requestCode);
2328 data.writeInt(startFlags);
2329 data.writeString(profileFile);
2330 if (profileFd != null) {
2331 data.writeInt(1);
2332 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2333 } else {
2334 data.writeInt(0);
2335 }
2336 if (options != null) {
2337 data.writeInt(1);
2338 options.writeToParcel(data, 0);
2339 } else {
2340 data.writeInt(0);
2341 }
2342 data.writeInt(userId);
2343 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2344 reply.readException();
2345 int result = reply.readInt();
2346 reply.recycle();
2347 data.recycle();
2348 return result;
2349 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002350 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2351 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002352 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002353 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002354 Parcel data = Parcel.obtain();
2355 Parcel reply = Parcel.obtain();
2356 data.writeInterfaceToken(IActivityManager.descriptor);
2357 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002358 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002359 intent.writeToParcel(data, 0);
2360 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002361 data.writeStrongBinder(resultTo);
2362 data.writeString(resultWho);
2363 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002364 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002365 data.writeString(profileFile);
2366 if (profileFd != null) {
2367 data.writeInt(1);
2368 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2369 } else {
2370 data.writeInt(0);
2371 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002372 if (options != null) {
2373 data.writeInt(1);
2374 options.writeToParcel(data, 0);
2375 } else {
2376 data.writeInt(0);
2377 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002378 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002379 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2380 reply.readException();
2381 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2382 reply.recycle();
2383 data.recycle();
2384 return result;
2385 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002386 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2387 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002388 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002389 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002390 Parcel data = Parcel.obtain();
2391 Parcel reply = Parcel.obtain();
2392 data.writeInterfaceToken(IActivityManager.descriptor);
2393 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002394 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002395 intent.writeToParcel(data, 0);
2396 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002397 data.writeStrongBinder(resultTo);
2398 data.writeString(resultWho);
2399 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002400 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002401 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002402 if (options != null) {
2403 data.writeInt(1);
2404 options.writeToParcel(data, 0);
2405 } else {
2406 data.writeInt(0);
2407 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002408 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002409 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2410 reply.readException();
2411 int result = reply.readInt();
2412 reply.recycle();
2413 data.recycle();
2414 return result;
2415 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002416 public int startActivityIntentSender(IApplicationThread caller,
2417 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002418 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002419 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002420 Parcel data = Parcel.obtain();
2421 Parcel reply = Parcel.obtain();
2422 data.writeInterfaceToken(IActivityManager.descriptor);
2423 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2424 intent.writeToParcel(data, 0);
2425 if (fillInIntent != null) {
2426 data.writeInt(1);
2427 fillInIntent.writeToParcel(data, 0);
2428 } else {
2429 data.writeInt(0);
2430 }
2431 data.writeString(resolvedType);
2432 data.writeStrongBinder(resultTo);
2433 data.writeString(resultWho);
2434 data.writeInt(requestCode);
2435 data.writeInt(flagsMask);
2436 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002437 if (options != null) {
2438 data.writeInt(1);
2439 options.writeToParcel(data, 0);
2440 } else {
2441 data.writeInt(0);
2442 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002443 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002444 reply.readException();
2445 int result = reply.readInt();
2446 reply.recycle();
2447 data.recycle();
2448 return result;
2449 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002450 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2451 Intent intent, String resolvedType, IVoiceInteractionSession session,
2452 IVoiceInteractor interactor, int startFlags, String profileFile,
2453 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2454 Parcel data = Parcel.obtain();
2455 Parcel reply = Parcel.obtain();
2456 data.writeInterfaceToken(IActivityManager.descriptor);
2457 data.writeString(callingPackage);
2458 data.writeInt(callingPid);
2459 data.writeInt(callingUid);
2460 intent.writeToParcel(data, 0);
2461 data.writeString(resolvedType);
2462 data.writeStrongBinder(session.asBinder());
2463 data.writeStrongBinder(interactor.asBinder());
2464 data.writeInt(startFlags);
2465 data.writeString(profileFile);
2466 if (profileFd != null) {
2467 data.writeInt(1);
2468 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2469 } else {
2470 data.writeInt(0);
2471 }
2472 if (options != null) {
2473 data.writeInt(1);
2474 options.writeToParcel(data, 0);
2475 } else {
2476 data.writeInt(0);
2477 }
2478 data.writeInt(userId);
2479 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2480 reply.readException();
2481 int result = reply.readInt();
2482 reply.recycle();
2483 data.recycle();
2484 return result;
2485 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002486 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002487 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002488 Parcel data = Parcel.obtain();
2489 Parcel reply = Parcel.obtain();
2490 data.writeInterfaceToken(IActivityManager.descriptor);
2491 data.writeStrongBinder(callingActivity);
2492 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002493 if (options != null) {
2494 data.writeInt(1);
2495 options.writeToParcel(data, 0);
2496 } else {
2497 data.writeInt(0);
2498 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002499 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2500 reply.readException();
2501 int result = reply.readInt();
2502 reply.recycle();
2503 data.recycle();
2504 return result != 0;
2505 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002506 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2507 Parcel data = Parcel.obtain();
2508 Parcel reply = Parcel.obtain();
2509 data.writeInterfaceToken(IActivityManager.descriptor);
2510 data.writeInt(taskId);
2511 if (options == null) {
2512 data.writeInt(0);
2513 } else {
2514 data.writeInt(1);
2515 options.writeToParcel(data, 0);
2516 }
2517 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2518 reply.readException();
2519 int result = reply.readInt();
2520 reply.recycle();
2521 data.recycle();
2522 return result;
2523 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002524 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002525 throws RemoteException {
2526 Parcel data = Parcel.obtain();
2527 Parcel reply = Parcel.obtain();
2528 data.writeInterfaceToken(IActivityManager.descriptor);
2529 data.writeStrongBinder(token);
2530 data.writeInt(resultCode);
2531 if (resultData != null) {
2532 data.writeInt(1);
2533 resultData.writeToParcel(data, 0);
2534 } else {
2535 data.writeInt(0);
2536 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002537 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002538 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2539 reply.readException();
2540 boolean res = reply.readInt() != 0;
2541 data.recycle();
2542 reply.recycle();
2543 return res;
2544 }
2545 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2546 {
2547 Parcel data = Parcel.obtain();
2548 Parcel reply = Parcel.obtain();
2549 data.writeInterfaceToken(IActivityManager.descriptor);
2550 data.writeStrongBinder(token);
2551 data.writeString(resultWho);
2552 data.writeInt(requestCode);
2553 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2554 reply.readException();
2555 data.recycle();
2556 reply.recycle();
2557 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002558 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2559 Parcel data = Parcel.obtain();
2560 Parcel reply = Parcel.obtain();
2561 data.writeInterfaceToken(IActivityManager.descriptor);
2562 data.writeStrongBinder(token);
2563 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2564 reply.readException();
2565 boolean res = reply.readInt() != 0;
2566 data.recycle();
2567 reply.recycle();
2568 return res;
2569 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002570 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2571 Parcel data = Parcel.obtain();
2572 Parcel reply = Parcel.obtain();
2573 data.writeInterfaceToken(IActivityManager.descriptor);
2574 data.writeStrongBinder(session.asBinder());
2575 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2576 reply.readException();
2577 data.recycle();
2578 reply.recycle();
2579 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002580 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2581 Parcel data = Parcel.obtain();
2582 Parcel reply = Parcel.obtain();
2583 data.writeInterfaceToken(IActivityManager.descriptor);
2584 data.writeStrongBinder(token);
2585 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2586 reply.readException();
2587 boolean res = reply.readInt() != 0;
2588 data.recycle();
2589 reply.recycle();
2590 return res;
2591 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002592 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002593 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002594 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002595 {
2596 Parcel data = Parcel.obtain();
2597 Parcel reply = Parcel.obtain();
2598 data.writeInterfaceToken(IActivityManager.descriptor);
2599 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002600 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002601 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2602 filter.writeToParcel(data, 0);
2603 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002604 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002605 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2606 reply.readException();
2607 Intent intent = null;
2608 int haveIntent = reply.readInt();
2609 if (haveIntent != 0) {
2610 intent = Intent.CREATOR.createFromParcel(reply);
2611 }
2612 reply.recycle();
2613 data.recycle();
2614 return intent;
2615 }
2616 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2617 {
2618 Parcel data = Parcel.obtain();
2619 Parcel reply = Parcel.obtain();
2620 data.writeInterfaceToken(IActivityManager.descriptor);
2621 data.writeStrongBinder(receiver.asBinder());
2622 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2623 reply.readException();
2624 data.recycle();
2625 reply.recycle();
2626 }
2627 public int broadcastIntent(IApplicationThread caller,
2628 Intent intent, String resolvedType, IIntentReceiver resultTo,
2629 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002630 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002631 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002632 {
2633 Parcel data = Parcel.obtain();
2634 Parcel reply = Parcel.obtain();
2635 data.writeInterfaceToken(IActivityManager.descriptor);
2636 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2637 intent.writeToParcel(data, 0);
2638 data.writeString(resolvedType);
2639 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2640 data.writeInt(resultCode);
2641 data.writeString(resultData);
2642 data.writeBundle(map);
2643 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002644 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002645 data.writeInt(serialized ? 1 : 0);
2646 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002647 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002648 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2649 reply.readException();
2650 int res = reply.readInt();
2651 reply.recycle();
2652 data.recycle();
2653 return res;
2654 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002655 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2656 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002657 {
2658 Parcel data = Parcel.obtain();
2659 Parcel reply = Parcel.obtain();
2660 data.writeInterfaceToken(IActivityManager.descriptor);
2661 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2662 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002663 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002664 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2665 reply.readException();
2666 data.recycle();
2667 reply.recycle();
2668 }
2669 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2670 {
2671 Parcel data = Parcel.obtain();
2672 Parcel reply = Parcel.obtain();
2673 data.writeInterfaceToken(IActivityManager.descriptor);
2674 data.writeStrongBinder(who);
2675 data.writeInt(resultCode);
2676 data.writeString(resultData);
2677 data.writeBundle(map);
2678 data.writeInt(abortBroadcast ? 1 : 0);
2679 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2680 reply.readException();
2681 data.recycle();
2682 reply.recycle();
2683 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002684 public void attachApplication(IApplicationThread app) throws RemoteException
2685 {
2686 Parcel data = Parcel.obtain();
2687 Parcel reply = Parcel.obtain();
2688 data.writeInterfaceToken(IActivityManager.descriptor);
2689 data.writeStrongBinder(app.asBinder());
2690 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2691 reply.readException();
2692 data.recycle();
2693 reply.recycle();
2694 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002695 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2696 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002697 {
2698 Parcel data = Parcel.obtain();
2699 Parcel reply = Parcel.obtain();
2700 data.writeInterfaceToken(IActivityManager.descriptor);
2701 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002702 if (config != null) {
2703 data.writeInt(1);
2704 config.writeToParcel(data, 0);
2705 } else {
2706 data.writeInt(0);
2707 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002708 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002709 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2710 reply.readException();
2711 data.recycle();
2712 reply.recycle();
2713 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002714 public void activityResumed(IBinder token) throws RemoteException
2715 {
2716 Parcel data = Parcel.obtain();
2717 Parcel reply = Parcel.obtain();
2718 data.writeInterfaceToken(IActivityManager.descriptor);
2719 data.writeStrongBinder(token);
2720 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2721 reply.readException();
2722 data.recycle();
2723 reply.recycle();
2724 }
Craig Mautnera0026042014-04-23 11:45:37 -07002725 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002726 {
2727 Parcel data = Parcel.obtain();
2728 Parcel reply = Parcel.obtain();
2729 data.writeInterfaceToken(IActivityManager.descriptor);
2730 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002731 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002732 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2733 reply.readException();
2734 data.recycle();
2735 reply.recycle();
2736 }
2737 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002738 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002739 {
2740 Parcel data = Parcel.obtain();
2741 Parcel reply = Parcel.obtain();
2742 data.writeInterfaceToken(IActivityManager.descriptor);
2743 data.writeStrongBinder(token);
2744 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002745 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002746 TextUtils.writeToParcel(description, data, 0);
2747 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2748 reply.readException();
2749 data.recycle();
2750 reply.recycle();
2751 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002752 public void activitySlept(IBinder token) throws RemoteException
2753 {
2754 Parcel data = Parcel.obtain();
2755 Parcel reply = Parcel.obtain();
2756 data.writeInterfaceToken(IActivityManager.descriptor);
2757 data.writeStrongBinder(token);
2758 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2759 reply.readException();
2760 data.recycle();
2761 reply.recycle();
2762 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002763 public void activityDestroyed(IBinder token) throws RemoteException
2764 {
2765 Parcel data = Parcel.obtain();
2766 Parcel reply = Parcel.obtain();
2767 data.writeInterfaceToken(IActivityManager.descriptor);
2768 data.writeStrongBinder(token);
2769 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2770 reply.readException();
2771 data.recycle();
2772 reply.recycle();
2773 }
2774 public String getCallingPackage(IBinder token) throws RemoteException
2775 {
2776 Parcel data = Parcel.obtain();
2777 Parcel reply = Parcel.obtain();
2778 data.writeInterfaceToken(IActivityManager.descriptor);
2779 data.writeStrongBinder(token);
2780 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2781 reply.readException();
2782 String res = reply.readString();
2783 data.recycle();
2784 reply.recycle();
2785 return res;
2786 }
2787 public ComponentName getCallingActivity(IBinder token)
2788 throws RemoteException {
2789 Parcel data = Parcel.obtain();
2790 Parcel reply = Parcel.obtain();
2791 data.writeInterfaceToken(IActivityManager.descriptor);
2792 data.writeStrongBinder(token);
2793 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2794 reply.readException();
2795 ComponentName res = ComponentName.readFromParcel(reply);
2796 data.recycle();
2797 reply.recycle();
2798 return res;
2799 }
Winson Chung1147c402014-05-14 11:05:00 -07002800 public List<IAppTask> getAppTasks() throws RemoteException {
2801 Parcel data = Parcel.obtain();
2802 Parcel reply = Parcel.obtain();
2803 data.writeInterfaceToken(IActivityManager.descriptor);
2804 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2805 reply.readException();
2806 ArrayList<IAppTask> list = null;
2807 int N = reply.readInt();
2808 if (N >= 0) {
2809 list = new ArrayList<IAppTask>();
2810 while (N > 0) {
2811 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2812 list.add(task);
2813 N--;
2814 }
2815 }
2816 data.recycle();
2817 reply.recycle();
2818 return list;
2819 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002820 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002821 Parcel data = Parcel.obtain();
2822 Parcel reply = Parcel.obtain();
2823 data.writeInterfaceToken(IActivityManager.descriptor);
2824 data.writeInt(maxNum);
2825 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002826 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2827 reply.readException();
2828 ArrayList list = null;
2829 int N = reply.readInt();
2830 if (N >= 0) {
2831 list = new ArrayList();
2832 while (N > 0) {
2833 ActivityManager.RunningTaskInfo info =
2834 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002835 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002836 list.add(info);
2837 N--;
2838 }
2839 }
2840 data.recycle();
2841 reply.recycle();
2842 return list;
2843 }
2844 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002845 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002846 Parcel data = Parcel.obtain();
2847 Parcel reply = Parcel.obtain();
2848 data.writeInterfaceToken(IActivityManager.descriptor);
2849 data.writeInt(maxNum);
2850 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002851 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002852 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2853 reply.readException();
2854 ArrayList<ActivityManager.RecentTaskInfo> list
2855 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2856 data.recycle();
2857 reply.recycle();
2858 return list;
2859 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002860 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002861 Parcel data = Parcel.obtain();
2862 Parcel reply = Parcel.obtain();
2863 data.writeInterfaceToken(IActivityManager.descriptor);
2864 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002865 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002866 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002867 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002868 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002869 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002870 }
2871 data.recycle();
2872 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002873 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07002874 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002875 public List getServices(int maxNum, int flags) throws RemoteException {
2876 Parcel data = Parcel.obtain();
2877 Parcel reply = Parcel.obtain();
2878 data.writeInterfaceToken(IActivityManager.descriptor);
2879 data.writeInt(maxNum);
2880 data.writeInt(flags);
2881 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2882 reply.readException();
2883 ArrayList list = null;
2884 int N = reply.readInt();
2885 if (N >= 0) {
2886 list = new ArrayList();
2887 while (N > 0) {
2888 ActivityManager.RunningServiceInfo info =
2889 ActivityManager.RunningServiceInfo.CREATOR
2890 .createFromParcel(reply);
2891 list.add(info);
2892 N--;
2893 }
2894 }
2895 data.recycle();
2896 reply.recycle();
2897 return list;
2898 }
2899 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2900 throws RemoteException {
2901 Parcel data = Parcel.obtain();
2902 Parcel reply = Parcel.obtain();
2903 data.writeInterfaceToken(IActivityManager.descriptor);
2904 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2905 reply.readException();
2906 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2907 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2908 data.recycle();
2909 reply.recycle();
2910 return list;
2911 }
2912 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2913 throws RemoteException {
2914 Parcel data = Parcel.obtain();
2915 Parcel reply = Parcel.obtain();
2916 data.writeInterfaceToken(IActivityManager.descriptor);
2917 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2918 reply.readException();
2919 ArrayList<ActivityManager.RunningAppProcessInfo> list
2920 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2921 data.recycle();
2922 reply.recycle();
2923 return list;
2924 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002925 public List<ApplicationInfo> getRunningExternalApplications()
2926 throws RemoteException {
2927 Parcel data = Parcel.obtain();
2928 Parcel reply = Parcel.obtain();
2929 data.writeInterfaceToken(IActivityManager.descriptor);
2930 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2931 reply.readException();
2932 ArrayList<ApplicationInfo> list
2933 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2934 data.recycle();
2935 reply.recycle();
2936 return list;
2937 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002938 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002939 {
2940 Parcel data = Parcel.obtain();
2941 Parcel reply = Parcel.obtain();
2942 data.writeInterfaceToken(IActivityManager.descriptor);
2943 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002944 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002945 if (options != null) {
2946 data.writeInt(1);
2947 options.writeToParcel(data, 0);
2948 } else {
2949 data.writeInt(0);
2950 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002951 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2952 reply.readException();
2953 data.recycle();
2954 reply.recycle();
2955 }
2956 public void moveTaskToBack(int task) throws RemoteException
2957 {
2958 Parcel data = Parcel.obtain();
2959 Parcel reply = Parcel.obtain();
2960 data.writeInterfaceToken(IActivityManager.descriptor);
2961 data.writeInt(task);
2962 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2963 reply.readException();
2964 data.recycle();
2965 reply.recycle();
2966 }
2967 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2968 throws RemoteException {
2969 Parcel data = Parcel.obtain();
2970 Parcel reply = Parcel.obtain();
2971 data.writeInterfaceToken(IActivityManager.descriptor);
2972 data.writeStrongBinder(token);
2973 data.writeInt(nonRoot ? 1 : 0);
2974 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2975 reply.readException();
2976 boolean res = reply.readInt() != 0;
2977 data.recycle();
2978 reply.recycle();
2979 return res;
2980 }
2981 public void moveTaskBackwards(int task) throws RemoteException
2982 {
2983 Parcel data = Parcel.obtain();
2984 Parcel reply = Parcel.obtain();
2985 data.writeInterfaceToken(IActivityManager.descriptor);
2986 data.writeInt(task);
2987 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2988 reply.readException();
2989 data.recycle();
2990 reply.recycle();
2991 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002992 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002993 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2994 {
2995 Parcel data = Parcel.obtain();
2996 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002997 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002998 data.writeInt(taskId);
2999 data.writeInt(stackId);
3000 data.writeInt(toTop ? 1 : 0);
3001 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3002 reply.readException();
3003 data.recycle();
3004 reply.recycle();
3005 }
3006 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003007 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003008 {
3009 Parcel data = Parcel.obtain();
3010 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003011 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003012 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003013 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003014 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003015 reply.readException();
3016 data.recycle();
3017 reply.recycle();
3018 }
Craig Mautner967212c2013-04-13 21:10:58 -07003019 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003020 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003021 {
3022 Parcel data = Parcel.obtain();
3023 Parcel reply = Parcel.obtain();
3024 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003025 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003026 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003027 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003028 data.recycle();
3029 reply.recycle();
3030 return list;
3031 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003032 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003033 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003034 {
3035 Parcel data = Parcel.obtain();
3036 Parcel reply = Parcel.obtain();
3037 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003038 data.writeInt(stackId);
3039 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003040 reply.readException();
3041 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003042 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003043 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003044 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003045 }
3046 data.recycle();
3047 reply.recycle();
3048 return info;
3049 }
3050 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003051 public boolean isInHomeStack(int taskId) throws RemoteException {
3052 Parcel data = Parcel.obtain();
3053 Parcel reply = Parcel.obtain();
3054 data.writeInterfaceToken(IActivityManager.descriptor);
3055 data.writeInt(taskId);
3056 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3057 reply.readException();
3058 boolean isInHomeStack = reply.readInt() > 0;
3059 data.recycle();
3060 reply.recycle();
3061 return isInHomeStack;
3062 }
3063 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003064 public void setFocusedStack(int stackId) throws RemoteException
3065 {
3066 Parcel data = Parcel.obtain();
3067 Parcel reply = Parcel.obtain();
3068 data.writeInterfaceToken(IActivityManager.descriptor);
3069 data.writeInt(stackId);
3070 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3071 reply.readException();
3072 data.recycle();
3073 reply.recycle();
3074 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003075 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3076 {
3077 Parcel data = Parcel.obtain();
3078 Parcel reply = Parcel.obtain();
3079 data.writeInterfaceToken(IActivityManager.descriptor);
3080 data.writeStrongBinder(token);
3081 data.writeInt(onlyRoot ? 1 : 0);
3082 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3083 reply.readException();
3084 int res = reply.readInt();
3085 data.recycle();
3086 reply.recycle();
3087 return res;
3088 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003089 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003090 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003091 Parcel data = Parcel.obtain();
3092 Parcel reply = Parcel.obtain();
3093 data.writeInterfaceToken(IActivityManager.descriptor);
3094 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3095 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003096 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003097 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003098 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3099 reply.readException();
3100 int res = reply.readInt();
3101 ContentProviderHolder cph = null;
3102 if (res != 0) {
3103 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3104 }
3105 data.recycle();
3106 reply.recycle();
3107 return cph;
3108 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003109 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3110 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003111 Parcel data = Parcel.obtain();
3112 Parcel reply = Parcel.obtain();
3113 data.writeInterfaceToken(IActivityManager.descriptor);
3114 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003115 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003116 data.writeStrongBinder(token);
3117 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3118 reply.readException();
3119 int res = reply.readInt();
3120 ContentProviderHolder cph = null;
3121 if (res != 0) {
3122 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3123 }
3124 data.recycle();
3125 reply.recycle();
3126 return cph;
3127 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003128 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003129 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003130 {
3131 Parcel data = Parcel.obtain();
3132 Parcel reply = Parcel.obtain();
3133 data.writeInterfaceToken(IActivityManager.descriptor);
3134 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3135 data.writeTypedList(providers);
3136 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3137 reply.readException();
3138 data.recycle();
3139 reply.recycle();
3140 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003141 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3142 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003143 Parcel data = Parcel.obtain();
3144 Parcel reply = Parcel.obtain();
3145 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003146 data.writeStrongBinder(connection);
3147 data.writeInt(stable);
3148 data.writeInt(unstable);
3149 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3150 reply.readException();
3151 boolean res = reply.readInt() != 0;
3152 data.recycle();
3153 reply.recycle();
3154 return res;
3155 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003156
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003157 public void unstableProviderDied(IBinder connection) throws RemoteException {
3158 Parcel data = Parcel.obtain();
3159 Parcel reply = Parcel.obtain();
3160 data.writeInterfaceToken(IActivityManager.descriptor);
3161 data.writeStrongBinder(connection);
3162 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3163 reply.readException();
3164 data.recycle();
3165 reply.recycle();
3166 }
3167
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003168 @Override
3169 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3170 Parcel data = Parcel.obtain();
3171 Parcel reply = Parcel.obtain();
3172 data.writeInterfaceToken(IActivityManager.descriptor);
3173 data.writeStrongBinder(connection);
3174 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3175 reply.readException();
3176 data.recycle();
3177 reply.recycle();
3178 }
3179
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003180 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3181 Parcel data = Parcel.obtain();
3182 Parcel reply = Parcel.obtain();
3183 data.writeInterfaceToken(IActivityManager.descriptor);
3184 data.writeStrongBinder(connection);
3185 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003186 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3187 reply.readException();
3188 data.recycle();
3189 reply.recycle();
3190 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003191
3192 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3193 Parcel data = Parcel.obtain();
3194 Parcel reply = Parcel.obtain();
3195 data.writeInterfaceToken(IActivityManager.descriptor);
3196 data.writeString(name);
3197 data.writeStrongBinder(token);
3198 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3199 reply.readException();
3200 data.recycle();
3201 reply.recycle();
3202 }
3203
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003204 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3205 throws RemoteException
3206 {
3207 Parcel data = Parcel.obtain();
3208 Parcel reply = Parcel.obtain();
3209 data.writeInterfaceToken(IActivityManager.descriptor);
3210 service.writeToParcel(data, 0);
3211 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3212 reply.readException();
3213 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3214 data.recycle();
3215 reply.recycle();
3216 return res;
3217 }
3218
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003219 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003220 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003221 {
3222 Parcel data = Parcel.obtain();
3223 Parcel reply = Parcel.obtain();
3224 data.writeInterfaceToken(IActivityManager.descriptor);
3225 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3226 service.writeToParcel(data, 0);
3227 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003228 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003229 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3230 reply.readException();
3231 ComponentName res = ComponentName.readFromParcel(reply);
3232 data.recycle();
3233 reply.recycle();
3234 return res;
3235 }
3236 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003237 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003238 {
3239 Parcel data = Parcel.obtain();
3240 Parcel reply = Parcel.obtain();
3241 data.writeInterfaceToken(IActivityManager.descriptor);
3242 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3243 service.writeToParcel(data, 0);
3244 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003245 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003246 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3247 reply.readException();
3248 int res = reply.readInt();
3249 reply.recycle();
3250 data.recycle();
3251 return res;
3252 }
3253 public boolean stopServiceToken(ComponentName className, IBinder token,
3254 int startId) throws RemoteException {
3255 Parcel data = Parcel.obtain();
3256 Parcel reply = Parcel.obtain();
3257 data.writeInterfaceToken(IActivityManager.descriptor);
3258 ComponentName.writeToParcel(className, data);
3259 data.writeStrongBinder(token);
3260 data.writeInt(startId);
3261 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3262 reply.readException();
3263 boolean res = reply.readInt() != 0;
3264 data.recycle();
3265 reply.recycle();
3266 return res;
3267 }
3268 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003269 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003270 Parcel data = Parcel.obtain();
3271 Parcel reply = Parcel.obtain();
3272 data.writeInterfaceToken(IActivityManager.descriptor);
3273 ComponentName.writeToParcel(className, data);
3274 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003275 data.writeInt(id);
3276 if (notification != null) {
3277 data.writeInt(1);
3278 notification.writeToParcel(data, 0);
3279 } else {
3280 data.writeInt(0);
3281 }
3282 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003283 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3284 reply.readException();
3285 data.recycle();
3286 reply.recycle();
3287 }
3288 public int bindService(IApplicationThread caller, IBinder token,
3289 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003290 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003291 Parcel data = Parcel.obtain();
3292 Parcel reply = Parcel.obtain();
3293 data.writeInterfaceToken(IActivityManager.descriptor);
3294 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3295 data.writeStrongBinder(token);
3296 service.writeToParcel(data, 0);
3297 data.writeString(resolvedType);
3298 data.writeStrongBinder(connection.asBinder());
3299 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003300 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003301 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3302 reply.readException();
3303 int res = reply.readInt();
3304 data.recycle();
3305 reply.recycle();
3306 return res;
3307 }
3308 public boolean unbindService(IServiceConnection connection) throws RemoteException
3309 {
3310 Parcel data = Parcel.obtain();
3311 Parcel reply = Parcel.obtain();
3312 data.writeInterfaceToken(IActivityManager.descriptor);
3313 data.writeStrongBinder(connection.asBinder());
3314 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3315 reply.readException();
3316 boolean res = reply.readInt() != 0;
3317 data.recycle();
3318 reply.recycle();
3319 return res;
3320 }
3321
3322 public void publishService(IBinder token,
3323 Intent intent, IBinder service) throws RemoteException {
3324 Parcel data = Parcel.obtain();
3325 Parcel reply = Parcel.obtain();
3326 data.writeInterfaceToken(IActivityManager.descriptor);
3327 data.writeStrongBinder(token);
3328 intent.writeToParcel(data, 0);
3329 data.writeStrongBinder(service);
3330 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3331 reply.readException();
3332 data.recycle();
3333 reply.recycle();
3334 }
3335
3336 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3337 throws RemoteException {
3338 Parcel data = Parcel.obtain();
3339 Parcel reply = Parcel.obtain();
3340 data.writeInterfaceToken(IActivityManager.descriptor);
3341 data.writeStrongBinder(token);
3342 intent.writeToParcel(data, 0);
3343 data.writeInt(doRebind ? 1 : 0);
3344 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3345 reply.readException();
3346 data.recycle();
3347 reply.recycle();
3348 }
3349
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003350 public void serviceDoneExecuting(IBinder token, int type, int startId,
3351 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003352 Parcel data = Parcel.obtain();
3353 Parcel reply = Parcel.obtain();
3354 data.writeInterfaceToken(IActivityManager.descriptor);
3355 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003356 data.writeInt(type);
3357 data.writeInt(startId);
3358 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003359 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3360 reply.readException();
3361 data.recycle();
3362 reply.recycle();
3363 }
3364
3365 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3366 Parcel data = Parcel.obtain();
3367 Parcel reply = Parcel.obtain();
3368 data.writeInterfaceToken(IActivityManager.descriptor);
3369 service.writeToParcel(data, 0);
3370 data.writeString(resolvedType);
3371 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3372 reply.readException();
3373 IBinder binder = reply.readStrongBinder();
3374 reply.recycle();
3375 data.recycle();
3376 return binder;
3377 }
3378
Christopher Tate181fafa2009-05-14 11:12:14 -07003379 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3380 throws RemoteException {
3381 Parcel data = Parcel.obtain();
3382 Parcel reply = Parcel.obtain();
3383 data.writeInterfaceToken(IActivityManager.descriptor);
3384 app.writeToParcel(data, 0);
3385 data.writeInt(backupRestoreMode);
3386 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3387 reply.readException();
3388 boolean success = reply.readInt() != 0;
3389 reply.recycle();
3390 data.recycle();
3391 return success;
3392 }
3393
Christopher Tate346acb12012-10-15 19:20:25 -07003394 public void clearPendingBackup() throws RemoteException {
3395 Parcel data = Parcel.obtain();
3396 Parcel reply = Parcel.obtain();
3397 data.writeInterfaceToken(IActivityManager.descriptor);
3398 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3399 reply.recycle();
3400 data.recycle();
3401 }
3402
Christopher Tate181fafa2009-05-14 11:12:14 -07003403 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3404 Parcel data = Parcel.obtain();
3405 Parcel reply = Parcel.obtain();
3406 data.writeInterfaceToken(IActivityManager.descriptor);
3407 data.writeString(packageName);
3408 data.writeStrongBinder(agent);
3409 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3410 reply.recycle();
3411 data.recycle();
3412 }
3413
3414 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3415 Parcel data = Parcel.obtain();
3416 Parcel reply = Parcel.obtain();
3417 data.writeInterfaceToken(IActivityManager.descriptor);
3418 app.writeToParcel(data, 0);
3419 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3420 reply.readException();
3421 reply.recycle();
3422 data.recycle();
3423 }
3424
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003425 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003426 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003427 IUiAutomationConnection connection, int userId, String instructionSet)
3428 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003429 Parcel data = Parcel.obtain();
3430 Parcel reply = Parcel.obtain();
3431 data.writeInterfaceToken(IActivityManager.descriptor);
3432 ComponentName.writeToParcel(className, data);
3433 data.writeString(profileFile);
3434 data.writeInt(flags);
3435 data.writeBundle(arguments);
3436 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003437 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003438 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003439 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003440 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3441 reply.readException();
3442 boolean res = reply.readInt() != 0;
3443 reply.recycle();
3444 data.recycle();
3445 return res;
3446 }
3447
3448 public void finishInstrumentation(IApplicationThread target,
3449 int resultCode, Bundle results) throws RemoteException {
3450 Parcel data = Parcel.obtain();
3451 Parcel reply = Parcel.obtain();
3452 data.writeInterfaceToken(IActivityManager.descriptor);
3453 data.writeStrongBinder(target != null ? target.asBinder() : null);
3454 data.writeInt(resultCode);
3455 data.writeBundle(results);
3456 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3457 reply.readException();
3458 data.recycle();
3459 reply.recycle();
3460 }
3461 public Configuration getConfiguration() throws RemoteException
3462 {
3463 Parcel data = Parcel.obtain();
3464 Parcel reply = Parcel.obtain();
3465 data.writeInterfaceToken(IActivityManager.descriptor);
3466 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3467 reply.readException();
3468 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3469 reply.recycle();
3470 data.recycle();
3471 return res;
3472 }
3473 public void updateConfiguration(Configuration values) throws RemoteException
3474 {
3475 Parcel data = Parcel.obtain();
3476 Parcel reply = Parcel.obtain();
3477 data.writeInterfaceToken(IActivityManager.descriptor);
3478 values.writeToParcel(data, 0);
3479 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3480 reply.readException();
3481 data.recycle();
3482 reply.recycle();
3483 }
3484 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3485 throws RemoteException {
3486 Parcel data = Parcel.obtain();
3487 Parcel reply = Parcel.obtain();
3488 data.writeInterfaceToken(IActivityManager.descriptor);
3489 data.writeStrongBinder(token);
3490 data.writeInt(requestedOrientation);
3491 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3492 reply.readException();
3493 data.recycle();
3494 reply.recycle();
3495 }
3496 public int getRequestedOrientation(IBinder token) throws RemoteException {
3497 Parcel data = Parcel.obtain();
3498 Parcel reply = Parcel.obtain();
3499 data.writeInterfaceToken(IActivityManager.descriptor);
3500 data.writeStrongBinder(token);
3501 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3502 reply.readException();
3503 int res = reply.readInt();
3504 data.recycle();
3505 reply.recycle();
3506 return res;
3507 }
3508 public ComponentName getActivityClassForToken(IBinder token)
3509 throws RemoteException {
3510 Parcel data = Parcel.obtain();
3511 Parcel reply = Parcel.obtain();
3512 data.writeInterfaceToken(IActivityManager.descriptor);
3513 data.writeStrongBinder(token);
3514 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3515 reply.readException();
3516 ComponentName res = ComponentName.readFromParcel(reply);
3517 data.recycle();
3518 reply.recycle();
3519 return res;
3520 }
3521 public String getPackageForToken(IBinder token) throws RemoteException
3522 {
3523 Parcel data = Parcel.obtain();
3524 Parcel reply = Parcel.obtain();
3525 data.writeInterfaceToken(IActivityManager.descriptor);
3526 data.writeStrongBinder(token);
3527 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3528 reply.readException();
3529 String res = reply.readString();
3530 data.recycle();
3531 reply.recycle();
3532 return res;
3533 }
3534 public IIntentSender getIntentSender(int type,
3535 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003536 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003537 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003538 Parcel data = Parcel.obtain();
3539 Parcel reply = Parcel.obtain();
3540 data.writeInterfaceToken(IActivityManager.descriptor);
3541 data.writeInt(type);
3542 data.writeString(packageName);
3543 data.writeStrongBinder(token);
3544 data.writeString(resultWho);
3545 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003546 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003547 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003548 data.writeTypedArray(intents, 0);
3549 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003550 } else {
3551 data.writeInt(0);
3552 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003553 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003554 if (options != null) {
3555 data.writeInt(1);
3556 options.writeToParcel(data, 0);
3557 } else {
3558 data.writeInt(0);
3559 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003560 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003561 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3562 reply.readException();
3563 IIntentSender res = IIntentSender.Stub.asInterface(
3564 reply.readStrongBinder());
3565 data.recycle();
3566 reply.recycle();
3567 return res;
3568 }
3569 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3570 Parcel data = Parcel.obtain();
3571 Parcel reply = Parcel.obtain();
3572 data.writeInterfaceToken(IActivityManager.descriptor);
3573 data.writeStrongBinder(sender.asBinder());
3574 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3575 reply.readException();
3576 data.recycle();
3577 reply.recycle();
3578 }
3579 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3580 Parcel data = Parcel.obtain();
3581 Parcel reply = Parcel.obtain();
3582 data.writeInterfaceToken(IActivityManager.descriptor);
3583 data.writeStrongBinder(sender.asBinder());
3584 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3585 reply.readException();
3586 String res = reply.readString();
3587 data.recycle();
3588 reply.recycle();
3589 return res;
3590 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003591 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3592 Parcel data = Parcel.obtain();
3593 Parcel reply = Parcel.obtain();
3594 data.writeInterfaceToken(IActivityManager.descriptor);
3595 data.writeStrongBinder(sender.asBinder());
3596 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3597 reply.readException();
3598 int res = reply.readInt();
3599 data.recycle();
3600 reply.recycle();
3601 return res;
3602 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003603 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3604 boolean requireFull, String name, String callerPackage) throws RemoteException {
3605 Parcel data = Parcel.obtain();
3606 Parcel reply = Parcel.obtain();
3607 data.writeInterfaceToken(IActivityManager.descriptor);
3608 data.writeInt(callingPid);
3609 data.writeInt(callingUid);
3610 data.writeInt(userId);
3611 data.writeInt(allowAll ? 1 : 0);
3612 data.writeInt(requireFull ? 1 : 0);
3613 data.writeString(name);
3614 data.writeString(callerPackage);
3615 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3616 reply.readException();
3617 int res = reply.readInt();
3618 data.recycle();
3619 reply.recycle();
3620 return res;
3621 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003622 public void setProcessLimit(int max) throws RemoteException
3623 {
3624 Parcel data = Parcel.obtain();
3625 Parcel reply = Parcel.obtain();
3626 data.writeInterfaceToken(IActivityManager.descriptor);
3627 data.writeInt(max);
3628 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3629 reply.readException();
3630 data.recycle();
3631 reply.recycle();
3632 }
3633 public int getProcessLimit() throws RemoteException
3634 {
3635 Parcel data = Parcel.obtain();
3636 Parcel reply = Parcel.obtain();
3637 data.writeInterfaceToken(IActivityManager.descriptor);
3638 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3639 reply.readException();
3640 int res = reply.readInt();
3641 data.recycle();
3642 reply.recycle();
3643 return res;
3644 }
3645 public void setProcessForeground(IBinder token, int pid,
3646 boolean isForeground) throws RemoteException {
3647 Parcel data = Parcel.obtain();
3648 Parcel reply = Parcel.obtain();
3649 data.writeInterfaceToken(IActivityManager.descriptor);
3650 data.writeStrongBinder(token);
3651 data.writeInt(pid);
3652 data.writeInt(isForeground ? 1 : 0);
3653 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3654 reply.readException();
3655 data.recycle();
3656 reply.recycle();
3657 }
3658 public int checkPermission(String permission, int pid, int uid)
3659 throws RemoteException {
3660 Parcel data = Parcel.obtain();
3661 Parcel reply = Parcel.obtain();
3662 data.writeInterfaceToken(IActivityManager.descriptor);
3663 data.writeString(permission);
3664 data.writeInt(pid);
3665 data.writeInt(uid);
3666 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3667 reply.readException();
3668 int res = reply.readInt();
3669 data.recycle();
3670 reply.recycle();
3671 return res;
3672 }
3673 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003674 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003675 Parcel data = Parcel.obtain();
3676 Parcel reply = Parcel.obtain();
3677 data.writeInterfaceToken(IActivityManager.descriptor);
3678 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003679 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003680 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003681 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3682 reply.readException();
3683 boolean res = reply.readInt() != 0;
3684 data.recycle();
3685 reply.recycle();
3686 return res;
3687 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003688 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003689 throws RemoteException {
3690 Parcel data = Parcel.obtain();
3691 Parcel reply = Parcel.obtain();
3692 data.writeInterfaceToken(IActivityManager.descriptor);
3693 uri.writeToParcel(data, 0);
3694 data.writeInt(pid);
3695 data.writeInt(uid);
3696 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003697 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003698 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3699 reply.readException();
3700 int res = reply.readInt();
3701 data.recycle();
3702 reply.recycle();
3703 return res;
3704 }
3705 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003706 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003707 Parcel data = Parcel.obtain();
3708 Parcel reply = Parcel.obtain();
3709 data.writeInterfaceToken(IActivityManager.descriptor);
3710 data.writeStrongBinder(caller.asBinder());
3711 data.writeString(targetPkg);
3712 uri.writeToParcel(data, 0);
3713 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003714 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003715 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3716 reply.readException();
3717 data.recycle();
3718 reply.recycle();
3719 }
3720 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003721 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003722 Parcel data = Parcel.obtain();
3723 Parcel reply = Parcel.obtain();
3724 data.writeInterfaceToken(IActivityManager.descriptor);
3725 data.writeStrongBinder(caller.asBinder());
3726 uri.writeToParcel(data, 0);
3727 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003728 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003729 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3730 reply.readException();
3731 data.recycle();
3732 reply.recycle();
3733 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003734
3735 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003736 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3737 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003738 Parcel data = Parcel.obtain();
3739 Parcel reply = Parcel.obtain();
3740 data.writeInterfaceToken(IActivityManager.descriptor);
3741 uri.writeToParcel(data, 0);
3742 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003743 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003744 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3745 reply.readException();
3746 data.recycle();
3747 reply.recycle();
3748 }
3749
3750 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003751 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3752 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003753 Parcel data = Parcel.obtain();
3754 Parcel reply = Parcel.obtain();
3755 data.writeInterfaceToken(IActivityManager.descriptor);
3756 uri.writeToParcel(data, 0);
3757 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003758 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003759 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3760 reply.readException();
3761 data.recycle();
3762 reply.recycle();
3763 }
3764
3765 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003766 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3767 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003768 Parcel data = Parcel.obtain();
3769 Parcel reply = Parcel.obtain();
3770 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003771 data.writeString(packageName);
3772 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003773 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3774 reply.readException();
3775 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3776 reply);
3777 data.recycle();
3778 reply.recycle();
3779 return perms;
3780 }
3781
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003782 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3783 throws RemoteException {
3784 Parcel data = Parcel.obtain();
3785 Parcel reply = Parcel.obtain();
3786 data.writeInterfaceToken(IActivityManager.descriptor);
3787 data.writeStrongBinder(who.asBinder());
3788 data.writeInt(waiting ? 1 : 0);
3789 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3790 reply.readException();
3791 data.recycle();
3792 reply.recycle();
3793 }
3794 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3795 Parcel data = Parcel.obtain();
3796 Parcel reply = Parcel.obtain();
3797 data.writeInterfaceToken(IActivityManager.descriptor);
3798 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3799 reply.readException();
3800 outInfo.readFromParcel(reply);
3801 data.recycle();
3802 reply.recycle();
3803 }
3804 public void unhandledBack() throws RemoteException
3805 {
3806 Parcel data = Parcel.obtain();
3807 Parcel reply = Parcel.obtain();
3808 data.writeInterfaceToken(IActivityManager.descriptor);
3809 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3810 reply.readException();
3811 data.recycle();
3812 reply.recycle();
3813 }
3814 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3815 {
3816 Parcel data = Parcel.obtain();
3817 Parcel reply = Parcel.obtain();
3818 data.writeInterfaceToken(IActivityManager.descriptor);
3819 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3820 reply.readException();
3821 ParcelFileDescriptor pfd = null;
3822 if (reply.readInt() != 0) {
3823 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3824 }
3825 data.recycle();
3826 reply.recycle();
3827 return pfd;
3828 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003829 public void setLockScreenShown(boolean shown) throws RemoteException
3830 {
3831 Parcel data = Parcel.obtain();
3832 Parcel reply = Parcel.obtain();
3833 data.writeInterfaceToken(IActivityManager.descriptor);
3834 data.writeInt(shown ? 1 : 0);
3835 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3836 reply.readException();
3837 data.recycle();
3838 reply.recycle();
3839 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003840 public void setDebugApp(
3841 String packageName, boolean waitForDebugger, boolean persistent)
3842 throws RemoteException
3843 {
3844 Parcel data = Parcel.obtain();
3845 Parcel reply = Parcel.obtain();
3846 data.writeInterfaceToken(IActivityManager.descriptor);
3847 data.writeString(packageName);
3848 data.writeInt(waitForDebugger ? 1 : 0);
3849 data.writeInt(persistent ? 1 : 0);
3850 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3851 reply.readException();
3852 data.recycle();
3853 reply.recycle();
3854 }
3855 public void setAlwaysFinish(boolean enabled) throws RemoteException
3856 {
3857 Parcel data = Parcel.obtain();
3858 Parcel reply = Parcel.obtain();
3859 data.writeInterfaceToken(IActivityManager.descriptor);
3860 data.writeInt(enabled ? 1 : 0);
3861 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3862 reply.readException();
3863 data.recycle();
3864 reply.recycle();
3865 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003866 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003867 {
3868 Parcel data = Parcel.obtain();
3869 Parcel reply = Parcel.obtain();
3870 data.writeInterfaceToken(IActivityManager.descriptor);
3871 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003872 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003873 reply.readException();
3874 data.recycle();
3875 reply.recycle();
3876 }
3877 public void enterSafeMode() throws RemoteException {
3878 Parcel data = Parcel.obtain();
3879 data.writeInterfaceToken(IActivityManager.descriptor);
3880 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3881 data.recycle();
3882 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003883 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3884 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003885 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003886 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003887 data.writeStrongBinder(sender.asBinder());
3888 data.writeInt(sourceUid);
3889 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003890 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3891 data.recycle();
3892 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003893 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003894 Parcel data = Parcel.obtain();
3895 Parcel reply = Parcel.obtain();
3896 data.writeInterfaceToken(IActivityManager.descriptor);
3897 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003898 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003899 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003900 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003901 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003902 boolean res = reply.readInt() != 0;
3903 data.recycle();
3904 reply.recycle();
3905 return res;
3906 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003907 @Override
3908 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3909 Parcel data = Parcel.obtain();
3910 Parcel reply = Parcel.obtain();
3911 data.writeInterfaceToken(IActivityManager.descriptor);
3912 data.writeString(reason);
3913 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3914 boolean res = reply.readInt() != 0;
3915 data.recycle();
3916 reply.recycle();
3917 return res;
3918 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003919 public boolean testIsSystemReady()
3920 {
3921 /* this base class version is never called */
3922 return true;
3923 }
Dan Egnor60d87622009-12-16 16:32:58 -08003924 public void handleApplicationCrash(IBinder app,
3925 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3926 {
3927 Parcel data = Parcel.obtain();
3928 Parcel reply = Parcel.obtain();
3929 data.writeInterfaceToken(IActivityManager.descriptor);
3930 data.writeStrongBinder(app);
3931 crashInfo.writeToParcel(data, 0);
3932 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3933 reply.readException();
3934 reply.recycle();
3935 data.recycle();
3936 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003937
Dan Egnor60d87622009-12-16 16:32:58 -08003938 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003939 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003940 {
3941 Parcel data = Parcel.obtain();
3942 Parcel reply = Parcel.obtain();
3943 data.writeInterfaceToken(IActivityManager.descriptor);
3944 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003945 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003946 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003947 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003948 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003949 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003950 reply.recycle();
3951 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003952 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003953 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003954
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003955 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003956 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003957 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003958 {
3959 Parcel data = Parcel.obtain();
3960 Parcel reply = Parcel.obtain();
3961 data.writeInterfaceToken(IActivityManager.descriptor);
3962 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003963 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003964 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003965 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3966 reply.readException();
3967 reply.recycle();
3968 data.recycle();
3969 }
3970
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003971 public void signalPersistentProcesses(int sig) throws RemoteException {
3972 Parcel data = Parcel.obtain();
3973 Parcel reply = Parcel.obtain();
3974 data.writeInterfaceToken(IActivityManager.descriptor);
3975 data.writeInt(sig);
3976 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3977 reply.readException();
3978 data.recycle();
3979 reply.recycle();
3980 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003981
Dianne Hackborn1676c852012-09-10 14:52:30 -07003982 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003983 Parcel data = Parcel.obtain();
3984 Parcel reply = Parcel.obtain();
3985 data.writeInterfaceToken(IActivityManager.descriptor);
3986 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003987 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003988 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3989 reply.readException();
3990 data.recycle();
3991 reply.recycle();
3992 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003993
3994 public void killAllBackgroundProcesses() throws RemoteException {
3995 Parcel data = Parcel.obtain();
3996 Parcel reply = Parcel.obtain();
3997 data.writeInterfaceToken(IActivityManager.descriptor);
3998 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3999 reply.readException();
4000 data.recycle();
4001 reply.recycle();
4002 }
4003
Dianne Hackborn1676c852012-09-10 14:52:30 -07004004 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004005 Parcel data = Parcel.obtain();
4006 Parcel reply = Parcel.obtain();
4007 data.writeInterfaceToken(IActivityManager.descriptor);
4008 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004009 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004010 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004011 reply.readException();
4012 data.recycle();
4013 reply.recycle();
4014 }
4015
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004016 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4017 throws RemoteException
4018 {
4019 Parcel data = Parcel.obtain();
4020 Parcel reply = Parcel.obtain();
4021 data.writeInterfaceToken(IActivityManager.descriptor);
4022 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4023 reply.readException();
4024 outInfo.readFromParcel(reply);
4025 reply.recycle();
4026 data.recycle();
4027 }
4028
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004029 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4030 {
4031 Parcel data = Parcel.obtain();
4032 Parcel reply = Parcel.obtain();
4033 data.writeInterfaceToken(IActivityManager.descriptor);
4034 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4035 reply.readException();
4036 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4037 reply.recycle();
4038 data.recycle();
4039 return res;
4040 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004041
Dianne Hackborn1676c852012-09-10 14:52:30 -07004042 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07004043 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004044 {
4045 Parcel data = Parcel.obtain();
4046 Parcel reply = Parcel.obtain();
4047 data.writeInterfaceToken(IActivityManager.descriptor);
4048 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004049 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004050 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004051 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004052 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004053 if (fd != null) {
4054 data.writeInt(1);
4055 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4056 } else {
4057 data.writeInt(0);
4058 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004059 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4060 reply.readException();
4061 boolean res = reply.readInt() != 0;
4062 reply.recycle();
4063 data.recycle();
4064 return res;
4065 }
4066
Dianne Hackborn55280a92009-05-07 15:53:46 -07004067 public boolean shutdown(int timeout) throws RemoteException
4068 {
4069 Parcel data = Parcel.obtain();
4070 Parcel reply = Parcel.obtain();
4071 data.writeInterfaceToken(IActivityManager.descriptor);
4072 data.writeInt(timeout);
4073 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4074 reply.readException();
4075 boolean res = reply.readInt() != 0;
4076 reply.recycle();
4077 data.recycle();
4078 return res;
4079 }
4080
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004081 public void stopAppSwitches() throws RemoteException {
4082 Parcel data = Parcel.obtain();
4083 Parcel reply = Parcel.obtain();
4084 data.writeInterfaceToken(IActivityManager.descriptor);
4085 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4086 reply.readException();
4087 reply.recycle();
4088 data.recycle();
4089 }
4090
4091 public void resumeAppSwitches() throws RemoteException {
4092 Parcel data = Parcel.obtain();
4093 Parcel reply = Parcel.obtain();
4094 data.writeInterfaceToken(IActivityManager.descriptor);
4095 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4096 reply.readException();
4097 reply.recycle();
4098 data.recycle();
4099 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004100
4101 public void addPackageDependency(String packageName) throws RemoteException {
4102 Parcel data = Parcel.obtain();
4103 Parcel reply = Parcel.obtain();
4104 data.writeInterfaceToken(IActivityManager.descriptor);
4105 data.writeString(packageName);
4106 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4107 reply.readException();
4108 data.recycle();
4109 reply.recycle();
4110 }
4111
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004112 public void killApplicationWithAppId(String pkg, int appid, String reason)
4113 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004114 Parcel data = Parcel.obtain();
4115 Parcel reply = Parcel.obtain();
4116 data.writeInterfaceToken(IActivityManager.descriptor);
4117 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004118 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004119 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004120 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004121 reply.readException();
4122 data.recycle();
4123 reply.recycle();
4124 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004125
4126 public void closeSystemDialogs(String reason) throws RemoteException {
4127 Parcel data = Parcel.obtain();
4128 Parcel reply = Parcel.obtain();
4129 data.writeInterfaceToken(IActivityManager.descriptor);
4130 data.writeString(reason);
4131 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4132 reply.readException();
4133 data.recycle();
4134 reply.recycle();
4135 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004136
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004137 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004138 throws RemoteException {
4139 Parcel data = Parcel.obtain();
4140 Parcel reply = Parcel.obtain();
4141 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004142 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004143 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4144 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004145 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004146 data.recycle();
4147 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004148 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004149 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004150
4151 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4152 Parcel data = Parcel.obtain();
4153 Parcel reply = Parcel.obtain();
4154 data.writeInterfaceToken(IActivityManager.descriptor);
4155 data.writeString(processName);
4156 data.writeInt(uid);
4157 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4158 reply.readException();
4159 data.recycle();
4160 reply.recycle();
4161 }
4162
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004163 public void overridePendingTransition(IBinder token, String packageName,
4164 int enterAnim, int exitAnim) throws RemoteException {
4165 Parcel data = Parcel.obtain();
4166 Parcel reply = Parcel.obtain();
4167 data.writeInterfaceToken(IActivityManager.descriptor);
4168 data.writeStrongBinder(token);
4169 data.writeString(packageName);
4170 data.writeInt(enterAnim);
4171 data.writeInt(exitAnim);
4172 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4173 reply.readException();
4174 data.recycle();
4175 reply.recycle();
4176 }
4177
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004178 public boolean isUserAMonkey() throws RemoteException {
4179 Parcel data = Parcel.obtain();
4180 Parcel reply = Parcel.obtain();
4181 data.writeInterfaceToken(IActivityManager.descriptor);
4182 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4183 reply.readException();
4184 boolean res = reply.readInt() != 0;
4185 data.recycle();
4186 reply.recycle();
4187 return res;
4188 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004189
4190 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4191 Parcel data = Parcel.obtain();
4192 Parcel reply = Parcel.obtain();
4193 data.writeInterfaceToken(IActivityManager.descriptor);
4194 data.writeInt(monkey ? 1 : 0);
4195 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4196 reply.readException();
4197 data.recycle();
4198 reply.recycle();
4199 }
4200
Dianne Hackborn860755f2010-06-03 18:47:52 -07004201 public void finishHeavyWeightApp() throws RemoteException {
4202 Parcel data = Parcel.obtain();
4203 Parcel reply = Parcel.obtain();
4204 data.writeInterfaceToken(IActivityManager.descriptor);
4205 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4206 reply.readException();
4207 data.recycle();
4208 reply.recycle();
4209 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004210
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004211 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004212 throws RemoteException {
4213 Parcel data = Parcel.obtain();
4214 Parcel reply = Parcel.obtain();
4215 data.writeInterfaceToken(IActivityManager.descriptor);
4216 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004217 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4218 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004219 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004220 data.recycle();
4221 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004222 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004223 }
4224
Craig Mautner233ceee2014-05-09 17:05:11 -07004225 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004226 throws RemoteException {
4227 Parcel data = Parcel.obtain();
4228 Parcel reply = Parcel.obtain();
4229 data.writeInterfaceToken(IActivityManager.descriptor);
4230 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004231 if (options == null) {
4232 data.writeInt(0);
4233 } else {
4234 data.writeInt(1);
4235 data.writeBundle(options.toBundle());
4236 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004237 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004238 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004239 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004240 data.recycle();
4241 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004242 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004243 }
4244
Craig Mautner233ceee2014-05-09 17:05:11 -07004245 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4246 Parcel data = Parcel.obtain();
4247 Parcel reply = Parcel.obtain();
4248 data.writeInterfaceToken(IActivityManager.descriptor);
4249 data.writeStrongBinder(token);
4250 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4251 reply.readException();
4252 Bundle bundle = reply.readBundle();
4253 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4254 data.recycle();
4255 reply.recycle();
4256 return options;
4257 }
4258
Daniel Sandler69a48172010-06-23 16:29:36 -04004259 public void setImmersive(IBinder token, boolean immersive)
4260 throws RemoteException {
4261 Parcel data = Parcel.obtain();
4262 Parcel reply = Parcel.obtain();
4263 data.writeInterfaceToken(IActivityManager.descriptor);
4264 data.writeStrongBinder(token);
4265 data.writeInt(immersive ? 1 : 0);
4266 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4267 reply.readException();
4268 data.recycle();
4269 reply.recycle();
4270 }
4271
4272 public boolean isImmersive(IBinder token)
4273 throws RemoteException {
4274 Parcel data = Parcel.obtain();
4275 Parcel reply = Parcel.obtain();
4276 data.writeInterfaceToken(IActivityManager.descriptor);
4277 data.writeStrongBinder(token);
4278 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004279 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004280 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004281 data.recycle();
4282 reply.recycle();
4283 return res;
4284 }
4285
Craig Mautnerd61dc202014-07-07 11:09:11 -07004286 public boolean isTopOfTask(IBinder token) throws RemoteException {
4287 Parcel data = Parcel.obtain();
4288 Parcel reply = Parcel.obtain();
4289 data.writeInterfaceToken(IActivityManager.descriptor);
4290 data.writeStrongBinder(token);
4291 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4292 reply.readException();
4293 boolean res = reply.readInt() == 1;
4294 data.recycle();
4295 reply.recycle();
4296 return res;
4297 }
4298
Daniel Sandler69a48172010-06-23 16:29:36 -04004299 public boolean isTopActivityImmersive()
4300 throws RemoteException {
4301 Parcel data = Parcel.obtain();
4302 Parcel reply = Parcel.obtain();
4303 data.writeInterfaceToken(IActivityManager.descriptor);
4304 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004305 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004306 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004307 data.recycle();
4308 reply.recycle();
4309 return res;
4310 }
4311
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004312 public void crashApplication(int uid, int initialPid, String packageName,
4313 String message) throws RemoteException {
4314 Parcel data = Parcel.obtain();
4315 Parcel reply = Parcel.obtain();
4316 data.writeInterfaceToken(IActivityManager.descriptor);
4317 data.writeInt(uid);
4318 data.writeInt(initialPid);
4319 data.writeString(packageName);
4320 data.writeString(message);
4321 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4322 reply.readException();
4323 data.recycle();
4324 reply.recycle();
4325 }
Andy McFadden824c5102010-07-09 16:26:57 -07004326
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004327 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004328 Parcel data = Parcel.obtain();
4329 Parcel reply = Parcel.obtain();
4330 data.writeInterfaceToken(IActivityManager.descriptor);
4331 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004332 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004333 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4334 reply.readException();
4335 String res = reply.readString();
4336 data.recycle();
4337 reply.recycle();
4338 return res;
4339 }
4340
Dianne Hackborn7e269642010-08-25 19:50:20 -07004341 public IBinder newUriPermissionOwner(String name)
4342 throws RemoteException {
4343 Parcel data = Parcel.obtain();
4344 Parcel reply = Parcel.obtain();
4345 data.writeInterfaceToken(IActivityManager.descriptor);
4346 data.writeString(name);
4347 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4348 reply.readException();
4349 IBinder res = reply.readStrongBinder();
4350 data.recycle();
4351 reply.recycle();
4352 return res;
4353 }
4354
4355 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004356 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004357 Parcel data = Parcel.obtain();
4358 Parcel reply = Parcel.obtain();
4359 data.writeInterfaceToken(IActivityManager.descriptor);
4360 data.writeStrongBinder(owner);
4361 data.writeInt(fromUid);
4362 data.writeString(targetPkg);
4363 uri.writeToParcel(data, 0);
4364 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004365 data.writeInt(sourceUserId);
4366 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004367 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4368 reply.readException();
4369 data.recycle();
4370 reply.recycle();
4371 }
4372
4373 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004374 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004375 Parcel data = Parcel.obtain();
4376 Parcel reply = Parcel.obtain();
4377 data.writeInterfaceToken(IActivityManager.descriptor);
4378 data.writeStrongBinder(owner);
4379 if (uri != null) {
4380 data.writeInt(1);
4381 uri.writeToParcel(data, 0);
4382 } else {
4383 data.writeInt(0);
4384 }
4385 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004386 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004387 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4388 reply.readException();
4389 data.recycle();
4390 reply.recycle();
4391 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004392
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004393 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004394 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004395 Parcel data = Parcel.obtain();
4396 Parcel reply = Parcel.obtain();
4397 data.writeInterfaceToken(IActivityManager.descriptor);
4398 data.writeInt(callingUid);
4399 data.writeString(targetPkg);
4400 uri.writeToParcel(data, 0);
4401 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004402 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004403 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4404 reply.readException();
4405 int res = reply.readInt();
4406 data.recycle();
4407 reply.recycle();
4408 return res;
4409 }
4410
Dianne Hackborn1676c852012-09-10 14:52:30 -07004411 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004412 String path, ParcelFileDescriptor fd) throws RemoteException {
4413 Parcel data = Parcel.obtain();
4414 Parcel reply = Parcel.obtain();
4415 data.writeInterfaceToken(IActivityManager.descriptor);
4416 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004417 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004418 data.writeInt(managed ? 1 : 0);
4419 data.writeString(path);
4420 if (fd != null) {
4421 data.writeInt(1);
4422 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4423 } else {
4424 data.writeInt(0);
4425 }
4426 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4427 reply.readException();
4428 boolean res = reply.readInt() != 0;
4429 reply.recycle();
4430 data.recycle();
4431 return res;
4432 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004433
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004434 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004435 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004436 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004437 Parcel data = Parcel.obtain();
4438 Parcel reply = Parcel.obtain();
4439 data.writeInterfaceToken(IActivityManager.descriptor);
4440 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004441 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004442 data.writeTypedArray(intents, 0);
4443 data.writeStringArray(resolvedTypes);
4444 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004445 if (options != null) {
4446 data.writeInt(1);
4447 options.writeToParcel(data, 0);
4448 } else {
4449 data.writeInt(0);
4450 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004451 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004452 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4453 reply.readException();
4454 int result = reply.readInt();
4455 reply.recycle();
4456 data.recycle();
4457 return result;
4458 }
4459
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004460 public int getFrontActivityScreenCompatMode() throws RemoteException {
4461 Parcel data = Parcel.obtain();
4462 Parcel reply = Parcel.obtain();
4463 data.writeInterfaceToken(IActivityManager.descriptor);
4464 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4465 reply.readException();
4466 int mode = reply.readInt();
4467 reply.recycle();
4468 data.recycle();
4469 return mode;
4470 }
4471
4472 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4473 Parcel data = Parcel.obtain();
4474 Parcel reply = Parcel.obtain();
4475 data.writeInterfaceToken(IActivityManager.descriptor);
4476 data.writeInt(mode);
4477 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4478 reply.readException();
4479 reply.recycle();
4480 data.recycle();
4481 }
4482
4483 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4484 Parcel data = Parcel.obtain();
4485 Parcel reply = Parcel.obtain();
4486 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004487 data.writeString(packageName);
4488 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004489 reply.readException();
4490 int mode = reply.readInt();
4491 reply.recycle();
4492 data.recycle();
4493 return mode;
4494 }
4495
4496 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004497 throws RemoteException {
4498 Parcel data = Parcel.obtain();
4499 Parcel reply = Parcel.obtain();
4500 data.writeInterfaceToken(IActivityManager.descriptor);
4501 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004502 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004503 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4504 reply.readException();
4505 reply.recycle();
4506 data.recycle();
4507 }
4508
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004509 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4510 Parcel data = Parcel.obtain();
4511 Parcel reply = Parcel.obtain();
4512 data.writeInterfaceToken(IActivityManager.descriptor);
4513 data.writeString(packageName);
4514 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4515 reply.readException();
4516 boolean ask = reply.readInt() != 0;
4517 reply.recycle();
4518 data.recycle();
4519 return ask;
4520 }
4521
4522 public void setPackageAskScreenCompat(String packageName, boolean ask)
4523 throws RemoteException {
4524 Parcel data = Parcel.obtain();
4525 Parcel reply = Parcel.obtain();
4526 data.writeInterfaceToken(IActivityManager.descriptor);
4527 data.writeString(packageName);
4528 data.writeInt(ask ? 1 : 0);
4529 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4530 reply.readException();
4531 reply.recycle();
4532 data.recycle();
4533 }
4534
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004535 public boolean switchUser(int userid) throws RemoteException {
4536 Parcel data = Parcel.obtain();
4537 Parcel reply = Parcel.obtain();
4538 data.writeInterfaceToken(IActivityManager.descriptor);
4539 data.writeInt(userid);
4540 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4541 reply.readException();
4542 boolean result = reply.readInt() != 0;
4543 reply.recycle();
4544 data.recycle();
4545 return result;
4546 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004547
Kenny Guy08488bf2014-02-21 17:40:37 +00004548 public boolean startUserInBackground(int userid) throws RemoteException {
4549 Parcel data = Parcel.obtain();
4550 Parcel reply = Parcel.obtain();
4551 data.writeInterfaceToken(IActivityManager.descriptor);
4552 data.writeInt(userid);
4553 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4554 reply.readException();
4555 boolean result = reply.readInt() != 0;
4556 reply.recycle();
4557 data.recycle();
4558 return result;
4559 }
4560
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004561 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4562 Parcel data = Parcel.obtain();
4563 Parcel reply = Parcel.obtain();
4564 data.writeInterfaceToken(IActivityManager.descriptor);
4565 data.writeInt(userid);
4566 data.writeStrongInterface(callback);
4567 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4568 reply.readException();
4569 int result = reply.readInt();
4570 reply.recycle();
4571 data.recycle();
4572 return result;
4573 }
4574
Amith Yamasani52f1d752012-03-28 18:19:29 -07004575 public UserInfo getCurrentUser() throws RemoteException {
4576 Parcel data = Parcel.obtain();
4577 Parcel reply = Parcel.obtain();
4578 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004579 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004580 reply.readException();
4581 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4582 reply.recycle();
4583 data.recycle();
4584 return userInfo;
4585 }
4586
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004587 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004588 Parcel data = Parcel.obtain();
4589 Parcel reply = Parcel.obtain();
4590 data.writeInterfaceToken(IActivityManager.descriptor);
4591 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004592 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004593 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4594 reply.readException();
4595 boolean result = reply.readInt() != 0;
4596 reply.recycle();
4597 data.recycle();
4598 return result;
4599 }
4600
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004601 public int[] getRunningUserIds() throws RemoteException {
4602 Parcel data = Parcel.obtain();
4603 Parcel reply = Parcel.obtain();
4604 data.writeInterfaceToken(IActivityManager.descriptor);
4605 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4606 reply.readException();
4607 int[] result = reply.createIntArray();
4608 reply.recycle();
4609 data.recycle();
4610 return result;
4611 }
4612
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004613 public boolean removeTask(int taskId, int flags) throws RemoteException {
4614 Parcel data = Parcel.obtain();
4615 Parcel reply = Parcel.obtain();
4616 data.writeInterfaceToken(IActivityManager.descriptor);
4617 data.writeInt(taskId);
4618 data.writeInt(flags);
4619 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4620 reply.readException();
4621 boolean result = reply.readInt() != 0;
4622 reply.recycle();
4623 data.recycle();
4624 return result;
4625 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004626
Jeff Sharkeya4620792011-05-20 15:29:23 -07004627 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4628 Parcel data = Parcel.obtain();
4629 Parcel reply = Parcel.obtain();
4630 data.writeInterfaceToken(IActivityManager.descriptor);
4631 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4632 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4633 reply.readException();
4634 data.recycle();
4635 reply.recycle();
4636 }
4637
4638 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4639 Parcel data = Parcel.obtain();
4640 Parcel reply = Parcel.obtain();
4641 data.writeInterfaceToken(IActivityManager.descriptor);
4642 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4643 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4644 reply.readException();
4645 data.recycle();
4646 reply.recycle();
4647 }
4648
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004649 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4650 Parcel data = Parcel.obtain();
4651 Parcel reply = Parcel.obtain();
4652 data.writeInterfaceToken(IActivityManager.descriptor);
4653 data.writeStrongBinder(sender.asBinder());
4654 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4655 reply.readException();
4656 boolean res = reply.readInt() != 0;
4657 data.recycle();
4658 reply.recycle();
4659 return res;
4660 }
4661
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004662 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4663 Parcel data = Parcel.obtain();
4664 Parcel reply = Parcel.obtain();
4665 data.writeInterfaceToken(IActivityManager.descriptor);
4666 data.writeStrongBinder(sender.asBinder());
4667 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4668 reply.readException();
4669 boolean res = reply.readInt() != 0;
4670 data.recycle();
4671 reply.recycle();
4672 return res;
4673 }
4674
Dianne Hackborn81038902012-11-26 17:04:09 -08004675 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4676 Parcel data = Parcel.obtain();
4677 Parcel reply = Parcel.obtain();
4678 data.writeInterfaceToken(IActivityManager.descriptor);
4679 data.writeStrongBinder(sender.asBinder());
4680 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4681 reply.readException();
4682 Intent res = reply.readInt() != 0
4683 ? Intent.CREATOR.createFromParcel(reply) : null;
4684 data.recycle();
4685 reply.recycle();
4686 return res;
4687 }
4688
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004689 public String getTagForIntentSender(IIntentSender sender, String prefix)
4690 throws RemoteException {
4691 Parcel data = Parcel.obtain();
4692 Parcel reply = Parcel.obtain();
4693 data.writeInterfaceToken(IActivityManager.descriptor);
4694 data.writeStrongBinder(sender.asBinder());
4695 data.writeString(prefix);
4696 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4697 reply.readException();
4698 String res = reply.readString();
4699 data.recycle();
4700 reply.recycle();
4701 return res;
4702 }
4703
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004704 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4705 {
4706 Parcel data = Parcel.obtain();
4707 Parcel reply = Parcel.obtain();
4708 data.writeInterfaceToken(IActivityManager.descriptor);
4709 values.writeToParcel(data, 0);
4710 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4711 reply.readException();
4712 data.recycle();
4713 reply.recycle();
4714 }
4715
Dianne Hackbornb437e092011-08-05 17:50:29 -07004716 public long[] getProcessPss(int[] pids) throws RemoteException {
4717 Parcel data = Parcel.obtain();
4718 Parcel reply = Parcel.obtain();
4719 data.writeInterfaceToken(IActivityManager.descriptor);
4720 data.writeIntArray(pids);
4721 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4722 reply.readException();
4723 long[] res = reply.createLongArray();
4724 data.recycle();
4725 reply.recycle();
4726 return res;
4727 }
4728
Dianne Hackborn661cd522011-08-22 00:26:20 -07004729 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4730 Parcel data = Parcel.obtain();
4731 Parcel reply = Parcel.obtain();
4732 data.writeInterfaceToken(IActivityManager.descriptor);
4733 TextUtils.writeToParcel(msg, data, 0);
4734 data.writeInt(always ? 1 : 0);
4735 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4736 reply.readException();
4737 data.recycle();
4738 reply.recycle();
4739 }
4740
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004741 public void dismissKeyguardOnNextActivity() throws RemoteException {
4742 Parcel data = Parcel.obtain();
4743 Parcel reply = Parcel.obtain();
4744 data.writeInterfaceToken(IActivityManager.descriptor);
4745 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4746 reply.readException();
4747 data.recycle();
4748 reply.recycle();
4749 }
4750
Adam Powelldd8fab22012-03-22 17:47:27 -07004751 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4752 throws RemoteException {
4753 Parcel data = Parcel.obtain();
4754 Parcel reply = Parcel.obtain();
4755 data.writeInterfaceToken(IActivityManager.descriptor);
4756 data.writeStrongBinder(token);
4757 data.writeString(destAffinity);
4758 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4759 reply.readException();
4760 boolean result = reply.readInt() != 0;
4761 data.recycle();
4762 reply.recycle();
4763 return result;
4764 }
4765
4766 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4767 throws RemoteException {
4768 Parcel data = Parcel.obtain();
4769 Parcel reply = Parcel.obtain();
4770 data.writeInterfaceToken(IActivityManager.descriptor);
4771 data.writeStrongBinder(token);
4772 target.writeToParcel(data, 0);
4773 data.writeInt(resultCode);
4774 if (resultData != null) {
4775 data.writeInt(1);
4776 resultData.writeToParcel(data, 0);
4777 } else {
4778 data.writeInt(0);
4779 }
4780 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4781 reply.readException();
4782 boolean result = reply.readInt() != 0;
4783 data.recycle();
4784 reply.recycle();
4785 return result;
4786 }
4787
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004788 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4789 Parcel data = Parcel.obtain();
4790 Parcel reply = Parcel.obtain();
4791 data.writeInterfaceToken(IActivityManager.descriptor);
4792 data.writeStrongBinder(activityToken);
4793 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4794 reply.readException();
4795 int result = reply.readInt();
4796 data.recycle();
4797 reply.recycle();
4798 return result;
4799 }
4800
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004801 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4802 Parcel data = Parcel.obtain();
4803 Parcel reply = Parcel.obtain();
4804 data.writeInterfaceToken(IActivityManager.descriptor);
4805 data.writeStrongBinder(activityToken);
4806 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4807 reply.readException();
4808 String result = reply.readString();
4809 data.recycle();
4810 reply.recycle();
4811 return result;
4812 }
4813
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004814 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4815 Parcel data = Parcel.obtain();
4816 Parcel reply = Parcel.obtain();
4817 data.writeInterfaceToken(IActivityManager.descriptor);
4818 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4819 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4820 reply.readException();
4821 data.recycle();
4822 reply.recycle();
4823 }
4824
4825 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4826 Parcel data = Parcel.obtain();
4827 Parcel reply = Parcel.obtain();
4828 data.writeInterfaceToken(IActivityManager.descriptor);
4829 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4830 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4831 reply.readException();
4832 data.recycle();
4833 reply.recycle();
4834 }
4835
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004836 public void requestBugReport() throws RemoteException {
4837 Parcel data = Parcel.obtain();
4838 Parcel reply = Parcel.obtain();
4839 data.writeInterfaceToken(IActivityManager.descriptor);
4840 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4841 reply.readException();
4842 data.recycle();
4843 reply.recycle();
4844 }
4845
Jeff Brownbd181bb2013-09-10 16:44:24 -07004846 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4847 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004848 Parcel data = Parcel.obtain();
4849 Parcel reply = Parcel.obtain();
4850 data.writeInterfaceToken(IActivityManager.descriptor);
4851 data.writeInt(pid);
4852 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004853 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004854 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4855 reply.readException();
4856 long res = reply.readInt();
4857 data.recycle();
4858 reply.recycle();
4859 return res;
4860 }
4861
Adam Skorydfc7fd72013-08-05 19:23:41 -07004862 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004863 Parcel data = Parcel.obtain();
4864 Parcel reply = Parcel.obtain();
4865 data.writeInterfaceToken(IActivityManager.descriptor);
4866 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004867 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004868 reply.readException();
4869 Bundle res = reply.readBundle();
4870 data.recycle();
4871 reply.recycle();
4872 return res;
4873 }
4874
Adam Skory7140a252013-09-11 12:04:58 +01004875 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004876 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004877 Parcel data = Parcel.obtain();
4878 Parcel reply = Parcel.obtain();
4879 data.writeInterfaceToken(IActivityManager.descriptor);
4880 data.writeStrongBinder(token);
4881 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004882 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004883 reply.readException();
4884 data.recycle();
4885 reply.recycle();
4886 }
4887
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004888 public void killUid(int uid, String reason) throws RemoteException {
4889 Parcel data = Parcel.obtain();
4890 Parcel reply = Parcel.obtain();
4891 data.writeInterfaceToken(IActivityManager.descriptor);
4892 data.writeInt(uid);
4893 data.writeString(reason);
4894 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4895 reply.readException();
4896 data.recycle();
4897 reply.recycle();
4898 }
4899
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004900 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4901 Parcel data = Parcel.obtain();
4902 Parcel reply = Parcel.obtain();
4903 data.writeInterfaceToken(IActivityManager.descriptor);
4904 data.writeStrongBinder(who);
4905 data.writeInt(allowRestart ? 1 : 0);
4906 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4907 reply.readException();
4908 data.recycle();
4909 reply.recycle();
4910 }
4911
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004912 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4913 Parcel data = Parcel.obtain();
4914 Parcel reply = Parcel.obtain();
4915 data.writeInterfaceToken(IActivityManager.descriptor);
4916 data.writeStrongBinder(token);
4917 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4918 reply.readException();
4919 data.recycle();
4920 reply.recycle();
4921 }
4922
Craig Mautner5eda9b32013-07-02 11:58:16 -07004923 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4924 Parcel data = Parcel.obtain();
4925 Parcel reply = Parcel.obtain();
4926 data.writeInterfaceToken(IActivityManager.descriptor);
4927 data.writeStrongBinder(token);
4928 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4929 reply.readException();
4930 data.recycle();
4931 reply.recycle();
4932 }
4933
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004934 public void restart() throws RemoteException {
4935 Parcel data = Parcel.obtain();
4936 Parcel reply = Parcel.obtain();
4937 data.writeInterfaceToken(IActivityManager.descriptor);
4938 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4939 reply.readException();
4940 data.recycle();
4941 reply.recycle();
4942 }
4943
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004944 public void performIdleMaintenance() throws RemoteException {
4945 Parcel data = Parcel.obtain();
4946 Parcel reply = Parcel.obtain();
4947 data.writeInterfaceToken(IActivityManager.descriptor);
4948 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4949 reply.readException();
4950 data.recycle();
4951 reply.recycle();
4952 }
4953
Craig Mautner4a1cb222013-12-04 16:14:06 -08004954 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4955 IActivityContainerCallback callback) throws RemoteException {
4956 Parcel data = Parcel.obtain();
4957 Parcel reply = Parcel.obtain();
4958 data.writeInterfaceToken(IActivityManager.descriptor);
4959 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07004960 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08004961 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4962 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004963 final int result = reply.readInt();
4964 final IActivityContainer res;
4965 if (result == 1) {
4966 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4967 } else {
4968 res = null;
4969 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004970 data.recycle();
4971 reply.recycle();
4972 return res;
4973 }
4974
Craig Mautner95da1082014-02-24 17:54:35 -08004975 public void deleteActivityContainer(IActivityContainer activityContainer)
4976 throws RemoteException {
4977 Parcel data = Parcel.obtain();
4978 Parcel reply = Parcel.obtain();
4979 data.writeInterfaceToken(IActivityManager.descriptor);
4980 data.writeStrongBinder(activityContainer.asBinder());
4981 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4982 reply.readException();
4983 data.recycle();
4984 reply.recycle();
4985 }
4986
Craig Mautnere0a38842013-12-16 16:14:02 -08004987 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4988 throws RemoteException {
4989 Parcel data = Parcel.obtain();
4990 Parcel reply = Parcel.obtain();
4991 data.writeInterfaceToken(IActivityManager.descriptor);
4992 data.writeStrongBinder(activityToken);
4993 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4994 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004995 final int result = reply.readInt();
4996 final IActivityContainer res;
4997 if (result == 1) {
4998 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4999 } else {
5000 res = null;
5001 }
Craig Mautnere0a38842013-12-16 16:14:02 -08005002 data.recycle();
5003 reply.recycle();
5004 return res;
5005 }
5006
Craig Mautner4a1cb222013-12-04 16:14:06 -08005007 public IBinder getHomeActivityToken() throws RemoteException {
5008 Parcel data = Parcel.obtain();
5009 Parcel reply = Parcel.obtain();
5010 data.writeInterfaceToken(IActivityManager.descriptor);
5011 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5012 reply.readException();
5013 IBinder res = reply.readStrongBinder();
5014 data.recycle();
5015 reply.recycle();
5016 return res;
5017 }
5018
Craig Mautneraea74a52014-03-08 14:23:10 -08005019 @Override
5020 public void startLockTaskMode(int taskId) throws RemoteException {
5021 Parcel data = Parcel.obtain();
5022 Parcel reply = Parcel.obtain();
5023 data.writeInterfaceToken(IActivityManager.descriptor);
5024 data.writeInt(taskId);
5025 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5026 reply.readException();
5027 data.recycle();
5028 reply.recycle();
5029 }
5030
5031 @Override
5032 public void startLockTaskMode(IBinder token) throws RemoteException {
5033 Parcel data = Parcel.obtain();
5034 Parcel reply = Parcel.obtain();
5035 data.writeInterfaceToken(IActivityManager.descriptor);
5036 data.writeStrongBinder(token);
5037 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5038 reply.readException();
5039 data.recycle();
5040 reply.recycle();
5041 }
5042
5043 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005044 public void startLockTaskModeOnCurrent() throws RemoteException {
5045 Parcel data = Parcel.obtain();
5046 Parcel reply = Parcel.obtain();
5047 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005048 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005049 reply.readException();
5050 data.recycle();
5051 reply.recycle();
5052 }
5053
5054 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005055 public void stopLockTaskMode() throws RemoteException {
5056 Parcel data = Parcel.obtain();
5057 Parcel reply = Parcel.obtain();
5058 data.writeInterfaceToken(IActivityManager.descriptor);
5059 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5060 reply.readException();
5061 data.recycle();
5062 reply.recycle();
5063 }
5064
5065 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005066 public void stopLockTaskModeOnCurrent() throws RemoteException {
5067 Parcel data = Parcel.obtain();
5068 Parcel reply = Parcel.obtain();
5069 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005070 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005071 reply.readException();
5072 data.recycle();
5073 reply.recycle();
5074 }
5075
5076 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005077 public boolean isInLockTaskMode() throws RemoteException {
5078 Parcel data = Parcel.obtain();
5079 Parcel reply = Parcel.obtain();
5080 data.writeInterfaceToken(IActivityManager.descriptor);
5081 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5082 reply.readException();
5083 boolean isInLockTaskMode = reply.readInt() == 1;
5084 data.recycle();
5085 reply.recycle();
5086 return isInLockTaskMode;
5087 }
5088
Craig Mautner688b5102014-03-27 16:55:03 -07005089 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005090 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005091 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005092 Parcel data = Parcel.obtain();
5093 Parcel reply = Parcel.obtain();
5094 data.writeInterfaceToken(IActivityManager.descriptor);
5095 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005096 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005097 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005098 reply.readException();
5099 data.recycle();
5100 reply.recycle();
5101 }
5102
Craig Mautneree2e45a2014-06-27 12:10:03 -07005103 @Override
5104 public boolean setMediaPlaying(IBinder token, boolean playing) throws RemoteException {
5105 Parcel data = Parcel.obtain();
5106 Parcel reply = Parcel.obtain();
5107 data.writeInterfaceToken(IActivityManager.descriptor);
5108 data.writeStrongBinder(token);
5109 data.writeInt(playing ? 1 : 0);
5110 mRemote.transact(SET_MEDIA_PLAYING_TRANSACTION, data, reply, 0);
5111 reply.readException();
5112 boolean success = reply.readInt() > 0;
5113 data.recycle();
5114 reply.recycle();
5115 return success;
5116 }
5117
5118 @Override
5119 public boolean isBackgroundMediaPlaying(IBinder token) throws RemoteException {
5120 Parcel data = Parcel.obtain();
5121 Parcel reply = Parcel.obtain();
5122 data.writeInterfaceToken(IActivityManager.descriptor);
5123 data.writeStrongBinder(token);
5124 mRemote.transact(IS_BG_MEDIA_PLAYING_TRANSACTION, data, reply, 0);
5125 reply.readException();
5126 final boolean playing = reply.readInt() > 0;
5127 data.recycle();
5128 reply.recycle();
5129 return playing;
5130 }
5131
5132 @Override
5133 public void mediaResourcesReleased(IBinder token) throws RemoteException {
5134 Parcel data = Parcel.obtain();
5135 Parcel reply = Parcel.obtain();
5136 data.writeInterfaceToken(IActivityManager.descriptor);
5137 data.writeStrongBinder(token);
Craig Mautnerbb742462014-07-07 15:28:55 -07005138 mRemote.transact(MEDIA_RESOURCES_RELEASED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5139 reply.readException();
5140 data.recycle();
5141 reply.recycle();
5142 }
5143
5144 @Override
5145 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5146 Parcel data = Parcel.obtain();
5147 Parcel reply = Parcel.obtain();
5148 data.writeInterfaceToken(IActivityManager.descriptor);
5149 data.writeStrongBinder(token);
5150 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5151 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005152 reply.readException();
5153 data.recycle();
5154 reply.recycle();
5155 }
5156
Craig Mautner8746a472014-07-24 15:12:54 -07005157 @Override
5158 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5159 Parcel data = Parcel.obtain();
5160 Parcel reply = Parcel.obtain();
5161 data.writeInterfaceToken(IActivityManager.descriptor);
5162 data.writeStrongBinder(token);
5163 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5164 IBinder.FLAG_ONEWAY);
5165 reply.readException();
5166 data.recycle();
5167 reply.recycle();
5168 }
5169
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005170 private IBinder mRemote;
5171}