blob: 1cb1047fe44d0c63b1ff267bd241dce999bfe51c [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 Hackborn028ceeb2014-08-17 17:45:48 -0700172 case START_ACTIVITY_AS_CALLER_TRANSACTION:
173 {
174 data.enforceInterface(IActivityManager.descriptor);
175 IBinder b = data.readStrongBinder();
176 IApplicationThread app = ApplicationThreadNative.asInterface(b);
177 String callingPackage = data.readString();
178 Intent intent = Intent.CREATOR.createFromParcel(data);
179 String resolvedType = data.readString();
180 IBinder resultTo = data.readStrongBinder();
181 String resultWho = data.readString();
182 int requestCode = data.readInt();
183 int startFlags = data.readInt();
184 String profileFile = data.readString();
185 ParcelFileDescriptor profileFd = data.readInt() != 0
186 ? data.readFileDescriptor() : null;
187 Bundle options = data.readInt() != 0
188 ? Bundle.CREATOR.createFromParcel(data) : null;
189 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
190 resultTo, resultWho, requestCode, startFlags,
191 profileFile, profileFd, options);
192 reply.writeNoException();
193 reply.writeInt(result);
194 return true;
195 }
196
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800197 case START_ACTIVITY_AND_WAIT_TRANSACTION:
198 {
199 data.enforceInterface(IActivityManager.descriptor);
200 IBinder b = data.readStrongBinder();
201 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800202 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800203 Intent intent = Intent.CREATOR.createFromParcel(data);
204 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800205 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800206 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800207 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700208 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700209 String profileFile = data.readString();
210 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700211 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700212 Bundle options = data.readInt() != 0
213 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700214 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800215 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700216 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700217 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800218 reply.writeNoException();
219 result.writeToParcel(reply, 0);
220 return true;
221 }
222
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700223 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
224 {
225 data.enforceInterface(IActivityManager.descriptor);
226 IBinder b = data.readStrongBinder();
227 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800228 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700229 Intent intent = Intent.CREATOR.createFromParcel(data);
230 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700231 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700232 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700233 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700234 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700235 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700236 Bundle options = data.readInt() != 0
237 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700238 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800239 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700240 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700241 reply.writeNoException();
242 reply.writeInt(result);
243 return true;
244 }
245
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700246 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700247 {
248 data.enforceInterface(IActivityManager.descriptor);
249 IBinder b = data.readStrongBinder();
250 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700251 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700252 Intent fillInIntent = null;
253 if (data.readInt() != 0) {
254 fillInIntent = Intent.CREATOR.createFromParcel(data);
255 }
256 String resolvedType = data.readString();
257 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700258 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700259 int requestCode = data.readInt();
260 int flagsMask = data.readInt();
261 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700262 Bundle options = data.readInt() != 0
263 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700264 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700265 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700266 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700267 reply.writeNoException();
268 reply.writeInt(result);
269 return true;
270 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700271
Dianne Hackborn91097de2014-04-04 18:02:06 -0700272 case START_VOICE_ACTIVITY_TRANSACTION:
273 {
274 data.enforceInterface(IActivityManager.descriptor);
275 String callingPackage = data.readString();
276 int callingPid = data.readInt();
277 int callingUid = data.readInt();
278 Intent intent = Intent.CREATOR.createFromParcel(data);
279 String resolvedType = data.readString();
280 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
281 data.readStrongBinder());
282 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
283 data.readStrongBinder());
284 int startFlags = data.readInt();
285 String profileFile = data.readString();
286 ParcelFileDescriptor profileFd = data.readInt() != 0
287 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
288 Bundle options = data.readInt() != 0
289 ? Bundle.CREATOR.createFromParcel(data) : null;
290 int userId = data.readInt();
291 int result = startVoiceActivity(callingPackage, callingPid, callingUid,
292 intent, resolvedType, session, interactor, startFlags,
293 profileFile, profileFd, options, userId);
294 reply.writeNoException();
295 reply.writeInt(result);
296 return true;
297 }
298
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800299 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
300 {
301 data.enforceInterface(IActivityManager.descriptor);
302 IBinder callingActivity = data.readStrongBinder();
303 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700304 Bundle options = data.readInt() != 0
305 ? Bundle.CREATOR.createFromParcel(data) : null;
306 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800307 reply.writeNoException();
308 reply.writeInt(result ? 1 : 0);
309 return true;
310 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700311
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700312 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
313 {
314 data.enforceInterface(IActivityManager.descriptor);
315 int taskId = data.readInt();
316 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
317 int result = startActivityFromRecents(taskId, options);
318 reply.writeNoException();
319 reply.writeInt(result);
320 return true;
321 }
322
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800323 case FINISH_ACTIVITY_TRANSACTION: {
324 data.enforceInterface(IActivityManager.descriptor);
325 IBinder token = data.readStrongBinder();
326 Intent resultData = null;
327 int resultCode = data.readInt();
328 if (data.readInt() != 0) {
329 resultData = Intent.CREATOR.createFromParcel(data);
330 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700331 boolean finishTask = (data.readInt() != 0);
332 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800333 reply.writeNoException();
334 reply.writeInt(res ? 1 : 0);
335 return true;
336 }
337
338 case FINISH_SUB_ACTIVITY_TRANSACTION: {
339 data.enforceInterface(IActivityManager.descriptor);
340 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700341 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800342 int requestCode = data.readInt();
343 finishSubActivity(token, resultWho, requestCode);
344 reply.writeNoException();
345 return true;
346 }
347
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700348 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
349 data.enforceInterface(IActivityManager.descriptor);
350 IBinder token = data.readStrongBinder();
351 boolean res = finishActivityAffinity(token);
352 reply.writeNoException();
353 reply.writeInt(res ? 1 : 0);
354 return true;
355 }
356
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700357 case FINISH_VOICE_TASK_TRANSACTION: {
358 data.enforceInterface(IActivityManager.descriptor);
359 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
360 data.readStrongBinder());
361 finishVoiceTask(session);
362 reply.writeNoException();
363 return true;
364 }
365
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800366 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
367 data.enforceInterface(IActivityManager.descriptor);
368 IBinder token = data.readStrongBinder();
369 boolean res = willActivityBeVisible(token);
370 reply.writeNoException();
371 reply.writeInt(res ? 1 : 0);
372 return true;
373 }
374
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800375 case REGISTER_RECEIVER_TRANSACTION:
376 {
377 data.enforceInterface(IActivityManager.descriptor);
378 IBinder b = data.readStrongBinder();
379 IApplicationThread app =
380 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700381 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800382 b = data.readStrongBinder();
383 IIntentReceiver rec
384 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
385 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
386 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700387 int userId = data.readInt();
388 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800389 reply.writeNoException();
390 if (intent != null) {
391 reply.writeInt(1);
392 intent.writeToParcel(reply, 0);
393 } else {
394 reply.writeInt(0);
395 }
396 return true;
397 }
398
399 case UNREGISTER_RECEIVER_TRANSACTION:
400 {
401 data.enforceInterface(IActivityManager.descriptor);
402 IBinder b = data.readStrongBinder();
403 if (b == null) {
404 return true;
405 }
406 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
407 unregisterReceiver(rec);
408 reply.writeNoException();
409 return true;
410 }
411
412 case BROADCAST_INTENT_TRANSACTION:
413 {
414 data.enforceInterface(IActivityManager.descriptor);
415 IBinder b = data.readStrongBinder();
416 IApplicationThread app =
417 b != null ? ApplicationThreadNative.asInterface(b) : null;
418 Intent intent = Intent.CREATOR.createFromParcel(data);
419 String resolvedType = data.readString();
420 b = data.readStrongBinder();
421 IIntentReceiver resultTo =
422 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
423 int resultCode = data.readInt();
424 String resultData = data.readString();
425 Bundle resultExtras = data.readBundle();
426 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800427 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800428 boolean serialized = data.readInt() != 0;
429 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700430 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800431 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800432 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700433 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800434 reply.writeNoException();
435 reply.writeInt(res);
436 return true;
437 }
438
439 case UNBROADCAST_INTENT_TRANSACTION:
440 {
441 data.enforceInterface(IActivityManager.descriptor);
442 IBinder b = data.readStrongBinder();
443 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
444 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700445 int userId = data.readInt();
446 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447 reply.writeNoException();
448 return true;
449 }
450
451 case FINISH_RECEIVER_TRANSACTION: {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder who = data.readStrongBinder();
454 int resultCode = data.readInt();
455 String resultData = data.readString();
456 Bundle resultExtras = data.readBundle();
457 boolean resultAbort = data.readInt() != 0;
458 if (who != null) {
459 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
460 }
461 reply.writeNoException();
462 return true;
463 }
464
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800465 case ATTACH_APPLICATION_TRANSACTION: {
466 data.enforceInterface(IActivityManager.descriptor);
467 IApplicationThread app = ApplicationThreadNative.asInterface(
468 data.readStrongBinder());
469 if (app != null) {
470 attachApplication(app);
471 }
472 reply.writeNoException();
473 return true;
474 }
475
476 case ACTIVITY_IDLE_TRANSACTION: {
477 data.enforceInterface(IActivityManager.descriptor);
478 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700479 Configuration config = null;
480 if (data.readInt() != 0) {
481 config = Configuration.CREATOR.createFromParcel(data);
482 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700483 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800484 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700485 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800486 }
487 reply.writeNoException();
488 return true;
489 }
490
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700491 case ACTIVITY_RESUMED_TRANSACTION: {
492 data.enforceInterface(IActivityManager.descriptor);
493 IBinder token = data.readStrongBinder();
494 activityResumed(token);
495 reply.writeNoException();
496 return true;
497 }
498
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 case ACTIVITY_PAUSED_TRANSACTION: {
500 data.enforceInterface(IActivityManager.descriptor);
501 IBinder token = data.readStrongBinder();
Craig Mautnera0026042014-04-23 11:45:37 -0700502 PersistableBundle persistentState = data.readPersistableBundle();
503 activityPaused(token, persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800504 reply.writeNoException();
505 return true;
506 }
507
508 case ACTIVITY_STOPPED_TRANSACTION: {
509 data.enforceInterface(IActivityManager.descriptor);
510 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800511 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700512 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800513 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700514 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800515 reply.writeNoException();
516 return true;
517 }
518
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800519 case ACTIVITY_SLEPT_TRANSACTION: {
520 data.enforceInterface(IActivityManager.descriptor);
521 IBinder token = data.readStrongBinder();
522 activitySlept(token);
523 reply.writeNoException();
524 return true;
525 }
526
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800527 case ACTIVITY_DESTROYED_TRANSACTION: {
528 data.enforceInterface(IActivityManager.descriptor);
529 IBinder token = data.readStrongBinder();
530 activityDestroyed(token);
531 reply.writeNoException();
532 return true;
533 }
534
535 case GET_CALLING_PACKAGE_TRANSACTION: {
536 data.enforceInterface(IActivityManager.descriptor);
537 IBinder token = data.readStrongBinder();
538 String res = token != null ? getCallingPackage(token) : null;
539 reply.writeNoException();
540 reply.writeString(res);
541 return true;
542 }
543
544 case GET_CALLING_ACTIVITY_TRANSACTION: {
545 data.enforceInterface(IActivityManager.descriptor);
546 IBinder token = data.readStrongBinder();
547 ComponentName cn = getCallingActivity(token);
548 reply.writeNoException();
549 ComponentName.writeToParcel(cn, reply);
550 return true;
551 }
552
Winson Chung1147c402014-05-14 11:05:00 -0700553 case GET_APP_TASKS_TRANSACTION: {
554 data.enforceInterface(IActivityManager.descriptor);
555 List<IAppTask> list = getAppTasks();
556 reply.writeNoException();
557 int N = list != null ? list.size() : -1;
558 reply.writeInt(N);
559 int i;
560 for (i=0; i<N; i++) {
561 IAppTask task = list.get(i);
562 reply.writeStrongBinder(task.asBinder());
563 }
564 return true;
565 }
566
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800567 case GET_TASKS_TRANSACTION: {
568 data.enforceInterface(IActivityManager.descriptor);
569 int maxNum = data.readInt();
570 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700571 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800572 reply.writeNoException();
573 int N = list != null ? list.size() : -1;
574 reply.writeInt(N);
575 int i;
576 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700577 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800578 info.writeToParcel(reply, 0);
579 }
580 return true;
581 }
582
583 case GET_RECENT_TASKS_TRANSACTION: {
584 data.enforceInterface(IActivityManager.descriptor);
585 int maxNum = data.readInt();
586 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700587 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800588 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700589 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800590 reply.writeNoException();
591 reply.writeTypedList(list);
592 return true;
593 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700594
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700595 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800596 data.enforceInterface(IActivityManager.descriptor);
597 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700598 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800599 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700600 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800601 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700602 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700603 } else {
604 reply.writeInt(0);
605 }
606 return true;
607 }
608
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800609 case GET_SERVICES_TRANSACTION: {
610 data.enforceInterface(IActivityManager.descriptor);
611 int maxNum = data.readInt();
612 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700613 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800614 reply.writeNoException();
615 int N = list != null ? list.size() : -1;
616 reply.writeInt(N);
617 int i;
618 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700619 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800620 info.writeToParcel(reply, 0);
621 }
622 return true;
623 }
624
625 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
626 data.enforceInterface(IActivityManager.descriptor);
627 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
628 reply.writeNoException();
629 reply.writeTypedList(list);
630 return true;
631 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700632
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800633 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
634 data.enforceInterface(IActivityManager.descriptor);
635 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
636 reply.writeNoException();
637 reply.writeTypedList(list);
638 return true;
639 }
640
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700641 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
642 data.enforceInterface(IActivityManager.descriptor);
643 List<ApplicationInfo> list = getRunningExternalApplications();
644 reply.writeNoException();
645 reply.writeTypedList(list);
646 return true;
647 }
648
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800649 case MOVE_TASK_TO_FRONT_TRANSACTION: {
650 data.enforceInterface(IActivityManager.descriptor);
651 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800652 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700653 Bundle options = data.readInt() != 0
654 ? Bundle.CREATOR.createFromParcel(data) : null;
655 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800656 reply.writeNoException();
657 return true;
658 }
659
660 case MOVE_TASK_TO_BACK_TRANSACTION: {
661 data.enforceInterface(IActivityManager.descriptor);
662 int task = data.readInt();
663 moveTaskToBack(task);
664 reply.writeNoException();
665 return true;
666 }
667
668 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
669 data.enforceInterface(IActivityManager.descriptor);
670 IBinder token = data.readStrongBinder();
671 boolean nonRoot = data.readInt() != 0;
672 boolean res = moveActivityTaskToBack(token, nonRoot);
673 reply.writeNoException();
674 reply.writeInt(res ? 1 : 0);
675 return true;
676 }
677
678 case MOVE_TASK_BACKWARDS_TRANSACTION: {
679 data.enforceInterface(IActivityManager.descriptor);
680 int task = data.readInt();
681 moveTaskBackwards(task);
682 reply.writeNoException();
683 return true;
684 }
685
Craig Mautnerc00204b2013-03-05 15:02:14 -0800686 case MOVE_TASK_TO_STACK_TRANSACTION: {
687 data.enforceInterface(IActivityManager.descriptor);
688 int taskId = data.readInt();
689 int stackId = data.readInt();
690 boolean toTop = data.readInt() != 0;
691 moveTaskToStack(taskId, stackId, toTop);
692 reply.writeNoException();
693 return true;
694 }
695
696 case RESIZE_STACK_TRANSACTION: {
697 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800698 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800699 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800700 Rect r = Rect.CREATOR.createFromParcel(data);
701 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800702 reply.writeNoException();
703 return true;
704 }
705
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800706 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700707 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800708 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700709 reply.writeNoException();
710 reply.writeTypedList(list);
711 return true;
712 }
713
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800714 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700715 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800716 int stackId = data.readInt();
717 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700718 reply.writeNoException();
719 if (info != null) {
720 reply.writeInt(1);
721 info.writeToParcel(reply, 0);
722 } else {
723 reply.writeInt(0);
724 }
725 return true;
726 }
727
Winson Chung303e1ff2014-03-07 15:06:19 -0800728 case IS_IN_HOME_STACK_TRANSACTION: {
729 data.enforceInterface(IActivityManager.descriptor);
730 int taskId = data.readInt();
731 boolean isInHomeStack = isInHomeStack(taskId);
732 reply.writeNoException();
733 reply.writeInt(isInHomeStack ? 1 : 0);
734 return true;
735 }
736
Craig Mautnercf910b02013-04-23 11:23:27 -0700737 case SET_FOCUSED_STACK_TRANSACTION: {
738 data.enforceInterface(IActivityManager.descriptor);
739 int stackId = data.readInt();
740 setFocusedStack(stackId);
741 reply.writeNoException();
742 return true;
743 }
744
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800745 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
746 data.enforceInterface(IActivityManager.descriptor);
747 IBinder token = data.readStrongBinder();
748 boolean onlyRoot = data.readInt() != 0;
749 int res = token != null
750 ? getTaskForActivity(token, onlyRoot) : -1;
751 reply.writeNoException();
752 reply.writeInt(res);
753 return true;
754 }
755
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800756 case GET_CONTENT_PROVIDER_TRANSACTION: {
757 data.enforceInterface(IActivityManager.descriptor);
758 IBinder b = data.readStrongBinder();
759 IApplicationThread app = ApplicationThreadNative.asInterface(b);
760 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700761 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700762 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700763 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800764 reply.writeNoException();
765 if (cph != null) {
766 reply.writeInt(1);
767 cph.writeToParcel(reply, 0);
768 } else {
769 reply.writeInt(0);
770 }
771 return true;
772 }
773
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800774 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
775 data.enforceInterface(IActivityManager.descriptor);
776 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700777 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800778 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700779 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800780 reply.writeNoException();
781 if (cph != null) {
782 reply.writeInt(1);
783 cph.writeToParcel(reply, 0);
784 } else {
785 reply.writeInt(0);
786 }
787 return true;
788 }
789
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800790 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
791 data.enforceInterface(IActivityManager.descriptor);
792 IBinder b = data.readStrongBinder();
793 IApplicationThread app = ApplicationThreadNative.asInterface(b);
794 ArrayList<ContentProviderHolder> providers =
795 data.createTypedArrayList(ContentProviderHolder.CREATOR);
796 publishContentProviders(app, providers);
797 reply.writeNoException();
798 return true;
799 }
800
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700801 case REF_CONTENT_PROVIDER_TRANSACTION: {
802 data.enforceInterface(IActivityManager.descriptor);
803 IBinder b = data.readStrongBinder();
804 int stable = data.readInt();
805 int unstable = data.readInt();
806 boolean res = refContentProvider(b, stable, unstable);
807 reply.writeNoException();
808 reply.writeInt(res ? 1 : 0);
809 return true;
810 }
811
812 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
813 data.enforceInterface(IActivityManager.descriptor);
814 IBinder b = data.readStrongBinder();
815 unstableProviderDied(b);
816 reply.writeNoException();
817 return true;
818 }
819
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700820 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
821 data.enforceInterface(IActivityManager.descriptor);
822 IBinder b = data.readStrongBinder();
823 appNotRespondingViaProvider(b);
824 reply.writeNoException();
825 return true;
826 }
827
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800828 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
829 data.enforceInterface(IActivityManager.descriptor);
830 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700831 boolean stable = data.readInt() != 0;
832 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800833 reply.writeNoException();
834 return true;
835 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800836
837 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
838 data.enforceInterface(IActivityManager.descriptor);
839 String name = data.readString();
840 IBinder token = data.readStrongBinder();
841 removeContentProviderExternal(name, token);
842 reply.writeNoException();
843 return true;
844 }
845
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700846 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
847 data.enforceInterface(IActivityManager.descriptor);
848 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
849 PendingIntent pi = getRunningServiceControlPanel(comp);
850 reply.writeNoException();
851 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
852 return true;
853 }
854
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800855 case START_SERVICE_TRANSACTION: {
856 data.enforceInterface(IActivityManager.descriptor);
857 IBinder b = data.readStrongBinder();
858 IApplicationThread app = ApplicationThreadNative.asInterface(b);
859 Intent service = Intent.CREATOR.createFromParcel(data);
860 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700861 int userId = data.readInt();
862 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800863 reply.writeNoException();
864 ComponentName.writeToParcel(cn, reply);
865 return true;
866 }
867
868 case STOP_SERVICE_TRANSACTION: {
869 data.enforceInterface(IActivityManager.descriptor);
870 IBinder b = data.readStrongBinder();
871 IApplicationThread app = ApplicationThreadNative.asInterface(b);
872 Intent service = Intent.CREATOR.createFromParcel(data);
873 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700874 int userId = data.readInt();
875 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800876 reply.writeNoException();
877 reply.writeInt(res);
878 return true;
879 }
880
881 case STOP_SERVICE_TOKEN_TRANSACTION: {
882 data.enforceInterface(IActivityManager.descriptor);
883 ComponentName className = ComponentName.readFromParcel(data);
884 IBinder token = data.readStrongBinder();
885 int startId = data.readInt();
886 boolean res = stopServiceToken(className, token, startId);
887 reply.writeNoException();
888 reply.writeInt(res ? 1 : 0);
889 return true;
890 }
891
892 case SET_SERVICE_FOREGROUND_TRANSACTION: {
893 data.enforceInterface(IActivityManager.descriptor);
894 ComponentName className = ComponentName.readFromParcel(data);
895 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700896 int id = data.readInt();
897 Notification notification = null;
898 if (data.readInt() != 0) {
899 notification = Notification.CREATOR.createFromParcel(data);
900 }
901 boolean removeNotification = data.readInt() != 0;
902 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800903 reply.writeNoException();
904 return true;
905 }
906
907 case BIND_SERVICE_TRANSACTION: {
908 data.enforceInterface(IActivityManager.descriptor);
909 IBinder b = data.readStrongBinder();
910 IApplicationThread app = ApplicationThreadNative.asInterface(b);
911 IBinder token = data.readStrongBinder();
912 Intent service = Intent.CREATOR.createFromParcel(data);
913 String resolvedType = data.readString();
914 b = data.readStrongBinder();
915 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800916 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800918 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800919 reply.writeNoException();
920 reply.writeInt(res);
921 return true;
922 }
923
924 case UNBIND_SERVICE_TRANSACTION: {
925 data.enforceInterface(IActivityManager.descriptor);
926 IBinder b = data.readStrongBinder();
927 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
928 boolean res = unbindService(conn);
929 reply.writeNoException();
930 reply.writeInt(res ? 1 : 0);
931 return true;
932 }
933
934 case PUBLISH_SERVICE_TRANSACTION: {
935 data.enforceInterface(IActivityManager.descriptor);
936 IBinder token = data.readStrongBinder();
937 Intent intent = Intent.CREATOR.createFromParcel(data);
938 IBinder service = data.readStrongBinder();
939 publishService(token, intent, service);
940 reply.writeNoException();
941 return true;
942 }
943
944 case UNBIND_FINISHED_TRANSACTION: {
945 data.enforceInterface(IActivityManager.descriptor);
946 IBinder token = data.readStrongBinder();
947 Intent intent = Intent.CREATOR.createFromParcel(data);
948 boolean doRebind = data.readInt() != 0;
949 unbindFinished(token, intent, doRebind);
950 reply.writeNoException();
951 return true;
952 }
953
954 case SERVICE_DONE_EXECUTING_TRANSACTION: {
955 data.enforceInterface(IActivityManager.descriptor);
956 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700957 int type = data.readInt();
958 int startId = data.readInt();
959 int res = data.readInt();
960 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800961 reply.writeNoException();
962 return true;
963 }
964
965 case START_INSTRUMENTATION_TRANSACTION: {
966 data.enforceInterface(IActivityManager.descriptor);
967 ComponentName className = ComponentName.readFromParcel(data);
968 String profileFile = data.readString();
969 int fl = data.readInt();
970 Bundle arguments = data.readBundle();
971 IBinder b = data.readStrongBinder();
972 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800973 b = data.readStrongBinder();
974 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700975 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +0100976 String abiOverride = data.readString();
977 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
978 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800979 reply.writeNoException();
980 reply.writeInt(res ? 1 : 0);
981 return true;
982 }
983
984
985 case FINISH_INSTRUMENTATION_TRANSACTION: {
986 data.enforceInterface(IActivityManager.descriptor);
987 IBinder b = data.readStrongBinder();
988 IApplicationThread app = ApplicationThreadNative.asInterface(b);
989 int resultCode = data.readInt();
990 Bundle results = data.readBundle();
991 finishInstrumentation(app, resultCode, results);
992 reply.writeNoException();
993 return true;
994 }
995
996 case GET_CONFIGURATION_TRANSACTION: {
997 data.enforceInterface(IActivityManager.descriptor);
998 Configuration config = getConfiguration();
999 reply.writeNoException();
1000 config.writeToParcel(reply, 0);
1001 return true;
1002 }
1003
1004 case UPDATE_CONFIGURATION_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 Configuration config = Configuration.CREATOR.createFromParcel(data);
1007 updateConfiguration(config);
1008 reply.writeNoException();
1009 return true;
1010 }
1011
1012 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1013 data.enforceInterface(IActivityManager.descriptor);
1014 IBinder token = data.readStrongBinder();
1015 int requestedOrientation = data.readInt();
1016 setRequestedOrientation(token, requestedOrientation);
1017 reply.writeNoException();
1018 return true;
1019 }
1020
1021 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1022 data.enforceInterface(IActivityManager.descriptor);
1023 IBinder token = data.readStrongBinder();
1024 int req = getRequestedOrientation(token);
1025 reply.writeNoException();
1026 reply.writeInt(req);
1027 return true;
1028 }
1029
1030 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1031 data.enforceInterface(IActivityManager.descriptor);
1032 IBinder token = data.readStrongBinder();
1033 ComponentName cn = getActivityClassForToken(token);
1034 reply.writeNoException();
1035 ComponentName.writeToParcel(cn, reply);
1036 return true;
1037 }
1038
1039 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1040 data.enforceInterface(IActivityManager.descriptor);
1041 IBinder token = data.readStrongBinder();
1042 reply.writeNoException();
1043 reply.writeString(getPackageForToken(token));
1044 return true;
1045 }
1046
1047 case GET_INTENT_SENDER_TRANSACTION: {
1048 data.enforceInterface(IActivityManager.descriptor);
1049 int type = data.readInt();
1050 String packageName = data.readString();
1051 IBinder token = data.readStrongBinder();
1052 String resultWho = data.readString();
1053 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001054 Intent[] requestIntents;
1055 String[] requestResolvedTypes;
1056 if (data.readInt() != 0) {
1057 requestIntents = data.createTypedArray(Intent.CREATOR);
1058 requestResolvedTypes = data.createStringArray();
1059 } else {
1060 requestIntents = null;
1061 requestResolvedTypes = null;
1062 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001063 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001064 Bundle options = data.readInt() != 0
1065 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001066 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001067 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001068 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001069 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001070 reply.writeNoException();
1071 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1072 return true;
1073 }
1074
1075 case CANCEL_INTENT_SENDER_TRANSACTION: {
1076 data.enforceInterface(IActivityManager.descriptor);
1077 IIntentSender r = IIntentSender.Stub.asInterface(
1078 data.readStrongBinder());
1079 cancelIntentSender(r);
1080 reply.writeNoException();
1081 return true;
1082 }
1083
1084 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1085 data.enforceInterface(IActivityManager.descriptor);
1086 IIntentSender r = IIntentSender.Stub.asInterface(
1087 data.readStrongBinder());
1088 String res = getPackageForIntentSender(r);
1089 reply.writeNoException();
1090 reply.writeString(res);
1091 return true;
1092 }
1093
Christopher Tatec4a07d12012-04-06 14:19:13 -07001094 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1095 data.enforceInterface(IActivityManager.descriptor);
1096 IIntentSender r = IIntentSender.Stub.asInterface(
1097 data.readStrongBinder());
1098 int res = getUidForIntentSender(r);
1099 reply.writeNoException();
1100 reply.writeInt(res);
1101 return true;
1102 }
1103
Dianne Hackborn41203752012-08-31 14:05:51 -07001104 case HANDLE_INCOMING_USER_TRANSACTION: {
1105 data.enforceInterface(IActivityManager.descriptor);
1106 int callingPid = data.readInt();
1107 int callingUid = data.readInt();
1108 int userId = data.readInt();
1109 boolean allowAll = data.readInt() != 0 ;
1110 boolean requireFull = data.readInt() != 0;
1111 String name = data.readString();
1112 String callerPackage = data.readString();
1113 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1114 requireFull, name, callerPackage);
1115 reply.writeNoException();
1116 reply.writeInt(res);
1117 return true;
1118 }
1119
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001120 case SET_PROCESS_LIMIT_TRANSACTION: {
1121 data.enforceInterface(IActivityManager.descriptor);
1122 int max = data.readInt();
1123 setProcessLimit(max);
1124 reply.writeNoException();
1125 return true;
1126 }
1127
1128 case GET_PROCESS_LIMIT_TRANSACTION: {
1129 data.enforceInterface(IActivityManager.descriptor);
1130 int limit = getProcessLimit();
1131 reply.writeNoException();
1132 reply.writeInt(limit);
1133 return true;
1134 }
1135
1136 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1137 data.enforceInterface(IActivityManager.descriptor);
1138 IBinder token = data.readStrongBinder();
1139 int pid = data.readInt();
1140 boolean isForeground = data.readInt() != 0;
1141 setProcessForeground(token, pid, isForeground);
1142 reply.writeNoException();
1143 return true;
1144 }
1145
1146 case CHECK_PERMISSION_TRANSACTION: {
1147 data.enforceInterface(IActivityManager.descriptor);
1148 String perm = data.readString();
1149 int pid = data.readInt();
1150 int uid = data.readInt();
1151 int res = checkPermission(perm, pid, uid);
1152 reply.writeNoException();
1153 reply.writeInt(res);
1154 return true;
1155 }
1156
1157 case CHECK_URI_PERMISSION_TRANSACTION: {
1158 data.enforceInterface(IActivityManager.descriptor);
1159 Uri uri = Uri.CREATOR.createFromParcel(data);
1160 int pid = data.readInt();
1161 int uid = data.readInt();
1162 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001163 int userId = data.readInt();
1164 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001165 reply.writeNoException();
1166 reply.writeInt(res);
1167 return true;
1168 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001169
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001170 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001171 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001172 String packageName = data.readString();
1173 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1174 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001175 int userId = data.readInt();
1176 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001177 reply.writeNoException();
1178 reply.writeInt(res ? 1 : 0);
1179 return true;
1180 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001181
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001182 case GRANT_URI_PERMISSION_TRANSACTION: {
1183 data.enforceInterface(IActivityManager.descriptor);
1184 IBinder b = data.readStrongBinder();
1185 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1186 String targetPkg = data.readString();
1187 Uri uri = Uri.CREATOR.createFromParcel(data);
1188 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001189 int userId = data.readInt();
1190 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001191 reply.writeNoException();
1192 return true;
1193 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001194
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001195 case REVOKE_URI_PERMISSION_TRANSACTION: {
1196 data.enforceInterface(IActivityManager.descriptor);
1197 IBinder b = data.readStrongBinder();
1198 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1199 Uri uri = Uri.CREATOR.createFromParcel(data);
1200 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001201 int userId = data.readInt();
1202 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001203 reply.writeNoException();
1204 return true;
1205 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001206
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001207 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1208 data.enforceInterface(IActivityManager.descriptor);
1209 Uri uri = Uri.CREATOR.createFromParcel(data);
1210 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001211 int userId = data.readInt();
1212 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001213 reply.writeNoException();
1214 return true;
1215 }
1216
1217 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1218 data.enforceInterface(IActivityManager.descriptor);
1219 Uri uri = Uri.CREATOR.createFromParcel(data);
1220 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001221 int userId = data.readInt();
1222 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001223 reply.writeNoException();
1224 return true;
1225 }
1226
1227 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1228 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001229 final String packageName = data.readString();
1230 final boolean incoming = data.readInt() != 0;
1231 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1232 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001233 reply.writeNoException();
1234 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1235 return true;
1236 }
1237
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001238 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1239 data.enforceInterface(IActivityManager.descriptor);
1240 IBinder b = data.readStrongBinder();
1241 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1242 boolean waiting = data.readInt() != 0;
1243 showWaitingForDebugger(app, waiting);
1244 reply.writeNoException();
1245 return true;
1246 }
1247
1248 case GET_MEMORY_INFO_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1251 getMemoryInfo(mi);
1252 reply.writeNoException();
1253 mi.writeToParcel(reply, 0);
1254 return true;
1255 }
1256
1257 case UNHANDLED_BACK_TRANSACTION: {
1258 data.enforceInterface(IActivityManager.descriptor);
1259 unhandledBack();
1260 reply.writeNoException();
1261 return true;
1262 }
1263
1264 case OPEN_CONTENT_URI_TRANSACTION: {
1265 data.enforceInterface(IActivityManager.descriptor);
1266 Uri uri = Uri.parse(data.readString());
1267 ParcelFileDescriptor pfd = openContentUri(uri);
1268 reply.writeNoException();
1269 if (pfd != null) {
1270 reply.writeInt(1);
1271 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1272 } else {
1273 reply.writeInt(0);
1274 }
1275 return true;
1276 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001277
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001278 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1279 data.enforceInterface(IActivityManager.descriptor);
1280 setLockScreenShown(data.readInt() != 0);
1281 reply.writeNoException();
1282 return true;
1283 }
1284
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001285 case SET_DEBUG_APP_TRANSACTION: {
1286 data.enforceInterface(IActivityManager.descriptor);
1287 String pn = data.readString();
1288 boolean wfd = data.readInt() != 0;
1289 boolean per = data.readInt() != 0;
1290 setDebugApp(pn, wfd, per);
1291 reply.writeNoException();
1292 return true;
1293 }
1294
1295 case SET_ALWAYS_FINISH_TRANSACTION: {
1296 data.enforceInterface(IActivityManager.descriptor);
1297 boolean enabled = data.readInt() != 0;
1298 setAlwaysFinish(enabled);
1299 reply.writeNoException();
1300 return true;
1301 }
1302
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001303 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001304 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001305 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001306 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001307 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001308 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001309 return true;
1310 }
1311
1312 case ENTER_SAFE_MODE_TRANSACTION: {
1313 data.enforceInterface(IActivityManager.descriptor);
1314 enterSafeMode();
1315 reply.writeNoException();
1316 return true;
1317 }
1318
1319 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1320 data.enforceInterface(IActivityManager.descriptor);
1321 IIntentSender is = IIntentSender.Stub.asInterface(
1322 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001323 int sourceUid = data.readInt();
1324 String sourcePkg = data.readString();
1325 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001326 reply.writeNoException();
1327 return true;
1328 }
1329
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001330 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001331 data.enforceInterface(IActivityManager.descriptor);
1332 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001333 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001334 boolean secure = data.readInt() != 0;
1335 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001336 reply.writeNoException();
1337 reply.writeInt(res ? 1 : 0);
1338 return true;
1339 }
1340
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001341 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1342 data.enforceInterface(IActivityManager.descriptor);
1343 String reason = data.readString();
1344 boolean res = killProcessesBelowForeground(reason);
1345 reply.writeNoException();
1346 reply.writeInt(res ? 1 : 0);
1347 return true;
1348 }
1349
Dan Egnor60d87622009-12-16 16:32:58 -08001350 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1351 data.enforceInterface(IActivityManager.descriptor);
1352 IBinder app = data.readStrongBinder();
1353 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1354 handleApplicationCrash(app, ci);
1355 reply.writeNoException();
1356 return true;
1357 }
1358
1359 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001360 data.enforceInterface(IActivityManager.descriptor);
1361 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001362 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001363 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001364 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001365 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001366 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001367 return true;
1368 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001369
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001370 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1371 data.enforceInterface(IActivityManager.descriptor);
1372 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001373 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001374 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1375 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001376 reply.writeNoException();
1377 return true;
1378 }
1379
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001380 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1381 data.enforceInterface(IActivityManager.descriptor);
1382 int sig = data.readInt();
1383 signalPersistentProcesses(sig);
1384 reply.writeNoException();
1385 return true;
1386 }
1387
Dianne Hackborn03abb812010-01-04 18:43:19 -08001388 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1389 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001390 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001391 int userId = data.readInt();
1392 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001393 reply.writeNoException();
1394 return true;
1395 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001396
1397 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1398 data.enforceInterface(IActivityManager.descriptor);
1399 killAllBackgroundProcesses();
1400 reply.writeNoException();
1401 return true;
1402 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001403
Dianne Hackborn03abb812010-01-04 18:43:19 -08001404 case FORCE_STOP_PACKAGE_TRANSACTION: {
1405 data.enforceInterface(IActivityManager.descriptor);
1406 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001407 int userId = data.readInt();
1408 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001409 reply.writeNoException();
1410 return true;
1411 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001412
1413 case GET_MY_MEMORY_STATE_TRANSACTION: {
1414 data.enforceInterface(IActivityManager.descriptor);
1415 ActivityManager.RunningAppProcessInfo info =
1416 new ActivityManager.RunningAppProcessInfo();
1417 getMyMemoryState(info);
1418 reply.writeNoException();
1419 info.writeToParcel(reply, 0);
1420 return true;
1421 }
1422
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001423 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1424 data.enforceInterface(IActivityManager.descriptor);
1425 ConfigurationInfo config = getDeviceConfigurationInfo();
1426 reply.writeNoException();
1427 config.writeToParcel(reply, 0);
1428 return true;
1429 }
1430
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001431 case PROFILE_CONTROL_TRANSACTION: {
1432 data.enforceInterface(IActivityManager.descriptor);
1433 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001434 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001435 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001436 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001437 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001438 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001439 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001440 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001441 reply.writeNoException();
1442 reply.writeInt(res ? 1 : 0);
1443 return true;
1444 }
1445
Dianne Hackborn55280a92009-05-07 15:53:46 -07001446 case SHUTDOWN_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
1448 boolean res = shutdown(data.readInt());
1449 reply.writeNoException();
1450 reply.writeInt(res ? 1 : 0);
1451 return true;
1452 }
1453
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001454 case STOP_APP_SWITCHES_TRANSACTION: {
1455 data.enforceInterface(IActivityManager.descriptor);
1456 stopAppSwitches();
1457 reply.writeNoException();
1458 return true;
1459 }
1460
1461 case RESUME_APP_SWITCHES_TRANSACTION: {
1462 data.enforceInterface(IActivityManager.descriptor);
1463 resumeAppSwitches();
1464 reply.writeNoException();
1465 return true;
1466 }
1467
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001468 case PEEK_SERVICE_TRANSACTION: {
1469 data.enforceInterface(IActivityManager.descriptor);
1470 Intent service = Intent.CREATOR.createFromParcel(data);
1471 String resolvedType = data.readString();
1472 IBinder binder = peekService(service, resolvedType);
1473 reply.writeNoException();
1474 reply.writeStrongBinder(binder);
1475 return true;
1476 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001477
1478 case START_BACKUP_AGENT_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1481 int backupRestoreMode = data.readInt();
1482 boolean success = bindBackupAgent(info, backupRestoreMode);
1483 reply.writeNoException();
1484 reply.writeInt(success ? 1 : 0);
1485 return true;
1486 }
1487
1488 case BACKUP_AGENT_CREATED_TRANSACTION: {
1489 data.enforceInterface(IActivityManager.descriptor);
1490 String packageName = data.readString();
1491 IBinder agent = data.readStrongBinder();
1492 backupAgentCreated(packageName, agent);
1493 reply.writeNoException();
1494 return true;
1495 }
1496
1497 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1498 data.enforceInterface(IActivityManager.descriptor);
1499 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1500 unbindBackupAgent(info);
1501 reply.writeNoException();
1502 return true;
1503 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001504
1505 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1506 data.enforceInterface(IActivityManager.descriptor);
1507 String packageName = data.readString();
1508 addPackageDependency(packageName);
1509 reply.writeNoException();
1510 return true;
1511 }
1512
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001513 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001514 data.enforceInterface(IActivityManager.descriptor);
1515 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001516 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001517 String reason = data.readString();
1518 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001519 reply.writeNoException();
1520 return true;
1521 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001522
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001523 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1524 data.enforceInterface(IActivityManager.descriptor);
1525 String reason = data.readString();
1526 closeSystemDialogs(reason);
1527 reply.writeNoException();
1528 return true;
1529 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001530
1531 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1532 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001533 int[] pids = data.createIntArray();
1534 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001535 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001536 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001537 return true;
1538 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001539
1540 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1541 data.enforceInterface(IActivityManager.descriptor);
1542 String processName = data.readString();
1543 int uid = data.readInt();
1544 killApplicationProcess(processName, uid);
1545 reply.writeNoException();
1546 return true;
1547 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001548
1549 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1550 data.enforceInterface(IActivityManager.descriptor);
1551 IBinder token = data.readStrongBinder();
1552 String packageName = data.readString();
1553 int enterAnim = data.readInt();
1554 int exitAnim = data.readInt();
1555 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001556 reply.writeNoException();
1557 return true;
1558 }
1559
1560 case IS_USER_A_MONKEY_TRANSACTION: {
1561 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001562 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001563 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001564 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001565 return true;
1566 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001567
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001568 case SET_USER_IS_MONKEY_TRANSACTION: {
1569 data.enforceInterface(IActivityManager.descriptor);
1570 final boolean monkey = (data.readInt() == 1);
1571 setUserIsMonkey(monkey);
1572 reply.writeNoException();
1573 return true;
1574 }
1575
Dianne Hackborn860755f2010-06-03 18:47:52 -07001576 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1577 data.enforceInterface(IActivityManager.descriptor);
1578 finishHeavyWeightApp();
1579 reply.writeNoException();
1580 return true;
1581 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001582
1583 case IS_IMMERSIVE_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001586 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001587 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001588 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001589 return true;
1590 }
1591
Craig Mautnerd61dc202014-07-07 11:09:11 -07001592 case IS_TOP_OF_TASK_TRANSACTION: {
1593 data.enforceInterface(IActivityManager.descriptor);
1594 IBinder token = data.readStrongBinder();
1595 final boolean isTopOfTask = isTopOfTask(token);
1596 reply.writeNoException();
1597 reply.writeInt(isTopOfTask ? 1 : 0);
1598 return true;
1599 }
1600
Craig Mautner5eda9b32013-07-02 11:58:16 -07001601 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001602 data.enforceInterface(IActivityManager.descriptor);
1603 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001604 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001605 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001606 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001607 return true;
1608 }
1609
1610 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1611 data.enforceInterface(IActivityManager.descriptor);
1612 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001613 final Bundle bundle;
1614 if (data.readInt() == 0) {
1615 bundle = null;
1616 } else {
1617 bundle = data.readBundle();
1618 }
1619 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1620 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001621 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001622 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001623 return true;
1624 }
1625
Craig Mautner233ceee2014-05-09 17:05:11 -07001626 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1627 data.enforceInterface(IActivityManager.descriptor);
1628 IBinder token = data.readStrongBinder();
1629 final ActivityOptions options = getActivityOptions(token);
1630 reply.writeNoException();
1631 reply.writeBundle(options == null ? null : options.toBundle());
1632 return true;
1633 }
1634
Daniel Sandler69a48172010-06-23 16:29:36 -04001635 case SET_IMMERSIVE_TRANSACTION: {
1636 data.enforceInterface(IActivityManager.descriptor);
1637 IBinder token = data.readStrongBinder();
1638 boolean imm = data.readInt() == 1;
1639 setImmersive(token, imm);
1640 reply.writeNoException();
1641 return true;
1642 }
1643
1644 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1645 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001646 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001647 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001648 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001649 return true;
1650 }
1651
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001652 case CRASH_APPLICATION_TRANSACTION: {
1653 data.enforceInterface(IActivityManager.descriptor);
1654 int uid = data.readInt();
1655 int initialPid = data.readInt();
1656 String packageName = data.readString();
1657 String message = data.readString();
1658 crashApplication(uid, initialPid, packageName, message);
1659 reply.writeNoException();
1660 return true;
1661 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001662
1663 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1664 data.enforceInterface(IActivityManager.descriptor);
1665 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001666 int userId = data.readInt();
1667 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001668 reply.writeNoException();
1669 reply.writeString(type);
1670 return true;
1671 }
1672
Dianne Hackborn7e269642010-08-25 19:50:20 -07001673 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1674 data.enforceInterface(IActivityManager.descriptor);
1675 String name = data.readString();
1676 IBinder perm = newUriPermissionOwner(name);
1677 reply.writeNoException();
1678 reply.writeStrongBinder(perm);
1679 return true;
1680 }
1681
1682 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1683 data.enforceInterface(IActivityManager.descriptor);
1684 IBinder owner = data.readStrongBinder();
1685 int fromUid = data.readInt();
1686 String targetPkg = data.readString();
1687 Uri uri = Uri.CREATOR.createFromParcel(data);
1688 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001689 int sourceUserId = data.readInt();
1690 int targetUserId = data.readInt();
1691 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1692 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001693 reply.writeNoException();
1694 return true;
1695 }
1696
1697 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1698 data.enforceInterface(IActivityManager.descriptor);
1699 IBinder owner = data.readStrongBinder();
1700 Uri uri = null;
1701 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001702 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001703 }
1704 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001705 int userId = data.readInt();
1706 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001707 reply.writeNoException();
1708 return true;
1709 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001710
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001711 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1712 data.enforceInterface(IActivityManager.descriptor);
1713 int callingUid = data.readInt();
1714 String targetPkg = data.readString();
1715 Uri uri = Uri.CREATOR.createFromParcel(data);
1716 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001717 int userId = data.readInt();
1718 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001719 reply.writeNoException();
1720 reply.writeInt(res);
1721 return true;
1722 }
1723
Andy McFadden824c5102010-07-09 16:26:57 -07001724 case DUMP_HEAP_TRANSACTION: {
1725 data.enforceInterface(IActivityManager.descriptor);
1726 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001727 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001728 boolean managed = data.readInt() != 0;
1729 String path = data.readString();
1730 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001731 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001732 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001733 reply.writeNoException();
1734 reply.writeInt(res ? 1 : 0);
1735 return true;
1736 }
1737
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001738 case START_ACTIVITIES_TRANSACTION:
1739 {
1740 data.enforceInterface(IActivityManager.descriptor);
1741 IBinder b = data.readStrongBinder();
1742 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001743 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001744 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1745 String[] resolvedTypes = data.createStringArray();
1746 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001747 Bundle options = data.readInt() != 0
1748 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001749 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001750 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001751 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001752 reply.writeNoException();
1753 reply.writeInt(result);
1754 return true;
1755 }
1756
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001757 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1758 {
1759 data.enforceInterface(IActivityManager.descriptor);
1760 int mode = getFrontActivityScreenCompatMode();
1761 reply.writeNoException();
1762 reply.writeInt(mode);
1763 return true;
1764 }
1765
1766 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1767 {
1768 data.enforceInterface(IActivityManager.descriptor);
1769 int mode = data.readInt();
1770 setFrontActivityScreenCompatMode(mode);
1771 reply.writeNoException();
1772 reply.writeInt(mode);
1773 return true;
1774 }
1775
1776 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1777 {
1778 data.enforceInterface(IActivityManager.descriptor);
1779 String pkg = data.readString();
1780 int mode = getPackageScreenCompatMode(pkg);
1781 reply.writeNoException();
1782 reply.writeInt(mode);
1783 return true;
1784 }
1785
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001786 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1787 {
1788 data.enforceInterface(IActivityManager.descriptor);
1789 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001790 int mode = data.readInt();
1791 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001792 reply.writeNoException();
1793 return true;
1794 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001795
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001796 case SWITCH_USER_TRANSACTION: {
1797 data.enforceInterface(IActivityManager.descriptor);
1798 int userid = data.readInt();
1799 boolean result = switchUser(userid);
1800 reply.writeNoException();
1801 reply.writeInt(result ? 1 : 0);
1802 return true;
1803 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001804
Kenny Guy08488bf2014-02-21 17:40:37 +00001805 case START_USER_IN_BACKGROUND_TRANSACTION: {
1806 data.enforceInterface(IActivityManager.descriptor);
1807 int userid = data.readInt();
1808 boolean result = startUserInBackground(userid);
1809 reply.writeNoException();
1810 reply.writeInt(result ? 1 : 0);
1811 return true;
1812 }
1813
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001814 case STOP_USER_TRANSACTION: {
1815 data.enforceInterface(IActivityManager.descriptor);
1816 int userid = data.readInt();
1817 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1818 data.readStrongBinder());
1819 int result = stopUser(userid, callback);
1820 reply.writeNoException();
1821 reply.writeInt(result);
1822 return true;
1823 }
1824
Amith Yamasani52f1d752012-03-28 18:19:29 -07001825 case GET_CURRENT_USER_TRANSACTION: {
1826 data.enforceInterface(IActivityManager.descriptor);
1827 UserInfo userInfo = getCurrentUser();
1828 reply.writeNoException();
1829 userInfo.writeToParcel(reply, 0);
1830 return true;
1831 }
1832
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001833 case IS_USER_RUNNING_TRANSACTION: {
1834 data.enforceInterface(IActivityManager.descriptor);
1835 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001836 boolean orStopping = data.readInt() != 0;
1837 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001838 reply.writeNoException();
1839 reply.writeInt(result ? 1 : 0);
1840 return true;
1841 }
1842
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001843 case GET_RUNNING_USER_IDS_TRANSACTION: {
1844 data.enforceInterface(IActivityManager.descriptor);
1845 int[] result = getRunningUserIds();
1846 reply.writeNoException();
1847 reply.writeIntArray(result);
1848 return true;
1849 }
1850
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001851 case REMOVE_TASK_TRANSACTION:
1852 {
1853 data.enforceInterface(IActivityManager.descriptor);
1854 int taskId = data.readInt();
1855 int fl = data.readInt();
1856 boolean result = removeTask(taskId, fl);
1857 reply.writeNoException();
1858 reply.writeInt(result ? 1 : 0);
1859 return true;
1860 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001861
Jeff Sharkeya4620792011-05-20 15:29:23 -07001862 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1863 data.enforceInterface(IActivityManager.descriptor);
1864 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1865 data.readStrongBinder());
1866 registerProcessObserver(observer);
1867 return true;
1868 }
1869
1870 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1871 data.enforceInterface(IActivityManager.descriptor);
1872 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1873 data.readStrongBinder());
1874 unregisterProcessObserver(observer);
1875 return true;
1876 }
1877
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001878 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1879 {
1880 data.enforceInterface(IActivityManager.descriptor);
1881 String pkg = data.readString();
1882 boolean ask = getPackageAskScreenCompat(pkg);
1883 reply.writeNoException();
1884 reply.writeInt(ask ? 1 : 0);
1885 return true;
1886 }
1887
1888 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1889 {
1890 data.enforceInterface(IActivityManager.descriptor);
1891 String pkg = data.readString();
1892 boolean ask = data.readInt() != 0;
1893 setPackageAskScreenCompat(pkg, ask);
1894 reply.writeNoException();
1895 return true;
1896 }
1897
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001898 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1899 data.enforceInterface(IActivityManager.descriptor);
1900 IIntentSender r = IIntentSender.Stub.asInterface(
1901 data.readStrongBinder());
1902 boolean res = isIntentSenderTargetedToPackage(r);
1903 reply.writeNoException();
1904 reply.writeInt(res ? 1 : 0);
1905 return true;
1906 }
1907
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001908 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1909 data.enforceInterface(IActivityManager.descriptor);
1910 IIntentSender r = IIntentSender.Stub.asInterface(
1911 data.readStrongBinder());
1912 boolean res = isIntentSenderAnActivity(r);
1913 reply.writeNoException();
1914 reply.writeInt(res ? 1 : 0);
1915 return true;
1916 }
1917
Dianne Hackborn81038902012-11-26 17:04:09 -08001918 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1919 data.enforceInterface(IActivityManager.descriptor);
1920 IIntentSender r = IIntentSender.Stub.asInterface(
1921 data.readStrongBinder());
1922 Intent intent = getIntentForIntentSender(r);
1923 reply.writeNoException();
1924 if (intent != null) {
1925 reply.writeInt(1);
1926 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1927 } else {
1928 reply.writeInt(0);
1929 }
1930 return true;
1931 }
1932
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001933 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1934 data.enforceInterface(IActivityManager.descriptor);
1935 IIntentSender r = IIntentSender.Stub.asInterface(
1936 data.readStrongBinder());
1937 String prefix = data.readString();
1938 String tag = getTagForIntentSender(r, prefix);
1939 reply.writeNoException();
1940 reply.writeString(tag);
1941 return true;
1942 }
1943
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001944 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1945 data.enforceInterface(IActivityManager.descriptor);
1946 Configuration config = Configuration.CREATOR.createFromParcel(data);
1947 updatePersistentConfiguration(config);
1948 reply.writeNoException();
1949 return true;
1950 }
1951
Dianne Hackbornb437e092011-08-05 17:50:29 -07001952 case GET_PROCESS_PSS_TRANSACTION: {
1953 data.enforceInterface(IActivityManager.descriptor);
1954 int[] pids = data.createIntArray();
1955 long[] pss = getProcessPss(pids);
1956 reply.writeNoException();
1957 reply.writeLongArray(pss);
1958 return true;
1959 }
1960
Dianne Hackborn661cd522011-08-22 00:26:20 -07001961 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1962 data.enforceInterface(IActivityManager.descriptor);
1963 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1964 boolean always = data.readInt() != 0;
1965 showBootMessage(msg, always);
1966 reply.writeNoException();
1967 return true;
1968 }
1969
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02001970 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001971 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02001972 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001973 reply.writeNoException();
1974 return true;
1975 }
1976
Adam Powelldd8fab22012-03-22 17:47:27 -07001977 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1978 data.enforceInterface(IActivityManager.descriptor);
1979 IBinder token = data.readStrongBinder();
1980 String destAffinity = data.readString();
1981 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1982 reply.writeNoException();
1983 reply.writeInt(res ? 1 : 0);
1984 return true;
1985 }
1986
1987 case NAVIGATE_UP_TO_TRANSACTION: {
1988 data.enforceInterface(IActivityManager.descriptor);
1989 IBinder token = data.readStrongBinder();
1990 Intent target = Intent.CREATOR.createFromParcel(data);
1991 int resultCode = data.readInt();
1992 Intent resultData = null;
1993 if (data.readInt() != 0) {
1994 resultData = Intent.CREATOR.createFromParcel(data);
1995 }
1996 boolean res = navigateUpTo(token, target, resultCode, resultData);
1997 reply.writeNoException();
1998 reply.writeInt(res ? 1 : 0);
1999 return true;
2000 }
2001
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002002 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2003 data.enforceInterface(IActivityManager.descriptor);
2004 IBinder token = data.readStrongBinder();
2005 int res = getLaunchedFromUid(token);
2006 reply.writeNoException();
2007 reply.writeInt(res);
2008 return true;
2009 }
2010
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002011 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2012 data.enforceInterface(IActivityManager.descriptor);
2013 IBinder token = data.readStrongBinder();
2014 String res = getLaunchedFromPackage(token);
2015 reply.writeNoException();
2016 reply.writeString(res);
2017 return true;
2018 }
2019
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002020 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2021 data.enforceInterface(IActivityManager.descriptor);
2022 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2023 data.readStrongBinder());
2024 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002025 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002026 return true;
2027 }
2028
2029 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2030 data.enforceInterface(IActivityManager.descriptor);
2031 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2032 data.readStrongBinder());
2033 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002034 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002035 return true;
2036 }
2037
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002038 case REQUEST_BUG_REPORT_TRANSACTION: {
2039 data.enforceInterface(IActivityManager.descriptor);
2040 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002041 reply.writeNoException();
2042 return true;
2043 }
2044
2045 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2046 data.enforceInterface(IActivityManager.descriptor);
2047 int pid = data.readInt();
2048 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002049 String reason = data.readString();
2050 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002051 reply.writeNoException();
2052 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002053 return true;
2054 }
2055
Adam Skorydfc7fd72013-08-05 19:23:41 -07002056 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002057 data.enforceInterface(IActivityManager.descriptor);
2058 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002059 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002060 reply.writeNoException();
2061 reply.writeBundle(res);
2062 return true;
2063 }
2064
Adam Skorydfc7fd72013-08-05 19:23:41 -07002065 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002066 data.enforceInterface(IActivityManager.descriptor);
2067 IBinder token = data.readStrongBinder();
2068 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002069 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002070 reply.writeNoException();
2071 return true;
2072 }
2073
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002074 case KILL_UID_TRANSACTION: {
2075 data.enforceInterface(IActivityManager.descriptor);
2076 int uid = data.readInt();
2077 String reason = data.readString();
2078 killUid(uid, reason);
2079 reply.writeNoException();
2080 return true;
2081 }
2082
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002083 case HANG_TRANSACTION: {
2084 data.enforceInterface(IActivityManager.descriptor);
2085 IBinder who = data.readStrongBinder();
2086 boolean allowRestart = data.readInt() != 0;
2087 hang(who, allowRestart);
2088 reply.writeNoException();
2089 return true;
2090 }
2091
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002092 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2093 data.enforceInterface(IActivityManager.descriptor);
2094 IBinder token = data.readStrongBinder();
2095 reportActivityFullyDrawn(token);
2096 reply.writeNoException();
2097 return true;
2098 }
2099
Craig Mautner5eda9b32013-07-02 11:58:16 -07002100 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2101 data.enforceInterface(IActivityManager.descriptor);
2102 IBinder token = data.readStrongBinder();
2103 notifyActivityDrawn(token);
2104 reply.writeNoException();
2105 return true;
2106 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002107
2108 case RESTART_TRANSACTION: {
2109 data.enforceInterface(IActivityManager.descriptor);
2110 restart();
2111 reply.writeNoException();
2112 return true;
2113 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002114
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002115 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2116 data.enforceInterface(IActivityManager.descriptor);
2117 performIdleMaintenance();
2118 reply.writeNoException();
2119 return true;
2120 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002121
2122 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2123 data.enforceInterface(IActivityManager.descriptor);
2124 IBinder parentActivityToken = data.readStrongBinder();
2125 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002126 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002127 IActivityContainer activityContainer =
2128 createActivityContainer(parentActivityToken, callback);
2129 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002130 if (activityContainer != null) {
2131 reply.writeInt(1);
2132 reply.writeStrongBinder(activityContainer.asBinder());
2133 } else {
2134 reply.writeInt(0);
2135 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002136 return true;
2137 }
2138
Craig Mautner95da1082014-02-24 17:54:35 -08002139 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2140 data.enforceInterface(IActivityManager.descriptor);
2141 IActivityContainer activityContainer =
2142 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2143 deleteActivityContainer(activityContainer);
2144 reply.writeNoException();
2145 return true;
2146 }
2147
Craig Mautnere0a38842013-12-16 16:14:02 -08002148 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2149 data.enforceInterface(IActivityManager.descriptor);
2150 IBinder activityToken = data.readStrongBinder();
2151 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2152 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002153 if (activityContainer != null) {
2154 reply.writeInt(1);
2155 reply.writeStrongBinder(activityContainer.asBinder());
2156 } else {
2157 reply.writeInt(0);
2158 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002159 return true;
2160 }
2161
Craig Mautner4a1cb222013-12-04 16:14:06 -08002162 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2163 data.enforceInterface(IActivityManager.descriptor);
2164 IBinder homeActivityToken = getHomeActivityToken();
2165 reply.writeNoException();
2166 reply.writeStrongBinder(homeActivityToken);
2167 return true;
2168 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002169
2170 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2171 data.enforceInterface(IActivityManager.descriptor);
2172 final int taskId = data.readInt();
2173 startLockTaskMode(taskId);
2174 reply.writeNoException();
2175 return true;
2176 }
2177
2178 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2179 data.enforceInterface(IActivityManager.descriptor);
2180 IBinder token = data.readStrongBinder();
2181 startLockTaskMode(token);
2182 reply.writeNoException();
2183 return true;
2184 }
2185
Craig Mautnerd61dc202014-07-07 11:09:11 -07002186 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002187 data.enforceInterface(IActivityManager.descriptor);
2188 startLockTaskModeOnCurrent();
2189 reply.writeNoException();
2190 return true;
2191 }
2192
Craig Mautneraea74a52014-03-08 14:23:10 -08002193 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2194 data.enforceInterface(IActivityManager.descriptor);
2195 stopLockTaskMode();
2196 reply.writeNoException();
2197 return true;
2198 }
2199
Craig Mautnerd61dc202014-07-07 11:09:11 -07002200 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002201 data.enforceInterface(IActivityManager.descriptor);
2202 stopLockTaskModeOnCurrent();
2203 reply.writeNoException();
2204 return true;
2205 }
2206
Craig Mautneraea74a52014-03-08 14:23:10 -08002207 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2208 data.enforceInterface(IActivityManager.descriptor);
2209 final boolean isInLockTaskMode = isInLockTaskMode();
2210 reply.writeNoException();
2211 reply.writeInt(isInLockTaskMode ? 1 : 0);
2212 return true;
2213 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002214
Winson Chunga449dc02014-05-16 11:15:04 -07002215 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002216 data.enforceInterface(IActivityManager.descriptor);
2217 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002218 ActivityManager.TaskDescription values =
2219 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2220 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002221 reply.writeNoException();
2222 return true;
2223 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002224
Jose Lima4b6c6692014-08-12 17:41:12 -07002225 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002226 data.enforceInterface(IActivityManager.descriptor);
2227 IBinder token = data.readStrongBinder();
2228 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002229 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002230 reply.writeNoException();
2231 reply.writeInt(success ? 1 : 0);
2232 return true;
2233 }
2234
Jose Lima4b6c6692014-08-12 17:41:12 -07002235 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002236 data.enforceInterface(IActivityManager.descriptor);
2237 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002238 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002239 reply.writeNoException();
2240 reply.writeInt(enabled ? 1 : 0);
2241 return true;
2242 }
2243
Jose Lima4b6c6692014-08-12 17:41:12 -07002244 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002245 data.enforceInterface(IActivityManager.descriptor);
2246 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002247 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002248 reply.writeNoException();
2249 return true;
2250 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002251
2252 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2253 data.enforceInterface(IActivityManager.descriptor);
2254 IBinder token = data.readStrongBinder();
2255 notifyLaunchTaskBehindComplete(token);
2256 reply.writeNoException();
2257 return true;
2258 }
Craig Mautner8746a472014-07-24 15:12:54 -07002259
2260 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2261 data.enforceInterface(IActivityManager.descriptor);
2262 IBinder token = data.readStrongBinder();
2263 notifyEnterAnimationComplete(token);
2264 reply.writeNoException();
2265 return true;
2266 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002267 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002268
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002269 return super.onTransact(code, data, reply, flags);
2270 }
2271
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002272 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002273 return this;
2274 }
2275
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002276 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2277 protected IActivityManager create() {
2278 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002279 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002280 Log.v("ActivityManager", "default service binder = " + b);
2281 }
2282 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002283 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002284 Log.v("ActivityManager", "default service = " + am);
2285 }
2286 return am;
2287 }
2288 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002289}
2290
2291class ActivityManagerProxy implements IActivityManager
2292{
2293 public ActivityManagerProxy(IBinder remote)
2294 {
2295 mRemote = remote;
2296 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002297
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002298 public IBinder asBinder()
2299 {
2300 return mRemote;
2301 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002302
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002303 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002304 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2305 int startFlags, String profileFile,
2306 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002307 Parcel data = Parcel.obtain();
2308 Parcel reply = Parcel.obtain();
2309 data.writeInterfaceToken(IActivityManager.descriptor);
2310 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002311 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002312 intent.writeToParcel(data, 0);
2313 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002314 data.writeStrongBinder(resultTo);
2315 data.writeString(resultWho);
2316 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002317 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002318 data.writeString(profileFile);
2319 if (profileFd != null) {
2320 data.writeInt(1);
2321 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2322 } else {
2323 data.writeInt(0);
2324 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002325 if (options != null) {
2326 data.writeInt(1);
2327 options.writeToParcel(data, 0);
2328 } else {
2329 data.writeInt(0);
2330 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002331 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2332 reply.readException();
2333 int result = reply.readInt();
2334 reply.recycle();
2335 data.recycle();
2336 return result;
2337 }
Amith Yamasani82644082012-08-03 13:09:11 -07002338
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002339 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002340 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2341 int startFlags, String profileFile,
2342 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2343 Parcel data = Parcel.obtain();
2344 Parcel reply = Parcel.obtain();
2345 data.writeInterfaceToken(IActivityManager.descriptor);
2346 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002347 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002348 intent.writeToParcel(data, 0);
2349 data.writeString(resolvedType);
2350 data.writeStrongBinder(resultTo);
2351 data.writeString(resultWho);
2352 data.writeInt(requestCode);
2353 data.writeInt(startFlags);
2354 data.writeString(profileFile);
2355 if (profileFd != null) {
2356 data.writeInt(1);
2357 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2358 } else {
2359 data.writeInt(0);
2360 }
2361 if (options != null) {
2362 data.writeInt(1);
2363 options.writeToParcel(data, 0);
2364 } else {
2365 data.writeInt(0);
2366 }
2367 data.writeInt(userId);
2368 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2369 reply.readException();
2370 int result = reply.readInt();
2371 reply.recycle();
2372 data.recycle();
2373 return result;
2374 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002375 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2376 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2377 int startFlags, String profileFile,
2378 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
2379 Parcel data = Parcel.obtain();
2380 Parcel reply = Parcel.obtain();
2381 data.writeInterfaceToken(IActivityManager.descriptor);
2382 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2383 data.writeString(callingPackage);
2384 intent.writeToParcel(data, 0);
2385 data.writeString(resolvedType);
2386 data.writeStrongBinder(resultTo);
2387 data.writeString(resultWho);
2388 data.writeInt(requestCode);
2389 data.writeInt(startFlags);
2390 data.writeString(profileFile);
2391 if (profileFd != null) {
2392 data.writeInt(1);
2393 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2394 } else {
2395 data.writeInt(0);
2396 }
2397 if (options != null) {
2398 data.writeInt(1);
2399 options.writeToParcel(data, 0);
2400 } else {
2401 data.writeInt(0);
2402 }
2403 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2404 reply.readException();
2405 int result = reply.readInt();
2406 reply.recycle();
2407 data.recycle();
2408 return result;
2409 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002410 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2411 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002412 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002413 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002414 Parcel data = Parcel.obtain();
2415 Parcel reply = Parcel.obtain();
2416 data.writeInterfaceToken(IActivityManager.descriptor);
2417 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002418 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002419 intent.writeToParcel(data, 0);
2420 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002421 data.writeStrongBinder(resultTo);
2422 data.writeString(resultWho);
2423 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002424 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002425 data.writeString(profileFile);
2426 if (profileFd != null) {
2427 data.writeInt(1);
2428 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2429 } else {
2430 data.writeInt(0);
2431 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002432 if (options != null) {
2433 data.writeInt(1);
2434 options.writeToParcel(data, 0);
2435 } else {
2436 data.writeInt(0);
2437 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002438 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002439 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2440 reply.readException();
2441 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2442 reply.recycle();
2443 data.recycle();
2444 return result;
2445 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002446 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2447 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002448 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002449 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002450 Parcel data = Parcel.obtain();
2451 Parcel reply = Parcel.obtain();
2452 data.writeInterfaceToken(IActivityManager.descriptor);
2453 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002454 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002455 intent.writeToParcel(data, 0);
2456 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002457 data.writeStrongBinder(resultTo);
2458 data.writeString(resultWho);
2459 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002460 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002461 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002462 if (options != null) {
2463 data.writeInt(1);
2464 options.writeToParcel(data, 0);
2465 } else {
2466 data.writeInt(0);
2467 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002468 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002469 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2470 reply.readException();
2471 int result = reply.readInt();
2472 reply.recycle();
2473 data.recycle();
2474 return result;
2475 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002476 public int startActivityIntentSender(IApplicationThread caller,
2477 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002478 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002479 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002480 Parcel data = Parcel.obtain();
2481 Parcel reply = Parcel.obtain();
2482 data.writeInterfaceToken(IActivityManager.descriptor);
2483 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2484 intent.writeToParcel(data, 0);
2485 if (fillInIntent != null) {
2486 data.writeInt(1);
2487 fillInIntent.writeToParcel(data, 0);
2488 } else {
2489 data.writeInt(0);
2490 }
2491 data.writeString(resolvedType);
2492 data.writeStrongBinder(resultTo);
2493 data.writeString(resultWho);
2494 data.writeInt(requestCode);
2495 data.writeInt(flagsMask);
2496 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002497 if (options != null) {
2498 data.writeInt(1);
2499 options.writeToParcel(data, 0);
2500 } else {
2501 data.writeInt(0);
2502 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002503 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002504 reply.readException();
2505 int result = reply.readInt();
2506 reply.recycle();
2507 data.recycle();
2508 return result;
2509 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002510 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2511 Intent intent, String resolvedType, IVoiceInteractionSession session,
2512 IVoiceInteractor interactor, int startFlags, String profileFile,
2513 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2514 Parcel data = Parcel.obtain();
2515 Parcel reply = Parcel.obtain();
2516 data.writeInterfaceToken(IActivityManager.descriptor);
2517 data.writeString(callingPackage);
2518 data.writeInt(callingPid);
2519 data.writeInt(callingUid);
2520 intent.writeToParcel(data, 0);
2521 data.writeString(resolvedType);
2522 data.writeStrongBinder(session.asBinder());
2523 data.writeStrongBinder(interactor.asBinder());
2524 data.writeInt(startFlags);
2525 data.writeString(profileFile);
2526 if (profileFd != null) {
2527 data.writeInt(1);
2528 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2529 } else {
2530 data.writeInt(0);
2531 }
2532 if (options != null) {
2533 data.writeInt(1);
2534 options.writeToParcel(data, 0);
2535 } else {
2536 data.writeInt(0);
2537 }
2538 data.writeInt(userId);
2539 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2540 reply.readException();
2541 int result = reply.readInt();
2542 reply.recycle();
2543 data.recycle();
2544 return result;
2545 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002546 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002547 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002548 Parcel data = Parcel.obtain();
2549 Parcel reply = Parcel.obtain();
2550 data.writeInterfaceToken(IActivityManager.descriptor);
2551 data.writeStrongBinder(callingActivity);
2552 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002553 if (options != null) {
2554 data.writeInt(1);
2555 options.writeToParcel(data, 0);
2556 } else {
2557 data.writeInt(0);
2558 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002559 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2560 reply.readException();
2561 int result = reply.readInt();
2562 reply.recycle();
2563 data.recycle();
2564 return result != 0;
2565 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002566 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2567 Parcel data = Parcel.obtain();
2568 Parcel reply = Parcel.obtain();
2569 data.writeInterfaceToken(IActivityManager.descriptor);
2570 data.writeInt(taskId);
2571 if (options == null) {
2572 data.writeInt(0);
2573 } else {
2574 data.writeInt(1);
2575 options.writeToParcel(data, 0);
2576 }
2577 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2578 reply.readException();
2579 int result = reply.readInt();
2580 reply.recycle();
2581 data.recycle();
2582 return result;
2583 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002584 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002585 throws RemoteException {
2586 Parcel data = Parcel.obtain();
2587 Parcel reply = Parcel.obtain();
2588 data.writeInterfaceToken(IActivityManager.descriptor);
2589 data.writeStrongBinder(token);
2590 data.writeInt(resultCode);
2591 if (resultData != null) {
2592 data.writeInt(1);
2593 resultData.writeToParcel(data, 0);
2594 } else {
2595 data.writeInt(0);
2596 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002597 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002598 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2599 reply.readException();
2600 boolean res = reply.readInt() != 0;
2601 data.recycle();
2602 reply.recycle();
2603 return res;
2604 }
2605 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2606 {
2607 Parcel data = Parcel.obtain();
2608 Parcel reply = Parcel.obtain();
2609 data.writeInterfaceToken(IActivityManager.descriptor);
2610 data.writeStrongBinder(token);
2611 data.writeString(resultWho);
2612 data.writeInt(requestCode);
2613 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2614 reply.readException();
2615 data.recycle();
2616 reply.recycle();
2617 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002618 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2619 Parcel data = Parcel.obtain();
2620 Parcel reply = Parcel.obtain();
2621 data.writeInterfaceToken(IActivityManager.descriptor);
2622 data.writeStrongBinder(token);
2623 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2624 reply.readException();
2625 boolean res = reply.readInt() != 0;
2626 data.recycle();
2627 reply.recycle();
2628 return res;
2629 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002630 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2631 Parcel data = Parcel.obtain();
2632 Parcel reply = Parcel.obtain();
2633 data.writeInterfaceToken(IActivityManager.descriptor);
2634 data.writeStrongBinder(session.asBinder());
2635 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2636 reply.readException();
2637 data.recycle();
2638 reply.recycle();
2639 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002640 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2641 Parcel data = Parcel.obtain();
2642 Parcel reply = Parcel.obtain();
2643 data.writeInterfaceToken(IActivityManager.descriptor);
2644 data.writeStrongBinder(token);
2645 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2646 reply.readException();
2647 boolean res = reply.readInt() != 0;
2648 data.recycle();
2649 reply.recycle();
2650 return res;
2651 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002652 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002653 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002654 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002655 {
2656 Parcel data = Parcel.obtain();
2657 Parcel reply = Parcel.obtain();
2658 data.writeInterfaceToken(IActivityManager.descriptor);
2659 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002660 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002661 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2662 filter.writeToParcel(data, 0);
2663 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002664 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002665 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2666 reply.readException();
2667 Intent intent = null;
2668 int haveIntent = reply.readInt();
2669 if (haveIntent != 0) {
2670 intent = Intent.CREATOR.createFromParcel(reply);
2671 }
2672 reply.recycle();
2673 data.recycle();
2674 return intent;
2675 }
2676 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2677 {
2678 Parcel data = Parcel.obtain();
2679 Parcel reply = Parcel.obtain();
2680 data.writeInterfaceToken(IActivityManager.descriptor);
2681 data.writeStrongBinder(receiver.asBinder());
2682 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2683 reply.readException();
2684 data.recycle();
2685 reply.recycle();
2686 }
2687 public int broadcastIntent(IApplicationThread caller,
2688 Intent intent, String resolvedType, IIntentReceiver resultTo,
2689 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002690 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002691 boolean sticky, int userId) 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(caller != null ? caller.asBinder() : null);
2697 intent.writeToParcel(data, 0);
2698 data.writeString(resolvedType);
2699 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2700 data.writeInt(resultCode);
2701 data.writeString(resultData);
2702 data.writeBundle(map);
2703 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002704 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002705 data.writeInt(serialized ? 1 : 0);
2706 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002707 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002708 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2709 reply.readException();
2710 int res = reply.readInt();
2711 reply.recycle();
2712 data.recycle();
2713 return res;
2714 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002715 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2716 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002717 {
2718 Parcel data = Parcel.obtain();
2719 Parcel reply = Parcel.obtain();
2720 data.writeInterfaceToken(IActivityManager.descriptor);
2721 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2722 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002723 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002724 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2725 reply.readException();
2726 data.recycle();
2727 reply.recycle();
2728 }
2729 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2730 {
2731 Parcel data = Parcel.obtain();
2732 Parcel reply = Parcel.obtain();
2733 data.writeInterfaceToken(IActivityManager.descriptor);
2734 data.writeStrongBinder(who);
2735 data.writeInt(resultCode);
2736 data.writeString(resultData);
2737 data.writeBundle(map);
2738 data.writeInt(abortBroadcast ? 1 : 0);
2739 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2740 reply.readException();
2741 data.recycle();
2742 reply.recycle();
2743 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002744 public void attachApplication(IApplicationThread app) throws RemoteException
2745 {
2746 Parcel data = Parcel.obtain();
2747 Parcel reply = Parcel.obtain();
2748 data.writeInterfaceToken(IActivityManager.descriptor);
2749 data.writeStrongBinder(app.asBinder());
2750 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2751 reply.readException();
2752 data.recycle();
2753 reply.recycle();
2754 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002755 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2756 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002757 {
2758 Parcel data = Parcel.obtain();
2759 Parcel reply = Parcel.obtain();
2760 data.writeInterfaceToken(IActivityManager.descriptor);
2761 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002762 if (config != null) {
2763 data.writeInt(1);
2764 config.writeToParcel(data, 0);
2765 } else {
2766 data.writeInt(0);
2767 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002768 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002769 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2770 reply.readException();
2771 data.recycle();
2772 reply.recycle();
2773 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002774 public void activityResumed(IBinder token) throws RemoteException
2775 {
2776 Parcel data = Parcel.obtain();
2777 Parcel reply = Parcel.obtain();
2778 data.writeInterfaceToken(IActivityManager.descriptor);
2779 data.writeStrongBinder(token);
2780 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2781 reply.readException();
2782 data.recycle();
2783 reply.recycle();
2784 }
Craig Mautnera0026042014-04-23 11:45:37 -07002785 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002786 {
2787 Parcel data = Parcel.obtain();
2788 Parcel reply = Parcel.obtain();
2789 data.writeInterfaceToken(IActivityManager.descriptor);
2790 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002791 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002792 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2793 reply.readException();
2794 data.recycle();
2795 reply.recycle();
2796 }
2797 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002798 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002799 {
2800 Parcel data = Parcel.obtain();
2801 Parcel reply = Parcel.obtain();
2802 data.writeInterfaceToken(IActivityManager.descriptor);
2803 data.writeStrongBinder(token);
2804 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002805 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002806 TextUtils.writeToParcel(description, data, 0);
2807 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2808 reply.readException();
2809 data.recycle();
2810 reply.recycle();
2811 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002812 public void activitySlept(IBinder token) throws RemoteException
2813 {
2814 Parcel data = Parcel.obtain();
2815 Parcel reply = Parcel.obtain();
2816 data.writeInterfaceToken(IActivityManager.descriptor);
2817 data.writeStrongBinder(token);
2818 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2819 reply.readException();
2820 data.recycle();
2821 reply.recycle();
2822 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002823 public void activityDestroyed(IBinder token) throws RemoteException
2824 {
2825 Parcel data = Parcel.obtain();
2826 Parcel reply = Parcel.obtain();
2827 data.writeInterfaceToken(IActivityManager.descriptor);
2828 data.writeStrongBinder(token);
2829 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2830 reply.readException();
2831 data.recycle();
2832 reply.recycle();
2833 }
2834 public String getCallingPackage(IBinder token) throws RemoteException
2835 {
2836 Parcel data = Parcel.obtain();
2837 Parcel reply = Parcel.obtain();
2838 data.writeInterfaceToken(IActivityManager.descriptor);
2839 data.writeStrongBinder(token);
2840 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2841 reply.readException();
2842 String res = reply.readString();
2843 data.recycle();
2844 reply.recycle();
2845 return res;
2846 }
2847 public ComponentName getCallingActivity(IBinder token)
2848 throws RemoteException {
2849 Parcel data = Parcel.obtain();
2850 Parcel reply = Parcel.obtain();
2851 data.writeInterfaceToken(IActivityManager.descriptor);
2852 data.writeStrongBinder(token);
2853 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2854 reply.readException();
2855 ComponentName res = ComponentName.readFromParcel(reply);
2856 data.recycle();
2857 reply.recycle();
2858 return res;
2859 }
Winson Chung1147c402014-05-14 11:05:00 -07002860 public List<IAppTask> getAppTasks() throws RemoteException {
2861 Parcel data = Parcel.obtain();
2862 Parcel reply = Parcel.obtain();
2863 data.writeInterfaceToken(IActivityManager.descriptor);
2864 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2865 reply.readException();
2866 ArrayList<IAppTask> list = null;
2867 int N = reply.readInt();
2868 if (N >= 0) {
2869 list = new ArrayList<IAppTask>();
2870 while (N > 0) {
2871 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2872 list.add(task);
2873 N--;
2874 }
2875 }
2876 data.recycle();
2877 reply.recycle();
2878 return list;
2879 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002880 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002881 Parcel data = Parcel.obtain();
2882 Parcel reply = Parcel.obtain();
2883 data.writeInterfaceToken(IActivityManager.descriptor);
2884 data.writeInt(maxNum);
2885 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002886 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2887 reply.readException();
2888 ArrayList list = null;
2889 int N = reply.readInt();
2890 if (N >= 0) {
2891 list = new ArrayList();
2892 while (N > 0) {
2893 ActivityManager.RunningTaskInfo info =
2894 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002895 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002896 list.add(info);
2897 N--;
2898 }
2899 }
2900 data.recycle();
2901 reply.recycle();
2902 return list;
2903 }
2904 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002905 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002906 Parcel data = Parcel.obtain();
2907 Parcel reply = Parcel.obtain();
2908 data.writeInterfaceToken(IActivityManager.descriptor);
2909 data.writeInt(maxNum);
2910 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002911 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002912 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2913 reply.readException();
2914 ArrayList<ActivityManager.RecentTaskInfo> list
2915 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2916 data.recycle();
2917 reply.recycle();
2918 return list;
2919 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002920 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002921 Parcel data = Parcel.obtain();
2922 Parcel reply = Parcel.obtain();
2923 data.writeInterfaceToken(IActivityManager.descriptor);
2924 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002925 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002926 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002927 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002928 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002929 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002930 }
2931 data.recycle();
2932 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002933 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07002934 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002935 public List getServices(int maxNum, int flags) throws RemoteException {
2936 Parcel data = Parcel.obtain();
2937 Parcel reply = Parcel.obtain();
2938 data.writeInterfaceToken(IActivityManager.descriptor);
2939 data.writeInt(maxNum);
2940 data.writeInt(flags);
2941 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2942 reply.readException();
2943 ArrayList list = null;
2944 int N = reply.readInt();
2945 if (N >= 0) {
2946 list = new ArrayList();
2947 while (N > 0) {
2948 ActivityManager.RunningServiceInfo info =
2949 ActivityManager.RunningServiceInfo.CREATOR
2950 .createFromParcel(reply);
2951 list.add(info);
2952 N--;
2953 }
2954 }
2955 data.recycle();
2956 reply.recycle();
2957 return list;
2958 }
2959 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2960 throws RemoteException {
2961 Parcel data = Parcel.obtain();
2962 Parcel reply = Parcel.obtain();
2963 data.writeInterfaceToken(IActivityManager.descriptor);
2964 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2965 reply.readException();
2966 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2967 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2968 data.recycle();
2969 reply.recycle();
2970 return list;
2971 }
2972 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2973 throws RemoteException {
2974 Parcel data = Parcel.obtain();
2975 Parcel reply = Parcel.obtain();
2976 data.writeInterfaceToken(IActivityManager.descriptor);
2977 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2978 reply.readException();
2979 ArrayList<ActivityManager.RunningAppProcessInfo> list
2980 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2981 data.recycle();
2982 reply.recycle();
2983 return list;
2984 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002985 public List<ApplicationInfo> getRunningExternalApplications()
2986 throws RemoteException {
2987 Parcel data = Parcel.obtain();
2988 Parcel reply = Parcel.obtain();
2989 data.writeInterfaceToken(IActivityManager.descriptor);
2990 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2991 reply.readException();
2992 ArrayList<ApplicationInfo> list
2993 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2994 data.recycle();
2995 reply.recycle();
2996 return list;
2997 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002998 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002999 {
3000 Parcel data = Parcel.obtain();
3001 Parcel reply = Parcel.obtain();
3002 data.writeInterfaceToken(IActivityManager.descriptor);
3003 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003004 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003005 if (options != null) {
3006 data.writeInt(1);
3007 options.writeToParcel(data, 0);
3008 } else {
3009 data.writeInt(0);
3010 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003011 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3012 reply.readException();
3013 data.recycle();
3014 reply.recycle();
3015 }
3016 public void moveTaskToBack(int task) throws RemoteException
3017 {
3018 Parcel data = Parcel.obtain();
3019 Parcel reply = Parcel.obtain();
3020 data.writeInterfaceToken(IActivityManager.descriptor);
3021 data.writeInt(task);
3022 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3023 reply.readException();
3024 data.recycle();
3025 reply.recycle();
3026 }
3027 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3028 throws RemoteException {
3029 Parcel data = Parcel.obtain();
3030 Parcel reply = Parcel.obtain();
3031 data.writeInterfaceToken(IActivityManager.descriptor);
3032 data.writeStrongBinder(token);
3033 data.writeInt(nonRoot ? 1 : 0);
3034 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3035 reply.readException();
3036 boolean res = reply.readInt() != 0;
3037 data.recycle();
3038 reply.recycle();
3039 return res;
3040 }
3041 public void moveTaskBackwards(int task) throws RemoteException
3042 {
3043 Parcel data = Parcel.obtain();
3044 Parcel reply = Parcel.obtain();
3045 data.writeInterfaceToken(IActivityManager.descriptor);
3046 data.writeInt(task);
3047 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3048 reply.readException();
3049 data.recycle();
3050 reply.recycle();
3051 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003052 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003053 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3054 {
3055 Parcel data = Parcel.obtain();
3056 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003057 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003058 data.writeInt(taskId);
3059 data.writeInt(stackId);
3060 data.writeInt(toTop ? 1 : 0);
3061 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3062 reply.readException();
3063 data.recycle();
3064 reply.recycle();
3065 }
3066 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003067 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003068 {
3069 Parcel data = Parcel.obtain();
3070 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003071 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003072 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003073 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003074 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003075 reply.readException();
3076 data.recycle();
3077 reply.recycle();
3078 }
Craig Mautner967212c2013-04-13 21:10:58 -07003079 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003080 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003081 {
3082 Parcel data = Parcel.obtain();
3083 Parcel reply = Parcel.obtain();
3084 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003085 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003086 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003087 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003088 data.recycle();
3089 reply.recycle();
3090 return list;
3091 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003092 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003093 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003094 {
3095 Parcel data = Parcel.obtain();
3096 Parcel reply = Parcel.obtain();
3097 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003098 data.writeInt(stackId);
3099 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003100 reply.readException();
3101 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003102 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003103 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003104 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003105 }
3106 data.recycle();
3107 reply.recycle();
3108 return info;
3109 }
3110 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003111 public boolean isInHomeStack(int taskId) throws RemoteException {
3112 Parcel data = Parcel.obtain();
3113 Parcel reply = Parcel.obtain();
3114 data.writeInterfaceToken(IActivityManager.descriptor);
3115 data.writeInt(taskId);
3116 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3117 reply.readException();
3118 boolean isInHomeStack = reply.readInt() > 0;
3119 data.recycle();
3120 reply.recycle();
3121 return isInHomeStack;
3122 }
3123 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003124 public void setFocusedStack(int stackId) throws RemoteException
3125 {
3126 Parcel data = Parcel.obtain();
3127 Parcel reply = Parcel.obtain();
3128 data.writeInterfaceToken(IActivityManager.descriptor);
3129 data.writeInt(stackId);
3130 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3131 reply.readException();
3132 data.recycle();
3133 reply.recycle();
3134 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003135 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3136 {
3137 Parcel data = Parcel.obtain();
3138 Parcel reply = Parcel.obtain();
3139 data.writeInterfaceToken(IActivityManager.descriptor);
3140 data.writeStrongBinder(token);
3141 data.writeInt(onlyRoot ? 1 : 0);
3142 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3143 reply.readException();
3144 int res = reply.readInt();
3145 data.recycle();
3146 reply.recycle();
3147 return res;
3148 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003149 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003150 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003151 Parcel data = Parcel.obtain();
3152 Parcel reply = Parcel.obtain();
3153 data.writeInterfaceToken(IActivityManager.descriptor);
3154 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3155 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003156 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003157 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003158 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3159 reply.readException();
3160 int res = reply.readInt();
3161 ContentProviderHolder cph = null;
3162 if (res != 0) {
3163 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3164 }
3165 data.recycle();
3166 reply.recycle();
3167 return cph;
3168 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003169 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3170 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003171 Parcel data = Parcel.obtain();
3172 Parcel reply = Parcel.obtain();
3173 data.writeInterfaceToken(IActivityManager.descriptor);
3174 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003175 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003176 data.writeStrongBinder(token);
3177 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3178 reply.readException();
3179 int res = reply.readInt();
3180 ContentProviderHolder cph = null;
3181 if (res != 0) {
3182 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3183 }
3184 data.recycle();
3185 reply.recycle();
3186 return cph;
3187 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003188 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003189 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003190 {
3191 Parcel data = Parcel.obtain();
3192 Parcel reply = Parcel.obtain();
3193 data.writeInterfaceToken(IActivityManager.descriptor);
3194 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3195 data.writeTypedList(providers);
3196 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3197 reply.readException();
3198 data.recycle();
3199 reply.recycle();
3200 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003201 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3202 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003203 Parcel data = Parcel.obtain();
3204 Parcel reply = Parcel.obtain();
3205 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003206 data.writeStrongBinder(connection);
3207 data.writeInt(stable);
3208 data.writeInt(unstable);
3209 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3210 reply.readException();
3211 boolean res = reply.readInt() != 0;
3212 data.recycle();
3213 reply.recycle();
3214 return res;
3215 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003216
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003217 public void unstableProviderDied(IBinder connection) throws RemoteException {
3218 Parcel data = Parcel.obtain();
3219 Parcel reply = Parcel.obtain();
3220 data.writeInterfaceToken(IActivityManager.descriptor);
3221 data.writeStrongBinder(connection);
3222 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3223 reply.readException();
3224 data.recycle();
3225 reply.recycle();
3226 }
3227
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003228 @Override
3229 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3230 Parcel data = Parcel.obtain();
3231 Parcel reply = Parcel.obtain();
3232 data.writeInterfaceToken(IActivityManager.descriptor);
3233 data.writeStrongBinder(connection);
3234 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3235 reply.readException();
3236 data.recycle();
3237 reply.recycle();
3238 }
3239
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003240 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3241 Parcel data = Parcel.obtain();
3242 Parcel reply = Parcel.obtain();
3243 data.writeInterfaceToken(IActivityManager.descriptor);
3244 data.writeStrongBinder(connection);
3245 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003246 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3247 reply.readException();
3248 data.recycle();
3249 reply.recycle();
3250 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003251
3252 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3253 Parcel data = Parcel.obtain();
3254 Parcel reply = Parcel.obtain();
3255 data.writeInterfaceToken(IActivityManager.descriptor);
3256 data.writeString(name);
3257 data.writeStrongBinder(token);
3258 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3259 reply.readException();
3260 data.recycle();
3261 reply.recycle();
3262 }
3263
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003264 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3265 throws RemoteException
3266 {
3267 Parcel data = Parcel.obtain();
3268 Parcel reply = Parcel.obtain();
3269 data.writeInterfaceToken(IActivityManager.descriptor);
3270 service.writeToParcel(data, 0);
3271 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3272 reply.readException();
3273 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3274 data.recycle();
3275 reply.recycle();
3276 return res;
3277 }
3278
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003279 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003280 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003281 {
3282 Parcel data = Parcel.obtain();
3283 Parcel reply = Parcel.obtain();
3284 data.writeInterfaceToken(IActivityManager.descriptor);
3285 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3286 service.writeToParcel(data, 0);
3287 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003288 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003289 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3290 reply.readException();
3291 ComponentName res = ComponentName.readFromParcel(reply);
3292 data.recycle();
3293 reply.recycle();
3294 return res;
3295 }
3296 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003297 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003298 {
3299 Parcel data = Parcel.obtain();
3300 Parcel reply = Parcel.obtain();
3301 data.writeInterfaceToken(IActivityManager.descriptor);
3302 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3303 service.writeToParcel(data, 0);
3304 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003305 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003306 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3307 reply.readException();
3308 int res = reply.readInt();
3309 reply.recycle();
3310 data.recycle();
3311 return res;
3312 }
3313 public boolean stopServiceToken(ComponentName className, IBinder token,
3314 int startId) throws RemoteException {
3315 Parcel data = Parcel.obtain();
3316 Parcel reply = Parcel.obtain();
3317 data.writeInterfaceToken(IActivityManager.descriptor);
3318 ComponentName.writeToParcel(className, data);
3319 data.writeStrongBinder(token);
3320 data.writeInt(startId);
3321 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3322 reply.readException();
3323 boolean res = reply.readInt() != 0;
3324 data.recycle();
3325 reply.recycle();
3326 return res;
3327 }
3328 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003329 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003330 Parcel data = Parcel.obtain();
3331 Parcel reply = Parcel.obtain();
3332 data.writeInterfaceToken(IActivityManager.descriptor);
3333 ComponentName.writeToParcel(className, data);
3334 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003335 data.writeInt(id);
3336 if (notification != null) {
3337 data.writeInt(1);
3338 notification.writeToParcel(data, 0);
3339 } else {
3340 data.writeInt(0);
3341 }
3342 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003343 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3344 reply.readException();
3345 data.recycle();
3346 reply.recycle();
3347 }
3348 public int bindService(IApplicationThread caller, IBinder token,
3349 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003350 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003351 Parcel data = Parcel.obtain();
3352 Parcel reply = Parcel.obtain();
3353 data.writeInterfaceToken(IActivityManager.descriptor);
3354 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3355 data.writeStrongBinder(token);
3356 service.writeToParcel(data, 0);
3357 data.writeString(resolvedType);
3358 data.writeStrongBinder(connection.asBinder());
3359 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003360 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003361 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3362 reply.readException();
3363 int res = reply.readInt();
3364 data.recycle();
3365 reply.recycle();
3366 return res;
3367 }
3368 public boolean unbindService(IServiceConnection connection) throws RemoteException
3369 {
3370 Parcel data = Parcel.obtain();
3371 Parcel reply = Parcel.obtain();
3372 data.writeInterfaceToken(IActivityManager.descriptor);
3373 data.writeStrongBinder(connection.asBinder());
3374 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3375 reply.readException();
3376 boolean res = reply.readInt() != 0;
3377 data.recycle();
3378 reply.recycle();
3379 return res;
3380 }
3381
3382 public void publishService(IBinder token,
3383 Intent intent, IBinder service) throws RemoteException {
3384 Parcel data = Parcel.obtain();
3385 Parcel reply = Parcel.obtain();
3386 data.writeInterfaceToken(IActivityManager.descriptor);
3387 data.writeStrongBinder(token);
3388 intent.writeToParcel(data, 0);
3389 data.writeStrongBinder(service);
3390 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3391 reply.readException();
3392 data.recycle();
3393 reply.recycle();
3394 }
3395
3396 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3397 throws RemoteException {
3398 Parcel data = Parcel.obtain();
3399 Parcel reply = Parcel.obtain();
3400 data.writeInterfaceToken(IActivityManager.descriptor);
3401 data.writeStrongBinder(token);
3402 intent.writeToParcel(data, 0);
3403 data.writeInt(doRebind ? 1 : 0);
3404 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3405 reply.readException();
3406 data.recycle();
3407 reply.recycle();
3408 }
3409
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003410 public void serviceDoneExecuting(IBinder token, int type, int startId,
3411 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003412 Parcel data = Parcel.obtain();
3413 Parcel reply = Parcel.obtain();
3414 data.writeInterfaceToken(IActivityManager.descriptor);
3415 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003416 data.writeInt(type);
3417 data.writeInt(startId);
3418 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003419 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3420 reply.readException();
3421 data.recycle();
3422 reply.recycle();
3423 }
3424
3425 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3426 Parcel data = Parcel.obtain();
3427 Parcel reply = Parcel.obtain();
3428 data.writeInterfaceToken(IActivityManager.descriptor);
3429 service.writeToParcel(data, 0);
3430 data.writeString(resolvedType);
3431 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3432 reply.readException();
3433 IBinder binder = reply.readStrongBinder();
3434 reply.recycle();
3435 data.recycle();
3436 return binder;
3437 }
3438
Christopher Tate181fafa2009-05-14 11:12:14 -07003439 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3440 throws RemoteException {
3441 Parcel data = Parcel.obtain();
3442 Parcel reply = Parcel.obtain();
3443 data.writeInterfaceToken(IActivityManager.descriptor);
3444 app.writeToParcel(data, 0);
3445 data.writeInt(backupRestoreMode);
3446 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3447 reply.readException();
3448 boolean success = reply.readInt() != 0;
3449 reply.recycle();
3450 data.recycle();
3451 return success;
3452 }
3453
Christopher Tate346acb12012-10-15 19:20:25 -07003454 public void clearPendingBackup() throws RemoteException {
3455 Parcel data = Parcel.obtain();
3456 Parcel reply = Parcel.obtain();
3457 data.writeInterfaceToken(IActivityManager.descriptor);
3458 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3459 reply.recycle();
3460 data.recycle();
3461 }
3462
Christopher Tate181fafa2009-05-14 11:12:14 -07003463 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3464 Parcel data = Parcel.obtain();
3465 Parcel reply = Parcel.obtain();
3466 data.writeInterfaceToken(IActivityManager.descriptor);
3467 data.writeString(packageName);
3468 data.writeStrongBinder(agent);
3469 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3470 reply.recycle();
3471 data.recycle();
3472 }
3473
3474 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3475 Parcel data = Parcel.obtain();
3476 Parcel reply = Parcel.obtain();
3477 data.writeInterfaceToken(IActivityManager.descriptor);
3478 app.writeToParcel(data, 0);
3479 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3480 reply.readException();
3481 reply.recycle();
3482 data.recycle();
3483 }
3484
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003485 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003486 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003487 IUiAutomationConnection connection, int userId, String instructionSet)
3488 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003489 Parcel data = Parcel.obtain();
3490 Parcel reply = Parcel.obtain();
3491 data.writeInterfaceToken(IActivityManager.descriptor);
3492 ComponentName.writeToParcel(className, data);
3493 data.writeString(profileFile);
3494 data.writeInt(flags);
3495 data.writeBundle(arguments);
3496 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003497 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003498 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003499 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003500 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3501 reply.readException();
3502 boolean res = reply.readInt() != 0;
3503 reply.recycle();
3504 data.recycle();
3505 return res;
3506 }
3507
3508 public void finishInstrumentation(IApplicationThread target,
3509 int resultCode, Bundle results) throws RemoteException {
3510 Parcel data = Parcel.obtain();
3511 Parcel reply = Parcel.obtain();
3512 data.writeInterfaceToken(IActivityManager.descriptor);
3513 data.writeStrongBinder(target != null ? target.asBinder() : null);
3514 data.writeInt(resultCode);
3515 data.writeBundle(results);
3516 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3517 reply.readException();
3518 data.recycle();
3519 reply.recycle();
3520 }
3521 public Configuration getConfiguration() throws RemoteException
3522 {
3523 Parcel data = Parcel.obtain();
3524 Parcel reply = Parcel.obtain();
3525 data.writeInterfaceToken(IActivityManager.descriptor);
3526 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3527 reply.readException();
3528 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3529 reply.recycle();
3530 data.recycle();
3531 return res;
3532 }
3533 public void updateConfiguration(Configuration values) throws RemoteException
3534 {
3535 Parcel data = Parcel.obtain();
3536 Parcel reply = Parcel.obtain();
3537 data.writeInterfaceToken(IActivityManager.descriptor);
3538 values.writeToParcel(data, 0);
3539 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3540 reply.readException();
3541 data.recycle();
3542 reply.recycle();
3543 }
3544 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3545 throws RemoteException {
3546 Parcel data = Parcel.obtain();
3547 Parcel reply = Parcel.obtain();
3548 data.writeInterfaceToken(IActivityManager.descriptor);
3549 data.writeStrongBinder(token);
3550 data.writeInt(requestedOrientation);
3551 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3552 reply.readException();
3553 data.recycle();
3554 reply.recycle();
3555 }
3556 public int getRequestedOrientation(IBinder token) throws RemoteException {
3557 Parcel data = Parcel.obtain();
3558 Parcel reply = Parcel.obtain();
3559 data.writeInterfaceToken(IActivityManager.descriptor);
3560 data.writeStrongBinder(token);
3561 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3562 reply.readException();
3563 int res = reply.readInt();
3564 data.recycle();
3565 reply.recycle();
3566 return res;
3567 }
3568 public ComponentName getActivityClassForToken(IBinder token)
3569 throws RemoteException {
3570 Parcel data = Parcel.obtain();
3571 Parcel reply = Parcel.obtain();
3572 data.writeInterfaceToken(IActivityManager.descriptor);
3573 data.writeStrongBinder(token);
3574 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3575 reply.readException();
3576 ComponentName res = ComponentName.readFromParcel(reply);
3577 data.recycle();
3578 reply.recycle();
3579 return res;
3580 }
3581 public String getPackageForToken(IBinder token) throws RemoteException
3582 {
3583 Parcel data = Parcel.obtain();
3584 Parcel reply = Parcel.obtain();
3585 data.writeInterfaceToken(IActivityManager.descriptor);
3586 data.writeStrongBinder(token);
3587 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3588 reply.readException();
3589 String res = reply.readString();
3590 data.recycle();
3591 reply.recycle();
3592 return res;
3593 }
3594 public IIntentSender getIntentSender(int type,
3595 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003596 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003597 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003598 Parcel data = Parcel.obtain();
3599 Parcel reply = Parcel.obtain();
3600 data.writeInterfaceToken(IActivityManager.descriptor);
3601 data.writeInt(type);
3602 data.writeString(packageName);
3603 data.writeStrongBinder(token);
3604 data.writeString(resultWho);
3605 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003606 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003607 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003608 data.writeTypedArray(intents, 0);
3609 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003610 } else {
3611 data.writeInt(0);
3612 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003613 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003614 if (options != null) {
3615 data.writeInt(1);
3616 options.writeToParcel(data, 0);
3617 } else {
3618 data.writeInt(0);
3619 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003620 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003621 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3622 reply.readException();
3623 IIntentSender res = IIntentSender.Stub.asInterface(
3624 reply.readStrongBinder());
3625 data.recycle();
3626 reply.recycle();
3627 return res;
3628 }
3629 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3630 Parcel data = Parcel.obtain();
3631 Parcel reply = Parcel.obtain();
3632 data.writeInterfaceToken(IActivityManager.descriptor);
3633 data.writeStrongBinder(sender.asBinder());
3634 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3635 reply.readException();
3636 data.recycle();
3637 reply.recycle();
3638 }
3639 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3640 Parcel data = Parcel.obtain();
3641 Parcel reply = Parcel.obtain();
3642 data.writeInterfaceToken(IActivityManager.descriptor);
3643 data.writeStrongBinder(sender.asBinder());
3644 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3645 reply.readException();
3646 String res = reply.readString();
3647 data.recycle();
3648 reply.recycle();
3649 return res;
3650 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003651 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3652 Parcel data = Parcel.obtain();
3653 Parcel reply = Parcel.obtain();
3654 data.writeInterfaceToken(IActivityManager.descriptor);
3655 data.writeStrongBinder(sender.asBinder());
3656 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3657 reply.readException();
3658 int res = reply.readInt();
3659 data.recycle();
3660 reply.recycle();
3661 return res;
3662 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003663 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3664 boolean requireFull, String name, String callerPackage) throws RemoteException {
3665 Parcel data = Parcel.obtain();
3666 Parcel reply = Parcel.obtain();
3667 data.writeInterfaceToken(IActivityManager.descriptor);
3668 data.writeInt(callingPid);
3669 data.writeInt(callingUid);
3670 data.writeInt(userId);
3671 data.writeInt(allowAll ? 1 : 0);
3672 data.writeInt(requireFull ? 1 : 0);
3673 data.writeString(name);
3674 data.writeString(callerPackage);
3675 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3676 reply.readException();
3677 int res = reply.readInt();
3678 data.recycle();
3679 reply.recycle();
3680 return res;
3681 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003682 public void setProcessLimit(int max) throws RemoteException
3683 {
3684 Parcel data = Parcel.obtain();
3685 Parcel reply = Parcel.obtain();
3686 data.writeInterfaceToken(IActivityManager.descriptor);
3687 data.writeInt(max);
3688 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3689 reply.readException();
3690 data.recycle();
3691 reply.recycle();
3692 }
3693 public int getProcessLimit() throws RemoteException
3694 {
3695 Parcel data = Parcel.obtain();
3696 Parcel reply = Parcel.obtain();
3697 data.writeInterfaceToken(IActivityManager.descriptor);
3698 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3699 reply.readException();
3700 int res = reply.readInt();
3701 data.recycle();
3702 reply.recycle();
3703 return res;
3704 }
3705 public void setProcessForeground(IBinder token, int pid,
3706 boolean isForeground) throws RemoteException {
3707 Parcel data = Parcel.obtain();
3708 Parcel reply = Parcel.obtain();
3709 data.writeInterfaceToken(IActivityManager.descriptor);
3710 data.writeStrongBinder(token);
3711 data.writeInt(pid);
3712 data.writeInt(isForeground ? 1 : 0);
3713 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3714 reply.readException();
3715 data.recycle();
3716 reply.recycle();
3717 }
3718 public int checkPermission(String permission, int pid, int uid)
3719 throws RemoteException {
3720 Parcel data = Parcel.obtain();
3721 Parcel reply = Parcel.obtain();
3722 data.writeInterfaceToken(IActivityManager.descriptor);
3723 data.writeString(permission);
3724 data.writeInt(pid);
3725 data.writeInt(uid);
3726 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3727 reply.readException();
3728 int res = reply.readInt();
3729 data.recycle();
3730 reply.recycle();
3731 return res;
3732 }
3733 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003734 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003735 Parcel data = Parcel.obtain();
3736 Parcel reply = Parcel.obtain();
3737 data.writeInterfaceToken(IActivityManager.descriptor);
3738 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003739 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003740 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003741 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3742 reply.readException();
3743 boolean res = reply.readInt() != 0;
3744 data.recycle();
3745 reply.recycle();
3746 return res;
3747 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003748 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003749 throws RemoteException {
3750 Parcel data = Parcel.obtain();
3751 Parcel reply = Parcel.obtain();
3752 data.writeInterfaceToken(IActivityManager.descriptor);
3753 uri.writeToParcel(data, 0);
3754 data.writeInt(pid);
3755 data.writeInt(uid);
3756 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003757 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003758 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3759 reply.readException();
3760 int res = reply.readInt();
3761 data.recycle();
3762 reply.recycle();
3763 return res;
3764 }
3765 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003766 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003767 Parcel data = Parcel.obtain();
3768 Parcel reply = Parcel.obtain();
3769 data.writeInterfaceToken(IActivityManager.descriptor);
3770 data.writeStrongBinder(caller.asBinder());
3771 data.writeString(targetPkg);
3772 uri.writeToParcel(data, 0);
3773 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003774 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003775 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3776 reply.readException();
3777 data.recycle();
3778 reply.recycle();
3779 }
3780 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003781 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003782 Parcel data = Parcel.obtain();
3783 Parcel reply = Parcel.obtain();
3784 data.writeInterfaceToken(IActivityManager.descriptor);
3785 data.writeStrongBinder(caller.asBinder());
3786 uri.writeToParcel(data, 0);
3787 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003788 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003789 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3790 reply.readException();
3791 data.recycle();
3792 reply.recycle();
3793 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003794
3795 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003796 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3797 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003798 Parcel data = Parcel.obtain();
3799 Parcel reply = Parcel.obtain();
3800 data.writeInterfaceToken(IActivityManager.descriptor);
3801 uri.writeToParcel(data, 0);
3802 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003803 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003804 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3805 reply.readException();
3806 data.recycle();
3807 reply.recycle();
3808 }
3809
3810 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003811 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3812 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003813 Parcel data = Parcel.obtain();
3814 Parcel reply = Parcel.obtain();
3815 data.writeInterfaceToken(IActivityManager.descriptor);
3816 uri.writeToParcel(data, 0);
3817 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003818 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003819 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3820 reply.readException();
3821 data.recycle();
3822 reply.recycle();
3823 }
3824
3825 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003826 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3827 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003828 Parcel data = Parcel.obtain();
3829 Parcel reply = Parcel.obtain();
3830 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003831 data.writeString(packageName);
3832 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003833 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3834 reply.readException();
3835 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3836 reply);
3837 data.recycle();
3838 reply.recycle();
3839 return perms;
3840 }
3841
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003842 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3843 throws RemoteException {
3844 Parcel data = Parcel.obtain();
3845 Parcel reply = Parcel.obtain();
3846 data.writeInterfaceToken(IActivityManager.descriptor);
3847 data.writeStrongBinder(who.asBinder());
3848 data.writeInt(waiting ? 1 : 0);
3849 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3850 reply.readException();
3851 data.recycle();
3852 reply.recycle();
3853 }
3854 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3855 Parcel data = Parcel.obtain();
3856 Parcel reply = Parcel.obtain();
3857 data.writeInterfaceToken(IActivityManager.descriptor);
3858 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3859 reply.readException();
3860 outInfo.readFromParcel(reply);
3861 data.recycle();
3862 reply.recycle();
3863 }
3864 public void unhandledBack() throws RemoteException
3865 {
3866 Parcel data = Parcel.obtain();
3867 Parcel reply = Parcel.obtain();
3868 data.writeInterfaceToken(IActivityManager.descriptor);
3869 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3870 reply.readException();
3871 data.recycle();
3872 reply.recycle();
3873 }
3874 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3875 {
3876 Parcel data = Parcel.obtain();
3877 Parcel reply = Parcel.obtain();
3878 data.writeInterfaceToken(IActivityManager.descriptor);
3879 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3880 reply.readException();
3881 ParcelFileDescriptor pfd = null;
3882 if (reply.readInt() != 0) {
3883 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3884 }
3885 data.recycle();
3886 reply.recycle();
3887 return pfd;
3888 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003889 public void setLockScreenShown(boolean shown) throws RemoteException
3890 {
3891 Parcel data = Parcel.obtain();
3892 Parcel reply = Parcel.obtain();
3893 data.writeInterfaceToken(IActivityManager.descriptor);
3894 data.writeInt(shown ? 1 : 0);
3895 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3896 reply.readException();
3897 data.recycle();
3898 reply.recycle();
3899 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003900 public void setDebugApp(
3901 String packageName, boolean waitForDebugger, boolean persistent)
3902 throws RemoteException
3903 {
3904 Parcel data = Parcel.obtain();
3905 Parcel reply = Parcel.obtain();
3906 data.writeInterfaceToken(IActivityManager.descriptor);
3907 data.writeString(packageName);
3908 data.writeInt(waitForDebugger ? 1 : 0);
3909 data.writeInt(persistent ? 1 : 0);
3910 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3911 reply.readException();
3912 data.recycle();
3913 reply.recycle();
3914 }
3915 public void setAlwaysFinish(boolean enabled) throws RemoteException
3916 {
3917 Parcel data = Parcel.obtain();
3918 Parcel reply = Parcel.obtain();
3919 data.writeInterfaceToken(IActivityManager.descriptor);
3920 data.writeInt(enabled ? 1 : 0);
3921 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3922 reply.readException();
3923 data.recycle();
3924 reply.recycle();
3925 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003926 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003927 {
3928 Parcel data = Parcel.obtain();
3929 Parcel reply = Parcel.obtain();
3930 data.writeInterfaceToken(IActivityManager.descriptor);
3931 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003932 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003933 reply.readException();
3934 data.recycle();
3935 reply.recycle();
3936 }
3937 public void enterSafeMode() throws RemoteException {
3938 Parcel data = Parcel.obtain();
3939 data.writeInterfaceToken(IActivityManager.descriptor);
3940 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3941 data.recycle();
3942 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003943 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3944 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003945 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003946 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003947 data.writeStrongBinder(sender.asBinder());
3948 data.writeInt(sourceUid);
3949 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003950 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3951 data.recycle();
3952 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003953 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003954 Parcel data = Parcel.obtain();
3955 Parcel reply = Parcel.obtain();
3956 data.writeInterfaceToken(IActivityManager.descriptor);
3957 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003958 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003959 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003960 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003961 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003962 boolean res = reply.readInt() != 0;
3963 data.recycle();
3964 reply.recycle();
3965 return res;
3966 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003967 @Override
3968 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3969 Parcel data = Parcel.obtain();
3970 Parcel reply = Parcel.obtain();
3971 data.writeInterfaceToken(IActivityManager.descriptor);
3972 data.writeString(reason);
3973 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3974 boolean res = reply.readInt() != 0;
3975 data.recycle();
3976 reply.recycle();
3977 return res;
3978 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003979 public boolean testIsSystemReady()
3980 {
3981 /* this base class version is never called */
3982 return true;
3983 }
Dan Egnor60d87622009-12-16 16:32:58 -08003984 public void handleApplicationCrash(IBinder app,
3985 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3986 {
3987 Parcel data = Parcel.obtain();
3988 Parcel reply = Parcel.obtain();
3989 data.writeInterfaceToken(IActivityManager.descriptor);
3990 data.writeStrongBinder(app);
3991 crashInfo.writeToParcel(data, 0);
3992 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3993 reply.readException();
3994 reply.recycle();
3995 data.recycle();
3996 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003997
Dan Egnor60d87622009-12-16 16:32:58 -08003998 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003999 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004000 {
4001 Parcel data = Parcel.obtain();
4002 Parcel reply = Parcel.obtain();
4003 data.writeInterfaceToken(IActivityManager.descriptor);
4004 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004005 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08004006 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004007 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004008 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004009 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004010 reply.recycle();
4011 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004012 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004013 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004014
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004015 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004016 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004017 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004018 {
4019 Parcel data = Parcel.obtain();
4020 Parcel reply = Parcel.obtain();
4021 data.writeInterfaceToken(IActivityManager.descriptor);
4022 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004023 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004024 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004025 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4026 reply.readException();
4027 reply.recycle();
4028 data.recycle();
4029 }
4030
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004031 public void signalPersistentProcesses(int sig) throws RemoteException {
4032 Parcel data = Parcel.obtain();
4033 Parcel reply = Parcel.obtain();
4034 data.writeInterfaceToken(IActivityManager.descriptor);
4035 data.writeInt(sig);
4036 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4037 reply.readException();
4038 data.recycle();
4039 reply.recycle();
4040 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004041
Dianne Hackborn1676c852012-09-10 14:52:30 -07004042 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004043 Parcel data = Parcel.obtain();
4044 Parcel reply = Parcel.obtain();
4045 data.writeInterfaceToken(IActivityManager.descriptor);
4046 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004047 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004048 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4049 reply.readException();
4050 data.recycle();
4051 reply.recycle();
4052 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004053
4054 public void killAllBackgroundProcesses() throws RemoteException {
4055 Parcel data = Parcel.obtain();
4056 Parcel reply = Parcel.obtain();
4057 data.writeInterfaceToken(IActivityManager.descriptor);
4058 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4059 reply.readException();
4060 data.recycle();
4061 reply.recycle();
4062 }
4063
Dianne Hackborn1676c852012-09-10 14:52:30 -07004064 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004065 Parcel data = Parcel.obtain();
4066 Parcel reply = Parcel.obtain();
4067 data.writeInterfaceToken(IActivityManager.descriptor);
4068 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004069 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004070 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004071 reply.readException();
4072 data.recycle();
4073 reply.recycle();
4074 }
4075
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004076 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4077 throws RemoteException
4078 {
4079 Parcel data = Parcel.obtain();
4080 Parcel reply = Parcel.obtain();
4081 data.writeInterfaceToken(IActivityManager.descriptor);
4082 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4083 reply.readException();
4084 outInfo.readFromParcel(reply);
4085 reply.recycle();
4086 data.recycle();
4087 }
4088
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004089 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4090 {
4091 Parcel data = Parcel.obtain();
4092 Parcel reply = Parcel.obtain();
4093 data.writeInterfaceToken(IActivityManager.descriptor);
4094 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4095 reply.readException();
4096 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4097 reply.recycle();
4098 data.recycle();
4099 return res;
4100 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004101
Dianne Hackborn1676c852012-09-10 14:52:30 -07004102 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07004103 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004104 {
4105 Parcel data = Parcel.obtain();
4106 Parcel reply = Parcel.obtain();
4107 data.writeInterfaceToken(IActivityManager.descriptor);
4108 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004109 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004110 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004111 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004112 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004113 if (fd != null) {
4114 data.writeInt(1);
4115 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4116 } else {
4117 data.writeInt(0);
4118 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004119 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4120 reply.readException();
4121 boolean res = reply.readInt() != 0;
4122 reply.recycle();
4123 data.recycle();
4124 return res;
4125 }
4126
Dianne Hackborn55280a92009-05-07 15:53:46 -07004127 public boolean shutdown(int timeout) throws RemoteException
4128 {
4129 Parcel data = Parcel.obtain();
4130 Parcel reply = Parcel.obtain();
4131 data.writeInterfaceToken(IActivityManager.descriptor);
4132 data.writeInt(timeout);
4133 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4134 reply.readException();
4135 boolean res = reply.readInt() != 0;
4136 reply.recycle();
4137 data.recycle();
4138 return res;
4139 }
4140
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004141 public void stopAppSwitches() throws RemoteException {
4142 Parcel data = Parcel.obtain();
4143 Parcel reply = Parcel.obtain();
4144 data.writeInterfaceToken(IActivityManager.descriptor);
4145 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4146 reply.readException();
4147 reply.recycle();
4148 data.recycle();
4149 }
4150
4151 public void resumeAppSwitches() throws RemoteException {
4152 Parcel data = Parcel.obtain();
4153 Parcel reply = Parcel.obtain();
4154 data.writeInterfaceToken(IActivityManager.descriptor);
4155 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4156 reply.readException();
4157 reply.recycle();
4158 data.recycle();
4159 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004160
4161 public void addPackageDependency(String packageName) throws RemoteException {
4162 Parcel data = Parcel.obtain();
4163 Parcel reply = Parcel.obtain();
4164 data.writeInterfaceToken(IActivityManager.descriptor);
4165 data.writeString(packageName);
4166 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4167 reply.readException();
4168 data.recycle();
4169 reply.recycle();
4170 }
4171
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004172 public void killApplicationWithAppId(String pkg, int appid, String reason)
4173 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004174 Parcel data = Parcel.obtain();
4175 Parcel reply = Parcel.obtain();
4176 data.writeInterfaceToken(IActivityManager.descriptor);
4177 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004178 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004179 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004180 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004181 reply.readException();
4182 data.recycle();
4183 reply.recycle();
4184 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004185
4186 public void closeSystemDialogs(String reason) throws RemoteException {
4187 Parcel data = Parcel.obtain();
4188 Parcel reply = Parcel.obtain();
4189 data.writeInterfaceToken(IActivityManager.descriptor);
4190 data.writeString(reason);
4191 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4192 reply.readException();
4193 data.recycle();
4194 reply.recycle();
4195 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004196
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004197 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004198 throws RemoteException {
4199 Parcel data = Parcel.obtain();
4200 Parcel reply = Parcel.obtain();
4201 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004202 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004203 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4204 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004205 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004206 data.recycle();
4207 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004208 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004209 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004210
4211 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4212 Parcel data = Parcel.obtain();
4213 Parcel reply = Parcel.obtain();
4214 data.writeInterfaceToken(IActivityManager.descriptor);
4215 data.writeString(processName);
4216 data.writeInt(uid);
4217 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4218 reply.readException();
4219 data.recycle();
4220 reply.recycle();
4221 }
4222
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004223 public void overridePendingTransition(IBinder token, String packageName,
4224 int enterAnim, int exitAnim) throws RemoteException {
4225 Parcel data = Parcel.obtain();
4226 Parcel reply = Parcel.obtain();
4227 data.writeInterfaceToken(IActivityManager.descriptor);
4228 data.writeStrongBinder(token);
4229 data.writeString(packageName);
4230 data.writeInt(enterAnim);
4231 data.writeInt(exitAnim);
4232 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4233 reply.readException();
4234 data.recycle();
4235 reply.recycle();
4236 }
4237
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004238 public boolean isUserAMonkey() throws RemoteException {
4239 Parcel data = Parcel.obtain();
4240 Parcel reply = Parcel.obtain();
4241 data.writeInterfaceToken(IActivityManager.descriptor);
4242 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4243 reply.readException();
4244 boolean res = reply.readInt() != 0;
4245 data.recycle();
4246 reply.recycle();
4247 return res;
4248 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004249
4250 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4251 Parcel data = Parcel.obtain();
4252 Parcel reply = Parcel.obtain();
4253 data.writeInterfaceToken(IActivityManager.descriptor);
4254 data.writeInt(monkey ? 1 : 0);
4255 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4256 reply.readException();
4257 data.recycle();
4258 reply.recycle();
4259 }
4260
Dianne Hackborn860755f2010-06-03 18:47:52 -07004261 public void finishHeavyWeightApp() throws RemoteException {
4262 Parcel data = Parcel.obtain();
4263 Parcel reply = Parcel.obtain();
4264 data.writeInterfaceToken(IActivityManager.descriptor);
4265 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4266 reply.readException();
4267 data.recycle();
4268 reply.recycle();
4269 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004270
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004271 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004272 throws RemoteException {
4273 Parcel data = Parcel.obtain();
4274 Parcel reply = Parcel.obtain();
4275 data.writeInterfaceToken(IActivityManager.descriptor);
4276 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004277 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4278 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004279 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004280 data.recycle();
4281 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004282 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004283 }
4284
Craig Mautner233ceee2014-05-09 17:05:11 -07004285 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004286 throws RemoteException {
4287 Parcel data = Parcel.obtain();
4288 Parcel reply = Parcel.obtain();
4289 data.writeInterfaceToken(IActivityManager.descriptor);
4290 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004291 if (options == null) {
4292 data.writeInt(0);
4293 } else {
4294 data.writeInt(1);
4295 data.writeBundle(options.toBundle());
4296 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004297 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004298 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004299 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004300 data.recycle();
4301 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004302 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004303 }
4304
Craig Mautner233ceee2014-05-09 17:05:11 -07004305 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4306 Parcel data = Parcel.obtain();
4307 Parcel reply = Parcel.obtain();
4308 data.writeInterfaceToken(IActivityManager.descriptor);
4309 data.writeStrongBinder(token);
4310 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4311 reply.readException();
4312 Bundle bundle = reply.readBundle();
4313 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4314 data.recycle();
4315 reply.recycle();
4316 return options;
4317 }
4318
Daniel Sandler69a48172010-06-23 16:29:36 -04004319 public void setImmersive(IBinder token, boolean immersive)
4320 throws RemoteException {
4321 Parcel data = Parcel.obtain();
4322 Parcel reply = Parcel.obtain();
4323 data.writeInterfaceToken(IActivityManager.descriptor);
4324 data.writeStrongBinder(token);
4325 data.writeInt(immersive ? 1 : 0);
4326 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4327 reply.readException();
4328 data.recycle();
4329 reply.recycle();
4330 }
4331
4332 public boolean isImmersive(IBinder token)
4333 throws RemoteException {
4334 Parcel data = Parcel.obtain();
4335 Parcel reply = Parcel.obtain();
4336 data.writeInterfaceToken(IActivityManager.descriptor);
4337 data.writeStrongBinder(token);
4338 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004339 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004340 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004341 data.recycle();
4342 reply.recycle();
4343 return res;
4344 }
4345
Craig Mautnerd61dc202014-07-07 11:09:11 -07004346 public boolean isTopOfTask(IBinder token) throws RemoteException {
4347 Parcel data = Parcel.obtain();
4348 Parcel reply = Parcel.obtain();
4349 data.writeInterfaceToken(IActivityManager.descriptor);
4350 data.writeStrongBinder(token);
4351 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4352 reply.readException();
4353 boolean res = reply.readInt() == 1;
4354 data.recycle();
4355 reply.recycle();
4356 return res;
4357 }
4358
Daniel Sandler69a48172010-06-23 16:29:36 -04004359 public boolean isTopActivityImmersive()
4360 throws RemoteException {
4361 Parcel data = Parcel.obtain();
4362 Parcel reply = Parcel.obtain();
4363 data.writeInterfaceToken(IActivityManager.descriptor);
4364 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004365 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004366 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004367 data.recycle();
4368 reply.recycle();
4369 return res;
4370 }
4371
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004372 public void crashApplication(int uid, int initialPid, String packageName,
4373 String message) throws RemoteException {
4374 Parcel data = Parcel.obtain();
4375 Parcel reply = Parcel.obtain();
4376 data.writeInterfaceToken(IActivityManager.descriptor);
4377 data.writeInt(uid);
4378 data.writeInt(initialPid);
4379 data.writeString(packageName);
4380 data.writeString(message);
4381 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4382 reply.readException();
4383 data.recycle();
4384 reply.recycle();
4385 }
Andy McFadden824c5102010-07-09 16:26:57 -07004386
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004387 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004388 Parcel data = Parcel.obtain();
4389 Parcel reply = Parcel.obtain();
4390 data.writeInterfaceToken(IActivityManager.descriptor);
4391 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004392 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004393 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4394 reply.readException();
4395 String res = reply.readString();
4396 data.recycle();
4397 reply.recycle();
4398 return res;
4399 }
4400
Dianne Hackborn7e269642010-08-25 19:50:20 -07004401 public IBinder newUriPermissionOwner(String name)
4402 throws RemoteException {
4403 Parcel data = Parcel.obtain();
4404 Parcel reply = Parcel.obtain();
4405 data.writeInterfaceToken(IActivityManager.descriptor);
4406 data.writeString(name);
4407 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4408 reply.readException();
4409 IBinder res = reply.readStrongBinder();
4410 data.recycle();
4411 reply.recycle();
4412 return res;
4413 }
4414
4415 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004416 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004417 Parcel data = Parcel.obtain();
4418 Parcel reply = Parcel.obtain();
4419 data.writeInterfaceToken(IActivityManager.descriptor);
4420 data.writeStrongBinder(owner);
4421 data.writeInt(fromUid);
4422 data.writeString(targetPkg);
4423 uri.writeToParcel(data, 0);
4424 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004425 data.writeInt(sourceUserId);
4426 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004427 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4428 reply.readException();
4429 data.recycle();
4430 reply.recycle();
4431 }
4432
4433 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004434 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004435 Parcel data = Parcel.obtain();
4436 Parcel reply = Parcel.obtain();
4437 data.writeInterfaceToken(IActivityManager.descriptor);
4438 data.writeStrongBinder(owner);
4439 if (uri != null) {
4440 data.writeInt(1);
4441 uri.writeToParcel(data, 0);
4442 } else {
4443 data.writeInt(0);
4444 }
4445 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004446 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004447 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4448 reply.readException();
4449 data.recycle();
4450 reply.recycle();
4451 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004452
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004453 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004454 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004455 Parcel data = Parcel.obtain();
4456 Parcel reply = Parcel.obtain();
4457 data.writeInterfaceToken(IActivityManager.descriptor);
4458 data.writeInt(callingUid);
4459 data.writeString(targetPkg);
4460 uri.writeToParcel(data, 0);
4461 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004462 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004463 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4464 reply.readException();
4465 int res = reply.readInt();
4466 data.recycle();
4467 reply.recycle();
4468 return res;
4469 }
4470
Dianne Hackborn1676c852012-09-10 14:52:30 -07004471 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004472 String path, ParcelFileDescriptor fd) throws RemoteException {
4473 Parcel data = Parcel.obtain();
4474 Parcel reply = Parcel.obtain();
4475 data.writeInterfaceToken(IActivityManager.descriptor);
4476 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004477 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004478 data.writeInt(managed ? 1 : 0);
4479 data.writeString(path);
4480 if (fd != null) {
4481 data.writeInt(1);
4482 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4483 } else {
4484 data.writeInt(0);
4485 }
4486 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4487 reply.readException();
4488 boolean res = reply.readInt() != 0;
4489 reply.recycle();
4490 data.recycle();
4491 return res;
4492 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004493
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004494 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004495 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004496 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004497 Parcel data = Parcel.obtain();
4498 Parcel reply = Parcel.obtain();
4499 data.writeInterfaceToken(IActivityManager.descriptor);
4500 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004501 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004502 data.writeTypedArray(intents, 0);
4503 data.writeStringArray(resolvedTypes);
4504 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004505 if (options != null) {
4506 data.writeInt(1);
4507 options.writeToParcel(data, 0);
4508 } else {
4509 data.writeInt(0);
4510 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004511 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004512 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4513 reply.readException();
4514 int result = reply.readInt();
4515 reply.recycle();
4516 data.recycle();
4517 return result;
4518 }
4519
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004520 public int getFrontActivityScreenCompatMode() throws RemoteException {
4521 Parcel data = Parcel.obtain();
4522 Parcel reply = Parcel.obtain();
4523 data.writeInterfaceToken(IActivityManager.descriptor);
4524 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4525 reply.readException();
4526 int mode = reply.readInt();
4527 reply.recycle();
4528 data.recycle();
4529 return mode;
4530 }
4531
4532 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4533 Parcel data = Parcel.obtain();
4534 Parcel reply = Parcel.obtain();
4535 data.writeInterfaceToken(IActivityManager.descriptor);
4536 data.writeInt(mode);
4537 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4538 reply.readException();
4539 reply.recycle();
4540 data.recycle();
4541 }
4542
4543 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4544 Parcel data = Parcel.obtain();
4545 Parcel reply = Parcel.obtain();
4546 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004547 data.writeString(packageName);
4548 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004549 reply.readException();
4550 int mode = reply.readInt();
4551 reply.recycle();
4552 data.recycle();
4553 return mode;
4554 }
4555
4556 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004557 throws RemoteException {
4558 Parcel data = Parcel.obtain();
4559 Parcel reply = Parcel.obtain();
4560 data.writeInterfaceToken(IActivityManager.descriptor);
4561 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004562 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004563 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4564 reply.readException();
4565 reply.recycle();
4566 data.recycle();
4567 }
4568
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004569 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4570 Parcel data = Parcel.obtain();
4571 Parcel reply = Parcel.obtain();
4572 data.writeInterfaceToken(IActivityManager.descriptor);
4573 data.writeString(packageName);
4574 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4575 reply.readException();
4576 boolean ask = reply.readInt() != 0;
4577 reply.recycle();
4578 data.recycle();
4579 return ask;
4580 }
4581
4582 public void setPackageAskScreenCompat(String packageName, boolean ask)
4583 throws RemoteException {
4584 Parcel data = Parcel.obtain();
4585 Parcel reply = Parcel.obtain();
4586 data.writeInterfaceToken(IActivityManager.descriptor);
4587 data.writeString(packageName);
4588 data.writeInt(ask ? 1 : 0);
4589 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4590 reply.readException();
4591 reply.recycle();
4592 data.recycle();
4593 }
4594
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004595 public boolean switchUser(int userid) throws RemoteException {
4596 Parcel data = Parcel.obtain();
4597 Parcel reply = Parcel.obtain();
4598 data.writeInterfaceToken(IActivityManager.descriptor);
4599 data.writeInt(userid);
4600 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4601 reply.readException();
4602 boolean result = reply.readInt() != 0;
4603 reply.recycle();
4604 data.recycle();
4605 return result;
4606 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004607
Kenny Guy08488bf2014-02-21 17:40:37 +00004608 public boolean startUserInBackground(int userid) throws RemoteException {
4609 Parcel data = Parcel.obtain();
4610 Parcel reply = Parcel.obtain();
4611 data.writeInterfaceToken(IActivityManager.descriptor);
4612 data.writeInt(userid);
4613 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4614 reply.readException();
4615 boolean result = reply.readInt() != 0;
4616 reply.recycle();
4617 data.recycle();
4618 return result;
4619 }
4620
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004621 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4622 Parcel data = Parcel.obtain();
4623 Parcel reply = Parcel.obtain();
4624 data.writeInterfaceToken(IActivityManager.descriptor);
4625 data.writeInt(userid);
4626 data.writeStrongInterface(callback);
4627 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4628 reply.readException();
4629 int result = reply.readInt();
4630 reply.recycle();
4631 data.recycle();
4632 return result;
4633 }
4634
Amith Yamasani52f1d752012-03-28 18:19:29 -07004635 public UserInfo getCurrentUser() throws RemoteException {
4636 Parcel data = Parcel.obtain();
4637 Parcel reply = Parcel.obtain();
4638 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004639 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004640 reply.readException();
4641 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4642 reply.recycle();
4643 data.recycle();
4644 return userInfo;
4645 }
4646
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004647 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004648 Parcel data = Parcel.obtain();
4649 Parcel reply = Parcel.obtain();
4650 data.writeInterfaceToken(IActivityManager.descriptor);
4651 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004652 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004653 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4654 reply.readException();
4655 boolean result = reply.readInt() != 0;
4656 reply.recycle();
4657 data.recycle();
4658 return result;
4659 }
4660
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004661 public int[] getRunningUserIds() throws RemoteException {
4662 Parcel data = Parcel.obtain();
4663 Parcel reply = Parcel.obtain();
4664 data.writeInterfaceToken(IActivityManager.descriptor);
4665 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4666 reply.readException();
4667 int[] result = reply.createIntArray();
4668 reply.recycle();
4669 data.recycle();
4670 return result;
4671 }
4672
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004673 public boolean removeTask(int taskId, int flags) throws RemoteException {
4674 Parcel data = Parcel.obtain();
4675 Parcel reply = Parcel.obtain();
4676 data.writeInterfaceToken(IActivityManager.descriptor);
4677 data.writeInt(taskId);
4678 data.writeInt(flags);
4679 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4680 reply.readException();
4681 boolean result = reply.readInt() != 0;
4682 reply.recycle();
4683 data.recycle();
4684 return result;
4685 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004686
Jeff Sharkeya4620792011-05-20 15:29:23 -07004687 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4688 Parcel data = Parcel.obtain();
4689 Parcel reply = Parcel.obtain();
4690 data.writeInterfaceToken(IActivityManager.descriptor);
4691 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4692 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4693 reply.readException();
4694 data.recycle();
4695 reply.recycle();
4696 }
4697
4698 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4699 Parcel data = Parcel.obtain();
4700 Parcel reply = Parcel.obtain();
4701 data.writeInterfaceToken(IActivityManager.descriptor);
4702 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4703 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4704 reply.readException();
4705 data.recycle();
4706 reply.recycle();
4707 }
4708
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004709 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4710 Parcel data = Parcel.obtain();
4711 Parcel reply = Parcel.obtain();
4712 data.writeInterfaceToken(IActivityManager.descriptor);
4713 data.writeStrongBinder(sender.asBinder());
4714 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4715 reply.readException();
4716 boolean res = reply.readInt() != 0;
4717 data.recycle();
4718 reply.recycle();
4719 return res;
4720 }
4721
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004722 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4723 Parcel data = Parcel.obtain();
4724 Parcel reply = Parcel.obtain();
4725 data.writeInterfaceToken(IActivityManager.descriptor);
4726 data.writeStrongBinder(sender.asBinder());
4727 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4728 reply.readException();
4729 boolean res = reply.readInt() != 0;
4730 data.recycle();
4731 reply.recycle();
4732 return res;
4733 }
4734
Dianne Hackborn81038902012-11-26 17:04:09 -08004735 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4736 Parcel data = Parcel.obtain();
4737 Parcel reply = Parcel.obtain();
4738 data.writeInterfaceToken(IActivityManager.descriptor);
4739 data.writeStrongBinder(sender.asBinder());
4740 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4741 reply.readException();
4742 Intent res = reply.readInt() != 0
4743 ? Intent.CREATOR.createFromParcel(reply) : null;
4744 data.recycle();
4745 reply.recycle();
4746 return res;
4747 }
4748
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004749 public String getTagForIntentSender(IIntentSender sender, String prefix)
4750 throws RemoteException {
4751 Parcel data = Parcel.obtain();
4752 Parcel reply = Parcel.obtain();
4753 data.writeInterfaceToken(IActivityManager.descriptor);
4754 data.writeStrongBinder(sender.asBinder());
4755 data.writeString(prefix);
4756 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4757 reply.readException();
4758 String res = reply.readString();
4759 data.recycle();
4760 reply.recycle();
4761 return res;
4762 }
4763
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004764 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4765 {
4766 Parcel data = Parcel.obtain();
4767 Parcel reply = Parcel.obtain();
4768 data.writeInterfaceToken(IActivityManager.descriptor);
4769 values.writeToParcel(data, 0);
4770 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4771 reply.readException();
4772 data.recycle();
4773 reply.recycle();
4774 }
4775
Dianne Hackbornb437e092011-08-05 17:50:29 -07004776 public long[] getProcessPss(int[] pids) throws RemoteException {
4777 Parcel data = Parcel.obtain();
4778 Parcel reply = Parcel.obtain();
4779 data.writeInterfaceToken(IActivityManager.descriptor);
4780 data.writeIntArray(pids);
4781 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4782 reply.readException();
4783 long[] res = reply.createLongArray();
4784 data.recycle();
4785 reply.recycle();
4786 return res;
4787 }
4788
Dianne Hackborn661cd522011-08-22 00:26:20 -07004789 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4790 Parcel data = Parcel.obtain();
4791 Parcel reply = Parcel.obtain();
4792 data.writeInterfaceToken(IActivityManager.descriptor);
4793 TextUtils.writeToParcel(msg, data, 0);
4794 data.writeInt(always ? 1 : 0);
4795 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4796 reply.readException();
4797 data.recycle();
4798 reply.recycle();
4799 }
4800
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004801 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004802 Parcel data = Parcel.obtain();
4803 Parcel reply = Parcel.obtain();
4804 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004805 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004806 reply.readException();
4807 data.recycle();
4808 reply.recycle();
4809 }
4810
Adam Powelldd8fab22012-03-22 17:47:27 -07004811 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4812 throws RemoteException {
4813 Parcel data = Parcel.obtain();
4814 Parcel reply = Parcel.obtain();
4815 data.writeInterfaceToken(IActivityManager.descriptor);
4816 data.writeStrongBinder(token);
4817 data.writeString(destAffinity);
4818 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4819 reply.readException();
4820 boolean result = reply.readInt() != 0;
4821 data.recycle();
4822 reply.recycle();
4823 return result;
4824 }
4825
4826 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4827 throws RemoteException {
4828 Parcel data = Parcel.obtain();
4829 Parcel reply = Parcel.obtain();
4830 data.writeInterfaceToken(IActivityManager.descriptor);
4831 data.writeStrongBinder(token);
4832 target.writeToParcel(data, 0);
4833 data.writeInt(resultCode);
4834 if (resultData != null) {
4835 data.writeInt(1);
4836 resultData.writeToParcel(data, 0);
4837 } else {
4838 data.writeInt(0);
4839 }
4840 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4841 reply.readException();
4842 boolean result = reply.readInt() != 0;
4843 data.recycle();
4844 reply.recycle();
4845 return result;
4846 }
4847
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004848 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4849 Parcel data = Parcel.obtain();
4850 Parcel reply = Parcel.obtain();
4851 data.writeInterfaceToken(IActivityManager.descriptor);
4852 data.writeStrongBinder(activityToken);
4853 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4854 reply.readException();
4855 int result = reply.readInt();
4856 data.recycle();
4857 reply.recycle();
4858 return result;
4859 }
4860
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004861 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4862 Parcel data = Parcel.obtain();
4863 Parcel reply = Parcel.obtain();
4864 data.writeInterfaceToken(IActivityManager.descriptor);
4865 data.writeStrongBinder(activityToken);
4866 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4867 reply.readException();
4868 String result = reply.readString();
4869 data.recycle();
4870 reply.recycle();
4871 return result;
4872 }
4873
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004874 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4875 Parcel data = Parcel.obtain();
4876 Parcel reply = Parcel.obtain();
4877 data.writeInterfaceToken(IActivityManager.descriptor);
4878 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4879 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4880 reply.readException();
4881 data.recycle();
4882 reply.recycle();
4883 }
4884
4885 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4886 Parcel data = Parcel.obtain();
4887 Parcel reply = Parcel.obtain();
4888 data.writeInterfaceToken(IActivityManager.descriptor);
4889 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4890 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4891 reply.readException();
4892 data.recycle();
4893 reply.recycle();
4894 }
4895
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004896 public void requestBugReport() throws RemoteException {
4897 Parcel data = Parcel.obtain();
4898 Parcel reply = Parcel.obtain();
4899 data.writeInterfaceToken(IActivityManager.descriptor);
4900 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4901 reply.readException();
4902 data.recycle();
4903 reply.recycle();
4904 }
4905
Jeff Brownbd181bb2013-09-10 16:44:24 -07004906 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4907 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004908 Parcel data = Parcel.obtain();
4909 Parcel reply = Parcel.obtain();
4910 data.writeInterfaceToken(IActivityManager.descriptor);
4911 data.writeInt(pid);
4912 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004913 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004914 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4915 reply.readException();
4916 long res = reply.readInt();
4917 data.recycle();
4918 reply.recycle();
4919 return res;
4920 }
4921
Adam Skorydfc7fd72013-08-05 19:23:41 -07004922 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004923 Parcel data = Parcel.obtain();
4924 Parcel reply = Parcel.obtain();
4925 data.writeInterfaceToken(IActivityManager.descriptor);
4926 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004927 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004928 reply.readException();
4929 Bundle res = reply.readBundle();
4930 data.recycle();
4931 reply.recycle();
4932 return res;
4933 }
4934
Adam Skory7140a252013-09-11 12:04:58 +01004935 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004936 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004937 Parcel data = Parcel.obtain();
4938 Parcel reply = Parcel.obtain();
4939 data.writeInterfaceToken(IActivityManager.descriptor);
4940 data.writeStrongBinder(token);
4941 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004942 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004943 reply.readException();
4944 data.recycle();
4945 reply.recycle();
4946 }
4947
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004948 public void killUid(int uid, String reason) throws RemoteException {
4949 Parcel data = Parcel.obtain();
4950 Parcel reply = Parcel.obtain();
4951 data.writeInterfaceToken(IActivityManager.descriptor);
4952 data.writeInt(uid);
4953 data.writeString(reason);
4954 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4955 reply.readException();
4956 data.recycle();
4957 reply.recycle();
4958 }
4959
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004960 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4961 Parcel data = Parcel.obtain();
4962 Parcel reply = Parcel.obtain();
4963 data.writeInterfaceToken(IActivityManager.descriptor);
4964 data.writeStrongBinder(who);
4965 data.writeInt(allowRestart ? 1 : 0);
4966 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4967 reply.readException();
4968 data.recycle();
4969 reply.recycle();
4970 }
4971
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004972 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4973 Parcel data = Parcel.obtain();
4974 Parcel reply = Parcel.obtain();
4975 data.writeInterfaceToken(IActivityManager.descriptor);
4976 data.writeStrongBinder(token);
4977 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4978 reply.readException();
4979 data.recycle();
4980 reply.recycle();
4981 }
4982
Craig Mautner5eda9b32013-07-02 11:58:16 -07004983 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4984 Parcel data = Parcel.obtain();
4985 Parcel reply = Parcel.obtain();
4986 data.writeInterfaceToken(IActivityManager.descriptor);
4987 data.writeStrongBinder(token);
4988 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4989 reply.readException();
4990 data.recycle();
4991 reply.recycle();
4992 }
4993
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004994 public void restart() throws RemoteException {
4995 Parcel data = Parcel.obtain();
4996 Parcel reply = Parcel.obtain();
4997 data.writeInterfaceToken(IActivityManager.descriptor);
4998 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4999 reply.readException();
5000 data.recycle();
5001 reply.recycle();
5002 }
5003
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005004 public void performIdleMaintenance() throws RemoteException {
5005 Parcel data = Parcel.obtain();
5006 Parcel reply = Parcel.obtain();
5007 data.writeInterfaceToken(IActivityManager.descriptor);
5008 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5009 reply.readException();
5010 data.recycle();
5011 reply.recycle();
5012 }
5013
Craig Mautner4a1cb222013-12-04 16:14:06 -08005014 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
5015 IActivityContainerCallback callback) throws RemoteException {
5016 Parcel data = Parcel.obtain();
5017 Parcel reply = Parcel.obtain();
5018 data.writeInterfaceToken(IActivityManager.descriptor);
5019 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005020 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08005021 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5022 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005023 final int result = reply.readInt();
5024 final IActivityContainer res;
5025 if (result == 1) {
5026 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5027 } else {
5028 res = null;
5029 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005030 data.recycle();
5031 reply.recycle();
5032 return res;
5033 }
5034
Craig Mautner95da1082014-02-24 17:54:35 -08005035 public void deleteActivityContainer(IActivityContainer activityContainer)
5036 throws RemoteException {
5037 Parcel data = Parcel.obtain();
5038 Parcel reply = Parcel.obtain();
5039 data.writeInterfaceToken(IActivityManager.descriptor);
5040 data.writeStrongBinder(activityContainer.asBinder());
5041 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5042 reply.readException();
5043 data.recycle();
5044 reply.recycle();
5045 }
5046
Craig Mautnere0a38842013-12-16 16:14:02 -08005047 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
5048 throws RemoteException {
5049 Parcel data = Parcel.obtain();
5050 Parcel reply = Parcel.obtain();
5051 data.writeInterfaceToken(IActivityManager.descriptor);
5052 data.writeStrongBinder(activityToken);
5053 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5054 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005055 final int result = reply.readInt();
5056 final IActivityContainer res;
5057 if (result == 1) {
5058 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5059 } else {
5060 res = null;
5061 }
Craig Mautnere0a38842013-12-16 16:14:02 -08005062 data.recycle();
5063 reply.recycle();
5064 return res;
5065 }
5066
Craig Mautner4a1cb222013-12-04 16:14:06 -08005067 public IBinder getHomeActivityToken() throws RemoteException {
5068 Parcel data = Parcel.obtain();
5069 Parcel reply = Parcel.obtain();
5070 data.writeInterfaceToken(IActivityManager.descriptor);
5071 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5072 reply.readException();
5073 IBinder res = reply.readStrongBinder();
5074 data.recycle();
5075 reply.recycle();
5076 return res;
5077 }
5078
Craig Mautneraea74a52014-03-08 14:23:10 -08005079 @Override
5080 public void startLockTaskMode(int taskId) throws RemoteException {
5081 Parcel data = Parcel.obtain();
5082 Parcel reply = Parcel.obtain();
5083 data.writeInterfaceToken(IActivityManager.descriptor);
5084 data.writeInt(taskId);
5085 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5086 reply.readException();
5087 data.recycle();
5088 reply.recycle();
5089 }
5090
5091 @Override
5092 public void startLockTaskMode(IBinder token) throws RemoteException {
5093 Parcel data = Parcel.obtain();
5094 Parcel reply = Parcel.obtain();
5095 data.writeInterfaceToken(IActivityManager.descriptor);
5096 data.writeStrongBinder(token);
5097 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5098 reply.readException();
5099 data.recycle();
5100 reply.recycle();
5101 }
5102
5103 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005104 public void startLockTaskModeOnCurrent() throws RemoteException {
5105 Parcel data = Parcel.obtain();
5106 Parcel reply = Parcel.obtain();
5107 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005108 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005109 reply.readException();
5110 data.recycle();
5111 reply.recycle();
5112 }
5113
5114 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005115 public void stopLockTaskMode() throws RemoteException {
5116 Parcel data = Parcel.obtain();
5117 Parcel reply = Parcel.obtain();
5118 data.writeInterfaceToken(IActivityManager.descriptor);
5119 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5120 reply.readException();
5121 data.recycle();
5122 reply.recycle();
5123 }
5124
5125 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005126 public void stopLockTaskModeOnCurrent() throws RemoteException {
5127 Parcel data = Parcel.obtain();
5128 Parcel reply = Parcel.obtain();
5129 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005130 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005131 reply.readException();
5132 data.recycle();
5133 reply.recycle();
5134 }
5135
5136 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005137 public boolean isInLockTaskMode() throws RemoteException {
5138 Parcel data = Parcel.obtain();
5139 Parcel reply = Parcel.obtain();
5140 data.writeInterfaceToken(IActivityManager.descriptor);
5141 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5142 reply.readException();
5143 boolean isInLockTaskMode = reply.readInt() == 1;
5144 data.recycle();
5145 reply.recycle();
5146 return isInLockTaskMode;
5147 }
5148
Craig Mautner688b5102014-03-27 16:55:03 -07005149 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005150 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005151 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005152 Parcel data = Parcel.obtain();
5153 Parcel reply = Parcel.obtain();
5154 data.writeInterfaceToken(IActivityManager.descriptor);
5155 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005156 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005157 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005158 reply.readException();
5159 data.recycle();
5160 reply.recycle();
5161 }
5162
Craig Mautneree2e45a2014-06-27 12:10:03 -07005163 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005164 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005165 Parcel data = Parcel.obtain();
5166 Parcel reply = Parcel.obtain();
5167 data.writeInterfaceToken(IActivityManager.descriptor);
5168 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005169 data.writeInt(visible ? 1 : 0);
5170 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005171 reply.readException();
5172 boolean success = reply.readInt() > 0;
5173 data.recycle();
5174 reply.recycle();
5175 return success;
5176 }
5177
5178 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005179 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005180 Parcel data = Parcel.obtain();
5181 Parcel reply = Parcel.obtain();
5182 data.writeInterfaceToken(IActivityManager.descriptor);
5183 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005184 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005185 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005186 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005187 data.recycle();
5188 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005189 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005190 }
5191
5192 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005193 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005194 Parcel data = Parcel.obtain();
5195 Parcel reply = Parcel.obtain();
5196 data.writeInterfaceToken(IActivityManager.descriptor);
5197 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005198 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5199 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005200 reply.readException();
5201 data.recycle();
5202 reply.recycle();
5203 }
5204
5205 @Override
5206 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5207 Parcel data = Parcel.obtain();
5208 Parcel reply = Parcel.obtain();
5209 data.writeInterfaceToken(IActivityManager.descriptor);
5210 data.writeStrongBinder(token);
5211 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5212 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005213 reply.readException();
5214 data.recycle();
5215 reply.recycle();
5216 }
5217
Craig Mautner8746a472014-07-24 15:12:54 -07005218 @Override
5219 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5220 Parcel data = Parcel.obtain();
5221 Parcel reply = Parcel.obtain();
5222 data.writeInterfaceToken(IActivityManager.descriptor);
5223 data.writeStrongBinder(token);
5224 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5225 IBinder.FLAG_ONEWAY);
5226 reply.readException();
5227 data.recycle();
5228 reply.recycle();
5229 }
5230
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005231 private IBinder mRemote;
5232}