blob: e2b5a841c532cd1c56668c8beba205f27352383b [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070021import android.content.IIntentReceiver;
22import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.Intent;
24import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070025import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070026import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070027import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.pm.ConfigurationInfo;
29import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070030import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070031import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.content.res.Configuration;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080033import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.net.Uri;
35import android.os.Binder;
36import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070037import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.os.IBinder;
39import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070040import android.os.ParcelFileDescriptor;
41import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070042import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070043import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070045import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070046import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080049import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070050import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import java.util.ArrayList;
53import java.util.List;
54
55/** {@hide} */
56public abstract class ActivityManagerNative extends Binder implements IActivityManager
57{
58 /**
59 * Cast a Binder object into an activity manager interface, generating
60 * a proxy if needed.
61 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080062 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080063 if (obj == null) {
64 return null;
65 }
66 IActivityManager in =
67 (IActivityManager)obj.queryLocalInterface(descriptor);
68 if (in != null) {
69 return in;
70 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080071
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072 return new ActivityManagerProxy(obj);
73 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 /**
76 * Retrieve the system's default/global activity manager.
77 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080078 static public IActivityManager getDefault() {
79 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 }
81
82 /**
83 * Convenience for checking whether the system is ready. For internal use only.
84 */
85 static public boolean isSystemReady() {
86 if (!sSystemReady) {
87 sSystemReady = getDefault().testIsSystemReady();
88 }
89 return sSystemReady;
90 }
91 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080092
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 /**
94 * Convenience for sending a sticky broadcast. For internal use only.
95 * If you don't care about permission, use null.
96 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070097 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080098 try {
99 getDefault().broadcastIntent(
100 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800101 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 } catch (RemoteException ex) {
103 }
104 }
105
Dianne Hackborn099bc622014-01-22 13:39:16 -0800106 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800108 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 } catch (RemoteException ex) {
110 }
111 }
112
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800113 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800114 attachInterface(this, descriptor);
115 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700116
117 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
119 throws RemoteException {
120 switch (code) {
121 case START_ACTIVITY_TRANSACTION:
122 {
123 data.enforceInterface(IActivityManager.descriptor);
124 IBinder b = data.readStrongBinder();
125 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800126 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800127 Intent intent = Intent.CREATOR.createFromParcel(data);
128 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800130 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700132 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700133 String profileFile = data.readString();
134 ParcelFileDescriptor profileFd = data.readInt() != 0
135 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700136 Bundle options = data.readInt() != 0
137 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800138 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700139 resultTo, resultWho, requestCode, startFlags,
140 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800141 reply.writeNoException();
142 reply.writeInt(result);
143 return true;
144 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700145
Amith Yamasani82644082012-08-03 13:09:11 -0700146 case START_ACTIVITY_AS_USER_TRANSACTION:
147 {
148 data.enforceInterface(IActivityManager.descriptor);
149 IBinder b = data.readStrongBinder();
150 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800151 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700152 Intent intent = Intent.CREATOR.createFromParcel(data);
153 String resolvedType = data.readString();
154 IBinder resultTo = data.readStrongBinder();
155 String resultWho = data.readString();
156 int requestCode = data.readInt();
157 int startFlags = data.readInt();
158 String profileFile = data.readString();
159 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700160 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
163 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800164 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700165 resultTo, resultWho, requestCode, startFlags,
166 profileFile, profileFd, options, userId);
167 reply.writeNoException();
168 reply.writeInt(result);
169 return true;
170 }
171
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800172 case START_ACTIVITY_AND_WAIT_TRANSACTION:
173 {
174 data.enforceInterface(IActivityManager.descriptor);
175 IBinder b = data.readStrongBinder();
176 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800177 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800178 Intent intent = Intent.CREATOR.createFromParcel(data);
179 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800180 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800181 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800182 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700183 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700184 String profileFile = data.readString();
185 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700186 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700187 Bundle options = data.readInt() != 0
188 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700189 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800190 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700191 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700192 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800193 reply.writeNoException();
194 result.writeToParcel(reply, 0);
195 return true;
196 }
197
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700198 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
199 {
200 data.enforceInterface(IActivityManager.descriptor);
201 IBinder b = data.readStrongBinder();
202 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800203 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700204 Intent intent = Intent.CREATOR.createFromParcel(data);
205 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700206 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700207 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700208 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700209 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700210 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700211 Bundle options = data.readInt() != 0
212 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700213 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800214 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700215 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700216 reply.writeNoException();
217 reply.writeInt(result);
218 return true;
219 }
220
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700221 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700222 {
223 data.enforceInterface(IActivityManager.descriptor);
224 IBinder b = data.readStrongBinder();
225 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700226 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700227 Intent fillInIntent = null;
228 if (data.readInt() != 0) {
229 fillInIntent = Intent.CREATOR.createFromParcel(data);
230 }
231 String resolvedType = data.readString();
232 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700233 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700234 int requestCode = data.readInt();
235 int flagsMask = data.readInt();
236 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700237 Bundle options = data.readInt() != 0
238 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700239 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700240 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700241 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700242 reply.writeNoException();
243 reply.writeInt(result);
244 return true;
245 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700246
Dianne Hackborn91097de2014-04-04 18:02:06 -0700247 case START_VOICE_ACTIVITY_TRANSACTION:
248 {
249 data.enforceInterface(IActivityManager.descriptor);
250 String callingPackage = data.readString();
251 int callingPid = data.readInt();
252 int callingUid = data.readInt();
253 Intent intent = Intent.CREATOR.createFromParcel(data);
254 String resolvedType = data.readString();
255 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
256 data.readStrongBinder());
257 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
258 data.readStrongBinder());
259 int startFlags = data.readInt();
260 String profileFile = data.readString();
261 ParcelFileDescriptor profileFd = data.readInt() != 0
262 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
263 Bundle options = data.readInt() != 0
264 ? Bundle.CREATOR.createFromParcel(data) : null;
265 int userId = data.readInt();
266 int result = startVoiceActivity(callingPackage, callingPid, callingUid,
267 intent, resolvedType, session, interactor, startFlags,
268 profileFile, profileFd, options, userId);
269 reply.writeNoException();
270 reply.writeInt(result);
271 return true;
272 }
273
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800274 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
275 {
276 data.enforceInterface(IActivityManager.descriptor);
277 IBinder callingActivity = data.readStrongBinder();
278 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700279 Bundle options = data.readInt() != 0
280 ? Bundle.CREATOR.createFromParcel(data) : null;
281 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800282 reply.writeNoException();
283 reply.writeInt(result ? 1 : 0);
284 return true;
285 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700286
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800287 case FINISH_ACTIVITY_TRANSACTION: {
288 data.enforceInterface(IActivityManager.descriptor);
289 IBinder token = data.readStrongBinder();
290 Intent resultData = null;
291 int resultCode = data.readInt();
292 if (data.readInt() != 0) {
293 resultData = Intent.CREATOR.createFromParcel(data);
294 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700295 boolean finishTask = (data.readInt() != 0);
296 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800297 reply.writeNoException();
298 reply.writeInt(res ? 1 : 0);
299 return true;
300 }
301
302 case FINISH_SUB_ACTIVITY_TRANSACTION: {
303 data.enforceInterface(IActivityManager.descriptor);
304 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700305 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800306 int requestCode = data.readInt();
307 finishSubActivity(token, resultWho, requestCode);
308 reply.writeNoException();
309 return true;
310 }
311
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700312 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
313 data.enforceInterface(IActivityManager.descriptor);
314 IBinder token = data.readStrongBinder();
315 boolean res = finishActivityAffinity(token);
316 reply.writeNoException();
317 reply.writeInt(res ? 1 : 0);
318 return true;
319 }
320
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700321 case FINISH_VOICE_TASK_TRANSACTION: {
322 data.enforceInterface(IActivityManager.descriptor);
323 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
324 data.readStrongBinder());
325 finishVoiceTask(session);
326 reply.writeNoException();
327 return true;
328 }
329
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800330 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
331 data.enforceInterface(IActivityManager.descriptor);
332 IBinder token = data.readStrongBinder();
333 boolean res = willActivityBeVisible(token);
334 reply.writeNoException();
335 reply.writeInt(res ? 1 : 0);
336 return true;
337 }
338
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800339 case REGISTER_RECEIVER_TRANSACTION:
340 {
341 data.enforceInterface(IActivityManager.descriptor);
342 IBinder b = data.readStrongBinder();
343 IApplicationThread app =
344 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700345 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800346 b = data.readStrongBinder();
347 IIntentReceiver rec
348 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
349 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
350 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700351 int userId = data.readInt();
352 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800353 reply.writeNoException();
354 if (intent != null) {
355 reply.writeInt(1);
356 intent.writeToParcel(reply, 0);
357 } else {
358 reply.writeInt(0);
359 }
360 return true;
361 }
362
363 case UNREGISTER_RECEIVER_TRANSACTION:
364 {
365 data.enforceInterface(IActivityManager.descriptor);
366 IBinder b = data.readStrongBinder();
367 if (b == null) {
368 return true;
369 }
370 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
371 unregisterReceiver(rec);
372 reply.writeNoException();
373 return true;
374 }
375
376 case BROADCAST_INTENT_TRANSACTION:
377 {
378 data.enforceInterface(IActivityManager.descriptor);
379 IBinder b = data.readStrongBinder();
380 IApplicationThread app =
381 b != null ? ApplicationThreadNative.asInterface(b) : null;
382 Intent intent = Intent.CREATOR.createFromParcel(data);
383 String resolvedType = data.readString();
384 b = data.readStrongBinder();
385 IIntentReceiver resultTo =
386 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
387 int resultCode = data.readInt();
388 String resultData = data.readString();
389 Bundle resultExtras = data.readBundle();
390 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800391 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800392 boolean serialized = data.readInt() != 0;
393 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700394 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800395 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800396 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700397 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800398 reply.writeNoException();
399 reply.writeInt(res);
400 return true;
401 }
402
403 case UNBROADCAST_INTENT_TRANSACTION:
404 {
405 data.enforceInterface(IActivityManager.descriptor);
406 IBinder b = data.readStrongBinder();
407 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
408 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700409 int userId = data.readInt();
410 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800411 reply.writeNoException();
412 return true;
413 }
414
415 case FINISH_RECEIVER_TRANSACTION: {
416 data.enforceInterface(IActivityManager.descriptor);
417 IBinder who = data.readStrongBinder();
418 int resultCode = data.readInt();
419 String resultData = data.readString();
420 Bundle resultExtras = data.readBundle();
421 boolean resultAbort = data.readInt() != 0;
422 if (who != null) {
423 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
424 }
425 reply.writeNoException();
426 return true;
427 }
428
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800429 case ATTACH_APPLICATION_TRANSACTION: {
430 data.enforceInterface(IActivityManager.descriptor);
431 IApplicationThread app = ApplicationThreadNative.asInterface(
432 data.readStrongBinder());
433 if (app != null) {
434 attachApplication(app);
435 }
436 reply.writeNoException();
437 return true;
438 }
439
440 case ACTIVITY_IDLE_TRANSACTION: {
441 data.enforceInterface(IActivityManager.descriptor);
442 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700443 Configuration config = null;
444 if (data.readInt() != 0) {
445 config = Configuration.CREATOR.createFromParcel(data);
446 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700447 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800448 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700449 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800450 }
451 reply.writeNoException();
452 return true;
453 }
454
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700455 case ACTIVITY_RESUMED_TRANSACTION: {
456 data.enforceInterface(IActivityManager.descriptor);
457 IBinder token = data.readStrongBinder();
458 activityResumed(token);
459 reply.writeNoException();
460 return true;
461 }
462
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800463 case ACTIVITY_PAUSED_TRANSACTION: {
464 data.enforceInterface(IActivityManager.descriptor);
465 IBinder token = data.readStrongBinder();
Craig Mautnera0026042014-04-23 11:45:37 -0700466 PersistableBundle persistentState = data.readPersistableBundle();
467 activityPaused(token, persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800468 reply.writeNoException();
469 return true;
470 }
471
472 case ACTIVITY_STOPPED_TRANSACTION: {
473 data.enforceInterface(IActivityManager.descriptor);
474 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800475 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700476 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800477 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700478 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800479 reply.writeNoException();
480 return true;
481 }
482
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800483 case ACTIVITY_SLEPT_TRANSACTION: {
484 data.enforceInterface(IActivityManager.descriptor);
485 IBinder token = data.readStrongBinder();
486 activitySlept(token);
487 reply.writeNoException();
488 return true;
489 }
490
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800491 case ACTIVITY_DESTROYED_TRANSACTION: {
492 data.enforceInterface(IActivityManager.descriptor);
493 IBinder token = data.readStrongBinder();
494 activityDestroyed(token);
495 reply.writeNoException();
496 return true;
497 }
498
499 case GET_CALLING_PACKAGE_TRANSACTION: {
500 data.enforceInterface(IActivityManager.descriptor);
501 IBinder token = data.readStrongBinder();
502 String res = token != null ? getCallingPackage(token) : null;
503 reply.writeNoException();
504 reply.writeString(res);
505 return true;
506 }
507
508 case GET_CALLING_ACTIVITY_TRANSACTION: {
509 data.enforceInterface(IActivityManager.descriptor);
510 IBinder token = data.readStrongBinder();
511 ComponentName cn = getCallingActivity(token);
512 reply.writeNoException();
513 ComponentName.writeToParcel(cn, reply);
514 return true;
515 }
516
Winson Chung1147c402014-05-14 11:05:00 -0700517 case GET_APP_TASKS_TRANSACTION: {
518 data.enforceInterface(IActivityManager.descriptor);
519 List<IAppTask> list = getAppTasks();
520 reply.writeNoException();
521 int N = list != null ? list.size() : -1;
522 reply.writeInt(N);
523 int i;
524 for (i=0; i<N; i++) {
525 IAppTask task = list.get(i);
526 reply.writeStrongBinder(task.asBinder());
527 }
528 return true;
529 }
530
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800531 case GET_TASKS_TRANSACTION: {
532 data.enforceInterface(IActivityManager.descriptor);
533 int maxNum = data.readInt();
534 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700535 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800536 reply.writeNoException();
537 int N = list != null ? list.size() : -1;
538 reply.writeInt(N);
539 int i;
540 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700541 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800542 info.writeToParcel(reply, 0);
543 }
544 return true;
545 }
546
547 case GET_RECENT_TASKS_TRANSACTION: {
548 data.enforceInterface(IActivityManager.descriptor);
549 int maxNum = data.readInt();
550 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700551 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800552 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700553 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554 reply.writeNoException();
555 reply.writeTypedList(list);
556 return true;
557 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700558
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700559 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800560 data.enforceInterface(IActivityManager.descriptor);
561 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700562 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800563 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700564 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800565 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700566 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700567 } else {
568 reply.writeInt(0);
569 }
570 return true;
571 }
572
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800573 case GET_SERVICES_TRANSACTION: {
574 data.enforceInterface(IActivityManager.descriptor);
575 int maxNum = data.readInt();
576 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700577 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800578 reply.writeNoException();
579 int N = list != null ? list.size() : -1;
580 reply.writeInt(N);
581 int i;
582 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700583 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800584 info.writeToParcel(reply, 0);
585 }
586 return true;
587 }
588
589 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
590 data.enforceInterface(IActivityManager.descriptor);
591 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
592 reply.writeNoException();
593 reply.writeTypedList(list);
594 return true;
595 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700596
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800597 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
598 data.enforceInterface(IActivityManager.descriptor);
599 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
600 reply.writeNoException();
601 reply.writeTypedList(list);
602 return true;
603 }
604
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700605 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
606 data.enforceInterface(IActivityManager.descriptor);
607 List<ApplicationInfo> list = getRunningExternalApplications();
608 reply.writeNoException();
609 reply.writeTypedList(list);
610 return true;
611 }
612
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800613 case MOVE_TASK_TO_FRONT_TRANSACTION: {
614 data.enforceInterface(IActivityManager.descriptor);
615 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800616 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700617 Bundle options = data.readInt() != 0
618 ? Bundle.CREATOR.createFromParcel(data) : null;
619 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800620 reply.writeNoException();
621 return true;
622 }
623
624 case MOVE_TASK_TO_BACK_TRANSACTION: {
625 data.enforceInterface(IActivityManager.descriptor);
626 int task = data.readInt();
627 moveTaskToBack(task);
628 reply.writeNoException();
629 return true;
630 }
631
632 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
633 data.enforceInterface(IActivityManager.descriptor);
634 IBinder token = data.readStrongBinder();
635 boolean nonRoot = data.readInt() != 0;
636 boolean res = moveActivityTaskToBack(token, nonRoot);
637 reply.writeNoException();
638 reply.writeInt(res ? 1 : 0);
639 return true;
640 }
641
642 case MOVE_TASK_BACKWARDS_TRANSACTION: {
643 data.enforceInterface(IActivityManager.descriptor);
644 int task = data.readInt();
645 moveTaskBackwards(task);
646 reply.writeNoException();
647 return true;
648 }
649
Craig Mautnerc00204b2013-03-05 15:02:14 -0800650 case MOVE_TASK_TO_STACK_TRANSACTION: {
651 data.enforceInterface(IActivityManager.descriptor);
652 int taskId = data.readInt();
653 int stackId = data.readInt();
654 boolean toTop = data.readInt() != 0;
655 moveTaskToStack(taskId, stackId, toTop);
656 reply.writeNoException();
657 return true;
658 }
659
660 case RESIZE_STACK_TRANSACTION: {
661 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800662 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800663 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800664 Rect r = Rect.CREATOR.createFromParcel(data);
665 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800666 reply.writeNoException();
667 return true;
668 }
669
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800670 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700671 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800672 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700673 reply.writeNoException();
674 reply.writeTypedList(list);
675 return true;
676 }
677
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800678 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700679 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800680 int stackId = data.readInt();
681 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700682 reply.writeNoException();
683 if (info != null) {
684 reply.writeInt(1);
685 info.writeToParcel(reply, 0);
686 } else {
687 reply.writeInt(0);
688 }
689 return true;
690 }
691
Winson Chung303e1ff2014-03-07 15:06:19 -0800692 case IS_IN_HOME_STACK_TRANSACTION: {
693 data.enforceInterface(IActivityManager.descriptor);
694 int taskId = data.readInt();
695 boolean isInHomeStack = isInHomeStack(taskId);
696 reply.writeNoException();
697 reply.writeInt(isInHomeStack ? 1 : 0);
698 return true;
699 }
700
Craig Mautnercf910b02013-04-23 11:23:27 -0700701 case SET_FOCUSED_STACK_TRANSACTION: {
702 data.enforceInterface(IActivityManager.descriptor);
703 int stackId = data.readInt();
704 setFocusedStack(stackId);
705 reply.writeNoException();
706 return true;
707 }
708
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800709 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
710 data.enforceInterface(IActivityManager.descriptor);
711 IBinder token = data.readStrongBinder();
712 boolean onlyRoot = data.readInt() != 0;
713 int res = token != null
714 ? getTaskForActivity(token, onlyRoot) : -1;
715 reply.writeNoException();
716 reply.writeInt(res);
717 return true;
718 }
719
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800720 case GET_CONTENT_PROVIDER_TRANSACTION: {
721 data.enforceInterface(IActivityManager.descriptor);
722 IBinder b = data.readStrongBinder();
723 IApplicationThread app = ApplicationThreadNative.asInterface(b);
724 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700725 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700726 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700727 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800728 reply.writeNoException();
729 if (cph != null) {
730 reply.writeInt(1);
731 cph.writeToParcel(reply, 0);
732 } else {
733 reply.writeInt(0);
734 }
735 return true;
736 }
737
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800738 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
739 data.enforceInterface(IActivityManager.descriptor);
740 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700741 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800742 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700743 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800744 reply.writeNoException();
745 if (cph != null) {
746 reply.writeInt(1);
747 cph.writeToParcel(reply, 0);
748 } else {
749 reply.writeInt(0);
750 }
751 return true;
752 }
753
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800754 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
755 data.enforceInterface(IActivityManager.descriptor);
756 IBinder b = data.readStrongBinder();
757 IApplicationThread app = ApplicationThreadNative.asInterface(b);
758 ArrayList<ContentProviderHolder> providers =
759 data.createTypedArrayList(ContentProviderHolder.CREATOR);
760 publishContentProviders(app, providers);
761 reply.writeNoException();
762 return true;
763 }
764
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700765 case REF_CONTENT_PROVIDER_TRANSACTION: {
766 data.enforceInterface(IActivityManager.descriptor);
767 IBinder b = data.readStrongBinder();
768 int stable = data.readInt();
769 int unstable = data.readInt();
770 boolean res = refContentProvider(b, stable, unstable);
771 reply.writeNoException();
772 reply.writeInt(res ? 1 : 0);
773 return true;
774 }
775
776 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
777 data.enforceInterface(IActivityManager.descriptor);
778 IBinder b = data.readStrongBinder();
779 unstableProviderDied(b);
780 reply.writeNoException();
781 return true;
782 }
783
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700784 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
785 data.enforceInterface(IActivityManager.descriptor);
786 IBinder b = data.readStrongBinder();
787 appNotRespondingViaProvider(b);
788 reply.writeNoException();
789 return true;
790 }
791
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800792 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
793 data.enforceInterface(IActivityManager.descriptor);
794 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700795 boolean stable = data.readInt() != 0;
796 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800797 reply.writeNoException();
798 return true;
799 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800800
801 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
802 data.enforceInterface(IActivityManager.descriptor);
803 String name = data.readString();
804 IBinder token = data.readStrongBinder();
805 removeContentProviderExternal(name, token);
806 reply.writeNoException();
807 return true;
808 }
809
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700810 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
811 data.enforceInterface(IActivityManager.descriptor);
812 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
813 PendingIntent pi = getRunningServiceControlPanel(comp);
814 reply.writeNoException();
815 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
816 return true;
817 }
818
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800819 case START_SERVICE_TRANSACTION: {
820 data.enforceInterface(IActivityManager.descriptor);
821 IBinder b = data.readStrongBinder();
822 IApplicationThread app = ApplicationThreadNative.asInterface(b);
823 Intent service = Intent.CREATOR.createFromParcel(data);
824 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700825 int userId = data.readInt();
826 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800827 reply.writeNoException();
828 ComponentName.writeToParcel(cn, reply);
829 return true;
830 }
831
832 case STOP_SERVICE_TRANSACTION: {
833 data.enforceInterface(IActivityManager.descriptor);
834 IBinder b = data.readStrongBinder();
835 IApplicationThread app = ApplicationThreadNative.asInterface(b);
836 Intent service = Intent.CREATOR.createFromParcel(data);
837 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700838 int userId = data.readInt();
839 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800840 reply.writeNoException();
841 reply.writeInt(res);
842 return true;
843 }
844
845 case STOP_SERVICE_TOKEN_TRANSACTION: {
846 data.enforceInterface(IActivityManager.descriptor);
847 ComponentName className = ComponentName.readFromParcel(data);
848 IBinder token = data.readStrongBinder();
849 int startId = data.readInt();
850 boolean res = stopServiceToken(className, token, startId);
851 reply.writeNoException();
852 reply.writeInt(res ? 1 : 0);
853 return true;
854 }
855
856 case SET_SERVICE_FOREGROUND_TRANSACTION: {
857 data.enforceInterface(IActivityManager.descriptor);
858 ComponentName className = ComponentName.readFromParcel(data);
859 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700860 int id = data.readInt();
861 Notification notification = null;
862 if (data.readInt() != 0) {
863 notification = Notification.CREATOR.createFromParcel(data);
864 }
865 boolean removeNotification = data.readInt() != 0;
866 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800867 reply.writeNoException();
868 return true;
869 }
870
871 case BIND_SERVICE_TRANSACTION: {
872 data.enforceInterface(IActivityManager.descriptor);
873 IBinder b = data.readStrongBinder();
874 IApplicationThread app = ApplicationThreadNative.asInterface(b);
875 IBinder token = data.readStrongBinder();
876 Intent service = Intent.CREATOR.createFromParcel(data);
877 String resolvedType = data.readString();
878 b = data.readStrongBinder();
879 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800880 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800881 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800882 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800883 reply.writeNoException();
884 reply.writeInt(res);
885 return true;
886 }
887
888 case UNBIND_SERVICE_TRANSACTION: {
889 data.enforceInterface(IActivityManager.descriptor);
890 IBinder b = data.readStrongBinder();
891 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
892 boolean res = unbindService(conn);
893 reply.writeNoException();
894 reply.writeInt(res ? 1 : 0);
895 return true;
896 }
897
898 case PUBLISH_SERVICE_TRANSACTION: {
899 data.enforceInterface(IActivityManager.descriptor);
900 IBinder token = data.readStrongBinder();
901 Intent intent = Intent.CREATOR.createFromParcel(data);
902 IBinder service = data.readStrongBinder();
903 publishService(token, intent, service);
904 reply.writeNoException();
905 return true;
906 }
907
908 case UNBIND_FINISHED_TRANSACTION: {
909 data.enforceInterface(IActivityManager.descriptor);
910 IBinder token = data.readStrongBinder();
911 Intent intent = Intent.CREATOR.createFromParcel(data);
912 boolean doRebind = data.readInt() != 0;
913 unbindFinished(token, intent, doRebind);
914 reply.writeNoException();
915 return true;
916 }
917
918 case SERVICE_DONE_EXECUTING_TRANSACTION: {
919 data.enforceInterface(IActivityManager.descriptor);
920 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700921 int type = data.readInt();
922 int startId = data.readInt();
923 int res = data.readInt();
924 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800925 reply.writeNoException();
926 return true;
927 }
928
929 case START_INSTRUMENTATION_TRANSACTION: {
930 data.enforceInterface(IActivityManager.descriptor);
931 ComponentName className = ComponentName.readFromParcel(data);
932 String profileFile = data.readString();
933 int fl = data.readInt();
934 Bundle arguments = data.readBundle();
935 IBinder b = data.readStrongBinder();
936 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800937 b = data.readStrongBinder();
938 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700939 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +0100940 String abiOverride = data.readString();
941 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
942 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800943 reply.writeNoException();
944 reply.writeInt(res ? 1 : 0);
945 return true;
946 }
947
948
949 case FINISH_INSTRUMENTATION_TRANSACTION: {
950 data.enforceInterface(IActivityManager.descriptor);
951 IBinder b = data.readStrongBinder();
952 IApplicationThread app = ApplicationThreadNative.asInterface(b);
953 int resultCode = data.readInt();
954 Bundle results = data.readBundle();
955 finishInstrumentation(app, resultCode, results);
956 reply.writeNoException();
957 return true;
958 }
959
960 case GET_CONFIGURATION_TRANSACTION: {
961 data.enforceInterface(IActivityManager.descriptor);
962 Configuration config = getConfiguration();
963 reply.writeNoException();
964 config.writeToParcel(reply, 0);
965 return true;
966 }
967
968 case UPDATE_CONFIGURATION_TRANSACTION: {
969 data.enforceInterface(IActivityManager.descriptor);
970 Configuration config = Configuration.CREATOR.createFromParcel(data);
971 updateConfiguration(config);
972 reply.writeNoException();
973 return true;
974 }
975
976 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
977 data.enforceInterface(IActivityManager.descriptor);
978 IBinder token = data.readStrongBinder();
979 int requestedOrientation = data.readInt();
980 setRequestedOrientation(token, requestedOrientation);
981 reply.writeNoException();
982 return true;
983 }
984
985 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
986 data.enforceInterface(IActivityManager.descriptor);
987 IBinder token = data.readStrongBinder();
988 int req = getRequestedOrientation(token);
989 reply.writeNoException();
990 reply.writeInt(req);
991 return true;
992 }
993
994 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
995 data.enforceInterface(IActivityManager.descriptor);
996 IBinder token = data.readStrongBinder();
997 ComponentName cn = getActivityClassForToken(token);
998 reply.writeNoException();
999 ComponentName.writeToParcel(cn, reply);
1000 return true;
1001 }
1002
1003 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1004 data.enforceInterface(IActivityManager.descriptor);
1005 IBinder token = data.readStrongBinder();
1006 reply.writeNoException();
1007 reply.writeString(getPackageForToken(token));
1008 return true;
1009 }
1010
1011 case GET_INTENT_SENDER_TRANSACTION: {
1012 data.enforceInterface(IActivityManager.descriptor);
1013 int type = data.readInt();
1014 String packageName = data.readString();
1015 IBinder token = data.readStrongBinder();
1016 String resultWho = data.readString();
1017 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001018 Intent[] requestIntents;
1019 String[] requestResolvedTypes;
1020 if (data.readInt() != 0) {
1021 requestIntents = data.createTypedArray(Intent.CREATOR);
1022 requestResolvedTypes = data.createStringArray();
1023 } else {
1024 requestIntents = null;
1025 requestResolvedTypes = null;
1026 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001027 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001028 Bundle options = data.readInt() != 0
1029 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001030 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001031 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001032 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001033 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001034 reply.writeNoException();
1035 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1036 return true;
1037 }
1038
1039 case CANCEL_INTENT_SENDER_TRANSACTION: {
1040 data.enforceInterface(IActivityManager.descriptor);
1041 IIntentSender r = IIntentSender.Stub.asInterface(
1042 data.readStrongBinder());
1043 cancelIntentSender(r);
1044 reply.writeNoException();
1045 return true;
1046 }
1047
1048 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1049 data.enforceInterface(IActivityManager.descriptor);
1050 IIntentSender r = IIntentSender.Stub.asInterface(
1051 data.readStrongBinder());
1052 String res = getPackageForIntentSender(r);
1053 reply.writeNoException();
1054 reply.writeString(res);
1055 return true;
1056 }
1057
Christopher Tatec4a07d12012-04-06 14:19:13 -07001058 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1059 data.enforceInterface(IActivityManager.descriptor);
1060 IIntentSender r = IIntentSender.Stub.asInterface(
1061 data.readStrongBinder());
1062 int res = getUidForIntentSender(r);
1063 reply.writeNoException();
1064 reply.writeInt(res);
1065 return true;
1066 }
1067
Dianne Hackborn41203752012-08-31 14:05:51 -07001068 case HANDLE_INCOMING_USER_TRANSACTION: {
1069 data.enforceInterface(IActivityManager.descriptor);
1070 int callingPid = data.readInt();
1071 int callingUid = data.readInt();
1072 int userId = data.readInt();
1073 boolean allowAll = data.readInt() != 0 ;
1074 boolean requireFull = data.readInt() != 0;
1075 String name = data.readString();
1076 String callerPackage = data.readString();
1077 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1078 requireFull, name, callerPackage);
1079 reply.writeNoException();
1080 reply.writeInt(res);
1081 return true;
1082 }
1083
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001084 case SET_PROCESS_LIMIT_TRANSACTION: {
1085 data.enforceInterface(IActivityManager.descriptor);
1086 int max = data.readInt();
1087 setProcessLimit(max);
1088 reply.writeNoException();
1089 return true;
1090 }
1091
1092 case GET_PROCESS_LIMIT_TRANSACTION: {
1093 data.enforceInterface(IActivityManager.descriptor);
1094 int limit = getProcessLimit();
1095 reply.writeNoException();
1096 reply.writeInt(limit);
1097 return true;
1098 }
1099
1100 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1101 data.enforceInterface(IActivityManager.descriptor);
1102 IBinder token = data.readStrongBinder();
1103 int pid = data.readInt();
1104 boolean isForeground = data.readInt() != 0;
1105 setProcessForeground(token, pid, isForeground);
1106 reply.writeNoException();
1107 return true;
1108 }
1109
1110 case CHECK_PERMISSION_TRANSACTION: {
1111 data.enforceInterface(IActivityManager.descriptor);
1112 String perm = data.readString();
1113 int pid = data.readInt();
1114 int uid = data.readInt();
1115 int res = checkPermission(perm, pid, uid);
1116 reply.writeNoException();
1117 reply.writeInt(res);
1118 return true;
1119 }
1120
1121 case CHECK_URI_PERMISSION_TRANSACTION: {
1122 data.enforceInterface(IActivityManager.descriptor);
1123 Uri uri = Uri.CREATOR.createFromParcel(data);
1124 int pid = data.readInt();
1125 int uid = data.readInt();
1126 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001127 int userId = data.readInt();
1128 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001129 reply.writeNoException();
1130 reply.writeInt(res);
1131 return true;
1132 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001133
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001134 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001135 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001136 String packageName = data.readString();
1137 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1138 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001139 int userId = data.readInt();
1140 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001141 reply.writeNoException();
1142 reply.writeInt(res ? 1 : 0);
1143 return true;
1144 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001145
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001146 case GRANT_URI_PERMISSION_TRANSACTION: {
1147 data.enforceInterface(IActivityManager.descriptor);
1148 IBinder b = data.readStrongBinder();
1149 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1150 String targetPkg = data.readString();
1151 Uri uri = Uri.CREATOR.createFromParcel(data);
1152 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001153 int userId = data.readInt();
1154 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001155 reply.writeNoException();
1156 return true;
1157 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001158
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001159 case REVOKE_URI_PERMISSION_TRANSACTION: {
1160 data.enforceInterface(IActivityManager.descriptor);
1161 IBinder b = data.readStrongBinder();
1162 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1163 Uri uri = Uri.CREATOR.createFromParcel(data);
1164 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001165 int userId = data.readInt();
1166 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001167 reply.writeNoException();
1168 return true;
1169 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001170
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001171 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1172 data.enforceInterface(IActivityManager.descriptor);
1173 Uri uri = Uri.CREATOR.createFromParcel(data);
1174 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001175 int userId = data.readInt();
1176 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001177 reply.writeNoException();
1178 return true;
1179 }
1180
1181 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1182 data.enforceInterface(IActivityManager.descriptor);
1183 Uri uri = Uri.CREATOR.createFromParcel(data);
1184 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001185 int userId = data.readInt();
1186 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001187 reply.writeNoException();
1188 return true;
1189 }
1190
1191 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1192 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001193 final String packageName = data.readString();
1194 final boolean incoming = data.readInt() != 0;
1195 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1196 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001197 reply.writeNoException();
1198 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1199 return true;
1200 }
1201
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001202 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1203 data.enforceInterface(IActivityManager.descriptor);
1204 IBinder b = data.readStrongBinder();
1205 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1206 boolean waiting = data.readInt() != 0;
1207 showWaitingForDebugger(app, waiting);
1208 reply.writeNoException();
1209 return true;
1210 }
1211
1212 case GET_MEMORY_INFO_TRANSACTION: {
1213 data.enforceInterface(IActivityManager.descriptor);
1214 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1215 getMemoryInfo(mi);
1216 reply.writeNoException();
1217 mi.writeToParcel(reply, 0);
1218 return true;
1219 }
1220
1221 case UNHANDLED_BACK_TRANSACTION: {
1222 data.enforceInterface(IActivityManager.descriptor);
1223 unhandledBack();
1224 reply.writeNoException();
1225 return true;
1226 }
1227
1228 case OPEN_CONTENT_URI_TRANSACTION: {
1229 data.enforceInterface(IActivityManager.descriptor);
1230 Uri uri = Uri.parse(data.readString());
1231 ParcelFileDescriptor pfd = openContentUri(uri);
1232 reply.writeNoException();
1233 if (pfd != null) {
1234 reply.writeInt(1);
1235 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1236 } else {
1237 reply.writeInt(0);
1238 }
1239 return true;
1240 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001241
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001242 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1243 data.enforceInterface(IActivityManager.descriptor);
1244 setLockScreenShown(data.readInt() != 0);
1245 reply.writeNoException();
1246 return true;
1247 }
1248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001249 case SET_DEBUG_APP_TRANSACTION: {
1250 data.enforceInterface(IActivityManager.descriptor);
1251 String pn = data.readString();
1252 boolean wfd = data.readInt() != 0;
1253 boolean per = data.readInt() != 0;
1254 setDebugApp(pn, wfd, per);
1255 reply.writeNoException();
1256 return true;
1257 }
1258
1259 case SET_ALWAYS_FINISH_TRANSACTION: {
1260 data.enforceInterface(IActivityManager.descriptor);
1261 boolean enabled = data.readInt() != 0;
1262 setAlwaysFinish(enabled);
1263 reply.writeNoException();
1264 return true;
1265 }
1266
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001267 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001268 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001269 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001270 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001271 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001272 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001273 return true;
1274 }
1275
1276 case ENTER_SAFE_MODE_TRANSACTION: {
1277 data.enforceInterface(IActivityManager.descriptor);
1278 enterSafeMode();
1279 reply.writeNoException();
1280 return true;
1281 }
1282
1283 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1284 data.enforceInterface(IActivityManager.descriptor);
1285 IIntentSender is = IIntentSender.Stub.asInterface(
1286 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001287 int sourceUid = data.readInt();
1288 String sourcePkg = data.readString();
1289 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001290 reply.writeNoException();
1291 return true;
1292 }
1293
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001294 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001295 data.enforceInterface(IActivityManager.descriptor);
1296 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001297 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001298 boolean secure = data.readInt() != 0;
1299 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001300 reply.writeNoException();
1301 reply.writeInt(res ? 1 : 0);
1302 return true;
1303 }
1304
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001305 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1306 data.enforceInterface(IActivityManager.descriptor);
1307 String reason = data.readString();
1308 boolean res = killProcessesBelowForeground(reason);
1309 reply.writeNoException();
1310 reply.writeInt(res ? 1 : 0);
1311 return true;
1312 }
1313
Dan Egnor60d87622009-12-16 16:32:58 -08001314 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1315 data.enforceInterface(IActivityManager.descriptor);
1316 IBinder app = data.readStrongBinder();
1317 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1318 handleApplicationCrash(app, ci);
1319 reply.writeNoException();
1320 return true;
1321 }
1322
1323 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001324 data.enforceInterface(IActivityManager.descriptor);
1325 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001326 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001327 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001328 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001329 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001330 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001331 return true;
1332 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001333
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001334 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1335 data.enforceInterface(IActivityManager.descriptor);
1336 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001337 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001338 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1339 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001340 reply.writeNoException();
1341 return true;
1342 }
1343
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001344 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1345 data.enforceInterface(IActivityManager.descriptor);
1346 int sig = data.readInt();
1347 signalPersistentProcesses(sig);
1348 reply.writeNoException();
1349 return true;
1350 }
1351
Dianne Hackborn03abb812010-01-04 18:43:19 -08001352 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1353 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001354 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001355 int userId = data.readInt();
1356 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001357 reply.writeNoException();
1358 return true;
1359 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001360
1361 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1362 data.enforceInterface(IActivityManager.descriptor);
1363 killAllBackgroundProcesses();
1364 reply.writeNoException();
1365 return true;
1366 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001367
Dianne Hackborn03abb812010-01-04 18:43:19 -08001368 case FORCE_STOP_PACKAGE_TRANSACTION: {
1369 data.enforceInterface(IActivityManager.descriptor);
1370 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001371 int userId = data.readInt();
1372 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001373 reply.writeNoException();
1374 return true;
1375 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001376
1377 case GET_MY_MEMORY_STATE_TRANSACTION: {
1378 data.enforceInterface(IActivityManager.descriptor);
1379 ActivityManager.RunningAppProcessInfo info =
1380 new ActivityManager.RunningAppProcessInfo();
1381 getMyMemoryState(info);
1382 reply.writeNoException();
1383 info.writeToParcel(reply, 0);
1384 return true;
1385 }
1386
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001387 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1388 data.enforceInterface(IActivityManager.descriptor);
1389 ConfigurationInfo config = getDeviceConfigurationInfo();
1390 reply.writeNoException();
1391 config.writeToParcel(reply, 0);
1392 return true;
1393 }
1394
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001395 case PROFILE_CONTROL_TRANSACTION: {
1396 data.enforceInterface(IActivityManager.descriptor);
1397 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001398 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001399 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001400 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001401 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001402 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001403 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001404 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001405 reply.writeNoException();
1406 reply.writeInt(res ? 1 : 0);
1407 return true;
1408 }
1409
Dianne Hackborn55280a92009-05-07 15:53:46 -07001410 case SHUTDOWN_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 boolean res = shutdown(data.readInt());
1413 reply.writeNoException();
1414 reply.writeInt(res ? 1 : 0);
1415 return true;
1416 }
1417
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001418 case STOP_APP_SWITCHES_TRANSACTION: {
1419 data.enforceInterface(IActivityManager.descriptor);
1420 stopAppSwitches();
1421 reply.writeNoException();
1422 return true;
1423 }
1424
1425 case RESUME_APP_SWITCHES_TRANSACTION: {
1426 data.enforceInterface(IActivityManager.descriptor);
1427 resumeAppSwitches();
1428 reply.writeNoException();
1429 return true;
1430 }
1431
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001432 case PEEK_SERVICE_TRANSACTION: {
1433 data.enforceInterface(IActivityManager.descriptor);
1434 Intent service = Intent.CREATOR.createFromParcel(data);
1435 String resolvedType = data.readString();
1436 IBinder binder = peekService(service, resolvedType);
1437 reply.writeNoException();
1438 reply.writeStrongBinder(binder);
1439 return true;
1440 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001441
1442 case START_BACKUP_AGENT_TRANSACTION: {
1443 data.enforceInterface(IActivityManager.descriptor);
1444 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1445 int backupRestoreMode = data.readInt();
1446 boolean success = bindBackupAgent(info, backupRestoreMode);
1447 reply.writeNoException();
1448 reply.writeInt(success ? 1 : 0);
1449 return true;
1450 }
1451
1452 case BACKUP_AGENT_CREATED_TRANSACTION: {
1453 data.enforceInterface(IActivityManager.descriptor);
1454 String packageName = data.readString();
1455 IBinder agent = data.readStrongBinder();
1456 backupAgentCreated(packageName, agent);
1457 reply.writeNoException();
1458 return true;
1459 }
1460
1461 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1462 data.enforceInterface(IActivityManager.descriptor);
1463 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1464 unbindBackupAgent(info);
1465 reply.writeNoException();
1466 return true;
1467 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001468
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001469 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001470 data.enforceInterface(IActivityManager.descriptor);
1471 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001472 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001473 String reason = data.readString();
1474 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001475 reply.writeNoException();
1476 return true;
1477 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001478
1479 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1480 data.enforceInterface(IActivityManager.descriptor);
1481 String reason = data.readString();
1482 closeSystemDialogs(reason);
1483 reply.writeNoException();
1484 return true;
1485 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001486
1487 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1488 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001489 int[] pids = data.createIntArray();
1490 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001491 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001492 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001493 return true;
1494 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001495
1496 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1497 data.enforceInterface(IActivityManager.descriptor);
1498 String processName = data.readString();
1499 int uid = data.readInt();
1500 killApplicationProcess(processName, uid);
1501 reply.writeNoException();
1502 return true;
1503 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001504
1505 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1506 data.enforceInterface(IActivityManager.descriptor);
1507 IBinder token = data.readStrongBinder();
1508 String packageName = data.readString();
1509 int enterAnim = data.readInt();
1510 int exitAnim = data.readInt();
1511 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001512 reply.writeNoException();
1513 return true;
1514 }
1515
1516 case IS_USER_A_MONKEY_TRANSACTION: {
1517 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001518 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001519 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001520 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001521 return true;
1522 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001523
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001524 case SET_USER_IS_MONKEY_TRANSACTION: {
1525 data.enforceInterface(IActivityManager.descriptor);
1526 final boolean monkey = (data.readInt() == 1);
1527 setUserIsMonkey(monkey);
1528 reply.writeNoException();
1529 return true;
1530 }
1531
Dianne Hackborn860755f2010-06-03 18:47:52 -07001532 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1533 data.enforceInterface(IActivityManager.descriptor);
1534 finishHeavyWeightApp();
1535 reply.writeNoException();
1536 return true;
1537 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001538
1539 case IS_IMMERSIVE_TRANSACTION: {
1540 data.enforceInterface(IActivityManager.descriptor);
1541 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001542 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001543 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001544 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001545 return true;
1546 }
1547
Craig Mautnerd61dc202014-07-07 11:09:11 -07001548 case IS_TOP_OF_TASK_TRANSACTION: {
1549 data.enforceInterface(IActivityManager.descriptor);
1550 IBinder token = data.readStrongBinder();
1551 final boolean isTopOfTask = isTopOfTask(token);
1552 reply.writeNoException();
1553 reply.writeInt(isTopOfTask ? 1 : 0);
1554 return true;
1555 }
1556
Craig Mautner5eda9b32013-07-02 11:58:16 -07001557 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001558 data.enforceInterface(IActivityManager.descriptor);
1559 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001560 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001561 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001562 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001563 return true;
1564 }
1565
1566 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1567 data.enforceInterface(IActivityManager.descriptor);
1568 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001569 final Bundle bundle;
1570 if (data.readInt() == 0) {
1571 bundle = null;
1572 } else {
1573 bundle = data.readBundle();
1574 }
1575 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1576 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001577 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001578 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001579 return true;
1580 }
1581
Craig Mautner233ceee2014-05-09 17:05:11 -07001582 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1583 data.enforceInterface(IActivityManager.descriptor);
1584 IBinder token = data.readStrongBinder();
1585 final ActivityOptions options = getActivityOptions(token);
1586 reply.writeNoException();
1587 reply.writeBundle(options == null ? null : options.toBundle());
1588 return true;
1589 }
1590
Daniel Sandler69a48172010-06-23 16:29:36 -04001591 case SET_IMMERSIVE_TRANSACTION: {
1592 data.enforceInterface(IActivityManager.descriptor);
1593 IBinder token = data.readStrongBinder();
1594 boolean imm = data.readInt() == 1;
1595 setImmersive(token, imm);
1596 reply.writeNoException();
1597 return true;
1598 }
1599
1600 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1601 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001602 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001603 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001604 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001605 return true;
1606 }
1607
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001608 case CRASH_APPLICATION_TRANSACTION: {
1609 data.enforceInterface(IActivityManager.descriptor);
1610 int uid = data.readInt();
1611 int initialPid = data.readInt();
1612 String packageName = data.readString();
1613 String message = data.readString();
1614 crashApplication(uid, initialPid, packageName, message);
1615 reply.writeNoException();
1616 return true;
1617 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001618
1619 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1620 data.enforceInterface(IActivityManager.descriptor);
1621 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001622 int userId = data.readInt();
1623 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001624 reply.writeNoException();
1625 reply.writeString(type);
1626 return true;
1627 }
1628
Dianne Hackborn7e269642010-08-25 19:50:20 -07001629 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1630 data.enforceInterface(IActivityManager.descriptor);
1631 String name = data.readString();
1632 IBinder perm = newUriPermissionOwner(name);
1633 reply.writeNoException();
1634 reply.writeStrongBinder(perm);
1635 return true;
1636 }
1637
1638 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1639 data.enforceInterface(IActivityManager.descriptor);
1640 IBinder owner = data.readStrongBinder();
1641 int fromUid = data.readInt();
1642 String targetPkg = data.readString();
1643 Uri uri = Uri.CREATOR.createFromParcel(data);
1644 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001645 int userId = data.readInt();
1646 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001647 reply.writeNoException();
1648 return true;
1649 }
1650
1651 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1652 data.enforceInterface(IActivityManager.descriptor);
1653 IBinder owner = data.readStrongBinder();
1654 Uri uri = null;
1655 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001656 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001657 }
1658 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001659 int userId = data.readInt();
1660 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001661 reply.writeNoException();
1662 return true;
1663 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001664
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001665 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1666 data.enforceInterface(IActivityManager.descriptor);
1667 int callingUid = data.readInt();
1668 String targetPkg = data.readString();
1669 Uri uri = Uri.CREATOR.createFromParcel(data);
1670 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001671 int userId = data.readInt();
1672 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001673 reply.writeNoException();
1674 reply.writeInt(res);
1675 return true;
1676 }
1677
Andy McFadden824c5102010-07-09 16:26:57 -07001678 case DUMP_HEAP_TRANSACTION: {
1679 data.enforceInterface(IActivityManager.descriptor);
1680 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001681 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001682 boolean managed = data.readInt() != 0;
1683 String path = data.readString();
1684 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001685 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001686 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001687 reply.writeNoException();
1688 reply.writeInt(res ? 1 : 0);
1689 return true;
1690 }
1691
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001692 case START_ACTIVITIES_TRANSACTION:
1693 {
1694 data.enforceInterface(IActivityManager.descriptor);
1695 IBinder b = data.readStrongBinder();
1696 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001697 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001698 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1699 String[] resolvedTypes = data.createStringArray();
1700 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001701 Bundle options = data.readInt() != 0
1702 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001703 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001704 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001705 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001706 reply.writeNoException();
1707 reply.writeInt(result);
1708 return true;
1709 }
1710
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001711 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1712 {
1713 data.enforceInterface(IActivityManager.descriptor);
1714 int mode = getFrontActivityScreenCompatMode();
1715 reply.writeNoException();
1716 reply.writeInt(mode);
1717 return true;
1718 }
1719
1720 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1721 {
1722 data.enforceInterface(IActivityManager.descriptor);
1723 int mode = data.readInt();
1724 setFrontActivityScreenCompatMode(mode);
1725 reply.writeNoException();
1726 reply.writeInt(mode);
1727 return true;
1728 }
1729
1730 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1731 {
1732 data.enforceInterface(IActivityManager.descriptor);
1733 String pkg = data.readString();
1734 int mode = getPackageScreenCompatMode(pkg);
1735 reply.writeNoException();
1736 reply.writeInt(mode);
1737 return true;
1738 }
1739
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001740 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1741 {
1742 data.enforceInterface(IActivityManager.descriptor);
1743 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001744 int mode = data.readInt();
1745 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001746 reply.writeNoException();
1747 return true;
1748 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001749
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001750 case SWITCH_USER_TRANSACTION: {
1751 data.enforceInterface(IActivityManager.descriptor);
1752 int userid = data.readInt();
1753 boolean result = switchUser(userid);
1754 reply.writeNoException();
1755 reply.writeInt(result ? 1 : 0);
1756 return true;
1757 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001758
Kenny Guy08488bf2014-02-21 17:40:37 +00001759 case START_USER_IN_BACKGROUND_TRANSACTION: {
1760 data.enforceInterface(IActivityManager.descriptor);
1761 int userid = data.readInt();
1762 boolean result = startUserInBackground(userid);
1763 reply.writeNoException();
1764 reply.writeInt(result ? 1 : 0);
1765 return true;
1766 }
1767
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001768 case STOP_USER_TRANSACTION: {
1769 data.enforceInterface(IActivityManager.descriptor);
1770 int userid = data.readInt();
1771 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1772 data.readStrongBinder());
1773 int result = stopUser(userid, callback);
1774 reply.writeNoException();
1775 reply.writeInt(result);
1776 return true;
1777 }
1778
Amith Yamasani52f1d752012-03-28 18:19:29 -07001779 case GET_CURRENT_USER_TRANSACTION: {
1780 data.enforceInterface(IActivityManager.descriptor);
1781 UserInfo userInfo = getCurrentUser();
1782 reply.writeNoException();
1783 userInfo.writeToParcel(reply, 0);
1784 return true;
1785 }
1786
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001787 case IS_USER_RUNNING_TRANSACTION: {
1788 data.enforceInterface(IActivityManager.descriptor);
1789 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001790 boolean orStopping = data.readInt() != 0;
1791 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001792 reply.writeNoException();
1793 reply.writeInt(result ? 1 : 0);
1794 return true;
1795 }
1796
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001797 case GET_RUNNING_USER_IDS_TRANSACTION: {
1798 data.enforceInterface(IActivityManager.descriptor);
1799 int[] result = getRunningUserIds();
1800 reply.writeNoException();
1801 reply.writeIntArray(result);
1802 return true;
1803 }
1804
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001805 case REMOVE_TASK_TRANSACTION:
1806 {
1807 data.enforceInterface(IActivityManager.descriptor);
1808 int taskId = data.readInt();
1809 int fl = data.readInt();
1810 boolean result = removeTask(taskId, fl);
1811 reply.writeNoException();
1812 reply.writeInt(result ? 1 : 0);
1813 return true;
1814 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001815
Jeff Sharkeya4620792011-05-20 15:29:23 -07001816 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1817 data.enforceInterface(IActivityManager.descriptor);
1818 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1819 data.readStrongBinder());
1820 registerProcessObserver(observer);
1821 return true;
1822 }
1823
1824 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1825 data.enforceInterface(IActivityManager.descriptor);
1826 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1827 data.readStrongBinder());
1828 unregisterProcessObserver(observer);
1829 return true;
1830 }
1831
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001832 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1833 {
1834 data.enforceInterface(IActivityManager.descriptor);
1835 String pkg = data.readString();
1836 boolean ask = getPackageAskScreenCompat(pkg);
1837 reply.writeNoException();
1838 reply.writeInt(ask ? 1 : 0);
1839 return true;
1840 }
1841
1842 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1843 {
1844 data.enforceInterface(IActivityManager.descriptor);
1845 String pkg = data.readString();
1846 boolean ask = data.readInt() != 0;
1847 setPackageAskScreenCompat(pkg, ask);
1848 reply.writeNoException();
1849 return true;
1850 }
1851
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001852 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1853 data.enforceInterface(IActivityManager.descriptor);
1854 IIntentSender r = IIntentSender.Stub.asInterface(
1855 data.readStrongBinder());
1856 boolean res = isIntentSenderTargetedToPackage(r);
1857 reply.writeNoException();
1858 reply.writeInt(res ? 1 : 0);
1859 return true;
1860 }
1861
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001862 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1863 data.enforceInterface(IActivityManager.descriptor);
1864 IIntentSender r = IIntentSender.Stub.asInterface(
1865 data.readStrongBinder());
1866 boolean res = isIntentSenderAnActivity(r);
1867 reply.writeNoException();
1868 reply.writeInt(res ? 1 : 0);
1869 return true;
1870 }
1871
Dianne Hackborn81038902012-11-26 17:04:09 -08001872 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1873 data.enforceInterface(IActivityManager.descriptor);
1874 IIntentSender r = IIntentSender.Stub.asInterface(
1875 data.readStrongBinder());
1876 Intent intent = getIntentForIntentSender(r);
1877 reply.writeNoException();
1878 if (intent != null) {
1879 reply.writeInt(1);
1880 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1881 } else {
1882 reply.writeInt(0);
1883 }
1884 return true;
1885 }
1886
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001887 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1888 data.enforceInterface(IActivityManager.descriptor);
1889 IIntentSender r = IIntentSender.Stub.asInterface(
1890 data.readStrongBinder());
1891 String prefix = data.readString();
1892 String tag = getTagForIntentSender(r, prefix);
1893 reply.writeNoException();
1894 reply.writeString(tag);
1895 return true;
1896 }
1897
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001898 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1899 data.enforceInterface(IActivityManager.descriptor);
1900 Configuration config = Configuration.CREATOR.createFromParcel(data);
1901 updatePersistentConfiguration(config);
1902 reply.writeNoException();
1903 return true;
1904 }
1905
Dianne Hackbornb437e092011-08-05 17:50:29 -07001906 case GET_PROCESS_PSS_TRANSACTION: {
1907 data.enforceInterface(IActivityManager.descriptor);
1908 int[] pids = data.createIntArray();
1909 long[] pss = getProcessPss(pids);
1910 reply.writeNoException();
1911 reply.writeLongArray(pss);
1912 return true;
1913 }
1914
Dianne Hackborn661cd522011-08-22 00:26:20 -07001915 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1916 data.enforceInterface(IActivityManager.descriptor);
1917 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1918 boolean always = data.readInt() != 0;
1919 showBootMessage(msg, always);
1920 reply.writeNoException();
1921 return true;
1922 }
1923
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001924 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1925 data.enforceInterface(IActivityManager.descriptor);
1926 dismissKeyguardOnNextActivity();
1927 reply.writeNoException();
1928 return true;
1929 }
1930
Adam Powelldd8fab22012-03-22 17:47:27 -07001931 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1932 data.enforceInterface(IActivityManager.descriptor);
1933 IBinder token = data.readStrongBinder();
1934 String destAffinity = data.readString();
1935 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1936 reply.writeNoException();
1937 reply.writeInt(res ? 1 : 0);
1938 return true;
1939 }
1940
1941 case NAVIGATE_UP_TO_TRANSACTION: {
1942 data.enforceInterface(IActivityManager.descriptor);
1943 IBinder token = data.readStrongBinder();
1944 Intent target = Intent.CREATOR.createFromParcel(data);
1945 int resultCode = data.readInt();
1946 Intent resultData = null;
1947 if (data.readInt() != 0) {
1948 resultData = Intent.CREATOR.createFromParcel(data);
1949 }
1950 boolean res = navigateUpTo(token, target, resultCode, resultData);
1951 reply.writeNoException();
1952 reply.writeInt(res ? 1 : 0);
1953 return true;
1954 }
1955
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001956 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1957 data.enforceInterface(IActivityManager.descriptor);
1958 IBinder token = data.readStrongBinder();
1959 int res = getLaunchedFromUid(token);
1960 reply.writeNoException();
1961 reply.writeInt(res);
1962 return true;
1963 }
1964
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001965 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1966 data.enforceInterface(IActivityManager.descriptor);
1967 IBinder token = data.readStrongBinder();
1968 String res = getLaunchedFromPackage(token);
1969 reply.writeNoException();
1970 reply.writeString(res);
1971 return true;
1972 }
1973
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001974 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1975 data.enforceInterface(IActivityManager.descriptor);
1976 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1977 data.readStrongBinder());
1978 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001979 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001980 return true;
1981 }
1982
1983 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1984 data.enforceInterface(IActivityManager.descriptor);
1985 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1986 data.readStrongBinder());
1987 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001988 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001989 return true;
1990 }
1991
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001992 case REQUEST_BUG_REPORT_TRANSACTION: {
1993 data.enforceInterface(IActivityManager.descriptor);
1994 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001995 reply.writeNoException();
1996 return true;
1997 }
1998
1999 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2000 data.enforceInterface(IActivityManager.descriptor);
2001 int pid = data.readInt();
2002 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002003 String reason = data.readString();
2004 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002005 reply.writeNoException();
2006 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002007 return true;
2008 }
2009
Adam Skorydfc7fd72013-08-05 19:23:41 -07002010 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002011 data.enforceInterface(IActivityManager.descriptor);
2012 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002013 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002014 reply.writeNoException();
2015 reply.writeBundle(res);
2016 return true;
2017 }
2018
Adam Skorydfc7fd72013-08-05 19:23:41 -07002019 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002020 data.enforceInterface(IActivityManager.descriptor);
2021 IBinder token = data.readStrongBinder();
2022 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002023 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002024 reply.writeNoException();
2025 return true;
2026 }
2027
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002028 case KILL_UID_TRANSACTION: {
2029 data.enforceInterface(IActivityManager.descriptor);
2030 int uid = data.readInt();
2031 String reason = data.readString();
2032 killUid(uid, reason);
2033 reply.writeNoException();
2034 return true;
2035 }
2036
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002037 case HANG_TRANSACTION: {
2038 data.enforceInterface(IActivityManager.descriptor);
2039 IBinder who = data.readStrongBinder();
2040 boolean allowRestart = data.readInt() != 0;
2041 hang(who, allowRestart);
2042 reply.writeNoException();
2043 return true;
2044 }
2045
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002046 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2047 data.enforceInterface(IActivityManager.descriptor);
2048 IBinder token = data.readStrongBinder();
2049 reportActivityFullyDrawn(token);
2050 reply.writeNoException();
2051 return true;
2052 }
2053
Craig Mautner5eda9b32013-07-02 11:58:16 -07002054 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2055 data.enforceInterface(IActivityManager.descriptor);
2056 IBinder token = data.readStrongBinder();
2057 notifyActivityDrawn(token);
2058 reply.writeNoException();
2059 return true;
2060 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002061
2062 case RESTART_TRANSACTION: {
2063 data.enforceInterface(IActivityManager.descriptor);
2064 restart();
2065 reply.writeNoException();
2066 return true;
2067 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002068
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002069 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2070 data.enforceInterface(IActivityManager.descriptor);
2071 performIdleMaintenance();
2072 reply.writeNoException();
2073 return true;
2074 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002075
2076 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2077 data.enforceInterface(IActivityManager.descriptor);
2078 IBinder parentActivityToken = data.readStrongBinder();
2079 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002080 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002081 IActivityContainer activityContainer =
2082 createActivityContainer(parentActivityToken, callback);
2083 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002084 if (activityContainer != null) {
2085 reply.writeInt(1);
2086 reply.writeStrongBinder(activityContainer.asBinder());
2087 } else {
2088 reply.writeInt(0);
2089 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002090 return true;
2091 }
2092
Craig Mautner95da1082014-02-24 17:54:35 -08002093 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2094 data.enforceInterface(IActivityManager.descriptor);
2095 IActivityContainer activityContainer =
2096 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2097 deleteActivityContainer(activityContainer);
2098 reply.writeNoException();
2099 return true;
2100 }
2101
Craig Mautnere0a38842013-12-16 16:14:02 -08002102 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2103 data.enforceInterface(IActivityManager.descriptor);
2104 IBinder activityToken = data.readStrongBinder();
2105 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2106 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002107 if (activityContainer != null) {
2108 reply.writeInt(1);
2109 reply.writeStrongBinder(activityContainer.asBinder());
2110 } else {
2111 reply.writeInt(0);
2112 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002113 return true;
2114 }
2115
Craig Mautner4a1cb222013-12-04 16:14:06 -08002116 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2117 data.enforceInterface(IActivityManager.descriptor);
2118 IBinder homeActivityToken = getHomeActivityToken();
2119 reply.writeNoException();
2120 reply.writeStrongBinder(homeActivityToken);
2121 return true;
2122 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002123
2124 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2125 data.enforceInterface(IActivityManager.descriptor);
2126 final int taskId = data.readInt();
2127 startLockTaskMode(taskId);
2128 reply.writeNoException();
2129 return true;
2130 }
2131
2132 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2133 data.enforceInterface(IActivityManager.descriptor);
2134 IBinder token = data.readStrongBinder();
2135 startLockTaskMode(token);
2136 reply.writeNoException();
2137 return true;
2138 }
2139
Craig Mautnerd61dc202014-07-07 11:09:11 -07002140 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002141 data.enforceInterface(IActivityManager.descriptor);
2142 startLockTaskModeOnCurrent();
2143 reply.writeNoException();
2144 return true;
2145 }
2146
Craig Mautneraea74a52014-03-08 14:23:10 -08002147 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2148 data.enforceInterface(IActivityManager.descriptor);
2149 stopLockTaskMode();
2150 reply.writeNoException();
2151 return true;
2152 }
2153
Craig Mautnerd61dc202014-07-07 11:09:11 -07002154 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002155 data.enforceInterface(IActivityManager.descriptor);
2156 stopLockTaskModeOnCurrent();
2157 reply.writeNoException();
2158 return true;
2159 }
2160
Craig Mautneraea74a52014-03-08 14:23:10 -08002161 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2162 data.enforceInterface(IActivityManager.descriptor);
2163 final boolean isInLockTaskMode = isInLockTaskMode();
2164 reply.writeNoException();
2165 reply.writeInt(isInLockTaskMode ? 1 : 0);
2166 return true;
2167 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002168
Winson Chunga449dc02014-05-16 11:15:04 -07002169 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002170 data.enforceInterface(IActivityManager.descriptor);
2171 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002172 ActivityManager.TaskDescription values =
2173 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2174 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002175 reply.writeNoException();
2176 return true;
2177 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002178
2179 case SET_MEDIA_PLAYING_TRANSACTION: {
2180 data.enforceInterface(IActivityManager.descriptor);
2181 IBinder token = data.readStrongBinder();
2182 boolean enable = data.readInt() > 0;
2183 boolean success = setMediaPlaying(token, enable);
2184 reply.writeNoException();
2185 reply.writeInt(success ? 1 : 0);
2186 return true;
2187 }
2188
2189 case IS_BG_MEDIA_PLAYING_TRANSACTION: {
2190 data.enforceInterface(IActivityManager.descriptor);
2191 IBinder token = data.readStrongBinder();
2192 final boolean enabled = isBackgroundMediaPlaying(token);
2193 reply.writeNoException();
2194 reply.writeInt(enabled ? 1 : 0);
2195 return true;
2196 }
2197
Craig Mautnerbb742462014-07-07 15:28:55 -07002198 case MEDIA_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002199 data.enforceInterface(IActivityManager.descriptor);
2200 IBinder token = data.readStrongBinder();
2201 mediaResourcesReleased(token);
2202 reply.writeNoException();
2203 return true;
2204 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002205
2206 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2207 data.enforceInterface(IActivityManager.descriptor);
2208 IBinder token = data.readStrongBinder();
2209 notifyLaunchTaskBehindComplete(token);
2210 reply.writeNoException();
2211 return true;
2212 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002213 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002214
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002215 return super.onTransact(code, data, reply, flags);
2216 }
2217
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002218 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002219 return this;
2220 }
2221
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002222 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2223 protected IActivityManager create() {
2224 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002225 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002226 Log.v("ActivityManager", "default service binder = " + b);
2227 }
2228 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002229 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002230 Log.v("ActivityManager", "default service = " + am);
2231 }
2232 return am;
2233 }
2234 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002235}
2236
2237class ActivityManagerProxy implements IActivityManager
2238{
2239 public ActivityManagerProxy(IBinder remote)
2240 {
2241 mRemote = remote;
2242 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002243
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002244 public IBinder asBinder()
2245 {
2246 return mRemote;
2247 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002248
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002249 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002250 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2251 int startFlags, String profileFile,
2252 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002253 Parcel data = Parcel.obtain();
2254 Parcel reply = Parcel.obtain();
2255 data.writeInterfaceToken(IActivityManager.descriptor);
2256 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002257 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002258 intent.writeToParcel(data, 0);
2259 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002260 data.writeStrongBinder(resultTo);
2261 data.writeString(resultWho);
2262 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002263 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002264 data.writeString(profileFile);
2265 if (profileFd != null) {
2266 data.writeInt(1);
2267 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2268 } else {
2269 data.writeInt(0);
2270 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002271 if (options != null) {
2272 data.writeInt(1);
2273 options.writeToParcel(data, 0);
2274 } else {
2275 data.writeInt(0);
2276 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002277 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2278 reply.readException();
2279 int result = reply.readInt();
2280 reply.recycle();
2281 data.recycle();
2282 return result;
2283 }
Amith Yamasani82644082012-08-03 13:09:11 -07002284
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002285 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002286 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2287 int startFlags, String profileFile,
2288 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2289 Parcel data = Parcel.obtain();
2290 Parcel reply = Parcel.obtain();
2291 data.writeInterfaceToken(IActivityManager.descriptor);
2292 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002293 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002294 intent.writeToParcel(data, 0);
2295 data.writeString(resolvedType);
2296 data.writeStrongBinder(resultTo);
2297 data.writeString(resultWho);
2298 data.writeInt(requestCode);
2299 data.writeInt(startFlags);
2300 data.writeString(profileFile);
2301 if (profileFd != null) {
2302 data.writeInt(1);
2303 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2304 } else {
2305 data.writeInt(0);
2306 }
2307 if (options != null) {
2308 data.writeInt(1);
2309 options.writeToParcel(data, 0);
2310 } else {
2311 data.writeInt(0);
2312 }
2313 data.writeInt(userId);
2314 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2315 reply.readException();
2316 int result = reply.readInt();
2317 reply.recycle();
2318 data.recycle();
2319 return result;
2320 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002321 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2322 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002323 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002324 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002325 Parcel data = Parcel.obtain();
2326 Parcel reply = Parcel.obtain();
2327 data.writeInterfaceToken(IActivityManager.descriptor);
2328 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002329 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002330 intent.writeToParcel(data, 0);
2331 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002332 data.writeStrongBinder(resultTo);
2333 data.writeString(resultWho);
2334 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002335 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002336 data.writeString(profileFile);
2337 if (profileFd != null) {
2338 data.writeInt(1);
2339 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2340 } else {
2341 data.writeInt(0);
2342 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002343 if (options != null) {
2344 data.writeInt(1);
2345 options.writeToParcel(data, 0);
2346 } else {
2347 data.writeInt(0);
2348 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002349 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002350 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2351 reply.readException();
2352 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2353 reply.recycle();
2354 data.recycle();
2355 return result;
2356 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002357 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2358 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002359 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002360 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002361 Parcel data = Parcel.obtain();
2362 Parcel reply = Parcel.obtain();
2363 data.writeInterfaceToken(IActivityManager.descriptor);
2364 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002365 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002366 intent.writeToParcel(data, 0);
2367 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002368 data.writeStrongBinder(resultTo);
2369 data.writeString(resultWho);
2370 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002371 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002372 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002373 if (options != null) {
2374 data.writeInt(1);
2375 options.writeToParcel(data, 0);
2376 } else {
2377 data.writeInt(0);
2378 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002379 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002380 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2381 reply.readException();
2382 int result = reply.readInt();
2383 reply.recycle();
2384 data.recycle();
2385 return result;
2386 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002387 public int startActivityIntentSender(IApplicationThread caller,
2388 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002389 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002390 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002391 Parcel data = Parcel.obtain();
2392 Parcel reply = Parcel.obtain();
2393 data.writeInterfaceToken(IActivityManager.descriptor);
2394 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2395 intent.writeToParcel(data, 0);
2396 if (fillInIntent != null) {
2397 data.writeInt(1);
2398 fillInIntent.writeToParcel(data, 0);
2399 } else {
2400 data.writeInt(0);
2401 }
2402 data.writeString(resolvedType);
2403 data.writeStrongBinder(resultTo);
2404 data.writeString(resultWho);
2405 data.writeInt(requestCode);
2406 data.writeInt(flagsMask);
2407 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002408 if (options != null) {
2409 data.writeInt(1);
2410 options.writeToParcel(data, 0);
2411 } else {
2412 data.writeInt(0);
2413 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002414 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002415 reply.readException();
2416 int result = reply.readInt();
2417 reply.recycle();
2418 data.recycle();
2419 return result;
2420 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002421 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2422 Intent intent, String resolvedType, IVoiceInteractionSession session,
2423 IVoiceInteractor interactor, int startFlags, String profileFile,
2424 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2425 Parcel data = Parcel.obtain();
2426 Parcel reply = Parcel.obtain();
2427 data.writeInterfaceToken(IActivityManager.descriptor);
2428 data.writeString(callingPackage);
2429 data.writeInt(callingPid);
2430 data.writeInt(callingUid);
2431 intent.writeToParcel(data, 0);
2432 data.writeString(resolvedType);
2433 data.writeStrongBinder(session.asBinder());
2434 data.writeStrongBinder(interactor.asBinder());
2435 data.writeInt(startFlags);
2436 data.writeString(profileFile);
2437 if (profileFd != null) {
2438 data.writeInt(1);
2439 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2440 } else {
2441 data.writeInt(0);
2442 }
2443 if (options != null) {
2444 data.writeInt(1);
2445 options.writeToParcel(data, 0);
2446 } else {
2447 data.writeInt(0);
2448 }
2449 data.writeInt(userId);
2450 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2451 reply.readException();
2452 int result = reply.readInt();
2453 reply.recycle();
2454 data.recycle();
2455 return result;
2456 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002457 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002458 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002459 Parcel data = Parcel.obtain();
2460 Parcel reply = Parcel.obtain();
2461 data.writeInterfaceToken(IActivityManager.descriptor);
2462 data.writeStrongBinder(callingActivity);
2463 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002464 if (options != null) {
2465 data.writeInt(1);
2466 options.writeToParcel(data, 0);
2467 } else {
2468 data.writeInt(0);
2469 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002470 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2471 reply.readException();
2472 int result = reply.readInt();
2473 reply.recycle();
2474 data.recycle();
2475 return result != 0;
2476 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002477 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002478 throws RemoteException {
2479 Parcel data = Parcel.obtain();
2480 Parcel reply = Parcel.obtain();
2481 data.writeInterfaceToken(IActivityManager.descriptor);
2482 data.writeStrongBinder(token);
2483 data.writeInt(resultCode);
2484 if (resultData != null) {
2485 data.writeInt(1);
2486 resultData.writeToParcel(data, 0);
2487 } else {
2488 data.writeInt(0);
2489 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002490 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002491 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2492 reply.readException();
2493 boolean res = reply.readInt() != 0;
2494 data.recycle();
2495 reply.recycle();
2496 return res;
2497 }
2498 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2499 {
2500 Parcel data = Parcel.obtain();
2501 Parcel reply = Parcel.obtain();
2502 data.writeInterfaceToken(IActivityManager.descriptor);
2503 data.writeStrongBinder(token);
2504 data.writeString(resultWho);
2505 data.writeInt(requestCode);
2506 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2507 reply.readException();
2508 data.recycle();
2509 reply.recycle();
2510 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002511 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2512 Parcel data = Parcel.obtain();
2513 Parcel reply = Parcel.obtain();
2514 data.writeInterfaceToken(IActivityManager.descriptor);
2515 data.writeStrongBinder(token);
2516 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2517 reply.readException();
2518 boolean res = reply.readInt() != 0;
2519 data.recycle();
2520 reply.recycle();
2521 return res;
2522 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002523 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2524 Parcel data = Parcel.obtain();
2525 Parcel reply = Parcel.obtain();
2526 data.writeInterfaceToken(IActivityManager.descriptor);
2527 data.writeStrongBinder(session.asBinder());
2528 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2529 reply.readException();
2530 data.recycle();
2531 reply.recycle();
2532 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002533 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2534 Parcel data = Parcel.obtain();
2535 Parcel reply = Parcel.obtain();
2536 data.writeInterfaceToken(IActivityManager.descriptor);
2537 data.writeStrongBinder(token);
2538 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2539 reply.readException();
2540 boolean res = reply.readInt() != 0;
2541 data.recycle();
2542 reply.recycle();
2543 return res;
2544 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002545 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002546 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002547 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002548 {
2549 Parcel data = Parcel.obtain();
2550 Parcel reply = Parcel.obtain();
2551 data.writeInterfaceToken(IActivityManager.descriptor);
2552 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002553 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002554 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2555 filter.writeToParcel(data, 0);
2556 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002557 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002558 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2559 reply.readException();
2560 Intent intent = null;
2561 int haveIntent = reply.readInt();
2562 if (haveIntent != 0) {
2563 intent = Intent.CREATOR.createFromParcel(reply);
2564 }
2565 reply.recycle();
2566 data.recycle();
2567 return intent;
2568 }
2569 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2570 {
2571 Parcel data = Parcel.obtain();
2572 Parcel reply = Parcel.obtain();
2573 data.writeInterfaceToken(IActivityManager.descriptor);
2574 data.writeStrongBinder(receiver.asBinder());
2575 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2576 reply.readException();
2577 data.recycle();
2578 reply.recycle();
2579 }
2580 public int broadcastIntent(IApplicationThread caller,
2581 Intent intent, String resolvedType, IIntentReceiver resultTo,
2582 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002583 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002584 boolean sticky, 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);
2590 intent.writeToParcel(data, 0);
2591 data.writeString(resolvedType);
2592 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2593 data.writeInt(resultCode);
2594 data.writeString(resultData);
2595 data.writeBundle(map);
2596 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002597 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002598 data.writeInt(serialized ? 1 : 0);
2599 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002600 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002601 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2602 reply.readException();
2603 int res = reply.readInt();
2604 reply.recycle();
2605 data.recycle();
2606 return res;
2607 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002608 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2609 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002610 {
2611 Parcel data = Parcel.obtain();
2612 Parcel reply = Parcel.obtain();
2613 data.writeInterfaceToken(IActivityManager.descriptor);
2614 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2615 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002616 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002617 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2618 reply.readException();
2619 data.recycle();
2620 reply.recycle();
2621 }
2622 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2623 {
2624 Parcel data = Parcel.obtain();
2625 Parcel reply = Parcel.obtain();
2626 data.writeInterfaceToken(IActivityManager.descriptor);
2627 data.writeStrongBinder(who);
2628 data.writeInt(resultCode);
2629 data.writeString(resultData);
2630 data.writeBundle(map);
2631 data.writeInt(abortBroadcast ? 1 : 0);
2632 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2633 reply.readException();
2634 data.recycle();
2635 reply.recycle();
2636 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002637 public void attachApplication(IApplicationThread app) throws RemoteException
2638 {
2639 Parcel data = Parcel.obtain();
2640 Parcel reply = Parcel.obtain();
2641 data.writeInterfaceToken(IActivityManager.descriptor);
2642 data.writeStrongBinder(app.asBinder());
2643 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2644 reply.readException();
2645 data.recycle();
2646 reply.recycle();
2647 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002648 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2649 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002650 {
2651 Parcel data = Parcel.obtain();
2652 Parcel reply = Parcel.obtain();
2653 data.writeInterfaceToken(IActivityManager.descriptor);
2654 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002655 if (config != null) {
2656 data.writeInt(1);
2657 config.writeToParcel(data, 0);
2658 } else {
2659 data.writeInt(0);
2660 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002661 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002662 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2663 reply.readException();
2664 data.recycle();
2665 reply.recycle();
2666 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002667 public void activityResumed(IBinder token) throws RemoteException
2668 {
2669 Parcel data = Parcel.obtain();
2670 Parcel reply = Parcel.obtain();
2671 data.writeInterfaceToken(IActivityManager.descriptor);
2672 data.writeStrongBinder(token);
2673 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2674 reply.readException();
2675 data.recycle();
2676 reply.recycle();
2677 }
Craig Mautnera0026042014-04-23 11:45:37 -07002678 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002679 {
2680 Parcel data = Parcel.obtain();
2681 Parcel reply = Parcel.obtain();
2682 data.writeInterfaceToken(IActivityManager.descriptor);
2683 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002684 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002685 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2686 reply.readException();
2687 data.recycle();
2688 reply.recycle();
2689 }
2690 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002691 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002692 {
2693 Parcel data = Parcel.obtain();
2694 Parcel reply = Parcel.obtain();
2695 data.writeInterfaceToken(IActivityManager.descriptor);
2696 data.writeStrongBinder(token);
2697 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002698 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002699 TextUtils.writeToParcel(description, data, 0);
2700 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2701 reply.readException();
2702 data.recycle();
2703 reply.recycle();
2704 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002705 public void activitySlept(IBinder token) throws RemoteException
2706 {
2707 Parcel data = Parcel.obtain();
2708 Parcel reply = Parcel.obtain();
2709 data.writeInterfaceToken(IActivityManager.descriptor);
2710 data.writeStrongBinder(token);
2711 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2712 reply.readException();
2713 data.recycle();
2714 reply.recycle();
2715 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002716 public void activityDestroyed(IBinder token) throws RemoteException
2717 {
2718 Parcel data = Parcel.obtain();
2719 Parcel reply = Parcel.obtain();
2720 data.writeInterfaceToken(IActivityManager.descriptor);
2721 data.writeStrongBinder(token);
2722 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2723 reply.readException();
2724 data.recycle();
2725 reply.recycle();
2726 }
2727 public String getCallingPackage(IBinder token) throws RemoteException
2728 {
2729 Parcel data = Parcel.obtain();
2730 Parcel reply = Parcel.obtain();
2731 data.writeInterfaceToken(IActivityManager.descriptor);
2732 data.writeStrongBinder(token);
2733 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2734 reply.readException();
2735 String res = reply.readString();
2736 data.recycle();
2737 reply.recycle();
2738 return res;
2739 }
2740 public ComponentName getCallingActivity(IBinder token)
2741 throws RemoteException {
2742 Parcel data = Parcel.obtain();
2743 Parcel reply = Parcel.obtain();
2744 data.writeInterfaceToken(IActivityManager.descriptor);
2745 data.writeStrongBinder(token);
2746 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2747 reply.readException();
2748 ComponentName res = ComponentName.readFromParcel(reply);
2749 data.recycle();
2750 reply.recycle();
2751 return res;
2752 }
Winson Chung1147c402014-05-14 11:05:00 -07002753 public List<IAppTask> getAppTasks() throws RemoteException {
2754 Parcel data = Parcel.obtain();
2755 Parcel reply = Parcel.obtain();
2756 data.writeInterfaceToken(IActivityManager.descriptor);
2757 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2758 reply.readException();
2759 ArrayList<IAppTask> list = null;
2760 int N = reply.readInt();
2761 if (N >= 0) {
2762 list = new ArrayList<IAppTask>();
2763 while (N > 0) {
2764 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2765 list.add(task);
2766 N--;
2767 }
2768 }
2769 data.recycle();
2770 reply.recycle();
2771 return list;
2772 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002773 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002774 Parcel data = Parcel.obtain();
2775 Parcel reply = Parcel.obtain();
2776 data.writeInterfaceToken(IActivityManager.descriptor);
2777 data.writeInt(maxNum);
2778 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002779 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2780 reply.readException();
2781 ArrayList list = null;
2782 int N = reply.readInt();
2783 if (N >= 0) {
2784 list = new ArrayList();
2785 while (N > 0) {
2786 ActivityManager.RunningTaskInfo info =
2787 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002788 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002789 list.add(info);
2790 N--;
2791 }
2792 }
2793 data.recycle();
2794 reply.recycle();
2795 return list;
2796 }
2797 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002798 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002799 Parcel data = Parcel.obtain();
2800 Parcel reply = Parcel.obtain();
2801 data.writeInterfaceToken(IActivityManager.descriptor);
2802 data.writeInt(maxNum);
2803 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002804 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002805 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2806 reply.readException();
2807 ArrayList<ActivityManager.RecentTaskInfo> list
2808 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2809 data.recycle();
2810 reply.recycle();
2811 return list;
2812 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002813 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002814 Parcel data = Parcel.obtain();
2815 Parcel reply = Parcel.obtain();
2816 data.writeInterfaceToken(IActivityManager.descriptor);
2817 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002818 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002819 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002820 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002821 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002822 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002823 }
2824 data.recycle();
2825 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002826 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07002827 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002828 public List getServices(int maxNum, int flags) throws RemoteException {
2829 Parcel data = Parcel.obtain();
2830 Parcel reply = Parcel.obtain();
2831 data.writeInterfaceToken(IActivityManager.descriptor);
2832 data.writeInt(maxNum);
2833 data.writeInt(flags);
2834 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2835 reply.readException();
2836 ArrayList list = null;
2837 int N = reply.readInt();
2838 if (N >= 0) {
2839 list = new ArrayList();
2840 while (N > 0) {
2841 ActivityManager.RunningServiceInfo info =
2842 ActivityManager.RunningServiceInfo.CREATOR
2843 .createFromParcel(reply);
2844 list.add(info);
2845 N--;
2846 }
2847 }
2848 data.recycle();
2849 reply.recycle();
2850 return list;
2851 }
2852 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2853 throws RemoteException {
2854 Parcel data = Parcel.obtain();
2855 Parcel reply = Parcel.obtain();
2856 data.writeInterfaceToken(IActivityManager.descriptor);
2857 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2858 reply.readException();
2859 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2860 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2861 data.recycle();
2862 reply.recycle();
2863 return list;
2864 }
2865 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2866 throws RemoteException {
2867 Parcel data = Parcel.obtain();
2868 Parcel reply = Parcel.obtain();
2869 data.writeInterfaceToken(IActivityManager.descriptor);
2870 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2871 reply.readException();
2872 ArrayList<ActivityManager.RunningAppProcessInfo> list
2873 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2874 data.recycle();
2875 reply.recycle();
2876 return list;
2877 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002878 public List<ApplicationInfo> getRunningExternalApplications()
2879 throws RemoteException {
2880 Parcel data = Parcel.obtain();
2881 Parcel reply = Parcel.obtain();
2882 data.writeInterfaceToken(IActivityManager.descriptor);
2883 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2884 reply.readException();
2885 ArrayList<ApplicationInfo> list
2886 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2887 data.recycle();
2888 reply.recycle();
2889 return list;
2890 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002891 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002892 {
2893 Parcel data = Parcel.obtain();
2894 Parcel reply = Parcel.obtain();
2895 data.writeInterfaceToken(IActivityManager.descriptor);
2896 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002897 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002898 if (options != null) {
2899 data.writeInt(1);
2900 options.writeToParcel(data, 0);
2901 } else {
2902 data.writeInt(0);
2903 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002904 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2905 reply.readException();
2906 data.recycle();
2907 reply.recycle();
2908 }
2909 public void moveTaskToBack(int task) throws RemoteException
2910 {
2911 Parcel data = Parcel.obtain();
2912 Parcel reply = Parcel.obtain();
2913 data.writeInterfaceToken(IActivityManager.descriptor);
2914 data.writeInt(task);
2915 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2916 reply.readException();
2917 data.recycle();
2918 reply.recycle();
2919 }
2920 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2921 throws RemoteException {
2922 Parcel data = Parcel.obtain();
2923 Parcel reply = Parcel.obtain();
2924 data.writeInterfaceToken(IActivityManager.descriptor);
2925 data.writeStrongBinder(token);
2926 data.writeInt(nonRoot ? 1 : 0);
2927 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2928 reply.readException();
2929 boolean res = reply.readInt() != 0;
2930 data.recycle();
2931 reply.recycle();
2932 return res;
2933 }
2934 public void moveTaskBackwards(int task) throws RemoteException
2935 {
2936 Parcel data = Parcel.obtain();
2937 Parcel reply = Parcel.obtain();
2938 data.writeInterfaceToken(IActivityManager.descriptor);
2939 data.writeInt(task);
2940 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2941 reply.readException();
2942 data.recycle();
2943 reply.recycle();
2944 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002945 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002946 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2947 {
2948 Parcel data = Parcel.obtain();
2949 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002950 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002951 data.writeInt(taskId);
2952 data.writeInt(stackId);
2953 data.writeInt(toTop ? 1 : 0);
2954 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2955 reply.readException();
2956 data.recycle();
2957 reply.recycle();
2958 }
2959 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002960 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002961 {
2962 Parcel data = Parcel.obtain();
2963 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002964 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002965 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002966 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002967 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002968 reply.readException();
2969 data.recycle();
2970 reply.recycle();
2971 }
Craig Mautner967212c2013-04-13 21:10:58 -07002972 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002973 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002974 {
2975 Parcel data = Parcel.obtain();
2976 Parcel reply = Parcel.obtain();
2977 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002978 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002979 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002980 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002981 data.recycle();
2982 reply.recycle();
2983 return list;
2984 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002985 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002986 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002987 {
2988 Parcel data = Parcel.obtain();
2989 Parcel reply = Parcel.obtain();
2990 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002991 data.writeInt(stackId);
2992 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002993 reply.readException();
2994 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002995 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002996 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002997 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002998 }
2999 data.recycle();
3000 reply.recycle();
3001 return info;
3002 }
3003 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003004 public boolean isInHomeStack(int taskId) throws RemoteException {
3005 Parcel data = Parcel.obtain();
3006 Parcel reply = Parcel.obtain();
3007 data.writeInterfaceToken(IActivityManager.descriptor);
3008 data.writeInt(taskId);
3009 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3010 reply.readException();
3011 boolean isInHomeStack = reply.readInt() > 0;
3012 data.recycle();
3013 reply.recycle();
3014 return isInHomeStack;
3015 }
3016 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003017 public void setFocusedStack(int stackId) throws RemoteException
3018 {
3019 Parcel data = Parcel.obtain();
3020 Parcel reply = Parcel.obtain();
3021 data.writeInterfaceToken(IActivityManager.descriptor);
3022 data.writeInt(stackId);
3023 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3024 reply.readException();
3025 data.recycle();
3026 reply.recycle();
3027 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003028 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3029 {
3030 Parcel data = Parcel.obtain();
3031 Parcel reply = Parcel.obtain();
3032 data.writeInterfaceToken(IActivityManager.descriptor);
3033 data.writeStrongBinder(token);
3034 data.writeInt(onlyRoot ? 1 : 0);
3035 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3036 reply.readException();
3037 int res = reply.readInt();
3038 data.recycle();
3039 reply.recycle();
3040 return res;
3041 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003042 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003043 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003044 Parcel data = Parcel.obtain();
3045 Parcel reply = Parcel.obtain();
3046 data.writeInterfaceToken(IActivityManager.descriptor);
3047 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3048 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003049 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003050 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003051 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3052 reply.readException();
3053 int res = reply.readInt();
3054 ContentProviderHolder cph = null;
3055 if (res != 0) {
3056 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3057 }
3058 data.recycle();
3059 reply.recycle();
3060 return cph;
3061 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003062 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3063 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003064 Parcel data = Parcel.obtain();
3065 Parcel reply = Parcel.obtain();
3066 data.writeInterfaceToken(IActivityManager.descriptor);
3067 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003068 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003069 data.writeStrongBinder(token);
3070 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3071 reply.readException();
3072 int res = reply.readInt();
3073 ContentProviderHolder cph = null;
3074 if (res != 0) {
3075 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3076 }
3077 data.recycle();
3078 reply.recycle();
3079 return cph;
3080 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003081 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003082 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003083 {
3084 Parcel data = Parcel.obtain();
3085 Parcel reply = Parcel.obtain();
3086 data.writeInterfaceToken(IActivityManager.descriptor);
3087 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3088 data.writeTypedList(providers);
3089 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3090 reply.readException();
3091 data.recycle();
3092 reply.recycle();
3093 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003094 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3095 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003096 Parcel data = Parcel.obtain();
3097 Parcel reply = Parcel.obtain();
3098 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003099 data.writeStrongBinder(connection);
3100 data.writeInt(stable);
3101 data.writeInt(unstable);
3102 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3103 reply.readException();
3104 boolean res = reply.readInt() != 0;
3105 data.recycle();
3106 reply.recycle();
3107 return res;
3108 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003109
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003110 public void unstableProviderDied(IBinder connection) throws RemoteException {
3111 Parcel data = Parcel.obtain();
3112 Parcel reply = Parcel.obtain();
3113 data.writeInterfaceToken(IActivityManager.descriptor);
3114 data.writeStrongBinder(connection);
3115 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3116 reply.readException();
3117 data.recycle();
3118 reply.recycle();
3119 }
3120
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003121 @Override
3122 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3123 Parcel data = Parcel.obtain();
3124 Parcel reply = Parcel.obtain();
3125 data.writeInterfaceToken(IActivityManager.descriptor);
3126 data.writeStrongBinder(connection);
3127 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3128 reply.readException();
3129 data.recycle();
3130 reply.recycle();
3131 }
3132
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003133 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3134 Parcel data = Parcel.obtain();
3135 Parcel reply = Parcel.obtain();
3136 data.writeInterfaceToken(IActivityManager.descriptor);
3137 data.writeStrongBinder(connection);
3138 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003139 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3140 reply.readException();
3141 data.recycle();
3142 reply.recycle();
3143 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003144
3145 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3146 Parcel data = Parcel.obtain();
3147 Parcel reply = Parcel.obtain();
3148 data.writeInterfaceToken(IActivityManager.descriptor);
3149 data.writeString(name);
3150 data.writeStrongBinder(token);
3151 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3152 reply.readException();
3153 data.recycle();
3154 reply.recycle();
3155 }
3156
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003157 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3158 throws RemoteException
3159 {
3160 Parcel data = Parcel.obtain();
3161 Parcel reply = Parcel.obtain();
3162 data.writeInterfaceToken(IActivityManager.descriptor);
3163 service.writeToParcel(data, 0);
3164 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3165 reply.readException();
3166 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3167 data.recycle();
3168 reply.recycle();
3169 return res;
3170 }
3171
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003172 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003173 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003174 {
3175 Parcel data = Parcel.obtain();
3176 Parcel reply = Parcel.obtain();
3177 data.writeInterfaceToken(IActivityManager.descriptor);
3178 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3179 service.writeToParcel(data, 0);
3180 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003181 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003182 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3183 reply.readException();
3184 ComponentName res = ComponentName.readFromParcel(reply);
3185 data.recycle();
3186 reply.recycle();
3187 return res;
3188 }
3189 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003190 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003191 {
3192 Parcel data = Parcel.obtain();
3193 Parcel reply = Parcel.obtain();
3194 data.writeInterfaceToken(IActivityManager.descriptor);
3195 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3196 service.writeToParcel(data, 0);
3197 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003198 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003199 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3200 reply.readException();
3201 int res = reply.readInt();
3202 reply.recycle();
3203 data.recycle();
3204 return res;
3205 }
3206 public boolean stopServiceToken(ComponentName className, IBinder token,
3207 int startId) throws RemoteException {
3208 Parcel data = Parcel.obtain();
3209 Parcel reply = Parcel.obtain();
3210 data.writeInterfaceToken(IActivityManager.descriptor);
3211 ComponentName.writeToParcel(className, data);
3212 data.writeStrongBinder(token);
3213 data.writeInt(startId);
3214 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3215 reply.readException();
3216 boolean res = reply.readInt() != 0;
3217 data.recycle();
3218 reply.recycle();
3219 return res;
3220 }
3221 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003222 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003223 Parcel data = Parcel.obtain();
3224 Parcel reply = Parcel.obtain();
3225 data.writeInterfaceToken(IActivityManager.descriptor);
3226 ComponentName.writeToParcel(className, data);
3227 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003228 data.writeInt(id);
3229 if (notification != null) {
3230 data.writeInt(1);
3231 notification.writeToParcel(data, 0);
3232 } else {
3233 data.writeInt(0);
3234 }
3235 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003236 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3237 reply.readException();
3238 data.recycle();
3239 reply.recycle();
3240 }
3241 public int bindService(IApplicationThread caller, IBinder token,
3242 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003243 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003244 Parcel data = Parcel.obtain();
3245 Parcel reply = Parcel.obtain();
3246 data.writeInterfaceToken(IActivityManager.descriptor);
3247 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3248 data.writeStrongBinder(token);
3249 service.writeToParcel(data, 0);
3250 data.writeString(resolvedType);
3251 data.writeStrongBinder(connection.asBinder());
3252 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003253 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003254 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3255 reply.readException();
3256 int res = reply.readInt();
3257 data.recycle();
3258 reply.recycle();
3259 return res;
3260 }
3261 public boolean unbindService(IServiceConnection connection) throws RemoteException
3262 {
3263 Parcel data = Parcel.obtain();
3264 Parcel reply = Parcel.obtain();
3265 data.writeInterfaceToken(IActivityManager.descriptor);
3266 data.writeStrongBinder(connection.asBinder());
3267 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3268 reply.readException();
3269 boolean res = reply.readInt() != 0;
3270 data.recycle();
3271 reply.recycle();
3272 return res;
3273 }
3274
3275 public void publishService(IBinder token,
3276 Intent intent, IBinder service) throws RemoteException {
3277 Parcel data = Parcel.obtain();
3278 Parcel reply = Parcel.obtain();
3279 data.writeInterfaceToken(IActivityManager.descriptor);
3280 data.writeStrongBinder(token);
3281 intent.writeToParcel(data, 0);
3282 data.writeStrongBinder(service);
3283 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3284 reply.readException();
3285 data.recycle();
3286 reply.recycle();
3287 }
3288
3289 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3290 throws RemoteException {
3291 Parcel data = Parcel.obtain();
3292 Parcel reply = Parcel.obtain();
3293 data.writeInterfaceToken(IActivityManager.descriptor);
3294 data.writeStrongBinder(token);
3295 intent.writeToParcel(data, 0);
3296 data.writeInt(doRebind ? 1 : 0);
3297 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3298 reply.readException();
3299 data.recycle();
3300 reply.recycle();
3301 }
3302
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003303 public void serviceDoneExecuting(IBinder token, int type, int startId,
3304 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003305 Parcel data = Parcel.obtain();
3306 Parcel reply = Parcel.obtain();
3307 data.writeInterfaceToken(IActivityManager.descriptor);
3308 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003309 data.writeInt(type);
3310 data.writeInt(startId);
3311 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003312 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3313 reply.readException();
3314 data.recycle();
3315 reply.recycle();
3316 }
3317
3318 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3319 Parcel data = Parcel.obtain();
3320 Parcel reply = Parcel.obtain();
3321 data.writeInterfaceToken(IActivityManager.descriptor);
3322 service.writeToParcel(data, 0);
3323 data.writeString(resolvedType);
3324 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3325 reply.readException();
3326 IBinder binder = reply.readStrongBinder();
3327 reply.recycle();
3328 data.recycle();
3329 return binder;
3330 }
3331
Christopher Tate181fafa2009-05-14 11:12:14 -07003332 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3333 throws RemoteException {
3334 Parcel data = Parcel.obtain();
3335 Parcel reply = Parcel.obtain();
3336 data.writeInterfaceToken(IActivityManager.descriptor);
3337 app.writeToParcel(data, 0);
3338 data.writeInt(backupRestoreMode);
3339 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3340 reply.readException();
3341 boolean success = reply.readInt() != 0;
3342 reply.recycle();
3343 data.recycle();
3344 return success;
3345 }
3346
Christopher Tate346acb12012-10-15 19:20:25 -07003347 public void clearPendingBackup() throws RemoteException {
3348 Parcel data = Parcel.obtain();
3349 Parcel reply = Parcel.obtain();
3350 data.writeInterfaceToken(IActivityManager.descriptor);
3351 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3352 reply.recycle();
3353 data.recycle();
3354 }
3355
Christopher Tate181fafa2009-05-14 11:12:14 -07003356 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3357 Parcel data = Parcel.obtain();
3358 Parcel reply = Parcel.obtain();
3359 data.writeInterfaceToken(IActivityManager.descriptor);
3360 data.writeString(packageName);
3361 data.writeStrongBinder(agent);
3362 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3363 reply.recycle();
3364 data.recycle();
3365 }
3366
3367 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3368 Parcel data = Parcel.obtain();
3369 Parcel reply = Parcel.obtain();
3370 data.writeInterfaceToken(IActivityManager.descriptor);
3371 app.writeToParcel(data, 0);
3372 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3373 reply.readException();
3374 reply.recycle();
3375 data.recycle();
3376 }
3377
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003378 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003379 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003380 IUiAutomationConnection connection, int userId, String instructionSet)
3381 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003382 Parcel data = Parcel.obtain();
3383 Parcel reply = Parcel.obtain();
3384 data.writeInterfaceToken(IActivityManager.descriptor);
3385 ComponentName.writeToParcel(className, data);
3386 data.writeString(profileFile);
3387 data.writeInt(flags);
3388 data.writeBundle(arguments);
3389 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003390 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003391 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003392 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003393 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3394 reply.readException();
3395 boolean res = reply.readInt() != 0;
3396 reply.recycle();
3397 data.recycle();
3398 return res;
3399 }
3400
3401 public void finishInstrumentation(IApplicationThread target,
3402 int resultCode, Bundle results) throws RemoteException {
3403 Parcel data = Parcel.obtain();
3404 Parcel reply = Parcel.obtain();
3405 data.writeInterfaceToken(IActivityManager.descriptor);
3406 data.writeStrongBinder(target != null ? target.asBinder() : null);
3407 data.writeInt(resultCode);
3408 data.writeBundle(results);
3409 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3410 reply.readException();
3411 data.recycle();
3412 reply.recycle();
3413 }
3414 public Configuration getConfiguration() throws RemoteException
3415 {
3416 Parcel data = Parcel.obtain();
3417 Parcel reply = Parcel.obtain();
3418 data.writeInterfaceToken(IActivityManager.descriptor);
3419 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3420 reply.readException();
3421 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3422 reply.recycle();
3423 data.recycle();
3424 return res;
3425 }
3426 public void updateConfiguration(Configuration values) throws RemoteException
3427 {
3428 Parcel data = Parcel.obtain();
3429 Parcel reply = Parcel.obtain();
3430 data.writeInterfaceToken(IActivityManager.descriptor);
3431 values.writeToParcel(data, 0);
3432 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3433 reply.readException();
3434 data.recycle();
3435 reply.recycle();
3436 }
3437 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3438 throws RemoteException {
3439 Parcel data = Parcel.obtain();
3440 Parcel reply = Parcel.obtain();
3441 data.writeInterfaceToken(IActivityManager.descriptor);
3442 data.writeStrongBinder(token);
3443 data.writeInt(requestedOrientation);
3444 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3445 reply.readException();
3446 data.recycle();
3447 reply.recycle();
3448 }
3449 public int getRequestedOrientation(IBinder token) throws RemoteException {
3450 Parcel data = Parcel.obtain();
3451 Parcel reply = Parcel.obtain();
3452 data.writeInterfaceToken(IActivityManager.descriptor);
3453 data.writeStrongBinder(token);
3454 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3455 reply.readException();
3456 int res = reply.readInt();
3457 data.recycle();
3458 reply.recycle();
3459 return res;
3460 }
3461 public ComponentName getActivityClassForToken(IBinder token)
3462 throws RemoteException {
3463 Parcel data = Parcel.obtain();
3464 Parcel reply = Parcel.obtain();
3465 data.writeInterfaceToken(IActivityManager.descriptor);
3466 data.writeStrongBinder(token);
3467 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3468 reply.readException();
3469 ComponentName res = ComponentName.readFromParcel(reply);
3470 data.recycle();
3471 reply.recycle();
3472 return res;
3473 }
3474 public String getPackageForToken(IBinder token) throws RemoteException
3475 {
3476 Parcel data = Parcel.obtain();
3477 Parcel reply = Parcel.obtain();
3478 data.writeInterfaceToken(IActivityManager.descriptor);
3479 data.writeStrongBinder(token);
3480 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3481 reply.readException();
3482 String res = reply.readString();
3483 data.recycle();
3484 reply.recycle();
3485 return res;
3486 }
3487 public IIntentSender getIntentSender(int type,
3488 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003489 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003490 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003491 Parcel data = Parcel.obtain();
3492 Parcel reply = Parcel.obtain();
3493 data.writeInterfaceToken(IActivityManager.descriptor);
3494 data.writeInt(type);
3495 data.writeString(packageName);
3496 data.writeStrongBinder(token);
3497 data.writeString(resultWho);
3498 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003499 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003500 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003501 data.writeTypedArray(intents, 0);
3502 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003503 } else {
3504 data.writeInt(0);
3505 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003506 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003507 if (options != null) {
3508 data.writeInt(1);
3509 options.writeToParcel(data, 0);
3510 } else {
3511 data.writeInt(0);
3512 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003513 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003514 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3515 reply.readException();
3516 IIntentSender res = IIntentSender.Stub.asInterface(
3517 reply.readStrongBinder());
3518 data.recycle();
3519 reply.recycle();
3520 return res;
3521 }
3522 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3523 Parcel data = Parcel.obtain();
3524 Parcel reply = Parcel.obtain();
3525 data.writeInterfaceToken(IActivityManager.descriptor);
3526 data.writeStrongBinder(sender.asBinder());
3527 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3528 reply.readException();
3529 data.recycle();
3530 reply.recycle();
3531 }
3532 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3533 Parcel data = Parcel.obtain();
3534 Parcel reply = Parcel.obtain();
3535 data.writeInterfaceToken(IActivityManager.descriptor);
3536 data.writeStrongBinder(sender.asBinder());
3537 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3538 reply.readException();
3539 String res = reply.readString();
3540 data.recycle();
3541 reply.recycle();
3542 return res;
3543 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003544 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3545 Parcel data = Parcel.obtain();
3546 Parcel reply = Parcel.obtain();
3547 data.writeInterfaceToken(IActivityManager.descriptor);
3548 data.writeStrongBinder(sender.asBinder());
3549 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3550 reply.readException();
3551 int res = reply.readInt();
3552 data.recycle();
3553 reply.recycle();
3554 return res;
3555 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003556 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3557 boolean requireFull, String name, String callerPackage) throws RemoteException {
3558 Parcel data = Parcel.obtain();
3559 Parcel reply = Parcel.obtain();
3560 data.writeInterfaceToken(IActivityManager.descriptor);
3561 data.writeInt(callingPid);
3562 data.writeInt(callingUid);
3563 data.writeInt(userId);
3564 data.writeInt(allowAll ? 1 : 0);
3565 data.writeInt(requireFull ? 1 : 0);
3566 data.writeString(name);
3567 data.writeString(callerPackage);
3568 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3569 reply.readException();
3570 int res = reply.readInt();
3571 data.recycle();
3572 reply.recycle();
3573 return res;
3574 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003575 public void setProcessLimit(int max) throws RemoteException
3576 {
3577 Parcel data = Parcel.obtain();
3578 Parcel reply = Parcel.obtain();
3579 data.writeInterfaceToken(IActivityManager.descriptor);
3580 data.writeInt(max);
3581 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3582 reply.readException();
3583 data.recycle();
3584 reply.recycle();
3585 }
3586 public int getProcessLimit() throws RemoteException
3587 {
3588 Parcel data = Parcel.obtain();
3589 Parcel reply = Parcel.obtain();
3590 data.writeInterfaceToken(IActivityManager.descriptor);
3591 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3592 reply.readException();
3593 int res = reply.readInt();
3594 data.recycle();
3595 reply.recycle();
3596 return res;
3597 }
3598 public void setProcessForeground(IBinder token, int pid,
3599 boolean isForeground) throws RemoteException {
3600 Parcel data = Parcel.obtain();
3601 Parcel reply = Parcel.obtain();
3602 data.writeInterfaceToken(IActivityManager.descriptor);
3603 data.writeStrongBinder(token);
3604 data.writeInt(pid);
3605 data.writeInt(isForeground ? 1 : 0);
3606 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3607 reply.readException();
3608 data.recycle();
3609 reply.recycle();
3610 }
3611 public int checkPermission(String permission, int pid, int uid)
3612 throws RemoteException {
3613 Parcel data = Parcel.obtain();
3614 Parcel reply = Parcel.obtain();
3615 data.writeInterfaceToken(IActivityManager.descriptor);
3616 data.writeString(permission);
3617 data.writeInt(pid);
3618 data.writeInt(uid);
3619 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3620 reply.readException();
3621 int res = reply.readInt();
3622 data.recycle();
3623 reply.recycle();
3624 return res;
3625 }
3626 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003627 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003628 Parcel data = Parcel.obtain();
3629 Parcel reply = Parcel.obtain();
3630 data.writeInterfaceToken(IActivityManager.descriptor);
3631 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003632 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003633 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003634 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3635 reply.readException();
3636 boolean res = reply.readInt() != 0;
3637 data.recycle();
3638 reply.recycle();
3639 return res;
3640 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003641 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003642 throws RemoteException {
3643 Parcel data = Parcel.obtain();
3644 Parcel reply = Parcel.obtain();
3645 data.writeInterfaceToken(IActivityManager.descriptor);
3646 uri.writeToParcel(data, 0);
3647 data.writeInt(pid);
3648 data.writeInt(uid);
3649 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003650 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003651 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3652 reply.readException();
3653 int res = reply.readInt();
3654 data.recycle();
3655 reply.recycle();
3656 return res;
3657 }
3658 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003659 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003660 Parcel data = Parcel.obtain();
3661 Parcel reply = Parcel.obtain();
3662 data.writeInterfaceToken(IActivityManager.descriptor);
3663 data.writeStrongBinder(caller.asBinder());
3664 data.writeString(targetPkg);
3665 uri.writeToParcel(data, 0);
3666 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003667 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003668 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3669 reply.readException();
3670 data.recycle();
3671 reply.recycle();
3672 }
3673 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003674 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003675 Parcel data = Parcel.obtain();
3676 Parcel reply = Parcel.obtain();
3677 data.writeInterfaceToken(IActivityManager.descriptor);
3678 data.writeStrongBinder(caller.asBinder());
3679 uri.writeToParcel(data, 0);
3680 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003681 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003682 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3683 reply.readException();
3684 data.recycle();
3685 reply.recycle();
3686 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003687
3688 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003689 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3690 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003691 Parcel data = Parcel.obtain();
3692 Parcel reply = Parcel.obtain();
3693 data.writeInterfaceToken(IActivityManager.descriptor);
3694 uri.writeToParcel(data, 0);
3695 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003696 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003697 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3698 reply.readException();
3699 data.recycle();
3700 reply.recycle();
3701 }
3702
3703 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003704 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3705 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003706 Parcel data = Parcel.obtain();
3707 Parcel reply = Parcel.obtain();
3708 data.writeInterfaceToken(IActivityManager.descriptor);
3709 uri.writeToParcel(data, 0);
3710 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003711 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003712 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3713 reply.readException();
3714 data.recycle();
3715 reply.recycle();
3716 }
3717
3718 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003719 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3720 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003721 Parcel data = Parcel.obtain();
3722 Parcel reply = Parcel.obtain();
3723 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003724 data.writeString(packageName);
3725 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003726 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3727 reply.readException();
3728 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3729 reply);
3730 data.recycle();
3731 reply.recycle();
3732 return perms;
3733 }
3734
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003735 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3736 throws RemoteException {
3737 Parcel data = Parcel.obtain();
3738 Parcel reply = Parcel.obtain();
3739 data.writeInterfaceToken(IActivityManager.descriptor);
3740 data.writeStrongBinder(who.asBinder());
3741 data.writeInt(waiting ? 1 : 0);
3742 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3743 reply.readException();
3744 data.recycle();
3745 reply.recycle();
3746 }
3747 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3748 Parcel data = Parcel.obtain();
3749 Parcel reply = Parcel.obtain();
3750 data.writeInterfaceToken(IActivityManager.descriptor);
3751 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3752 reply.readException();
3753 outInfo.readFromParcel(reply);
3754 data.recycle();
3755 reply.recycle();
3756 }
3757 public void unhandledBack() throws RemoteException
3758 {
3759 Parcel data = Parcel.obtain();
3760 Parcel reply = Parcel.obtain();
3761 data.writeInterfaceToken(IActivityManager.descriptor);
3762 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3763 reply.readException();
3764 data.recycle();
3765 reply.recycle();
3766 }
3767 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3768 {
3769 Parcel data = Parcel.obtain();
3770 Parcel reply = Parcel.obtain();
3771 data.writeInterfaceToken(IActivityManager.descriptor);
3772 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3773 reply.readException();
3774 ParcelFileDescriptor pfd = null;
3775 if (reply.readInt() != 0) {
3776 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3777 }
3778 data.recycle();
3779 reply.recycle();
3780 return pfd;
3781 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003782 public void setLockScreenShown(boolean shown) throws RemoteException
3783 {
3784 Parcel data = Parcel.obtain();
3785 Parcel reply = Parcel.obtain();
3786 data.writeInterfaceToken(IActivityManager.descriptor);
3787 data.writeInt(shown ? 1 : 0);
3788 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3789 reply.readException();
3790 data.recycle();
3791 reply.recycle();
3792 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003793 public void setDebugApp(
3794 String packageName, boolean waitForDebugger, boolean persistent)
3795 throws RemoteException
3796 {
3797 Parcel data = Parcel.obtain();
3798 Parcel reply = Parcel.obtain();
3799 data.writeInterfaceToken(IActivityManager.descriptor);
3800 data.writeString(packageName);
3801 data.writeInt(waitForDebugger ? 1 : 0);
3802 data.writeInt(persistent ? 1 : 0);
3803 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3804 reply.readException();
3805 data.recycle();
3806 reply.recycle();
3807 }
3808 public void setAlwaysFinish(boolean enabled) throws RemoteException
3809 {
3810 Parcel data = Parcel.obtain();
3811 Parcel reply = Parcel.obtain();
3812 data.writeInterfaceToken(IActivityManager.descriptor);
3813 data.writeInt(enabled ? 1 : 0);
3814 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3815 reply.readException();
3816 data.recycle();
3817 reply.recycle();
3818 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003819 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003820 {
3821 Parcel data = Parcel.obtain();
3822 Parcel reply = Parcel.obtain();
3823 data.writeInterfaceToken(IActivityManager.descriptor);
3824 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003825 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003826 reply.readException();
3827 data.recycle();
3828 reply.recycle();
3829 }
3830 public void enterSafeMode() throws RemoteException {
3831 Parcel data = Parcel.obtain();
3832 data.writeInterfaceToken(IActivityManager.descriptor);
3833 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3834 data.recycle();
3835 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003836 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3837 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003838 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003839 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003840 data.writeStrongBinder(sender.asBinder());
3841 data.writeInt(sourceUid);
3842 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003843 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3844 data.recycle();
3845 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003846 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003847 Parcel data = Parcel.obtain();
3848 Parcel reply = Parcel.obtain();
3849 data.writeInterfaceToken(IActivityManager.descriptor);
3850 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003851 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003852 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003853 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003854 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003855 boolean res = reply.readInt() != 0;
3856 data.recycle();
3857 reply.recycle();
3858 return res;
3859 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003860 @Override
3861 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3862 Parcel data = Parcel.obtain();
3863 Parcel reply = Parcel.obtain();
3864 data.writeInterfaceToken(IActivityManager.descriptor);
3865 data.writeString(reason);
3866 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3867 boolean res = reply.readInt() != 0;
3868 data.recycle();
3869 reply.recycle();
3870 return res;
3871 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003872 public boolean testIsSystemReady()
3873 {
3874 /* this base class version is never called */
3875 return true;
3876 }
Dan Egnor60d87622009-12-16 16:32:58 -08003877 public void handleApplicationCrash(IBinder app,
3878 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3879 {
3880 Parcel data = Parcel.obtain();
3881 Parcel reply = Parcel.obtain();
3882 data.writeInterfaceToken(IActivityManager.descriptor);
3883 data.writeStrongBinder(app);
3884 crashInfo.writeToParcel(data, 0);
3885 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3886 reply.readException();
3887 reply.recycle();
3888 data.recycle();
3889 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003890
Dan Egnor60d87622009-12-16 16:32:58 -08003891 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003892 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003893 {
3894 Parcel data = Parcel.obtain();
3895 Parcel reply = Parcel.obtain();
3896 data.writeInterfaceToken(IActivityManager.descriptor);
3897 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003898 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003899 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003900 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003901 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003902 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003903 reply.recycle();
3904 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003905 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003906 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003907
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003908 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003909 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003910 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003911 {
3912 Parcel data = Parcel.obtain();
3913 Parcel reply = Parcel.obtain();
3914 data.writeInterfaceToken(IActivityManager.descriptor);
3915 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003916 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003917 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003918 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3919 reply.readException();
3920 reply.recycle();
3921 data.recycle();
3922 }
3923
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003924 public void signalPersistentProcesses(int sig) throws RemoteException {
3925 Parcel data = Parcel.obtain();
3926 Parcel reply = Parcel.obtain();
3927 data.writeInterfaceToken(IActivityManager.descriptor);
3928 data.writeInt(sig);
3929 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3930 reply.readException();
3931 data.recycle();
3932 reply.recycle();
3933 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003934
Dianne Hackborn1676c852012-09-10 14:52:30 -07003935 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003936 Parcel data = Parcel.obtain();
3937 Parcel reply = Parcel.obtain();
3938 data.writeInterfaceToken(IActivityManager.descriptor);
3939 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003940 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003941 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3942 reply.readException();
3943 data.recycle();
3944 reply.recycle();
3945 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003946
3947 public void killAllBackgroundProcesses() throws RemoteException {
3948 Parcel data = Parcel.obtain();
3949 Parcel reply = Parcel.obtain();
3950 data.writeInterfaceToken(IActivityManager.descriptor);
3951 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3952 reply.readException();
3953 data.recycle();
3954 reply.recycle();
3955 }
3956
Dianne Hackborn1676c852012-09-10 14:52:30 -07003957 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003958 Parcel data = Parcel.obtain();
3959 Parcel reply = Parcel.obtain();
3960 data.writeInterfaceToken(IActivityManager.descriptor);
3961 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003962 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003963 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003964 reply.readException();
3965 data.recycle();
3966 reply.recycle();
3967 }
3968
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003969 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3970 throws RemoteException
3971 {
3972 Parcel data = Parcel.obtain();
3973 Parcel reply = Parcel.obtain();
3974 data.writeInterfaceToken(IActivityManager.descriptor);
3975 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3976 reply.readException();
3977 outInfo.readFromParcel(reply);
3978 reply.recycle();
3979 data.recycle();
3980 }
3981
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003982 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3983 {
3984 Parcel data = Parcel.obtain();
3985 Parcel reply = Parcel.obtain();
3986 data.writeInterfaceToken(IActivityManager.descriptor);
3987 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3988 reply.readException();
3989 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3990 reply.recycle();
3991 data.recycle();
3992 return res;
3993 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003994
Dianne Hackborn1676c852012-09-10 14:52:30 -07003995 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003996 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003997 {
3998 Parcel data = Parcel.obtain();
3999 Parcel reply = Parcel.obtain();
4000 data.writeInterfaceToken(IActivityManager.descriptor);
4001 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004002 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004003 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004004 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004005 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004006 if (fd != null) {
4007 data.writeInt(1);
4008 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4009 } else {
4010 data.writeInt(0);
4011 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004012 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4013 reply.readException();
4014 boolean res = reply.readInt() != 0;
4015 reply.recycle();
4016 data.recycle();
4017 return res;
4018 }
4019
Dianne Hackborn55280a92009-05-07 15:53:46 -07004020 public boolean shutdown(int timeout) throws RemoteException
4021 {
4022 Parcel data = Parcel.obtain();
4023 Parcel reply = Parcel.obtain();
4024 data.writeInterfaceToken(IActivityManager.descriptor);
4025 data.writeInt(timeout);
4026 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4027 reply.readException();
4028 boolean res = reply.readInt() != 0;
4029 reply.recycle();
4030 data.recycle();
4031 return res;
4032 }
4033
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004034 public void stopAppSwitches() throws RemoteException {
4035 Parcel data = Parcel.obtain();
4036 Parcel reply = Parcel.obtain();
4037 data.writeInterfaceToken(IActivityManager.descriptor);
4038 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4039 reply.readException();
4040 reply.recycle();
4041 data.recycle();
4042 }
4043
4044 public void resumeAppSwitches() throws RemoteException {
4045 Parcel data = Parcel.obtain();
4046 Parcel reply = Parcel.obtain();
4047 data.writeInterfaceToken(IActivityManager.descriptor);
4048 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4049 reply.readException();
4050 reply.recycle();
4051 data.recycle();
4052 }
4053
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004054 public void killApplicationWithAppId(String pkg, int appid, String reason)
4055 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004056 Parcel data = Parcel.obtain();
4057 Parcel reply = Parcel.obtain();
4058 data.writeInterfaceToken(IActivityManager.descriptor);
4059 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004060 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004061 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004062 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004063 reply.readException();
4064 data.recycle();
4065 reply.recycle();
4066 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004067
4068 public void closeSystemDialogs(String reason) throws RemoteException {
4069 Parcel data = Parcel.obtain();
4070 Parcel reply = Parcel.obtain();
4071 data.writeInterfaceToken(IActivityManager.descriptor);
4072 data.writeString(reason);
4073 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4074 reply.readException();
4075 data.recycle();
4076 reply.recycle();
4077 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004078
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004079 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004080 throws RemoteException {
4081 Parcel data = Parcel.obtain();
4082 Parcel reply = Parcel.obtain();
4083 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004084 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004085 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4086 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004087 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004088 data.recycle();
4089 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004090 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004091 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004092
4093 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4094 Parcel data = Parcel.obtain();
4095 Parcel reply = Parcel.obtain();
4096 data.writeInterfaceToken(IActivityManager.descriptor);
4097 data.writeString(processName);
4098 data.writeInt(uid);
4099 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4100 reply.readException();
4101 data.recycle();
4102 reply.recycle();
4103 }
4104
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004105 public void overridePendingTransition(IBinder token, String packageName,
4106 int enterAnim, int exitAnim) throws RemoteException {
4107 Parcel data = Parcel.obtain();
4108 Parcel reply = Parcel.obtain();
4109 data.writeInterfaceToken(IActivityManager.descriptor);
4110 data.writeStrongBinder(token);
4111 data.writeString(packageName);
4112 data.writeInt(enterAnim);
4113 data.writeInt(exitAnim);
4114 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4115 reply.readException();
4116 data.recycle();
4117 reply.recycle();
4118 }
4119
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004120 public boolean isUserAMonkey() throws RemoteException {
4121 Parcel data = Parcel.obtain();
4122 Parcel reply = Parcel.obtain();
4123 data.writeInterfaceToken(IActivityManager.descriptor);
4124 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4125 reply.readException();
4126 boolean res = reply.readInt() != 0;
4127 data.recycle();
4128 reply.recycle();
4129 return res;
4130 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004131
4132 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4133 Parcel data = Parcel.obtain();
4134 Parcel reply = Parcel.obtain();
4135 data.writeInterfaceToken(IActivityManager.descriptor);
4136 data.writeInt(monkey ? 1 : 0);
4137 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4138 reply.readException();
4139 data.recycle();
4140 reply.recycle();
4141 }
4142
Dianne Hackborn860755f2010-06-03 18:47:52 -07004143 public void finishHeavyWeightApp() throws RemoteException {
4144 Parcel data = Parcel.obtain();
4145 Parcel reply = Parcel.obtain();
4146 data.writeInterfaceToken(IActivityManager.descriptor);
4147 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4148 reply.readException();
4149 data.recycle();
4150 reply.recycle();
4151 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004152
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004153 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004154 throws RemoteException {
4155 Parcel data = Parcel.obtain();
4156 Parcel reply = Parcel.obtain();
4157 data.writeInterfaceToken(IActivityManager.descriptor);
4158 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004159 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4160 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004161 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004162 data.recycle();
4163 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004164 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004165 }
4166
Craig Mautner233ceee2014-05-09 17:05:11 -07004167 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004168 throws RemoteException {
4169 Parcel data = Parcel.obtain();
4170 Parcel reply = Parcel.obtain();
4171 data.writeInterfaceToken(IActivityManager.descriptor);
4172 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004173 if (options == null) {
4174 data.writeInt(0);
4175 } else {
4176 data.writeInt(1);
4177 data.writeBundle(options.toBundle());
4178 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004179 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004180 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004181 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004182 data.recycle();
4183 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004184 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004185 }
4186
Craig Mautner233ceee2014-05-09 17:05:11 -07004187 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4188 Parcel data = Parcel.obtain();
4189 Parcel reply = Parcel.obtain();
4190 data.writeInterfaceToken(IActivityManager.descriptor);
4191 data.writeStrongBinder(token);
4192 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4193 reply.readException();
4194 Bundle bundle = reply.readBundle();
4195 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4196 data.recycle();
4197 reply.recycle();
4198 return options;
4199 }
4200
Daniel Sandler69a48172010-06-23 16:29:36 -04004201 public void setImmersive(IBinder token, boolean immersive)
4202 throws RemoteException {
4203 Parcel data = Parcel.obtain();
4204 Parcel reply = Parcel.obtain();
4205 data.writeInterfaceToken(IActivityManager.descriptor);
4206 data.writeStrongBinder(token);
4207 data.writeInt(immersive ? 1 : 0);
4208 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4209 reply.readException();
4210 data.recycle();
4211 reply.recycle();
4212 }
4213
4214 public boolean isImmersive(IBinder token)
4215 throws RemoteException {
4216 Parcel data = Parcel.obtain();
4217 Parcel reply = Parcel.obtain();
4218 data.writeInterfaceToken(IActivityManager.descriptor);
4219 data.writeStrongBinder(token);
4220 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004221 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004222 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004223 data.recycle();
4224 reply.recycle();
4225 return res;
4226 }
4227
Craig Mautnerd61dc202014-07-07 11:09:11 -07004228 public boolean isTopOfTask(IBinder token) throws RemoteException {
4229 Parcel data = Parcel.obtain();
4230 Parcel reply = Parcel.obtain();
4231 data.writeInterfaceToken(IActivityManager.descriptor);
4232 data.writeStrongBinder(token);
4233 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4234 reply.readException();
4235 boolean res = reply.readInt() == 1;
4236 data.recycle();
4237 reply.recycle();
4238 return res;
4239 }
4240
Daniel Sandler69a48172010-06-23 16:29:36 -04004241 public boolean isTopActivityImmersive()
4242 throws RemoteException {
4243 Parcel data = Parcel.obtain();
4244 Parcel reply = Parcel.obtain();
4245 data.writeInterfaceToken(IActivityManager.descriptor);
4246 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004247 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004248 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004249 data.recycle();
4250 reply.recycle();
4251 return res;
4252 }
4253
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004254 public void crashApplication(int uid, int initialPid, String packageName,
4255 String message) throws RemoteException {
4256 Parcel data = Parcel.obtain();
4257 Parcel reply = Parcel.obtain();
4258 data.writeInterfaceToken(IActivityManager.descriptor);
4259 data.writeInt(uid);
4260 data.writeInt(initialPid);
4261 data.writeString(packageName);
4262 data.writeString(message);
4263 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4264 reply.readException();
4265 data.recycle();
4266 reply.recycle();
4267 }
Andy McFadden824c5102010-07-09 16:26:57 -07004268
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004269 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004270 Parcel data = Parcel.obtain();
4271 Parcel reply = Parcel.obtain();
4272 data.writeInterfaceToken(IActivityManager.descriptor);
4273 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004274 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004275 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4276 reply.readException();
4277 String res = reply.readString();
4278 data.recycle();
4279 reply.recycle();
4280 return res;
4281 }
4282
Dianne Hackborn7e269642010-08-25 19:50:20 -07004283 public IBinder newUriPermissionOwner(String name)
4284 throws RemoteException {
4285 Parcel data = Parcel.obtain();
4286 Parcel reply = Parcel.obtain();
4287 data.writeInterfaceToken(IActivityManager.descriptor);
4288 data.writeString(name);
4289 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4290 reply.readException();
4291 IBinder res = reply.readStrongBinder();
4292 data.recycle();
4293 reply.recycle();
4294 return res;
4295 }
4296
4297 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004298 Uri uri, int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004299 Parcel data = Parcel.obtain();
4300 Parcel reply = Parcel.obtain();
4301 data.writeInterfaceToken(IActivityManager.descriptor);
4302 data.writeStrongBinder(owner);
4303 data.writeInt(fromUid);
4304 data.writeString(targetPkg);
4305 uri.writeToParcel(data, 0);
4306 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004307 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004308 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4309 reply.readException();
4310 data.recycle();
4311 reply.recycle();
4312 }
4313
4314 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004315 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004316 Parcel data = Parcel.obtain();
4317 Parcel reply = Parcel.obtain();
4318 data.writeInterfaceToken(IActivityManager.descriptor);
4319 data.writeStrongBinder(owner);
4320 if (uri != null) {
4321 data.writeInt(1);
4322 uri.writeToParcel(data, 0);
4323 } else {
4324 data.writeInt(0);
4325 }
4326 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004327 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004328 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4329 reply.readException();
4330 data.recycle();
4331 reply.recycle();
4332 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004333
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004334 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004335 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004336 Parcel data = Parcel.obtain();
4337 Parcel reply = Parcel.obtain();
4338 data.writeInterfaceToken(IActivityManager.descriptor);
4339 data.writeInt(callingUid);
4340 data.writeString(targetPkg);
4341 uri.writeToParcel(data, 0);
4342 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004343 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004344 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4345 reply.readException();
4346 int res = reply.readInt();
4347 data.recycle();
4348 reply.recycle();
4349 return res;
4350 }
4351
Dianne Hackborn1676c852012-09-10 14:52:30 -07004352 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004353 String path, ParcelFileDescriptor fd) throws RemoteException {
4354 Parcel data = Parcel.obtain();
4355 Parcel reply = Parcel.obtain();
4356 data.writeInterfaceToken(IActivityManager.descriptor);
4357 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004358 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004359 data.writeInt(managed ? 1 : 0);
4360 data.writeString(path);
4361 if (fd != null) {
4362 data.writeInt(1);
4363 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4364 } else {
4365 data.writeInt(0);
4366 }
4367 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4368 reply.readException();
4369 boolean res = reply.readInt() != 0;
4370 reply.recycle();
4371 data.recycle();
4372 return res;
4373 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004374
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004375 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004376 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004377 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004378 Parcel data = Parcel.obtain();
4379 Parcel reply = Parcel.obtain();
4380 data.writeInterfaceToken(IActivityManager.descriptor);
4381 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004382 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004383 data.writeTypedArray(intents, 0);
4384 data.writeStringArray(resolvedTypes);
4385 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004386 if (options != null) {
4387 data.writeInt(1);
4388 options.writeToParcel(data, 0);
4389 } else {
4390 data.writeInt(0);
4391 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004392 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004393 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4394 reply.readException();
4395 int result = reply.readInt();
4396 reply.recycle();
4397 data.recycle();
4398 return result;
4399 }
4400
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004401 public int getFrontActivityScreenCompatMode() throws RemoteException {
4402 Parcel data = Parcel.obtain();
4403 Parcel reply = Parcel.obtain();
4404 data.writeInterfaceToken(IActivityManager.descriptor);
4405 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4406 reply.readException();
4407 int mode = reply.readInt();
4408 reply.recycle();
4409 data.recycle();
4410 return mode;
4411 }
4412
4413 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4414 Parcel data = Parcel.obtain();
4415 Parcel reply = Parcel.obtain();
4416 data.writeInterfaceToken(IActivityManager.descriptor);
4417 data.writeInt(mode);
4418 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4419 reply.readException();
4420 reply.recycle();
4421 data.recycle();
4422 }
4423
4424 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4425 Parcel data = Parcel.obtain();
4426 Parcel reply = Parcel.obtain();
4427 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004428 data.writeString(packageName);
4429 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004430 reply.readException();
4431 int mode = reply.readInt();
4432 reply.recycle();
4433 data.recycle();
4434 return mode;
4435 }
4436
4437 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004438 throws RemoteException {
4439 Parcel data = Parcel.obtain();
4440 Parcel reply = Parcel.obtain();
4441 data.writeInterfaceToken(IActivityManager.descriptor);
4442 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004443 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004444 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4445 reply.readException();
4446 reply.recycle();
4447 data.recycle();
4448 }
4449
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004450 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4451 Parcel data = Parcel.obtain();
4452 Parcel reply = Parcel.obtain();
4453 data.writeInterfaceToken(IActivityManager.descriptor);
4454 data.writeString(packageName);
4455 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4456 reply.readException();
4457 boolean ask = reply.readInt() != 0;
4458 reply.recycle();
4459 data.recycle();
4460 return ask;
4461 }
4462
4463 public void setPackageAskScreenCompat(String packageName, boolean ask)
4464 throws RemoteException {
4465 Parcel data = Parcel.obtain();
4466 Parcel reply = Parcel.obtain();
4467 data.writeInterfaceToken(IActivityManager.descriptor);
4468 data.writeString(packageName);
4469 data.writeInt(ask ? 1 : 0);
4470 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4471 reply.readException();
4472 reply.recycle();
4473 data.recycle();
4474 }
4475
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004476 public boolean switchUser(int userid) throws RemoteException {
4477 Parcel data = Parcel.obtain();
4478 Parcel reply = Parcel.obtain();
4479 data.writeInterfaceToken(IActivityManager.descriptor);
4480 data.writeInt(userid);
4481 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4482 reply.readException();
4483 boolean result = reply.readInt() != 0;
4484 reply.recycle();
4485 data.recycle();
4486 return result;
4487 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004488
Kenny Guy08488bf2014-02-21 17:40:37 +00004489 public boolean startUserInBackground(int userid) throws RemoteException {
4490 Parcel data = Parcel.obtain();
4491 Parcel reply = Parcel.obtain();
4492 data.writeInterfaceToken(IActivityManager.descriptor);
4493 data.writeInt(userid);
4494 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4495 reply.readException();
4496 boolean result = reply.readInt() != 0;
4497 reply.recycle();
4498 data.recycle();
4499 return result;
4500 }
4501
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004502 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4503 Parcel data = Parcel.obtain();
4504 Parcel reply = Parcel.obtain();
4505 data.writeInterfaceToken(IActivityManager.descriptor);
4506 data.writeInt(userid);
4507 data.writeStrongInterface(callback);
4508 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4509 reply.readException();
4510 int result = reply.readInt();
4511 reply.recycle();
4512 data.recycle();
4513 return result;
4514 }
4515
Amith Yamasani52f1d752012-03-28 18:19:29 -07004516 public UserInfo getCurrentUser() throws RemoteException {
4517 Parcel data = Parcel.obtain();
4518 Parcel reply = Parcel.obtain();
4519 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004520 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004521 reply.readException();
4522 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4523 reply.recycle();
4524 data.recycle();
4525 return userInfo;
4526 }
4527
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004528 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004529 Parcel data = Parcel.obtain();
4530 Parcel reply = Parcel.obtain();
4531 data.writeInterfaceToken(IActivityManager.descriptor);
4532 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004533 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004534 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4535 reply.readException();
4536 boolean result = reply.readInt() != 0;
4537 reply.recycle();
4538 data.recycle();
4539 return result;
4540 }
4541
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004542 public int[] getRunningUserIds() throws RemoteException {
4543 Parcel data = Parcel.obtain();
4544 Parcel reply = Parcel.obtain();
4545 data.writeInterfaceToken(IActivityManager.descriptor);
4546 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4547 reply.readException();
4548 int[] result = reply.createIntArray();
4549 reply.recycle();
4550 data.recycle();
4551 return result;
4552 }
4553
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004554 public boolean removeTask(int taskId, int flags) throws RemoteException {
4555 Parcel data = Parcel.obtain();
4556 Parcel reply = Parcel.obtain();
4557 data.writeInterfaceToken(IActivityManager.descriptor);
4558 data.writeInt(taskId);
4559 data.writeInt(flags);
4560 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4561 reply.readException();
4562 boolean result = reply.readInt() != 0;
4563 reply.recycle();
4564 data.recycle();
4565 return result;
4566 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004567
Jeff Sharkeya4620792011-05-20 15:29:23 -07004568 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4569 Parcel data = Parcel.obtain();
4570 Parcel reply = Parcel.obtain();
4571 data.writeInterfaceToken(IActivityManager.descriptor);
4572 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4573 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4574 reply.readException();
4575 data.recycle();
4576 reply.recycle();
4577 }
4578
4579 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4580 Parcel data = Parcel.obtain();
4581 Parcel reply = Parcel.obtain();
4582 data.writeInterfaceToken(IActivityManager.descriptor);
4583 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4584 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4585 reply.readException();
4586 data.recycle();
4587 reply.recycle();
4588 }
4589
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004590 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4591 Parcel data = Parcel.obtain();
4592 Parcel reply = Parcel.obtain();
4593 data.writeInterfaceToken(IActivityManager.descriptor);
4594 data.writeStrongBinder(sender.asBinder());
4595 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4596 reply.readException();
4597 boolean res = reply.readInt() != 0;
4598 data.recycle();
4599 reply.recycle();
4600 return res;
4601 }
4602
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004603 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4604 Parcel data = Parcel.obtain();
4605 Parcel reply = Parcel.obtain();
4606 data.writeInterfaceToken(IActivityManager.descriptor);
4607 data.writeStrongBinder(sender.asBinder());
4608 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4609 reply.readException();
4610 boolean res = reply.readInt() != 0;
4611 data.recycle();
4612 reply.recycle();
4613 return res;
4614 }
4615
Dianne Hackborn81038902012-11-26 17:04:09 -08004616 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4617 Parcel data = Parcel.obtain();
4618 Parcel reply = Parcel.obtain();
4619 data.writeInterfaceToken(IActivityManager.descriptor);
4620 data.writeStrongBinder(sender.asBinder());
4621 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4622 reply.readException();
4623 Intent res = reply.readInt() != 0
4624 ? Intent.CREATOR.createFromParcel(reply) : null;
4625 data.recycle();
4626 reply.recycle();
4627 return res;
4628 }
4629
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004630 public String getTagForIntentSender(IIntentSender sender, String prefix)
4631 throws RemoteException {
4632 Parcel data = Parcel.obtain();
4633 Parcel reply = Parcel.obtain();
4634 data.writeInterfaceToken(IActivityManager.descriptor);
4635 data.writeStrongBinder(sender.asBinder());
4636 data.writeString(prefix);
4637 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4638 reply.readException();
4639 String res = reply.readString();
4640 data.recycle();
4641 reply.recycle();
4642 return res;
4643 }
4644
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004645 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4646 {
4647 Parcel data = Parcel.obtain();
4648 Parcel reply = Parcel.obtain();
4649 data.writeInterfaceToken(IActivityManager.descriptor);
4650 values.writeToParcel(data, 0);
4651 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4652 reply.readException();
4653 data.recycle();
4654 reply.recycle();
4655 }
4656
Dianne Hackbornb437e092011-08-05 17:50:29 -07004657 public long[] getProcessPss(int[] pids) throws RemoteException {
4658 Parcel data = Parcel.obtain();
4659 Parcel reply = Parcel.obtain();
4660 data.writeInterfaceToken(IActivityManager.descriptor);
4661 data.writeIntArray(pids);
4662 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4663 reply.readException();
4664 long[] res = reply.createLongArray();
4665 data.recycle();
4666 reply.recycle();
4667 return res;
4668 }
4669
Dianne Hackborn661cd522011-08-22 00:26:20 -07004670 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4671 Parcel data = Parcel.obtain();
4672 Parcel reply = Parcel.obtain();
4673 data.writeInterfaceToken(IActivityManager.descriptor);
4674 TextUtils.writeToParcel(msg, data, 0);
4675 data.writeInt(always ? 1 : 0);
4676 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4677 reply.readException();
4678 data.recycle();
4679 reply.recycle();
4680 }
4681
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004682 public void dismissKeyguardOnNextActivity() throws RemoteException {
4683 Parcel data = Parcel.obtain();
4684 Parcel reply = Parcel.obtain();
4685 data.writeInterfaceToken(IActivityManager.descriptor);
4686 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4687 reply.readException();
4688 data.recycle();
4689 reply.recycle();
4690 }
4691
Adam Powelldd8fab22012-03-22 17:47:27 -07004692 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4693 throws RemoteException {
4694 Parcel data = Parcel.obtain();
4695 Parcel reply = Parcel.obtain();
4696 data.writeInterfaceToken(IActivityManager.descriptor);
4697 data.writeStrongBinder(token);
4698 data.writeString(destAffinity);
4699 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4700 reply.readException();
4701 boolean result = reply.readInt() != 0;
4702 data.recycle();
4703 reply.recycle();
4704 return result;
4705 }
4706
4707 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4708 throws RemoteException {
4709 Parcel data = Parcel.obtain();
4710 Parcel reply = Parcel.obtain();
4711 data.writeInterfaceToken(IActivityManager.descriptor);
4712 data.writeStrongBinder(token);
4713 target.writeToParcel(data, 0);
4714 data.writeInt(resultCode);
4715 if (resultData != null) {
4716 data.writeInt(1);
4717 resultData.writeToParcel(data, 0);
4718 } else {
4719 data.writeInt(0);
4720 }
4721 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4722 reply.readException();
4723 boolean result = reply.readInt() != 0;
4724 data.recycle();
4725 reply.recycle();
4726 return result;
4727 }
4728
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004729 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4730 Parcel data = Parcel.obtain();
4731 Parcel reply = Parcel.obtain();
4732 data.writeInterfaceToken(IActivityManager.descriptor);
4733 data.writeStrongBinder(activityToken);
4734 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4735 reply.readException();
4736 int result = reply.readInt();
4737 data.recycle();
4738 reply.recycle();
4739 return result;
4740 }
4741
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004742 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4743 Parcel data = Parcel.obtain();
4744 Parcel reply = Parcel.obtain();
4745 data.writeInterfaceToken(IActivityManager.descriptor);
4746 data.writeStrongBinder(activityToken);
4747 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4748 reply.readException();
4749 String result = reply.readString();
4750 data.recycle();
4751 reply.recycle();
4752 return result;
4753 }
4754
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004755 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4756 Parcel data = Parcel.obtain();
4757 Parcel reply = Parcel.obtain();
4758 data.writeInterfaceToken(IActivityManager.descriptor);
4759 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4760 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4761 reply.readException();
4762 data.recycle();
4763 reply.recycle();
4764 }
4765
4766 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4767 Parcel data = Parcel.obtain();
4768 Parcel reply = Parcel.obtain();
4769 data.writeInterfaceToken(IActivityManager.descriptor);
4770 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4771 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4772 reply.readException();
4773 data.recycle();
4774 reply.recycle();
4775 }
4776
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004777 public void requestBugReport() throws RemoteException {
4778 Parcel data = Parcel.obtain();
4779 Parcel reply = Parcel.obtain();
4780 data.writeInterfaceToken(IActivityManager.descriptor);
4781 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4782 reply.readException();
4783 data.recycle();
4784 reply.recycle();
4785 }
4786
Jeff Brownbd181bb2013-09-10 16:44:24 -07004787 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4788 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004789 Parcel data = Parcel.obtain();
4790 Parcel reply = Parcel.obtain();
4791 data.writeInterfaceToken(IActivityManager.descriptor);
4792 data.writeInt(pid);
4793 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004794 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004795 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4796 reply.readException();
4797 long res = reply.readInt();
4798 data.recycle();
4799 reply.recycle();
4800 return res;
4801 }
4802
Adam Skorydfc7fd72013-08-05 19:23:41 -07004803 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004804 Parcel data = Parcel.obtain();
4805 Parcel reply = Parcel.obtain();
4806 data.writeInterfaceToken(IActivityManager.descriptor);
4807 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004808 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004809 reply.readException();
4810 Bundle res = reply.readBundle();
4811 data.recycle();
4812 reply.recycle();
4813 return res;
4814 }
4815
Adam Skory7140a252013-09-11 12:04:58 +01004816 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004817 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004818 Parcel data = Parcel.obtain();
4819 Parcel reply = Parcel.obtain();
4820 data.writeInterfaceToken(IActivityManager.descriptor);
4821 data.writeStrongBinder(token);
4822 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004823 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004824 reply.readException();
4825 data.recycle();
4826 reply.recycle();
4827 }
4828
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004829 public void killUid(int uid, String reason) throws RemoteException {
4830 Parcel data = Parcel.obtain();
4831 Parcel reply = Parcel.obtain();
4832 data.writeInterfaceToken(IActivityManager.descriptor);
4833 data.writeInt(uid);
4834 data.writeString(reason);
4835 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4836 reply.readException();
4837 data.recycle();
4838 reply.recycle();
4839 }
4840
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004841 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4842 Parcel data = Parcel.obtain();
4843 Parcel reply = Parcel.obtain();
4844 data.writeInterfaceToken(IActivityManager.descriptor);
4845 data.writeStrongBinder(who);
4846 data.writeInt(allowRestart ? 1 : 0);
4847 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4848 reply.readException();
4849 data.recycle();
4850 reply.recycle();
4851 }
4852
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004853 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4854 Parcel data = Parcel.obtain();
4855 Parcel reply = Parcel.obtain();
4856 data.writeInterfaceToken(IActivityManager.descriptor);
4857 data.writeStrongBinder(token);
4858 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4859 reply.readException();
4860 data.recycle();
4861 reply.recycle();
4862 }
4863
Craig Mautner5eda9b32013-07-02 11:58:16 -07004864 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4865 Parcel data = Parcel.obtain();
4866 Parcel reply = Parcel.obtain();
4867 data.writeInterfaceToken(IActivityManager.descriptor);
4868 data.writeStrongBinder(token);
4869 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4870 reply.readException();
4871 data.recycle();
4872 reply.recycle();
4873 }
4874
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004875 public void restart() throws RemoteException {
4876 Parcel data = Parcel.obtain();
4877 Parcel reply = Parcel.obtain();
4878 data.writeInterfaceToken(IActivityManager.descriptor);
4879 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4880 reply.readException();
4881 data.recycle();
4882 reply.recycle();
4883 }
4884
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004885 public void performIdleMaintenance() throws RemoteException {
4886 Parcel data = Parcel.obtain();
4887 Parcel reply = Parcel.obtain();
4888 data.writeInterfaceToken(IActivityManager.descriptor);
4889 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4890 reply.readException();
4891 data.recycle();
4892 reply.recycle();
4893 }
4894
Craig Mautner4a1cb222013-12-04 16:14:06 -08004895 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4896 IActivityContainerCallback callback) throws RemoteException {
4897 Parcel data = Parcel.obtain();
4898 Parcel reply = Parcel.obtain();
4899 data.writeInterfaceToken(IActivityManager.descriptor);
4900 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07004901 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08004902 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4903 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004904 final int result = reply.readInt();
4905 final IActivityContainer res;
4906 if (result == 1) {
4907 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4908 } else {
4909 res = null;
4910 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004911 data.recycle();
4912 reply.recycle();
4913 return res;
4914 }
4915
Craig Mautner95da1082014-02-24 17:54:35 -08004916 public void deleteActivityContainer(IActivityContainer activityContainer)
4917 throws RemoteException {
4918 Parcel data = Parcel.obtain();
4919 Parcel reply = Parcel.obtain();
4920 data.writeInterfaceToken(IActivityManager.descriptor);
4921 data.writeStrongBinder(activityContainer.asBinder());
4922 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4923 reply.readException();
4924 data.recycle();
4925 reply.recycle();
4926 }
4927
Craig Mautnere0a38842013-12-16 16:14:02 -08004928 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4929 throws RemoteException {
4930 Parcel data = Parcel.obtain();
4931 Parcel reply = Parcel.obtain();
4932 data.writeInterfaceToken(IActivityManager.descriptor);
4933 data.writeStrongBinder(activityToken);
4934 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4935 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004936 final int result = reply.readInt();
4937 final IActivityContainer res;
4938 if (result == 1) {
4939 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4940 } else {
4941 res = null;
4942 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004943 data.recycle();
4944 reply.recycle();
4945 return res;
4946 }
4947
Craig Mautner4a1cb222013-12-04 16:14:06 -08004948 public IBinder getHomeActivityToken() throws RemoteException {
4949 Parcel data = Parcel.obtain();
4950 Parcel reply = Parcel.obtain();
4951 data.writeInterfaceToken(IActivityManager.descriptor);
4952 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4953 reply.readException();
4954 IBinder res = reply.readStrongBinder();
4955 data.recycle();
4956 reply.recycle();
4957 return res;
4958 }
4959
Craig Mautneraea74a52014-03-08 14:23:10 -08004960 @Override
4961 public void startLockTaskMode(int taskId) throws RemoteException {
4962 Parcel data = Parcel.obtain();
4963 Parcel reply = Parcel.obtain();
4964 data.writeInterfaceToken(IActivityManager.descriptor);
4965 data.writeInt(taskId);
4966 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
4967 reply.readException();
4968 data.recycle();
4969 reply.recycle();
4970 }
4971
4972 @Override
4973 public void startLockTaskMode(IBinder token) throws RemoteException {
4974 Parcel data = Parcel.obtain();
4975 Parcel reply = Parcel.obtain();
4976 data.writeInterfaceToken(IActivityManager.descriptor);
4977 data.writeStrongBinder(token);
4978 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
4979 reply.readException();
4980 data.recycle();
4981 reply.recycle();
4982 }
4983
4984 @Override
Jason Monk62515be2014-05-21 16:06:19 -04004985 public void startLockTaskModeOnCurrent() throws RemoteException {
4986 Parcel data = Parcel.obtain();
4987 Parcel reply = Parcel.obtain();
4988 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07004989 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04004990 reply.readException();
4991 data.recycle();
4992 reply.recycle();
4993 }
4994
4995 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08004996 public void stopLockTaskMode() throws RemoteException {
4997 Parcel data = Parcel.obtain();
4998 Parcel reply = Parcel.obtain();
4999 data.writeInterfaceToken(IActivityManager.descriptor);
5000 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5001 reply.readException();
5002 data.recycle();
5003 reply.recycle();
5004 }
5005
5006 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005007 public void stopLockTaskModeOnCurrent() throws RemoteException {
5008 Parcel data = Parcel.obtain();
5009 Parcel reply = Parcel.obtain();
5010 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005011 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005012 reply.readException();
5013 data.recycle();
5014 reply.recycle();
5015 }
5016
5017 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005018 public boolean isInLockTaskMode() throws RemoteException {
5019 Parcel data = Parcel.obtain();
5020 Parcel reply = Parcel.obtain();
5021 data.writeInterfaceToken(IActivityManager.descriptor);
5022 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5023 reply.readException();
5024 boolean isInLockTaskMode = reply.readInt() == 1;
5025 data.recycle();
5026 reply.recycle();
5027 return isInLockTaskMode;
5028 }
5029
Craig Mautner688b5102014-03-27 16:55:03 -07005030 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005031 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005032 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005033 Parcel data = Parcel.obtain();
5034 Parcel reply = Parcel.obtain();
5035 data.writeInterfaceToken(IActivityManager.descriptor);
5036 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005037 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005038 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005039 reply.readException();
5040 data.recycle();
5041 reply.recycle();
5042 }
5043
Craig Mautneree2e45a2014-06-27 12:10:03 -07005044 @Override
5045 public boolean setMediaPlaying(IBinder token, boolean playing) throws RemoteException {
5046 Parcel data = Parcel.obtain();
5047 Parcel reply = Parcel.obtain();
5048 data.writeInterfaceToken(IActivityManager.descriptor);
5049 data.writeStrongBinder(token);
5050 data.writeInt(playing ? 1 : 0);
5051 mRemote.transact(SET_MEDIA_PLAYING_TRANSACTION, data, reply, 0);
5052 reply.readException();
5053 boolean success = reply.readInt() > 0;
5054 data.recycle();
5055 reply.recycle();
5056 return success;
5057 }
5058
5059 @Override
5060 public boolean isBackgroundMediaPlaying(IBinder token) throws RemoteException {
5061 Parcel data = Parcel.obtain();
5062 Parcel reply = Parcel.obtain();
5063 data.writeInterfaceToken(IActivityManager.descriptor);
5064 data.writeStrongBinder(token);
5065 mRemote.transact(IS_BG_MEDIA_PLAYING_TRANSACTION, data, reply, 0);
5066 reply.readException();
5067 final boolean playing = reply.readInt() > 0;
5068 data.recycle();
5069 reply.recycle();
5070 return playing;
5071 }
5072
5073 @Override
5074 public void mediaResourcesReleased(IBinder token) throws RemoteException {
5075 Parcel data = Parcel.obtain();
5076 Parcel reply = Parcel.obtain();
5077 data.writeInterfaceToken(IActivityManager.descriptor);
5078 data.writeStrongBinder(token);
Craig Mautnerbb742462014-07-07 15:28:55 -07005079 mRemote.transact(MEDIA_RESOURCES_RELEASED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5080 reply.readException();
5081 data.recycle();
5082 reply.recycle();
5083 }
5084
5085 @Override
5086 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5087 Parcel data = Parcel.obtain();
5088 Parcel reply = Parcel.obtain();
5089 data.writeInterfaceToken(IActivityManager.descriptor);
5090 data.writeStrongBinder(token);
5091 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5092 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005093 reply.readException();
5094 data.recycle();
5095 reply.recycle();
5096 }
5097
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005098 private IBinder mRemote;
5099}