blob: 342155d72674a912f0f1e77adda4190cda208aee [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 Prevotd85fc722014-04-16 19:52:08 +01001664 int userId = data.readInt();
1665 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001666 reply.writeNoException();
1667 return true;
1668 }
1669
1670 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1671 data.enforceInterface(IActivityManager.descriptor);
1672 IBinder owner = data.readStrongBinder();
1673 Uri uri = null;
1674 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001675 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001676 }
1677 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001678 int userId = data.readInt();
1679 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001680 reply.writeNoException();
1681 return true;
1682 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001683
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001684 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1685 data.enforceInterface(IActivityManager.descriptor);
1686 int callingUid = data.readInt();
1687 String targetPkg = data.readString();
1688 Uri uri = Uri.CREATOR.createFromParcel(data);
1689 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001690 int userId = data.readInt();
1691 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001692 reply.writeNoException();
1693 reply.writeInt(res);
1694 return true;
1695 }
1696
Andy McFadden824c5102010-07-09 16:26:57 -07001697 case DUMP_HEAP_TRANSACTION: {
1698 data.enforceInterface(IActivityManager.descriptor);
1699 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001700 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001701 boolean managed = data.readInt() != 0;
1702 String path = data.readString();
1703 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001704 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001705 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001706 reply.writeNoException();
1707 reply.writeInt(res ? 1 : 0);
1708 return true;
1709 }
1710
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001711 case START_ACTIVITIES_TRANSACTION:
1712 {
1713 data.enforceInterface(IActivityManager.descriptor);
1714 IBinder b = data.readStrongBinder();
1715 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001716 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001717 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1718 String[] resolvedTypes = data.createStringArray();
1719 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001720 Bundle options = data.readInt() != 0
1721 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001722 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001723 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001724 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001725 reply.writeNoException();
1726 reply.writeInt(result);
1727 return true;
1728 }
1729
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001730 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1731 {
1732 data.enforceInterface(IActivityManager.descriptor);
1733 int mode = getFrontActivityScreenCompatMode();
1734 reply.writeNoException();
1735 reply.writeInt(mode);
1736 return true;
1737 }
1738
1739 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1740 {
1741 data.enforceInterface(IActivityManager.descriptor);
1742 int mode = data.readInt();
1743 setFrontActivityScreenCompatMode(mode);
1744 reply.writeNoException();
1745 reply.writeInt(mode);
1746 return true;
1747 }
1748
1749 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1750 {
1751 data.enforceInterface(IActivityManager.descriptor);
1752 String pkg = data.readString();
1753 int mode = getPackageScreenCompatMode(pkg);
1754 reply.writeNoException();
1755 reply.writeInt(mode);
1756 return true;
1757 }
1758
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001759 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1760 {
1761 data.enforceInterface(IActivityManager.descriptor);
1762 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001763 int mode = data.readInt();
1764 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001765 reply.writeNoException();
1766 return true;
1767 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001768
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001769 case SWITCH_USER_TRANSACTION: {
1770 data.enforceInterface(IActivityManager.descriptor);
1771 int userid = data.readInt();
1772 boolean result = switchUser(userid);
1773 reply.writeNoException();
1774 reply.writeInt(result ? 1 : 0);
1775 return true;
1776 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001777
Kenny Guy08488bf2014-02-21 17:40:37 +00001778 case START_USER_IN_BACKGROUND_TRANSACTION: {
1779 data.enforceInterface(IActivityManager.descriptor);
1780 int userid = data.readInt();
1781 boolean result = startUserInBackground(userid);
1782 reply.writeNoException();
1783 reply.writeInt(result ? 1 : 0);
1784 return true;
1785 }
1786
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001787 case STOP_USER_TRANSACTION: {
1788 data.enforceInterface(IActivityManager.descriptor);
1789 int userid = data.readInt();
1790 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1791 data.readStrongBinder());
1792 int result = stopUser(userid, callback);
1793 reply.writeNoException();
1794 reply.writeInt(result);
1795 return true;
1796 }
1797
Amith Yamasani52f1d752012-03-28 18:19:29 -07001798 case GET_CURRENT_USER_TRANSACTION: {
1799 data.enforceInterface(IActivityManager.descriptor);
1800 UserInfo userInfo = getCurrentUser();
1801 reply.writeNoException();
1802 userInfo.writeToParcel(reply, 0);
1803 return true;
1804 }
1805
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001806 case IS_USER_RUNNING_TRANSACTION: {
1807 data.enforceInterface(IActivityManager.descriptor);
1808 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001809 boolean orStopping = data.readInt() != 0;
1810 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001811 reply.writeNoException();
1812 reply.writeInt(result ? 1 : 0);
1813 return true;
1814 }
1815
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001816 case GET_RUNNING_USER_IDS_TRANSACTION: {
1817 data.enforceInterface(IActivityManager.descriptor);
1818 int[] result = getRunningUserIds();
1819 reply.writeNoException();
1820 reply.writeIntArray(result);
1821 return true;
1822 }
1823
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001824 case REMOVE_TASK_TRANSACTION:
1825 {
1826 data.enforceInterface(IActivityManager.descriptor);
1827 int taskId = data.readInt();
1828 int fl = data.readInt();
1829 boolean result = removeTask(taskId, fl);
1830 reply.writeNoException();
1831 reply.writeInt(result ? 1 : 0);
1832 return true;
1833 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001834
Jeff Sharkeya4620792011-05-20 15:29:23 -07001835 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1836 data.enforceInterface(IActivityManager.descriptor);
1837 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1838 data.readStrongBinder());
1839 registerProcessObserver(observer);
1840 return true;
1841 }
1842
1843 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1844 data.enforceInterface(IActivityManager.descriptor);
1845 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1846 data.readStrongBinder());
1847 unregisterProcessObserver(observer);
1848 return true;
1849 }
1850
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001851 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1852 {
1853 data.enforceInterface(IActivityManager.descriptor);
1854 String pkg = data.readString();
1855 boolean ask = getPackageAskScreenCompat(pkg);
1856 reply.writeNoException();
1857 reply.writeInt(ask ? 1 : 0);
1858 return true;
1859 }
1860
1861 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1862 {
1863 data.enforceInterface(IActivityManager.descriptor);
1864 String pkg = data.readString();
1865 boolean ask = data.readInt() != 0;
1866 setPackageAskScreenCompat(pkg, ask);
1867 reply.writeNoException();
1868 return true;
1869 }
1870
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001871 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1872 data.enforceInterface(IActivityManager.descriptor);
1873 IIntentSender r = IIntentSender.Stub.asInterface(
1874 data.readStrongBinder());
1875 boolean res = isIntentSenderTargetedToPackage(r);
1876 reply.writeNoException();
1877 reply.writeInt(res ? 1 : 0);
1878 return true;
1879 }
1880
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001881 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1882 data.enforceInterface(IActivityManager.descriptor);
1883 IIntentSender r = IIntentSender.Stub.asInterface(
1884 data.readStrongBinder());
1885 boolean res = isIntentSenderAnActivity(r);
1886 reply.writeNoException();
1887 reply.writeInt(res ? 1 : 0);
1888 return true;
1889 }
1890
Dianne Hackborn81038902012-11-26 17:04:09 -08001891 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1892 data.enforceInterface(IActivityManager.descriptor);
1893 IIntentSender r = IIntentSender.Stub.asInterface(
1894 data.readStrongBinder());
1895 Intent intent = getIntentForIntentSender(r);
1896 reply.writeNoException();
1897 if (intent != null) {
1898 reply.writeInt(1);
1899 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1900 } else {
1901 reply.writeInt(0);
1902 }
1903 return true;
1904 }
1905
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001906 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1907 data.enforceInterface(IActivityManager.descriptor);
1908 IIntentSender r = IIntentSender.Stub.asInterface(
1909 data.readStrongBinder());
1910 String prefix = data.readString();
1911 String tag = getTagForIntentSender(r, prefix);
1912 reply.writeNoException();
1913 reply.writeString(tag);
1914 return true;
1915 }
1916
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001917 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1918 data.enforceInterface(IActivityManager.descriptor);
1919 Configuration config = Configuration.CREATOR.createFromParcel(data);
1920 updatePersistentConfiguration(config);
1921 reply.writeNoException();
1922 return true;
1923 }
1924
Dianne Hackbornb437e092011-08-05 17:50:29 -07001925 case GET_PROCESS_PSS_TRANSACTION: {
1926 data.enforceInterface(IActivityManager.descriptor);
1927 int[] pids = data.createIntArray();
1928 long[] pss = getProcessPss(pids);
1929 reply.writeNoException();
1930 reply.writeLongArray(pss);
1931 return true;
1932 }
1933
Dianne Hackborn661cd522011-08-22 00:26:20 -07001934 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1935 data.enforceInterface(IActivityManager.descriptor);
1936 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1937 boolean always = data.readInt() != 0;
1938 showBootMessage(msg, always);
1939 reply.writeNoException();
1940 return true;
1941 }
1942
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001943 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1944 data.enforceInterface(IActivityManager.descriptor);
1945 dismissKeyguardOnNextActivity();
1946 reply.writeNoException();
1947 return true;
1948 }
1949
Adam Powelldd8fab22012-03-22 17:47:27 -07001950 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1951 data.enforceInterface(IActivityManager.descriptor);
1952 IBinder token = data.readStrongBinder();
1953 String destAffinity = data.readString();
1954 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1955 reply.writeNoException();
1956 reply.writeInt(res ? 1 : 0);
1957 return true;
1958 }
1959
1960 case NAVIGATE_UP_TO_TRANSACTION: {
1961 data.enforceInterface(IActivityManager.descriptor);
1962 IBinder token = data.readStrongBinder();
1963 Intent target = Intent.CREATOR.createFromParcel(data);
1964 int resultCode = data.readInt();
1965 Intent resultData = null;
1966 if (data.readInt() != 0) {
1967 resultData = Intent.CREATOR.createFromParcel(data);
1968 }
1969 boolean res = navigateUpTo(token, target, resultCode, resultData);
1970 reply.writeNoException();
1971 reply.writeInt(res ? 1 : 0);
1972 return true;
1973 }
1974
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001975 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1976 data.enforceInterface(IActivityManager.descriptor);
1977 IBinder token = data.readStrongBinder();
1978 int res = getLaunchedFromUid(token);
1979 reply.writeNoException();
1980 reply.writeInt(res);
1981 return true;
1982 }
1983
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001984 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1985 data.enforceInterface(IActivityManager.descriptor);
1986 IBinder token = data.readStrongBinder();
1987 String res = getLaunchedFromPackage(token);
1988 reply.writeNoException();
1989 reply.writeString(res);
1990 return true;
1991 }
1992
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001993 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1994 data.enforceInterface(IActivityManager.descriptor);
1995 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1996 data.readStrongBinder());
1997 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001998 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001999 return true;
2000 }
2001
2002 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2003 data.enforceInterface(IActivityManager.descriptor);
2004 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2005 data.readStrongBinder());
2006 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002007 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002008 return true;
2009 }
2010
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002011 case REQUEST_BUG_REPORT_TRANSACTION: {
2012 data.enforceInterface(IActivityManager.descriptor);
2013 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002014 reply.writeNoException();
2015 return true;
2016 }
2017
2018 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2019 data.enforceInterface(IActivityManager.descriptor);
2020 int pid = data.readInt();
2021 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002022 String reason = data.readString();
2023 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002024 reply.writeNoException();
2025 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002026 return true;
2027 }
2028
Adam Skorydfc7fd72013-08-05 19:23:41 -07002029 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002030 data.enforceInterface(IActivityManager.descriptor);
2031 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002032 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002033 reply.writeNoException();
2034 reply.writeBundle(res);
2035 return true;
2036 }
2037
Adam Skorydfc7fd72013-08-05 19:23:41 -07002038 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002039 data.enforceInterface(IActivityManager.descriptor);
2040 IBinder token = data.readStrongBinder();
2041 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002042 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002043 reply.writeNoException();
2044 return true;
2045 }
2046
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002047 case KILL_UID_TRANSACTION: {
2048 data.enforceInterface(IActivityManager.descriptor);
2049 int uid = data.readInt();
2050 String reason = data.readString();
2051 killUid(uid, reason);
2052 reply.writeNoException();
2053 return true;
2054 }
2055
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002056 case HANG_TRANSACTION: {
2057 data.enforceInterface(IActivityManager.descriptor);
2058 IBinder who = data.readStrongBinder();
2059 boolean allowRestart = data.readInt() != 0;
2060 hang(who, allowRestart);
2061 reply.writeNoException();
2062 return true;
2063 }
2064
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002065 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2066 data.enforceInterface(IActivityManager.descriptor);
2067 IBinder token = data.readStrongBinder();
2068 reportActivityFullyDrawn(token);
2069 reply.writeNoException();
2070 return true;
2071 }
2072
Craig Mautner5eda9b32013-07-02 11:58:16 -07002073 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2074 data.enforceInterface(IActivityManager.descriptor);
2075 IBinder token = data.readStrongBinder();
2076 notifyActivityDrawn(token);
2077 reply.writeNoException();
2078 return true;
2079 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002080
2081 case RESTART_TRANSACTION: {
2082 data.enforceInterface(IActivityManager.descriptor);
2083 restart();
2084 reply.writeNoException();
2085 return true;
2086 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002087
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002088 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2089 data.enforceInterface(IActivityManager.descriptor);
2090 performIdleMaintenance();
2091 reply.writeNoException();
2092 return true;
2093 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002094
2095 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2096 data.enforceInterface(IActivityManager.descriptor);
2097 IBinder parentActivityToken = data.readStrongBinder();
2098 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002099 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002100 IActivityContainer activityContainer =
2101 createActivityContainer(parentActivityToken, callback);
2102 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002103 if (activityContainer != null) {
2104 reply.writeInt(1);
2105 reply.writeStrongBinder(activityContainer.asBinder());
2106 } else {
2107 reply.writeInt(0);
2108 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002109 return true;
2110 }
2111
Craig Mautner95da1082014-02-24 17:54:35 -08002112 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2113 data.enforceInterface(IActivityManager.descriptor);
2114 IActivityContainer activityContainer =
2115 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2116 deleteActivityContainer(activityContainer);
2117 reply.writeNoException();
2118 return true;
2119 }
2120
Craig Mautnere0a38842013-12-16 16:14:02 -08002121 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2122 data.enforceInterface(IActivityManager.descriptor);
2123 IBinder activityToken = data.readStrongBinder();
2124 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2125 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002126 if (activityContainer != null) {
2127 reply.writeInt(1);
2128 reply.writeStrongBinder(activityContainer.asBinder());
2129 } else {
2130 reply.writeInt(0);
2131 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002132 return true;
2133 }
2134
Craig Mautner4a1cb222013-12-04 16:14:06 -08002135 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2136 data.enforceInterface(IActivityManager.descriptor);
2137 IBinder homeActivityToken = getHomeActivityToken();
2138 reply.writeNoException();
2139 reply.writeStrongBinder(homeActivityToken);
2140 return true;
2141 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002142
2143 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2144 data.enforceInterface(IActivityManager.descriptor);
2145 final int taskId = data.readInt();
2146 startLockTaskMode(taskId);
2147 reply.writeNoException();
2148 return true;
2149 }
2150
2151 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2152 data.enforceInterface(IActivityManager.descriptor);
2153 IBinder token = data.readStrongBinder();
2154 startLockTaskMode(token);
2155 reply.writeNoException();
2156 return true;
2157 }
2158
Craig Mautnerd61dc202014-07-07 11:09:11 -07002159 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002160 data.enforceInterface(IActivityManager.descriptor);
2161 startLockTaskModeOnCurrent();
2162 reply.writeNoException();
2163 return true;
2164 }
2165
Craig Mautneraea74a52014-03-08 14:23:10 -08002166 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2167 data.enforceInterface(IActivityManager.descriptor);
2168 stopLockTaskMode();
2169 reply.writeNoException();
2170 return true;
2171 }
2172
Craig Mautnerd61dc202014-07-07 11:09:11 -07002173 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002174 data.enforceInterface(IActivityManager.descriptor);
2175 stopLockTaskModeOnCurrent();
2176 reply.writeNoException();
2177 return true;
2178 }
2179
Craig Mautneraea74a52014-03-08 14:23:10 -08002180 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2181 data.enforceInterface(IActivityManager.descriptor);
2182 final boolean isInLockTaskMode = isInLockTaskMode();
2183 reply.writeNoException();
2184 reply.writeInt(isInLockTaskMode ? 1 : 0);
2185 return true;
2186 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002187
Winson Chunga449dc02014-05-16 11:15:04 -07002188 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002189 data.enforceInterface(IActivityManager.descriptor);
2190 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002191 ActivityManager.TaskDescription values =
2192 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2193 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002194 reply.writeNoException();
2195 return true;
2196 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002197
2198 case SET_MEDIA_PLAYING_TRANSACTION: {
2199 data.enforceInterface(IActivityManager.descriptor);
2200 IBinder token = data.readStrongBinder();
2201 boolean enable = data.readInt() > 0;
2202 boolean success = setMediaPlaying(token, enable);
2203 reply.writeNoException();
2204 reply.writeInt(success ? 1 : 0);
2205 return true;
2206 }
2207
2208 case IS_BG_MEDIA_PLAYING_TRANSACTION: {
2209 data.enforceInterface(IActivityManager.descriptor);
2210 IBinder token = data.readStrongBinder();
2211 final boolean enabled = isBackgroundMediaPlaying(token);
2212 reply.writeNoException();
2213 reply.writeInt(enabled ? 1 : 0);
2214 return true;
2215 }
2216
Craig Mautnerbb742462014-07-07 15:28:55 -07002217 case MEDIA_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002218 data.enforceInterface(IActivityManager.descriptor);
2219 IBinder token = data.readStrongBinder();
2220 mediaResourcesReleased(token);
2221 reply.writeNoException();
2222 return true;
2223 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002224
2225 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2226 data.enforceInterface(IActivityManager.descriptor);
2227 IBinder token = data.readStrongBinder();
2228 notifyLaunchTaskBehindComplete(token);
2229 reply.writeNoException();
2230 return true;
2231 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002232 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002233
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002234 return super.onTransact(code, data, reply, flags);
2235 }
2236
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002237 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002238 return this;
2239 }
2240
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002241 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2242 protected IActivityManager create() {
2243 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002244 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002245 Log.v("ActivityManager", "default service binder = " + b);
2246 }
2247 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002248 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002249 Log.v("ActivityManager", "default service = " + am);
2250 }
2251 return am;
2252 }
2253 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002254}
2255
2256class ActivityManagerProxy implements IActivityManager
2257{
2258 public ActivityManagerProxy(IBinder remote)
2259 {
2260 mRemote = remote;
2261 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002262
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002263 public IBinder asBinder()
2264 {
2265 return mRemote;
2266 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002267
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002268 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002269 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2270 int startFlags, String profileFile,
2271 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002272 Parcel data = Parcel.obtain();
2273 Parcel reply = Parcel.obtain();
2274 data.writeInterfaceToken(IActivityManager.descriptor);
2275 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002276 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002277 intent.writeToParcel(data, 0);
2278 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002279 data.writeStrongBinder(resultTo);
2280 data.writeString(resultWho);
2281 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002282 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002283 data.writeString(profileFile);
2284 if (profileFd != null) {
2285 data.writeInt(1);
2286 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2287 } else {
2288 data.writeInt(0);
2289 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002290 if (options != null) {
2291 data.writeInt(1);
2292 options.writeToParcel(data, 0);
2293 } else {
2294 data.writeInt(0);
2295 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002296 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2297 reply.readException();
2298 int result = reply.readInt();
2299 reply.recycle();
2300 data.recycle();
2301 return result;
2302 }
Amith Yamasani82644082012-08-03 13:09:11 -07002303
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002304 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002305 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2306 int startFlags, String profileFile,
2307 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2308 Parcel data = Parcel.obtain();
2309 Parcel reply = Parcel.obtain();
2310 data.writeInterfaceToken(IActivityManager.descriptor);
2311 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002312 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002313 intent.writeToParcel(data, 0);
2314 data.writeString(resolvedType);
2315 data.writeStrongBinder(resultTo);
2316 data.writeString(resultWho);
2317 data.writeInt(requestCode);
2318 data.writeInt(startFlags);
2319 data.writeString(profileFile);
2320 if (profileFd != null) {
2321 data.writeInt(1);
2322 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2323 } else {
2324 data.writeInt(0);
2325 }
2326 if (options != null) {
2327 data.writeInt(1);
2328 options.writeToParcel(data, 0);
2329 } else {
2330 data.writeInt(0);
2331 }
2332 data.writeInt(userId);
2333 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2334 reply.readException();
2335 int result = reply.readInt();
2336 reply.recycle();
2337 data.recycle();
2338 return result;
2339 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002340 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2341 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002342 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002343 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002344 Parcel data = Parcel.obtain();
2345 Parcel reply = Parcel.obtain();
2346 data.writeInterfaceToken(IActivityManager.descriptor);
2347 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002348 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002349 intent.writeToParcel(data, 0);
2350 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002351 data.writeStrongBinder(resultTo);
2352 data.writeString(resultWho);
2353 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002354 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002355 data.writeString(profileFile);
2356 if (profileFd != null) {
2357 data.writeInt(1);
2358 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2359 } else {
2360 data.writeInt(0);
2361 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002362 if (options != null) {
2363 data.writeInt(1);
2364 options.writeToParcel(data, 0);
2365 } else {
2366 data.writeInt(0);
2367 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002368 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002369 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2370 reply.readException();
2371 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2372 reply.recycle();
2373 data.recycle();
2374 return result;
2375 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002376 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2377 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002378 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002379 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002380 Parcel data = Parcel.obtain();
2381 Parcel reply = Parcel.obtain();
2382 data.writeInterfaceToken(IActivityManager.descriptor);
2383 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002384 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002385 intent.writeToParcel(data, 0);
2386 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002387 data.writeStrongBinder(resultTo);
2388 data.writeString(resultWho);
2389 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002390 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002391 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002392 if (options != null) {
2393 data.writeInt(1);
2394 options.writeToParcel(data, 0);
2395 } else {
2396 data.writeInt(0);
2397 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002398 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002399 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2400 reply.readException();
2401 int result = reply.readInt();
2402 reply.recycle();
2403 data.recycle();
2404 return result;
2405 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002406 public int startActivityIntentSender(IApplicationThread caller,
2407 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002408 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002409 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002410 Parcel data = Parcel.obtain();
2411 Parcel reply = Parcel.obtain();
2412 data.writeInterfaceToken(IActivityManager.descriptor);
2413 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2414 intent.writeToParcel(data, 0);
2415 if (fillInIntent != null) {
2416 data.writeInt(1);
2417 fillInIntent.writeToParcel(data, 0);
2418 } else {
2419 data.writeInt(0);
2420 }
2421 data.writeString(resolvedType);
2422 data.writeStrongBinder(resultTo);
2423 data.writeString(resultWho);
2424 data.writeInt(requestCode);
2425 data.writeInt(flagsMask);
2426 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002427 if (options != null) {
2428 data.writeInt(1);
2429 options.writeToParcel(data, 0);
2430 } else {
2431 data.writeInt(0);
2432 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002433 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002434 reply.readException();
2435 int result = reply.readInt();
2436 reply.recycle();
2437 data.recycle();
2438 return result;
2439 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002440 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2441 Intent intent, String resolvedType, IVoiceInteractionSession session,
2442 IVoiceInteractor interactor, int startFlags, String profileFile,
2443 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2444 Parcel data = Parcel.obtain();
2445 Parcel reply = Parcel.obtain();
2446 data.writeInterfaceToken(IActivityManager.descriptor);
2447 data.writeString(callingPackage);
2448 data.writeInt(callingPid);
2449 data.writeInt(callingUid);
2450 intent.writeToParcel(data, 0);
2451 data.writeString(resolvedType);
2452 data.writeStrongBinder(session.asBinder());
2453 data.writeStrongBinder(interactor.asBinder());
2454 data.writeInt(startFlags);
2455 data.writeString(profileFile);
2456 if (profileFd != null) {
2457 data.writeInt(1);
2458 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2459 } else {
2460 data.writeInt(0);
2461 }
2462 if (options != null) {
2463 data.writeInt(1);
2464 options.writeToParcel(data, 0);
2465 } else {
2466 data.writeInt(0);
2467 }
2468 data.writeInt(userId);
2469 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2470 reply.readException();
2471 int result = reply.readInt();
2472 reply.recycle();
2473 data.recycle();
2474 return result;
2475 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002476 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002477 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002478 Parcel data = Parcel.obtain();
2479 Parcel reply = Parcel.obtain();
2480 data.writeInterfaceToken(IActivityManager.descriptor);
2481 data.writeStrongBinder(callingActivity);
2482 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002483 if (options != null) {
2484 data.writeInt(1);
2485 options.writeToParcel(data, 0);
2486 } else {
2487 data.writeInt(0);
2488 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002489 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2490 reply.readException();
2491 int result = reply.readInt();
2492 reply.recycle();
2493 data.recycle();
2494 return result != 0;
2495 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002496 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2497 Parcel data = Parcel.obtain();
2498 Parcel reply = Parcel.obtain();
2499 data.writeInterfaceToken(IActivityManager.descriptor);
2500 data.writeInt(taskId);
2501 if (options == null) {
2502 data.writeInt(0);
2503 } else {
2504 data.writeInt(1);
2505 options.writeToParcel(data, 0);
2506 }
2507 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2508 reply.readException();
2509 int result = reply.readInt();
2510 reply.recycle();
2511 data.recycle();
2512 return result;
2513 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002514 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002515 throws RemoteException {
2516 Parcel data = Parcel.obtain();
2517 Parcel reply = Parcel.obtain();
2518 data.writeInterfaceToken(IActivityManager.descriptor);
2519 data.writeStrongBinder(token);
2520 data.writeInt(resultCode);
2521 if (resultData != null) {
2522 data.writeInt(1);
2523 resultData.writeToParcel(data, 0);
2524 } else {
2525 data.writeInt(0);
2526 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002527 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002528 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2529 reply.readException();
2530 boolean res = reply.readInt() != 0;
2531 data.recycle();
2532 reply.recycle();
2533 return res;
2534 }
2535 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2536 {
2537 Parcel data = Parcel.obtain();
2538 Parcel reply = Parcel.obtain();
2539 data.writeInterfaceToken(IActivityManager.descriptor);
2540 data.writeStrongBinder(token);
2541 data.writeString(resultWho);
2542 data.writeInt(requestCode);
2543 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2544 reply.readException();
2545 data.recycle();
2546 reply.recycle();
2547 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002548 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2549 Parcel data = Parcel.obtain();
2550 Parcel reply = Parcel.obtain();
2551 data.writeInterfaceToken(IActivityManager.descriptor);
2552 data.writeStrongBinder(token);
2553 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2554 reply.readException();
2555 boolean res = reply.readInt() != 0;
2556 data.recycle();
2557 reply.recycle();
2558 return res;
2559 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002560 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2561 Parcel data = Parcel.obtain();
2562 Parcel reply = Parcel.obtain();
2563 data.writeInterfaceToken(IActivityManager.descriptor);
2564 data.writeStrongBinder(session.asBinder());
2565 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2566 reply.readException();
2567 data.recycle();
2568 reply.recycle();
2569 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002570 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2571 Parcel data = Parcel.obtain();
2572 Parcel reply = Parcel.obtain();
2573 data.writeInterfaceToken(IActivityManager.descriptor);
2574 data.writeStrongBinder(token);
2575 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2576 reply.readException();
2577 boolean res = reply.readInt() != 0;
2578 data.recycle();
2579 reply.recycle();
2580 return res;
2581 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002582 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002583 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002584 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002585 {
2586 Parcel data = Parcel.obtain();
2587 Parcel reply = Parcel.obtain();
2588 data.writeInterfaceToken(IActivityManager.descriptor);
2589 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002590 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002591 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2592 filter.writeToParcel(data, 0);
2593 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002594 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002595 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2596 reply.readException();
2597 Intent intent = null;
2598 int haveIntent = reply.readInt();
2599 if (haveIntent != 0) {
2600 intent = Intent.CREATOR.createFromParcel(reply);
2601 }
2602 reply.recycle();
2603 data.recycle();
2604 return intent;
2605 }
2606 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2607 {
2608 Parcel data = Parcel.obtain();
2609 Parcel reply = Parcel.obtain();
2610 data.writeInterfaceToken(IActivityManager.descriptor);
2611 data.writeStrongBinder(receiver.asBinder());
2612 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2613 reply.readException();
2614 data.recycle();
2615 reply.recycle();
2616 }
2617 public int broadcastIntent(IApplicationThread caller,
2618 Intent intent, String resolvedType, IIntentReceiver resultTo,
2619 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002620 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002621 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002622 {
2623 Parcel data = Parcel.obtain();
2624 Parcel reply = Parcel.obtain();
2625 data.writeInterfaceToken(IActivityManager.descriptor);
2626 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2627 intent.writeToParcel(data, 0);
2628 data.writeString(resolvedType);
2629 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2630 data.writeInt(resultCode);
2631 data.writeString(resultData);
2632 data.writeBundle(map);
2633 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002634 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002635 data.writeInt(serialized ? 1 : 0);
2636 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002637 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002638 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2639 reply.readException();
2640 int res = reply.readInt();
2641 reply.recycle();
2642 data.recycle();
2643 return res;
2644 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002645 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2646 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002647 {
2648 Parcel data = Parcel.obtain();
2649 Parcel reply = Parcel.obtain();
2650 data.writeInterfaceToken(IActivityManager.descriptor);
2651 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2652 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002653 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002654 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2655 reply.readException();
2656 data.recycle();
2657 reply.recycle();
2658 }
2659 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2660 {
2661 Parcel data = Parcel.obtain();
2662 Parcel reply = Parcel.obtain();
2663 data.writeInterfaceToken(IActivityManager.descriptor);
2664 data.writeStrongBinder(who);
2665 data.writeInt(resultCode);
2666 data.writeString(resultData);
2667 data.writeBundle(map);
2668 data.writeInt(abortBroadcast ? 1 : 0);
2669 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2670 reply.readException();
2671 data.recycle();
2672 reply.recycle();
2673 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002674 public void attachApplication(IApplicationThread app) throws RemoteException
2675 {
2676 Parcel data = Parcel.obtain();
2677 Parcel reply = Parcel.obtain();
2678 data.writeInterfaceToken(IActivityManager.descriptor);
2679 data.writeStrongBinder(app.asBinder());
2680 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2681 reply.readException();
2682 data.recycle();
2683 reply.recycle();
2684 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002685 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2686 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002687 {
2688 Parcel data = Parcel.obtain();
2689 Parcel reply = Parcel.obtain();
2690 data.writeInterfaceToken(IActivityManager.descriptor);
2691 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002692 if (config != null) {
2693 data.writeInt(1);
2694 config.writeToParcel(data, 0);
2695 } else {
2696 data.writeInt(0);
2697 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002698 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002699 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2700 reply.readException();
2701 data.recycle();
2702 reply.recycle();
2703 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002704 public void activityResumed(IBinder token) throws RemoteException
2705 {
2706 Parcel data = Parcel.obtain();
2707 Parcel reply = Parcel.obtain();
2708 data.writeInterfaceToken(IActivityManager.descriptor);
2709 data.writeStrongBinder(token);
2710 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2711 reply.readException();
2712 data.recycle();
2713 reply.recycle();
2714 }
Craig Mautnera0026042014-04-23 11:45:37 -07002715 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002716 {
2717 Parcel data = Parcel.obtain();
2718 Parcel reply = Parcel.obtain();
2719 data.writeInterfaceToken(IActivityManager.descriptor);
2720 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002721 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002722 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2723 reply.readException();
2724 data.recycle();
2725 reply.recycle();
2726 }
2727 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002728 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002729 {
2730 Parcel data = Parcel.obtain();
2731 Parcel reply = Parcel.obtain();
2732 data.writeInterfaceToken(IActivityManager.descriptor);
2733 data.writeStrongBinder(token);
2734 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002735 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002736 TextUtils.writeToParcel(description, data, 0);
2737 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2738 reply.readException();
2739 data.recycle();
2740 reply.recycle();
2741 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002742 public void activitySlept(IBinder token) throws RemoteException
2743 {
2744 Parcel data = Parcel.obtain();
2745 Parcel reply = Parcel.obtain();
2746 data.writeInterfaceToken(IActivityManager.descriptor);
2747 data.writeStrongBinder(token);
2748 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2749 reply.readException();
2750 data.recycle();
2751 reply.recycle();
2752 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002753 public void activityDestroyed(IBinder token) throws RemoteException
2754 {
2755 Parcel data = Parcel.obtain();
2756 Parcel reply = Parcel.obtain();
2757 data.writeInterfaceToken(IActivityManager.descriptor);
2758 data.writeStrongBinder(token);
2759 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2760 reply.readException();
2761 data.recycle();
2762 reply.recycle();
2763 }
2764 public String getCallingPackage(IBinder token) throws RemoteException
2765 {
2766 Parcel data = Parcel.obtain();
2767 Parcel reply = Parcel.obtain();
2768 data.writeInterfaceToken(IActivityManager.descriptor);
2769 data.writeStrongBinder(token);
2770 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2771 reply.readException();
2772 String res = reply.readString();
2773 data.recycle();
2774 reply.recycle();
2775 return res;
2776 }
2777 public ComponentName getCallingActivity(IBinder token)
2778 throws RemoteException {
2779 Parcel data = Parcel.obtain();
2780 Parcel reply = Parcel.obtain();
2781 data.writeInterfaceToken(IActivityManager.descriptor);
2782 data.writeStrongBinder(token);
2783 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2784 reply.readException();
2785 ComponentName res = ComponentName.readFromParcel(reply);
2786 data.recycle();
2787 reply.recycle();
2788 return res;
2789 }
Winson Chung1147c402014-05-14 11:05:00 -07002790 public List<IAppTask> getAppTasks() throws RemoteException {
2791 Parcel data = Parcel.obtain();
2792 Parcel reply = Parcel.obtain();
2793 data.writeInterfaceToken(IActivityManager.descriptor);
2794 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2795 reply.readException();
2796 ArrayList<IAppTask> list = null;
2797 int N = reply.readInt();
2798 if (N >= 0) {
2799 list = new ArrayList<IAppTask>();
2800 while (N > 0) {
2801 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2802 list.add(task);
2803 N--;
2804 }
2805 }
2806 data.recycle();
2807 reply.recycle();
2808 return list;
2809 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002810 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002811 Parcel data = Parcel.obtain();
2812 Parcel reply = Parcel.obtain();
2813 data.writeInterfaceToken(IActivityManager.descriptor);
2814 data.writeInt(maxNum);
2815 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002816 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2817 reply.readException();
2818 ArrayList list = null;
2819 int N = reply.readInt();
2820 if (N >= 0) {
2821 list = new ArrayList();
2822 while (N > 0) {
2823 ActivityManager.RunningTaskInfo info =
2824 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002825 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002826 list.add(info);
2827 N--;
2828 }
2829 }
2830 data.recycle();
2831 reply.recycle();
2832 return list;
2833 }
2834 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002835 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002836 Parcel data = Parcel.obtain();
2837 Parcel reply = Parcel.obtain();
2838 data.writeInterfaceToken(IActivityManager.descriptor);
2839 data.writeInt(maxNum);
2840 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002841 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002842 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2843 reply.readException();
2844 ArrayList<ActivityManager.RecentTaskInfo> list
2845 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2846 data.recycle();
2847 reply.recycle();
2848 return list;
2849 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002850 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002851 Parcel data = Parcel.obtain();
2852 Parcel reply = Parcel.obtain();
2853 data.writeInterfaceToken(IActivityManager.descriptor);
2854 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002855 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002856 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002857 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002858 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002859 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002860 }
2861 data.recycle();
2862 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002863 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07002864 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002865 public List getServices(int maxNum, int flags) throws RemoteException {
2866 Parcel data = Parcel.obtain();
2867 Parcel reply = Parcel.obtain();
2868 data.writeInterfaceToken(IActivityManager.descriptor);
2869 data.writeInt(maxNum);
2870 data.writeInt(flags);
2871 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2872 reply.readException();
2873 ArrayList list = null;
2874 int N = reply.readInt();
2875 if (N >= 0) {
2876 list = new ArrayList();
2877 while (N > 0) {
2878 ActivityManager.RunningServiceInfo info =
2879 ActivityManager.RunningServiceInfo.CREATOR
2880 .createFromParcel(reply);
2881 list.add(info);
2882 N--;
2883 }
2884 }
2885 data.recycle();
2886 reply.recycle();
2887 return list;
2888 }
2889 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2890 throws RemoteException {
2891 Parcel data = Parcel.obtain();
2892 Parcel reply = Parcel.obtain();
2893 data.writeInterfaceToken(IActivityManager.descriptor);
2894 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2895 reply.readException();
2896 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2897 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2898 data.recycle();
2899 reply.recycle();
2900 return list;
2901 }
2902 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2903 throws RemoteException {
2904 Parcel data = Parcel.obtain();
2905 Parcel reply = Parcel.obtain();
2906 data.writeInterfaceToken(IActivityManager.descriptor);
2907 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2908 reply.readException();
2909 ArrayList<ActivityManager.RunningAppProcessInfo> list
2910 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2911 data.recycle();
2912 reply.recycle();
2913 return list;
2914 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002915 public List<ApplicationInfo> getRunningExternalApplications()
2916 throws RemoteException {
2917 Parcel data = Parcel.obtain();
2918 Parcel reply = Parcel.obtain();
2919 data.writeInterfaceToken(IActivityManager.descriptor);
2920 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2921 reply.readException();
2922 ArrayList<ApplicationInfo> list
2923 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2924 data.recycle();
2925 reply.recycle();
2926 return list;
2927 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002928 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002929 {
2930 Parcel data = Parcel.obtain();
2931 Parcel reply = Parcel.obtain();
2932 data.writeInterfaceToken(IActivityManager.descriptor);
2933 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002934 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002935 if (options != null) {
2936 data.writeInt(1);
2937 options.writeToParcel(data, 0);
2938 } else {
2939 data.writeInt(0);
2940 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002941 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2942 reply.readException();
2943 data.recycle();
2944 reply.recycle();
2945 }
2946 public void moveTaskToBack(int task) throws RemoteException
2947 {
2948 Parcel data = Parcel.obtain();
2949 Parcel reply = Parcel.obtain();
2950 data.writeInterfaceToken(IActivityManager.descriptor);
2951 data.writeInt(task);
2952 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2953 reply.readException();
2954 data.recycle();
2955 reply.recycle();
2956 }
2957 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2958 throws RemoteException {
2959 Parcel data = Parcel.obtain();
2960 Parcel reply = Parcel.obtain();
2961 data.writeInterfaceToken(IActivityManager.descriptor);
2962 data.writeStrongBinder(token);
2963 data.writeInt(nonRoot ? 1 : 0);
2964 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2965 reply.readException();
2966 boolean res = reply.readInt() != 0;
2967 data.recycle();
2968 reply.recycle();
2969 return res;
2970 }
2971 public void moveTaskBackwards(int task) throws RemoteException
2972 {
2973 Parcel data = Parcel.obtain();
2974 Parcel reply = Parcel.obtain();
2975 data.writeInterfaceToken(IActivityManager.descriptor);
2976 data.writeInt(task);
2977 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2978 reply.readException();
2979 data.recycle();
2980 reply.recycle();
2981 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002982 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002983 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2984 {
2985 Parcel data = Parcel.obtain();
2986 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002987 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002988 data.writeInt(taskId);
2989 data.writeInt(stackId);
2990 data.writeInt(toTop ? 1 : 0);
2991 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2992 reply.readException();
2993 data.recycle();
2994 reply.recycle();
2995 }
2996 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002997 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002998 {
2999 Parcel data = Parcel.obtain();
3000 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003001 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003002 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003003 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003004 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003005 reply.readException();
3006 data.recycle();
3007 reply.recycle();
3008 }
Craig Mautner967212c2013-04-13 21:10:58 -07003009 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003010 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003011 {
3012 Parcel data = Parcel.obtain();
3013 Parcel reply = Parcel.obtain();
3014 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003015 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003016 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003017 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003018 data.recycle();
3019 reply.recycle();
3020 return list;
3021 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003022 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003023 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003024 {
3025 Parcel data = Parcel.obtain();
3026 Parcel reply = Parcel.obtain();
3027 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003028 data.writeInt(stackId);
3029 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003030 reply.readException();
3031 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003032 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003033 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003034 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003035 }
3036 data.recycle();
3037 reply.recycle();
3038 return info;
3039 }
3040 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003041 public boolean isInHomeStack(int taskId) throws RemoteException {
3042 Parcel data = Parcel.obtain();
3043 Parcel reply = Parcel.obtain();
3044 data.writeInterfaceToken(IActivityManager.descriptor);
3045 data.writeInt(taskId);
3046 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3047 reply.readException();
3048 boolean isInHomeStack = reply.readInt() > 0;
3049 data.recycle();
3050 reply.recycle();
3051 return isInHomeStack;
3052 }
3053 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003054 public void setFocusedStack(int stackId) throws RemoteException
3055 {
3056 Parcel data = Parcel.obtain();
3057 Parcel reply = Parcel.obtain();
3058 data.writeInterfaceToken(IActivityManager.descriptor);
3059 data.writeInt(stackId);
3060 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3061 reply.readException();
3062 data.recycle();
3063 reply.recycle();
3064 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003065 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3066 {
3067 Parcel data = Parcel.obtain();
3068 Parcel reply = Parcel.obtain();
3069 data.writeInterfaceToken(IActivityManager.descriptor);
3070 data.writeStrongBinder(token);
3071 data.writeInt(onlyRoot ? 1 : 0);
3072 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3073 reply.readException();
3074 int res = reply.readInt();
3075 data.recycle();
3076 reply.recycle();
3077 return res;
3078 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003079 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003080 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003081 Parcel data = Parcel.obtain();
3082 Parcel reply = Parcel.obtain();
3083 data.writeInterfaceToken(IActivityManager.descriptor);
3084 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3085 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003086 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003087 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003088 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3089 reply.readException();
3090 int res = reply.readInt();
3091 ContentProviderHolder cph = null;
3092 if (res != 0) {
3093 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3094 }
3095 data.recycle();
3096 reply.recycle();
3097 return cph;
3098 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003099 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3100 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003101 Parcel data = Parcel.obtain();
3102 Parcel reply = Parcel.obtain();
3103 data.writeInterfaceToken(IActivityManager.descriptor);
3104 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003105 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003106 data.writeStrongBinder(token);
3107 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3108 reply.readException();
3109 int res = reply.readInt();
3110 ContentProviderHolder cph = null;
3111 if (res != 0) {
3112 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3113 }
3114 data.recycle();
3115 reply.recycle();
3116 return cph;
3117 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003118 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003119 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003120 {
3121 Parcel data = Parcel.obtain();
3122 Parcel reply = Parcel.obtain();
3123 data.writeInterfaceToken(IActivityManager.descriptor);
3124 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3125 data.writeTypedList(providers);
3126 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3127 reply.readException();
3128 data.recycle();
3129 reply.recycle();
3130 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003131 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3132 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003133 Parcel data = Parcel.obtain();
3134 Parcel reply = Parcel.obtain();
3135 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003136 data.writeStrongBinder(connection);
3137 data.writeInt(stable);
3138 data.writeInt(unstable);
3139 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3140 reply.readException();
3141 boolean res = reply.readInt() != 0;
3142 data.recycle();
3143 reply.recycle();
3144 return res;
3145 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003146
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003147 public void unstableProviderDied(IBinder connection) throws RemoteException {
3148 Parcel data = Parcel.obtain();
3149 Parcel reply = Parcel.obtain();
3150 data.writeInterfaceToken(IActivityManager.descriptor);
3151 data.writeStrongBinder(connection);
3152 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3153 reply.readException();
3154 data.recycle();
3155 reply.recycle();
3156 }
3157
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003158 @Override
3159 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3160 Parcel data = Parcel.obtain();
3161 Parcel reply = Parcel.obtain();
3162 data.writeInterfaceToken(IActivityManager.descriptor);
3163 data.writeStrongBinder(connection);
3164 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3165 reply.readException();
3166 data.recycle();
3167 reply.recycle();
3168 }
3169
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003170 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3171 Parcel data = Parcel.obtain();
3172 Parcel reply = Parcel.obtain();
3173 data.writeInterfaceToken(IActivityManager.descriptor);
3174 data.writeStrongBinder(connection);
3175 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003176 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3177 reply.readException();
3178 data.recycle();
3179 reply.recycle();
3180 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003181
3182 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3183 Parcel data = Parcel.obtain();
3184 Parcel reply = Parcel.obtain();
3185 data.writeInterfaceToken(IActivityManager.descriptor);
3186 data.writeString(name);
3187 data.writeStrongBinder(token);
3188 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3189 reply.readException();
3190 data.recycle();
3191 reply.recycle();
3192 }
3193
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003194 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3195 throws RemoteException
3196 {
3197 Parcel data = Parcel.obtain();
3198 Parcel reply = Parcel.obtain();
3199 data.writeInterfaceToken(IActivityManager.descriptor);
3200 service.writeToParcel(data, 0);
3201 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3202 reply.readException();
3203 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3204 data.recycle();
3205 reply.recycle();
3206 return res;
3207 }
3208
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003209 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003210 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003211 {
3212 Parcel data = Parcel.obtain();
3213 Parcel reply = Parcel.obtain();
3214 data.writeInterfaceToken(IActivityManager.descriptor);
3215 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3216 service.writeToParcel(data, 0);
3217 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003218 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003219 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3220 reply.readException();
3221 ComponentName res = ComponentName.readFromParcel(reply);
3222 data.recycle();
3223 reply.recycle();
3224 return res;
3225 }
3226 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003227 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003228 {
3229 Parcel data = Parcel.obtain();
3230 Parcel reply = Parcel.obtain();
3231 data.writeInterfaceToken(IActivityManager.descriptor);
3232 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3233 service.writeToParcel(data, 0);
3234 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003235 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003236 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3237 reply.readException();
3238 int res = reply.readInt();
3239 reply.recycle();
3240 data.recycle();
3241 return res;
3242 }
3243 public boolean stopServiceToken(ComponentName className, IBinder token,
3244 int startId) throws RemoteException {
3245 Parcel data = Parcel.obtain();
3246 Parcel reply = Parcel.obtain();
3247 data.writeInterfaceToken(IActivityManager.descriptor);
3248 ComponentName.writeToParcel(className, data);
3249 data.writeStrongBinder(token);
3250 data.writeInt(startId);
3251 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3252 reply.readException();
3253 boolean res = reply.readInt() != 0;
3254 data.recycle();
3255 reply.recycle();
3256 return res;
3257 }
3258 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003259 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003260 Parcel data = Parcel.obtain();
3261 Parcel reply = Parcel.obtain();
3262 data.writeInterfaceToken(IActivityManager.descriptor);
3263 ComponentName.writeToParcel(className, data);
3264 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003265 data.writeInt(id);
3266 if (notification != null) {
3267 data.writeInt(1);
3268 notification.writeToParcel(data, 0);
3269 } else {
3270 data.writeInt(0);
3271 }
3272 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003273 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3274 reply.readException();
3275 data.recycle();
3276 reply.recycle();
3277 }
3278 public int bindService(IApplicationThread caller, IBinder token,
3279 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003280 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003281 Parcel data = Parcel.obtain();
3282 Parcel reply = Parcel.obtain();
3283 data.writeInterfaceToken(IActivityManager.descriptor);
3284 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3285 data.writeStrongBinder(token);
3286 service.writeToParcel(data, 0);
3287 data.writeString(resolvedType);
3288 data.writeStrongBinder(connection.asBinder());
3289 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003290 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003291 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3292 reply.readException();
3293 int res = reply.readInt();
3294 data.recycle();
3295 reply.recycle();
3296 return res;
3297 }
3298 public boolean unbindService(IServiceConnection connection) throws RemoteException
3299 {
3300 Parcel data = Parcel.obtain();
3301 Parcel reply = Parcel.obtain();
3302 data.writeInterfaceToken(IActivityManager.descriptor);
3303 data.writeStrongBinder(connection.asBinder());
3304 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3305 reply.readException();
3306 boolean res = reply.readInt() != 0;
3307 data.recycle();
3308 reply.recycle();
3309 return res;
3310 }
3311
3312 public void publishService(IBinder token,
3313 Intent intent, IBinder service) throws RemoteException {
3314 Parcel data = Parcel.obtain();
3315 Parcel reply = Parcel.obtain();
3316 data.writeInterfaceToken(IActivityManager.descriptor);
3317 data.writeStrongBinder(token);
3318 intent.writeToParcel(data, 0);
3319 data.writeStrongBinder(service);
3320 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3321 reply.readException();
3322 data.recycle();
3323 reply.recycle();
3324 }
3325
3326 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3327 throws RemoteException {
3328 Parcel data = Parcel.obtain();
3329 Parcel reply = Parcel.obtain();
3330 data.writeInterfaceToken(IActivityManager.descriptor);
3331 data.writeStrongBinder(token);
3332 intent.writeToParcel(data, 0);
3333 data.writeInt(doRebind ? 1 : 0);
3334 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3335 reply.readException();
3336 data.recycle();
3337 reply.recycle();
3338 }
3339
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003340 public void serviceDoneExecuting(IBinder token, int type, int startId,
3341 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003342 Parcel data = Parcel.obtain();
3343 Parcel reply = Parcel.obtain();
3344 data.writeInterfaceToken(IActivityManager.descriptor);
3345 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003346 data.writeInt(type);
3347 data.writeInt(startId);
3348 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003349 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3350 reply.readException();
3351 data.recycle();
3352 reply.recycle();
3353 }
3354
3355 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3356 Parcel data = Parcel.obtain();
3357 Parcel reply = Parcel.obtain();
3358 data.writeInterfaceToken(IActivityManager.descriptor);
3359 service.writeToParcel(data, 0);
3360 data.writeString(resolvedType);
3361 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3362 reply.readException();
3363 IBinder binder = reply.readStrongBinder();
3364 reply.recycle();
3365 data.recycle();
3366 return binder;
3367 }
3368
Christopher Tate181fafa2009-05-14 11:12:14 -07003369 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3370 throws RemoteException {
3371 Parcel data = Parcel.obtain();
3372 Parcel reply = Parcel.obtain();
3373 data.writeInterfaceToken(IActivityManager.descriptor);
3374 app.writeToParcel(data, 0);
3375 data.writeInt(backupRestoreMode);
3376 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3377 reply.readException();
3378 boolean success = reply.readInt() != 0;
3379 reply.recycle();
3380 data.recycle();
3381 return success;
3382 }
3383
Christopher Tate346acb12012-10-15 19:20:25 -07003384 public void clearPendingBackup() throws RemoteException {
3385 Parcel data = Parcel.obtain();
3386 Parcel reply = Parcel.obtain();
3387 data.writeInterfaceToken(IActivityManager.descriptor);
3388 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3389 reply.recycle();
3390 data.recycle();
3391 }
3392
Christopher Tate181fafa2009-05-14 11:12:14 -07003393 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3394 Parcel data = Parcel.obtain();
3395 Parcel reply = Parcel.obtain();
3396 data.writeInterfaceToken(IActivityManager.descriptor);
3397 data.writeString(packageName);
3398 data.writeStrongBinder(agent);
3399 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3400 reply.recycle();
3401 data.recycle();
3402 }
3403
3404 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3405 Parcel data = Parcel.obtain();
3406 Parcel reply = Parcel.obtain();
3407 data.writeInterfaceToken(IActivityManager.descriptor);
3408 app.writeToParcel(data, 0);
3409 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3410 reply.readException();
3411 reply.recycle();
3412 data.recycle();
3413 }
3414
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003415 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003416 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003417 IUiAutomationConnection connection, int userId, String instructionSet)
3418 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003419 Parcel data = Parcel.obtain();
3420 Parcel reply = Parcel.obtain();
3421 data.writeInterfaceToken(IActivityManager.descriptor);
3422 ComponentName.writeToParcel(className, data);
3423 data.writeString(profileFile);
3424 data.writeInt(flags);
3425 data.writeBundle(arguments);
3426 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003427 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003428 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003429 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003430 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3431 reply.readException();
3432 boolean res = reply.readInt() != 0;
3433 reply.recycle();
3434 data.recycle();
3435 return res;
3436 }
3437
3438 public void finishInstrumentation(IApplicationThread target,
3439 int resultCode, Bundle results) throws RemoteException {
3440 Parcel data = Parcel.obtain();
3441 Parcel reply = Parcel.obtain();
3442 data.writeInterfaceToken(IActivityManager.descriptor);
3443 data.writeStrongBinder(target != null ? target.asBinder() : null);
3444 data.writeInt(resultCode);
3445 data.writeBundle(results);
3446 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3447 reply.readException();
3448 data.recycle();
3449 reply.recycle();
3450 }
3451 public Configuration getConfiguration() throws RemoteException
3452 {
3453 Parcel data = Parcel.obtain();
3454 Parcel reply = Parcel.obtain();
3455 data.writeInterfaceToken(IActivityManager.descriptor);
3456 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3457 reply.readException();
3458 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3459 reply.recycle();
3460 data.recycle();
3461 return res;
3462 }
3463 public void updateConfiguration(Configuration values) throws RemoteException
3464 {
3465 Parcel data = Parcel.obtain();
3466 Parcel reply = Parcel.obtain();
3467 data.writeInterfaceToken(IActivityManager.descriptor);
3468 values.writeToParcel(data, 0);
3469 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3470 reply.readException();
3471 data.recycle();
3472 reply.recycle();
3473 }
3474 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3475 throws RemoteException {
3476 Parcel data = Parcel.obtain();
3477 Parcel reply = Parcel.obtain();
3478 data.writeInterfaceToken(IActivityManager.descriptor);
3479 data.writeStrongBinder(token);
3480 data.writeInt(requestedOrientation);
3481 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3482 reply.readException();
3483 data.recycle();
3484 reply.recycle();
3485 }
3486 public int getRequestedOrientation(IBinder token) throws RemoteException {
3487 Parcel data = Parcel.obtain();
3488 Parcel reply = Parcel.obtain();
3489 data.writeInterfaceToken(IActivityManager.descriptor);
3490 data.writeStrongBinder(token);
3491 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3492 reply.readException();
3493 int res = reply.readInt();
3494 data.recycle();
3495 reply.recycle();
3496 return res;
3497 }
3498 public ComponentName getActivityClassForToken(IBinder token)
3499 throws RemoteException {
3500 Parcel data = Parcel.obtain();
3501 Parcel reply = Parcel.obtain();
3502 data.writeInterfaceToken(IActivityManager.descriptor);
3503 data.writeStrongBinder(token);
3504 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3505 reply.readException();
3506 ComponentName res = ComponentName.readFromParcel(reply);
3507 data.recycle();
3508 reply.recycle();
3509 return res;
3510 }
3511 public String getPackageForToken(IBinder token) throws RemoteException
3512 {
3513 Parcel data = Parcel.obtain();
3514 Parcel reply = Parcel.obtain();
3515 data.writeInterfaceToken(IActivityManager.descriptor);
3516 data.writeStrongBinder(token);
3517 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3518 reply.readException();
3519 String res = reply.readString();
3520 data.recycle();
3521 reply.recycle();
3522 return res;
3523 }
3524 public IIntentSender getIntentSender(int type,
3525 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003526 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003527 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003528 Parcel data = Parcel.obtain();
3529 Parcel reply = Parcel.obtain();
3530 data.writeInterfaceToken(IActivityManager.descriptor);
3531 data.writeInt(type);
3532 data.writeString(packageName);
3533 data.writeStrongBinder(token);
3534 data.writeString(resultWho);
3535 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003536 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003537 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003538 data.writeTypedArray(intents, 0);
3539 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003540 } else {
3541 data.writeInt(0);
3542 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003543 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003544 if (options != null) {
3545 data.writeInt(1);
3546 options.writeToParcel(data, 0);
3547 } else {
3548 data.writeInt(0);
3549 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003550 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003551 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3552 reply.readException();
3553 IIntentSender res = IIntentSender.Stub.asInterface(
3554 reply.readStrongBinder());
3555 data.recycle();
3556 reply.recycle();
3557 return res;
3558 }
3559 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3560 Parcel data = Parcel.obtain();
3561 Parcel reply = Parcel.obtain();
3562 data.writeInterfaceToken(IActivityManager.descriptor);
3563 data.writeStrongBinder(sender.asBinder());
3564 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3565 reply.readException();
3566 data.recycle();
3567 reply.recycle();
3568 }
3569 public String getPackageForIntentSender(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(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3575 reply.readException();
3576 String res = reply.readString();
3577 data.recycle();
3578 reply.recycle();
3579 return res;
3580 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003581 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3582 Parcel data = Parcel.obtain();
3583 Parcel reply = Parcel.obtain();
3584 data.writeInterfaceToken(IActivityManager.descriptor);
3585 data.writeStrongBinder(sender.asBinder());
3586 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3587 reply.readException();
3588 int res = reply.readInt();
3589 data.recycle();
3590 reply.recycle();
3591 return res;
3592 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003593 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3594 boolean requireFull, String name, String callerPackage) throws RemoteException {
3595 Parcel data = Parcel.obtain();
3596 Parcel reply = Parcel.obtain();
3597 data.writeInterfaceToken(IActivityManager.descriptor);
3598 data.writeInt(callingPid);
3599 data.writeInt(callingUid);
3600 data.writeInt(userId);
3601 data.writeInt(allowAll ? 1 : 0);
3602 data.writeInt(requireFull ? 1 : 0);
3603 data.writeString(name);
3604 data.writeString(callerPackage);
3605 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3606 reply.readException();
3607 int res = reply.readInt();
3608 data.recycle();
3609 reply.recycle();
3610 return res;
3611 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003612 public void setProcessLimit(int max) throws RemoteException
3613 {
3614 Parcel data = Parcel.obtain();
3615 Parcel reply = Parcel.obtain();
3616 data.writeInterfaceToken(IActivityManager.descriptor);
3617 data.writeInt(max);
3618 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3619 reply.readException();
3620 data.recycle();
3621 reply.recycle();
3622 }
3623 public int getProcessLimit() throws RemoteException
3624 {
3625 Parcel data = Parcel.obtain();
3626 Parcel reply = Parcel.obtain();
3627 data.writeInterfaceToken(IActivityManager.descriptor);
3628 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3629 reply.readException();
3630 int res = reply.readInt();
3631 data.recycle();
3632 reply.recycle();
3633 return res;
3634 }
3635 public void setProcessForeground(IBinder token, int pid,
3636 boolean isForeground) throws RemoteException {
3637 Parcel data = Parcel.obtain();
3638 Parcel reply = Parcel.obtain();
3639 data.writeInterfaceToken(IActivityManager.descriptor);
3640 data.writeStrongBinder(token);
3641 data.writeInt(pid);
3642 data.writeInt(isForeground ? 1 : 0);
3643 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3644 reply.readException();
3645 data.recycle();
3646 reply.recycle();
3647 }
3648 public int checkPermission(String permission, int pid, int uid)
3649 throws RemoteException {
3650 Parcel data = Parcel.obtain();
3651 Parcel reply = Parcel.obtain();
3652 data.writeInterfaceToken(IActivityManager.descriptor);
3653 data.writeString(permission);
3654 data.writeInt(pid);
3655 data.writeInt(uid);
3656 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3657 reply.readException();
3658 int res = reply.readInt();
3659 data.recycle();
3660 reply.recycle();
3661 return res;
3662 }
3663 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003664 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003665 Parcel data = Parcel.obtain();
3666 Parcel reply = Parcel.obtain();
3667 data.writeInterfaceToken(IActivityManager.descriptor);
3668 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003669 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003670 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003671 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3672 reply.readException();
3673 boolean res = reply.readInt() != 0;
3674 data.recycle();
3675 reply.recycle();
3676 return res;
3677 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003678 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003679 throws RemoteException {
3680 Parcel data = Parcel.obtain();
3681 Parcel reply = Parcel.obtain();
3682 data.writeInterfaceToken(IActivityManager.descriptor);
3683 uri.writeToParcel(data, 0);
3684 data.writeInt(pid);
3685 data.writeInt(uid);
3686 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003687 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003688 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3689 reply.readException();
3690 int res = reply.readInt();
3691 data.recycle();
3692 reply.recycle();
3693 return res;
3694 }
3695 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003696 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003697 Parcel data = Parcel.obtain();
3698 Parcel reply = Parcel.obtain();
3699 data.writeInterfaceToken(IActivityManager.descriptor);
3700 data.writeStrongBinder(caller.asBinder());
3701 data.writeString(targetPkg);
3702 uri.writeToParcel(data, 0);
3703 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003704 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003705 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3706 reply.readException();
3707 data.recycle();
3708 reply.recycle();
3709 }
3710 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003711 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003712 Parcel data = Parcel.obtain();
3713 Parcel reply = Parcel.obtain();
3714 data.writeInterfaceToken(IActivityManager.descriptor);
3715 data.writeStrongBinder(caller.asBinder());
3716 uri.writeToParcel(data, 0);
3717 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003718 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003719 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3720 reply.readException();
3721 data.recycle();
3722 reply.recycle();
3723 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003724
3725 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003726 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3727 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003728 Parcel data = Parcel.obtain();
3729 Parcel reply = Parcel.obtain();
3730 data.writeInterfaceToken(IActivityManager.descriptor);
3731 uri.writeToParcel(data, 0);
3732 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003733 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003734 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3735 reply.readException();
3736 data.recycle();
3737 reply.recycle();
3738 }
3739
3740 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003741 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3742 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003743 Parcel data = Parcel.obtain();
3744 Parcel reply = Parcel.obtain();
3745 data.writeInterfaceToken(IActivityManager.descriptor);
3746 uri.writeToParcel(data, 0);
3747 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003748 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003749 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3750 reply.readException();
3751 data.recycle();
3752 reply.recycle();
3753 }
3754
3755 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003756 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3757 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003758 Parcel data = Parcel.obtain();
3759 Parcel reply = Parcel.obtain();
3760 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003761 data.writeString(packageName);
3762 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003763 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3764 reply.readException();
3765 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3766 reply);
3767 data.recycle();
3768 reply.recycle();
3769 return perms;
3770 }
3771
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003772 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3773 throws RemoteException {
3774 Parcel data = Parcel.obtain();
3775 Parcel reply = Parcel.obtain();
3776 data.writeInterfaceToken(IActivityManager.descriptor);
3777 data.writeStrongBinder(who.asBinder());
3778 data.writeInt(waiting ? 1 : 0);
3779 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3780 reply.readException();
3781 data.recycle();
3782 reply.recycle();
3783 }
3784 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3785 Parcel data = Parcel.obtain();
3786 Parcel reply = Parcel.obtain();
3787 data.writeInterfaceToken(IActivityManager.descriptor);
3788 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3789 reply.readException();
3790 outInfo.readFromParcel(reply);
3791 data.recycle();
3792 reply.recycle();
3793 }
3794 public void unhandledBack() throws RemoteException
3795 {
3796 Parcel data = Parcel.obtain();
3797 Parcel reply = Parcel.obtain();
3798 data.writeInterfaceToken(IActivityManager.descriptor);
3799 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3800 reply.readException();
3801 data.recycle();
3802 reply.recycle();
3803 }
3804 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3805 {
3806 Parcel data = Parcel.obtain();
3807 Parcel reply = Parcel.obtain();
3808 data.writeInterfaceToken(IActivityManager.descriptor);
3809 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3810 reply.readException();
3811 ParcelFileDescriptor pfd = null;
3812 if (reply.readInt() != 0) {
3813 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3814 }
3815 data.recycle();
3816 reply.recycle();
3817 return pfd;
3818 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003819 public void setLockScreenShown(boolean shown) throws RemoteException
3820 {
3821 Parcel data = Parcel.obtain();
3822 Parcel reply = Parcel.obtain();
3823 data.writeInterfaceToken(IActivityManager.descriptor);
3824 data.writeInt(shown ? 1 : 0);
3825 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3826 reply.readException();
3827 data.recycle();
3828 reply.recycle();
3829 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003830 public void setDebugApp(
3831 String packageName, boolean waitForDebugger, boolean persistent)
3832 throws RemoteException
3833 {
3834 Parcel data = Parcel.obtain();
3835 Parcel reply = Parcel.obtain();
3836 data.writeInterfaceToken(IActivityManager.descriptor);
3837 data.writeString(packageName);
3838 data.writeInt(waitForDebugger ? 1 : 0);
3839 data.writeInt(persistent ? 1 : 0);
3840 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3841 reply.readException();
3842 data.recycle();
3843 reply.recycle();
3844 }
3845 public void setAlwaysFinish(boolean enabled) throws RemoteException
3846 {
3847 Parcel data = Parcel.obtain();
3848 Parcel reply = Parcel.obtain();
3849 data.writeInterfaceToken(IActivityManager.descriptor);
3850 data.writeInt(enabled ? 1 : 0);
3851 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3852 reply.readException();
3853 data.recycle();
3854 reply.recycle();
3855 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003856 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003857 {
3858 Parcel data = Parcel.obtain();
3859 Parcel reply = Parcel.obtain();
3860 data.writeInterfaceToken(IActivityManager.descriptor);
3861 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003862 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003863 reply.readException();
3864 data.recycle();
3865 reply.recycle();
3866 }
3867 public void enterSafeMode() throws RemoteException {
3868 Parcel data = Parcel.obtain();
3869 data.writeInterfaceToken(IActivityManager.descriptor);
3870 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3871 data.recycle();
3872 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003873 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3874 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003875 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003876 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003877 data.writeStrongBinder(sender.asBinder());
3878 data.writeInt(sourceUid);
3879 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003880 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3881 data.recycle();
3882 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003883 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003884 Parcel data = Parcel.obtain();
3885 Parcel reply = Parcel.obtain();
3886 data.writeInterfaceToken(IActivityManager.descriptor);
3887 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003888 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003889 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003890 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003891 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003892 boolean res = reply.readInt() != 0;
3893 data.recycle();
3894 reply.recycle();
3895 return res;
3896 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003897 @Override
3898 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3899 Parcel data = Parcel.obtain();
3900 Parcel reply = Parcel.obtain();
3901 data.writeInterfaceToken(IActivityManager.descriptor);
3902 data.writeString(reason);
3903 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3904 boolean res = reply.readInt() != 0;
3905 data.recycle();
3906 reply.recycle();
3907 return res;
3908 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003909 public boolean testIsSystemReady()
3910 {
3911 /* this base class version is never called */
3912 return true;
3913 }
Dan Egnor60d87622009-12-16 16:32:58 -08003914 public void handleApplicationCrash(IBinder app,
3915 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3916 {
3917 Parcel data = Parcel.obtain();
3918 Parcel reply = Parcel.obtain();
3919 data.writeInterfaceToken(IActivityManager.descriptor);
3920 data.writeStrongBinder(app);
3921 crashInfo.writeToParcel(data, 0);
3922 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3923 reply.readException();
3924 reply.recycle();
3925 data.recycle();
3926 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003927
Dan Egnor60d87622009-12-16 16:32:58 -08003928 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003929 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003930 {
3931 Parcel data = Parcel.obtain();
3932 Parcel reply = Parcel.obtain();
3933 data.writeInterfaceToken(IActivityManager.descriptor);
3934 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003935 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003936 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003937 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003938 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003939 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003940 reply.recycle();
3941 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003942 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003943 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003944
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003945 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003946 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003947 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003948 {
3949 Parcel data = Parcel.obtain();
3950 Parcel reply = Parcel.obtain();
3951 data.writeInterfaceToken(IActivityManager.descriptor);
3952 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003953 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003954 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003955 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3956 reply.readException();
3957 reply.recycle();
3958 data.recycle();
3959 }
3960
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003961 public void signalPersistentProcesses(int sig) throws RemoteException {
3962 Parcel data = Parcel.obtain();
3963 Parcel reply = Parcel.obtain();
3964 data.writeInterfaceToken(IActivityManager.descriptor);
3965 data.writeInt(sig);
3966 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3967 reply.readException();
3968 data.recycle();
3969 reply.recycle();
3970 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003971
Dianne Hackborn1676c852012-09-10 14:52:30 -07003972 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003973 Parcel data = Parcel.obtain();
3974 Parcel reply = Parcel.obtain();
3975 data.writeInterfaceToken(IActivityManager.descriptor);
3976 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003977 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003978 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3979 reply.readException();
3980 data.recycle();
3981 reply.recycle();
3982 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003983
3984 public void killAllBackgroundProcesses() throws RemoteException {
3985 Parcel data = Parcel.obtain();
3986 Parcel reply = Parcel.obtain();
3987 data.writeInterfaceToken(IActivityManager.descriptor);
3988 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3989 reply.readException();
3990 data.recycle();
3991 reply.recycle();
3992 }
3993
Dianne Hackborn1676c852012-09-10 14:52:30 -07003994 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003995 Parcel data = Parcel.obtain();
3996 Parcel reply = Parcel.obtain();
3997 data.writeInterfaceToken(IActivityManager.descriptor);
3998 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003999 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004000 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004001 reply.readException();
4002 data.recycle();
4003 reply.recycle();
4004 }
4005
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004006 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4007 throws RemoteException
4008 {
4009 Parcel data = Parcel.obtain();
4010 Parcel reply = Parcel.obtain();
4011 data.writeInterfaceToken(IActivityManager.descriptor);
4012 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4013 reply.readException();
4014 outInfo.readFromParcel(reply);
4015 reply.recycle();
4016 data.recycle();
4017 }
4018
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004019 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4020 {
4021 Parcel data = Parcel.obtain();
4022 Parcel reply = Parcel.obtain();
4023 data.writeInterfaceToken(IActivityManager.descriptor);
4024 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4025 reply.readException();
4026 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4027 reply.recycle();
4028 data.recycle();
4029 return res;
4030 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004031
Dianne Hackborn1676c852012-09-10 14:52:30 -07004032 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07004033 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004034 {
4035 Parcel data = Parcel.obtain();
4036 Parcel reply = Parcel.obtain();
4037 data.writeInterfaceToken(IActivityManager.descriptor);
4038 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004039 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004040 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004041 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004042 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004043 if (fd != null) {
4044 data.writeInt(1);
4045 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4046 } else {
4047 data.writeInt(0);
4048 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004049 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4050 reply.readException();
4051 boolean res = reply.readInt() != 0;
4052 reply.recycle();
4053 data.recycle();
4054 return res;
4055 }
4056
Dianne Hackborn55280a92009-05-07 15:53:46 -07004057 public boolean shutdown(int timeout) throws RemoteException
4058 {
4059 Parcel data = Parcel.obtain();
4060 Parcel reply = Parcel.obtain();
4061 data.writeInterfaceToken(IActivityManager.descriptor);
4062 data.writeInt(timeout);
4063 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4064 reply.readException();
4065 boolean res = reply.readInt() != 0;
4066 reply.recycle();
4067 data.recycle();
4068 return res;
4069 }
4070
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004071 public void stopAppSwitches() throws RemoteException {
4072 Parcel data = Parcel.obtain();
4073 Parcel reply = Parcel.obtain();
4074 data.writeInterfaceToken(IActivityManager.descriptor);
4075 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4076 reply.readException();
4077 reply.recycle();
4078 data.recycle();
4079 }
4080
4081 public void resumeAppSwitches() throws RemoteException {
4082 Parcel data = Parcel.obtain();
4083 Parcel reply = Parcel.obtain();
4084 data.writeInterfaceToken(IActivityManager.descriptor);
4085 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4086 reply.readException();
4087 reply.recycle();
4088 data.recycle();
4089 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004090
4091 public void addPackageDependency(String packageName) throws RemoteException {
4092 Parcel data = Parcel.obtain();
4093 Parcel reply = Parcel.obtain();
4094 data.writeInterfaceToken(IActivityManager.descriptor);
4095 data.writeString(packageName);
4096 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4097 reply.readException();
4098 data.recycle();
4099 reply.recycle();
4100 }
4101
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004102 public void killApplicationWithAppId(String pkg, int appid, String reason)
4103 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004104 Parcel data = Parcel.obtain();
4105 Parcel reply = Parcel.obtain();
4106 data.writeInterfaceToken(IActivityManager.descriptor);
4107 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004108 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004109 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004110 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004111 reply.readException();
4112 data.recycle();
4113 reply.recycle();
4114 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004115
4116 public void closeSystemDialogs(String reason) throws RemoteException {
4117 Parcel data = Parcel.obtain();
4118 Parcel reply = Parcel.obtain();
4119 data.writeInterfaceToken(IActivityManager.descriptor);
4120 data.writeString(reason);
4121 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4122 reply.readException();
4123 data.recycle();
4124 reply.recycle();
4125 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004126
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004127 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004128 throws RemoteException {
4129 Parcel data = Parcel.obtain();
4130 Parcel reply = Parcel.obtain();
4131 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004132 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004133 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4134 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004135 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004136 data.recycle();
4137 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004138 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004139 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004140
4141 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4142 Parcel data = Parcel.obtain();
4143 Parcel reply = Parcel.obtain();
4144 data.writeInterfaceToken(IActivityManager.descriptor);
4145 data.writeString(processName);
4146 data.writeInt(uid);
4147 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4148 reply.readException();
4149 data.recycle();
4150 reply.recycle();
4151 }
4152
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004153 public void overridePendingTransition(IBinder token, String packageName,
4154 int enterAnim, int exitAnim) throws RemoteException {
4155 Parcel data = Parcel.obtain();
4156 Parcel reply = Parcel.obtain();
4157 data.writeInterfaceToken(IActivityManager.descriptor);
4158 data.writeStrongBinder(token);
4159 data.writeString(packageName);
4160 data.writeInt(enterAnim);
4161 data.writeInt(exitAnim);
4162 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4163 reply.readException();
4164 data.recycle();
4165 reply.recycle();
4166 }
4167
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004168 public boolean isUserAMonkey() throws RemoteException {
4169 Parcel data = Parcel.obtain();
4170 Parcel reply = Parcel.obtain();
4171 data.writeInterfaceToken(IActivityManager.descriptor);
4172 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4173 reply.readException();
4174 boolean res = reply.readInt() != 0;
4175 data.recycle();
4176 reply.recycle();
4177 return res;
4178 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004179
4180 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4181 Parcel data = Parcel.obtain();
4182 Parcel reply = Parcel.obtain();
4183 data.writeInterfaceToken(IActivityManager.descriptor);
4184 data.writeInt(monkey ? 1 : 0);
4185 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4186 reply.readException();
4187 data.recycle();
4188 reply.recycle();
4189 }
4190
Dianne Hackborn860755f2010-06-03 18:47:52 -07004191 public void finishHeavyWeightApp() throws RemoteException {
4192 Parcel data = Parcel.obtain();
4193 Parcel reply = Parcel.obtain();
4194 data.writeInterfaceToken(IActivityManager.descriptor);
4195 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4196 reply.readException();
4197 data.recycle();
4198 reply.recycle();
4199 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004200
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004201 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004202 throws RemoteException {
4203 Parcel data = Parcel.obtain();
4204 Parcel reply = Parcel.obtain();
4205 data.writeInterfaceToken(IActivityManager.descriptor);
4206 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004207 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4208 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004209 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004210 data.recycle();
4211 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004212 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004213 }
4214
Craig Mautner233ceee2014-05-09 17:05:11 -07004215 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004216 throws RemoteException {
4217 Parcel data = Parcel.obtain();
4218 Parcel reply = Parcel.obtain();
4219 data.writeInterfaceToken(IActivityManager.descriptor);
4220 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004221 if (options == null) {
4222 data.writeInt(0);
4223 } else {
4224 data.writeInt(1);
4225 data.writeBundle(options.toBundle());
4226 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004227 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004228 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004229 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004230 data.recycle();
4231 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004232 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004233 }
4234
Craig Mautner233ceee2014-05-09 17:05:11 -07004235 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4236 Parcel data = Parcel.obtain();
4237 Parcel reply = Parcel.obtain();
4238 data.writeInterfaceToken(IActivityManager.descriptor);
4239 data.writeStrongBinder(token);
4240 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4241 reply.readException();
4242 Bundle bundle = reply.readBundle();
4243 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4244 data.recycle();
4245 reply.recycle();
4246 return options;
4247 }
4248
Daniel Sandler69a48172010-06-23 16:29:36 -04004249 public void setImmersive(IBinder token, boolean immersive)
4250 throws RemoteException {
4251 Parcel data = Parcel.obtain();
4252 Parcel reply = Parcel.obtain();
4253 data.writeInterfaceToken(IActivityManager.descriptor);
4254 data.writeStrongBinder(token);
4255 data.writeInt(immersive ? 1 : 0);
4256 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4257 reply.readException();
4258 data.recycle();
4259 reply.recycle();
4260 }
4261
4262 public boolean isImmersive(IBinder token)
4263 throws RemoteException {
4264 Parcel data = Parcel.obtain();
4265 Parcel reply = Parcel.obtain();
4266 data.writeInterfaceToken(IActivityManager.descriptor);
4267 data.writeStrongBinder(token);
4268 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004269 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004270 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004271 data.recycle();
4272 reply.recycle();
4273 return res;
4274 }
4275
Craig Mautnerd61dc202014-07-07 11:09:11 -07004276 public boolean isTopOfTask(IBinder token) throws RemoteException {
4277 Parcel data = Parcel.obtain();
4278 Parcel reply = Parcel.obtain();
4279 data.writeInterfaceToken(IActivityManager.descriptor);
4280 data.writeStrongBinder(token);
4281 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4282 reply.readException();
4283 boolean res = reply.readInt() == 1;
4284 data.recycle();
4285 reply.recycle();
4286 return res;
4287 }
4288
Daniel Sandler69a48172010-06-23 16:29:36 -04004289 public boolean isTopActivityImmersive()
4290 throws RemoteException {
4291 Parcel data = Parcel.obtain();
4292 Parcel reply = Parcel.obtain();
4293 data.writeInterfaceToken(IActivityManager.descriptor);
4294 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004295 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004296 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004297 data.recycle();
4298 reply.recycle();
4299 return res;
4300 }
4301
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004302 public void crashApplication(int uid, int initialPid, String packageName,
4303 String message) throws RemoteException {
4304 Parcel data = Parcel.obtain();
4305 Parcel reply = Parcel.obtain();
4306 data.writeInterfaceToken(IActivityManager.descriptor);
4307 data.writeInt(uid);
4308 data.writeInt(initialPid);
4309 data.writeString(packageName);
4310 data.writeString(message);
4311 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4312 reply.readException();
4313 data.recycle();
4314 reply.recycle();
4315 }
Andy McFadden824c5102010-07-09 16:26:57 -07004316
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004317 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004318 Parcel data = Parcel.obtain();
4319 Parcel reply = Parcel.obtain();
4320 data.writeInterfaceToken(IActivityManager.descriptor);
4321 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004322 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004323 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4324 reply.readException();
4325 String res = reply.readString();
4326 data.recycle();
4327 reply.recycle();
4328 return res;
4329 }
4330
Dianne Hackborn7e269642010-08-25 19:50:20 -07004331 public IBinder newUriPermissionOwner(String name)
4332 throws RemoteException {
4333 Parcel data = Parcel.obtain();
4334 Parcel reply = Parcel.obtain();
4335 data.writeInterfaceToken(IActivityManager.descriptor);
4336 data.writeString(name);
4337 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4338 reply.readException();
4339 IBinder res = reply.readStrongBinder();
4340 data.recycle();
4341 reply.recycle();
4342 return res;
4343 }
4344
4345 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004346 Uri uri, int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004347 Parcel data = Parcel.obtain();
4348 Parcel reply = Parcel.obtain();
4349 data.writeInterfaceToken(IActivityManager.descriptor);
4350 data.writeStrongBinder(owner);
4351 data.writeInt(fromUid);
4352 data.writeString(targetPkg);
4353 uri.writeToParcel(data, 0);
4354 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004355 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004356 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4357 reply.readException();
4358 data.recycle();
4359 reply.recycle();
4360 }
4361
4362 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004363 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004364 Parcel data = Parcel.obtain();
4365 Parcel reply = Parcel.obtain();
4366 data.writeInterfaceToken(IActivityManager.descriptor);
4367 data.writeStrongBinder(owner);
4368 if (uri != null) {
4369 data.writeInt(1);
4370 uri.writeToParcel(data, 0);
4371 } else {
4372 data.writeInt(0);
4373 }
4374 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004375 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004376 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4377 reply.readException();
4378 data.recycle();
4379 reply.recycle();
4380 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004381
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004382 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004383 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004384 Parcel data = Parcel.obtain();
4385 Parcel reply = Parcel.obtain();
4386 data.writeInterfaceToken(IActivityManager.descriptor);
4387 data.writeInt(callingUid);
4388 data.writeString(targetPkg);
4389 uri.writeToParcel(data, 0);
4390 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004391 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004392 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4393 reply.readException();
4394 int res = reply.readInt();
4395 data.recycle();
4396 reply.recycle();
4397 return res;
4398 }
4399
Dianne Hackborn1676c852012-09-10 14:52:30 -07004400 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004401 String path, ParcelFileDescriptor fd) throws RemoteException {
4402 Parcel data = Parcel.obtain();
4403 Parcel reply = Parcel.obtain();
4404 data.writeInterfaceToken(IActivityManager.descriptor);
4405 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004406 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004407 data.writeInt(managed ? 1 : 0);
4408 data.writeString(path);
4409 if (fd != null) {
4410 data.writeInt(1);
4411 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4412 } else {
4413 data.writeInt(0);
4414 }
4415 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4416 reply.readException();
4417 boolean res = reply.readInt() != 0;
4418 reply.recycle();
4419 data.recycle();
4420 return res;
4421 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004422
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004423 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004424 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004425 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004426 Parcel data = Parcel.obtain();
4427 Parcel reply = Parcel.obtain();
4428 data.writeInterfaceToken(IActivityManager.descriptor);
4429 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004430 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004431 data.writeTypedArray(intents, 0);
4432 data.writeStringArray(resolvedTypes);
4433 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004434 if (options != null) {
4435 data.writeInt(1);
4436 options.writeToParcel(data, 0);
4437 } else {
4438 data.writeInt(0);
4439 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004440 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004441 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4442 reply.readException();
4443 int result = reply.readInt();
4444 reply.recycle();
4445 data.recycle();
4446 return result;
4447 }
4448
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004449 public int getFrontActivityScreenCompatMode() throws RemoteException {
4450 Parcel data = Parcel.obtain();
4451 Parcel reply = Parcel.obtain();
4452 data.writeInterfaceToken(IActivityManager.descriptor);
4453 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4454 reply.readException();
4455 int mode = reply.readInt();
4456 reply.recycle();
4457 data.recycle();
4458 return mode;
4459 }
4460
4461 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4462 Parcel data = Parcel.obtain();
4463 Parcel reply = Parcel.obtain();
4464 data.writeInterfaceToken(IActivityManager.descriptor);
4465 data.writeInt(mode);
4466 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4467 reply.readException();
4468 reply.recycle();
4469 data.recycle();
4470 }
4471
4472 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4473 Parcel data = Parcel.obtain();
4474 Parcel reply = Parcel.obtain();
4475 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004476 data.writeString(packageName);
4477 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004478 reply.readException();
4479 int mode = reply.readInt();
4480 reply.recycle();
4481 data.recycle();
4482 return mode;
4483 }
4484
4485 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004486 throws RemoteException {
4487 Parcel data = Parcel.obtain();
4488 Parcel reply = Parcel.obtain();
4489 data.writeInterfaceToken(IActivityManager.descriptor);
4490 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004491 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004492 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4493 reply.readException();
4494 reply.recycle();
4495 data.recycle();
4496 }
4497
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004498 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4499 Parcel data = Parcel.obtain();
4500 Parcel reply = Parcel.obtain();
4501 data.writeInterfaceToken(IActivityManager.descriptor);
4502 data.writeString(packageName);
4503 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4504 reply.readException();
4505 boolean ask = reply.readInt() != 0;
4506 reply.recycle();
4507 data.recycle();
4508 return ask;
4509 }
4510
4511 public void setPackageAskScreenCompat(String packageName, boolean ask)
4512 throws RemoteException {
4513 Parcel data = Parcel.obtain();
4514 Parcel reply = Parcel.obtain();
4515 data.writeInterfaceToken(IActivityManager.descriptor);
4516 data.writeString(packageName);
4517 data.writeInt(ask ? 1 : 0);
4518 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4519 reply.readException();
4520 reply.recycle();
4521 data.recycle();
4522 }
4523
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004524 public boolean switchUser(int userid) throws RemoteException {
4525 Parcel data = Parcel.obtain();
4526 Parcel reply = Parcel.obtain();
4527 data.writeInterfaceToken(IActivityManager.descriptor);
4528 data.writeInt(userid);
4529 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4530 reply.readException();
4531 boolean result = reply.readInt() != 0;
4532 reply.recycle();
4533 data.recycle();
4534 return result;
4535 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004536
Kenny Guy08488bf2014-02-21 17:40:37 +00004537 public boolean startUserInBackground(int userid) throws RemoteException {
4538 Parcel data = Parcel.obtain();
4539 Parcel reply = Parcel.obtain();
4540 data.writeInterfaceToken(IActivityManager.descriptor);
4541 data.writeInt(userid);
4542 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4543 reply.readException();
4544 boolean result = reply.readInt() != 0;
4545 reply.recycle();
4546 data.recycle();
4547 return result;
4548 }
4549
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004550 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4551 Parcel data = Parcel.obtain();
4552 Parcel reply = Parcel.obtain();
4553 data.writeInterfaceToken(IActivityManager.descriptor);
4554 data.writeInt(userid);
4555 data.writeStrongInterface(callback);
4556 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4557 reply.readException();
4558 int result = reply.readInt();
4559 reply.recycle();
4560 data.recycle();
4561 return result;
4562 }
4563
Amith Yamasani52f1d752012-03-28 18:19:29 -07004564 public UserInfo getCurrentUser() throws RemoteException {
4565 Parcel data = Parcel.obtain();
4566 Parcel reply = Parcel.obtain();
4567 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004568 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004569 reply.readException();
4570 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4571 reply.recycle();
4572 data.recycle();
4573 return userInfo;
4574 }
4575
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004576 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004577 Parcel data = Parcel.obtain();
4578 Parcel reply = Parcel.obtain();
4579 data.writeInterfaceToken(IActivityManager.descriptor);
4580 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004581 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004582 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4583 reply.readException();
4584 boolean result = reply.readInt() != 0;
4585 reply.recycle();
4586 data.recycle();
4587 return result;
4588 }
4589
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004590 public int[] getRunningUserIds() throws RemoteException {
4591 Parcel data = Parcel.obtain();
4592 Parcel reply = Parcel.obtain();
4593 data.writeInterfaceToken(IActivityManager.descriptor);
4594 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4595 reply.readException();
4596 int[] result = reply.createIntArray();
4597 reply.recycle();
4598 data.recycle();
4599 return result;
4600 }
4601
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004602 public boolean removeTask(int taskId, int flags) throws RemoteException {
4603 Parcel data = Parcel.obtain();
4604 Parcel reply = Parcel.obtain();
4605 data.writeInterfaceToken(IActivityManager.descriptor);
4606 data.writeInt(taskId);
4607 data.writeInt(flags);
4608 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4609 reply.readException();
4610 boolean result = reply.readInt() != 0;
4611 reply.recycle();
4612 data.recycle();
4613 return result;
4614 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004615
Jeff Sharkeya4620792011-05-20 15:29:23 -07004616 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4617 Parcel data = Parcel.obtain();
4618 Parcel reply = Parcel.obtain();
4619 data.writeInterfaceToken(IActivityManager.descriptor);
4620 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4621 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4622 reply.readException();
4623 data.recycle();
4624 reply.recycle();
4625 }
4626
4627 public void unregisterProcessObserver(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(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4633 reply.readException();
4634 data.recycle();
4635 reply.recycle();
4636 }
4637
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004638 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4639 Parcel data = Parcel.obtain();
4640 Parcel reply = Parcel.obtain();
4641 data.writeInterfaceToken(IActivityManager.descriptor);
4642 data.writeStrongBinder(sender.asBinder());
4643 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4644 reply.readException();
4645 boolean res = reply.readInt() != 0;
4646 data.recycle();
4647 reply.recycle();
4648 return res;
4649 }
4650
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004651 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4652 Parcel data = Parcel.obtain();
4653 Parcel reply = Parcel.obtain();
4654 data.writeInterfaceToken(IActivityManager.descriptor);
4655 data.writeStrongBinder(sender.asBinder());
4656 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4657 reply.readException();
4658 boolean res = reply.readInt() != 0;
4659 data.recycle();
4660 reply.recycle();
4661 return res;
4662 }
4663
Dianne Hackborn81038902012-11-26 17:04:09 -08004664 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4665 Parcel data = Parcel.obtain();
4666 Parcel reply = Parcel.obtain();
4667 data.writeInterfaceToken(IActivityManager.descriptor);
4668 data.writeStrongBinder(sender.asBinder());
4669 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4670 reply.readException();
4671 Intent res = reply.readInt() != 0
4672 ? Intent.CREATOR.createFromParcel(reply) : null;
4673 data.recycle();
4674 reply.recycle();
4675 return res;
4676 }
4677
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004678 public String getTagForIntentSender(IIntentSender sender, String prefix)
4679 throws RemoteException {
4680 Parcel data = Parcel.obtain();
4681 Parcel reply = Parcel.obtain();
4682 data.writeInterfaceToken(IActivityManager.descriptor);
4683 data.writeStrongBinder(sender.asBinder());
4684 data.writeString(prefix);
4685 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4686 reply.readException();
4687 String res = reply.readString();
4688 data.recycle();
4689 reply.recycle();
4690 return res;
4691 }
4692
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004693 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4694 {
4695 Parcel data = Parcel.obtain();
4696 Parcel reply = Parcel.obtain();
4697 data.writeInterfaceToken(IActivityManager.descriptor);
4698 values.writeToParcel(data, 0);
4699 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4700 reply.readException();
4701 data.recycle();
4702 reply.recycle();
4703 }
4704
Dianne Hackbornb437e092011-08-05 17:50:29 -07004705 public long[] getProcessPss(int[] pids) throws RemoteException {
4706 Parcel data = Parcel.obtain();
4707 Parcel reply = Parcel.obtain();
4708 data.writeInterfaceToken(IActivityManager.descriptor);
4709 data.writeIntArray(pids);
4710 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4711 reply.readException();
4712 long[] res = reply.createLongArray();
4713 data.recycle();
4714 reply.recycle();
4715 return res;
4716 }
4717
Dianne Hackborn661cd522011-08-22 00:26:20 -07004718 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4719 Parcel data = Parcel.obtain();
4720 Parcel reply = Parcel.obtain();
4721 data.writeInterfaceToken(IActivityManager.descriptor);
4722 TextUtils.writeToParcel(msg, data, 0);
4723 data.writeInt(always ? 1 : 0);
4724 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4725 reply.readException();
4726 data.recycle();
4727 reply.recycle();
4728 }
4729
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004730 public void dismissKeyguardOnNextActivity() throws RemoteException {
4731 Parcel data = Parcel.obtain();
4732 Parcel reply = Parcel.obtain();
4733 data.writeInterfaceToken(IActivityManager.descriptor);
4734 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4735 reply.readException();
4736 data.recycle();
4737 reply.recycle();
4738 }
4739
Adam Powelldd8fab22012-03-22 17:47:27 -07004740 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4741 throws RemoteException {
4742 Parcel data = Parcel.obtain();
4743 Parcel reply = Parcel.obtain();
4744 data.writeInterfaceToken(IActivityManager.descriptor);
4745 data.writeStrongBinder(token);
4746 data.writeString(destAffinity);
4747 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4748 reply.readException();
4749 boolean result = reply.readInt() != 0;
4750 data.recycle();
4751 reply.recycle();
4752 return result;
4753 }
4754
4755 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4756 throws RemoteException {
4757 Parcel data = Parcel.obtain();
4758 Parcel reply = Parcel.obtain();
4759 data.writeInterfaceToken(IActivityManager.descriptor);
4760 data.writeStrongBinder(token);
4761 target.writeToParcel(data, 0);
4762 data.writeInt(resultCode);
4763 if (resultData != null) {
4764 data.writeInt(1);
4765 resultData.writeToParcel(data, 0);
4766 } else {
4767 data.writeInt(0);
4768 }
4769 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4770 reply.readException();
4771 boolean result = reply.readInt() != 0;
4772 data.recycle();
4773 reply.recycle();
4774 return result;
4775 }
4776
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004777 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4778 Parcel data = Parcel.obtain();
4779 Parcel reply = Parcel.obtain();
4780 data.writeInterfaceToken(IActivityManager.descriptor);
4781 data.writeStrongBinder(activityToken);
4782 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4783 reply.readException();
4784 int result = reply.readInt();
4785 data.recycle();
4786 reply.recycle();
4787 return result;
4788 }
4789
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004790 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4791 Parcel data = Parcel.obtain();
4792 Parcel reply = Parcel.obtain();
4793 data.writeInterfaceToken(IActivityManager.descriptor);
4794 data.writeStrongBinder(activityToken);
4795 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4796 reply.readException();
4797 String result = reply.readString();
4798 data.recycle();
4799 reply.recycle();
4800 return result;
4801 }
4802
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004803 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4804 Parcel data = Parcel.obtain();
4805 Parcel reply = Parcel.obtain();
4806 data.writeInterfaceToken(IActivityManager.descriptor);
4807 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4808 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4809 reply.readException();
4810 data.recycle();
4811 reply.recycle();
4812 }
4813
4814 public void unregisterUserSwitchObserver(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(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4820 reply.readException();
4821 data.recycle();
4822 reply.recycle();
4823 }
4824
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004825 public void requestBugReport() throws RemoteException {
4826 Parcel data = Parcel.obtain();
4827 Parcel reply = Parcel.obtain();
4828 data.writeInterfaceToken(IActivityManager.descriptor);
4829 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4830 reply.readException();
4831 data.recycle();
4832 reply.recycle();
4833 }
4834
Jeff Brownbd181bb2013-09-10 16:44:24 -07004835 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4836 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004837 Parcel data = Parcel.obtain();
4838 Parcel reply = Parcel.obtain();
4839 data.writeInterfaceToken(IActivityManager.descriptor);
4840 data.writeInt(pid);
4841 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004842 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004843 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4844 reply.readException();
4845 long res = reply.readInt();
4846 data.recycle();
4847 reply.recycle();
4848 return res;
4849 }
4850
Adam Skorydfc7fd72013-08-05 19:23:41 -07004851 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004852 Parcel data = Parcel.obtain();
4853 Parcel reply = Parcel.obtain();
4854 data.writeInterfaceToken(IActivityManager.descriptor);
4855 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004856 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004857 reply.readException();
4858 Bundle res = reply.readBundle();
4859 data.recycle();
4860 reply.recycle();
4861 return res;
4862 }
4863
Adam Skory7140a252013-09-11 12:04:58 +01004864 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004865 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004866 Parcel data = Parcel.obtain();
4867 Parcel reply = Parcel.obtain();
4868 data.writeInterfaceToken(IActivityManager.descriptor);
4869 data.writeStrongBinder(token);
4870 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004871 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004872 reply.readException();
4873 data.recycle();
4874 reply.recycle();
4875 }
4876
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004877 public void killUid(int uid, String reason) throws RemoteException {
4878 Parcel data = Parcel.obtain();
4879 Parcel reply = Parcel.obtain();
4880 data.writeInterfaceToken(IActivityManager.descriptor);
4881 data.writeInt(uid);
4882 data.writeString(reason);
4883 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4884 reply.readException();
4885 data.recycle();
4886 reply.recycle();
4887 }
4888
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004889 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4890 Parcel data = Parcel.obtain();
4891 Parcel reply = Parcel.obtain();
4892 data.writeInterfaceToken(IActivityManager.descriptor);
4893 data.writeStrongBinder(who);
4894 data.writeInt(allowRestart ? 1 : 0);
4895 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4896 reply.readException();
4897 data.recycle();
4898 reply.recycle();
4899 }
4900
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004901 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4902 Parcel data = Parcel.obtain();
4903 Parcel reply = Parcel.obtain();
4904 data.writeInterfaceToken(IActivityManager.descriptor);
4905 data.writeStrongBinder(token);
4906 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4907 reply.readException();
4908 data.recycle();
4909 reply.recycle();
4910 }
4911
Craig Mautner5eda9b32013-07-02 11:58:16 -07004912 public void notifyActivityDrawn(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(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4918 reply.readException();
4919 data.recycle();
4920 reply.recycle();
4921 }
4922
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004923 public void restart() throws RemoteException {
4924 Parcel data = Parcel.obtain();
4925 Parcel reply = Parcel.obtain();
4926 data.writeInterfaceToken(IActivityManager.descriptor);
4927 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4928 reply.readException();
4929 data.recycle();
4930 reply.recycle();
4931 }
4932
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004933 public void performIdleMaintenance() throws RemoteException {
4934 Parcel data = Parcel.obtain();
4935 Parcel reply = Parcel.obtain();
4936 data.writeInterfaceToken(IActivityManager.descriptor);
4937 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4938 reply.readException();
4939 data.recycle();
4940 reply.recycle();
4941 }
4942
Craig Mautner4a1cb222013-12-04 16:14:06 -08004943 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4944 IActivityContainerCallback callback) throws RemoteException {
4945 Parcel data = Parcel.obtain();
4946 Parcel reply = Parcel.obtain();
4947 data.writeInterfaceToken(IActivityManager.descriptor);
4948 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07004949 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08004950 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4951 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004952 final int result = reply.readInt();
4953 final IActivityContainer res;
4954 if (result == 1) {
4955 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4956 } else {
4957 res = null;
4958 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004959 data.recycle();
4960 reply.recycle();
4961 return res;
4962 }
4963
Craig Mautner95da1082014-02-24 17:54:35 -08004964 public void deleteActivityContainer(IActivityContainer activityContainer)
4965 throws RemoteException {
4966 Parcel data = Parcel.obtain();
4967 Parcel reply = Parcel.obtain();
4968 data.writeInterfaceToken(IActivityManager.descriptor);
4969 data.writeStrongBinder(activityContainer.asBinder());
4970 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4971 reply.readException();
4972 data.recycle();
4973 reply.recycle();
4974 }
4975
Craig Mautnere0a38842013-12-16 16:14:02 -08004976 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4977 throws RemoteException {
4978 Parcel data = Parcel.obtain();
4979 Parcel reply = Parcel.obtain();
4980 data.writeInterfaceToken(IActivityManager.descriptor);
4981 data.writeStrongBinder(activityToken);
4982 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4983 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004984 final int result = reply.readInt();
4985 final IActivityContainer res;
4986 if (result == 1) {
4987 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4988 } else {
4989 res = null;
4990 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004991 data.recycle();
4992 reply.recycle();
4993 return res;
4994 }
4995
Craig Mautner4a1cb222013-12-04 16:14:06 -08004996 public IBinder getHomeActivityToken() throws RemoteException {
4997 Parcel data = Parcel.obtain();
4998 Parcel reply = Parcel.obtain();
4999 data.writeInterfaceToken(IActivityManager.descriptor);
5000 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5001 reply.readException();
5002 IBinder res = reply.readStrongBinder();
5003 data.recycle();
5004 reply.recycle();
5005 return res;
5006 }
5007
Craig Mautneraea74a52014-03-08 14:23:10 -08005008 @Override
5009 public void startLockTaskMode(int taskId) throws RemoteException {
5010 Parcel data = Parcel.obtain();
5011 Parcel reply = Parcel.obtain();
5012 data.writeInterfaceToken(IActivityManager.descriptor);
5013 data.writeInt(taskId);
5014 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5015 reply.readException();
5016 data.recycle();
5017 reply.recycle();
5018 }
5019
5020 @Override
5021 public void startLockTaskMode(IBinder token) throws RemoteException {
5022 Parcel data = Parcel.obtain();
5023 Parcel reply = Parcel.obtain();
5024 data.writeInterfaceToken(IActivityManager.descriptor);
5025 data.writeStrongBinder(token);
5026 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5027 reply.readException();
5028 data.recycle();
5029 reply.recycle();
5030 }
5031
5032 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005033 public void startLockTaskModeOnCurrent() throws RemoteException {
5034 Parcel data = Parcel.obtain();
5035 Parcel reply = Parcel.obtain();
5036 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005037 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005038 reply.readException();
5039 data.recycle();
5040 reply.recycle();
5041 }
5042
5043 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005044 public void stopLockTaskMode() throws RemoteException {
5045 Parcel data = Parcel.obtain();
5046 Parcel reply = Parcel.obtain();
5047 data.writeInterfaceToken(IActivityManager.descriptor);
5048 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5049 reply.readException();
5050 data.recycle();
5051 reply.recycle();
5052 }
5053
5054 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005055 public void stopLockTaskModeOnCurrent() throws RemoteException {
5056 Parcel data = Parcel.obtain();
5057 Parcel reply = Parcel.obtain();
5058 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005059 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005060 reply.readException();
5061 data.recycle();
5062 reply.recycle();
5063 }
5064
5065 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005066 public boolean isInLockTaskMode() throws RemoteException {
5067 Parcel data = Parcel.obtain();
5068 Parcel reply = Parcel.obtain();
5069 data.writeInterfaceToken(IActivityManager.descriptor);
5070 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5071 reply.readException();
5072 boolean isInLockTaskMode = reply.readInt() == 1;
5073 data.recycle();
5074 reply.recycle();
5075 return isInLockTaskMode;
5076 }
5077
Craig Mautner688b5102014-03-27 16:55:03 -07005078 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005079 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005080 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005081 Parcel data = Parcel.obtain();
5082 Parcel reply = Parcel.obtain();
5083 data.writeInterfaceToken(IActivityManager.descriptor);
5084 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005085 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005086 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005087 reply.readException();
5088 data.recycle();
5089 reply.recycle();
5090 }
5091
Craig Mautneree2e45a2014-06-27 12:10:03 -07005092 @Override
5093 public boolean setMediaPlaying(IBinder token, boolean playing) throws RemoteException {
5094 Parcel data = Parcel.obtain();
5095 Parcel reply = Parcel.obtain();
5096 data.writeInterfaceToken(IActivityManager.descriptor);
5097 data.writeStrongBinder(token);
5098 data.writeInt(playing ? 1 : 0);
5099 mRemote.transact(SET_MEDIA_PLAYING_TRANSACTION, data, reply, 0);
5100 reply.readException();
5101 boolean success = reply.readInt() > 0;
5102 data.recycle();
5103 reply.recycle();
5104 return success;
5105 }
5106
5107 @Override
5108 public boolean isBackgroundMediaPlaying(IBinder token) throws RemoteException {
5109 Parcel data = Parcel.obtain();
5110 Parcel reply = Parcel.obtain();
5111 data.writeInterfaceToken(IActivityManager.descriptor);
5112 data.writeStrongBinder(token);
5113 mRemote.transact(IS_BG_MEDIA_PLAYING_TRANSACTION, data, reply, 0);
5114 reply.readException();
5115 final boolean playing = reply.readInt() > 0;
5116 data.recycle();
5117 reply.recycle();
5118 return playing;
5119 }
5120
5121 @Override
5122 public void mediaResourcesReleased(IBinder token) throws RemoteException {
5123 Parcel data = Parcel.obtain();
5124 Parcel reply = Parcel.obtain();
5125 data.writeInterfaceToken(IActivityManager.descriptor);
5126 data.writeStrongBinder(token);
Craig Mautnerbb742462014-07-07 15:28:55 -07005127 mRemote.transact(MEDIA_RESOURCES_RELEASED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5128 reply.readException();
5129 data.recycle();
5130 reply.recycle();
5131 }
5132
5133 @Override
5134 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5135 Parcel data = Parcel.obtain();
5136 Parcel reply = Parcel.obtain();
5137 data.writeInterfaceToken(IActivityManager.descriptor);
5138 data.writeStrongBinder(token);
5139 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5140 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005141 reply.readException();
5142 data.recycle();
5143 reply.recycle();
5144 }
5145
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005146 private IBinder mRemote;
5147}