blob: e94cdae11a61571a6a7e9f8f81d3f034ddd38e6c [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;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070033import android.graphics.Bitmap;
34import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080035import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036import android.net.Uri;
37import android.os.Binder;
38import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070039import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.os.IBinder;
41import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070042import android.os.ParcelFileDescriptor;
43import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070044import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070045import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070047import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070048import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080051import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070052import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054import java.util.ArrayList;
55import java.util.List;
56
57/** {@hide} */
58public abstract class ActivityManagerNative extends Binder implements IActivityManager
59{
60 /**
61 * Cast a Binder object into an activity manager interface, generating
62 * a proxy if needed.
63 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080064 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080065 if (obj == null) {
66 return null;
67 }
68 IActivityManager in =
69 (IActivityManager)obj.queryLocalInterface(descriptor);
70 if (in != null) {
71 return in;
72 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080073
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 return new ActivityManagerProxy(obj);
75 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 /**
78 * Retrieve the system's default/global activity manager.
79 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080080 static public IActivityManager getDefault() {
81 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082 }
83
84 /**
85 * Convenience for checking whether the system is ready. For internal use only.
86 */
87 static public boolean isSystemReady() {
88 if (!sSystemReady) {
89 sSystemReady = getDefault().testIsSystemReady();
90 }
91 return sSystemReady;
92 }
93 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080094
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095 /**
96 * Convenience for sending a sticky broadcast. For internal use only.
97 * If you don't care about permission, use null.
98 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070099 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100 try {
101 getDefault().broadcastIntent(
102 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800103 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800104 } catch (RemoteException ex) {
105 }
106 }
107
Dianne Hackborn099bc622014-01-22 13:39:16 -0800108 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800110 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800111 } catch (RemoteException ex) {
112 }
113 }
114
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800115 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800116 attachInterface(this, descriptor);
117 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700118
119 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
121 throws RemoteException {
122 switch (code) {
123 case START_ACTIVITY_TRANSACTION:
124 {
125 data.enforceInterface(IActivityManager.descriptor);
126 IBinder b = data.readStrongBinder();
127 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800128 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 Intent intent = Intent.CREATOR.createFromParcel(data);
130 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800132 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800133 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700134 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700135 ProfilerInfo profilerInfo = data.readInt() != 0
136 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700137 Bundle options = data.readInt() != 0
138 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800139 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700140 resultTo, resultWho, requestCode, startFlags, profilerInfo, 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();
Jeff Hao1b012d32014-08-20 10:35:34 -0700158 ProfilerInfo profilerInfo = data.readInt() != 0
159 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700160 Bundle options = data.readInt() != 0
161 ? Bundle.CREATOR.createFromParcel(data) : null;
162 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800163 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700164 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700165 reply.writeNoException();
166 reply.writeInt(result);
167 return true;
168 }
169
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700170 case START_ACTIVITY_AS_CALLER_TRANSACTION:
171 {
172 data.enforceInterface(IActivityManager.descriptor);
173 IBinder b = data.readStrongBinder();
174 IApplicationThread app = ApplicationThreadNative.asInterface(b);
175 String callingPackage = data.readString();
176 Intent intent = Intent.CREATOR.createFromParcel(data);
177 String resolvedType = data.readString();
178 IBinder resultTo = data.readStrongBinder();
179 String resultWho = data.readString();
180 int requestCode = data.readInt();
181 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700182 ProfilerInfo profilerInfo = data.readInt() != 0
183 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700184 Bundle options = data.readInt() != 0
185 ? Bundle.CREATOR.createFromParcel(data) : null;
Jeff Sharkey97978802014-10-14 10:48:18 -0700186 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700187 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Jeff Sharkey97978802014-10-14 10:48:18 -0700188 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700189 reply.writeNoException();
190 reply.writeInt(result);
191 return true;
192 }
193
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800194 case START_ACTIVITY_AND_WAIT_TRANSACTION:
195 {
196 data.enforceInterface(IActivityManager.descriptor);
197 IBinder b = data.readStrongBinder();
198 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800199 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800200 Intent intent = Intent.CREATOR.createFromParcel(data);
201 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800202 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800203 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800204 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700205 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700206 ProfilerInfo profilerInfo = data.readInt() != 0
207 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700208 Bundle options = data.readInt() != 0
209 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700210 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800211 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700212 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800213 reply.writeNoException();
214 result.writeToParcel(reply, 0);
215 return true;
216 }
217
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700218 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
219 {
220 data.enforceInterface(IActivityManager.descriptor);
221 IBinder b = data.readStrongBinder();
222 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800223 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700224 Intent intent = Intent.CREATOR.createFromParcel(data);
225 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700226 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700227 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700228 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700229 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700230 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 Bundle options = data.readInt() != 0
232 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700233 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800234 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700235 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700236 reply.writeNoException();
237 reply.writeInt(result);
238 return true;
239 }
240
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700241 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700242 {
243 data.enforceInterface(IActivityManager.descriptor);
244 IBinder b = data.readStrongBinder();
245 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700246 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700247 Intent fillInIntent = null;
248 if (data.readInt() != 0) {
249 fillInIntent = Intent.CREATOR.createFromParcel(data);
250 }
251 String resolvedType = data.readString();
252 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700253 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700254 int requestCode = data.readInt();
255 int flagsMask = data.readInt();
256 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700257 Bundle options = data.readInt() != 0
258 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700259 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700260 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700261 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700262 reply.writeNoException();
263 reply.writeInt(result);
264 return true;
265 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700266
Dianne Hackborn91097de2014-04-04 18:02:06 -0700267 case START_VOICE_ACTIVITY_TRANSACTION:
268 {
269 data.enforceInterface(IActivityManager.descriptor);
270 String callingPackage = data.readString();
271 int callingPid = data.readInt();
272 int callingUid = data.readInt();
273 Intent intent = Intent.CREATOR.createFromParcel(data);
274 String resolvedType = data.readString();
275 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
276 data.readStrongBinder());
277 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
278 data.readStrongBinder());
279 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700280 ProfilerInfo profilerInfo = data.readInt() != 0
281 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700282 Bundle options = data.readInt() != 0
283 ? Bundle.CREATOR.createFromParcel(data) : null;
284 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700285 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
286 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700287 reply.writeNoException();
288 reply.writeInt(result);
289 return true;
290 }
291
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800292 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
293 {
294 data.enforceInterface(IActivityManager.descriptor);
295 IBinder callingActivity = data.readStrongBinder();
296 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700297 Bundle options = data.readInt() != 0
298 ? Bundle.CREATOR.createFromParcel(data) : null;
299 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800300 reply.writeNoException();
301 reply.writeInt(result ? 1 : 0);
302 return true;
303 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700304
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700305 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
306 {
307 data.enforceInterface(IActivityManager.descriptor);
308 int taskId = data.readInt();
309 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
310 int result = startActivityFromRecents(taskId, options);
311 reply.writeNoException();
312 reply.writeInt(result);
313 return true;
314 }
315
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800316 case FINISH_ACTIVITY_TRANSACTION: {
317 data.enforceInterface(IActivityManager.descriptor);
318 IBinder token = data.readStrongBinder();
319 Intent resultData = null;
320 int resultCode = data.readInt();
321 if (data.readInt() != 0) {
322 resultData = Intent.CREATOR.createFromParcel(data);
323 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700324 boolean finishTask = (data.readInt() != 0);
325 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 reply.writeNoException();
327 reply.writeInt(res ? 1 : 0);
328 return true;
329 }
330
331 case FINISH_SUB_ACTIVITY_TRANSACTION: {
332 data.enforceInterface(IActivityManager.descriptor);
333 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700334 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800335 int requestCode = data.readInt();
336 finishSubActivity(token, resultWho, requestCode);
337 reply.writeNoException();
338 return true;
339 }
340
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700341 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
342 data.enforceInterface(IActivityManager.descriptor);
343 IBinder token = data.readStrongBinder();
344 boolean res = finishActivityAffinity(token);
345 reply.writeNoException();
346 reply.writeInt(res ? 1 : 0);
347 return true;
348 }
349
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700350 case FINISH_VOICE_TASK_TRANSACTION: {
351 data.enforceInterface(IActivityManager.descriptor);
352 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
353 data.readStrongBinder());
354 finishVoiceTask(session);
355 reply.writeNoException();
356 return true;
357 }
358
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700359 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
360 data.enforceInterface(IActivityManager.descriptor);
361 IBinder token = data.readStrongBinder();
362 boolean res = releaseActivityInstance(token);
363 reply.writeNoException();
364 reply.writeInt(res ? 1 : 0);
365 return true;
366 }
367
368 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
369 data.enforceInterface(IActivityManager.descriptor);
370 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
371 releaseSomeActivities(app);
372 reply.writeNoException();
373 return true;
374 }
375
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800376 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
377 data.enforceInterface(IActivityManager.descriptor);
378 IBinder token = data.readStrongBinder();
379 boolean res = willActivityBeVisible(token);
380 reply.writeNoException();
381 reply.writeInt(res ? 1 : 0);
382 return true;
383 }
384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 case REGISTER_RECEIVER_TRANSACTION:
386 {
387 data.enforceInterface(IActivityManager.descriptor);
388 IBinder b = data.readStrongBinder();
389 IApplicationThread app =
390 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700391 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800392 b = data.readStrongBinder();
393 IIntentReceiver rec
394 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
395 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
396 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700397 int userId = data.readInt();
398 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800399 reply.writeNoException();
400 if (intent != null) {
401 reply.writeInt(1);
402 intent.writeToParcel(reply, 0);
403 } else {
404 reply.writeInt(0);
405 }
406 return true;
407 }
408
409 case UNREGISTER_RECEIVER_TRANSACTION:
410 {
411 data.enforceInterface(IActivityManager.descriptor);
412 IBinder b = data.readStrongBinder();
413 if (b == null) {
414 return true;
415 }
416 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
417 unregisterReceiver(rec);
418 reply.writeNoException();
419 return true;
420 }
421
422 case BROADCAST_INTENT_TRANSACTION:
423 {
424 data.enforceInterface(IActivityManager.descriptor);
425 IBinder b = data.readStrongBinder();
426 IApplicationThread app =
427 b != null ? ApplicationThreadNative.asInterface(b) : null;
428 Intent intent = Intent.CREATOR.createFromParcel(data);
429 String resolvedType = data.readString();
430 b = data.readStrongBinder();
431 IIntentReceiver resultTo =
432 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
433 int resultCode = data.readInt();
434 String resultData = data.readString();
435 Bundle resultExtras = data.readBundle();
436 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800437 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800438 boolean serialized = data.readInt() != 0;
439 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700440 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800441 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800442 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700443 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800444 reply.writeNoException();
445 reply.writeInt(res);
446 return true;
447 }
448
449 case UNBROADCAST_INTENT_TRANSACTION:
450 {
451 data.enforceInterface(IActivityManager.descriptor);
452 IBinder b = data.readStrongBinder();
453 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
454 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700455 int userId = data.readInt();
456 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800457 reply.writeNoException();
458 return true;
459 }
460
461 case FINISH_RECEIVER_TRANSACTION: {
462 data.enforceInterface(IActivityManager.descriptor);
463 IBinder who = data.readStrongBinder();
464 int resultCode = data.readInt();
465 String resultData = data.readString();
466 Bundle resultExtras = data.readBundle();
467 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800468 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800469 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800470 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800471 }
472 reply.writeNoException();
473 return true;
474 }
475
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800476 case ATTACH_APPLICATION_TRANSACTION: {
477 data.enforceInterface(IActivityManager.descriptor);
478 IApplicationThread app = ApplicationThreadNative.asInterface(
479 data.readStrongBinder());
480 if (app != null) {
481 attachApplication(app);
482 }
483 reply.writeNoException();
484 return true;
485 }
486
487 case ACTIVITY_IDLE_TRANSACTION: {
488 data.enforceInterface(IActivityManager.descriptor);
489 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700490 Configuration config = null;
491 if (data.readInt() != 0) {
492 config = Configuration.CREATOR.createFromParcel(data);
493 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700494 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800495 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700496 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 }
498 reply.writeNoException();
499 return true;
500 }
501
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700502 case ACTIVITY_RESUMED_TRANSACTION: {
503 data.enforceInterface(IActivityManager.descriptor);
504 IBinder token = data.readStrongBinder();
505 activityResumed(token);
506 reply.writeNoException();
507 return true;
508 }
509
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800510 case ACTIVITY_PAUSED_TRANSACTION: {
511 data.enforceInterface(IActivityManager.descriptor);
512 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700513 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800514 reply.writeNoException();
515 return true;
516 }
517
518 case ACTIVITY_STOPPED_TRANSACTION: {
519 data.enforceInterface(IActivityManager.descriptor);
520 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800521 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700522 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800523 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700524 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800525 reply.writeNoException();
526 return true;
527 }
528
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800529 case ACTIVITY_SLEPT_TRANSACTION: {
530 data.enforceInterface(IActivityManager.descriptor);
531 IBinder token = data.readStrongBinder();
532 activitySlept(token);
533 reply.writeNoException();
534 return true;
535 }
536
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800537 case ACTIVITY_DESTROYED_TRANSACTION: {
538 data.enforceInterface(IActivityManager.descriptor);
539 IBinder token = data.readStrongBinder();
540 activityDestroyed(token);
541 reply.writeNoException();
542 return true;
543 }
544
545 case GET_CALLING_PACKAGE_TRANSACTION: {
546 data.enforceInterface(IActivityManager.descriptor);
547 IBinder token = data.readStrongBinder();
548 String res = token != null ? getCallingPackage(token) : null;
549 reply.writeNoException();
550 reply.writeString(res);
551 return true;
552 }
553
554 case GET_CALLING_ACTIVITY_TRANSACTION: {
555 data.enforceInterface(IActivityManager.descriptor);
556 IBinder token = data.readStrongBinder();
557 ComponentName cn = getCallingActivity(token);
558 reply.writeNoException();
559 ComponentName.writeToParcel(cn, reply);
560 return true;
561 }
562
Winson Chung1147c402014-05-14 11:05:00 -0700563 case GET_APP_TASKS_TRANSACTION: {
564 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700565 String callingPackage = data.readString();
566 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700567 reply.writeNoException();
568 int N = list != null ? list.size() : -1;
569 reply.writeInt(N);
570 int i;
571 for (i=0; i<N; i++) {
572 IAppTask task = list.get(i);
573 reply.writeStrongBinder(task.asBinder());
574 }
575 return true;
576 }
577
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700578 case ADD_APP_TASK_TRANSACTION: {
579 data.enforceInterface(IActivityManager.descriptor);
580 IBinder activityToken = data.readStrongBinder();
581 Intent intent = Intent.CREATOR.createFromParcel(data);
582 ActivityManager.TaskDescription descr
583 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
584 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
585 int res = addAppTask(activityToken, intent, descr, thumbnail);
586 reply.writeNoException();
587 reply.writeInt(res);
588 return true;
589 }
590
591 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
592 data.enforceInterface(IActivityManager.descriptor);
593 Point size = getAppTaskThumbnailSize();
594 reply.writeNoException();
595 size.writeToParcel(reply, 0);
596 return true;
597 }
598
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800599 case GET_TASKS_TRANSACTION: {
600 data.enforceInterface(IActivityManager.descriptor);
601 int maxNum = data.readInt();
602 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700603 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800604 reply.writeNoException();
605 int N = list != null ? list.size() : -1;
606 reply.writeInt(N);
607 int i;
608 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700609 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800610 info.writeToParcel(reply, 0);
611 }
612 return true;
613 }
614
615 case GET_RECENT_TASKS_TRANSACTION: {
616 data.enforceInterface(IActivityManager.descriptor);
617 int maxNum = data.readInt();
618 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700619 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800620 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700621 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800622 reply.writeNoException();
623 reply.writeTypedList(list);
624 return true;
625 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700626
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700627 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800628 data.enforceInterface(IActivityManager.descriptor);
629 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700630 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800631 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700632 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800633 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700634 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700635 } else {
636 reply.writeInt(0);
637 }
638 return true;
639 }
640
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800641 case GET_SERVICES_TRANSACTION: {
642 data.enforceInterface(IActivityManager.descriptor);
643 int maxNum = data.readInt();
644 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700645 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800646 reply.writeNoException();
647 int N = list != null ? list.size() : -1;
648 reply.writeInt(N);
649 int i;
650 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700651 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800652 info.writeToParcel(reply, 0);
653 }
654 return true;
655 }
656
657 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
658 data.enforceInterface(IActivityManager.descriptor);
659 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
660 reply.writeNoException();
661 reply.writeTypedList(list);
662 return true;
663 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700664
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800665 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
666 data.enforceInterface(IActivityManager.descriptor);
667 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
668 reply.writeNoException();
669 reply.writeTypedList(list);
670 return true;
671 }
672
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700673 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
674 data.enforceInterface(IActivityManager.descriptor);
675 List<ApplicationInfo> list = getRunningExternalApplications();
676 reply.writeNoException();
677 reply.writeTypedList(list);
678 return true;
679 }
680
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800681 case MOVE_TASK_TO_FRONT_TRANSACTION: {
682 data.enforceInterface(IActivityManager.descriptor);
683 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800684 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700685 Bundle options = data.readInt() != 0
686 ? Bundle.CREATOR.createFromParcel(data) : null;
687 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800688 reply.writeNoException();
689 return true;
690 }
691
692 case MOVE_TASK_TO_BACK_TRANSACTION: {
693 data.enforceInterface(IActivityManager.descriptor);
694 int task = data.readInt();
695 moveTaskToBack(task);
696 reply.writeNoException();
697 return true;
698 }
699
700 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
701 data.enforceInterface(IActivityManager.descriptor);
702 IBinder token = data.readStrongBinder();
703 boolean nonRoot = data.readInt() != 0;
704 boolean res = moveActivityTaskToBack(token, nonRoot);
705 reply.writeNoException();
706 reply.writeInt(res ? 1 : 0);
707 return true;
708 }
709
710 case MOVE_TASK_BACKWARDS_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 int task = data.readInt();
713 moveTaskBackwards(task);
714 reply.writeNoException();
715 return true;
716 }
717
Craig Mautnerc00204b2013-03-05 15:02:14 -0800718 case MOVE_TASK_TO_STACK_TRANSACTION: {
719 data.enforceInterface(IActivityManager.descriptor);
720 int taskId = data.readInt();
721 int stackId = data.readInt();
722 boolean toTop = data.readInt() != 0;
723 moveTaskToStack(taskId, stackId, toTop);
724 reply.writeNoException();
725 return true;
726 }
727
728 case RESIZE_STACK_TRANSACTION: {
729 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800730 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800731 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800732 Rect r = Rect.CREATOR.createFromParcel(data);
733 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800734 reply.writeNoException();
735 return true;
736 }
737
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800738 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700739 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800740 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700741 reply.writeNoException();
742 reply.writeTypedList(list);
743 return true;
744 }
745
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800746 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700747 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800748 int stackId = data.readInt();
749 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700750 reply.writeNoException();
751 if (info != null) {
752 reply.writeInt(1);
753 info.writeToParcel(reply, 0);
754 } else {
755 reply.writeInt(0);
756 }
757 return true;
758 }
759
Winson Chung303e1ff2014-03-07 15:06:19 -0800760 case IS_IN_HOME_STACK_TRANSACTION: {
761 data.enforceInterface(IActivityManager.descriptor);
762 int taskId = data.readInt();
763 boolean isInHomeStack = isInHomeStack(taskId);
764 reply.writeNoException();
765 reply.writeInt(isInHomeStack ? 1 : 0);
766 return true;
767 }
768
Craig Mautnercf910b02013-04-23 11:23:27 -0700769 case SET_FOCUSED_STACK_TRANSACTION: {
770 data.enforceInterface(IActivityManager.descriptor);
771 int stackId = data.readInt();
772 setFocusedStack(stackId);
773 reply.writeNoException();
774 return true;
775 }
776
Winson Chung740c3ac2014-11-12 16:14:38 -0800777 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 IBinder token = data.readStrongBinder();
780 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
781 reply.writeNoException();
782 return true;
783 }
784
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800785 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
786 data.enforceInterface(IActivityManager.descriptor);
787 IBinder token = data.readStrongBinder();
788 boolean onlyRoot = data.readInt() != 0;
789 int res = token != null
790 ? getTaskForActivity(token, onlyRoot) : -1;
791 reply.writeNoException();
792 reply.writeInt(res);
793 return true;
794 }
795
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800796 case GET_CONTENT_PROVIDER_TRANSACTION: {
797 data.enforceInterface(IActivityManager.descriptor);
798 IBinder b = data.readStrongBinder();
799 IApplicationThread app = ApplicationThreadNative.asInterface(b);
800 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700801 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700802 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700803 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800804 reply.writeNoException();
805 if (cph != null) {
806 reply.writeInt(1);
807 cph.writeToParcel(reply, 0);
808 } else {
809 reply.writeInt(0);
810 }
811 return true;
812 }
813
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800814 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
815 data.enforceInterface(IActivityManager.descriptor);
816 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700817 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800818 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700819 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800820 reply.writeNoException();
821 if (cph != null) {
822 reply.writeInt(1);
823 cph.writeToParcel(reply, 0);
824 } else {
825 reply.writeInt(0);
826 }
827 return true;
828 }
829
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800830 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
831 data.enforceInterface(IActivityManager.descriptor);
832 IBinder b = data.readStrongBinder();
833 IApplicationThread app = ApplicationThreadNative.asInterface(b);
834 ArrayList<ContentProviderHolder> providers =
835 data.createTypedArrayList(ContentProviderHolder.CREATOR);
836 publishContentProviders(app, providers);
837 reply.writeNoException();
838 return true;
839 }
840
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700841 case REF_CONTENT_PROVIDER_TRANSACTION: {
842 data.enforceInterface(IActivityManager.descriptor);
843 IBinder b = data.readStrongBinder();
844 int stable = data.readInt();
845 int unstable = data.readInt();
846 boolean res = refContentProvider(b, stable, unstable);
847 reply.writeNoException();
848 reply.writeInt(res ? 1 : 0);
849 return true;
850 }
851
852 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
853 data.enforceInterface(IActivityManager.descriptor);
854 IBinder b = data.readStrongBinder();
855 unstableProviderDied(b);
856 reply.writeNoException();
857 return true;
858 }
859
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700860 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
861 data.enforceInterface(IActivityManager.descriptor);
862 IBinder b = data.readStrongBinder();
863 appNotRespondingViaProvider(b);
864 reply.writeNoException();
865 return true;
866 }
867
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800868 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
869 data.enforceInterface(IActivityManager.descriptor);
870 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700871 boolean stable = data.readInt() != 0;
872 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 reply.writeNoException();
874 return true;
875 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800876
877 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
878 data.enforceInterface(IActivityManager.descriptor);
879 String name = data.readString();
880 IBinder token = data.readStrongBinder();
881 removeContentProviderExternal(name, token);
882 reply.writeNoException();
883 return true;
884 }
885
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700886 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
887 data.enforceInterface(IActivityManager.descriptor);
888 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
889 PendingIntent pi = getRunningServiceControlPanel(comp);
890 reply.writeNoException();
891 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
892 return true;
893 }
894
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800895 case START_SERVICE_TRANSACTION: {
896 data.enforceInterface(IActivityManager.descriptor);
897 IBinder b = data.readStrongBinder();
898 IApplicationThread app = ApplicationThreadNative.asInterface(b);
899 Intent service = Intent.CREATOR.createFromParcel(data);
900 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700901 int userId = data.readInt();
902 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800903 reply.writeNoException();
904 ComponentName.writeToParcel(cn, reply);
905 return true;
906 }
907
908 case STOP_SERVICE_TRANSACTION: {
909 data.enforceInterface(IActivityManager.descriptor);
910 IBinder b = data.readStrongBinder();
911 IApplicationThread app = ApplicationThreadNative.asInterface(b);
912 Intent service = Intent.CREATOR.createFromParcel(data);
913 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700914 int userId = data.readInt();
915 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800916 reply.writeNoException();
917 reply.writeInt(res);
918 return true;
919 }
920
921 case STOP_SERVICE_TOKEN_TRANSACTION: {
922 data.enforceInterface(IActivityManager.descriptor);
923 ComponentName className = ComponentName.readFromParcel(data);
924 IBinder token = data.readStrongBinder();
925 int startId = data.readInt();
926 boolean res = stopServiceToken(className, token, startId);
927 reply.writeNoException();
928 reply.writeInt(res ? 1 : 0);
929 return true;
930 }
931
932 case SET_SERVICE_FOREGROUND_TRANSACTION: {
933 data.enforceInterface(IActivityManager.descriptor);
934 ComponentName className = ComponentName.readFromParcel(data);
935 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700936 int id = data.readInt();
937 Notification notification = null;
938 if (data.readInt() != 0) {
939 notification = Notification.CREATOR.createFromParcel(data);
940 }
941 boolean removeNotification = data.readInt() != 0;
942 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800943 reply.writeNoException();
944 return true;
945 }
946
947 case BIND_SERVICE_TRANSACTION: {
948 data.enforceInterface(IActivityManager.descriptor);
949 IBinder b = data.readStrongBinder();
950 IApplicationThread app = ApplicationThreadNative.asInterface(b);
951 IBinder token = data.readStrongBinder();
952 Intent service = Intent.CREATOR.createFromParcel(data);
953 String resolvedType = data.readString();
954 b = data.readStrongBinder();
955 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800956 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800957 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800958 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800959 reply.writeNoException();
960 reply.writeInt(res);
961 return true;
962 }
963
964 case UNBIND_SERVICE_TRANSACTION: {
965 data.enforceInterface(IActivityManager.descriptor);
966 IBinder b = data.readStrongBinder();
967 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
968 boolean res = unbindService(conn);
969 reply.writeNoException();
970 reply.writeInt(res ? 1 : 0);
971 return true;
972 }
973
974 case PUBLISH_SERVICE_TRANSACTION: {
975 data.enforceInterface(IActivityManager.descriptor);
976 IBinder token = data.readStrongBinder();
977 Intent intent = Intent.CREATOR.createFromParcel(data);
978 IBinder service = data.readStrongBinder();
979 publishService(token, intent, service);
980 reply.writeNoException();
981 return true;
982 }
983
984 case UNBIND_FINISHED_TRANSACTION: {
985 data.enforceInterface(IActivityManager.descriptor);
986 IBinder token = data.readStrongBinder();
987 Intent intent = Intent.CREATOR.createFromParcel(data);
988 boolean doRebind = data.readInt() != 0;
989 unbindFinished(token, intent, doRebind);
990 reply.writeNoException();
991 return true;
992 }
993
994 case SERVICE_DONE_EXECUTING_TRANSACTION: {
995 data.enforceInterface(IActivityManager.descriptor);
996 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700997 int type = data.readInt();
998 int startId = data.readInt();
999 int res = data.readInt();
1000 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001001 reply.writeNoException();
1002 return true;
1003 }
1004
1005 case START_INSTRUMENTATION_TRANSACTION: {
1006 data.enforceInterface(IActivityManager.descriptor);
1007 ComponentName className = ComponentName.readFromParcel(data);
1008 String profileFile = data.readString();
1009 int fl = data.readInt();
1010 Bundle arguments = data.readBundle();
1011 IBinder b = data.readStrongBinder();
1012 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001013 b = data.readStrongBinder();
1014 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001015 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001016 String abiOverride = data.readString();
1017 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1018 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001019 reply.writeNoException();
1020 reply.writeInt(res ? 1 : 0);
1021 return true;
1022 }
1023
1024
1025 case FINISH_INSTRUMENTATION_TRANSACTION: {
1026 data.enforceInterface(IActivityManager.descriptor);
1027 IBinder b = data.readStrongBinder();
1028 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1029 int resultCode = data.readInt();
1030 Bundle results = data.readBundle();
1031 finishInstrumentation(app, resultCode, results);
1032 reply.writeNoException();
1033 return true;
1034 }
1035
1036 case GET_CONFIGURATION_TRANSACTION: {
1037 data.enforceInterface(IActivityManager.descriptor);
1038 Configuration config = getConfiguration();
1039 reply.writeNoException();
1040 config.writeToParcel(reply, 0);
1041 return true;
1042 }
1043
1044 case UPDATE_CONFIGURATION_TRANSACTION: {
1045 data.enforceInterface(IActivityManager.descriptor);
1046 Configuration config = Configuration.CREATOR.createFromParcel(data);
1047 updateConfiguration(config);
1048 reply.writeNoException();
1049 return true;
1050 }
1051
1052 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1053 data.enforceInterface(IActivityManager.descriptor);
1054 IBinder token = data.readStrongBinder();
1055 int requestedOrientation = data.readInt();
1056 setRequestedOrientation(token, requestedOrientation);
1057 reply.writeNoException();
1058 return true;
1059 }
1060
1061 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1062 data.enforceInterface(IActivityManager.descriptor);
1063 IBinder token = data.readStrongBinder();
1064 int req = getRequestedOrientation(token);
1065 reply.writeNoException();
1066 reply.writeInt(req);
1067 return true;
1068 }
1069
1070 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1071 data.enforceInterface(IActivityManager.descriptor);
1072 IBinder token = data.readStrongBinder();
1073 ComponentName cn = getActivityClassForToken(token);
1074 reply.writeNoException();
1075 ComponentName.writeToParcel(cn, reply);
1076 return true;
1077 }
1078
1079 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1080 data.enforceInterface(IActivityManager.descriptor);
1081 IBinder token = data.readStrongBinder();
1082 reply.writeNoException();
1083 reply.writeString(getPackageForToken(token));
1084 return true;
1085 }
1086
1087 case GET_INTENT_SENDER_TRANSACTION: {
1088 data.enforceInterface(IActivityManager.descriptor);
1089 int type = data.readInt();
1090 String packageName = data.readString();
1091 IBinder token = data.readStrongBinder();
1092 String resultWho = data.readString();
1093 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001094 Intent[] requestIntents;
1095 String[] requestResolvedTypes;
1096 if (data.readInt() != 0) {
1097 requestIntents = data.createTypedArray(Intent.CREATOR);
1098 requestResolvedTypes = data.createStringArray();
1099 } else {
1100 requestIntents = null;
1101 requestResolvedTypes = null;
1102 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001103 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001104 Bundle options = data.readInt() != 0
1105 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001106 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001107 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001108 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001109 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001110 reply.writeNoException();
1111 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1112 return true;
1113 }
1114
1115 case CANCEL_INTENT_SENDER_TRANSACTION: {
1116 data.enforceInterface(IActivityManager.descriptor);
1117 IIntentSender r = IIntentSender.Stub.asInterface(
1118 data.readStrongBinder());
1119 cancelIntentSender(r);
1120 reply.writeNoException();
1121 return true;
1122 }
1123
1124 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1125 data.enforceInterface(IActivityManager.descriptor);
1126 IIntentSender r = IIntentSender.Stub.asInterface(
1127 data.readStrongBinder());
1128 String res = getPackageForIntentSender(r);
1129 reply.writeNoException();
1130 reply.writeString(res);
1131 return true;
1132 }
1133
Christopher Tatec4a07d12012-04-06 14:19:13 -07001134 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1135 data.enforceInterface(IActivityManager.descriptor);
1136 IIntentSender r = IIntentSender.Stub.asInterface(
1137 data.readStrongBinder());
1138 int res = getUidForIntentSender(r);
1139 reply.writeNoException();
1140 reply.writeInt(res);
1141 return true;
1142 }
1143
Dianne Hackborn41203752012-08-31 14:05:51 -07001144 case HANDLE_INCOMING_USER_TRANSACTION: {
1145 data.enforceInterface(IActivityManager.descriptor);
1146 int callingPid = data.readInt();
1147 int callingUid = data.readInt();
1148 int userId = data.readInt();
1149 boolean allowAll = data.readInt() != 0 ;
1150 boolean requireFull = data.readInt() != 0;
1151 String name = data.readString();
1152 String callerPackage = data.readString();
1153 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1154 requireFull, name, callerPackage);
1155 reply.writeNoException();
1156 reply.writeInt(res);
1157 return true;
1158 }
1159
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001160 case SET_PROCESS_LIMIT_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 int max = data.readInt();
1163 setProcessLimit(max);
1164 reply.writeNoException();
1165 return true;
1166 }
1167
1168 case GET_PROCESS_LIMIT_TRANSACTION: {
1169 data.enforceInterface(IActivityManager.descriptor);
1170 int limit = getProcessLimit();
1171 reply.writeNoException();
1172 reply.writeInt(limit);
1173 return true;
1174 }
1175
1176 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1177 data.enforceInterface(IActivityManager.descriptor);
1178 IBinder token = data.readStrongBinder();
1179 int pid = data.readInt();
1180 boolean isForeground = data.readInt() != 0;
1181 setProcessForeground(token, pid, isForeground);
1182 reply.writeNoException();
1183 return true;
1184 }
1185
1186 case CHECK_PERMISSION_TRANSACTION: {
1187 data.enforceInterface(IActivityManager.descriptor);
1188 String perm = data.readString();
1189 int pid = data.readInt();
1190 int uid = data.readInt();
1191 int res = checkPermission(perm, pid, uid);
1192 reply.writeNoException();
1193 reply.writeInt(res);
1194 return true;
1195 }
1196
Dianne Hackbornff170242014-11-19 10:59:01 -08001197 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1198 data.enforceInterface(IActivityManager.descriptor);
1199 String perm = data.readString();
1200 int pid = data.readInt();
1201 int uid = data.readInt();
1202 IBinder token = data.readStrongBinder();
1203 int res = checkPermissionWithToken(perm, pid, uid, token);
1204 reply.writeNoException();
1205 reply.writeInt(res);
1206 return true;
1207 }
1208
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001209 case CHECK_URI_PERMISSION_TRANSACTION: {
1210 data.enforceInterface(IActivityManager.descriptor);
1211 Uri uri = Uri.CREATOR.createFromParcel(data);
1212 int pid = data.readInt();
1213 int uid = data.readInt();
1214 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001215 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001216 IBinder callerToken = data.readStrongBinder();
1217 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001218 reply.writeNoException();
1219 reply.writeInt(res);
1220 return true;
1221 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001222
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001224 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001225 String packageName = data.readString();
1226 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1227 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001228 int userId = data.readInt();
1229 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001230 reply.writeNoException();
1231 reply.writeInt(res ? 1 : 0);
1232 return true;
1233 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001234
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001235 case GRANT_URI_PERMISSION_TRANSACTION: {
1236 data.enforceInterface(IActivityManager.descriptor);
1237 IBinder b = data.readStrongBinder();
1238 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1239 String targetPkg = data.readString();
1240 Uri uri = Uri.CREATOR.createFromParcel(data);
1241 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001242 int userId = data.readInt();
1243 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001244 reply.writeNoException();
1245 return true;
1246 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001247
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001248 case REVOKE_URI_PERMISSION_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 IBinder b = data.readStrongBinder();
1251 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1252 Uri uri = Uri.CREATOR.createFromParcel(data);
1253 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001254 int userId = data.readInt();
1255 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001256 reply.writeNoException();
1257 return true;
1258 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001259
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001260 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1261 data.enforceInterface(IActivityManager.descriptor);
1262 Uri uri = Uri.CREATOR.createFromParcel(data);
1263 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001264 int userId = data.readInt();
1265 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001266 reply.writeNoException();
1267 return true;
1268 }
1269
1270 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1271 data.enforceInterface(IActivityManager.descriptor);
1272 Uri uri = Uri.CREATOR.createFromParcel(data);
1273 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001274 int userId = data.readInt();
1275 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001276 reply.writeNoException();
1277 return true;
1278 }
1279
1280 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001282 final String packageName = data.readString();
1283 final boolean incoming = data.readInt() != 0;
1284 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1285 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001286 reply.writeNoException();
1287 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1288 return true;
1289 }
1290
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001291 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1292 data.enforceInterface(IActivityManager.descriptor);
1293 IBinder b = data.readStrongBinder();
1294 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1295 boolean waiting = data.readInt() != 0;
1296 showWaitingForDebugger(app, waiting);
1297 reply.writeNoException();
1298 return true;
1299 }
1300
1301 case GET_MEMORY_INFO_TRANSACTION: {
1302 data.enforceInterface(IActivityManager.descriptor);
1303 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1304 getMemoryInfo(mi);
1305 reply.writeNoException();
1306 mi.writeToParcel(reply, 0);
1307 return true;
1308 }
1309
1310 case UNHANDLED_BACK_TRANSACTION: {
1311 data.enforceInterface(IActivityManager.descriptor);
1312 unhandledBack();
1313 reply.writeNoException();
1314 return true;
1315 }
1316
1317 case OPEN_CONTENT_URI_TRANSACTION: {
1318 data.enforceInterface(IActivityManager.descriptor);
1319 Uri uri = Uri.parse(data.readString());
1320 ParcelFileDescriptor pfd = openContentUri(uri);
1321 reply.writeNoException();
1322 if (pfd != null) {
1323 reply.writeInt(1);
1324 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1325 } else {
1326 reply.writeInt(0);
1327 }
1328 return true;
1329 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001330
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001331 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1332 data.enforceInterface(IActivityManager.descriptor);
1333 setLockScreenShown(data.readInt() != 0);
1334 reply.writeNoException();
1335 return true;
1336 }
1337
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001338 case SET_DEBUG_APP_TRANSACTION: {
1339 data.enforceInterface(IActivityManager.descriptor);
1340 String pn = data.readString();
1341 boolean wfd = data.readInt() != 0;
1342 boolean per = data.readInt() != 0;
1343 setDebugApp(pn, wfd, per);
1344 reply.writeNoException();
1345 return true;
1346 }
1347
1348 case SET_ALWAYS_FINISH_TRANSACTION: {
1349 data.enforceInterface(IActivityManager.descriptor);
1350 boolean enabled = data.readInt() != 0;
1351 setAlwaysFinish(enabled);
1352 reply.writeNoException();
1353 return true;
1354 }
1355
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001356 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001357 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001358 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001359 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001360 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001361 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001362 return true;
1363 }
1364
1365 case ENTER_SAFE_MODE_TRANSACTION: {
1366 data.enforceInterface(IActivityManager.descriptor);
1367 enterSafeMode();
1368 reply.writeNoException();
1369 return true;
1370 }
1371
1372 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
1374 IIntentSender is = IIntentSender.Stub.asInterface(
1375 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001376 int sourceUid = data.readInt();
1377 String sourcePkg = data.readString();
1378 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001379 reply.writeNoException();
1380 return true;
1381 }
1382
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001383 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001384 data.enforceInterface(IActivityManager.descriptor);
1385 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001386 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001387 boolean secure = data.readInt() != 0;
1388 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001389 reply.writeNoException();
1390 reply.writeInt(res ? 1 : 0);
1391 return true;
1392 }
1393
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001394 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1395 data.enforceInterface(IActivityManager.descriptor);
1396 String reason = data.readString();
1397 boolean res = killProcessesBelowForeground(reason);
1398 reply.writeNoException();
1399 reply.writeInt(res ? 1 : 0);
1400 return true;
1401 }
1402
Dan Egnor60d87622009-12-16 16:32:58 -08001403 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1404 data.enforceInterface(IActivityManager.descriptor);
1405 IBinder app = data.readStrongBinder();
1406 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1407 handleApplicationCrash(app, ci);
1408 reply.writeNoException();
1409 return true;
1410 }
1411
1412 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001413 data.enforceInterface(IActivityManager.descriptor);
1414 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001415 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001416 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001417 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001418 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001419 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001420 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001421 return true;
1422 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001423
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001424 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1425 data.enforceInterface(IActivityManager.descriptor);
1426 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001427 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001428 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1429 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001430 reply.writeNoException();
1431 return true;
1432 }
1433
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001434 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1435 data.enforceInterface(IActivityManager.descriptor);
1436 int sig = data.readInt();
1437 signalPersistentProcesses(sig);
1438 reply.writeNoException();
1439 return true;
1440 }
1441
Dianne Hackborn03abb812010-01-04 18:43:19 -08001442 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1443 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001444 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001445 int userId = data.readInt();
1446 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001447 reply.writeNoException();
1448 return true;
1449 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001450
1451 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1452 data.enforceInterface(IActivityManager.descriptor);
1453 killAllBackgroundProcesses();
1454 reply.writeNoException();
1455 return true;
1456 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001457
Dianne Hackborn03abb812010-01-04 18:43:19 -08001458 case FORCE_STOP_PACKAGE_TRANSACTION: {
1459 data.enforceInterface(IActivityManager.descriptor);
1460 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001461 int userId = data.readInt();
1462 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001463 reply.writeNoException();
1464 return true;
1465 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001466
1467 case GET_MY_MEMORY_STATE_TRANSACTION: {
1468 data.enforceInterface(IActivityManager.descriptor);
1469 ActivityManager.RunningAppProcessInfo info =
1470 new ActivityManager.RunningAppProcessInfo();
1471 getMyMemoryState(info);
1472 reply.writeNoException();
1473 info.writeToParcel(reply, 0);
1474 return true;
1475 }
1476
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001477 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1478 data.enforceInterface(IActivityManager.descriptor);
1479 ConfigurationInfo config = getDeviceConfigurationInfo();
1480 reply.writeNoException();
1481 config.writeToParcel(reply, 0);
1482 return true;
1483 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001484
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001485 case PROFILE_CONTROL_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001488 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001489 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001490 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001491 ProfilerInfo profilerInfo = data.readInt() != 0
1492 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1493 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001494 reply.writeNoException();
1495 reply.writeInt(res ? 1 : 0);
1496 return true;
1497 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001498
Dianne Hackborn55280a92009-05-07 15:53:46 -07001499 case SHUTDOWN_TRANSACTION: {
1500 data.enforceInterface(IActivityManager.descriptor);
1501 boolean res = shutdown(data.readInt());
1502 reply.writeNoException();
1503 reply.writeInt(res ? 1 : 0);
1504 return true;
1505 }
1506
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001507 case STOP_APP_SWITCHES_TRANSACTION: {
1508 data.enforceInterface(IActivityManager.descriptor);
1509 stopAppSwitches();
1510 reply.writeNoException();
1511 return true;
1512 }
1513
1514 case RESUME_APP_SWITCHES_TRANSACTION: {
1515 data.enforceInterface(IActivityManager.descriptor);
1516 resumeAppSwitches();
1517 reply.writeNoException();
1518 return true;
1519 }
1520
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001521 case PEEK_SERVICE_TRANSACTION: {
1522 data.enforceInterface(IActivityManager.descriptor);
1523 Intent service = Intent.CREATOR.createFromParcel(data);
1524 String resolvedType = data.readString();
1525 IBinder binder = peekService(service, resolvedType);
1526 reply.writeNoException();
1527 reply.writeStrongBinder(binder);
1528 return true;
1529 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001530
1531 case START_BACKUP_AGENT_TRANSACTION: {
1532 data.enforceInterface(IActivityManager.descriptor);
1533 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1534 int backupRestoreMode = data.readInt();
1535 boolean success = bindBackupAgent(info, backupRestoreMode);
1536 reply.writeNoException();
1537 reply.writeInt(success ? 1 : 0);
1538 return true;
1539 }
1540
1541 case BACKUP_AGENT_CREATED_TRANSACTION: {
1542 data.enforceInterface(IActivityManager.descriptor);
1543 String packageName = data.readString();
1544 IBinder agent = data.readStrongBinder();
1545 backupAgentCreated(packageName, agent);
1546 reply.writeNoException();
1547 return true;
1548 }
1549
1550 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1551 data.enforceInterface(IActivityManager.descriptor);
1552 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1553 unbindBackupAgent(info);
1554 reply.writeNoException();
1555 return true;
1556 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001557
1558 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1559 data.enforceInterface(IActivityManager.descriptor);
1560 String packageName = data.readString();
1561 addPackageDependency(packageName);
1562 reply.writeNoException();
1563 return true;
1564 }
1565
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001566 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001567 data.enforceInterface(IActivityManager.descriptor);
1568 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001569 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001570 String reason = data.readString();
1571 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001572 reply.writeNoException();
1573 return true;
1574 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001575
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001576 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1577 data.enforceInterface(IActivityManager.descriptor);
1578 String reason = data.readString();
1579 closeSystemDialogs(reason);
1580 reply.writeNoException();
1581 return true;
1582 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001583
1584 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1585 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001586 int[] pids = data.createIntArray();
1587 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001588 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001589 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001590 return true;
1591 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001592
1593 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1594 data.enforceInterface(IActivityManager.descriptor);
1595 String processName = data.readString();
1596 int uid = data.readInt();
1597 killApplicationProcess(processName, uid);
1598 reply.writeNoException();
1599 return true;
1600 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001601
1602 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1603 data.enforceInterface(IActivityManager.descriptor);
1604 IBinder token = data.readStrongBinder();
1605 String packageName = data.readString();
1606 int enterAnim = data.readInt();
1607 int exitAnim = data.readInt();
1608 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001609 reply.writeNoException();
1610 return true;
1611 }
1612
1613 case IS_USER_A_MONKEY_TRANSACTION: {
1614 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001615 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001616 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001617 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001618 return true;
1619 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001620
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001621 case SET_USER_IS_MONKEY_TRANSACTION: {
1622 data.enforceInterface(IActivityManager.descriptor);
1623 final boolean monkey = (data.readInt() == 1);
1624 setUserIsMonkey(monkey);
1625 reply.writeNoException();
1626 return true;
1627 }
1628
Dianne Hackborn860755f2010-06-03 18:47:52 -07001629 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1630 data.enforceInterface(IActivityManager.descriptor);
1631 finishHeavyWeightApp();
1632 reply.writeNoException();
1633 return true;
1634 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001635
1636 case IS_IMMERSIVE_TRANSACTION: {
1637 data.enforceInterface(IActivityManager.descriptor);
1638 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001639 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001640 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001641 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001642 return true;
1643 }
1644
Craig Mautnerd61dc202014-07-07 11:09:11 -07001645 case IS_TOP_OF_TASK_TRANSACTION: {
1646 data.enforceInterface(IActivityManager.descriptor);
1647 IBinder token = data.readStrongBinder();
1648 final boolean isTopOfTask = isTopOfTask(token);
1649 reply.writeNoException();
1650 reply.writeInt(isTopOfTask ? 1 : 0);
1651 return true;
1652 }
1653
Craig Mautner5eda9b32013-07-02 11:58:16 -07001654 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001655 data.enforceInterface(IActivityManager.descriptor);
1656 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001657 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001658 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001659 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001660 return true;
1661 }
1662
1663 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1664 data.enforceInterface(IActivityManager.descriptor);
1665 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001666 final Bundle bundle;
1667 if (data.readInt() == 0) {
1668 bundle = null;
1669 } else {
1670 bundle = data.readBundle();
1671 }
1672 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1673 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001674 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001675 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001676 return true;
1677 }
1678
Craig Mautner233ceee2014-05-09 17:05:11 -07001679 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1680 data.enforceInterface(IActivityManager.descriptor);
1681 IBinder token = data.readStrongBinder();
1682 final ActivityOptions options = getActivityOptions(token);
1683 reply.writeNoException();
1684 reply.writeBundle(options == null ? null : options.toBundle());
1685 return true;
1686 }
1687
Daniel Sandler69a48172010-06-23 16:29:36 -04001688 case SET_IMMERSIVE_TRANSACTION: {
1689 data.enforceInterface(IActivityManager.descriptor);
1690 IBinder token = data.readStrongBinder();
1691 boolean imm = data.readInt() == 1;
1692 setImmersive(token, imm);
1693 reply.writeNoException();
1694 return true;
1695 }
1696
1697 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1698 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001699 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001700 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001701 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001702 return true;
1703 }
1704
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001705 case CRASH_APPLICATION_TRANSACTION: {
1706 data.enforceInterface(IActivityManager.descriptor);
1707 int uid = data.readInt();
1708 int initialPid = data.readInt();
1709 String packageName = data.readString();
1710 String message = data.readString();
1711 crashApplication(uid, initialPid, packageName, message);
1712 reply.writeNoException();
1713 return true;
1714 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001715
1716 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1717 data.enforceInterface(IActivityManager.descriptor);
1718 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001719 int userId = data.readInt();
1720 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001721 reply.writeNoException();
1722 reply.writeString(type);
1723 return true;
1724 }
1725
Dianne Hackborn7e269642010-08-25 19:50:20 -07001726 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1727 data.enforceInterface(IActivityManager.descriptor);
1728 String name = data.readString();
1729 IBinder perm = newUriPermissionOwner(name);
1730 reply.writeNoException();
1731 reply.writeStrongBinder(perm);
1732 return true;
1733 }
1734
1735 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1736 data.enforceInterface(IActivityManager.descriptor);
1737 IBinder owner = data.readStrongBinder();
1738 int fromUid = data.readInt();
1739 String targetPkg = data.readString();
1740 Uri uri = Uri.CREATOR.createFromParcel(data);
1741 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001742 int sourceUserId = data.readInt();
1743 int targetUserId = data.readInt();
1744 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1745 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001746 reply.writeNoException();
1747 return true;
1748 }
1749
1750 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1751 data.enforceInterface(IActivityManager.descriptor);
1752 IBinder owner = data.readStrongBinder();
1753 Uri uri = null;
1754 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001755 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001756 }
1757 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001758 int userId = data.readInt();
1759 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001760 reply.writeNoException();
1761 return true;
1762 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001763
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001764 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1765 data.enforceInterface(IActivityManager.descriptor);
1766 int callingUid = data.readInt();
1767 String targetPkg = data.readString();
1768 Uri uri = Uri.CREATOR.createFromParcel(data);
1769 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001770 int userId = data.readInt();
1771 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001772 reply.writeNoException();
1773 reply.writeInt(res);
1774 return true;
1775 }
1776
Andy McFadden824c5102010-07-09 16:26:57 -07001777 case DUMP_HEAP_TRANSACTION: {
1778 data.enforceInterface(IActivityManager.descriptor);
1779 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001780 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001781 boolean managed = data.readInt() != 0;
1782 String path = data.readString();
1783 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001784 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001785 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001786 reply.writeNoException();
1787 reply.writeInt(res ? 1 : 0);
1788 return true;
1789 }
1790
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001791 case START_ACTIVITIES_TRANSACTION:
1792 {
1793 data.enforceInterface(IActivityManager.descriptor);
1794 IBinder b = data.readStrongBinder();
1795 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001796 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001797 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1798 String[] resolvedTypes = data.createStringArray();
1799 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001800 Bundle options = data.readInt() != 0
1801 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001802 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001803 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001804 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001805 reply.writeNoException();
1806 reply.writeInt(result);
1807 return true;
1808 }
1809
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001810 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1811 {
1812 data.enforceInterface(IActivityManager.descriptor);
1813 int mode = getFrontActivityScreenCompatMode();
1814 reply.writeNoException();
1815 reply.writeInt(mode);
1816 return true;
1817 }
1818
1819 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1820 {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 int mode = data.readInt();
1823 setFrontActivityScreenCompatMode(mode);
1824 reply.writeNoException();
1825 reply.writeInt(mode);
1826 return true;
1827 }
1828
1829 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1830 {
1831 data.enforceInterface(IActivityManager.descriptor);
1832 String pkg = data.readString();
1833 int mode = getPackageScreenCompatMode(pkg);
1834 reply.writeNoException();
1835 reply.writeInt(mode);
1836 return true;
1837 }
1838
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001839 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1840 {
1841 data.enforceInterface(IActivityManager.descriptor);
1842 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001843 int mode = data.readInt();
1844 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001845 reply.writeNoException();
1846 return true;
1847 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001848
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001849 case SWITCH_USER_TRANSACTION: {
1850 data.enforceInterface(IActivityManager.descriptor);
1851 int userid = data.readInt();
1852 boolean result = switchUser(userid);
1853 reply.writeNoException();
1854 reply.writeInt(result ? 1 : 0);
1855 return true;
1856 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001857
Kenny Guy08488bf2014-02-21 17:40:37 +00001858 case START_USER_IN_BACKGROUND_TRANSACTION: {
1859 data.enforceInterface(IActivityManager.descriptor);
1860 int userid = data.readInt();
1861 boolean result = startUserInBackground(userid);
1862 reply.writeNoException();
1863 reply.writeInt(result ? 1 : 0);
1864 return true;
1865 }
1866
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001867 case STOP_USER_TRANSACTION: {
1868 data.enforceInterface(IActivityManager.descriptor);
1869 int userid = data.readInt();
1870 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1871 data.readStrongBinder());
1872 int result = stopUser(userid, callback);
1873 reply.writeNoException();
1874 reply.writeInt(result);
1875 return true;
1876 }
1877
Amith Yamasani52f1d752012-03-28 18:19:29 -07001878 case GET_CURRENT_USER_TRANSACTION: {
1879 data.enforceInterface(IActivityManager.descriptor);
1880 UserInfo userInfo = getCurrentUser();
1881 reply.writeNoException();
1882 userInfo.writeToParcel(reply, 0);
1883 return true;
1884 }
1885
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001886 case IS_USER_RUNNING_TRANSACTION: {
1887 data.enforceInterface(IActivityManager.descriptor);
1888 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001889 boolean orStopping = data.readInt() != 0;
1890 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001891 reply.writeNoException();
1892 reply.writeInt(result ? 1 : 0);
1893 return true;
1894 }
1895
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001896 case GET_RUNNING_USER_IDS_TRANSACTION: {
1897 data.enforceInterface(IActivityManager.descriptor);
1898 int[] result = getRunningUserIds();
1899 reply.writeNoException();
1900 reply.writeIntArray(result);
1901 return true;
1902 }
1903
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001904 case REMOVE_TASK_TRANSACTION:
1905 {
1906 data.enforceInterface(IActivityManager.descriptor);
1907 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001908 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001909 reply.writeNoException();
1910 reply.writeInt(result ? 1 : 0);
1911 return true;
1912 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001913
Jeff Sharkeya4620792011-05-20 15:29:23 -07001914 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1915 data.enforceInterface(IActivityManager.descriptor);
1916 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1917 data.readStrongBinder());
1918 registerProcessObserver(observer);
1919 return true;
1920 }
1921
1922 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1923 data.enforceInterface(IActivityManager.descriptor);
1924 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1925 data.readStrongBinder());
1926 unregisterProcessObserver(observer);
1927 return true;
1928 }
1929
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001930 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1931 {
1932 data.enforceInterface(IActivityManager.descriptor);
1933 String pkg = data.readString();
1934 boolean ask = getPackageAskScreenCompat(pkg);
1935 reply.writeNoException();
1936 reply.writeInt(ask ? 1 : 0);
1937 return true;
1938 }
1939
1940 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1941 {
1942 data.enforceInterface(IActivityManager.descriptor);
1943 String pkg = data.readString();
1944 boolean ask = data.readInt() != 0;
1945 setPackageAskScreenCompat(pkg, ask);
1946 reply.writeNoException();
1947 return true;
1948 }
1949
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001950 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1951 data.enforceInterface(IActivityManager.descriptor);
1952 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07001953 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001954 boolean res = isIntentSenderTargetedToPackage(r);
1955 reply.writeNoException();
1956 reply.writeInt(res ? 1 : 0);
1957 return true;
1958 }
1959
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001960 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1961 data.enforceInterface(IActivityManager.descriptor);
1962 IIntentSender r = IIntentSender.Stub.asInterface(
1963 data.readStrongBinder());
1964 boolean res = isIntentSenderAnActivity(r);
1965 reply.writeNoException();
1966 reply.writeInt(res ? 1 : 0);
1967 return true;
1968 }
1969
Dianne Hackborn81038902012-11-26 17:04:09 -08001970 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1971 data.enforceInterface(IActivityManager.descriptor);
1972 IIntentSender r = IIntentSender.Stub.asInterface(
1973 data.readStrongBinder());
1974 Intent intent = getIntentForIntentSender(r);
1975 reply.writeNoException();
1976 if (intent != null) {
1977 reply.writeInt(1);
1978 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1979 } else {
1980 reply.writeInt(0);
1981 }
1982 return true;
1983 }
1984
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001985 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1986 data.enforceInterface(IActivityManager.descriptor);
1987 IIntentSender r = IIntentSender.Stub.asInterface(
1988 data.readStrongBinder());
1989 String prefix = data.readString();
1990 String tag = getTagForIntentSender(r, prefix);
1991 reply.writeNoException();
1992 reply.writeString(tag);
1993 return true;
1994 }
1995
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001996 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1997 data.enforceInterface(IActivityManager.descriptor);
1998 Configuration config = Configuration.CREATOR.createFromParcel(data);
1999 updatePersistentConfiguration(config);
2000 reply.writeNoException();
2001 return true;
2002 }
2003
Dianne Hackbornb437e092011-08-05 17:50:29 -07002004 case GET_PROCESS_PSS_TRANSACTION: {
2005 data.enforceInterface(IActivityManager.descriptor);
2006 int[] pids = data.createIntArray();
2007 long[] pss = getProcessPss(pids);
2008 reply.writeNoException();
2009 reply.writeLongArray(pss);
2010 return true;
2011 }
2012
Dianne Hackborn661cd522011-08-22 00:26:20 -07002013 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2014 data.enforceInterface(IActivityManager.descriptor);
2015 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2016 boolean always = data.readInt() != 0;
2017 showBootMessage(msg, always);
2018 reply.writeNoException();
2019 return true;
2020 }
2021
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002022 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002023 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002024 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002025 reply.writeNoException();
2026 return true;
2027 }
2028
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002029 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002030 data.enforceInterface(IActivityManager.descriptor);
2031 IBinder token = data.readStrongBinder();
2032 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002033 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002034 reply.writeNoException();
2035 reply.writeInt(res ? 1 : 0);
2036 return true;
2037 }
2038
2039 case NAVIGATE_UP_TO_TRANSACTION: {
2040 data.enforceInterface(IActivityManager.descriptor);
2041 IBinder token = data.readStrongBinder();
2042 Intent target = Intent.CREATOR.createFromParcel(data);
2043 int resultCode = data.readInt();
2044 Intent resultData = null;
2045 if (data.readInt() != 0) {
2046 resultData = Intent.CREATOR.createFromParcel(data);
2047 }
2048 boolean res = navigateUpTo(token, target, resultCode, resultData);
2049 reply.writeNoException();
2050 reply.writeInt(res ? 1 : 0);
2051 return true;
2052 }
2053
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002054 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2055 data.enforceInterface(IActivityManager.descriptor);
2056 IBinder token = data.readStrongBinder();
2057 int res = getLaunchedFromUid(token);
2058 reply.writeNoException();
2059 reply.writeInt(res);
2060 return true;
2061 }
2062
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002063 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2064 data.enforceInterface(IActivityManager.descriptor);
2065 IBinder token = data.readStrongBinder();
2066 String res = getLaunchedFromPackage(token);
2067 reply.writeNoException();
2068 reply.writeString(res);
2069 return true;
2070 }
2071
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002072 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2073 data.enforceInterface(IActivityManager.descriptor);
2074 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2075 data.readStrongBinder());
2076 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002077 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002078 return true;
2079 }
2080
2081 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2082 data.enforceInterface(IActivityManager.descriptor);
2083 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2084 data.readStrongBinder());
2085 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002086 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002087 return true;
2088 }
2089
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002090 case REQUEST_BUG_REPORT_TRANSACTION: {
2091 data.enforceInterface(IActivityManager.descriptor);
2092 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002093 reply.writeNoException();
2094 return true;
2095 }
2096
2097 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2098 data.enforceInterface(IActivityManager.descriptor);
2099 int pid = data.readInt();
2100 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002101 String reason = data.readString();
2102 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002103 reply.writeNoException();
2104 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002105 return true;
2106 }
2107
Adam Skorydfc7fd72013-08-05 19:23:41 -07002108 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002109 data.enforceInterface(IActivityManager.descriptor);
2110 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002111 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002112 reply.writeNoException();
2113 reply.writeBundle(res);
2114 return true;
2115 }
2116
Adam Skorydfc7fd72013-08-05 19:23:41 -07002117 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002118 data.enforceInterface(IActivityManager.descriptor);
2119 IBinder token = data.readStrongBinder();
2120 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002121 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002122 reply.writeNoException();
2123 return true;
2124 }
2125
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002126 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2127 data.enforceInterface(IActivityManager.descriptor);
2128 Intent intent = Intent.CREATOR.createFromParcel(data);
2129 int requestType = data.readInt();
2130 String hint = data.readString();
2131 int userHandle = data.readInt();
2132 boolean res = launchAssistIntent(intent, requestType, hint, userHandle);
2133 reply.writeNoException();
2134 reply.writeInt(res ? 1 : 0);
2135 return true;
2136 }
2137
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002138 case KILL_UID_TRANSACTION: {
2139 data.enforceInterface(IActivityManager.descriptor);
2140 int uid = data.readInt();
2141 String reason = data.readString();
2142 killUid(uid, reason);
2143 reply.writeNoException();
2144 return true;
2145 }
2146
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002147 case HANG_TRANSACTION: {
2148 data.enforceInterface(IActivityManager.descriptor);
2149 IBinder who = data.readStrongBinder();
2150 boolean allowRestart = data.readInt() != 0;
2151 hang(who, allowRestart);
2152 reply.writeNoException();
2153 return true;
2154 }
2155
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002156 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2157 data.enforceInterface(IActivityManager.descriptor);
2158 IBinder token = data.readStrongBinder();
2159 reportActivityFullyDrawn(token);
2160 reply.writeNoException();
2161 return true;
2162 }
2163
Craig Mautner5eda9b32013-07-02 11:58:16 -07002164 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2165 data.enforceInterface(IActivityManager.descriptor);
2166 IBinder token = data.readStrongBinder();
2167 notifyActivityDrawn(token);
2168 reply.writeNoException();
2169 return true;
2170 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002171
2172 case RESTART_TRANSACTION: {
2173 data.enforceInterface(IActivityManager.descriptor);
2174 restart();
2175 reply.writeNoException();
2176 return true;
2177 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002178
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002179 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2180 data.enforceInterface(IActivityManager.descriptor);
2181 performIdleMaintenance();
2182 reply.writeNoException();
2183 return true;
2184 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002185
2186 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2187 data.enforceInterface(IActivityManager.descriptor);
2188 IBinder parentActivityToken = data.readStrongBinder();
2189 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002190 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002191 IActivityContainer activityContainer =
2192 createActivityContainer(parentActivityToken, callback);
2193 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002194 if (activityContainer != null) {
2195 reply.writeInt(1);
2196 reply.writeStrongBinder(activityContainer.asBinder());
2197 } else {
2198 reply.writeInt(0);
2199 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002200 return true;
2201 }
2202
Craig Mautner95da1082014-02-24 17:54:35 -08002203 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2204 data.enforceInterface(IActivityManager.descriptor);
2205 IActivityContainer activityContainer =
2206 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2207 deleteActivityContainer(activityContainer);
2208 reply.writeNoException();
2209 return true;
2210 }
2211
Craig Mautnerca0653a2015-02-17 10:17:21 -08002212 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002213 data.enforceInterface(IActivityManager.descriptor);
2214 IBinder activityToken = data.readStrongBinder();
Craig Mautnerca0653a2015-02-17 10:17:21 -08002215 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002216 reply.writeNoException();
Craig Mautnerca0653a2015-02-17 10:17:21 -08002217 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002218 return true;
2219 }
2220
Craig Mautner4a1cb222013-12-04 16:14:06 -08002221 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2222 data.enforceInterface(IActivityManager.descriptor);
2223 IBinder homeActivityToken = getHomeActivityToken();
2224 reply.writeNoException();
2225 reply.writeStrongBinder(homeActivityToken);
2226 return true;
2227 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002228
2229 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2230 data.enforceInterface(IActivityManager.descriptor);
2231 final int taskId = data.readInt();
2232 startLockTaskMode(taskId);
2233 reply.writeNoException();
2234 return true;
2235 }
2236
2237 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2238 data.enforceInterface(IActivityManager.descriptor);
2239 IBinder token = data.readStrongBinder();
2240 startLockTaskMode(token);
2241 reply.writeNoException();
2242 return true;
2243 }
2244
Craig Mautnerd61dc202014-07-07 11:09:11 -07002245 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002246 data.enforceInterface(IActivityManager.descriptor);
2247 startLockTaskModeOnCurrent();
2248 reply.writeNoException();
2249 return true;
2250 }
2251
Craig Mautneraea74a52014-03-08 14:23:10 -08002252 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2253 data.enforceInterface(IActivityManager.descriptor);
2254 stopLockTaskMode();
2255 reply.writeNoException();
2256 return true;
2257 }
2258
Craig Mautnerd61dc202014-07-07 11:09:11 -07002259 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002260 data.enforceInterface(IActivityManager.descriptor);
2261 stopLockTaskModeOnCurrent();
2262 reply.writeNoException();
2263 return true;
2264 }
2265
Craig Mautneraea74a52014-03-08 14:23:10 -08002266 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2267 data.enforceInterface(IActivityManager.descriptor);
2268 final boolean isInLockTaskMode = isInLockTaskMode();
2269 reply.writeNoException();
2270 reply.writeInt(isInLockTaskMode ? 1 : 0);
2271 return true;
2272 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002273
Winson Chunga449dc02014-05-16 11:15:04 -07002274 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002275 data.enforceInterface(IActivityManager.descriptor);
2276 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002277 ActivityManager.TaskDescription values =
2278 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2279 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002280 reply.writeNoException();
2281 return true;
2282 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002283
Craig Mautner648f69b2014-09-18 14:16:26 -07002284 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2285 data.enforceInterface(IActivityManager.descriptor);
2286 String filename = data.readString();
2287 Bitmap icon = getTaskDescriptionIcon(filename);
2288 reply.writeNoException();
2289 if (icon == null) {
2290 reply.writeInt(0);
2291 } else {
2292 reply.writeInt(1);
2293 icon.writeToParcel(reply, 0);
2294 }
2295 return true;
2296 }
2297
Winson Chung044d5292014-11-06 11:05:19 -08002298 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2299 data.enforceInterface(IActivityManager.descriptor);
2300 final Bundle bundle;
2301 if (data.readInt() == 0) {
2302 bundle = null;
2303 } else {
2304 bundle = data.readBundle();
2305 }
2306 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2307 startInPlaceAnimationOnFrontMostApplication(options);
2308 reply.writeNoException();
2309 return true;
2310 }
2311
Jose Lima4b6c6692014-08-12 17:41:12 -07002312 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002313 data.enforceInterface(IActivityManager.descriptor);
2314 IBinder token = data.readStrongBinder();
2315 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002316 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002317 reply.writeNoException();
2318 reply.writeInt(success ? 1 : 0);
2319 return true;
2320 }
2321
Jose Lima4b6c6692014-08-12 17:41:12 -07002322 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002323 data.enforceInterface(IActivityManager.descriptor);
2324 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002325 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002326 reply.writeNoException();
2327 reply.writeInt(enabled ? 1 : 0);
2328 return true;
2329 }
2330
Jose Lima4b6c6692014-08-12 17:41:12 -07002331 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002332 data.enforceInterface(IActivityManager.descriptor);
2333 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002334 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002335 reply.writeNoException();
2336 return true;
2337 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002338
2339 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2340 data.enforceInterface(IActivityManager.descriptor);
2341 IBinder token = data.readStrongBinder();
2342 notifyLaunchTaskBehindComplete(token);
2343 reply.writeNoException();
2344 return true;
2345 }
Craig Mautner8746a472014-07-24 15:12:54 -07002346
2347 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2348 data.enforceInterface(IActivityManager.descriptor);
2349 IBinder token = data.readStrongBinder();
2350 notifyEnterAnimationComplete(token);
2351 reply.writeNoException();
2352 return true;
2353 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002354
2355 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2356 data.enforceInterface(IActivityManager.descriptor);
2357 bootAnimationComplete();
2358 reply.writeNoException();
2359 return true;
2360 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002361
2362 case SYSTEM_BACKUP_RESTORED: {
2363 data.enforceInterface(IActivityManager.descriptor);
2364 systemBackupRestored();
2365 reply.writeNoException();
2366 return true;
2367 }
Jeff Sharkeyc2ae6fb2015-01-15 21:27:13 -08002368
Jeff Sharkey605eb792014-11-04 13:34:06 -08002369 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2370 data.enforceInterface(IActivityManager.descriptor);
2371 final int uid = data.readInt();
2372 final byte[] firstPacket = data.createByteArray();
2373 notifyCleartextNetwork(uid, firstPacket);
2374 reply.writeNoException();
2375 return true;
2376 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002377 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002378
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002379 return super.onTransact(code, data, reply, flags);
2380 }
2381
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002382 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002383 return this;
2384 }
2385
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002386 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2387 protected IActivityManager create() {
2388 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002389 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002390 Log.v("ActivityManager", "default service binder = " + b);
2391 }
2392 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002393 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002394 Log.v("ActivityManager", "default service = " + am);
2395 }
2396 return am;
2397 }
2398 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002399}
2400
2401class ActivityManagerProxy implements IActivityManager
2402{
2403 public ActivityManagerProxy(IBinder remote)
2404 {
2405 mRemote = remote;
2406 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002407
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002408 public IBinder asBinder()
2409 {
2410 return mRemote;
2411 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002412
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002413 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002414 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002415 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002416 Parcel data = Parcel.obtain();
2417 Parcel reply = Parcel.obtain();
2418 data.writeInterfaceToken(IActivityManager.descriptor);
2419 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002420 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002421 intent.writeToParcel(data, 0);
2422 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002423 data.writeStrongBinder(resultTo);
2424 data.writeString(resultWho);
2425 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002426 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002427 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002428 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002429 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002430 } else {
2431 data.writeInt(0);
2432 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002433 if (options != null) {
2434 data.writeInt(1);
2435 options.writeToParcel(data, 0);
2436 } else {
2437 data.writeInt(0);
2438 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002439 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2440 reply.readException();
2441 int result = reply.readInt();
2442 reply.recycle();
2443 data.recycle();
2444 return result;
2445 }
Amith Yamasani82644082012-08-03 13:09:11 -07002446
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002447 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002448 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002449 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2450 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002451 Parcel data = Parcel.obtain();
2452 Parcel reply = Parcel.obtain();
2453 data.writeInterfaceToken(IActivityManager.descriptor);
2454 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002455 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002456 intent.writeToParcel(data, 0);
2457 data.writeString(resolvedType);
2458 data.writeStrongBinder(resultTo);
2459 data.writeString(resultWho);
2460 data.writeInt(requestCode);
2461 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002462 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002463 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002464 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002465 } else {
2466 data.writeInt(0);
2467 }
2468 if (options != null) {
2469 data.writeInt(1);
2470 options.writeToParcel(data, 0);
2471 } else {
2472 data.writeInt(0);
2473 }
2474 data.writeInt(userId);
2475 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2476 reply.readException();
2477 int result = reply.readInt();
2478 reply.recycle();
2479 data.recycle();
2480 return result;
2481 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002482 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2483 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002484 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002485 Parcel data = Parcel.obtain();
2486 Parcel reply = Parcel.obtain();
2487 data.writeInterfaceToken(IActivityManager.descriptor);
2488 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2489 data.writeString(callingPackage);
2490 intent.writeToParcel(data, 0);
2491 data.writeString(resolvedType);
2492 data.writeStrongBinder(resultTo);
2493 data.writeString(resultWho);
2494 data.writeInt(requestCode);
2495 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002496 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002497 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002498 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002499 } else {
2500 data.writeInt(0);
2501 }
2502 if (options != null) {
2503 data.writeInt(1);
2504 options.writeToParcel(data, 0);
2505 } else {
2506 data.writeInt(0);
2507 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002508 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002509 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2510 reply.readException();
2511 int result = reply.readInt();
2512 reply.recycle();
2513 data.recycle();
2514 return result;
2515 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002516 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2517 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002518 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2519 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002520 Parcel data = Parcel.obtain();
2521 Parcel reply = Parcel.obtain();
2522 data.writeInterfaceToken(IActivityManager.descriptor);
2523 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002524 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002525 intent.writeToParcel(data, 0);
2526 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002527 data.writeStrongBinder(resultTo);
2528 data.writeString(resultWho);
2529 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002530 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002531 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002532 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002533 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002534 } else {
2535 data.writeInt(0);
2536 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002537 if (options != null) {
2538 data.writeInt(1);
2539 options.writeToParcel(data, 0);
2540 } else {
2541 data.writeInt(0);
2542 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002543 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002544 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2545 reply.readException();
2546 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2547 reply.recycle();
2548 data.recycle();
2549 return result;
2550 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002551 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2552 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002553 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002554 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002555 Parcel data = Parcel.obtain();
2556 Parcel reply = Parcel.obtain();
2557 data.writeInterfaceToken(IActivityManager.descriptor);
2558 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002559 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002560 intent.writeToParcel(data, 0);
2561 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002562 data.writeStrongBinder(resultTo);
2563 data.writeString(resultWho);
2564 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002565 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002566 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002567 if (options != null) {
2568 data.writeInt(1);
2569 options.writeToParcel(data, 0);
2570 } else {
2571 data.writeInt(0);
2572 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002573 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002574 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2575 reply.readException();
2576 int result = reply.readInt();
2577 reply.recycle();
2578 data.recycle();
2579 return result;
2580 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002581 public int startActivityIntentSender(IApplicationThread caller,
2582 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002583 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002584 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002585 Parcel data = Parcel.obtain();
2586 Parcel reply = Parcel.obtain();
2587 data.writeInterfaceToken(IActivityManager.descriptor);
2588 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2589 intent.writeToParcel(data, 0);
2590 if (fillInIntent != null) {
2591 data.writeInt(1);
2592 fillInIntent.writeToParcel(data, 0);
2593 } else {
2594 data.writeInt(0);
2595 }
2596 data.writeString(resolvedType);
2597 data.writeStrongBinder(resultTo);
2598 data.writeString(resultWho);
2599 data.writeInt(requestCode);
2600 data.writeInt(flagsMask);
2601 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002602 if (options != null) {
2603 data.writeInt(1);
2604 options.writeToParcel(data, 0);
2605 } else {
2606 data.writeInt(0);
2607 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002608 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002609 reply.readException();
2610 int result = reply.readInt();
2611 reply.recycle();
2612 data.recycle();
2613 return result;
2614 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002615 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2616 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002617 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2618 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002619 Parcel data = Parcel.obtain();
2620 Parcel reply = Parcel.obtain();
2621 data.writeInterfaceToken(IActivityManager.descriptor);
2622 data.writeString(callingPackage);
2623 data.writeInt(callingPid);
2624 data.writeInt(callingUid);
2625 intent.writeToParcel(data, 0);
2626 data.writeString(resolvedType);
2627 data.writeStrongBinder(session.asBinder());
2628 data.writeStrongBinder(interactor.asBinder());
2629 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002630 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002631 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002632 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002633 } else {
2634 data.writeInt(0);
2635 }
2636 if (options != null) {
2637 data.writeInt(1);
2638 options.writeToParcel(data, 0);
2639 } else {
2640 data.writeInt(0);
2641 }
2642 data.writeInt(userId);
2643 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2644 reply.readException();
2645 int result = reply.readInt();
2646 reply.recycle();
2647 data.recycle();
2648 return result;
2649 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002650 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002651 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002652 Parcel data = Parcel.obtain();
2653 Parcel reply = Parcel.obtain();
2654 data.writeInterfaceToken(IActivityManager.descriptor);
2655 data.writeStrongBinder(callingActivity);
2656 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002657 if (options != null) {
2658 data.writeInt(1);
2659 options.writeToParcel(data, 0);
2660 } else {
2661 data.writeInt(0);
2662 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002663 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2664 reply.readException();
2665 int result = reply.readInt();
2666 reply.recycle();
2667 data.recycle();
2668 return result != 0;
2669 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002670 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2671 Parcel data = Parcel.obtain();
2672 Parcel reply = Parcel.obtain();
2673 data.writeInterfaceToken(IActivityManager.descriptor);
2674 data.writeInt(taskId);
2675 if (options == null) {
2676 data.writeInt(0);
2677 } else {
2678 data.writeInt(1);
2679 options.writeToParcel(data, 0);
2680 }
2681 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2682 reply.readException();
2683 int result = reply.readInt();
2684 reply.recycle();
2685 data.recycle();
2686 return result;
2687 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002688 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002689 throws RemoteException {
2690 Parcel data = Parcel.obtain();
2691 Parcel reply = Parcel.obtain();
2692 data.writeInterfaceToken(IActivityManager.descriptor);
2693 data.writeStrongBinder(token);
2694 data.writeInt(resultCode);
2695 if (resultData != null) {
2696 data.writeInt(1);
2697 resultData.writeToParcel(data, 0);
2698 } else {
2699 data.writeInt(0);
2700 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002701 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002702 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2703 reply.readException();
2704 boolean res = reply.readInt() != 0;
2705 data.recycle();
2706 reply.recycle();
2707 return res;
2708 }
2709 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2710 {
2711 Parcel data = Parcel.obtain();
2712 Parcel reply = Parcel.obtain();
2713 data.writeInterfaceToken(IActivityManager.descriptor);
2714 data.writeStrongBinder(token);
2715 data.writeString(resultWho);
2716 data.writeInt(requestCode);
2717 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2718 reply.readException();
2719 data.recycle();
2720 reply.recycle();
2721 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002722 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2723 Parcel data = Parcel.obtain();
2724 Parcel reply = Parcel.obtain();
2725 data.writeInterfaceToken(IActivityManager.descriptor);
2726 data.writeStrongBinder(token);
2727 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2728 reply.readException();
2729 boolean res = reply.readInt() != 0;
2730 data.recycle();
2731 reply.recycle();
2732 return res;
2733 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002734 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2735 Parcel data = Parcel.obtain();
2736 Parcel reply = Parcel.obtain();
2737 data.writeInterfaceToken(IActivityManager.descriptor);
2738 data.writeStrongBinder(session.asBinder());
2739 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2740 reply.readException();
2741 data.recycle();
2742 reply.recycle();
2743 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002744 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2745 Parcel data = Parcel.obtain();
2746 Parcel reply = Parcel.obtain();
2747 data.writeInterfaceToken(IActivityManager.descriptor);
2748 data.writeStrongBinder(token);
2749 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2750 reply.readException();
2751 boolean res = reply.readInt() != 0;
2752 data.recycle();
2753 reply.recycle();
2754 return res;
2755 }
2756 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2757 Parcel data = Parcel.obtain();
2758 Parcel reply = Parcel.obtain();
2759 data.writeInterfaceToken(IActivityManager.descriptor);
2760 data.writeStrongBinder(app.asBinder());
2761 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2762 reply.readException();
2763 data.recycle();
2764 reply.recycle();
2765 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002766 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2767 Parcel data = Parcel.obtain();
2768 Parcel reply = Parcel.obtain();
2769 data.writeInterfaceToken(IActivityManager.descriptor);
2770 data.writeStrongBinder(token);
2771 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2772 reply.readException();
2773 boolean res = reply.readInt() != 0;
2774 data.recycle();
2775 reply.recycle();
2776 return res;
2777 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002778 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002779 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002780 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002781 {
2782 Parcel data = Parcel.obtain();
2783 Parcel reply = Parcel.obtain();
2784 data.writeInterfaceToken(IActivityManager.descriptor);
2785 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002786 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002787 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2788 filter.writeToParcel(data, 0);
2789 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002790 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002791 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2792 reply.readException();
2793 Intent intent = null;
2794 int haveIntent = reply.readInt();
2795 if (haveIntent != 0) {
2796 intent = Intent.CREATOR.createFromParcel(reply);
2797 }
2798 reply.recycle();
2799 data.recycle();
2800 return intent;
2801 }
2802 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2803 {
2804 Parcel data = Parcel.obtain();
2805 Parcel reply = Parcel.obtain();
2806 data.writeInterfaceToken(IActivityManager.descriptor);
2807 data.writeStrongBinder(receiver.asBinder());
2808 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2809 reply.readException();
2810 data.recycle();
2811 reply.recycle();
2812 }
2813 public int broadcastIntent(IApplicationThread caller,
2814 Intent intent, String resolvedType, IIntentReceiver resultTo,
2815 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002816 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002817 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002818 {
2819 Parcel data = Parcel.obtain();
2820 Parcel reply = Parcel.obtain();
2821 data.writeInterfaceToken(IActivityManager.descriptor);
2822 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2823 intent.writeToParcel(data, 0);
2824 data.writeString(resolvedType);
2825 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2826 data.writeInt(resultCode);
2827 data.writeString(resultData);
2828 data.writeBundle(map);
2829 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002830 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002831 data.writeInt(serialized ? 1 : 0);
2832 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002833 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002834 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2835 reply.readException();
2836 int res = reply.readInt();
2837 reply.recycle();
2838 data.recycle();
2839 return res;
2840 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002841 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2842 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002843 {
2844 Parcel data = Parcel.obtain();
2845 Parcel reply = Parcel.obtain();
2846 data.writeInterfaceToken(IActivityManager.descriptor);
2847 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2848 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002849 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002850 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2851 reply.readException();
2852 data.recycle();
2853 reply.recycle();
2854 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002855 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
2856 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002857 {
2858 Parcel data = Parcel.obtain();
2859 Parcel reply = Parcel.obtain();
2860 data.writeInterfaceToken(IActivityManager.descriptor);
2861 data.writeStrongBinder(who);
2862 data.writeInt(resultCode);
2863 data.writeString(resultData);
2864 data.writeBundle(map);
2865 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002866 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002867 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2868 reply.readException();
2869 data.recycle();
2870 reply.recycle();
2871 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002872 public void attachApplication(IApplicationThread app) throws RemoteException
2873 {
2874 Parcel data = Parcel.obtain();
2875 Parcel reply = Parcel.obtain();
2876 data.writeInterfaceToken(IActivityManager.descriptor);
2877 data.writeStrongBinder(app.asBinder());
2878 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2879 reply.readException();
2880 data.recycle();
2881 reply.recycle();
2882 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002883 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2884 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002885 {
2886 Parcel data = Parcel.obtain();
2887 Parcel reply = Parcel.obtain();
2888 data.writeInterfaceToken(IActivityManager.descriptor);
2889 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002890 if (config != null) {
2891 data.writeInt(1);
2892 config.writeToParcel(data, 0);
2893 } else {
2894 data.writeInt(0);
2895 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002896 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002897 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2898 reply.readException();
2899 data.recycle();
2900 reply.recycle();
2901 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002902 public void activityResumed(IBinder token) throws RemoteException
2903 {
2904 Parcel data = Parcel.obtain();
2905 Parcel reply = Parcel.obtain();
2906 data.writeInterfaceToken(IActivityManager.descriptor);
2907 data.writeStrongBinder(token);
2908 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2909 reply.readException();
2910 data.recycle();
2911 reply.recycle();
2912 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07002913 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002914 {
2915 Parcel data = Parcel.obtain();
2916 Parcel reply = Parcel.obtain();
2917 data.writeInterfaceToken(IActivityManager.descriptor);
2918 data.writeStrongBinder(token);
2919 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2920 reply.readException();
2921 data.recycle();
2922 reply.recycle();
2923 }
2924 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002925 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002926 {
2927 Parcel data = Parcel.obtain();
2928 Parcel reply = Parcel.obtain();
2929 data.writeInterfaceToken(IActivityManager.descriptor);
2930 data.writeStrongBinder(token);
2931 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002932 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002933 TextUtils.writeToParcel(description, data, 0);
2934 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2935 reply.readException();
2936 data.recycle();
2937 reply.recycle();
2938 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002939 public void activitySlept(IBinder token) throws RemoteException
2940 {
2941 Parcel data = Parcel.obtain();
2942 Parcel reply = Parcel.obtain();
2943 data.writeInterfaceToken(IActivityManager.descriptor);
2944 data.writeStrongBinder(token);
2945 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2946 reply.readException();
2947 data.recycle();
2948 reply.recycle();
2949 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002950 public void activityDestroyed(IBinder token) throws RemoteException
2951 {
2952 Parcel data = Parcel.obtain();
2953 Parcel reply = Parcel.obtain();
2954 data.writeInterfaceToken(IActivityManager.descriptor);
2955 data.writeStrongBinder(token);
2956 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2957 reply.readException();
2958 data.recycle();
2959 reply.recycle();
2960 }
2961 public String getCallingPackage(IBinder token) throws RemoteException
2962 {
2963 Parcel data = Parcel.obtain();
2964 Parcel reply = Parcel.obtain();
2965 data.writeInterfaceToken(IActivityManager.descriptor);
2966 data.writeStrongBinder(token);
2967 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2968 reply.readException();
2969 String res = reply.readString();
2970 data.recycle();
2971 reply.recycle();
2972 return res;
2973 }
2974 public ComponentName getCallingActivity(IBinder token)
2975 throws RemoteException {
2976 Parcel data = Parcel.obtain();
2977 Parcel reply = Parcel.obtain();
2978 data.writeInterfaceToken(IActivityManager.descriptor);
2979 data.writeStrongBinder(token);
2980 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2981 reply.readException();
2982 ComponentName res = ComponentName.readFromParcel(reply);
2983 data.recycle();
2984 reply.recycle();
2985 return res;
2986 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002987 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07002988 Parcel data = Parcel.obtain();
2989 Parcel reply = Parcel.obtain();
2990 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002991 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07002992 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2993 reply.readException();
2994 ArrayList<IAppTask> list = null;
2995 int N = reply.readInt();
2996 if (N >= 0) {
2997 list = new ArrayList<IAppTask>();
2998 while (N > 0) {
2999 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3000 list.add(task);
3001 N--;
3002 }
3003 }
3004 data.recycle();
3005 reply.recycle();
3006 return list;
3007 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003008 public int addAppTask(IBinder activityToken, Intent intent,
3009 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3010 Parcel data = Parcel.obtain();
3011 Parcel reply = Parcel.obtain();
3012 data.writeInterfaceToken(IActivityManager.descriptor);
3013 data.writeStrongBinder(activityToken);
3014 intent.writeToParcel(data, 0);
3015 description.writeToParcel(data, 0);
3016 thumbnail.writeToParcel(data, 0);
3017 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3018 reply.readException();
3019 int res = reply.readInt();
3020 data.recycle();
3021 reply.recycle();
3022 return res;
3023 }
3024 public Point getAppTaskThumbnailSize() throws RemoteException {
3025 Parcel data = Parcel.obtain();
3026 Parcel reply = Parcel.obtain();
3027 data.writeInterfaceToken(IActivityManager.descriptor);
3028 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3029 reply.readException();
3030 Point size = Point.CREATOR.createFromParcel(reply);
3031 data.recycle();
3032 reply.recycle();
3033 return size;
3034 }
Dianne Hackborn09233282014-04-30 11:33:59 -07003035 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003036 Parcel data = Parcel.obtain();
3037 Parcel reply = Parcel.obtain();
3038 data.writeInterfaceToken(IActivityManager.descriptor);
3039 data.writeInt(maxNum);
3040 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003041 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3042 reply.readException();
3043 ArrayList list = null;
3044 int N = reply.readInt();
3045 if (N >= 0) {
3046 list = new ArrayList();
3047 while (N > 0) {
3048 ActivityManager.RunningTaskInfo info =
3049 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003050 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003051 list.add(info);
3052 N--;
3053 }
3054 }
3055 data.recycle();
3056 reply.recycle();
3057 return list;
3058 }
3059 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003060 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003061 Parcel data = Parcel.obtain();
3062 Parcel reply = Parcel.obtain();
3063 data.writeInterfaceToken(IActivityManager.descriptor);
3064 data.writeInt(maxNum);
3065 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003066 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003067 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3068 reply.readException();
3069 ArrayList<ActivityManager.RecentTaskInfo> list
3070 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3071 data.recycle();
3072 reply.recycle();
3073 return list;
3074 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003075 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003076 Parcel data = Parcel.obtain();
3077 Parcel reply = Parcel.obtain();
3078 data.writeInterfaceToken(IActivityManager.descriptor);
3079 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003080 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003081 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003082 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003083 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003084 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003085 }
3086 data.recycle();
3087 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003088 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003089 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003090 public List getServices(int maxNum, int flags) throws RemoteException {
3091 Parcel data = Parcel.obtain();
3092 Parcel reply = Parcel.obtain();
3093 data.writeInterfaceToken(IActivityManager.descriptor);
3094 data.writeInt(maxNum);
3095 data.writeInt(flags);
3096 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3097 reply.readException();
3098 ArrayList list = null;
3099 int N = reply.readInt();
3100 if (N >= 0) {
3101 list = new ArrayList();
3102 while (N > 0) {
3103 ActivityManager.RunningServiceInfo info =
3104 ActivityManager.RunningServiceInfo.CREATOR
3105 .createFromParcel(reply);
3106 list.add(info);
3107 N--;
3108 }
3109 }
3110 data.recycle();
3111 reply.recycle();
3112 return list;
3113 }
3114 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3115 throws RemoteException {
3116 Parcel data = Parcel.obtain();
3117 Parcel reply = Parcel.obtain();
3118 data.writeInterfaceToken(IActivityManager.descriptor);
3119 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3120 reply.readException();
3121 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3122 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3123 data.recycle();
3124 reply.recycle();
3125 return list;
3126 }
3127 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3128 throws RemoteException {
3129 Parcel data = Parcel.obtain();
3130 Parcel reply = Parcel.obtain();
3131 data.writeInterfaceToken(IActivityManager.descriptor);
3132 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3133 reply.readException();
3134 ArrayList<ActivityManager.RunningAppProcessInfo> list
3135 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3136 data.recycle();
3137 reply.recycle();
3138 return list;
3139 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003140 public List<ApplicationInfo> getRunningExternalApplications()
3141 throws RemoteException {
3142 Parcel data = Parcel.obtain();
3143 Parcel reply = Parcel.obtain();
3144 data.writeInterfaceToken(IActivityManager.descriptor);
3145 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3146 reply.readException();
3147 ArrayList<ApplicationInfo> list
3148 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3149 data.recycle();
3150 reply.recycle();
3151 return list;
3152 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003153 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003154 {
3155 Parcel data = Parcel.obtain();
3156 Parcel reply = Parcel.obtain();
3157 data.writeInterfaceToken(IActivityManager.descriptor);
3158 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003159 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003160 if (options != null) {
3161 data.writeInt(1);
3162 options.writeToParcel(data, 0);
3163 } else {
3164 data.writeInt(0);
3165 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003166 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3167 reply.readException();
3168 data.recycle();
3169 reply.recycle();
3170 }
3171 public void moveTaskToBack(int task) throws RemoteException
3172 {
3173 Parcel data = Parcel.obtain();
3174 Parcel reply = Parcel.obtain();
3175 data.writeInterfaceToken(IActivityManager.descriptor);
3176 data.writeInt(task);
3177 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3178 reply.readException();
3179 data.recycle();
3180 reply.recycle();
3181 }
3182 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3183 throws RemoteException {
3184 Parcel data = Parcel.obtain();
3185 Parcel reply = Parcel.obtain();
3186 data.writeInterfaceToken(IActivityManager.descriptor);
3187 data.writeStrongBinder(token);
3188 data.writeInt(nonRoot ? 1 : 0);
3189 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3190 reply.readException();
3191 boolean res = reply.readInt() != 0;
3192 data.recycle();
3193 reply.recycle();
3194 return res;
3195 }
3196 public void moveTaskBackwards(int task) throws RemoteException
3197 {
3198 Parcel data = Parcel.obtain();
3199 Parcel reply = Parcel.obtain();
3200 data.writeInterfaceToken(IActivityManager.descriptor);
3201 data.writeInt(task);
3202 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3203 reply.readException();
3204 data.recycle();
3205 reply.recycle();
3206 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003207 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003208 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3209 {
3210 Parcel data = Parcel.obtain();
3211 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003212 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003213 data.writeInt(taskId);
3214 data.writeInt(stackId);
3215 data.writeInt(toTop ? 1 : 0);
3216 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3217 reply.readException();
3218 data.recycle();
3219 reply.recycle();
3220 }
3221 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003222 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003223 {
3224 Parcel data = Parcel.obtain();
3225 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003226 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003227 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003228 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003229 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003230 reply.readException();
3231 data.recycle();
3232 reply.recycle();
3233 }
Craig Mautner967212c2013-04-13 21:10:58 -07003234 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003235 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003236 {
3237 Parcel data = Parcel.obtain();
3238 Parcel reply = Parcel.obtain();
3239 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003240 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003241 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003242 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003243 data.recycle();
3244 reply.recycle();
3245 return list;
3246 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003247 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003248 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003249 {
3250 Parcel data = Parcel.obtain();
3251 Parcel reply = Parcel.obtain();
3252 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003253 data.writeInt(stackId);
3254 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003255 reply.readException();
3256 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003257 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003258 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003259 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003260 }
3261 data.recycle();
3262 reply.recycle();
3263 return info;
3264 }
3265 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003266 public boolean isInHomeStack(int taskId) throws RemoteException {
3267 Parcel data = Parcel.obtain();
3268 Parcel reply = Parcel.obtain();
3269 data.writeInterfaceToken(IActivityManager.descriptor);
3270 data.writeInt(taskId);
3271 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3272 reply.readException();
3273 boolean isInHomeStack = reply.readInt() > 0;
3274 data.recycle();
3275 reply.recycle();
3276 return isInHomeStack;
3277 }
3278 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003279 public void setFocusedStack(int stackId) throws RemoteException
3280 {
3281 Parcel data = Parcel.obtain();
3282 Parcel reply = Parcel.obtain();
3283 data.writeInterfaceToken(IActivityManager.descriptor);
3284 data.writeInt(stackId);
3285 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3286 reply.readException();
3287 data.recycle();
3288 reply.recycle();
3289 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003290 @Override
3291 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3292 {
3293 Parcel data = Parcel.obtain();
3294 Parcel reply = Parcel.obtain();
3295 data.writeInterfaceToken(IActivityManager.descriptor);
3296 data.writeStrongBinder(listener.asBinder());
3297 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3298 reply.readException();
3299 data.recycle();
3300 reply.recycle();
3301 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003302 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3303 {
3304 Parcel data = Parcel.obtain();
3305 Parcel reply = Parcel.obtain();
3306 data.writeInterfaceToken(IActivityManager.descriptor);
3307 data.writeStrongBinder(token);
3308 data.writeInt(onlyRoot ? 1 : 0);
3309 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3310 reply.readException();
3311 int res = reply.readInt();
3312 data.recycle();
3313 reply.recycle();
3314 return res;
3315 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003316 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003317 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003318 Parcel data = Parcel.obtain();
3319 Parcel reply = Parcel.obtain();
3320 data.writeInterfaceToken(IActivityManager.descriptor);
3321 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3322 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003323 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003324 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003325 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3326 reply.readException();
3327 int res = reply.readInt();
3328 ContentProviderHolder cph = null;
3329 if (res != 0) {
3330 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3331 }
3332 data.recycle();
3333 reply.recycle();
3334 return cph;
3335 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003336 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3337 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003338 Parcel data = Parcel.obtain();
3339 Parcel reply = Parcel.obtain();
3340 data.writeInterfaceToken(IActivityManager.descriptor);
3341 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003342 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003343 data.writeStrongBinder(token);
3344 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3345 reply.readException();
3346 int res = reply.readInt();
3347 ContentProviderHolder cph = null;
3348 if (res != 0) {
3349 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3350 }
3351 data.recycle();
3352 reply.recycle();
3353 return cph;
3354 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003355 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003356 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003357 {
3358 Parcel data = Parcel.obtain();
3359 Parcel reply = Parcel.obtain();
3360 data.writeInterfaceToken(IActivityManager.descriptor);
3361 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3362 data.writeTypedList(providers);
3363 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3364 reply.readException();
3365 data.recycle();
3366 reply.recycle();
3367 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003368 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3369 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003370 Parcel data = Parcel.obtain();
3371 Parcel reply = Parcel.obtain();
3372 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003373 data.writeStrongBinder(connection);
3374 data.writeInt(stable);
3375 data.writeInt(unstable);
3376 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3377 reply.readException();
3378 boolean res = reply.readInt() != 0;
3379 data.recycle();
3380 reply.recycle();
3381 return res;
3382 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003383
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003384 public void unstableProviderDied(IBinder connection) throws RemoteException {
3385 Parcel data = Parcel.obtain();
3386 Parcel reply = Parcel.obtain();
3387 data.writeInterfaceToken(IActivityManager.descriptor);
3388 data.writeStrongBinder(connection);
3389 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3390 reply.readException();
3391 data.recycle();
3392 reply.recycle();
3393 }
3394
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003395 @Override
3396 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3397 Parcel data = Parcel.obtain();
3398 Parcel reply = Parcel.obtain();
3399 data.writeInterfaceToken(IActivityManager.descriptor);
3400 data.writeStrongBinder(connection);
3401 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3402 reply.readException();
3403 data.recycle();
3404 reply.recycle();
3405 }
3406
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003407 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3408 Parcel data = Parcel.obtain();
3409 Parcel reply = Parcel.obtain();
3410 data.writeInterfaceToken(IActivityManager.descriptor);
3411 data.writeStrongBinder(connection);
3412 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003413 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3414 reply.readException();
3415 data.recycle();
3416 reply.recycle();
3417 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003418
3419 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3420 Parcel data = Parcel.obtain();
3421 Parcel reply = Parcel.obtain();
3422 data.writeInterfaceToken(IActivityManager.descriptor);
3423 data.writeString(name);
3424 data.writeStrongBinder(token);
3425 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3426 reply.readException();
3427 data.recycle();
3428 reply.recycle();
3429 }
3430
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003431 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3432 throws RemoteException
3433 {
3434 Parcel data = Parcel.obtain();
3435 Parcel reply = Parcel.obtain();
3436 data.writeInterfaceToken(IActivityManager.descriptor);
3437 service.writeToParcel(data, 0);
3438 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3439 reply.readException();
3440 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3441 data.recycle();
3442 reply.recycle();
3443 return res;
3444 }
3445
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003446 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003447 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003448 {
3449 Parcel data = Parcel.obtain();
3450 Parcel reply = Parcel.obtain();
3451 data.writeInterfaceToken(IActivityManager.descriptor);
3452 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3453 service.writeToParcel(data, 0);
3454 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003455 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003456 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3457 reply.readException();
3458 ComponentName res = ComponentName.readFromParcel(reply);
3459 data.recycle();
3460 reply.recycle();
3461 return res;
3462 }
3463 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003464 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003465 {
3466 Parcel data = Parcel.obtain();
3467 Parcel reply = Parcel.obtain();
3468 data.writeInterfaceToken(IActivityManager.descriptor);
3469 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3470 service.writeToParcel(data, 0);
3471 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003472 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003473 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3474 reply.readException();
3475 int res = reply.readInt();
3476 reply.recycle();
3477 data.recycle();
3478 return res;
3479 }
3480 public boolean stopServiceToken(ComponentName className, IBinder token,
3481 int startId) throws RemoteException {
3482 Parcel data = Parcel.obtain();
3483 Parcel reply = Parcel.obtain();
3484 data.writeInterfaceToken(IActivityManager.descriptor);
3485 ComponentName.writeToParcel(className, data);
3486 data.writeStrongBinder(token);
3487 data.writeInt(startId);
3488 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3489 reply.readException();
3490 boolean res = reply.readInt() != 0;
3491 data.recycle();
3492 reply.recycle();
3493 return res;
3494 }
3495 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003496 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003497 Parcel data = Parcel.obtain();
3498 Parcel reply = Parcel.obtain();
3499 data.writeInterfaceToken(IActivityManager.descriptor);
3500 ComponentName.writeToParcel(className, data);
3501 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003502 data.writeInt(id);
3503 if (notification != null) {
3504 data.writeInt(1);
3505 notification.writeToParcel(data, 0);
3506 } else {
3507 data.writeInt(0);
3508 }
3509 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003510 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3511 reply.readException();
3512 data.recycle();
3513 reply.recycle();
3514 }
3515 public int bindService(IApplicationThread caller, IBinder token,
3516 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003517 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003518 Parcel data = Parcel.obtain();
3519 Parcel reply = Parcel.obtain();
3520 data.writeInterfaceToken(IActivityManager.descriptor);
3521 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3522 data.writeStrongBinder(token);
3523 service.writeToParcel(data, 0);
3524 data.writeString(resolvedType);
3525 data.writeStrongBinder(connection.asBinder());
3526 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003527 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003528 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3529 reply.readException();
3530 int res = reply.readInt();
3531 data.recycle();
3532 reply.recycle();
3533 return res;
3534 }
3535 public boolean unbindService(IServiceConnection connection) throws RemoteException
3536 {
3537 Parcel data = Parcel.obtain();
3538 Parcel reply = Parcel.obtain();
3539 data.writeInterfaceToken(IActivityManager.descriptor);
3540 data.writeStrongBinder(connection.asBinder());
3541 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3542 reply.readException();
3543 boolean res = reply.readInt() != 0;
3544 data.recycle();
3545 reply.recycle();
3546 return res;
3547 }
3548
3549 public void publishService(IBinder token,
3550 Intent intent, IBinder service) throws RemoteException {
3551 Parcel data = Parcel.obtain();
3552 Parcel reply = Parcel.obtain();
3553 data.writeInterfaceToken(IActivityManager.descriptor);
3554 data.writeStrongBinder(token);
3555 intent.writeToParcel(data, 0);
3556 data.writeStrongBinder(service);
3557 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3558 reply.readException();
3559 data.recycle();
3560 reply.recycle();
3561 }
3562
3563 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3564 throws RemoteException {
3565 Parcel data = Parcel.obtain();
3566 Parcel reply = Parcel.obtain();
3567 data.writeInterfaceToken(IActivityManager.descriptor);
3568 data.writeStrongBinder(token);
3569 intent.writeToParcel(data, 0);
3570 data.writeInt(doRebind ? 1 : 0);
3571 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3572 reply.readException();
3573 data.recycle();
3574 reply.recycle();
3575 }
3576
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003577 public void serviceDoneExecuting(IBinder token, int type, int startId,
3578 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003579 Parcel data = Parcel.obtain();
3580 Parcel reply = Parcel.obtain();
3581 data.writeInterfaceToken(IActivityManager.descriptor);
3582 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003583 data.writeInt(type);
3584 data.writeInt(startId);
3585 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003586 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3587 reply.readException();
3588 data.recycle();
3589 reply.recycle();
3590 }
3591
3592 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3593 Parcel data = Parcel.obtain();
3594 Parcel reply = Parcel.obtain();
3595 data.writeInterfaceToken(IActivityManager.descriptor);
3596 service.writeToParcel(data, 0);
3597 data.writeString(resolvedType);
3598 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3599 reply.readException();
3600 IBinder binder = reply.readStrongBinder();
3601 reply.recycle();
3602 data.recycle();
3603 return binder;
3604 }
3605
Christopher Tate181fafa2009-05-14 11:12:14 -07003606 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3607 throws RemoteException {
3608 Parcel data = Parcel.obtain();
3609 Parcel reply = Parcel.obtain();
3610 data.writeInterfaceToken(IActivityManager.descriptor);
3611 app.writeToParcel(data, 0);
3612 data.writeInt(backupRestoreMode);
3613 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3614 reply.readException();
3615 boolean success = reply.readInt() != 0;
3616 reply.recycle();
3617 data.recycle();
3618 return success;
3619 }
3620
Christopher Tate346acb12012-10-15 19:20:25 -07003621 public void clearPendingBackup() throws RemoteException {
3622 Parcel data = Parcel.obtain();
3623 Parcel reply = Parcel.obtain();
3624 data.writeInterfaceToken(IActivityManager.descriptor);
3625 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3626 reply.recycle();
3627 data.recycle();
3628 }
3629
Christopher Tate181fafa2009-05-14 11:12:14 -07003630 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3631 Parcel data = Parcel.obtain();
3632 Parcel reply = Parcel.obtain();
3633 data.writeInterfaceToken(IActivityManager.descriptor);
3634 data.writeString(packageName);
3635 data.writeStrongBinder(agent);
3636 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3637 reply.recycle();
3638 data.recycle();
3639 }
3640
3641 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3642 Parcel data = Parcel.obtain();
3643 Parcel reply = Parcel.obtain();
3644 data.writeInterfaceToken(IActivityManager.descriptor);
3645 app.writeToParcel(data, 0);
3646 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3647 reply.readException();
3648 reply.recycle();
3649 data.recycle();
3650 }
3651
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003652 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003653 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003654 IUiAutomationConnection connection, int userId, String instructionSet)
3655 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003656 Parcel data = Parcel.obtain();
3657 Parcel reply = Parcel.obtain();
3658 data.writeInterfaceToken(IActivityManager.descriptor);
3659 ComponentName.writeToParcel(className, data);
3660 data.writeString(profileFile);
3661 data.writeInt(flags);
3662 data.writeBundle(arguments);
3663 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003664 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003665 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003666 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003667 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3668 reply.readException();
3669 boolean res = reply.readInt() != 0;
3670 reply.recycle();
3671 data.recycle();
3672 return res;
3673 }
3674
3675 public void finishInstrumentation(IApplicationThread target,
3676 int resultCode, Bundle results) throws RemoteException {
3677 Parcel data = Parcel.obtain();
3678 Parcel reply = Parcel.obtain();
3679 data.writeInterfaceToken(IActivityManager.descriptor);
3680 data.writeStrongBinder(target != null ? target.asBinder() : null);
3681 data.writeInt(resultCode);
3682 data.writeBundle(results);
3683 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3684 reply.readException();
3685 data.recycle();
3686 reply.recycle();
3687 }
3688 public Configuration getConfiguration() throws RemoteException
3689 {
3690 Parcel data = Parcel.obtain();
3691 Parcel reply = Parcel.obtain();
3692 data.writeInterfaceToken(IActivityManager.descriptor);
3693 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3694 reply.readException();
3695 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3696 reply.recycle();
3697 data.recycle();
3698 return res;
3699 }
3700 public void updateConfiguration(Configuration values) throws RemoteException
3701 {
3702 Parcel data = Parcel.obtain();
3703 Parcel reply = Parcel.obtain();
3704 data.writeInterfaceToken(IActivityManager.descriptor);
3705 values.writeToParcel(data, 0);
3706 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3707 reply.readException();
3708 data.recycle();
3709 reply.recycle();
3710 }
3711 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3712 throws RemoteException {
3713 Parcel data = Parcel.obtain();
3714 Parcel reply = Parcel.obtain();
3715 data.writeInterfaceToken(IActivityManager.descriptor);
3716 data.writeStrongBinder(token);
3717 data.writeInt(requestedOrientation);
3718 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3719 reply.readException();
3720 data.recycle();
3721 reply.recycle();
3722 }
3723 public int getRequestedOrientation(IBinder token) throws RemoteException {
3724 Parcel data = Parcel.obtain();
3725 Parcel reply = Parcel.obtain();
3726 data.writeInterfaceToken(IActivityManager.descriptor);
3727 data.writeStrongBinder(token);
3728 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3729 reply.readException();
3730 int res = reply.readInt();
3731 data.recycle();
3732 reply.recycle();
3733 return res;
3734 }
3735 public ComponentName getActivityClassForToken(IBinder token)
3736 throws RemoteException {
3737 Parcel data = Parcel.obtain();
3738 Parcel reply = Parcel.obtain();
3739 data.writeInterfaceToken(IActivityManager.descriptor);
3740 data.writeStrongBinder(token);
3741 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3742 reply.readException();
3743 ComponentName res = ComponentName.readFromParcel(reply);
3744 data.recycle();
3745 reply.recycle();
3746 return res;
3747 }
3748 public String getPackageForToken(IBinder token) throws RemoteException
3749 {
3750 Parcel data = Parcel.obtain();
3751 Parcel reply = Parcel.obtain();
3752 data.writeInterfaceToken(IActivityManager.descriptor);
3753 data.writeStrongBinder(token);
3754 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3755 reply.readException();
3756 String res = reply.readString();
3757 data.recycle();
3758 reply.recycle();
3759 return res;
3760 }
3761 public IIntentSender getIntentSender(int type,
3762 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003763 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003764 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003765 Parcel data = Parcel.obtain();
3766 Parcel reply = Parcel.obtain();
3767 data.writeInterfaceToken(IActivityManager.descriptor);
3768 data.writeInt(type);
3769 data.writeString(packageName);
3770 data.writeStrongBinder(token);
3771 data.writeString(resultWho);
3772 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003773 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003774 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003775 data.writeTypedArray(intents, 0);
3776 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003777 } else {
3778 data.writeInt(0);
3779 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003780 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003781 if (options != null) {
3782 data.writeInt(1);
3783 options.writeToParcel(data, 0);
3784 } else {
3785 data.writeInt(0);
3786 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003787 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003788 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3789 reply.readException();
3790 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08003791 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003792 data.recycle();
3793 reply.recycle();
3794 return res;
3795 }
3796 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3797 Parcel data = Parcel.obtain();
3798 Parcel reply = Parcel.obtain();
3799 data.writeInterfaceToken(IActivityManager.descriptor);
3800 data.writeStrongBinder(sender.asBinder());
3801 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3802 reply.readException();
3803 data.recycle();
3804 reply.recycle();
3805 }
3806 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3807 Parcel data = Parcel.obtain();
3808 Parcel reply = Parcel.obtain();
3809 data.writeInterfaceToken(IActivityManager.descriptor);
3810 data.writeStrongBinder(sender.asBinder());
3811 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3812 reply.readException();
3813 String res = reply.readString();
3814 data.recycle();
3815 reply.recycle();
3816 return res;
3817 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003818 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3819 Parcel data = Parcel.obtain();
3820 Parcel reply = Parcel.obtain();
3821 data.writeInterfaceToken(IActivityManager.descriptor);
3822 data.writeStrongBinder(sender.asBinder());
3823 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3824 reply.readException();
3825 int res = reply.readInt();
3826 data.recycle();
3827 reply.recycle();
3828 return res;
3829 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003830 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3831 boolean requireFull, String name, String callerPackage) throws RemoteException {
3832 Parcel data = Parcel.obtain();
3833 Parcel reply = Parcel.obtain();
3834 data.writeInterfaceToken(IActivityManager.descriptor);
3835 data.writeInt(callingPid);
3836 data.writeInt(callingUid);
3837 data.writeInt(userId);
3838 data.writeInt(allowAll ? 1 : 0);
3839 data.writeInt(requireFull ? 1 : 0);
3840 data.writeString(name);
3841 data.writeString(callerPackage);
3842 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3843 reply.readException();
3844 int res = reply.readInt();
3845 data.recycle();
3846 reply.recycle();
3847 return res;
3848 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003849 public void setProcessLimit(int max) throws RemoteException
3850 {
3851 Parcel data = Parcel.obtain();
3852 Parcel reply = Parcel.obtain();
3853 data.writeInterfaceToken(IActivityManager.descriptor);
3854 data.writeInt(max);
3855 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3856 reply.readException();
3857 data.recycle();
3858 reply.recycle();
3859 }
3860 public int getProcessLimit() throws RemoteException
3861 {
3862 Parcel data = Parcel.obtain();
3863 Parcel reply = Parcel.obtain();
3864 data.writeInterfaceToken(IActivityManager.descriptor);
3865 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3866 reply.readException();
3867 int res = reply.readInt();
3868 data.recycle();
3869 reply.recycle();
3870 return res;
3871 }
3872 public void setProcessForeground(IBinder token, int pid,
3873 boolean isForeground) throws RemoteException {
3874 Parcel data = Parcel.obtain();
3875 Parcel reply = Parcel.obtain();
3876 data.writeInterfaceToken(IActivityManager.descriptor);
3877 data.writeStrongBinder(token);
3878 data.writeInt(pid);
3879 data.writeInt(isForeground ? 1 : 0);
3880 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3881 reply.readException();
3882 data.recycle();
3883 reply.recycle();
3884 }
3885 public int checkPermission(String permission, int pid, int uid)
3886 throws RemoteException {
3887 Parcel data = Parcel.obtain();
3888 Parcel reply = Parcel.obtain();
3889 data.writeInterfaceToken(IActivityManager.descriptor);
3890 data.writeString(permission);
3891 data.writeInt(pid);
3892 data.writeInt(uid);
3893 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3894 reply.readException();
3895 int res = reply.readInt();
3896 data.recycle();
3897 reply.recycle();
3898 return res;
3899 }
Dianne Hackbornff170242014-11-19 10:59:01 -08003900 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
3901 throws RemoteException {
3902 Parcel data = Parcel.obtain();
3903 Parcel reply = Parcel.obtain();
3904 data.writeInterfaceToken(IActivityManager.descriptor);
3905 data.writeString(permission);
3906 data.writeInt(pid);
3907 data.writeInt(uid);
3908 data.writeStrongBinder(callerToken);
3909 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
3910 reply.readException();
3911 int res = reply.readInt();
3912 data.recycle();
3913 reply.recycle();
3914 return res;
3915 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003916 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003917 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003918 Parcel data = Parcel.obtain();
3919 Parcel reply = Parcel.obtain();
3920 data.writeInterfaceToken(IActivityManager.descriptor);
3921 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003922 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003923 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003924 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3925 reply.readException();
3926 boolean res = reply.readInt() != 0;
3927 data.recycle();
3928 reply.recycle();
3929 return res;
3930 }
Dianne Hackbornff170242014-11-19 10:59:01 -08003931 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
3932 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003933 Parcel data = Parcel.obtain();
3934 Parcel reply = Parcel.obtain();
3935 data.writeInterfaceToken(IActivityManager.descriptor);
3936 uri.writeToParcel(data, 0);
3937 data.writeInt(pid);
3938 data.writeInt(uid);
3939 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003940 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08003941 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003942 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3943 reply.readException();
3944 int res = reply.readInt();
3945 data.recycle();
3946 reply.recycle();
3947 return res;
3948 }
3949 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003950 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003951 Parcel data = Parcel.obtain();
3952 Parcel reply = Parcel.obtain();
3953 data.writeInterfaceToken(IActivityManager.descriptor);
3954 data.writeStrongBinder(caller.asBinder());
3955 data.writeString(targetPkg);
3956 uri.writeToParcel(data, 0);
3957 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003958 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003959 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3960 reply.readException();
3961 data.recycle();
3962 reply.recycle();
3963 }
3964 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003965 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003966 Parcel data = Parcel.obtain();
3967 Parcel reply = Parcel.obtain();
3968 data.writeInterfaceToken(IActivityManager.descriptor);
3969 data.writeStrongBinder(caller.asBinder());
3970 uri.writeToParcel(data, 0);
3971 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003972 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003973 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3974 reply.readException();
3975 data.recycle();
3976 reply.recycle();
3977 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003978
3979 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003980 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3981 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003982 Parcel data = Parcel.obtain();
3983 Parcel reply = Parcel.obtain();
3984 data.writeInterfaceToken(IActivityManager.descriptor);
3985 uri.writeToParcel(data, 0);
3986 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003987 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003988 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3989 reply.readException();
3990 data.recycle();
3991 reply.recycle();
3992 }
3993
3994 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003995 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3996 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003997 Parcel data = Parcel.obtain();
3998 Parcel reply = Parcel.obtain();
3999 data.writeInterfaceToken(IActivityManager.descriptor);
4000 uri.writeToParcel(data, 0);
4001 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004002 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004003 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4004 reply.readException();
4005 data.recycle();
4006 reply.recycle();
4007 }
4008
4009 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004010 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4011 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004012 Parcel data = Parcel.obtain();
4013 Parcel reply = Parcel.obtain();
4014 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004015 data.writeString(packageName);
4016 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004017 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4018 reply.readException();
4019 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4020 reply);
4021 data.recycle();
4022 reply.recycle();
4023 return perms;
4024 }
4025
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004026 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4027 throws RemoteException {
4028 Parcel data = Parcel.obtain();
4029 Parcel reply = Parcel.obtain();
4030 data.writeInterfaceToken(IActivityManager.descriptor);
4031 data.writeStrongBinder(who.asBinder());
4032 data.writeInt(waiting ? 1 : 0);
4033 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4034 reply.readException();
4035 data.recycle();
4036 reply.recycle();
4037 }
4038 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4039 Parcel data = Parcel.obtain();
4040 Parcel reply = Parcel.obtain();
4041 data.writeInterfaceToken(IActivityManager.descriptor);
4042 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4043 reply.readException();
4044 outInfo.readFromParcel(reply);
4045 data.recycle();
4046 reply.recycle();
4047 }
4048 public void unhandledBack() throws RemoteException
4049 {
4050 Parcel data = Parcel.obtain();
4051 Parcel reply = Parcel.obtain();
4052 data.writeInterfaceToken(IActivityManager.descriptor);
4053 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4054 reply.readException();
4055 data.recycle();
4056 reply.recycle();
4057 }
4058 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4059 {
4060 Parcel data = Parcel.obtain();
4061 Parcel reply = Parcel.obtain();
4062 data.writeInterfaceToken(IActivityManager.descriptor);
4063 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4064 reply.readException();
4065 ParcelFileDescriptor pfd = null;
4066 if (reply.readInt() != 0) {
4067 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4068 }
4069 data.recycle();
4070 reply.recycle();
4071 return pfd;
4072 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004073 public void setLockScreenShown(boolean shown) throws RemoteException
4074 {
4075 Parcel data = Parcel.obtain();
4076 Parcel reply = Parcel.obtain();
4077 data.writeInterfaceToken(IActivityManager.descriptor);
4078 data.writeInt(shown ? 1 : 0);
4079 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4080 reply.readException();
4081 data.recycle();
4082 reply.recycle();
4083 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004084 public void setDebugApp(
4085 String packageName, boolean waitForDebugger, boolean persistent)
4086 throws RemoteException
4087 {
4088 Parcel data = Parcel.obtain();
4089 Parcel reply = Parcel.obtain();
4090 data.writeInterfaceToken(IActivityManager.descriptor);
4091 data.writeString(packageName);
4092 data.writeInt(waitForDebugger ? 1 : 0);
4093 data.writeInt(persistent ? 1 : 0);
4094 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4095 reply.readException();
4096 data.recycle();
4097 reply.recycle();
4098 }
4099 public void setAlwaysFinish(boolean enabled) throws RemoteException
4100 {
4101 Parcel data = Parcel.obtain();
4102 Parcel reply = Parcel.obtain();
4103 data.writeInterfaceToken(IActivityManager.descriptor);
4104 data.writeInt(enabled ? 1 : 0);
4105 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4106 reply.readException();
4107 data.recycle();
4108 reply.recycle();
4109 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004110 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004111 {
4112 Parcel data = Parcel.obtain();
4113 Parcel reply = Parcel.obtain();
4114 data.writeInterfaceToken(IActivityManager.descriptor);
4115 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004116 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004117 reply.readException();
4118 data.recycle();
4119 reply.recycle();
4120 }
4121 public void enterSafeMode() throws RemoteException {
4122 Parcel data = Parcel.obtain();
4123 data.writeInterfaceToken(IActivityManager.descriptor);
4124 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4125 data.recycle();
4126 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08004127 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
4128 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004129 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004130 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004131 data.writeStrongBinder(sender.asBinder());
4132 data.writeInt(sourceUid);
4133 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004134 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4135 data.recycle();
4136 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004137 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004138 Parcel data = Parcel.obtain();
4139 Parcel reply = Parcel.obtain();
4140 data.writeInterfaceToken(IActivityManager.descriptor);
4141 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004142 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004143 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004144 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004145 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004146 boolean res = reply.readInt() != 0;
4147 data.recycle();
4148 reply.recycle();
4149 return res;
4150 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004151 @Override
4152 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4153 Parcel data = Parcel.obtain();
4154 Parcel reply = Parcel.obtain();
4155 data.writeInterfaceToken(IActivityManager.descriptor);
4156 data.writeString(reason);
4157 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4158 boolean res = reply.readInt() != 0;
4159 data.recycle();
4160 reply.recycle();
4161 return res;
4162 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004163 public boolean testIsSystemReady()
4164 {
4165 /* this base class version is never called */
4166 return true;
4167 }
Dan Egnor60d87622009-12-16 16:32:58 -08004168 public void handleApplicationCrash(IBinder app,
4169 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4170 {
4171 Parcel data = Parcel.obtain();
4172 Parcel reply = Parcel.obtain();
4173 data.writeInterfaceToken(IActivityManager.descriptor);
4174 data.writeStrongBinder(app);
4175 crashInfo.writeToParcel(data, 0);
4176 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4177 reply.readException();
4178 reply.recycle();
4179 data.recycle();
4180 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004181
Dianne Hackborn52322712014-08-26 22:47:26 -07004182 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004183 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004184 {
4185 Parcel data = Parcel.obtain();
4186 Parcel reply = Parcel.obtain();
4187 data.writeInterfaceToken(IActivityManager.descriptor);
4188 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004189 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004190 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004191 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004192 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004193 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004194 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004195 reply.recycle();
4196 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004197 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004198 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004199
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004200 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004201 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004202 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004203 {
4204 Parcel data = Parcel.obtain();
4205 Parcel reply = Parcel.obtain();
4206 data.writeInterfaceToken(IActivityManager.descriptor);
4207 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004208 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004209 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004210 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4211 reply.readException();
4212 reply.recycle();
4213 data.recycle();
4214 }
4215
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004216 public void signalPersistentProcesses(int sig) throws RemoteException {
4217 Parcel data = Parcel.obtain();
4218 Parcel reply = Parcel.obtain();
4219 data.writeInterfaceToken(IActivityManager.descriptor);
4220 data.writeInt(sig);
4221 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4222 reply.readException();
4223 data.recycle();
4224 reply.recycle();
4225 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004226
Dianne Hackborn1676c852012-09-10 14:52:30 -07004227 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004228 Parcel data = Parcel.obtain();
4229 Parcel reply = Parcel.obtain();
4230 data.writeInterfaceToken(IActivityManager.descriptor);
4231 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004232 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004233 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4234 reply.readException();
4235 data.recycle();
4236 reply.recycle();
4237 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004238
4239 public void killAllBackgroundProcesses() throws RemoteException {
4240 Parcel data = Parcel.obtain();
4241 Parcel reply = Parcel.obtain();
4242 data.writeInterfaceToken(IActivityManager.descriptor);
4243 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4244 reply.readException();
4245 data.recycle();
4246 reply.recycle();
4247 }
4248
Dianne Hackborn1676c852012-09-10 14:52:30 -07004249 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004250 Parcel data = Parcel.obtain();
4251 Parcel reply = Parcel.obtain();
4252 data.writeInterfaceToken(IActivityManager.descriptor);
4253 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004254 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004255 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004256 reply.readException();
4257 data.recycle();
4258 reply.recycle();
4259 }
4260
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004261 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4262 throws RemoteException
4263 {
4264 Parcel data = Parcel.obtain();
4265 Parcel reply = Parcel.obtain();
4266 data.writeInterfaceToken(IActivityManager.descriptor);
4267 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4268 reply.readException();
4269 outInfo.readFromParcel(reply);
4270 reply.recycle();
4271 data.recycle();
4272 }
4273
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004274 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4275 {
4276 Parcel data = Parcel.obtain();
4277 Parcel reply = Parcel.obtain();
4278 data.writeInterfaceToken(IActivityManager.descriptor);
4279 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4280 reply.readException();
4281 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4282 reply.recycle();
4283 data.recycle();
4284 return res;
4285 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004286
Dianne Hackborn1676c852012-09-10 14:52:30 -07004287 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004288 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004289 {
4290 Parcel data = Parcel.obtain();
4291 Parcel reply = Parcel.obtain();
4292 data.writeInterfaceToken(IActivityManager.descriptor);
4293 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004294 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004295 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004296 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004297 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004298 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004299 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004300 } else {
4301 data.writeInt(0);
4302 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004303 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4304 reply.readException();
4305 boolean res = reply.readInt() != 0;
4306 reply.recycle();
4307 data.recycle();
4308 return res;
4309 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004310
Dianne Hackborn55280a92009-05-07 15:53:46 -07004311 public boolean shutdown(int timeout) throws RemoteException
4312 {
4313 Parcel data = Parcel.obtain();
4314 Parcel reply = Parcel.obtain();
4315 data.writeInterfaceToken(IActivityManager.descriptor);
4316 data.writeInt(timeout);
4317 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4318 reply.readException();
4319 boolean res = reply.readInt() != 0;
4320 reply.recycle();
4321 data.recycle();
4322 return res;
4323 }
4324
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004325 public void stopAppSwitches() throws RemoteException {
4326 Parcel data = Parcel.obtain();
4327 Parcel reply = Parcel.obtain();
4328 data.writeInterfaceToken(IActivityManager.descriptor);
4329 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4330 reply.readException();
4331 reply.recycle();
4332 data.recycle();
4333 }
4334
4335 public void resumeAppSwitches() throws RemoteException {
4336 Parcel data = Parcel.obtain();
4337 Parcel reply = Parcel.obtain();
4338 data.writeInterfaceToken(IActivityManager.descriptor);
4339 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4340 reply.readException();
4341 reply.recycle();
4342 data.recycle();
4343 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004344
4345 public void addPackageDependency(String packageName) throws RemoteException {
4346 Parcel data = Parcel.obtain();
4347 Parcel reply = Parcel.obtain();
4348 data.writeInterfaceToken(IActivityManager.descriptor);
4349 data.writeString(packageName);
4350 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4351 reply.readException();
4352 data.recycle();
4353 reply.recycle();
4354 }
4355
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004356 public void killApplicationWithAppId(String pkg, int appid, String reason)
4357 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004358 Parcel data = Parcel.obtain();
4359 Parcel reply = Parcel.obtain();
4360 data.writeInterfaceToken(IActivityManager.descriptor);
4361 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004362 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004363 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004364 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004365 reply.readException();
4366 data.recycle();
4367 reply.recycle();
4368 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004369
4370 public void closeSystemDialogs(String reason) throws RemoteException {
4371 Parcel data = Parcel.obtain();
4372 Parcel reply = Parcel.obtain();
4373 data.writeInterfaceToken(IActivityManager.descriptor);
4374 data.writeString(reason);
4375 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4376 reply.readException();
4377 data.recycle();
4378 reply.recycle();
4379 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004380
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004381 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004382 throws RemoteException {
4383 Parcel data = Parcel.obtain();
4384 Parcel reply = Parcel.obtain();
4385 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004386 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004387 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4388 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004389 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004390 data.recycle();
4391 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004392 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004393 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004394
4395 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4396 Parcel data = Parcel.obtain();
4397 Parcel reply = Parcel.obtain();
4398 data.writeInterfaceToken(IActivityManager.descriptor);
4399 data.writeString(processName);
4400 data.writeInt(uid);
4401 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4402 reply.readException();
4403 data.recycle();
4404 reply.recycle();
4405 }
4406
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004407 public void overridePendingTransition(IBinder token, String packageName,
4408 int enterAnim, int exitAnim) throws RemoteException {
4409 Parcel data = Parcel.obtain();
4410 Parcel reply = Parcel.obtain();
4411 data.writeInterfaceToken(IActivityManager.descriptor);
4412 data.writeStrongBinder(token);
4413 data.writeString(packageName);
4414 data.writeInt(enterAnim);
4415 data.writeInt(exitAnim);
4416 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4417 reply.readException();
4418 data.recycle();
4419 reply.recycle();
4420 }
4421
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004422 public boolean isUserAMonkey() throws RemoteException {
4423 Parcel data = Parcel.obtain();
4424 Parcel reply = Parcel.obtain();
4425 data.writeInterfaceToken(IActivityManager.descriptor);
4426 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4427 reply.readException();
4428 boolean res = reply.readInt() != 0;
4429 data.recycle();
4430 reply.recycle();
4431 return res;
4432 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004433
4434 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4435 Parcel data = Parcel.obtain();
4436 Parcel reply = Parcel.obtain();
4437 data.writeInterfaceToken(IActivityManager.descriptor);
4438 data.writeInt(monkey ? 1 : 0);
4439 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4440 reply.readException();
4441 data.recycle();
4442 reply.recycle();
4443 }
4444
Dianne Hackborn860755f2010-06-03 18:47:52 -07004445 public void finishHeavyWeightApp() throws RemoteException {
4446 Parcel data = Parcel.obtain();
4447 Parcel reply = Parcel.obtain();
4448 data.writeInterfaceToken(IActivityManager.descriptor);
4449 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4450 reply.readException();
4451 data.recycle();
4452 reply.recycle();
4453 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004454
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004455 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004456 throws RemoteException {
4457 Parcel data = Parcel.obtain();
4458 Parcel reply = Parcel.obtain();
4459 data.writeInterfaceToken(IActivityManager.descriptor);
4460 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004461 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4462 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004463 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004464 data.recycle();
4465 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004466 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004467 }
4468
Craig Mautner233ceee2014-05-09 17:05:11 -07004469 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004470 throws RemoteException {
4471 Parcel data = Parcel.obtain();
4472 Parcel reply = Parcel.obtain();
4473 data.writeInterfaceToken(IActivityManager.descriptor);
4474 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004475 if (options == null) {
4476 data.writeInt(0);
4477 } else {
4478 data.writeInt(1);
4479 data.writeBundle(options.toBundle());
4480 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004481 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004482 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004483 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004484 data.recycle();
4485 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004486 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004487 }
4488
Craig Mautner233ceee2014-05-09 17:05:11 -07004489 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4490 Parcel data = Parcel.obtain();
4491 Parcel reply = Parcel.obtain();
4492 data.writeInterfaceToken(IActivityManager.descriptor);
4493 data.writeStrongBinder(token);
4494 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4495 reply.readException();
4496 Bundle bundle = reply.readBundle();
4497 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4498 data.recycle();
4499 reply.recycle();
4500 return options;
4501 }
4502
Daniel Sandler69a48172010-06-23 16:29:36 -04004503 public void setImmersive(IBinder token, boolean immersive)
4504 throws RemoteException {
4505 Parcel data = Parcel.obtain();
4506 Parcel reply = Parcel.obtain();
4507 data.writeInterfaceToken(IActivityManager.descriptor);
4508 data.writeStrongBinder(token);
4509 data.writeInt(immersive ? 1 : 0);
4510 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4511 reply.readException();
4512 data.recycle();
4513 reply.recycle();
4514 }
4515
4516 public boolean isImmersive(IBinder token)
4517 throws RemoteException {
4518 Parcel data = Parcel.obtain();
4519 Parcel reply = Parcel.obtain();
4520 data.writeInterfaceToken(IActivityManager.descriptor);
4521 data.writeStrongBinder(token);
4522 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004523 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004524 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004525 data.recycle();
4526 reply.recycle();
4527 return res;
4528 }
4529
Craig Mautnerd61dc202014-07-07 11:09:11 -07004530 public boolean isTopOfTask(IBinder token) throws RemoteException {
4531 Parcel data = Parcel.obtain();
4532 Parcel reply = Parcel.obtain();
4533 data.writeInterfaceToken(IActivityManager.descriptor);
4534 data.writeStrongBinder(token);
4535 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4536 reply.readException();
4537 boolean res = reply.readInt() == 1;
4538 data.recycle();
4539 reply.recycle();
4540 return res;
4541 }
4542
Daniel Sandler69a48172010-06-23 16:29:36 -04004543 public boolean isTopActivityImmersive()
4544 throws RemoteException {
4545 Parcel data = Parcel.obtain();
4546 Parcel reply = Parcel.obtain();
4547 data.writeInterfaceToken(IActivityManager.descriptor);
4548 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004549 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004550 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004551 data.recycle();
4552 reply.recycle();
4553 return res;
4554 }
4555
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004556 public void crashApplication(int uid, int initialPid, String packageName,
4557 String message) throws RemoteException {
4558 Parcel data = Parcel.obtain();
4559 Parcel reply = Parcel.obtain();
4560 data.writeInterfaceToken(IActivityManager.descriptor);
4561 data.writeInt(uid);
4562 data.writeInt(initialPid);
4563 data.writeString(packageName);
4564 data.writeString(message);
4565 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4566 reply.readException();
4567 data.recycle();
4568 reply.recycle();
4569 }
Andy McFadden824c5102010-07-09 16:26:57 -07004570
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004571 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004572 Parcel data = Parcel.obtain();
4573 Parcel reply = Parcel.obtain();
4574 data.writeInterfaceToken(IActivityManager.descriptor);
4575 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004576 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004577 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4578 reply.readException();
4579 String res = reply.readString();
4580 data.recycle();
4581 reply.recycle();
4582 return res;
4583 }
4584
Dianne Hackborn7e269642010-08-25 19:50:20 -07004585 public IBinder newUriPermissionOwner(String name)
4586 throws RemoteException {
4587 Parcel data = Parcel.obtain();
4588 Parcel reply = Parcel.obtain();
4589 data.writeInterfaceToken(IActivityManager.descriptor);
4590 data.writeString(name);
4591 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4592 reply.readException();
4593 IBinder res = reply.readStrongBinder();
4594 data.recycle();
4595 reply.recycle();
4596 return res;
4597 }
4598
4599 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004600 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004601 Parcel data = Parcel.obtain();
4602 Parcel reply = Parcel.obtain();
4603 data.writeInterfaceToken(IActivityManager.descriptor);
4604 data.writeStrongBinder(owner);
4605 data.writeInt(fromUid);
4606 data.writeString(targetPkg);
4607 uri.writeToParcel(data, 0);
4608 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004609 data.writeInt(sourceUserId);
4610 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004611 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4612 reply.readException();
4613 data.recycle();
4614 reply.recycle();
4615 }
4616
4617 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004618 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004619 Parcel data = Parcel.obtain();
4620 Parcel reply = Parcel.obtain();
4621 data.writeInterfaceToken(IActivityManager.descriptor);
4622 data.writeStrongBinder(owner);
4623 if (uri != null) {
4624 data.writeInt(1);
4625 uri.writeToParcel(data, 0);
4626 } else {
4627 data.writeInt(0);
4628 }
4629 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004630 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004631 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4632 reply.readException();
4633 data.recycle();
4634 reply.recycle();
4635 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004636
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004637 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004638 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004639 Parcel data = Parcel.obtain();
4640 Parcel reply = Parcel.obtain();
4641 data.writeInterfaceToken(IActivityManager.descriptor);
4642 data.writeInt(callingUid);
4643 data.writeString(targetPkg);
4644 uri.writeToParcel(data, 0);
4645 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004646 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004647 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4648 reply.readException();
4649 int res = reply.readInt();
4650 data.recycle();
4651 reply.recycle();
4652 return res;
4653 }
4654
Dianne Hackborn1676c852012-09-10 14:52:30 -07004655 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004656 String path, ParcelFileDescriptor fd) throws RemoteException {
4657 Parcel data = Parcel.obtain();
4658 Parcel reply = Parcel.obtain();
4659 data.writeInterfaceToken(IActivityManager.descriptor);
4660 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004661 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004662 data.writeInt(managed ? 1 : 0);
4663 data.writeString(path);
4664 if (fd != null) {
4665 data.writeInt(1);
4666 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4667 } else {
4668 data.writeInt(0);
4669 }
4670 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4671 reply.readException();
4672 boolean res = reply.readInt() != 0;
4673 reply.recycle();
4674 data.recycle();
4675 return res;
4676 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004677
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004678 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004679 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004680 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004681 Parcel data = Parcel.obtain();
4682 Parcel reply = Parcel.obtain();
4683 data.writeInterfaceToken(IActivityManager.descriptor);
4684 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004685 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004686 data.writeTypedArray(intents, 0);
4687 data.writeStringArray(resolvedTypes);
4688 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004689 if (options != null) {
4690 data.writeInt(1);
4691 options.writeToParcel(data, 0);
4692 } else {
4693 data.writeInt(0);
4694 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004695 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004696 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4697 reply.readException();
4698 int result = reply.readInt();
4699 reply.recycle();
4700 data.recycle();
4701 return result;
4702 }
4703
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004704 public int getFrontActivityScreenCompatMode() throws RemoteException {
4705 Parcel data = Parcel.obtain();
4706 Parcel reply = Parcel.obtain();
4707 data.writeInterfaceToken(IActivityManager.descriptor);
4708 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4709 reply.readException();
4710 int mode = reply.readInt();
4711 reply.recycle();
4712 data.recycle();
4713 return mode;
4714 }
4715
4716 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4717 Parcel data = Parcel.obtain();
4718 Parcel reply = Parcel.obtain();
4719 data.writeInterfaceToken(IActivityManager.descriptor);
4720 data.writeInt(mode);
4721 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4722 reply.readException();
4723 reply.recycle();
4724 data.recycle();
4725 }
4726
4727 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4728 Parcel data = Parcel.obtain();
4729 Parcel reply = Parcel.obtain();
4730 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004731 data.writeString(packageName);
4732 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004733 reply.readException();
4734 int mode = reply.readInt();
4735 reply.recycle();
4736 data.recycle();
4737 return mode;
4738 }
4739
4740 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004741 throws RemoteException {
4742 Parcel data = Parcel.obtain();
4743 Parcel reply = Parcel.obtain();
4744 data.writeInterfaceToken(IActivityManager.descriptor);
4745 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004746 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004747 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4748 reply.readException();
4749 reply.recycle();
4750 data.recycle();
4751 }
4752
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004753 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4754 Parcel data = Parcel.obtain();
4755 Parcel reply = Parcel.obtain();
4756 data.writeInterfaceToken(IActivityManager.descriptor);
4757 data.writeString(packageName);
4758 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4759 reply.readException();
4760 boolean ask = reply.readInt() != 0;
4761 reply.recycle();
4762 data.recycle();
4763 return ask;
4764 }
4765
4766 public void setPackageAskScreenCompat(String packageName, boolean ask)
4767 throws RemoteException {
4768 Parcel data = Parcel.obtain();
4769 Parcel reply = Parcel.obtain();
4770 data.writeInterfaceToken(IActivityManager.descriptor);
4771 data.writeString(packageName);
4772 data.writeInt(ask ? 1 : 0);
4773 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4774 reply.readException();
4775 reply.recycle();
4776 data.recycle();
4777 }
4778
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004779 public boolean switchUser(int userid) throws RemoteException {
4780 Parcel data = Parcel.obtain();
4781 Parcel reply = Parcel.obtain();
4782 data.writeInterfaceToken(IActivityManager.descriptor);
4783 data.writeInt(userid);
4784 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4785 reply.readException();
4786 boolean result = reply.readInt() != 0;
4787 reply.recycle();
4788 data.recycle();
4789 return result;
4790 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004791
Kenny Guy08488bf2014-02-21 17:40:37 +00004792 public boolean startUserInBackground(int userid) throws RemoteException {
4793 Parcel data = Parcel.obtain();
4794 Parcel reply = Parcel.obtain();
4795 data.writeInterfaceToken(IActivityManager.descriptor);
4796 data.writeInt(userid);
4797 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4798 reply.readException();
4799 boolean result = reply.readInt() != 0;
4800 reply.recycle();
4801 data.recycle();
4802 return result;
4803 }
4804
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004805 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4806 Parcel data = Parcel.obtain();
4807 Parcel reply = Parcel.obtain();
4808 data.writeInterfaceToken(IActivityManager.descriptor);
4809 data.writeInt(userid);
4810 data.writeStrongInterface(callback);
4811 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4812 reply.readException();
4813 int result = reply.readInt();
4814 reply.recycle();
4815 data.recycle();
4816 return result;
4817 }
4818
Amith Yamasani52f1d752012-03-28 18:19:29 -07004819 public UserInfo getCurrentUser() throws RemoteException {
4820 Parcel data = Parcel.obtain();
4821 Parcel reply = Parcel.obtain();
4822 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004823 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004824 reply.readException();
4825 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4826 reply.recycle();
4827 data.recycle();
4828 return userInfo;
4829 }
4830
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004831 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004832 Parcel data = Parcel.obtain();
4833 Parcel reply = Parcel.obtain();
4834 data.writeInterfaceToken(IActivityManager.descriptor);
4835 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004836 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004837 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4838 reply.readException();
4839 boolean result = reply.readInt() != 0;
4840 reply.recycle();
4841 data.recycle();
4842 return result;
4843 }
4844
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004845 public int[] getRunningUserIds() throws RemoteException {
4846 Parcel data = Parcel.obtain();
4847 Parcel reply = Parcel.obtain();
4848 data.writeInterfaceToken(IActivityManager.descriptor);
4849 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4850 reply.readException();
4851 int[] result = reply.createIntArray();
4852 reply.recycle();
4853 data.recycle();
4854 return result;
4855 }
4856
Wale Ogunwaled54b5782014-10-23 15:55:23 -07004857 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004858 Parcel data = Parcel.obtain();
4859 Parcel reply = Parcel.obtain();
4860 data.writeInterfaceToken(IActivityManager.descriptor);
4861 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004862 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4863 reply.readException();
4864 boolean result = reply.readInt() != 0;
4865 reply.recycle();
4866 data.recycle();
4867 return result;
4868 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004869
Jeff Sharkeya4620792011-05-20 15:29:23 -07004870 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4871 Parcel data = Parcel.obtain();
4872 Parcel reply = Parcel.obtain();
4873 data.writeInterfaceToken(IActivityManager.descriptor);
4874 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4875 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4876 reply.readException();
4877 data.recycle();
4878 reply.recycle();
4879 }
4880
4881 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4882 Parcel data = Parcel.obtain();
4883 Parcel reply = Parcel.obtain();
4884 data.writeInterfaceToken(IActivityManager.descriptor);
4885 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4886 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4887 reply.readException();
4888 data.recycle();
4889 reply.recycle();
4890 }
4891
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004892 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4893 Parcel data = Parcel.obtain();
4894 Parcel reply = Parcel.obtain();
4895 data.writeInterfaceToken(IActivityManager.descriptor);
4896 data.writeStrongBinder(sender.asBinder());
4897 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4898 reply.readException();
4899 boolean res = reply.readInt() != 0;
4900 data.recycle();
4901 reply.recycle();
4902 return res;
4903 }
4904
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004905 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4906 Parcel data = Parcel.obtain();
4907 Parcel reply = Parcel.obtain();
4908 data.writeInterfaceToken(IActivityManager.descriptor);
4909 data.writeStrongBinder(sender.asBinder());
4910 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4911 reply.readException();
4912 boolean res = reply.readInt() != 0;
4913 data.recycle();
4914 reply.recycle();
4915 return res;
4916 }
4917
Dianne Hackborn81038902012-11-26 17:04:09 -08004918 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4919 Parcel data = Parcel.obtain();
4920 Parcel reply = Parcel.obtain();
4921 data.writeInterfaceToken(IActivityManager.descriptor);
4922 data.writeStrongBinder(sender.asBinder());
4923 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4924 reply.readException();
4925 Intent res = reply.readInt() != 0
4926 ? Intent.CREATOR.createFromParcel(reply) : null;
4927 data.recycle();
4928 reply.recycle();
4929 return res;
4930 }
4931
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004932 public String getTagForIntentSender(IIntentSender sender, String prefix)
4933 throws RemoteException {
4934 Parcel data = Parcel.obtain();
4935 Parcel reply = Parcel.obtain();
4936 data.writeInterfaceToken(IActivityManager.descriptor);
4937 data.writeStrongBinder(sender.asBinder());
4938 data.writeString(prefix);
4939 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4940 reply.readException();
4941 String res = reply.readString();
4942 data.recycle();
4943 reply.recycle();
4944 return res;
4945 }
4946
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004947 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4948 {
4949 Parcel data = Parcel.obtain();
4950 Parcel reply = Parcel.obtain();
4951 data.writeInterfaceToken(IActivityManager.descriptor);
4952 values.writeToParcel(data, 0);
4953 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4954 reply.readException();
4955 data.recycle();
4956 reply.recycle();
4957 }
4958
Dianne Hackbornb437e092011-08-05 17:50:29 -07004959 public long[] getProcessPss(int[] pids) throws RemoteException {
4960 Parcel data = Parcel.obtain();
4961 Parcel reply = Parcel.obtain();
4962 data.writeInterfaceToken(IActivityManager.descriptor);
4963 data.writeIntArray(pids);
4964 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4965 reply.readException();
4966 long[] res = reply.createLongArray();
4967 data.recycle();
4968 reply.recycle();
4969 return res;
4970 }
4971
Dianne Hackborn661cd522011-08-22 00:26:20 -07004972 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4973 Parcel data = Parcel.obtain();
4974 Parcel reply = Parcel.obtain();
4975 data.writeInterfaceToken(IActivityManager.descriptor);
4976 TextUtils.writeToParcel(msg, data, 0);
4977 data.writeInt(always ? 1 : 0);
4978 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4979 reply.readException();
4980 data.recycle();
4981 reply.recycle();
4982 }
4983
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004984 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004985 Parcel data = Parcel.obtain();
4986 Parcel reply = Parcel.obtain();
4987 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004988 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004989 reply.readException();
4990 data.recycle();
4991 reply.recycle();
4992 }
4993
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004994 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07004995 throws RemoteException {
4996 Parcel data = Parcel.obtain();
4997 Parcel reply = Parcel.obtain();
4998 data.writeInterfaceToken(IActivityManager.descriptor);
4999 data.writeStrongBinder(token);
5000 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005001 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005002 reply.readException();
5003 boolean result = reply.readInt() != 0;
5004 data.recycle();
5005 reply.recycle();
5006 return result;
5007 }
5008
5009 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5010 throws RemoteException {
5011 Parcel data = Parcel.obtain();
5012 Parcel reply = Parcel.obtain();
5013 data.writeInterfaceToken(IActivityManager.descriptor);
5014 data.writeStrongBinder(token);
5015 target.writeToParcel(data, 0);
5016 data.writeInt(resultCode);
5017 if (resultData != null) {
5018 data.writeInt(1);
5019 resultData.writeToParcel(data, 0);
5020 } else {
5021 data.writeInt(0);
5022 }
5023 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5024 reply.readException();
5025 boolean result = reply.readInt() != 0;
5026 data.recycle();
5027 reply.recycle();
5028 return result;
5029 }
5030
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005031 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5032 Parcel data = Parcel.obtain();
5033 Parcel reply = Parcel.obtain();
5034 data.writeInterfaceToken(IActivityManager.descriptor);
5035 data.writeStrongBinder(activityToken);
5036 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5037 reply.readException();
5038 int result = reply.readInt();
5039 data.recycle();
5040 reply.recycle();
5041 return result;
5042 }
5043
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005044 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5045 Parcel data = Parcel.obtain();
5046 Parcel reply = Parcel.obtain();
5047 data.writeInterfaceToken(IActivityManager.descriptor);
5048 data.writeStrongBinder(activityToken);
5049 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5050 reply.readException();
5051 String result = reply.readString();
5052 data.recycle();
5053 reply.recycle();
5054 return result;
5055 }
5056
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005057 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5058 Parcel data = Parcel.obtain();
5059 Parcel reply = Parcel.obtain();
5060 data.writeInterfaceToken(IActivityManager.descriptor);
5061 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5062 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5063 reply.readException();
5064 data.recycle();
5065 reply.recycle();
5066 }
5067
5068 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5069 Parcel data = Parcel.obtain();
5070 Parcel reply = Parcel.obtain();
5071 data.writeInterfaceToken(IActivityManager.descriptor);
5072 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5073 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5074 reply.readException();
5075 data.recycle();
5076 reply.recycle();
5077 }
5078
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005079 public void requestBugReport() throws RemoteException {
5080 Parcel data = Parcel.obtain();
5081 Parcel reply = Parcel.obtain();
5082 data.writeInterfaceToken(IActivityManager.descriptor);
5083 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5084 reply.readException();
5085 data.recycle();
5086 reply.recycle();
5087 }
5088
Jeff Brownbd181bb2013-09-10 16:44:24 -07005089 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5090 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005091 Parcel data = Parcel.obtain();
5092 Parcel reply = Parcel.obtain();
5093 data.writeInterfaceToken(IActivityManager.descriptor);
5094 data.writeInt(pid);
5095 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005096 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005097 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5098 reply.readException();
5099 long res = reply.readInt();
5100 data.recycle();
5101 reply.recycle();
5102 return res;
5103 }
5104
Adam Skorydfc7fd72013-08-05 19:23:41 -07005105 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005106 Parcel data = Parcel.obtain();
5107 Parcel reply = Parcel.obtain();
5108 data.writeInterfaceToken(IActivityManager.descriptor);
5109 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005110 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005111 reply.readException();
5112 Bundle res = reply.readBundle();
5113 data.recycle();
5114 reply.recycle();
5115 return res;
5116 }
5117
Adam Skory7140a252013-09-11 12:04:58 +01005118 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005119 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005120 Parcel data = Parcel.obtain();
5121 Parcel reply = Parcel.obtain();
5122 data.writeInterfaceToken(IActivityManager.descriptor);
5123 data.writeStrongBinder(token);
5124 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005125 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005126 reply.readException();
5127 data.recycle();
5128 reply.recycle();
5129 }
5130
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005131 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
5132 throws RemoteException {
5133 Parcel data = Parcel.obtain();
5134 Parcel reply = Parcel.obtain();
5135 data.writeInterfaceToken(IActivityManager.descriptor);
5136 intent.writeToParcel(data, 0);
5137 data.writeInt(requestType);
5138 data.writeString(hint);
5139 data.writeInt(userHandle);
5140 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5141 reply.readException();
5142 boolean res = reply.readInt() != 0;
5143 data.recycle();
5144 reply.recycle();
5145 return res;
5146 }
5147
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005148 public void killUid(int uid, String reason) throws RemoteException {
5149 Parcel data = Parcel.obtain();
5150 Parcel reply = Parcel.obtain();
5151 data.writeInterfaceToken(IActivityManager.descriptor);
5152 data.writeInt(uid);
5153 data.writeString(reason);
5154 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5155 reply.readException();
5156 data.recycle();
5157 reply.recycle();
5158 }
5159
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005160 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5161 Parcel data = Parcel.obtain();
5162 Parcel reply = Parcel.obtain();
5163 data.writeInterfaceToken(IActivityManager.descriptor);
5164 data.writeStrongBinder(who);
5165 data.writeInt(allowRestart ? 1 : 0);
5166 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5167 reply.readException();
5168 data.recycle();
5169 reply.recycle();
5170 }
5171
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005172 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5173 Parcel data = Parcel.obtain();
5174 Parcel reply = Parcel.obtain();
5175 data.writeInterfaceToken(IActivityManager.descriptor);
5176 data.writeStrongBinder(token);
5177 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5178 reply.readException();
5179 data.recycle();
5180 reply.recycle();
5181 }
5182
Craig Mautner5eda9b32013-07-02 11:58:16 -07005183 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5184 Parcel data = Parcel.obtain();
5185 Parcel reply = Parcel.obtain();
5186 data.writeInterfaceToken(IActivityManager.descriptor);
5187 data.writeStrongBinder(token);
5188 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5189 reply.readException();
5190 data.recycle();
5191 reply.recycle();
5192 }
5193
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005194 public void restart() throws RemoteException {
5195 Parcel data = Parcel.obtain();
5196 Parcel reply = Parcel.obtain();
5197 data.writeInterfaceToken(IActivityManager.descriptor);
5198 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5199 reply.readException();
5200 data.recycle();
5201 reply.recycle();
5202 }
5203
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005204 public void performIdleMaintenance() throws RemoteException {
5205 Parcel data = Parcel.obtain();
5206 Parcel reply = Parcel.obtain();
5207 data.writeInterfaceToken(IActivityManager.descriptor);
5208 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5209 reply.readException();
5210 data.recycle();
5211 reply.recycle();
5212 }
5213
Craig Mautner4a1cb222013-12-04 16:14:06 -08005214 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
5215 IActivityContainerCallback callback) throws RemoteException {
5216 Parcel data = Parcel.obtain();
5217 Parcel reply = Parcel.obtain();
5218 data.writeInterfaceToken(IActivityManager.descriptor);
5219 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005220 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08005221 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5222 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005223 final int result = reply.readInt();
5224 final IActivityContainer res;
5225 if (result == 1) {
5226 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5227 } else {
5228 res = null;
5229 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005230 data.recycle();
5231 reply.recycle();
5232 return res;
5233 }
5234
Craig Mautner95da1082014-02-24 17:54:35 -08005235 public void deleteActivityContainer(IActivityContainer activityContainer)
5236 throws RemoteException {
5237 Parcel data = Parcel.obtain();
5238 Parcel reply = Parcel.obtain();
5239 data.writeInterfaceToken(IActivityManager.descriptor);
5240 data.writeStrongBinder(activityContainer.asBinder());
5241 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5242 reply.readException();
5243 data.recycle();
5244 reply.recycle();
5245 }
5246
Craig Mautnerca0653a2015-02-17 10:17:21 -08005247 @Override
5248 public int getActivityDisplayId(IBinder activityToken) throws RemoteException {
Craig Mautnere0a38842013-12-16 16:14:02 -08005249 Parcel data = Parcel.obtain();
5250 Parcel reply = Parcel.obtain();
5251 data.writeInterfaceToken(IActivityManager.descriptor);
5252 data.writeStrongBinder(activityToken);
Craig Mautnerca0653a2015-02-17 10:17:21 -08005253 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005254 reply.readException();
Craig Mautnerca0653a2015-02-17 10:17:21 -08005255 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005256 data.recycle();
5257 reply.recycle();
Craig Mautnerca0653a2015-02-17 10:17:21 -08005258 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005259 }
5260
Craig Mautnerca0653a2015-02-17 10:17:21 -08005261 @Override
Craig Mautner4a1cb222013-12-04 16:14:06 -08005262 public IBinder getHomeActivityToken() throws RemoteException {
5263 Parcel data = Parcel.obtain();
5264 Parcel reply = Parcel.obtain();
5265 data.writeInterfaceToken(IActivityManager.descriptor);
5266 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5267 reply.readException();
5268 IBinder res = reply.readStrongBinder();
5269 data.recycle();
5270 reply.recycle();
5271 return res;
5272 }
5273
Craig Mautneraea74a52014-03-08 14:23:10 -08005274 @Override
5275 public void startLockTaskMode(int taskId) throws RemoteException {
5276 Parcel data = Parcel.obtain();
5277 Parcel reply = Parcel.obtain();
5278 data.writeInterfaceToken(IActivityManager.descriptor);
5279 data.writeInt(taskId);
5280 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5281 reply.readException();
5282 data.recycle();
5283 reply.recycle();
5284 }
5285
5286 @Override
5287 public void startLockTaskMode(IBinder token) throws RemoteException {
5288 Parcel data = Parcel.obtain();
5289 Parcel reply = Parcel.obtain();
5290 data.writeInterfaceToken(IActivityManager.descriptor);
5291 data.writeStrongBinder(token);
5292 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5293 reply.readException();
5294 data.recycle();
5295 reply.recycle();
5296 }
5297
5298 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005299 public void startLockTaskModeOnCurrent() throws RemoteException {
5300 Parcel data = Parcel.obtain();
5301 Parcel reply = Parcel.obtain();
5302 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005303 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005304 reply.readException();
5305 data.recycle();
5306 reply.recycle();
5307 }
5308
5309 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005310 public void stopLockTaskMode() throws RemoteException {
5311 Parcel data = Parcel.obtain();
5312 Parcel reply = Parcel.obtain();
5313 data.writeInterfaceToken(IActivityManager.descriptor);
5314 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5315 reply.readException();
5316 data.recycle();
5317 reply.recycle();
5318 }
5319
5320 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005321 public void stopLockTaskModeOnCurrent() throws RemoteException {
5322 Parcel data = Parcel.obtain();
5323 Parcel reply = Parcel.obtain();
5324 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005325 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005326 reply.readException();
5327 data.recycle();
5328 reply.recycle();
5329 }
5330
5331 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005332 public boolean isInLockTaskMode() throws RemoteException {
5333 Parcel data = Parcel.obtain();
5334 Parcel reply = Parcel.obtain();
5335 data.writeInterfaceToken(IActivityManager.descriptor);
5336 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5337 reply.readException();
5338 boolean isInLockTaskMode = reply.readInt() == 1;
5339 data.recycle();
5340 reply.recycle();
5341 return isInLockTaskMode;
5342 }
5343
Craig Mautner688b5102014-03-27 16:55:03 -07005344 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005345 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005346 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005347 Parcel data = Parcel.obtain();
5348 Parcel reply = Parcel.obtain();
5349 data.writeInterfaceToken(IActivityManager.descriptor);
5350 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005351 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005352 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005353 reply.readException();
5354 data.recycle();
5355 reply.recycle();
5356 }
5357
Craig Mautneree2e45a2014-06-27 12:10:03 -07005358 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005359 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5360 Parcel data = Parcel.obtain();
5361 Parcel reply = Parcel.obtain();
5362 data.writeInterfaceToken(IActivityManager.descriptor);
5363 data.writeString(filename);
5364 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5365 reply.readException();
5366 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5367 data.recycle();
5368 reply.recycle();
5369 return icon;
5370 }
5371
5372 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005373 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5374 throws RemoteException {
5375 Parcel data = Parcel.obtain();
5376 Parcel reply = Parcel.obtain();
5377 data.writeInterfaceToken(IActivityManager.descriptor);
5378 if (options == null) {
5379 data.writeInt(0);
5380 } else {
5381 data.writeInt(1);
5382 data.writeBundle(options.toBundle());
5383 }
5384 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5385 reply.readException();
5386 data.recycle();
5387 reply.recycle();
5388 }
5389
5390 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005391 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005392 Parcel data = Parcel.obtain();
5393 Parcel reply = Parcel.obtain();
5394 data.writeInterfaceToken(IActivityManager.descriptor);
5395 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005396 data.writeInt(visible ? 1 : 0);
5397 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005398 reply.readException();
5399 boolean success = reply.readInt() > 0;
5400 data.recycle();
5401 reply.recycle();
5402 return success;
5403 }
5404
5405 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005406 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005407 Parcel data = Parcel.obtain();
5408 Parcel reply = Parcel.obtain();
5409 data.writeInterfaceToken(IActivityManager.descriptor);
5410 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005411 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005412 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005413 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005414 data.recycle();
5415 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005416 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005417 }
5418
5419 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005420 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005421 Parcel data = Parcel.obtain();
5422 Parcel reply = Parcel.obtain();
5423 data.writeInterfaceToken(IActivityManager.descriptor);
5424 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005425 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5426 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005427 reply.readException();
5428 data.recycle();
5429 reply.recycle();
5430 }
5431
5432 @Override
5433 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5434 Parcel data = Parcel.obtain();
5435 Parcel reply = Parcel.obtain();
5436 data.writeInterfaceToken(IActivityManager.descriptor);
5437 data.writeStrongBinder(token);
5438 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5439 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005440 reply.readException();
5441 data.recycle();
5442 reply.recycle();
5443 }
5444
Craig Mautner8746a472014-07-24 15:12:54 -07005445 @Override
5446 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5447 Parcel data = Parcel.obtain();
5448 Parcel reply = Parcel.obtain();
5449 data.writeInterfaceToken(IActivityManager.descriptor);
5450 data.writeStrongBinder(token);
5451 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5452 IBinder.FLAG_ONEWAY);
5453 reply.readException();
5454 data.recycle();
5455 reply.recycle();
5456 }
5457
Craig Mautner6e2f3952014-09-09 14:26:41 -07005458 @Override
5459 public void bootAnimationComplete() throws RemoteException {
5460 Parcel data = Parcel.obtain();
5461 Parcel reply = Parcel.obtain();
5462 data.writeInterfaceToken(IActivityManager.descriptor);
5463 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5464 reply.readException();
5465 data.recycle();
5466 reply.recycle();
5467 }
5468
Wale Ogunwale18795a22014-12-03 11:38:33 -08005469 @Override
5470 public void systemBackupRestored() throws RemoteException {
5471 Parcel data = Parcel.obtain();
5472 Parcel reply = Parcel.obtain();
5473 data.writeInterfaceToken(IActivityManager.descriptor);
5474 mRemote.transact(SYSTEM_BACKUP_RESTORED, data, reply, 0);
5475 reply.readException();
5476 data.recycle();
5477 reply.recycle();
5478 }
5479
Jeff Sharkeyc2ae6fb2015-01-15 21:27:13 -08005480 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005481 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5482 Parcel data = Parcel.obtain();
5483 Parcel reply = Parcel.obtain();
5484 data.writeInterfaceToken(IActivityManager.descriptor);
5485 data.writeInt(uid);
5486 data.writeByteArray(firstPacket);
5487 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5488 reply.readException();
5489 data.recycle();
5490 reply.recycle();
5491 }
5492
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005493 private IBinder mRemote;
5494}