blob: c3028b7f63ea0e05891e0de0bfaaf1102789ad39 [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;
Jeff Hao1b012d32014-08-20 10:35:34 -070020import android.app.ProfilerInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070022import android.content.IIntentReceiver;
23import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.content.Intent;
25import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070026import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070027import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070028import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.pm.ConfigurationInfo;
30import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070031import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070032import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070034import android.graphics.Bitmap;
35import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080036import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080037import android.net.Uri;
38import android.os.Binder;
39import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070040import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.os.IBinder;
42import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070043import android.os.ParcelFileDescriptor;
44import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070045import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070046import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070048import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070049import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080052import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070053import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055import java.util.ArrayList;
56import java.util.List;
57
58/** {@hide} */
59public abstract class ActivityManagerNative extends Binder implements IActivityManager
60{
61 /**
62 * Cast a Binder object into an activity manager interface, generating
63 * a proxy if needed.
64 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 if (obj == null) {
67 return null;
68 }
69 IActivityManager in =
70 (IActivityManager)obj.queryLocalInterface(descriptor);
71 if (in != null) {
72 return in;
73 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 return new ActivityManagerProxy(obj);
76 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080077
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 /**
79 * Retrieve the system's default/global activity manager.
80 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080081 static public IActivityManager getDefault() {
82 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 }
84
85 /**
86 * Convenience for checking whether the system is ready. For internal use only.
87 */
88 static public boolean isSystemReady() {
89 if (!sSystemReady) {
90 sSystemReady = getDefault().testIsSystemReady();
91 }
92 return sSystemReady;
93 }
94 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080095
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 /**
97 * Convenience for sending a sticky broadcast. For internal use only.
98 * If you don't care about permission, use null.
99 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -0700100 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800101 try {
102 getDefault().broadcastIntent(
103 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800104 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105 } catch (RemoteException ex) {
106 }
107 }
108
Dianne Hackborn099bc622014-01-22 13:39:16 -0800109 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800111 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800116 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800117 attachInterface(this, descriptor);
118 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700119
120 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800121 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
122 throws RemoteException {
123 switch (code) {
124 case START_ACTIVITY_TRANSACTION:
125 {
126 data.enforceInterface(IActivityManager.descriptor);
127 IBinder b = data.readStrongBinder();
128 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800129 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 Intent intent = Intent.CREATOR.createFromParcel(data);
131 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800133 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700135 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700136 ProfilerInfo profilerInfo = data.readInt() != 0
137 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700138 Bundle options = data.readInt() != 0
139 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800140 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700141 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 reply.writeNoException();
143 reply.writeInt(result);
144 return true;
145 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700146
Amith Yamasani82644082012-08-03 13:09:11 -0700147 case START_ACTIVITY_AS_USER_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
155 IBinder resultTo = data.readStrongBinder();
156 String resultWho = data.readString();
157 int requestCode = data.readInt();
158 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700159 ProfilerInfo profilerInfo = data.readInt() != 0
160 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
163 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800164 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700165 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700166 reply.writeNoException();
167 reply.writeInt(result);
168 return true;
169 }
170
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700171 case START_ACTIVITY_AS_CALLER_TRANSACTION:
172 {
173 data.enforceInterface(IActivityManager.descriptor);
174 IBinder b = data.readStrongBinder();
175 IApplicationThread app = ApplicationThreadNative.asInterface(b);
176 String callingPackage = data.readString();
177 Intent intent = Intent.CREATOR.createFromParcel(data);
178 String resolvedType = data.readString();
179 IBinder resultTo = data.readStrongBinder();
180 String resultWho = data.readString();
181 int requestCode = data.readInt();
182 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700183 ProfilerInfo profilerInfo = data.readInt() != 0
184 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700185 Bundle options = data.readInt() != 0
186 ? Bundle.CREATOR.createFromParcel(data) : null;
Jeff Sharkey97978802014-10-14 10:48:18 -0700187 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700188 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Jeff Sharkey97978802014-10-14 10:48:18 -0700189 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700190 reply.writeNoException();
191 reply.writeInt(result);
192 return true;
193 }
194
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800195 case START_ACTIVITY_AND_WAIT_TRANSACTION:
196 {
197 data.enforceInterface(IActivityManager.descriptor);
198 IBinder b = data.readStrongBinder();
199 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800200 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800201 Intent intent = Intent.CREATOR.createFromParcel(data);
202 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800203 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800204 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800205 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700206 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700207 ProfilerInfo profilerInfo = data.readInt() != 0
208 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700209 Bundle options = data.readInt() != 0
210 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700211 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800212 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700213 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800214 reply.writeNoException();
215 result.writeToParcel(reply, 0);
216 return true;
217 }
218
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700219 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
220 {
221 data.enforceInterface(IActivityManager.descriptor);
222 IBinder b = data.readStrongBinder();
223 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800224 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700225 Intent intent = Intent.CREATOR.createFromParcel(data);
226 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700227 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700228 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700229 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700230 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700231 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700232 Bundle options = data.readInt() != 0
233 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700234 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800235 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700236 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700237 reply.writeNoException();
238 reply.writeInt(result);
239 return true;
240 }
241
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700242 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700243 {
244 data.enforceInterface(IActivityManager.descriptor);
245 IBinder b = data.readStrongBinder();
246 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700247 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700248 Intent fillInIntent = null;
249 if (data.readInt() != 0) {
250 fillInIntent = Intent.CREATOR.createFromParcel(data);
251 }
252 String resolvedType = data.readString();
253 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700254 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700255 int requestCode = data.readInt();
256 int flagsMask = data.readInt();
257 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700258 Bundle options = data.readInt() != 0
259 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700260 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700261 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700262 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700263 reply.writeNoException();
264 reply.writeInt(result);
265 return true;
266 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700267
Dianne Hackborn91097de2014-04-04 18:02:06 -0700268 case START_VOICE_ACTIVITY_TRANSACTION:
269 {
270 data.enforceInterface(IActivityManager.descriptor);
271 String callingPackage = data.readString();
272 int callingPid = data.readInt();
273 int callingUid = data.readInt();
274 Intent intent = Intent.CREATOR.createFromParcel(data);
275 String resolvedType = data.readString();
276 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
277 data.readStrongBinder());
278 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
279 data.readStrongBinder());
280 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700281 ProfilerInfo profilerInfo = data.readInt() != 0
282 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700283 Bundle options = data.readInt() != 0
284 ? Bundle.CREATOR.createFromParcel(data) : null;
285 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700286 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
287 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700288 reply.writeNoException();
289 reply.writeInt(result);
290 return true;
291 }
292
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800293 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
294 {
295 data.enforceInterface(IActivityManager.descriptor);
296 IBinder callingActivity = data.readStrongBinder();
297 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700298 Bundle options = data.readInt() != 0
299 ? Bundle.CREATOR.createFromParcel(data) : null;
300 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800301 reply.writeNoException();
302 reply.writeInt(result ? 1 : 0);
303 return true;
304 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700305
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700306 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
307 {
308 data.enforceInterface(IActivityManager.descriptor);
309 int taskId = data.readInt();
310 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
311 int result = startActivityFromRecents(taskId, options);
312 reply.writeNoException();
313 reply.writeInt(result);
314 return true;
315 }
316
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800317 case FINISH_ACTIVITY_TRANSACTION: {
318 data.enforceInterface(IActivityManager.descriptor);
319 IBinder token = data.readStrongBinder();
320 Intent resultData = null;
321 int resultCode = data.readInt();
322 if (data.readInt() != 0) {
323 resultData = Intent.CREATOR.createFromParcel(data);
324 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700325 boolean finishTask = (data.readInt() != 0);
326 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800327 reply.writeNoException();
328 reply.writeInt(res ? 1 : 0);
329 return true;
330 }
331
332 case FINISH_SUB_ACTIVITY_TRANSACTION: {
333 data.enforceInterface(IActivityManager.descriptor);
334 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700335 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800336 int requestCode = data.readInt();
337 finishSubActivity(token, resultWho, requestCode);
338 reply.writeNoException();
339 return true;
340 }
341
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700342 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
343 data.enforceInterface(IActivityManager.descriptor);
344 IBinder token = data.readStrongBinder();
345 boolean res = finishActivityAffinity(token);
346 reply.writeNoException();
347 reply.writeInt(res ? 1 : 0);
348 return true;
349 }
350
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700351 case FINISH_VOICE_TASK_TRANSACTION: {
352 data.enforceInterface(IActivityManager.descriptor);
353 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
354 data.readStrongBinder());
355 finishVoiceTask(session);
356 reply.writeNoException();
357 return true;
358 }
359
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700360 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
361 data.enforceInterface(IActivityManager.descriptor);
362 IBinder token = data.readStrongBinder();
363 boolean res = releaseActivityInstance(token);
364 reply.writeNoException();
365 reply.writeInt(res ? 1 : 0);
366 return true;
367 }
368
369 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
370 data.enforceInterface(IActivityManager.descriptor);
371 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
372 releaseSomeActivities(app);
373 reply.writeNoException();
374 return true;
375 }
376
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800377 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
378 data.enforceInterface(IActivityManager.descriptor);
379 IBinder token = data.readStrongBinder();
380 boolean res = willActivityBeVisible(token);
381 reply.writeNoException();
382 reply.writeInt(res ? 1 : 0);
383 return true;
384 }
385
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 case REGISTER_RECEIVER_TRANSACTION:
387 {
388 data.enforceInterface(IActivityManager.descriptor);
389 IBinder b = data.readStrongBinder();
390 IApplicationThread app =
391 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700392 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800393 b = data.readStrongBinder();
394 IIntentReceiver rec
395 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
396 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
397 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700398 int userId = data.readInt();
399 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800400 reply.writeNoException();
401 if (intent != null) {
402 reply.writeInt(1);
403 intent.writeToParcel(reply, 0);
404 } else {
405 reply.writeInt(0);
406 }
407 return true;
408 }
409
410 case UNREGISTER_RECEIVER_TRANSACTION:
411 {
412 data.enforceInterface(IActivityManager.descriptor);
413 IBinder b = data.readStrongBinder();
414 if (b == null) {
415 return true;
416 }
417 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
418 unregisterReceiver(rec);
419 reply.writeNoException();
420 return true;
421 }
422
423 case BROADCAST_INTENT_TRANSACTION:
424 {
425 data.enforceInterface(IActivityManager.descriptor);
426 IBinder b = data.readStrongBinder();
427 IApplicationThread app =
428 b != null ? ApplicationThreadNative.asInterface(b) : null;
429 Intent intent = Intent.CREATOR.createFromParcel(data);
430 String resolvedType = data.readString();
431 b = data.readStrongBinder();
432 IIntentReceiver resultTo =
433 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
434 int resultCode = data.readInt();
435 String resultData = data.readString();
436 Bundle resultExtras = data.readBundle();
437 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800438 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800439 boolean serialized = data.readInt() != 0;
440 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700441 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800442 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800443 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700444 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800445 reply.writeNoException();
446 reply.writeInt(res);
447 return true;
448 }
449
450 case UNBROADCAST_INTENT_TRANSACTION:
451 {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder b = data.readStrongBinder();
454 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
455 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700456 int userId = data.readInt();
457 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800458 reply.writeNoException();
459 return true;
460 }
461
462 case FINISH_RECEIVER_TRANSACTION: {
463 data.enforceInterface(IActivityManager.descriptor);
464 IBinder who = data.readStrongBinder();
465 int resultCode = data.readInt();
466 String resultData = data.readString();
467 Bundle resultExtras = data.readBundle();
468 boolean resultAbort = data.readInt() != 0;
469 if (who != null) {
470 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
471 }
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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800777 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 IBinder token = data.readStrongBinder();
780 boolean onlyRoot = data.readInt() != 0;
781 int res = token != null
782 ? getTaskForActivity(token, onlyRoot) : -1;
783 reply.writeNoException();
784 reply.writeInt(res);
785 return true;
786 }
787
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800788 case GET_CONTENT_PROVIDER_TRANSACTION: {
789 data.enforceInterface(IActivityManager.descriptor);
790 IBinder b = data.readStrongBinder();
791 IApplicationThread app = ApplicationThreadNative.asInterface(b);
792 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700793 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700794 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700795 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800796 reply.writeNoException();
797 if (cph != null) {
798 reply.writeInt(1);
799 cph.writeToParcel(reply, 0);
800 } else {
801 reply.writeInt(0);
802 }
803 return true;
804 }
805
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800806 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
807 data.enforceInterface(IActivityManager.descriptor);
808 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700809 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800810 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700811 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800812 reply.writeNoException();
813 if (cph != null) {
814 reply.writeInt(1);
815 cph.writeToParcel(reply, 0);
816 } else {
817 reply.writeInt(0);
818 }
819 return true;
820 }
821
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800822 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
823 data.enforceInterface(IActivityManager.descriptor);
824 IBinder b = data.readStrongBinder();
825 IApplicationThread app = ApplicationThreadNative.asInterface(b);
826 ArrayList<ContentProviderHolder> providers =
827 data.createTypedArrayList(ContentProviderHolder.CREATOR);
828 publishContentProviders(app, providers);
829 reply.writeNoException();
830 return true;
831 }
832
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700833 case REF_CONTENT_PROVIDER_TRANSACTION: {
834 data.enforceInterface(IActivityManager.descriptor);
835 IBinder b = data.readStrongBinder();
836 int stable = data.readInt();
837 int unstable = data.readInt();
838 boolean res = refContentProvider(b, stable, unstable);
839 reply.writeNoException();
840 reply.writeInt(res ? 1 : 0);
841 return true;
842 }
843
844 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
845 data.enforceInterface(IActivityManager.descriptor);
846 IBinder b = data.readStrongBinder();
847 unstableProviderDied(b);
848 reply.writeNoException();
849 return true;
850 }
851
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700852 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
853 data.enforceInterface(IActivityManager.descriptor);
854 IBinder b = data.readStrongBinder();
855 appNotRespondingViaProvider(b);
856 reply.writeNoException();
857 return true;
858 }
859
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800860 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
861 data.enforceInterface(IActivityManager.descriptor);
862 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700863 boolean stable = data.readInt() != 0;
864 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800865 reply.writeNoException();
866 return true;
867 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800868
869 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
870 data.enforceInterface(IActivityManager.descriptor);
871 String name = data.readString();
872 IBinder token = data.readStrongBinder();
873 removeContentProviderExternal(name, token);
874 reply.writeNoException();
875 return true;
876 }
877
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700878 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
879 data.enforceInterface(IActivityManager.descriptor);
880 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
881 PendingIntent pi = getRunningServiceControlPanel(comp);
882 reply.writeNoException();
883 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
884 return true;
885 }
886
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800887 case START_SERVICE_TRANSACTION: {
888 data.enforceInterface(IActivityManager.descriptor);
889 IBinder b = data.readStrongBinder();
890 IApplicationThread app = ApplicationThreadNative.asInterface(b);
891 Intent service = Intent.CREATOR.createFromParcel(data);
892 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700893 int userId = data.readInt();
894 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800895 reply.writeNoException();
896 ComponentName.writeToParcel(cn, reply);
897 return true;
898 }
899
900 case STOP_SERVICE_TRANSACTION: {
901 data.enforceInterface(IActivityManager.descriptor);
902 IBinder b = data.readStrongBinder();
903 IApplicationThread app = ApplicationThreadNative.asInterface(b);
904 Intent service = Intent.CREATOR.createFromParcel(data);
905 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700906 int userId = data.readInt();
907 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 reply.writeNoException();
909 reply.writeInt(res);
910 return true;
911 }
912
913 case STOP_SERVICE_TOKEN_TRANSACTION: {
914 data.enforceInterface(IActivityManager.descriptor);
915 ComponentName className = ComponentName.readFromParcel(data);
916 IBinder token = data.readStrongBinder();
917 int startId = data.readInt();
918 boolean res = stopServiceToken(className, token, startId);
919 reply.writeNoException();
920 reply.writeInt(res ? 1 : 0);
921 return true;
922 }
923
924 case SET_SERVICE_FOREGROUND_TRANSACTION: {
925 data.enforceInterface(IActivityManager.descriptor);
926 ComponentName className = ComponentName.readFromParcel(data);
927 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700928 int id = data.readInt();
929 Notification notification = null;
930 if (data.readInt() != 0) {
931 notification = Notification.CREATOR.createFromParcel(data);
932 }
933 boolean removeNotification = data.readInt() != 0;
934 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800935 reply.writeNoException();
936 return true;
937 }
938
939 case BIND_SERVICE_TRANSACTION: {
940 data.enforceInterface(IActivityManager.descriptor);
941 IBinder b = data.readStrongBinder();
942 IApplicationThread app = ApplicationThreadNative.asInterface(b);
943 IBinder token = data.readStrongBinder();
944 Intent service = Intent.CREATOR.createFromParcel(data);
945 String resolvedType = data.readString();
946 b = data.readStrongBinder();
947 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800948 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800949 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800950 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800951 reply.writeNoException();
952 reply.writeInt(res);
953 return true;
954 }
955
956 case UNBIND_SERVICE_TRANSACTION: {
957 data.enforceInterface(IActivityManager.descriptor);
958 IBinder b = data.readStrongBinder();
959 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
960 boolean res = unbindService(conn);
961 reply.writeNoException();
962 reply.writeInt(res ? 1 : 0);
963 return true;
964 }
965
966 case PUBLISH_SERVICE_TRANSACTION: {
967 data.enforceInterface(IActivityManager.descriptor);
968 IBinder token = data.readStrongBinder();
969 Intent intent = Intent.CREATOR.createFromParcel(data);
970 IBinder service = data.readStrongBinder();
971 publishService(token, intent, service);
972 reply.writeNoException();
973 return true;
974 }
975
976 case UNBIND_FINISHED_TRANSACTION: {
977 data.enforceInterface(IActivityManager.descriptor);
978 IBinder token = data.readStrongBinder();
979 Intent intent = Intent.CREATOR.createFromParcel(data);
980 boolean doRebind = data.readInt() != 0;
981 unbindFinished(token, intent, doRebind);
982 reply.writeNoException();
983 return true;
984 }
985
986 case SERVICE_DONE_EXECUTING_TRANSACTION: {
987 data.enforceInterface(IActivityManager.descriptor);
988 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700989 int type = data.readInt();
990 int startId = data.readInt();
991 int res = data.readInt();
992 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800993 reply.writeNoException();
994 return true;
995 }
996
997 case START_INSTRUMENTATION_TRANSACTION: {
998 data.enforceInterface(IActivityManager.descriptor);
999 ComponentName className = ComponentName.readFromParcel(data);
1000 String profileFile = data.readString();
1001 int fl = data.readInt();
1002 Bundle arguments = data.readBundle();
1003 IBinder b = data.readStrongBinder();
1004 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001005 b = data.readStrongBinder();
1006 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001007 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001008 String abiOverride = data.readString();
1009 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1010 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001011 reply.writeNoException();
1012 reply.writeInt(res ? 1 : 0);
1013 return true;
1014 }
1015
1016
1017 case FINISH_INSTRUMENTATION_TRANSACTION: {
1018 data.enforceInterface(IActivityManager.descriptor);
1019 IBinder b = data.readStrongBinder();
1020 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1021 int resultCode = data.readInt();
1022 Bundle results = data.readBundle();
1023 finishInstrumentation(app, resultCode, results);
1024 reply.writeNoException();
1025 return true;
1026 }
1027
1028 case GET_CONFIGURATION_TRANSACTION: {
1029 data.enforceInterface(IActivityManager.descriptor);
1030 Configuration config = getConfiguration();
1031 reply.writeNoException();
1032 config.writeToParcel(reply, 0);
1033 return true;
1034 }
1035
1036 case UPDATE_CONFIGURATION_TRANSACTION: {
1037 data.enforceInterface(IActivityManager.descriptor);
1038 Configuration config = Configuration.CREATOR.createFromParcel(data);
1039 updateConfiguration(config);
1040 reply.writeNoException();
1041 return true;
1042 }
1043
1044 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1045 data.enforceInterface(IActivityManager.descriptor);
1046 IBinder token = data.readStrongBinder();
1047 int requestedOrientation = data.readInt();
1048 setRequestedOrientation(token, requestedOrientation);
1049 reply.writeNoException();
1050 return true;
1051 }
1052
1053 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1054 data.enforceInterface(IActivityManager.descriptor);
1055 IBinder token = data.readStrongBinder();
1056 int req = getRequestedOrientation(token);
1057 reply.writeNoException();
1058 reply.writeInt(req);
1059 return true;
1060 }
1061
1062 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1063 data.enforceInterface(IActivityManager.descriptor);
1064 IBinder token = data.readStrongBinder();
1065 ComponentName cn = getActivityClassForToken(token);
1066 reply.writeNoException();
1067 ComponentName.writeToParcel(cn, reply);
1068 return true;
1069 }
1070
1071 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1072 data.enforceInterface(IActivityManager.descriptor);
1073 IBinder token = data.readStrongBinder();
1074 reply.writeNoException();
1075 reply.writeString(getPackageForToken(token));
1076 return true;
1077 }
1078
1079 case GET_INTENT_SENDER_TRANSACTION: {
1080 data.enforceInterface(IActivityManager.descriptor);
1081 int type = data.readInt();
1082 String packageName = data.readString();
1083 IBinder token = data.readStrongBinder();
1084 String resultWho = data.readString();
1085 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001086 Intent[] requestIntents;
1087 String[] requestResolvedTypes;
1088 if (data.readInt() != 0) {
1089 requestIntents = data.createTypedArray(Intent.CREATOR);
1090 requestResolvedTypes = data.createStringArray();
1091 } else {
1092 requestIntents = null;
1093 requestResolvedTypes = null;
1094 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001095 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001096 Bundle options = data.readInt() != 0
1097 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001098 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001099 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001100 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001101 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001102 reply.writeNoException();
1103 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1104 return true;
1105 }
1106
1107 case CANCEL_INTENT_SENDER_TRANSACTION: {
1108 data.enforceInterface(IActivityManager.descriptor);
1109 IIntentSender r = IIntentSender.Stub.asInterface(
1110 data.readStrongBinder());
1111 cancelIntentSender(r);
1112 reply.writeNoException();
1113 return true;
1114 }
1115
1116 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1117 data.enforceInterface(IActivityManager.descriptor);
1118 IIntentSender r = IIntentSender.Stub.asInterface(
1119 data.readStrongBinder());
1120 String res = getPackageForIntentSender(r);
1121 reply.writeNoException();
1122 reply.writeString(res);
1123 return true;
1124 }
1125
Christopher Tatec4a07d12012-04-06 14:19:13 -07001126 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1127 data.enforceInterface(IActivityManager.descriptor);
1128 IIntentSender r = IIntentSender.Stub.asInterface(
1129 data.readStrongBinder());
1130 int res = getUidForIntentSender(r);
1131 reply.writeNoException();
1132 reply.writeInt(res);
1133 return true;
1134 }
1135
Dianne Hackborn41203752012-08-31 14:05:51 -07001136 case HANDLE_INCOMING_USER_TRANSACTION: {
1137 data.enforceInterface(IActivityManager.descriptor);
1138 int callingPid = data.readInt();
1139 int callingUid = data.readInt();
1140 int userId = data.readInt();
1141 boolean allowAll = data.readInt() != 0 ;
1142 boolean requireFull = data.readInt() != 0;
1143 String name = data.readString();
1144 String callerPackage = data.readString();
1145 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1146 requireFull, name, callerPackage);
1147 reply.writeNoException();
1148 reply.writeInt(res);
1149 return true;
1150 }
1151
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 case SET_PROCESS_LIMIT_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 int max = data.readInt();
1155 setProcessLimit(max);
1156 reply.writeNoException();
1157 return true;
1158 }
1159
1160 case GET_PROCESS_LIMIT_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 int limit = getProcessLimit();
1163 reply.writeNoException();
1164 reply.writeInt(limit);
1165 return true;
1166 }
1167
1168 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1169 data.enforceInterface(IActivityManager.descriptor);
1170 IBinder token = data.readStrongBinder();
1171 int pid = data.readInt();
1172 boolean isForeground = data.readInt() != 0;
1173 setProcessForeground(token, pid, isForeground);
1174 reply.writeNoException();
1175 return true;
1176 }
1177
1178 case CHECK_PERMISSION_TRANSACTION: {
1179 data.enforceInterface(IActivityManager.descriptor);
1180 String perm = data.readString();
1181 int pid = data.readInt();
1182 int uid = data.readInt();
1183 int res = checkPermission(perm, pid, uid);
1184 reply.writeNoException();
1185 reply.writeInt(res);
1186 return true;
1187 }
1188
1189 case CHECK_URI_PERMISSION_TRANSACTION: {
1190 data.enforceInterface(IActivityManager.descriptor);
1191 Uri uri = Uri.CREATOR.createFromParcel(data);
1192 int pid = data.readInt();
1193 int uid = data.readInt();
1194 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001195 int userId = data.readInt();
1196 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001197 reply.writeNoException();
1198 reply.writeInt(res);
1199 return true;
1200 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001201
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001202 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001203 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001204 String packageName = data.readString();
1205 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1206 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001207 int userId = data.readInt();
1208 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001209 reply.writeNoException();
1210 reply.writeInt(res ? 1 : 0);
1211 return true;
1212 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001213
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001214 case GRANT_URI_PERMISSION_TRANSACTION: {
1215 data.enforceInterface(IActivityManager.descriptor);
1216 IBinder b = data.readStrongBinder();
1217 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1218 String targetPkg = data.readString();
1219 Uri uri = Uri.CREATOR.createFromParcel(data);
1220 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001221 int userId = data.readInt();
1222 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223 reply.writeNoException();
1224 return true;
1225 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001226
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001227 case REVOKE_URI_PERMISSION_TRANSACTION: {
1228 data.enforceInterface(IActivityManager.descriptor);
1229 IBinder b = data.readStrongBinder();
1230 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1231 Uri uri = Uri.CREATOR.createFromParcel(data);
1232 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001233 int userId = data.readInt();
1234 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001235 reply.writeNoException();
1236 return true;
1237 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001238
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001239 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1240 data.enforceInterface(IActivityManager.descriptor);
1241 Uri uri = Uri.CREATOR.createFromParcel(data);
1242 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001243 int userId = data.readInt();
1244 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001245 reply.writeNoException();
1246 return true;
1247 }
1248
1249 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1250 data.enforceInterface(IActivityManager.descriptor);
1251 Uri uri = Uri.CREATOR.createFromParcel(data);
1252 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001253 int userId = data.readInt();
1254 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001255 reply.writeNoException();
1256 return true;
1257 }
1258
1259 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1260 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001261 final String packageName = data.readString();
1262 final boolean incoming = data.readInt() != 0;
1263 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1264 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001265 reply.writeNoException();
1266 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1267 return true;
1268 }
1269
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001270 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1271 data.enforceInterface(IActivityManager.descriptor);
1272 IBinder b = data.readStrongBinder();
1273 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1274 boolean waiting = data.readInt() != 0;
1275 showWaitingForDebugger(app, waiting);
1276 reply.writeNoException();
1277 return true;
1278 }
1279
1280 case GET_MEMORY_INFO_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
1282 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1283 getMemoryInfo(mi);
1284 reply.writeNoException();
1285 mi.writeToParcel(reply, 0);
1286 return true;
1287 }
1288
1289 case UNHANDLED_BACK_TRANSACTION: {
1290 data.enforceInterface(IActivityManager.descriptor);
1291 unhandledBack();
1292 reply.writeNoException();
1293 return true;
1294 }
1295
1296 case OPEN_CONTENT_URI_TRANSACTION: {
1297 data.enforceInterface(IActivityManager.descriptor);
1298 Uri uri = Uri.parse(data.readString());
1299 ParcelFileDescriptor pfd = openContentUri(uri);
1300 reply.writeNoException();
1301 if (pfd != null) {
1302 reply.writeInt(1);
1303 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1304 } else {
1305 reply.writeInt(0);
1306 }
1307 return true;
1308 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001309
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001310 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1311 data.enforceInterface(IActivityManager.descriptor);
1312 setLockScreenShown(data.readInt() != 0);
1313 reply.writeNoException();
1314 return true;
1315 }
1316
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001317 case SET_DEBUG_APP_TRANSACTION: {
1318 data.enforceInterface(IActivityManager.descriptor);
1319 String pn = data.readString();
1320 boolean wfd = data.readInt() != 0;
1321 boolean per = data.readInt() != 0;
1322 setDebugApp(pn, wfd, per);
1323 reply.writeNoException();
1324 return true;
1325 }
1326
1327 case SET_ALWAYS_FINISH_TRANSACTION: {
1328 data.enforceInterface(IActivityManager.descriptor);
1329 boolean enabled = data.readInt() != 0;
1330 setAlwaysFinish(enabled);
1331 reply.writeNoException();
1332 return true;
1333 }
1334
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001335 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001336 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001337 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001338 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001339 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001340 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001341 return true;
1342 }
1343
1344 case ENTER_SAFE_MODE_TRANSACTION: {
1345 data.enforceInterface(IActivityManager.descriptor);
1346 enterSafeMode();
1347 reply.writeNoException();
1348 return true;
1349 }
1350
1351 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1352 data.enforceInterface(IActivityManager.descriptor);
1353 IIntentSender is = IIntentSender.Stub.asInterface(
1354 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001355 int sourceUid = data.readInt();
1356 String sourcePkg = data.readString();
1357 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001358 reply.writeNoException();
1359 return true;
1360 }
1361
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001362 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001363 data.enforceInterface(IActivityManager.descriptor);
1364 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001365 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001366 boolean secure = data.readInt() != 0;
1367 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001368 reply.writeNoException();
1369 reply.writeInt(res ? 1 : 0);
1370 return true;
1371 }
1372
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001373 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1374 data.enforceInterface(IActivityManager.descriptor);
1375 String reason = data.readString();
1376 boolean res = killProcessesBelowForeground(reason);
1377 reply.writeNoException();
1378 reply.writeInt(res ? 1 : 0);
1379 return true;
1380 }
1381
Dan Egnor60d87622009-12-16 16:32:58 -08001382 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1383 data.enforceInterface(IActivityManager.descriptor);
1384 IBinder app = data.readStrongBinder();
1385 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1386 handleApplicationCrash(app, ci);
1387 reply.writeNoException();
1388 return true;
1389 }
1390
1391 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001392 data.enforceInterface(IActivityManager.descriptor);
1393 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001394 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001395 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001396 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001397 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001398 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001399 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001400 return true;
1401 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001402
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001403 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1404 data.enforceInterface(IActivityManager.descriptor);
1405 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001406 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001407 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1408 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001409 reply.writeNoException();
1410 return true;
1411 }
1412
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001413 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1414 data.enforceInterface(IActivityManager.descriptor);
1415 int sig = data.readInt();
1416 signalPersistentProcesses(sig);
1417 reply.writeNoException();
1418 return true;
1419 }
1420
Dianne Hackborn03abb812010-01-04 18:43:19 -08001421 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1422 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001423 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001424 int userId = data.readInt();
1425 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001426 reply.writeNoException();
1427 return true;
1428 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001429
1430 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1431 data.enforceInterface(IActivityManager.descriptor);
1432 killAllBackgroundProcesses();
1433 reply.writeNoException();
1434 return true;
1435 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001436
Dianne Hackborn03abb812010-01-04 18:43:19 -08001437 case FORCE_STOP_PACKAGE_TRANSACTION: {
1438 data.enforceInterface(IActivityManager.descriptor);
1439 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001440 int userId = data.readInt();
1441 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001442 reply.writeNoException();
1443 return true;
1444 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001445
1446 case GET_MY_MEMORY_STATE_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
1448 ActivityManager.RunningAppProcessInfo info =
1449 new ActivityManager.RunningAppProcessInfo();
1450 getMyMemoryState(info);
1451 reply.writeNoException();
1452 info.writeToParcel(reply, 0);
1453 return true;
1454 }
1455
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001456 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1457 data.enforceInterface(IActivityManager.descriptor);
1458 ConfigurationInfo config = getDeviceConfigurationInfo();
1459 reply.writeNoException();
1460 config.writeToParcel(reply, 0);
1461 return true;
1462 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001463
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001464 case PROFILE_CONTROL_TRANSACTION: {
1465 data.enforceInterface(IActivityManager.descriptor);
1466 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001467 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001468 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001469 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001470 ProfilerInfo profilerInfo = data.readInt() != 0
1471 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1472 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001473 reply.writeNoException();
1474 reply.writeInt(res ? 1 : 0);
1475 return true;
1476 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001477
Dianne Hackborn55280a92009-05-07 15:53:46 -07001478 case SHUTDOWN_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 boolean res = shutdown(data.readInt());
1481 reply.writeNoException();
1482 reply.writeInt(res ? 1 : 0);
1483 return true;
1484 }
1485
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001486 case STOP_APP_SWITCHES_TRANSACTION: {
1487 data.enforceInterface(IActivityManager.descriptor);
1488 stopAppSwitches();
1489 reply.writeNoException();
1490 return true;
1491 }
1492
1493 case RESUME_APP_SWITCHES_TRANSACTION: {
1494 data.enforceInterface(IActivityManager.descriptor);
1495 resumeAppSwitches();
1496 reply.writeNoException();
1497 return true;
1498 }
1499
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001500 case PEEK_SERVICE_TRANSACTION: {
1501 data.enforceInterface(IActivityManager.descriptor);
1502 Intent service = Intent.CREATOR.createFromParcel(data);
1503 String resolvedType = data.readString();
1504 IBinder binder = peekService(service, resolvedType);
1505 reply.writeNoException();
1506 reply.writeStrongBinder(binder);
1507 return true;
1508 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001509
1510 case START_BACKUP_AGENT_TRANSACTION: {
1511 data.enforceInterface(IActivityManager.descriptor);
1512 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1513 int backupRestoreMode = data.readInt();
1514 boolean success = bindBackupAgent(info, backupRestoreMode);
1515 reply.writeNoException();
1516 reply.writeInt(success ? 1 : 0);
1517 return true;
1518 }
1519
1520 case BACKUP_AGENT_CREATED_TRANSACTION: {
1521 data.enforceInterface(IActivityManager.descriptor);
1522 String packageName = data.readString();
1523 IBinder agent = data.readStrongBinder();
1524 backupAgentCreated(packageName, agent);
1525 reply.writeNoException();
1526 return true;
1527 }
1528
1529 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1530 data.enforceInterface(IActivityManager.descriptor);
1531 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1532 unbindBackupAgent(info);
1533 reply.writeNoException();
1534 return true;
1535 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001536
1537 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1538 data.enforceInterface(IActivityManager.descriptor);
1539 String packageName = data.readString();
1540 addPackageDependency(packageName);
1541 reply.writeNoException();
1542 return true;
1543 }
1544
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001545 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001546 data.enforceInterface(IActivityManager.descriptor);
1547 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001548 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001549 String reason = data.readString();
1550 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001551 reply.writeNoException();
1552 return true;
1553 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001554
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001555 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1556 data.enforceInterface(IActivityManager.descriptor);
1557 String reason = data.readString();
1558 closeSystemDialogs(reason);
1559 reply.writeNoException();
1560 return true;
1561 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001562
1563 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1564 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001565 int[] pids = data.createIntArray();
1566 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001567 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001568 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001569 return true;
1570 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001571
1572 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1573 data.enforceInterface(IActivityManager.descriptor);
1574 String processName = data.readString();
1575 int uid = data.readInt();
1576 killApplicationProcess(processName, uid);
1577 reply.writeNoException();
1578 return true;
1579 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001580
1581 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1582 data.enforceInterface(IActivityManager.descriptor);
1583 IBinder token = data.readStrongBinder();
1584 String packageName = data.readString();
1585 int enterAnim = data.readInt();
1586 int exitAnim = data.readInt();
1587 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001588 reply.writeNoException();
1589 return true;
1590 }
1591
1592 case IS_USER_A_MONKEY_TRANSACTION: {
1593 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001594 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001595 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001596 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001597 return true;
1598 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001599
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001600 case SET_USER_IS_MONKEY_TRANSACTION: {
1601 data.enforceInterface(IActivityManager.descriptor);
1602 final boolean monkey = (data.readInt() == 1);
1603 setUserIsMonkey(monkey);
1604 reply.writeNoException();
1605 return true;
1606 }
1607
Dianne Hackborn860755f2010-06-03 18:47:52 -07001608 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1609 data.enforceInterface(IActivityManager.descriptor);
1610 finishHeavyWeightApp();
1611 reply.writeNoException();
1612 return true;
1613 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001614
1615 case IS_IMMERSIVE_TRANSACTION: {
1616 data.enforceInterface(IActivityManager.descriptor);
1617 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001618 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001619 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001620 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001621 return true;
1622 }
1623
Craig Mautnerd61dc202014-07-07 11:09:11 -07001624 case IS_TOP_OF_TASK_TRANSACTION: {
1625 data.enforceInterface(IActivityManager.descriptor);
1626 IBinder token = data.readStrongBinder();
1627 final boolean isTopOfTask = isTopOfTask(token);
1628 reply.writeNoException();
1629 reply.writeInt(isTopOfTask ? 1 : 0);
1630 return true;
1631 }
1632
Craig Mautner5eda9b32013-07-02 11:58:16 -07001633 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001634 data.enforceInterface(IActivityManager.descriptor);
1635 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001636 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001637 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001638 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001639 return true;
1640 }
1641
1642 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1643 data.enforceInterface(IActivityManager.descriptor);
1644 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001645 final Bundle bundle;
1646 if (data.readInt() == 0) {
1647 bundle = null;
1648 } else {
1649 bundle = data.readBundle();
1650 }
1651 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1652 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001653 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001654 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001655 return true;
1656 }
1657
Craig Mautner233ceee2014-05-09 17:05:11 -07001658 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1659 data.enforceInterface(IActivityManager.descriptor);
1660 IBinder token = data.readStrongBinder();
1661 final ActivityOptions options = getActivityOptions(token);
1662 reply.writeNoException();
1663 reply.writeBundle(options == null ? null : options.toBundle());
1664 return true;
1665 }
1666
Daniel Sandler69a48172010-06-23 16:29:36 -04001667 case SET_IMMERSIVE_TRANSACTION: {
1668 data.enforceInterface(IActivityManager.descriptor);
1669 IBinder token = data.readStrongBinder();
1670 boolean imm = data.readInt() == 1;
1671 setImmersive(token, imm);
1672 reply.writeNoException();
1673 return true;
1674 }
1675
1676 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1677 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001678 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001679 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001680 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001681 return true;
1682 }
1683
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001684 case CRASH_APPLICATION_TRANSACTION: {
1685 data.enforceInterface(IActivityManager.descriptor);
1686 int uid = data.readInt();
1687 int initialPid = data.readInt();
1688 String packageName = data.readString();
1689 String message = data.readString();
1690 crashApplication(uid, initialPid, packageName, message);
1691 reply.writeNoException();
1692 return true;
1693 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001694
1695 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1696 data.enforceInterface(IActivityManager.descriptor);
1697 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001698 int userId = data.readInt();
1699 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001700 reply.writeNoException();
1701 reply.writeString(type);
1702 return true;
1703 }
1704
Dianne Hackborn7e269642010-08-25 19:50:20 -07001705 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1706 data.enforceInterface(IActivityManager.descriptor);
1707 String name = data.readString();
1708 IBinder perm = newUriPermissionOwner(name);
1709 reply.writeNoException();
1710 reply.writeStrongBinder(perm);
1711 return true;
1712 }
1713
1714 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1715 data.enforceInterface(IActivityManager.descriptor);
1716 IBinder owner = data.readStrongBinder();
1717 int fromUid = data.readInt();
1718 String targetPkg = data.readString();
1719 Uri uri = Uri.CREATOR.createFromParcel(data);
1720 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001721 int sourceUserId = data.readInt();
1722 int targetUserId = data.readInt();
1723 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1724 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001725 reply.writeNoException();
1726 return true;
1727 }
1728
1729 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1730 data.enforceInterface(IActivityManager.descriptor);
1731 IBinder owner = data.readStrongBinder();
1732 Uri uri = null;
1733 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001734 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001735 }
1736 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001737 int userId = data.readInt();
1738 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001739 reply.writeNoException();
1740 return true;
1741 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001742
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001743 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1744 data.enforceInterface(IActivityManager.descriptor);
1745 int callingUid = data.readInt();
1746 String targetPkg = data.readString();
1747 Uri uri = Uri.CREATOR.createFromParcel(data);
1748 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001749 int userId = data.readInt();
1750 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001751 reply.writeNoException();
1752 reply.writeInt(res);
1753 return true;
1754 }
1755
Andy McFadden824c5102010-07-09 16:26:57 -07001756 case DUMP_HEAP_TRANSACTION: {
1757 data.enforceInterface(IActivityManager.descriptor);
1758 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001759 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001760 boolean managed = data.readInt() != 0;
1761 String path = data.readString();
1762 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001763 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001764 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001765 reply.writeNoException();
1766 reply.writeInt(res ? 1 : 0);
1767 return true;
1768 }
1769
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001770 case START_ACTIVITIES_TRANSACTION:
1771 {
1772 data.enforceInterface(IActivityManager.descriptor);
1773 IBinder b = data.readStrongBinder();
1774 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001775 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001776 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1777 String[] resolvedTypes = data.createStringArray();
1778 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001779 Bundle options = data.readInt() != 0
1780 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001781 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001782 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001783 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001784 reply.writeNoException();
1785 reply.writeInt(result);
1786 return true;
1787 }
1788
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001789 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1790 {
1791 data.enforceInterface(IActivityManager.descriptor);
1792 int mode = getFrontActivityScreenCompatMode();
1793 reply.writeNoException();
1794 reply.writeInt(mode);
1795 return true;
1796 }
1797
1798 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1799 {
1800 data.enforceInterface(IActivityManager.descriptor);
1801 int mode = data.readInt();
1802 setFrontActivityScreenCompatMode(mode);
1803 reply.writeNoException();
1804 reply.writeInt(mode);
1805 return true;
1806 }
1807
1808 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1809 {
1810 data.enforceInterface(IActivityManager.descriptor);
1811 String pkg = data.readString();
1812 int mode = getPackageScreenCompatMode(pkg);
1813 reply.writeNoException();
1814 reply.writeInt(mode);
1815 return true;
1816 }
1817
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001818 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1819 {
1820 data.enforceInterface(IActivityManager.descriptor);
1821 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001822 int mode = data.readInt();
1823 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001824 reply.writeNoException();
1825 return true;
1826 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001827
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001828 case SWITCH_USER_TRANSACTION: {
1829 data.enforceInterface(IActivityManager.descriptor);
1830 int userid = data.readInt();
1831 boolean result = switchUser(userid);
1832 reply.writeNoException();
1833 reply.writeInt(result ? 1 : 0);
1834 return true;
1835 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001836
Kenny Guy08488bf2014-02-21 17:40:37 +00001837 case START_USER_IN_BACKGROUND_TRANSACTION: {
1838 data.enforceInterface(IActivityManager.descriptor);
1839 int userid = data.readInt();
1840 boolean result = startUserInBackground(userid);
1841 reply.writeNoException();
1842 reply.writeInt(result ? 1 : 0);
1843 return true;
1844 }
1845
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001846 case STOP_USER_TRANSACTION: {
1847 data.enforceInterface(IActivityManager.descriptor);
1848 int userid = data.readInt();
1849 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1850 data.readStrongBinder());
1851 int result = stopUser(userid, callback);
1852 reply.writeNoException();
1853 reply.writeInt(result);
1854 return true;
1855 }
1856
Amith Yamasani52f1d752012-03-28 18:19:29 -07001857 case GET_CURRENT_USER_TRANSACTION: {
1858 data.enforceInterface(IActivityManager.descriptor);
1859 UserInfo userInfo = getCurrentUser();
1860 reply.writeNoException();
1861 userInfo.writeToParcel(reply, 0);
1862 return true;
1863 }
1864
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001865 case IS_USER_RUNNING_TRANSACTION: {
1866 data.enforceInterface(IActivityManager.descriptor);
1867 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001868 boolean orStopping = data.readInt() != 0;
1869 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001870 reply.writeNoException();
1871 reply.writeInt(result ? 1 : 0);
1872 return true;
1873 }
1874
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001875 case GET_RUNNING_USER_IDS_TRANSACTION: {
1876 data.enforceInterface(IActivityManager.descriptor);
1877 int[] result = getRunningUserIds();
1878 reply.writeNoException();
1879 reply.writeIntArray(result);
1880 return true;
1881 }
1882
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001883 case REMOVE_TASK_TRANSACTION:
1884 {
1885 data.enforceInterface(IActivityManager.descriptor);
1886 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001887 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001888 reply.writeNoException();
1889 reply.writeInt(result ? 1 : 0);
1890 return true;
1891 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001892
Jeff Sharkeya4620792011-05-20 15:29:23 -07001893 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1894 data.enforceInterface(IActivityManager.descriptor);
1895 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1896 data.readStrongBinder());
1897 registerProcessObserver(observer);
1898 return true;
1899 }
1900
1901 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1902 data.enforceInterface(IActivityManager.descriptor);
1903 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1904 data.readStrongBinder());
1905 unregisterProcessObserver(observer);
1906 return true;
1907 }
1908
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001909 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1910 {
1911 data.enforceInterface(IActivityManager.descriptor);
1912 String pkg = data.readString();
1913 boolean ask = getPackageAskScreenCompat(pkg);
1914 reply.writeNoException();
1915 reply.writeInt(ask ? 1 : 0);
1916 return true;
1917 }
1918
1919 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1920 {
1921 data.enforceInterface(IActivityManager.descriptor);
1922 String pkg = data.readString();
1923 boolean ask = data.readInt() != 0;
1924 setPackageAskScreenCompat(pkg, ask);
1925 reply.writeNoException();
1926 return true;
1927 }
1928
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001929 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1930 data.enforceInterface(IActivityManager.descriptor);
1931 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07001932 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001933 boolean res = isIntentSenderTargetedToPackage(r);
1934 reply.writeNoException();
1935 reply.writeInt(res ? 1 : 0);
1936 return true;
1937 }
1938
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001939 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1940 data.enforceInterface(IActivityManager.descriptor);
1941 IIntentSender r = IIntentSender.Stub.asInterface(
1942 data.readStrongBinder());
1943 boolean res = isIntentSenderAnActivity(r);
1944 reply.writeNoException();
1945 reply.writeInt(res ? 1 : 0);
1946 return true;
1947 }
1948
Dianne Hackborn81038902012-11-26 17:04:09 -08001949 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1950 data.enforceInterface(IActivityManager.descriptor);
1951 IIntentSender r = IIntentSender.Stub.asInterface(
1952 data.readStrongBinder());
1953 Intent intent = getIntentForIntentSender(r);
1954 reply.writeNoException();
1955 if (intent != null) {
1956 reply.writeInt(1);
1957 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1958 } else {
1959 reply.writeInt(0);
1960 }
1961 return true;
1962 }
1963
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001964 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1965 data.enforceInterface(IActivityManager.descriptor);
1966 IIntentSender r = IIntentSender.Stub.asInterface(
1967 data.readStrongBinder());
1968 String prefix = data.readString();
1969 String tag = getTagForIntentSender(r, prefix);
1970 reply.writeNoException();
1971 reply.writeString(tag);
1972 return true;
1973 }
1974
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001975 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1976 data.enforceInterface(IActivityManager.descriptor);
1977 Configuration config = Configuration.CREATOR.createFromParcel(data);
1978 updatePersistentConfiguration(config);
1979 reply.writeNoException();
1980 return true;
1981 }
1982
Dianne Hackbornb437e092011-08-05 17:50:29 -07001983 case GET_PROCESS_PSS_TRANSACTION: {
1984 data.enforceInterface(IActivityManager.descriptor);
1985 int[] pids = data.createIntArray();
1986 long[] pss = getProcessPss(pids);
1987 reply.writeNoException();
1988 reply.writeLongArray(pss);
1989 return true;
1990 }
1991
Dianne Hackborn661cd522011-08-22 00:26:20 -07001992 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1993 data.enforceInterface(IActivityManager.descriptor);
1994 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1995 boolean always = data.readInt() != 0;
1996 showBootMessage(msg, always);
1997 reply.writeNoException();
1998 return true;
1999 }
2000
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002001 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002002 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002003 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002004 reply.writeNoException();
2005 return true;
2006 }
2007
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002008 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002009 data.enforceInterface(IActivityManager.descriptor);
2010 IBinder token = data.readStrongBinder();
2011 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002012 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002013 reply.writeNoException();
2014 reply.writeInt(res ? 1 : 0);
2015 return true;
2016 }
2017
2018 case NAVIGATE_UP_TO_TRANSACTION: {
2019 data.enforceInterface(IActivityManager.descriptor);
2020 IBinder token = data.readStrongBinder();
2021 Intent target = Intent.CREATOR.createFromParcel(data);
2022 int resultCode = data.readInt();
2023 Intent resultData = null;
2024 if (data.readInt() != 0) {
2025 resultData = Intent.CREATOR.createFromParcel(data);
2026 }
2027 boolean res = navigateUpTo(token, target, resultCode, resultData);
2028 reply.writeNoException();
2029 reply.writeInt(res ? 1 : 0);
2030 return true;
2031 }
2032
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002033 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2034 data.enforceInterface(IActivityManager.descriptor);
2035 IBinder token = data.readStrongBinder();
2036 int res = getLaunchedFromUid(token);
2037 reply.writeNoException();
2038 reply.writeInt(res);
2039 return true;
2040 }
2041
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002042 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2043 data.enforceInterface(IActivityManager.descriptor);
2044 IBinder token = data.readStrongBinder();
2045 String res = getLaunchedFromPackage(token);
2046 reply.writeNoException();
2047 reply.writeString(res);
2048 return true;
2049 }
2050
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002051 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2052 data.enforceInterface(IActivityManager.descriptor);
2053 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2054 data.readStrongBinder());
2055 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002056 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002057 return true;
2058 }
2059
2060 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2061 data.enforceInterface(IActivityManager.descriptor);
2062 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2063 data.readStrongBinder());
2064 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002065 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002066 return true;
2067 }
2068
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002069 case REQUEST_BUG_REPORT_TRANSACTION: {
2070 data.enforceInterface(IActivityManager.descriptor);
2071 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002072 reply.writeNoException();
2073 return true;
2074 }
2075
2076 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2077 data.enforceInterface(IActivityManager.descriptor);
2078 int pid = data.readInt();
2079 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002080 String reason = data.readString();
2081 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002082 reply.writeNoException();
2083 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002084 return true;
2085 }
2086
Adam Skorydfc7fd72013-08-05 19:23:41 -07002087 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002088 data.enforceInterface(IActivityManager.descriptor);
2089 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002090 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002091 reply.writeNoException();
2092 reply.writeBundle(res);
2093 return true;
2094 }
2095
Adam Skorydfc7fd72013-08-05 19:23:41 -07002096 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002097 data.enforceInterface(IActivityManager.descriptor);
2098 IBinder token = data.readStrongBinder();
2099 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002100 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002101 reply.writeNoException();
2102 return true;
2103 }
2104
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002105 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2106 data.enforceInterface(IActivityManager.descriptor);
2107 Intent intent = Intent.CREATOR.createFromParcel(data);
2108 int requestType = data.readInt();
2109 String hint = data.readString();
2110 int userHandle = data.readInt();
2111 boolean res = launchAssistIntent(intent, requestType, hint, userHandle);
2112 reply.writeNoException();
2113 reply.writeInt(res ? 1 : 0);
2114 return true;
2115 }
2116
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002117 case KILL_UID_TRANSACTION: {
2118 data.enforceInterface(IActivityManager.descriptor);
2119 int uid = data.readInt();
2120 String reason = data.readString();
2121 killUid(uid, reason);
2122 reply.writeNoException();
2123 return true;
2124 }
2125
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002126 case HANG_TRANSACTION: {
2127 data.enforceInterface(IActivityManager.descriptor);
2128 IBinder who = data.readStrongBinder();
2129 boolean allowRestart = data.readInt() != 0;
2130 hang(who, allowRestart);
2131 reply.writeNoException();
2132 return true;
2133 }
2134
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002135 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2136 data.enforceInterface(IActivityManager.descriptor);
2137 IBinder token = data.readStrongBinder();
2138 reportActivityFullyDrawn(token);
2139 reply.writeNoException();
2140 return true;
2141 }
2142
Craig Mautner5eda9b32013-07-02 11:58:16 -07002143 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2144 data.enforceInterface(IActivityManager.descriptor);
2145 IBinder token = data.readStrongBinder();
2146 notifyActivityDrawn(token);
2147 reply.writeNoException();
2148 return true;
2149 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002150
2151 case RESTART_TRANSACTION: {
2152 data.enforceInterface(IActivityManager.descriptor);
2153 restart();
2154 reply.writeNoException();
2155 return true;
2156 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002157
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002158 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2159 data.enforceInterface(IActivityManager.descriptor);
2160 performIdleMaintenance();
2161 reply.writeNoException();
2162 return true;
2163 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002164
2165 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2166 data.enforceInterface(IActivityManager.descriptor);
2167 IBinder parentActivityToken = data.readStrongBinder();
2168 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002169 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002170 IActivityContainer activityContainer =
2171 createActivityContainer(parentActivityToken, callback);
2172 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002173 if (activityContainer != null) {
2174 reply.writeInt(1);
2175 reply.writeStrongBinder(activityContainer.asBinder());
2176 } else {
2177 reply.writeInt(0);
2178 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002179 return true;
2180 }
2181
Craig Mautner95da1082014-02-24 17:54:35 -08002182 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2183 data.enforceInterface(IActivityManager.descriptor);
2184 IActivityContainer activityContainer =
2185 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2186 deleteActivityContainer(activityContainer);
2187 reply.writeNoException();
2188 return true;
2189 }
2190
Craig Mautnere0a38842013-12-16 16:14:02 -08002191 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2192 data.enforceInterface(IActivityManager.descriptor);
2193 IBinder activityToken = data.readStrongBinder();
2194 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2195 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002196 if (activityContainer != null) {
2197 reply.writeInt(1);
2198 reply.writeStrongBinder(activityContainer.asBinder());
2199 } else {
2200 reply.writeInt(0);
2201 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002202 return true;
2203 }
2204
Craig Mautner4a1cb222013-12-04 16:14:06 -08002205 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2206 data.enforceInterface(IActivityManager.descriptor);
2207 IBinder homeActivityToken = getHomeActivityToken();
2208 reply.writeNoException();
2209 reply.writeStrongBinder(homeActivityToken);
2210 return true;
2211 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002212
2213 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2214 data.enforceInterface(IActivityManager.descriptor);
2215 final int taskId = data.readInt();
2216 startLockTaskMode(taskId);
2217 reply.writeNoException();
2218 return true;
2219 }
2220
2221 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2222 data.enforceInterface(IActivityManager.descriptor);
2223 IBinder token = data.readStrongBinder();
2224 startLockTaskMode(token);
2225 reply.writeNoException();
2226 return true;
2227 }
2228
Craig Mautnerd61dc202014-07-07 11:09:11 -07002229 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002230 data.enforceInterface(IActivityManager.descriptor);
2231 startLockTaskModeOnCurrent();
2232 reply.writeNoException();
2233 return true;
2234 }
2235
Craig Mautneraea74a52014-03-08 14:23:10 -08002236 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2237 data.enforceInterface(IActivityManager.descriptor);
2238 stopLockTaskMode();
2239 reply.writeNoException();
2240 return true;
2241 }
2242
Craig Mautnerd61dc202014-07-07 11:09:11 -07002243 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002244 data.enforceInterface(IActivityManager.descriptor);
2245 stopLockTaskModeOnCurrent();
2246 reply.writeNoException();
2247 return true;
2248 }
2249
Craig Mautneraea74a52014-03-08 14:23:10 -08002250 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2251 data.enforceInterface(IActivityManager.descriptor);
2252 final boolean isInLockTaskMode = isInLockTaskMode();
2253 reply.writeNoException();
2254 reply.writeInt(isInLockTaskMode ? 1 : 0);
2255 return true;
2256 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002257
Winson Chunga449dc02014-05-16 11:15:04 -07002258 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002259 data.enforceInterface(IActivityManager.descriptor);
2260 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002261 ActivityManager.TaskDescription values =
2262 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2263 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002264 reply.writeNoException();
2265 return true;
2266 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002267
Craig Mautner648f69b2014-09-18 14:16:26 -07002268 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2269 data.enforceInterface(IActivityManager.descriptor);
2270 String filename = data.readString();
2271 Bitmap icon = getTaskDescriptionIcon(filename);
2272 reply.writeNoException();
2273 if (icon == null) {
2274 reply.writeInt(0);
2275 } else {
2276 reply.writeInt(1);
2277 icon.writeToParcel(reply, 0);
2278 }
2279 return true;
2280 }
2281
Winson Chung044d5292014-11-06 11:05:19 -08002282 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2283 data.enforceInterface(IActivityManager.descriptor);
2284 final Bundle bundle;
2285 if (data.readInt() == 0) {
2286 bundle = null;
2287 } else {
2288 bundle = data.readBundle();
2289 }
2290 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2291 startInPlaceAnimationOnFrontMostApplication(options);
2292 reply.writeNoException();
2293 return true;
2294 }
2295
Jose Lima4b6c6692014-08-12 17:41:12 -07002296 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002297 data.enforceInterface(IActivityManager.descriptor);
2298 IBinder token = data.readStrongBinder();
2299 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002300 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002301 reply.writeNoException();
2302 reply.writeInt(success ? 1 : 0);
2303 return true;
2304 }
2305
Jose Lima4b6c6692014-08-12 17:41:12 -07002306 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002307 data.enforceInterface(IActivityManager.descriptor);
2308 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002309 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002310 reply.writeNoException();
2311 reply.writeInt(enabled ? 1 : 0);
2312 return true;
2313 }
2314
Jose Lima4b6c6692014-08-12 17:41:12 -07002315 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002316 data.enforceInterface(IActivityManager.descriptor);
2317 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002318 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002319 reply.writeNoException();
2320 return true;
2321 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002322
2323 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2324 data.enforceInterface(IActivityManager.descriptor);
2325 IBinder token = data.readStrongBinder();
2326 notifyLaunchTaskBehindComplete(token);
2327 reply.writeNoException();
2328 return true;
2329 }
Craig Mautner8746a472014-07-24 15:12:54 -07002330
2331 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2332 data.enforceInterface(IActivityManager.descriptor);
2333 IBinder token = data.readStrongBinder();
2334 notifyEnterAnimationComplete(token);
2335 reply.writeNoException();
2336 return true;
2337 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002338
2339 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2340 data.enforceInterface(IActivityManager.descriptor);
2341 bootAnimationComplete();
2342 reply.writeNoException();
2343 return true;
2344 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002345 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002346
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002347 return super.onTransact(code, data, reply, flags);
2348 }
2349
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002350 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002351 return this;
2352 }
2353
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002354 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2355 protected IActivityManager create() {
2356 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002357 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002358 Log.v("ActivityManager", "default service binder = " + b);
2359 }
2360 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002361 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002362 Log.v("ActivityManager", "default service = " + am);
2363 }
2364 return am;
2365 }
2366 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002367}
2368
2369class ActivityManagerProxy implements IActivityManager
2370{
2371 public ActivityManagerProxy(IBinder remote)
2372 {
2373 mRemote = remote;
2374 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002375
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002376 public IBinder asBinder()
2377 {
2378 return mRemote;
2379 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002380
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002381 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002382 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002383 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002384 Parcel data = Parcel.obtain();
2385 Parcel reply = Parcel.obtain();
2386 data.writeInterfaceToken(IActivityManager.descriptor);
2387 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002388 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002389 intent.writeToParcel(data, 0);
2390 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002391 data.writeStrongBinder(resultTo);
2392 data.writeString(resultWho);
2393 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002394 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002395 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002396 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002397 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002398 } else {
2399 data.writeInt(0);
2400 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002401 if (options != null) {
2402 data.writeInt(1);
2403 options.writeToParcel(data, 0);
2404 } else {
2405 data.writeInt(0);
2406 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002407 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2408 reply.readException();
2409 int result = reply.readInt();
2410 reply.recycle();
2411 data.recycle();
2412 return result;
2413 }
Amith Yamasani82644082012-08-03 13:09:11 -07002414
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002415 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002416 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002417 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2418 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002419 Parcel data = Parcel.obtain();
2420 Parcel reply = Parcel.obtain();
2421 data.writeInterfaceToken(IActivityManager.descriptor);
2422 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002423 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002424 intent.writeToParcel(data, 0);
2425 data.writeString(resolvedType);
2426 data.writeStrongBinder(resultTo);
2427 data.writeString(resultWho);
2428 data.writeInt(requestCode);
2429 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002430 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002431 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002432 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002433 } else {
2434 data.writeInt(0);
2435 }
2436 if (options != null) {
2437 data.writeInt(1);
2438 options.writeToParcel(data, 0);
2439 } else {
2440 data.writeInt(0);
2441 }
2442 data.writeInt(userId);
2443 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2444 reply.readException();
2445 int result = reply.readInt();
2446 reply.recycle();
2447 data.recycle();
2448 return result;
2449 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002450 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2451 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002452 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002453 Parcel data = Parcel.obtain();
2454 Parcel reply = Parcel.obtain();
2455 data.writeInterfaceToken(IActivityManager.descriptor);
2456 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2457 data.writeString(callingPackage);
2458 intent.writeToParcel(data, 0);
2459 data.writeString(resolvedType);
2460 data.writeStrongBinder(resultTo);
2461 data.writeString(resultWho);
2462 data.writeInt(requestCode);
2463 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002464 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002465 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002466 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002467 } else {
2468 data.writeInt(0);
2469 }
2470 if (options != null) {
2471 data.writeInt(1);
2472 options.writeToParcel(data, 0);
2473 } else {
2474 data.writeInt(0);
2475 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002476 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002477 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2478 reply.readException();
2479 int result = reply.readInt();
2480 reply.recycle();
2481 data.recycle();
2482 return result;
2483 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002484 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2485 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002486 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2487 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002488 Parcel data = Parcel.obtain();
2489 Parcel reply = Parcel.obtain();
2490 data.writeInterfaceToken(IActivityManager.descriptor);
2491 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002492 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002493 intent.writeToParcel(data, 0);
2494 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002495 data.writeStrongBinder(resultTo);
2496 data.writeString(resultWho);
2497 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002498 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002499 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002500 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002501 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002502 } else {
2503 data.writeInt(0);
2504 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002505 if (options != null) {
2506 data.writeInt(1);
2507 options.writeToParcel(data, 0);
2508 } else {
2509 data.writeInt(0);
2510 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002511 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002512 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2513 reply.readException();
2514 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2515 reply.recycle();
2516 data.recycle();
2517 return result;
2518 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002519 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2520 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002521 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002522 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002523 Parcel data = Parcel.obtain();
2524 Parcel reply = Parcel.obtain();
2525 data.writeInterfaceToken(IActivityManager.descriptor);
2526 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002527 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002528 intent.writeToParcel(data, 0);
2529 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002530 data.writeStrongBinder(resultTo);
2531 data.writeString(resultWho);
2532 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002533 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002534 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002535 if (options != null) {
2536 data.writeInt(1);
2537 options.writeToParcel(data, 0);
2538 } else {
2539 data.writeInt(0);
2540 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002541 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002542 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2543 reply.readException();
2544 int result = reply.readInt();
2545 reply.recycle();
2546 data.recycle();
2547 return result;
2548 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002549 public int startActivityIntentSender(IApplicationThread caller,
2550 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002551 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002552 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002553 Parcel data = Parcel.obtain();
2554 Parcel reply = Parcel.obtain();
2555 data.writeInterfaceToken(IActivityManager.descriptor);
2556 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2557 intent.writeToParcel(data, 0);
2558 if (fillInIntent != null) {
2559 data.writeInt(1);
2560 fillInIntent.writeToParcel(data, 0);
2561 } else {
2562 data.writeInt(0);
2563 }
2564 data.writeString(resolvedType);
2565 data.writeStrongBinder(resultTo);
2566 data.writeString(resultWho);
2567 data.writeInt(requestCode);
2568 data.writeInt(flagsMask);
2569 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002570 if (options != null) {
2571 data.writeInt(1);
2572 options.writeToParcel(data, 0);
2573 } else {
2574 data.writeInt(0);
2575 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002576 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002577 reply.readException();
2578 int result = reply.readInt();
2579 reply.recycle();
2580 data.recycle();
2581 return result;
2582 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002583 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2584 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002585 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2586 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002587 Parcel data = Parcel.obtain();
2588 Parcel reply = Parcel.obtain();
2589 data.writeInterfaceToken(IActivityManager.descriptor);
2590 data.writeString(callingPackage);
2591 data.writeInt(callingPid);
2592 data.writeInt(callingUid);
2593 intent.writeToParcel(data, 0);
2594 data.writeString(resolvedType);
2595 data.writeStrongBinder(session.asBinder());
2596 data.writeStrongBinder(interactor.asBinder());
2597 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002598 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002599 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002600 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002601 } else {
2602 data.writeInt(0);
2603 }
2604 if (options != null) {
2605 data.writeInt(1);
2606 options.writeToParcel(data, 0);
2607 } else {
2608 data.writeInt(0);
2609 }
2610 data.writeInt(userId);
2611 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2612 reply.readException();
2613 int result = reply.readInt();
2614 reply.recycle();
2615 data.recycle();
2616 return result;
2617 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002618 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002619 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002620 Parcel data = Parcel.obtain();
2621 Parcel reply = Parcel.obtain();
2622 data.writeInterfaceToken(IActivityManager.descriptor);
2623 data.writeStrongBinder(callingActivity);
2624 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002625 if (options != null) {
2626 data.writeInt(1);
2627 options.writeToParcel(data, 0);
2628 } else {
2629 data.writeInt(0);
2630 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002631 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2632 reply.readException();
2633 int result = reply.readInt();
2634 reply.recycle();
2635 data.recycle();
2636 return result != 0;
2637 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002638 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2639 Parcel data = Parcel.obtain();
2640 Parcel reply = Parcel.obtain();
2641 data.writeInterfaceToken(IActivityManager.descriptor);
2642 data.writeInt(taskId);
2643 if (options == null) {
2644 data.writeInt(0);
2645 } else {
2646 data.writeInt(1);
2647 options.writeToParcel(data, 0);
2648 }
2649 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2650 reply.readException();
2651 int result = reply.readInt();
2652 reply.recycle();
2653 data.recycle();
2654 return result;
2655 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002656 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002657 throws RemoteException {
2658 Parcel data = Parcel.obtain();
2659 Parcel reply = Parcel.obtain();
2660 data.writeInterfaceToken(IActivityManager.descriptor);
2661 data.writeStrongBinder(token);
2662 data.writeInt(resultCode);
2663 if (resultData != null) {
2664 data.writeInt(1);
2665 resultData.writeToParcel(data, 0);
2666 } else {
2667 data.writeInt(0);
2668 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002669 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002670 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2671 reply.readException();
2672 boolean res = reply.readInt() != 0;
2673 data.recycle();
2674 reply.recycle();
2675 return res;
2676 }
2677 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2678 {
2679 Parcel data = Parcel.obtain();
2680 Parcel reply = Parcel.obtain();
2681 data.writeInterfaceToken(IActivityManager.descriptor);
2682 data.writeStrongBinder(token);
2683 data.writeString(resultWho);
2684 data.writeInt(requestCode);
2685 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2686 reply.readException();
2687 data.recycle();
2688 reply.recycle();
2689 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002690 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2691 Parcel data = Parcel.obtain();
2692 Parcel reply = Parcel.obtain();
2693 data.writeInterfaceToken(IActivityManager.descriptor);
2694 data.writeStrongBinder(token);
2695 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2696 reply.readException();
2697 boolean res = reply.readInt() != 0;
2698 data.recycle();
2699 reply.recycle();
2700 return res;
2701 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002702 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2703 Parcel data = Parcel.obtain();
2704 Parcel reply = Parcel.obtain();
2705 data.writeInterfaceToken(IActivityManager.descriptor);
2706 data.writeStrongBinder(session.asBinder());
2707 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2708 reply.readException();
2709 data.recycle();
2710 reply.recycle();
2711 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002712 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2713 Parcel data = Parcel.obtain();
2714 Parcel reply = Parcel.obtain();
2715 data.writeInterfaceToken(IActivityManager.descriptor);
2716 data.writeStrongBinder(token);
2717 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2718 reply.readException();
2719 boolean res = reply.readInt() != 0;
2720 data.recycle();
2721 reply.recycle();
2722 return res;
2723 }
2724 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2725 Parcel data = Parcel.obtain();
2726 Parcel reply = Parcel.obtain();
2727 data.writeInterfaceToken(IActivityManager.descriptor);
2728 data.writeStrongBinder(app.asBinder());
2729 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2730 reply.readException();
2731 data.recycle();
2732 reply.recycle();
2733 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002734 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2735 Parcel data = Parcel.obtain();
2736 Parcel reply = Parcel.obtain();
2737 data.writeInterfaceToken(IActivityManager.descriptor);
2738 data.writeStrongBinder(token);
2739 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2740 reply.readException();
2741 boolean res = reply.readInt() != 0;
2742 data.recycle();
2743 reply.recycle();
2744 return res;
2745 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002746 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002747 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002748 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002749 {
2750 Parcel data = Parcel.obtain();
2751 Parcel reply = Parcel.obtain();
2752 data.writeInterfaceToken(IActivityManager.descriptor);
2753 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002754 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002755 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2756 filter.writeToParcel(data, 0);
2757 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002758 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002759 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2760 reply.readException();
2761 Intent intent = null;
2762 int haveIntent = reply.readInt();
2763 if (haveIntent != 0) {
2764 intent = Intent.CREATOR.createFromParcel(reply);
2765 }
2766 reply.recycle();
2767 data.recycle();
2768 return intent;
2769 }
2770 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2771 {
2772 Parcel data = Parcel.obtain();
2773 Parcel reply = Parcel.obtain();
2774 data.writeInterfaceToken(IActivityManager.descriptor);
2775 data.writeStrongBinder(receiver.asBinder());
2776 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2777 reply.readException();
2778 data.recycle();
2779 reply.recycle();
2780 }
2781 public int broadcastIntent(IApplicationThread caller,
2782 Intent intent, String resolvedType, IIntentReceiver resultTo,
2783 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002784 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002785 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002786 {
2787 Parcel data = Parcel.obtain();
2788 Parcel reply = Parcel.obtain();
2789 data.writeInterfaceToken(IActivityManager.descriptor);
2790 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2791 intent.writeToParcel(data, 0);
2792 data.writeString(resolvedType);
2793 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2794 data.writeInt(resultCode);
2795 data.writeString(resultData);
2796 data.writeBundle(map);
2797 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002798 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002799 data.writeInt(serialized ? 1 : 0);
2800 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002801 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002802 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2803 reply.readException();
2804 int res = reply.readInt();
2805 reply.recycle();
2806 data.recycle();
2807 return res;
2808 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002809 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2810 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002811 {
2812 Parcel data = Parcel.obtain();
2813 Parcel reply = Parcel.obtain();
2814 data.writeInterfaceToken(IActivityManager.descriptor);
2815 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2816 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002817 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002818 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2819 reply.readException();
2820 data.recycle();
2821 reply.recycle();
2822 }
2823 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2824 {
2825 Parcel data = Parcel.obtain();
2826 Parcel reply = Parcel.obtain();
2827 data.writeInterfaceToken(IActivityManager.descriptor);
2828 data.writeStrongBinder(who);
2829 data.writeInt(resultCode);
2830 data.writeString(resultData);
2831 data.writeBundle(map);
2832 data.writeInt(abortBroadcast ? 1 : 0);
2833 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2834 reply.readException();
2835 data.recycle();
2836 reply.recycle();
2837 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002838 public void attachApplication(IApplicationThread app) throws RemoteException
2839 {
2840 Parcel data = Parcel.obtain();
2841 Parcel reply = Parcel.obtain();
2842 data.writeInterfaceToken(IActivityManager.descriptor);
2843 data.writeStrongBinder(app.asBinder());
2844 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2845 reply.readException();
2846 data.recycle();
2847 reply.recycle();
2848 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002849 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2850 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002851 {
2852 Parcel data = Parcel.obtain();
2853 Parcel reply = Parcel.obtain();
2854 data.writeInterfaceToken(IActivityManager.descriptor);
2855 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002856 if (config != null) {
2857 data.writeInt(1);
2858 config.writeToParcel(data, 0);
2859 } else {
2860 data.writeInt(0);
2861 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002862 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002863 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2864 reply.readException();
2865 data.recycle();
2866 reply.recycle();
2867 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002868 public void activityResumed(IBinder token) throws RemoteException
2869 {
2870 Parcel data = Parcel.obtain();
2871 Parcel reply = Parcel.obtain();
2872 data.writeInterfaceToken(IActivityManager.descriptor);
2873 data.writeStrongBinder(token);
2874 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2875 reply.readException();
2876 data.recycle();
2877 reply.recycle();
2878 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07002879 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002880 {
2881 Parcel data = Parcel.obtain();
2882 Parcel reply = Parcel.obtain();
2883 data.writeInterfaceToken(IActivityManager.descriptor);
2884 data.writeStrongBinder(token);
2885 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2886 reply.readException();
2887 data.recycle();
2888 reply.recycle();
2889 }
2890 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002891 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002892 {
2893 Parcel data = Parcel.obtain();
2894 Parcel reply = Parcel.obtain();
2895 data.writeInterfaceToken(IActivityManager.descriptor);
2896 data.writeStrongBinder(token);
2897 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002898 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002899 TextUtils.writeToParcel(description, data, 0);
2900 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2901 reply.readException();
2902 data.recycle();
2903 reply.recycle();
2904 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002905 public void activitySlept(IBinder token) throws RemoteException
2906 {
2907 Parcel data = Parcel.obtain();
2908 Parcel reply = Parcel.obtain();
2909 data.writeInterfaceToken(IActivityManager.descriptor);
2910 data.writeStrongBinder(token);
2911 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2912 reply.readException();
2913 data.recycle();
2914 reply.recycle();
2915 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002916 public void activityDestroyed(IBinder token) throws RemoteException
2917 {
2918 Parcel data = Parcel.obtain();
2919 Parcel reply = Parcel.obtain();
2920 data.writeInterfaceToken(IActivityManager.descriptor);
2921 data.writeStrongBinder(token);
2922 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2923 reply.readException();
2924 data.recycle();
2925 reply.recycle();
2926 }
2927 public String getCallingPackage(IBinder token) throws RemoteException
2928 {
2929 Parcel data = Parcel.obtain();
2930 Parcel reply = Parcel.obtain();
2931 data.writeInterfaceToken(IActivityManager.descriptor);
2932 data.writeStrongBinder(token);
2933 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2934 reply.readException();
2935 String res = reply.readString();
2936 data.recycle();
2937 reply.recycle();
2938 return res;
2939 }
2940 public ComponentName getCallingActivity(IBinder token)
2941 throws RemoteException {
2942 Parcel data = Parcel.obtain();
2943 Parcel reply = Parcel.obtain();
2944 data.writeInterfaceToken(IActivityManager.descriptor);
2945 data.writeStrongBinder(token);
2946 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2947 reply.readException();
2948 ComponentName res = ComponentName.readFromParcel(reply);
2949 data.recycle();
2950 reply.recycle();
2951 return res;
2952 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002953 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07002954 Parcel data = Parcel.obtain();
2955 Parcel reply = Parcel.obtain();
2956 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002957 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07002958 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2959 reply.readException();
2960 ArrayList<IAppTask> list = null;
2961 int N = reply.readInt();
2962 if (N >= 0) {
2963 list = new ArrayList<IAppTask>();
2964 while (N > 0) {
2965 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2966 list.add(task);
2967 N--;
2968 }
2969 }
2970 data.recycle();
2971 reply.recycle();
2972 return list;
2973 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07002974 public int addAppTask(IBinder activityToken, Intent intent,
2975 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
2976 Parcel data = Parcel.obtain();
2977 Parcel reply = Parcel.obtain();
2978 data.writeInterfaceToken(IActivityManager.descriptor);
2979 data.writeStrongBinder(activityToken);
2980 intent.writeToParcel(data, 0);
2981 description.writeToParcel(data, 0);
2982 thumbnail.writeToParcel(data, 0);
2983 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
2984 reply.readException();
2985 int res = reply.readInt();
2986 data.recycle();
2987 reply.recycle();
2988 return res;
2989 }
2990 public Point getAppTaskThumbnailSize() throws RemoteException {
2991 Parcel data = Parcel.obtain();
2992 Parcel reply = Parcel.obtain();
2993 data.writeInterfaceToken(IActivityManager.descriptor);
2994 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
2995 reply.readException();
2996 Point size = Point.CREATOR.createFromParcel(reply);
2997 data.recycle();
2998 reply.recycle();
2999 return size;
3000 }
Dianne Hackborn09233282014-04-30 11:33:59 -07003001 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003002 Parcel data = Parcel.obtain();
3003 Parcel reply = Parcel.obtain();
3004 data.writeInterfaceToken(IActivityManager.descriptor);
3005 data.writeInt(maxNum);
3006 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003007 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3008 reply.readException();
3009 ArrayList list = null;
3010 int N = reply.readInt();
3011 if (N >= 0) {
3012 list = new ArrayList();
3013 while (N > 0) {
3014 ActivityManager.RunningTaskInfo info =
3015 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003016 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003017 list.add(info);
3018 N--;
3019 }
3020 }
3021 data.recycle();
3022 reply.recycle();
3023 return list;
3024 }
3025 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003026 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003027 Parcel data = Parcel.obtain();
3028 Parcel reply = Parcel.obtain();
3029 data.writeInterfaceToken(IActivityManager.descriptor);
3030 data.writeInt(maxNum);
3031 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003032 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003033 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3034 reply.readException();
3035 ArrayList<ActivityManager.RecentTaskInfo> list
3036 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3037 data.recycle();
3038 reply.recycle();
3039 return list;
3040 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003041 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003042 Parcel data = Parcel.obtain();
3043 Parcel reply = Parcel.obtain();
3044 data.writeInterfaceToken(IActivityManager.descriptor);
3045 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003046 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003047 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003048 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003049 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003050 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003051 }
3052 data.recycle();
3053 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003054 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003055 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003056 public List getServices(int maxNum, int flags) throws RemoteException {
3057 Parcel data = Parcel.obtain();
3058 Parcel reply = Parcel.obtain();
3059 data.writeInterfaceToken(IActivityManager.descriptor);
3060 data.writeInt(maxNum);
3061 data.writeInt(flags);
3062 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3063 reply.readException();
3064 ArrayList list = null;
3065 int N = reply.readInt();
3066 if (N >= 0) {
3067 list = new ArrayList();
3068 while (N > 0) {
3069 ActivityManager.RunningServiceInfo info =
3070 ActivityManager.RunningServiceInfo.CREATOR
3071 .createFromParcel(reply);
3072 list.add(info);
3073 N--;
3074 }
3075 }
3076 data.recycle();
3077 reply.recycle();
3078 return list;
3079 }
3080 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3081 throws RemoteException {
3082 Parcel data = Parcel.obtain();
3083 Parcel reply = Parcel.obtain();
3084 data.writeInterfaceToken(IActivityManager.descriptor);
3085 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3086 reply.readException();
3087 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3088 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3089 data.recycle();
3090 reply.recycle();
3091 return list;
3092 }
3093 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3094 throws RemoteException {
3095 Parcel data = Parcel.obtain();
3096 Parcel reply = Parcel.obtain();
3097 data.writeInterfaceToken(IActivityManager.descriptor);
3098 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3099 reply.readException();
3100 ArrayList<ActivityManager.RunningAppProcessInfo> list
3101 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3102 data.recycle();
3103 reply.recycle();
3104 return list;
3105 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003106 public List<ApplicationInfo> getRunningExternalApplications()
3107 throws RemoteException {
3108 Parcel data = Parcel.obtain();
3109 Parcel reply = Parcel.obtain();
3110 data.writeInterfaceToken(IActivityManager.descriptor);
3111 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3112 reply.readException();
3113 ArrayList<ApplicationInfo> list
3114 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3115 data.recycle();
3116 reply.recycle();
3117 return list;
3118 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003119 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003120 {
3121 Parcel data = Parcel.obtain();
3122 Parcel reply = Parcel.obtain();
3123 data.writeInterfaceToken(IActivityManager.descriptor);
3124 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003125 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003126 if (options != null) {
3127 data.writeInt(1);
3128 options.writeToParcel(data, 0);
3129 } else {
3130 data.writeInt(0);
3131 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003132 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3133 reply.readException();
3134 data.recycle();
3135 reply.recycle();
3136 }
3137 public void moveTaskToBack(int task) throws RemoteException
3138 {
3139 Parcel data = Parcel.obtain();
3140 Parcel reply = Parcel.obtain();
3141 data.writeInterfaceToken(IActivityManager.descriptor);
3142 data.writeInt(task);
3143 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3144 reply.readException();
3145 data.recycle();
3146 reply.recycle();
3147 }
3148 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3149 throws RemoteException {
3150 Parcel data = Parcel.obtain();
3151 Parcel reply = Parcel.obtain();
3152 data.writeInterfaceToken(IActivityManager.descriptor);
3153 data.writeStrongBinder(token);
3154 data.writeInt(nonRoot ? 1 : 0);
3155 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3156 reply.readException();
3157 boolean res = reply.readInt() != 0;
3158 data.recycle();
3159 reply.recycle();
3160 return res;
3161 }
3162 public void moveTaskBackwards(int task) throws RemoteException
3163 {
3164 Parcel data = Parcel.obtain();
3165 Parcel reply = Parcel.obtain();
3166 data.writeInterfaceToken(IActivityManager.descriptor);
3167 data.writeInt(task);
3168 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3169 reply.readException();
3170 data.recycle();
3171 reply.recycle();
3172 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003173 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003174 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3175 {
3176 Parcel data = Parcel.obtain();
3177 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003178 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003179 data.writeInt(taskId);
3180 data.writeInt(stackId);
3181 data.writeInt(toTop ? 1 : 0);
3182 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3183 reply.readException();
3184 data.recycle();
3185 reply.recycle();
3186 }
3187 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003188 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003189 {
3190 Parcel data = Parcel.obtain();
3191 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003192 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003193 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003194 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003195 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003196 reply.readException();
3197 data.recycle();
3198 reply.recycle();
3199 }
Craig Mautner967212c2013-04-13 21:10:58 -07003200 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003201 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003202 {
3203 Parcel data = Parcel.obtain();
3204 Parcel reply = Parcel.obtain();
3205 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003206 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003207 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003208 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003209 data.recycle();
3210 reply.recycle();
3211 return list;
3212 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003213 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003214 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003215 {
3216 Parcel data = Parcel.obtain();
3217 Parcel reply = Parcel.obtain();
3218 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003219 data.writeInt(stackId);
3220 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003221 reply.readException();
3222 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003223 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003224 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003225 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003226 }
3227 data.recycle();
3228 reply.recycle();
3229 return info;
3230 }
3231 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003232 public boolean isInHomeStack(int taskId) throws RemoteException {
3233 Parcel data = Parcel.obtain();
3234 Parcel reply = Parcel.obtain();
3235 data.writeInterfaceToken(IActivityManager.descriptor);
3236 data.writeInt(taskId);
3237 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3238 reply.readException();
3239 boolean isInHomeStack = reply.readInt() > 0;
3240 data.recycle();
3241 reply.recycle();
3242 return isInHomeStack;
3243 }
3244 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003245 public void setFocusedStack(int stackId) throws RemoteException
3246 {
3247 Parcel data = Parcel.obtain();
3248 Parcel reply = Parcel.obtain();
3249 data.writeInterfaceToken(IActivityManager.descriptor);
3250 data.writeInt(stackId);
3251 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3252 reply.readException();
3253 data.recycle();
3254 reply.recycle();
3255 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003256 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3257 {
3258 Parcel data = Parcel.obtain();
3259 Parcel reply = Parcel.obtain();
3260 data.writeInterfaceToken(IActivityManager.descriptor);
3261 data.writeStrongBinder(token);
3262 data.writeInt(onlyRoot ? 1 : 0);
3263 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3264 reply.readException();
3265 int res = reply.readInt();
3266 data.recycle();
3267 reply.recycle();
3268 return res;
3269 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003270 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003271 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003272 Parcel data = Parcel.obtain();
3273 Parcel reply = Parcel.obtain();
3274 data.writeInterfaceToken(IActivityManager.descriptor);
3275 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3276 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003277 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003278 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003279 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3280 reply.readException();
3281 int res = reply.readInt();
3282 ContentProviderHolder cph = null;
3283 if (res != 0) {
3284 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3285 }
3286 data.recycle();
3287 reply.recycle();
3288 return cph;
3289 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003290 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3291 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003292 Parcel data = Parcel.obtain();
3293 Parcel reply = Parcel.obtain();
3294 data.writeInterfaceToken(IActivityManager.descriptor);
3295 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003296 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003297 data.writeStrongBinder(token);
3298 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3299 reply.readException();
3300 int res = reply.readInt();
3301 ContentProviderHolder cph = null;
3302 if (res != 0) {
3303 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3304 }
3305 data.recycle();
3306 reply.recycle();
3307 return cph;
3308 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003309 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003310 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003311 {
3312 Parcel data = Parcel.obtain();
3313 Parcel reply = Parcel.obtain();
3314 data.writeInterfaceToken(IActivityManager.descriptor);
3315 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3316 data.writeTypedList(providers);
3317 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3318 reply.readException();
3319 data.recycle();
3320 reply.recycle();
3321 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003322 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3323 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003324 Parcel data = Parcel.obtain();
3325 Parcel reply = Parcel.obtain();
3326 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003327 data.writeStrongBinder(connection);
3328 data.writeInt(stable);
3329 data.writeInt(unstable);
3330 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3331 reply.readException();
3332 boolean res = reply.readInt() != 0;
3333 data.recycle();
3334 reply.recycle();
3335 return res;
3336 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003337
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003338 public void unstableProviderDied(IBinder connection) throws RemoteException {
3339 Parcel data = Parcel.obtain();
3340 Parcel reply = Parcel.obtain();
3341 data.writeInterfaceToken(IActivityManager.descriptor);
3342 data.writeStrongBinder(connection);
3343 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3344 reply.readException();
3345 data.recycle();
3346 reply.recycle();
3347 }
3348
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003349 @Override
3350 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3351 Parcel data = Parcel.obtain();
3352 Parcel reply = Parcel.obtain();
3353 data.writeInterfaceToken(IActivityManager.descriptor);
3354 data.writeStrongBinder(connection);
3355 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3356 reply.readException();
3357 data.recycle();
3358 reply.recycle();
3359 }
3360
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003361 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3362 Parcel data = Parcel.obtain();
3363 Parcel reply = Parcel.obtain();
3364 data.writeInterfaceToken(IActivityManager.descriptor);
3365 data.writeStrongBinder(connection);
3366 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003367 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3368 reply.readException();
3369 data.recycle();
3370 reply.recycle();
3371 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003372
3373 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3374 Parcel data = Parcel.obtain();
3375 Parcel reply = Parcel.obtain();
3376 data.writeInterfaceToken(IActivityManager.descriptor);
3377 data.writeString(name);
3378 data.writeStrongBinder(token);
3379 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3380 reply.readException();
3381 data.recycle();
3382 reply.recycle();
3383 }
3384
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003385 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3386 throws RemoteException
3387 {
3388 Parcel data = Parcel.obtain();
3389 Parcel reply = Parcel.obtain();
3390 data.writeInterfaceToken(IActivityManager.descriptor);
3391 service.writeToParcel(data, 0);
3392 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3393 reply.readException();
3394 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3395 data.recycle();
3396 reply.recycle();
3397 return res;
3398 }
3399
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003400 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003401 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003402 {
3403 Parcel data = Parcel.obtain();
3404 Parcel reply = Parcel.obtain();
3405 data.writeInterfaceToken(IActivityManager.descriptor);
3406 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3407 service.writeToParcel(data, 0);
3408 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003409 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003410 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3411 reply.readException();
3412 ComponentName res = ComponentName.readFromParcel(reply);
3413 data.recycle();
3414 reply.recycle();
3415 return res;
3416 }
3417 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003418 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003419 {
3420 Parcel data = Parcel.obtain();
3421 Parcel reply = Parcel.obtain();
3422 data.writeInterfaceToken(IActivityManager.descriptor);
3423 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3424 service.writeToParcel(data, 0);
3425 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003426 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003427 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3428 reply.readException();
3429 int res = reply.readInt();
3430 reply.recycle();
3431 data.recycle();
3432 return res;
3433 }
3434 public boolean stopServiceToken(ComponentName className, IBinder token,
3435 int startId) throws RemoteException {
3436 Parcel data = Parcel.obtain();
3437 Parcel reply = Parcel.obtain();
3438 data.writeInterfaceToken(IActivityManager.descriptor);
3439 ComponentName.writeToParcel(className, data);
3440 data.writeStrongBinder(token);
3441 data.writeInt(startId);
3442 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3443 reply.readException();
3444 boolean res = reply.readInt() != 0;
3445 data.recycle();
3446 reply.recycle();
3447 return res;
3448 }
3449 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003450 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003451 Parcel data = Parcel.obtain();
3452 Parcel reply = Parcel.obtain();
3453 data.writeInterfaceToken(IActivityManager.descriptor);
3454 ComponentName.writeToParcel(className, data);
3455 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003456 data.writeInt(id);
3457 if (notification != null) {
3458 data.writeInt(1);
3459 notification.writeToParcel(data, 0);
3460 } else {
3461 data.writeInt(0);
3462 }
3463 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003464 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3465 reply.readException();
3466 data.recycle();
3467 reply.recycle();
3468 }
3469 public int bindService(IApplicationThread caller, IBinder token,
3470 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003471 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003472 Parcel data = Parcel.obtain();
3473 Parcel reply = Parcel.obtain();
3474 data.writeInterfaceToken(IActivityManager.descriptor);
3475 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3476 data.writeStrongBinder(token);
3477 service.writeToParcel(data, 0);
3478 data.writeString(resolvedType);
3479 data.writeStrongBinder(connection.asBinder());
3480 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003481 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003482 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3483 reply.readException();
3484 int res = reply.readInt();
3485 data.recycle();
3486 reply.recycle();
3487 return res;
3488 }
3489 public boolean unbindService(IServiceConnection connection) throws RemoteException
3490 {
3491 Parcel data = Parcel.obtain();
3492 Parcel reply = Parcel.obtain();
3493 data.writeInterfaceToken(IActivityManager.descriptor);
3494 data.writeStrongBinder(connection.asBinder());
3495 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3496 reply.readException();
3497 boolean res = reply.readInt() != 0;
3498 data.recycle();
3499 reply.recycle();
3500 return res;
3501 }
3502
3503 public void publishService(IBinder token,
3504 Intent intent, IBinder service) throws RemoteException {
3505 Parcel data = Parcel.obtain();
3506 Parcel reply = Parcel.obtain();
3507 data.writeInterfaceToken(IActivityManager.descriptor);
3508 data.writeStrongBinder(token);
3509 intent.writeToParcel(data, 0);
3510 data.writeStrongBinder(service);
3511 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3512 reply.readException();
3513 data.recycle();
3514 reply.recycle();
3515 }
3516
3517 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3518 throws RemoteException {
3519 Parcel data = Parcel.obtain();
3520 Parcel reply = Parcel.obtain();
3521 data.writeInterfaceToken(IActivityManager.descriptor);
3522 data.writeStrongBinder(token);
3523 intent.writeToParcel(data, 0);
3524 data.writeInt(doRebind ? 1 : 0);
3525 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3526 reply.readException();
3527 data.recycle();
3528 reply.recycle();
3529 }
3530
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003531 public void serviceDoneExecuting(IBinder token, int type, int startId,
3532 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003533 Parcel data = Parcel.obtain();
3534 Parcel reply = Parcel.obtain();
3535 data.writeInterfaceToken(IActivityManager.descriptor);
3536 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003537 data.writeInt(type);
3538 data.writeInt(startId);
3539 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003540 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3541 reply.readException();
3542 data.recycle();
3543 reply.recycle();
3544 }
3545
3546 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3547 Parcel data = Parcel.obtain();
3548 Parcel reply = Parcel.obtain();
3549 data.writeInterfaceToken(IActivityManager.descriptor);
3550 service.writeToParcel(data, 0);
3551 data.writeString(resolvedType);
3552 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3553 reply.readException();
3554 IBinder binder = reply.readStrongBinder();
3555 reply.recycle();
3556 data.recycle();
3557 return binder;
3558 }
3559
Christopher Tate181fafa2009-05-14 11:12:14 -07003560 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3561 throws RemoteException {
3562 Parcel data = Parcel.obtain();
3563 Parcel reply = Parcel.obtain();
3564 data.writeInterfaceToken(IActivityManager.descriptor);
3565 app.writeToParcel(data, 0);
3566 data.writeInt(backupRestoreMode);
3567 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3568 reply.readException();
3569 boolean success = reply.readInt() != 0;
3570 reply.recycle();
3571 data.recycle();
3572 return success;
3573 }
3574
Christopher Tate346acb12012-10-15 19:20:25 -07003575 public void clearPendingBackup() throws RemoteException {
3576 Parcel data = Parcel.obtain();
3577 Parcel reply = Parcel.obtain();
3578 data.writeInterfaceToken(IActivityManager.descriptor);
3579 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3580 reply.recycle();
3581 data.recycle();
3582 }
3583
Christopher Tate181fafa2009-05-14 11:12:14 -07003584 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3585 Parcel data = Parcel.obtain();
3586 Parcel reply = Parcel.obtain();
3587 data.writeInterfaceToken(IActivityManager.descriptor);
3588 data.writeString(packageName);
3589 data.writeStrongBinder(agent);
3590 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3591 reply.recycle();
3592 data.recycle();
3593 }
3594
3595 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3596 Parcel data = Parcel.obtain();
3597 Parcel reply = Parcel.obtain();
3598 data.writeInterfaceToken(IActivityManager.descriptor);
3599 app.writeToParcel(data, 0);
3600 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3601 reply.readException();
3602 reply.recycle();
3603 data.recycle();
3604 }
3605
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003606 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003607 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003608 IUiAutomationConnection connection, int userId, String instructionSet)
3609 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003610 Parcel data = Parcel.obtain();
3611 Parcel reply = Parcel.obtain();
3612 data.writeInterfaceToken(IActivityManager.descriptor);
3613 ComponentName.writeToParcel(className, data);
3614 data.writeString(profileFile);
3615 data.writeInt(flags);
3616 data.writeBundle(arguments);
3617 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003618 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003619 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003620 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003621 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3622 reply.readException();
3623 boolean res = reply.readInt() != 0;
3624 reply.recycle();
3625 data.recycle();
3626 return res;
3627 }
3628
3629 public void finishInstrumentation(IApplicationThread target,
3630 int resultCode, Bundle results) throws RemoteException {
3631 Parcel data = Parcel.obtain();
3632 Parcel reply = Parcel.obtain();
3633 data.writeInterfaceToken(IActivityManager.descriptor);
3634 data.writeStrongBinder(target != null ? target.asBinder() : null);
3635 data.writeInt(resultCode);
3636 data.writeBundle(results);
3637 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3638 reply.readException();
3639 data.recycle();
3640 reply.recycle();
3641 }
3642 public Configuration getConfiguration() throws RemoteException
3643 {
3644 Parcel data = Parcel.obtain();
3645 Parcel reply = Parcel.obtain();
3646 data.writeInterfaceToken(IActivityManager.descriptor);
3647 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3648 reply.readException();
3649 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3650 reply.recycle();
3651 data.recycle();
3652 return res;
3653 }
3654 public void updateConfiguration(Configuration values) throws RemoteException
3655 {
3656 Parcel data = Parcel.obtain();
3657 Parcel reply = Parcel.obtain();
3658 data.writeInterfaceToken(IActivityManager.descriptor);
3659 values.writeToParcel(data, 0);
3660 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3661 reply.readException();
3662 data.recycle();
3663 reply.recycle();
3664 }
3665 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3666 throws RemoteException {
3667 Parcel data = Parcel.obtain();
3668 Parcel reply = Parcel.obtain();
3669 data.writeInterfaceToken(IActivityManager.descriptor);
3670 data.writeStrongBinder(token);
3671 data.writeInt(requestedOrientation);
3672 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3673 reply.readException();
3674 data.recycle();
3675 reply.recycle();
3676 }
3677 public int getRequestedOrientation(IBinder token) throws RemoteException {
3678 Parcel data = Parcel.obtain();
3679 Parcel reply = Parcel.obtain();
3680 data.writeInterfaceToken(IActivityManager.descriptor);
3681 data.writeStrongBinder(token);
3682 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3683 reply.readException();
3684 int res = reply.readInt();
3685 data.recycle();
3686 reply.recycle();
3687 return res;
3688 }
3689 public ComponentName getActivityClassForToken(IBinder token)
3690 throws RemoteException {
3691 Parcel data = Parcel.obtain();
3692 Parcel reply = Parcel.obtain();
3693 data.writeInterfaceToken(IActivityManager.descriptor);
3694 data.writeStrongBinder(token);
3695 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3696 reply.readException();
3697 ComponentName res = ComponentName.readFromParcel(reply);
3698 data.recycle();
3699 reply.recycle();
3700 return res;
3701 }
3702 public String getPackageForToken(IBinder token) throws RemoteException
3703 {
3704 Parcel data = Parcel.obtain();
3705 Parcel reply = Parcel.obtain();
3706 data.writeInterfaceToken(IActivityManager.descriptor);
3707 data.writeStrongBinder(token);
3708 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3709 reply.readException();
3710 String res = reply.readString();
3711 data.recycle();
3712 reply.recycle();
3713 return res;
3714 }
3715 public IIntentSender getIntentSender(int type,
3716 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003717 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003718 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003719 Parcel data = Parcel.obtain();
3720 Parcel reply = Parcel.obtain();
3721 data.writeInterfaceToken(IActivityManager.descriptor);
3722 data.writeInt(type);
3723 data.writeString(packageName);
3724 data.writeStrongBinder(token);
3725 data.writeString(resultWho);
3726 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003727 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003728 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003729 data.writeTypedArray(intents, 0);
3730 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003731 } else {
3732 data.writeInt(0);
3733 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003734 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003735 if (options != null) {
3736 data.writeInt(1);
3737 options.writeToParcel(data, 0);
3738 } else {
3739 data.writeInt(0);
3740 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003741 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003742 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3743 reply.readException();
3744 IIntentSender res = IIntentSender.Stub.asInterface(
3745 reply.readStrongBinder());
3746 data.recycle();
3747 reply.recycle();
3748 return res;
3749 }
3750 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3751 Parcel data = Parcel.obtain();
3752 Parcel reply = Parcel.obtain();
3753 data.writeInterfaceToken(IActivityManager.descriptor);
3754 data.writeStrongBinder(sender.asBinder());
3755 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3756 reply.readException();
3757 data.recycle();
3758 reply.recycle();
3759 }
3760 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3761 Parcel data = Parcel.obtain();
3762 Parcel reply = Parcel.obtain();
3763 data.writeInterfaceToken(IActivityManager.descriptor);
3764 data.writeStrongBinder(sender.asBinder());
3765 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3766 reply.readException();
3767 String res = reply.readString();
3768 data.recycle();
3769 reply.recycle();
3770 return res;
3771 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003772 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3773 Parcel data = Parcel.obtain();
3774 Parcel reply = Parcel.obtain();
3775 data.writeInterfaceToken(IActivityManager.descriptor);
3776 data.writeStrongBinder(sender.asBinder());
3777 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3778 reply.readException();
3779 int res = reply.readInt();
3780 data.recycle();
3781 reply.recycle();
3782 return res;
3783 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003784 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3785 boolean requireFull, String name, String callerPackage) throws RemoteException {
3786 Parcel data = Parcel.obtain();
3787 Parcel reply = Parcel.obtain();
3788 data.writeInterfaceToken(IActivityManager.descriptor);
3789 data.writeInt(callingPid);
3790 data.writeInt(callingUid);
3791 data.writeInt(userId);
3792 data.writeInt(allowAll ? 1 : 0);
3793 data.writeInt(requireFull ? 1 : 0);
3794 data.writeString(name);
3795 data.writeString(callerPackage);
3796 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3797 reply.readException();
3798 int res = reply.readInt();
3799 data.recycle();
3800 reply.recycle();
3801 return res;
3802 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003803 public void setProcessLimit(int max) throws RemoteException
3804 {
3805 Parcel data = Parcel.obtain();
3806 Parcel reply = Parcel.obtain();
3807 data.writeInterfaceToken(IActivityManager.descriptor);
3808 data.writeInt(max);
3809 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3810 reply.readException();
3811 data.recycle();
3812 reply.recycle();
3813 }
3814 public int getProcessLimit() throws RemoteException
3815 {
3816 Parcel data = Parcel.obtain();
3817 Parcel reply = Parcel.obtain();
3818 data.writeInterfaceToken(IActivityManager.descriptor);
3819 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3820 reply.readException();
3821 int res = reply.readInt();
3822 data.recycle();
3823 reply.recycle();
3824 return res;
3825 }
3826 public void setProcessForeground(IBinder token, int pid,
3827 boolean isForeground) throws RemoteException {
3828 Parcel data = Parcel.obtain();
3829 Parcel reply = Parcel.obtain();
3830 data.writeInterfaceToken(IActivityManager.descriptor);
3831 data.writeStrongBinder(token);
3832 data.writeInt(pid);
3833 data.writeInt(isForeground ? 1 : 0);
3834 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3835 reply.readException();
3836 data.recycle();
3837 reply.recycle();
3838 }
3839 public int checkPermission(String permission, int pid, int uid)
3840 throws RemoteException {
3841 Parcel data = Parcel.obtain();
3842 Parcel reply = Parcel.obtain();
3843 data.writeInterfaceToken(IActivityManager.descriptor);
3844 data.writeString(permission);
3845 data.writeInt(pid);
3846 data.writeInt(uid);
3847 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3848 reply.readException();
3849 int res = reply.readInt();
3850 data.recycle();
3851 reply.recycle();
3852 return res;
3853 }
3854 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003855 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003856 Parcel data = Parcel.obtain();
3857 Parcel reply = Parcel.obtain();
3858 data.writeInterfaceToken(IActivityManager.descriptor);
3859 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003860 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003861 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003862 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3863 reply.readException();
3864 boolean res = reply.readInt() != 0;
3865 data.recycle();
3866 reply.recycle();
3867 return res;
3868 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003869 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003870 throws RemoteException {
3871 Parcel data = Parcel.obtain();
3872 Parcel reply = Parcel.obtain();
3873 data.writeInterfaceToken(IActivityManager.descriptor);
3874 uri.writeToParcel(data, 0);
3875 data.writeInt(pid);
3876 data.writeInt(uid);
3877 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003878 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003879 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3880 reply.readException();
3881 int res = reply.readInt();
3882 data.recycle();
3883 reply.recycle();
3884 return res;
3885 }
3886 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003887 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003888 Parcel data = Parcel.obtain();
3889 Parcel reply = Parcel.obtain();
3890 data.writeInterfaceToken(IActivityManager.descriptor);
3891 data.writeStrongBinder(caller.asBinder());
3892 data.writeString(targetPkg);
3893 uri.writeToParcel(data, 0);
3894 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003895 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003896 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3897 reply.readException();
3898 data.recycle();
3899 reply.recycle();
3900 }
3901 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003902 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003903 Parcel data = Parcel.obtain();
3904 Parcel reply = Parcel.obtain();
3905 data.writeInterfaceToken(IActivityManager.descriptor);
3906 data.writeStrongBinder(caller.asBinder());
3907 uri.writeToParcel(data, 0);
3908 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003909 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003910 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3911 reply.readException();
3912 data.recycle();
3913 reply.recycle();
3914 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003915
3916 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003917 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3918 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003919 Parcel data = Parcel.obtain();
3920 Parcel reply = Parcel.obtain();
3921 data.writeInterfaceToken(IActivityManager.descriptor);
3922 uri.writeToParcel(data, 0);
3923 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003924 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003925 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3926 reply.readException();
3927 data.recycle();
3928 reply.recycle();
3929 }
3930
3931 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003932 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3933 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003934 Parcel data = Parcel.obtain();
3935 Parcel reply = Parcel.obtain();
3936 data.writeInterfaceToken(IActivityManager.descriptor);
3937 uri.writeToParcel(data, 0);
3938 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003939 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003940 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3941 reply.readException();
3942 data.recycle();
3943 reply.recycle();
3944 }
3945
3946 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003947 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3948 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003949 Parcel data = Parcel.obtain();
3950 Parcel reply = Parcel.obtain();
3951 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003952 data.writeString(packageName);
3953 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003954 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3955 reply.readException();
3956 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3957 reply);
3958 data.recycle();
3959 reply.recycle();
3960 return perms;
3961 }
3962
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003963 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3964 throws RemoteException {
3965 Parcel data = Parcel.obtain();
3966 Parcel reply = Parcel.obtain();
3967 data.writeInterfaceToken(IActivityManager.descriptor);
3968 data.writeStrongBinder(who.asBinder());
3969 data.writeInt(waiting ? 1 : 0);
3970 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3971 reply.readException();
3972 data.recycle();
3973 reply.recycle();
3974 }
3975 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3976 Parcel data = Parcel.obtain();
3977 Parcel reply = Parcel.obtain();
3978 data.writeInterfaceToken(IActivityManager.descriptor);
3979 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3980 reply.readException();
3981 outInfo.readFromParcel(reply);
3982 data.recycle();
3983 reply.recycle();
3984 }
3985 public void unhandledBack() throws RemoteException
3986 {
3987 Parcel data = Parcel.obtain();
3988 Parcel reply = Parcel.obtain();
3989 data.writeInterfaceToken(IActivityManager.descriptor);
3990 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3991 reply.readException();
3992 data.recycle();
3993 reply.recycle();
3994 }
3995 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3996 {
3997 Parcel data = Parcel.obtain();
3998 Parcel reply = Parcel.obtain();
3999 data.writeInterfaceToken(IActivityManager.descriptor);
4000 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4001 reply.readException();
4002 ParcelFileDescriptor pfd = null;
4003 if (reply.readInt() != 0) {
4004 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4005 }
4006 data.recycle();
4007 reply.recycle();
4008 return pfd;
4009 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004010 public void setLockScreenShown(boolean shown) throws RemoteException
4011 {
4012 Parcel data = Parcel.obtain();
4013 Parcel reply = Parcel.obtain();
4014 data.writeInterfaceToken(IActivityManager.descriptor);
4015 data.writeInt(shown ? 1 : 0);
4016 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4017 reply.readException();
4018 data.recycle();
4019 reply.recycle();
4020 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004021 public void setDebugApp(
4022 String packageName, boolean waitForDebugger, boolean persistent)
4023 throws RemoteException
4024 {
4025 Parcel data = Parcel.obtain();
4026 Parcel reply = Parcel.obtain();
4027 data.writeInterfaceToken(IActivityManager.descriptor);
4028 data.writeString(packageName);
4029 data.writeInt(waitForDebugger ? 1 : 0);
4030 data.writeInt(persistent ? 1 : 0);
4031 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4032 reply.readException();
4033 data.recycle();
4034 reply.recycle();
4035 }
4036 public void setAlwaysFinish(boolean enabled) throws RemoteException
4037 {
4038 Parcel data = Parcel.obtain();
4039 Parcel reply = Parcel.obtain();
4040 data.writeInterfaceToken(IActivityManager.descriptor);
4041 data.writeInt(enabled ? 1 : 0);
4042 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4043 reply.readException();
4044 data.recycle();
4045 reply.recycle();
4046 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004047 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004048 {
4049 Parcel data = Parcel.obtain();
4050 Parcel reply = Parcel.obtain();
4051 data.writeInterfaceToken(IActivityManager.descriptor);
4052 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004053 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004054 reply.readException();
4055 data.recycle();
4056 reply.recycle();
4057 }
4058 public void enterSafeMode() throws RemoteException {
4059 Parcel data = Parcel.obtain();
4060 data.writeInterfaceToken(IActivityManager.descriptor);
4061 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4062 data.recycle();
4063 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08004064 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
4065 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004066 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004067 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004068 data.writeStrongBinder(sender.asBinder());
4069 data.writeInt(sourceUid);
4070 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004071 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4072 data.recycle();
4073 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004074 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004075 Parcel data = Parcel.obtain();
4076 Parcel reply = Parcel.obtain();
4077 data.writeInterfaceToken(IActivityManager.descriptor);
4078 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004079 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004080 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004081 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004082 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004083 boolean res = reply.readInt() != 0;
4084 data.recycle();
4085 reply.recycle();
4086 return res;
4087 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004088 @Override
4089 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4090 Parcel data = Parcel.obtain();
4091 Parcel reply = Parcel.obtain();
4092 data.writeInterfaceToken(IActivityManager.descriptor);
4093 data.writeString(reason);
4094 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4095 boolean res = reply.readInt() != 0;
4096 data.recycle();
4097 reply.recycle();
4098 return res;
4099 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004100 public boolean testIsSystemReady()
4101 {
4102 /* this base class version is never called */
4103 return true;
4104 }
Dan Egnor60d87622009-12-16 16:32:58 -08004105 public void handleApplicationCrash(IBinder app,
4106 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4107 {
4108 Parcel data = Parcel.obtain();
4109 Parcel reply = Parcel.obtain();
4110 data.writeInterfaceToken(IActivityManager.descriptor);
4111 data.writeStrongBinder(app);
4112 crashInfo.writeToParcel(data, 0);
4113 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4114 reply.readException();
4115 reply.recycle();
4116 data.recycle();
4117 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004118
Dianne Hackborn52322712014-08-26 22:47:26 -07004119 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004120 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004121 {
4122 Parcel data = Parcel.obtain();
4123 Parcel reply = Parcel.obtain();
4124 data.writeInterfaceToken(IActivityManager.descriptor);
4125 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004126 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004127 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004128 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004129 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004130 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004131 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004132 reply.recycle();
4133 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004134 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004135 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004136
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004137 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004138 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004139 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004140 {
4141 Parcel data = Parcel.obtain();
4142 Parcel reply = Parcel.obtain();
4143 data.writeInterfaceToken(IActivityManager.descriptor);
4144 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004145 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004146 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004147 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4148 reply.readException();
4149 reply.recycle();
4150 data.recycle();
4151 }
4152
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004153 public void signalPersistentProcesses(int sig) throws RemoteException {
4154 Parcel data = Parcel.obtain();
4155 Parcel reply = Parcel.obtain();
4156 data.writeInterfaceToken(IActivityManager.descriptor);
4157 data.writeInt(sig);
4158 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4159 reply.readException();
4160 data.recycle();
4161 reply.recycle();
4162 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004163
Dianne Hackborn1676c852012-09-10 14:52:30 -07004164 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004165 Parcel data = Parcel.obtain();
4166 Parcel reply = Parcel.obtain();
4167 data.writeInterfaceToken(IActivityManager.descriptor);
4168 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004169 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004170 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4171 reply.readException();
4172 data.recycle();
4173 reply.recycle();
4174 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004175
4176 public void killAllBackgroundProcesses() throws RemoteException {
4177 Parcel data = Parcel.obtain();
4178 Parcel reply = Parcel.obtain();
4179 data.writeInterfaceToken(IActivityManager.descriptor);
4180 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4181 reply.readException();
4182 data.recycle();
4183 reply.recycle();
4184 }
4185
Dianne Hackborn1676c852012-09-10 14:52:30 -07004186 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004187 Parcel data = Parcel.obtain();
4188 Parcel reply = Parcel.obtain();
4189 data.writeInterfaceToken(IActivityManager.descriptor);
4190 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004191 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004192 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004193 reply.readException();
4194 data.recycle();
4195 reply.recycle();
4196 }
4197
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004198 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4199 throws RemoteException
4200 {
4201 Parcel data = Parcel.obtain();
4202 Parcel reply = Parcel.obtain();
4203 data.writeInterfaceToken(IActivityManager.descriptor);
4204 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4205 reply.readException();
4206 outInfo.readFromParcel(reply);
4207 reply.recycle();
4208 data.recycle();
4209 }
4210
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004211 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4212 {
4213 Parcel data = Parcel.obtain();
4214 Parcel reply = Parcel.obtain();
4215 data.writeInterfaceToken(IActivityManager.descriptor);
4216 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4217 reply.readException();
4218 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4219 reply.recycle();
4220 data.recycle();
4221 return res;
4222 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004223
Dianne Hackborn1676c852012-09-10 14:52:30 -07004224 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004225 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004226 {
4227 Parcel data = Parcel.obtain();
4228 Parcel reply = Parcel.obtain();
4229 data.writeInterfaceToken(IActivityManager.descriptor);
4230 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004231 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004232 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004233 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004234 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004235 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004236 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004237 } else {
4238 data.writeInt(0);
4239 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004240 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4241 reply.readException();
4242 boolean res = reply.readInt() != 0;
4243 reply.recycle();
4244 data.recycle();
4245 return res;
4246 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004247
Dianne Hackborn55280a92009-05-07 15:53:46 -07004248 public boolean shutdown(int timeout) throws RemoteException
4249 {
4250 Parcel data = Parcel.obtain();
4251 Parcel reply = Parcel.obtain();
4252 data.writeInterfaceToken(IActivityManager.descriptor);
4253 data.writeInt(timeout);
4254 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4255 reply.readException();
4256 boolean res = reply.readInt() != 0;
4257 reply.recycle();
4258 data.recycle();
4259 return res;
4260 }
4261
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004262 public void stopAppSwitches() throws RemoteException {
4263 Parcel data = Parcel.obtain();
4264 Parcel reply = Parcel.obtain();
4265 data.writeInterfaceToken(IActivityManager.descriptor);
4266 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4267 reply.readException();
4268 reply.recycle();
4269 data.recycle();
4270 }
4271
4272 public void resumeAppSwitches() throws RemoteException {
4273 Parcel data = Parcel.obtain();
4274 Parcel reply = Parcel.obtain();
4275 data.writeInterfaceToken(IActivityManager.descriptor);
4276 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4277 reply.readException();
4278 reply.recycle();
4279 data.recycle();
4280 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004281
4282 public void addPackageDependency(String packageName) throws RemoteException {
4283 Parcel data = Parcel.obtain();
4284 Parcel reply = Parcel.obtain();
4285 data.writeInterfaceToken(IActivityManager.descriptor);
4286 data.writeString(packageName);
4287 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4288 reply.readException();
4289 data.recycle();
4290 reply.recycle();
4291 }
4292
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004293 public void killApplicationWithAppId(String pkg, int appid, String reason)
4294 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004295 Parcel data = Parcel.obtain();
4296 Parcel reply = Parcel.obtain();
4297 data.writeInterfaceToken(IActivityManager.descriptor);
4298 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004299 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004300 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004301 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004302 reply.readException();
4303 data.recycle();
4304 reply.recycle();
4305 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004306
4307 public void closeSystemDialogs(String reason) throws RemoteException {
4308 Parcel data = Parcel.obtain();
4309 Parcel reply = Parcel.obtain();
4310 data.writeInterfaceToken(IActivityManager.descriptor);
4311 data.writeString(reason);
4312 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4313 reply.readException();
4314 data.recycle();
4315 reply.recycle();
4316 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004317
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004318 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004319 throws RemoteException {
4320 Parcel data = Parcel.obtain();
4321 Parcel reply = Parcel.obtain();
4322 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004323 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004324 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4325 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004326 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004327 data.recycle();
4328 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004329 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004330 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004331
4332 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4333 Parcel data = Parcel.obtain();
4334 Parcel reply = Parcel.obtain();
4335 data.writeInterfaceToken(IActivityManager.descriptor);
4336 data.writeString(processName);
4337 data.writeInt(uid);
4338 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4339 reply.readException();
4340 data.recycle();
4341 reply.recycle();
4342 }
4343
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004344 public void overridePendingTransition(IBinder token, String packageName,
4345 int enterAnim, int exitAnim) throws RemoteException {
4346 Parcel data = Parcel.obtain();
4347 Parcel reply = Parcel.obtain();
4348 data.writeInterfaceToken(IActivityManager.descriptor);
4349 data.writeStrongBinder(token);
4350 data.writeString(packageName);
4351 data.writeInt(enterAnim);
4352 data.writeInt(exitAnim);
4353 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4354 reply.readException();
4355 data.recycle();
4356 reply.recycle();
4357 }
4358
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004359 public boolean isUserAMonkey() throws RemoteException {
4360 Parcel data = Parcel.obtain();
4361 Parcel reply = Parcel.obtain();
4362 data.writeInterfaceToken(IActivityManager.descriptor);
4363 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4364 reply.readException();
4365 boolean res = reply.readInt() != 0;
4366 data.recycle();
4367 reply.recycle();
4368 return res;
4369 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004370
4371 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4372 Parcel data = Parcel.obtain();
4373 Parcel reply = Parcel.obtain();
4374 data.writeInterfaceToken(IActivityManager.descriptor);
4375 data.writeInt(monkey ? 1 : 0);
4376 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4377 reply.readException();
4378 data.recycle();
4379 reply.recycle();
4380 }
4381
Dianne Hackborn860755f2010-06-03 18:47:52 -07004382 public void finishHeavyWeightApp() throws RemoteException {
4383 Parcel data = Parcel.obtain();
4384 Parcel reply = Parcel.obtain();
4385 data.writeInterfaceToken(IActivityManager.descriptor);
4386 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4387 reply.readException();
4388 data.recycle();
4389 reply.recycle();
4390 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004391
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004392 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004393 throws RemoteException {
4394 Parcel data = Parcel.obtain();
4395 Parcel reply = Parcel.obtain();
4396 data.writeInterfaceToken(IActivityManager.descriptor);
4397 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004398 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4399 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004400 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004401 data.recycle();
4402 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004403 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004404 }
4405
Craig Mautner233ceee2014-05-09 17:05:11 -07004406 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004407 throws RemoteException {
4408 Parcel data = Parcel.obtain();
4409 Parcel reply = Parcel.obtain();
4410 data.writeInterfaceToken(IActivityManager.descriptor);
4411 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004412 if (options == null) {
4413 data.writeInt(0);
4414 } else {
4415 data.writeInt(1);
4416 data.writeBundle(options.toBundle());
4417 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004418 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004419 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004420 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004421 data.recycle();
4422 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004423 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004424 }
4425
Craig Mautner233ceee2014-05-09 17:05:11 -07004426 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4427 Parcel data = Parcel.obtain();
4428 Parcel reply = Parcel.obtain();
4429 data.writeInterfaceToken(IActivityManager.descriptor);
4430 data.writeStrongBinder(token);
4431 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4432 reply.readException();
4433 Bundle bundle = reply.readBundle();
4434 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4435 data.recycle();
4436 reply.recycle();
4437 return options;
4438 }
4439
Daniel Sandler69a48172010-06-23 16:29:36 -04004440 public void setImmersive(IBinder token, boolean immersive)
4441 throws RemoteException {
4442 Parcel data = Parcel.obtain();
4443 Parcel reply = Parcel.obtain();
4444 data.writeInterfaceToken(IActivityManager.descriptor);
4445 data.writeStrongBinder(token);
4446 data.writeInt(immersive ? 1 : 0);
4447 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4448 reply.readException();
4449 data.recycle();
4450 reply.recycle();
4451 }
4452
4453 public boolean isImmersive(IBinder token)
4454 throws RemoteException {
4455 Parcel data = Parcel.obtain();
4456 Parcel reply = Parcel.obtain();
4457 data.writeInterfaceToken(IActivityManager.descriptor);
4458 data.writeStrongBinder(token);
4459 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004460 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004461 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004462 data.recycle();
4463 reply.recycle();
4464 return res;
4465 }
4466
Craig Mautnerd61dc202014-07-07 11:09:11 -07004467 public boolean isTopOfTask(IBinder token) throws RemoteException {
4468 Parcel data = Parcel.obtain();
4469 Parcel reply = Parcel.obtain();
4470 data.writeInterfaceToken(IActivityManager.descriptor);
4471 data.writeStrongBinder(token);
4472 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4473 reply.readException();
4474 boolean res = reply.readInt() == 1;
4475 data.recycle();
4476 reply.recycle();
4477 return res;
4478 }
4479
Daniel Sandler69a48172010-06-23 16:29:36 -04004480 public boolean isTopActivityImmersive()
4481 throws RemoteException {
4482 Parcel data = Parcel.obtain();
4483 Parcel reply = Parcel.obtain();
4484 data.writeInterfaceToken(IActivityManager.descriptor);
4485 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004486 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004487 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004488 data.recycle();
4489 reply.recycle();
4490 return res;
4491 }
4492
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004493 public void crashApplication(int uid, int initialPid, String packageName,
4494 String message) throws RemoteException {
4495 Parcel data = Parcel.obtain();
4496 Parcel reply = Parcel.obtain();
4497 data.writeInterfaceToken(IActivityManager.descriptor);
4498 data.writeInt(uid);
4499 data.writeInt(initialPid);
4500 data.writeString(packageName);
4501 data.writeString(message);
4502 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4503 reply.readException();
4504 data.recycle();
4505 reply.recycle();
4506 }
Andy McFadden824c5102010-07-09 16:26:57 -07004507
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004508 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004509 Parcel data = Parcel.obtain();
4510 Parcel reply = Parcel.obtain();
4511 data.writeInterfaceToken(IActivityManager.descriptor);
4512 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004513 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004514 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4515 reply.readException();
4516 String res = reply.readString();
4517 data.recycle();
4518 reply.recycle();
4519 return res;
4520 }
4521
Dianne Hackborn7e269642010-08-25 19:50:20 -07004522 public IBinder newUriPermissionOwner(String name)
4523 throws RemoteException {
4524 Parcel data = Parcel.obtain();
4525 Parcel reply = Parcel.obtain();
4526 data.writeInterfaceToken(IActivityManager.descriptor);
4527 data.writeString(name);
4528 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4529 reply.readException();
4530 IBinder res = reply.readStrongBinder();
4531 data.recycle();
4532 reply.recycle();
4533 return res;
4534 }
4535
4536 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004537 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004538 Parcel data = Parcel.obtain();
4539 Parcel reply = Parcel.obtain();
4540 data.writeInterfaceToken(IActivityManager.descriptor);
4541 data.writeStrongBinder(owner);
4542 data.writeInt(fromUid);
4543 data.writeString(targetPkg);
4544 uri.writeToParcel(data, 0);
4545 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004546 data.writeInt(sourceUserId);
4547 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004548 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4549 reply.readException();
4550 data.recycle();
4551 reply.recycle();
4552 }
4553
4554 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004555 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004556 Parcel data = Parcel.obtain();
4557 Parcel reply = Parcel.obtain();
4558 data.writeInterfaceToken(IActivityManager.descriptor);
4559 data.writeStrongBinder(owner);
4560 if (uri != null) {
4561 data.writeInt(1);
4562 uri.writeToParcel(data, 0);
4563 } else {
4564 data.writeInt(0);
4565 }
4566 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004567 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004568 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4569 reply.readException();
4570 data.recycle();
4571 reply.recycle();
4572 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004573
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004574 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004575 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004576 Parcel data = Parcel.obtain();
4577 Parcel reply = Parcel.obtain();
4578 data.writeInterfaceToken(IActivityManager.descriptor);
4579 data.writeInt(callingUid);
4580 data.writeString(targetPkg);
4581 uri.writeToParcel(data, 0);
4582 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004583 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004584 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4585 reply.readException();
4586 int res = reply.readInt();
4587 data.recycle();
4588 reply.recycle();
4589 return res;
4590 }
4591
Dianne Hackborn1676c852012-09-10 14:52:30 -07004592 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004593 String path, ParcelFileDescriptor fd) throws RemoteException {
4594 Parcel data = Parcel.obtain();
4595 Parcel reply = Parcel.obtain();
4596 data.writeInterfaceToken(IActivityManager.descriptor);
4597 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004598 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004599 data.writeInt(managed ? 1 : 0);
4600 data.writeString(path);
4601 if (fd != null) {
4602 data.writeInt(1);
4603 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4604 } else {
4605 data.writeInt(0);
4606 }
4607 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4608 reply.readException();
4609 boolean res = reply.readInt() != 0;
4610 reply.recycle();
4611 data.recycle();
4612 return res;
4613 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004614
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004615 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004616 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004617 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004618 Parcel data = Parcel.obtain();
4619 Parcel reply = Parcel.obtain();
4620 data.writeInterfaceToken(IActivityManager.descriptor);
4621 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004622 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004623 data.writeTypedArray(intents, 0);
4624 data.writeStringArray(resolvedTypes);
4625 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004626 if (options != null) {
4627 data.writeInt(1);
4628 options.writeToParcel(data, 0);
4629 } else {
4630 data.writeInt(0);
4631 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004632 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004633 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4634 reply.readException();
4635 int result = reply.readInt();
4636 reply.recycle();
4637 data.recycle();
4638 return result;
4639 }
4640
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004641 public int getFrontActivityScreenCompatMode() throws RemoteException {
4642 Parcel data = Parcel.obtain();
4643 Parcel reply = Parcel.obtain();
4644 data.writeInterfaceToken(IActivityManager.descriptor);
4645 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4646 reply.readException();
4647 int mode = reply.readInt();
4648 reply.recycle();
4649 data.recycle();
4650 return mode;
4651 }
4652
4653 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4654 Parcel data = Parcel.obtain();
4655 Parcel reply = Parcel.obtain();
4656 data.writeInterfaceToken(IActivityManager.descriptor);
4657 data.writeInt(mode);
4658 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4659 reply.readException();
4660 reply.recycle();
4661 data.recycle();
4662 }
4663
4664 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4665 Parcel data = Parcel.obtain();
4666 Parcel reply = Parcel.obtain();
4667 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004668 data.writeString(packageName);
4669 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004670 reply.readException();
4671 int mode = reply.readInt();
4672 reply.recycle();
4673 data.recycle();
4674 return mode;
4675 }
4676
4677 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004678 throws RemoteException {
4679 Parcel data = Parcel.obtain();
4680 Parcel reply = Parcel.obtain();
4681 data.writeInterfaceToken(IActivityManager.descriptor);
4682 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004683 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004684 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4685 reply.readException();
4686 reply.recycle();
4687 data.recycle();
4688 }
4689
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004690 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4691 Parcel data = Parcel.obtain();
4692 Parcel reply = Parcel.obtain();
4693 data.writeInterfaceToken(IActivityManager.descriptor);
4694 data.writeString(packageName);
4695 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4696 reply.readException();
4697 boolean ask = reply.readInt() != 0;
4698 reply.recycle();
4699 data.recycle();
4700 return ask;
4701 }
4702
4703 public void setPackageAskScreenCompat(String packageName, boolean ask)
4704 throws RemoteException {
4705 Parcel data = Parcel.obtain();
4706 Parcel reply = Parcel.obtain();
4707 data.writeInterfaceToken(IActivityManager.descriptor);
4708 data.writeString(packageName);
4709 data.writeInt(ask ? 1 : 0);
4710 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4711 reply.readException();
4712 reply.recycle();
4713 data.recycle();
4714 }
4715
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004716 public boolean switchUser(int userid) throws RemoteException {
4717 Parcel data = Parcel.obtain();
4718 Parcel reply = Parcel.obtain();
4719 data.writeInterfaceToken(IActivityManager.descriptor);
4720 data.writeInt(userid);
4721 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4722 reply.readException();
4723 boolean result = reply.readInt() != 0;
4724 reply.recycle();
4725 data.recycle();
4726 return result;
4727 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004728
Kenny Guy08488bf2014-02-21 17:40:37 +00004729 public boolean startUserInBackground(int userid) throws RemoteException {
4730 Parcel data = Parcel.obtain();
4731 Parcel reply = Parcel.obtain();
4732 data.writeInterfaceToken(IActivityManager.descriptor);
4733 data.writeInt(userid);
4734 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4735 reply.readException();
4736 boolean result = reply.readInt() != 0;
4737 reply.recycle();
4738 data.recycle();
4739 return result;
4740 }
4741
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004742 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4743 Parcel data = Parcel.obtain();
4744 Parcel reply = Parcel.obtain();
4745 data.writeInterfaceToken(IActivityManager.descriptor);
4746 data.writeInt(userid);
4747 data.writeStrongInterface(callback);
4748 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4749 reply.readException();
4750 int result = reply.readInt();
4751 reply.recycle();
4752 data.recycle();
4753 return result;
4754 }
4755
Amith Yamasani52f1d752012-03-28 18:19:29 -07004756 public UserInfo getCurrentUser() throws RemoteException {
4757 Parcel data = Parcel.obtain();
4758 Parcel reply = Parcel.obtain();
4759 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004760 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004761 reply.readException();
4762 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4763 reply.recycle();
4764 data.recycle();
4765 return userInfo;
4766 }
4767
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004768 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004769 Parcel data = Parcel.obtain();
4770 Parcel reply = Parcel.obtain();
4771 data.writeInterfaceToken(IActivityManager.descriptor);
4772 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004773 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004774 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4775 reply.readException();
4776 boolean result = reply.readInt() != 0;
4777 reply.recycle();
4778 data.recycle();
4779 return result;
4780 }
4781
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004782 public int[] getRunningUserIds() throws RemoteException {
4783 Parcel data = Parcel.obtain();
4784 Parcel reply = Parcel.obtain();
4785 data.writeInterfaceToken(IActivityManager.descriptor);
4786 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4787 reply.readException();
4788 int[] result = reply.createIntArray();
4789 reply.recycle();
4790 data.recycle();
4791 return result;
4792 }
4793
Wale Ogunwaled54b5782014-10-23 15:55:23 -07004794 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004795 Parcel data = Parcel.obtain();
4796 Parcel reply = Parcel.obtain();
4797 data.writeInterfaceToken(IActivityManager.descriptor);
4798 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004799 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4800 reply.readException();
4801 boolean result = reply.readInt() != 0;
4802 reply.recycle();
4803 data.recycle();
4804 return result;
4805 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004806
Jeff Sharkeya4620792011-05-20 15:29:23 -07004807 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4808 Parcel data = Parcel.obtain();
4809 Parcel reply = Parcel.obtain();
4810 data.writeInterfaceToken(IActivityManager.descriptor);
4811 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4812 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4813 reply.readException();
4814 data.recycle();
4815 reply.recycle();
4816 }
4817
4818 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4819 Parcel data = Parcel.obtain();
4820 Parcel reply = Parcel.obtain();
4821 data.writeInterfaceToken(IActivityManager.descriptor);
4822 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4823 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4824 reply.readException();
4825 data.recycle();
4826 reply.recycle();
4827 }
4828
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004829 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4830 Parcel data = Parcel.obtain();
4831 Parcel reply = Parcel.obtain();
4832 data.writeInterfaceToken(IActivityManager.descriptor);
4833 data.writeStrongBinder(sender.asBinder());
4834 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4835 reply.readException();
4836 boolean res = reply.readInt() != 0;
4837 data.recycle();
4838 reply.recycle();
4839 return res;
4840 }
4841
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004842 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4843 Parcel data = Parcel.obtain();
4844 Parcel reply = Parcel.obtain();
4845 data.writeInterfaceToken(IActivityManager.descriptor);
4846 data.writeStrongBinder(sender.asBinder());
4847 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4848 reply.readException();
4849 boolean res = reply.readInt() != 0;
4850 data.recycle();
4851 reply.recycle();
4852 return res;
4853 }
4854
Dianne Hackborn81038902012-11-26 17:04:09 -08004855 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4856 Parcel data = Parcel.obtain();
4857 Parcel reply = Parcel.obtain();
4858 data.writeInterfaceToken(IActivityManager.descriptor);
4859 data.writeStrongBinder(sender.asBinder());
4860 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4861 reply.readException();
4862 Intent res = reply.readInt() != 0
4863 ? Intent.CREATOR.createFromParcel(reply) : null;
4864 data.recycle();
4865 reply.recycle();
4866 return res;
4867 }
4868
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004869 public String getTagForIntentSender(IIntentSender sender, String prefix)
4870 throws RemoteException {
4871 Parcel data = Parcel.obtain();
4872 Parcel reply = Parcel.obtain();
4873 data.writeInterfaceToken(IActivityManager.descriptor);
4874 data.writeStrongBinder(sender.asBinder());
4875 data.writeString(prefix);
4876 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4877 reply.readException();
4878 String res = reply.readString();
4879 data.recycle();
4880 reply.recycle();
4881 return res;
4882 }
4883
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004884 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4885 {
4886 Parcel data = Parcel.obtain();
4887 Parcel reply = Parcel.obtain();
4888 data.writeInterfaceToken(IActivityManager.descriptor);
4889 values.writeToParcel(data, 0);
4890 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4891 reply.readException();
4892 data.recycle();
4893 reply.recycle();
4894 }
4895
Dianne Hackbornb437e092011-08-05 17:50:29 -07004896 public long[] getProcessPss(int[] pids) throws RemoteException {
4897 Parcel data = Parcel.obtain();
4898 Parcel reply = Parcel.obtain();
4899 data.writeInterfaceToken(IActivityManager.descriptor);
4900 data.writeIntArray(pids);
4901 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4902 reply.readException();
4903 long[] res = reply.createLongArray();
4904 data.recycle();
4905 reply.recycle();
4906 return res;
4907 }
4908
Dianne Hackborn661cd522011-08-22 00:26:20 -07004909 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4910 Parcel data = Parcel.obtain();
4911 Parcel reply = Parcel.obtain();
4912 data.writeInterfaceToken(IActivityManager.descriptor);
4913 TextUtils.writeToParcel(msg, data, 0);
4914 data.writeInt(always ? 1 : 0);
4915 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4916 reply.readException();
4917 data.recycle();
4918 reply.recycle();
4919 }
4920
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004921 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004922 Parcel data = Parcel.obtain();
4923 Parcel reply = Parcel.obtain();
4924 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004925 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004926 reply.readException();
4927 data.recycle();
4928 reply.recycle();
4929 }
4930
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004931 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07004932 throws RemoteException {
4933 Parcel data = Parcel.obtain();
4934 Parcel reply = Parcel.obtain();
4935 data.writeInterfaceToken(IActivityManager.descriptor);
4936 data.writeStrongBinder(token);
4937 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004938 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07004939 reply.readException();
4940 boolean result = reply.readInt() != 0;
4941 data.recycle();
4942 reply.recycle();
4943 return result;
4944 }
4945
4946 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4947 throws RemoteException {
4948 Parcel data = Parcel.obtain();
4949 Parcel reply = Parcel.obtain();
4950 data.writeInterfaceToken(IActivityManager.descriptor);
4951 data.writeStrongBinder(token);
4952 target.writeToParcel(data, 0);
4953 data.writeInt(resultCode);
4954 if (resultData != null) {
4955 data.writeInt(1);
4956 resultData.writeToParcel(data, 0);
4957 } else {
4958 data.writeInt(0);
4959 }
4960 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4961 reply.readException();
4962 boolean result = reply.readInt() != 0;
4963 data.recycle();
4964 reply.recycle();
4965 return result;
4966 }
4967
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004968 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4969 Parcel data = Parcel.obtain();
4970 Parcel reply = Parcel.obtain();
4971 data.writeInterfaceToken(IActivityManager.descriptor);
4972 data.writeStrongBinder(activityToken);
4973 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4974 reply.readException();
4975 int result = reply.readInt();
4976 data.recycle();
4977 reply.recycle();
4978 return result;
4979 }
4980
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004981 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4982 Parcel data = Parcel.obtain();
4983 Parcel reply = Parcel.obtain();
4984 data.writeInterfaceToken(IActivityManager.descriptor);
4985 data.writeStrongBinder(activityToken);
4986 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4987 reply.readException();
4988 String result = reply.readString();
4989 data.recycle();
4990 reply.recycle();
4991 return result;
4992 }
4993
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004994 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4995 Parcel data = Parcel.obtain();
4996 Parcel reply = Parcel.obtain();
4997 data.writeInterfaceToken(IActivityManager.descriptor);
4998 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4999 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5000 reply.readException();
5001 data.recycle();
5002 reply.recycle();
5003 }
5004
5005 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5006 Parcel data = Parcel.obtain();
5007 Parcel reply = Parcel.obtain();
5008 data.writeInterfaceToken(IActivityManager.descriptor);
5009 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5010 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5011 reply.readException();
5012 data.recycle();
5013 reply.recycle();
5014 }
5015
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005016 public void requestBugReport() throws RemoteException {
5017 Parcel data = Parcel.obtain();
5018 Parcel reply = Parcel.obtain();
5019 data.writeInterfaceToken(IActivityManager.descriptor);
5020 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5021 reply.readException();
5022 data.recycle();
5023 reply.recycle();
5024 }
5025
Jeff Brownbd181bb2013-09-10 16:44:24 -07005026 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5027 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005028 Parcel data = Parcel.obtain();
5029 Parcel reply = Parcel.obtain();
5030 data.writeInterfaceToken(IActivityManager.descriptor);
5031 data.writeInt(pid);
5032 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005033 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005034 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5035 reply.readException();
5036 long res = reply.readInt();
5037 data.recycle();
5038 reply.recycle();
5039 return res;
5040 }
5041
Adam Skorydfc7fd72013-08-05 19:23:41 -07005042 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005043 Parcel data = Parcel.obtain();
5044 Parcel reply = Parcel.obtain();
5045 data.writeInterfaceToken(IActivityManager.descriptor);
5046 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005047 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005048 reply.readException();
5049 Bundle res = reply.readBundle();
5050 data.recycle();
5051 reply.recycle();
5052 return res;
5053 }
5054
Adam Skory7140a252013-09-11 12:04:58 +01005055 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005056 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005057 Parcel data = Parcel.obtain();
5058 Parcel reply = Parcel.obtain();
5059 data.writeInterfaceToken(IActivityManager.descriptor);
5060 data.writeStrongBinder(token);
5061 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005062 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005063 reply.readException();
5064 data.recycle();
5065 reply.recycle();
5066 }
5067
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005068 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
5069 throws RemoteException {
5070 Parcel data = Parcel.obtain();
5071 Parcel reply = Parcel.obtain();
5072 data.writeInterfaceToken(IActivityManager.descriptor);
5073 intent.writeToParcel(data, 0);
5074 data.writeInt(requestType);
5075 data.writeString(hint);
5076 data.writeInt(userHandle);
5077 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5078 reply.readException();
5079 boolean res = reply.readInt() != 0;
5080 data.recycle();
5081 reply.recycle();
5082 return res;
5083 }
5084
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005085 public void killUid(int uid, String reason) throws RemoteException {
5086 Parcel data = Parcel.obtain();
5087 Parcel reply = Parcel.obtain();
5088 data.writeInterfaceToken(IActivityManager.descriptor);
5089 data.writeInt(uid);
5090 data.writeString(reason);
5091 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5092 reply.readException();
5093 data.recycle();
5094 reply.recycle();
5095 }
5096
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005097 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5098 Parcel data = Parcel.obtain();
5099 Parcel reply = Parcel.obtain();
5100 data.writeInterfaceToken(IActivityManager.descriptor);
5101 data.writeStrongBinder(who);
5102 data.writeInt(allowRestart ? 1 : 0);
5103 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5104 reply.readException();
5105 data.recycle();
5106 reply.recycle();
5107 }
5108
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005109 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5110 Parcel data = Parcel.obtain();
5111 Parcel reply = Parcel.obtain();
5112 data.writeInterfaceToken(IActivityManager.descriptor);
5113 data.writeStrongBinder(token);
5114 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5115 reply.readException();
5116 data.recycle();
5117 reply.recycle();
5118 }
5119
Craig Mautner5eda9b32013-07-02 11:58:16 -07005120 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5121 Parcel data = Parcel.obtain();
5122 Parcel reply = Parcel.obtain();
5123 data.writeInterfaceToken(IActivityManager.descriptor);
5124 data.writeStrongBinder(token);
5125 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5126 reply.readException();
5127 data.recycle();
5128 reply.recycle();
5129 }
5130
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005131 public void restart() throws RemoteException {
5132 Parcel data = Parcel.obtain();
5133 Parcel reply = Parcel.obtain();
5134 data.writeInterfaceToken(IActivityManager.descriptor);
5135 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5136 reply.readException();
5137 data.recycle();
5138 reply.recycle();
5139 }
5140
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005141 public void performIdleMaintenance() throws RemoteException {
5142 Parcel data = Parcel.obtain();
5143 Parcel reply = Parcel.obtain();
5144 data.writeInterfaceToken(IActivityManager.descriptor);
5145 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5146 reply.readException();
5147 data.recycle();
5148 reply.recycle();
5149 }
5150
Craig Mautner4a1cb222013-12-04 16:14:06 -08005151 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
5152 IActivityContainerCallback callback) throws RemoteException {
5153 Parcel data = Parcel.obtain();
5154 Parcel reply = Parcel.obtain();
5155 data.writeInterfaceToken(IActivityManager.descriptor);
5156 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005157 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08005158 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5159 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005160 final int result = reply.readInt();
5161 final IActivityContainer res;
5162 if (result == 1) {
5163 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5164 } else {
5165 res = null;
5166 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005167 data.recycle();
5168 reply.recycle();
5169 return res;
5170 }
5171
Craig Mautner95da1082014-02-24 17:54:35 -08005172 public void deleteActivityContainer(IActivityContainer activityContainer)
5173 throws RemoteException {
5174 Parcel data = Parcel.obtain();
5175 Parcel reply = Parcel.obtain();
5176 data.writeInterfaceToken(IActivityManager.descriptor);
5177 data.writeStrongBinder(activityContainer.asBinder());
5178 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5179 reply.readException();
5180 data.recycle();
5181 reply.recycle();
5182 }
5183
Craig Mautnere0a38842013-12-16 16:14:02 -08005184 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
5185 throws RemoteException {
5186 Parcel data = Parcel.obtain();
5187 Parcel reply = Parcel.obtain();
5188 data.writeInterfaceToken(IActivityManager.descriptor);
5189 data.writeStrongBinder(activityToken);
5190 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5191 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005192 final int result = reply.readInt();
5193 final IActivityContainer res;
5194 if (result == 1) {
5195 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5196 } else {
5197 res = null;
5198 }
Craig Mautnere0a38842013-12-16 16:14:02 -08005199 data.recycle();
5200 reply.recycle();
5201 return res;
5202 }
5203
Craig Mautner4a1cb222013-12-04 16:14:06 -08005204 public IBinder getHomeActivityToken() throws RemoteException {
5205 Parcel data = Parcel.obtain();
5206 Parcel reply = Parcel.obtain();
5207 data.writeInterfaceToken(IActivityManager.descriptor);
5208 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5209 reply.readException();
5210 IBinder res = reply.readStrongBinder();
5211 data.recycle();
5212 reply.recycle();
5213 return res;
5214 }
5215
Craig Mautneraea74a52014-03-08 14:23:10 -08005216 @Override
5217 public void startLockTaskMode(int taskId) throws RemoteException {
5218 Parcel data = Parcel.obtain();
5219 Parcel reply = Parcel.obtain();
5220 data.writeInterfaceToken(IActivityManager.descriptor);
5221 data.writeInt(taskId);
5222 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5223 reply.readException();
5224 data.recycle();
5225 reply.recycle();
5226 }
5227
5228 @Override
5229 public void startLockTaskMode(IBinder token) throws RemoteException {
5230 Parcel data = Parcel.obtain();
5231 Parcel reply = Parcel.obtain();
5232 data.writeInterfaceToken(IActivityManager.descriptor);
5233 data.writeStrongBinder(token);
5234 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5235 reply.readException();
5236 data.recycle();
5237 reply.recycle();
5238 }
5239
5240 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005241 public void startLockTaskModeOnCurrent() throws RemoteException {
5242 Parcel data = Parcel.obtain();
5243 Parcel reply = Parcel.obtain();
5244 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005245 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005246 reply.readException();
5247 data.recycle();
5248 reply.recycle();
5249 }
5250
5251 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005252 public void stopLockTaskMode() throws RemoteException {
5253 Parcel data = Parcel.obtain();
5254 Parcel reply = Parcel.obtain();
5255 data.writeInterfaceToken(IActivityManager.descriptor);
5256 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5257 reply.readException();
5258 data.recycle();
5259 reply.recycle();
5260 }
5261
5262 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005263 public void stopLockTaskModeOnCurrent() throws RemoteException {
5264 Parcel data = Parcel.obtain();
5265 Parcel reply = Parcel.obtain();
5266 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005267 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005268 reply.readException();
5269 data.recycle();
5270 reply.recycle();
5271 }
5272
5273 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005274 public boolean isInLockTaskMode() throws RemoteException {
5275 Parcel data = Parcel.obtain();
5276 Parcel reply = Parcel.obtain();
5277 data.writeInterfaceToken(IActivityManager.descriptor);
5278 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5279 reply.readException();
5280 boolean isInLockTaskMode = reply.readInt() == 1;
5281 data.recycle();
5282 reply.recycle();
5283 return isInLockTaskMode;
5284 }
5285
Craig Mautner688b5102014-03-27 16:55:03 -07005286 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005287 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005288 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005289 Parcel data = Parcel.obtain();
5290 Parcel reply = Parcel.obtain();
5291 data.writeInterfaceToken(IActivityManager.descriptor);
5292 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005293 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005294 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005295 reply.readException();
5296 data.recycle();
5297 reply.recycle();
5298 }
5299
Craig Mautneree2e45a2014-06-27 12:10:03 -07005300 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005301 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5302 Parcel data = Parcel.obtain();
5303 Parcel reply = Parcel.obtain();
5304 data.writeInterfaceToken(IActivityManager.descriptor);
5305 data.writeString(filename);
5306 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5307 reply.readException();
5308 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5309 data.recycle();
5310 reply.recycle();
5311 return icon;
5312 }
5313
5314 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005315 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5316 throws RemoteException {
5317 Parcel data = Parcel.obtain();
5318 Parcel reply = Parcel.obtain();
5319 data.writeInterfaceToken(IActivityManager.descriptor);
5320 if (options == null) {
5321 data.writeInt(0);
5322 } else {
5323 data.writeInt(1);
5324 data.writeBundle(options.toBundle());
5325 }
5326 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5327 reply.readException();
5328 data.recycle();
5329 reply.recycle();
5330 }
5331
5332 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005333 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005334 Parcel data = Parcel.obtain();
5335 Parcel reply = Parcel.obtain();
5336 data.writeInterfaceToken(IActivityManager.descriptor);
5337 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005338 data.writeInt(visible ? 1 : 0);
5339 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005340 reply.readException();
5341 boolean success = reply.readInt() > 0;
5342 data.recycle();
5343 reply.recycle();
5344 return success;
5345 }
5346
5347 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005348 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005349 Parcel data = Parcel.obtain();
5350 Parcel reply = Parcel.obtain();
5351 data.writeInterfaceToken(IActivityManager.descriptor);
5352 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005353 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005354 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005355 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005356 data.recycle();
5357 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005358 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005359 }
5360
5361 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005362 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005363 Parcel data = Parcel.obtain();
5364 Parcel reply = Parcel.obtain();
5365 data.writeInterfaceToken(IActivityManager.descriptor);
5366 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005367 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5368 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005369 reply.readException();
5370 data.recycle();
5371 reply.recycle();
5372 }
5373
5374 @Override
5375 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5376 Parcel data = Parcel.obtain();
5377 Parcel reply = Parcel.obtain();
5378 data.writeInterfaceToken(IActivityManager.descriptor);
5379 data.writeStrongBinder(token);
5380 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5381 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005382 reply.readException();
5383 data.recycle();
5384 reply.recycle();
5385 }
5386
Craig Mautner8746a472014-07-24 15:12:54 -07005387 @Override
5388 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5389 Parcel data = Parcel.obtain();
5390 Parcel reply = Parcel.obtain();
5391 data.writeInterfaceToken(IActivityManager.descriptor);
5392 data.writeStrongBinder(token);
5393 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5394 IBinder.FLAG_ONEWAY);
5395 reply.readException();
5396 data.recycle();
5397 reply.recycle();
5398 }
5399
Craig Mautner6e2f3952014-09-09 14:26:41 -07005400 @Override
5401 public void bootAnimationComplete() throws RemoteException {
5402 Parcel data = Parcel.obtain();
5403 Parcel reply = Parcel.obtain();
5404 data.writeInterfaceToken(IActivityManager.descriptor);
5405 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5406 reply.readException();
5407 data.recycle();
5408 reply.recycle();
5409 }
5410
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005411 private IBinder mRemote;
5412}