blob: 4e2ff0bdb54f386d59671f0c58b932dfc434c342 [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();
1887 int fl = data.readInt();
1888 boolean result = removeTask(taskId, fl);
1889 reply.writeNoException();
1890 reply.writeInt(result ? 1 : 0);
1891 return true;
1892 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001893
Jeff Sharkeya4620792011-05-20 15:29:23 -07001894 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1895 data.enforceInterface(IActivityManager.descriptor);
1896 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1897 data.readStrongBinder());
1898 registerProcessObserver(observer);
1899 return true;
1900 }
1901
1902 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1903 data.enforceInterface(IActivityManager.descriptor);
1904 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1905 data.readStrongBinder());
1906 unregisterProcessObserver(observer);
1907 return true;
1908 }
1909
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001910 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1911 {
1912 data.enforceInterface(IActivityManager.descriptor);
1913 String pkg = data.readString();
1914 boolean ask = getPackageAskScreenCompat(pkg);
1915 reply.writeNoException();
1916 reply.writeInt(ask ? 1 : 0);
1917 return true;
1918 }
1919
1920 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1921 {
1922 data.enforceInterface(IActivityManager.descriptor);
1923 String pkg = data.readString();
1924 boolean ask = data.readInt() != 0;
1925 setPackageAskScreenCompat(pkg, ask);
1926 reply.writeNoException();
1927 return true;
1928 }
1929
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001930 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1931 data.enforceInterface(IActivityManager.descriptor);
1932 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07001933 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001934 boolean res = isIntentSenderTargetedToPackage(r);
1935 reply.writeNoException();
1936 reply.writeInt(res ? 1 : 0);
1937 return true;
1938 }
1939
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001940 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1941 data.enforceInterface(IActivityManager.descriptor);
1942 IIntentSender r = IIntentSender.Stub.asInterface(
1943 data.readStrongBinder());
1944 boolean res = isIntentSenderAnActivity(r);
1945 reply.writeNoException();
1946 reply.writeInt(res ? 1 : 0);
1947 return true;
1948 }
1949
Dianne Hackborn81038902012-11-26 17:04:09 -08001950 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1951 data.enforceInterface(IActivityManager.descriptor);
1952 IIntentSender r = IIntentSender.Stub.asInterface(
1953 data.readStrongBinder());
1954 Intent intent = getIntentForIntentSender(r);
1955 reply.writeNoException();
1956 if (intent != null) {
1957 reply.writeInt(1);
1958 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1959 } else {
1960 reply.writeInt(0);
1961 }
1962 return true;
1963 }
1964
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001965 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1966 data.enforceInterface(IActivityManager.descriptor);
1967 IIntentSender r = IIntentSender.Stub.asInterface(
1968 data.readStrongBinder());
1969 String prefix = data.readString();
1970 String tag = getTagForIntentSender(r, prefix);
1971 reply.writeNoException();
1972 reply.writeString(tag);
1973 return true;
1974 }
1975
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001976 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1977 data.enforceInterface(IActivityManager.descriptor);
1978 Configuration config = Configuration.CREATOR.createFromParcel(data);
1979 updatePersistentConfiguration(config);
1980 reply.writeNoException();
1981 return true;
1982 }
1983
Dianne Hackbornb437e092011-08-05 17:50:29 -07001984 case GET_PROCESS_PSS_TRANSACTION: {
1985 data.enforceInterface(IActivityManager.descriptor);
1986 int[] pids = data.createIntArray();
1987 long[] pss = getProcessPss(pids);
1988 reply.writeNoException();
1989 reply.writeLongArray(pss);
1990 return true;
1991 }
1992
Dianne Hackborn661cd522011-08-22 00:26:20 -07001993 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1994 data.enforceInterface(IActivityManager.descriptor);
1995 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1996 boolean always = data.readInt() != 0;
1997 showBootMessage(msg, always);
1998 reply.writeNoException();
1999 return true;
2000 }
2001
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002002 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002003 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002004 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002005 reply.writeNoException();
2006 return true;
2007 }
2008
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002009 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002010 data.enforceInterface(IActivityManager.descriptor);
2011 IBinder token = data.readStrongBinder();
2012 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002013 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002014 reply.writeNoException();
2015 reply.writeInt(res ? 1 : 0);
2016 return true;
2017 }
2018
2019 case NAVIGATE_UP_TO_TRANSACTION: {
2020 data.enforceInterface(IActivityManager.descriptor);
2021 IBinder token = data.readStrongBinder();
2022 Intent target = Intent.CREATOR.createFromParcel(data);
2023 int resultCode = data.readInt();
2024 Intent resultData = null;
2025 if (data.readInt() != 0) {
2026 resultData = Intent.CREATOR.createFromParcel(data);
2027 }
2028 boolean res = navigateUpTo(token, target, resultCode, resultData);
2029 reply.writeNoException();
2030 reply.writeInt(res ? 1 : 0);
2031 return true;
2032 }
2033
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002034 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2035 data.enforceInterface(IActivityManager.descriptor);
2036 IBinder token = data.readStrongBinder();
2037 int res = getLaunchedFromUid(token);
2038 reply.writeNoException();
2039 reply.writeInt(res);
2040 return true;
2041 }
2042
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002043 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2044 data.enforceInterface(IActivityManager.descriptor);
2045 IBinder token = data.readStrongBinder();
2046 String res = getLaunchedFromPackage(token);
2047 reply.writeNoException();
2048 reply.writeString(res);
2049 return true;
2050 }
2051
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002052 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2053 data.enforceInterface(IActivityManager.descriptor);
2054 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2055 data.readStrongBinder());
2056 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002057 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002058 return true;
2059 }
2060
2061 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2062 data.enforceInterface(IActivityManager.descriptor);
2063 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2064 data.readStrongBinder());
2065 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002066 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002067 return true;
2068 }
2069
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002070 case REQUEST_BUG_REPORT_TRANSACTION: {
2071 data.enforceInterface(IActivityManager.descriptor);
2072 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002073 reply.writeNoException();
2074 return true;
2075 }
2076
2077 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2078 data.enforceInterface(IActivityManager.descriptor);
2079 int pid = data.readInt();
2080 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002081 String reason = data.readString();
2082 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002083 reply.writeNoException();
2084 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002085 return true;
2086 }
2087
Adam Skorydfc7fd72013-08-05 19:23:41 -07002088 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002089 data.enforceInterface(IActivityManager.descriptor);
2090 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002091 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002092 reply.writeNoException();
2093 reply.writeBundle(res);
2094 return true;
2095 }
2096
Adam Skorydfc7fd72013-08-05 19:23:41 -07002097 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002098 data.enforceInterface(IActivityManager.descriptor);
2099 IBinder token = data.readStrongBinder();
2100 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002101 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002102 reply.writeNoException();
2103 return true;
2104 }
2105
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002106 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2107 data.enforceInterface(IActivityManager.descriptor);
2108 Intent intent = Intent.CREATOR.createFromParcel(data);
2109 int requestType = data.readInt();
2110 String hint = data.readString();
2111 int userHandle = data.readInt();
2112 boolean res = launchAssistIntent(intent, requestType, hint, userHandle);
2113 reply.writeNoException();
2114 reply.writeInt(res ? 1 : 0);
2115 return true;
2116 }
2117
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002118 case KILL_UID_TRANSACTION: {
2119 data.enforceInterface(IActivityManager.descriptor);
2120 int uid = data.readInt();
2121 String reason = data.readString();
2122 killUid(uid, reason);
2123 reply.writeNoException();
2124 return true;
2125 }
2126
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002127 case HANG_TRANSACTION: {
2128 data.enforceInterface(IActivityManager.descriptor);
2129 IBinder who = data.readStrongBinder();
2130 boolean allowRestart = data.readInt() != 0;
2131 hang(who, allowRestart);
2132 reply.writeNoException();
2133 return true;
2134 }
2135
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002136 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2137 data.enforceInterface(IActivityManager.descriptor);
2138 IBinder token = data.readStrongBinder();
2139 reportActivityFullyDrawn(token);
2140 reply.writeNoException();
2141 return true;
2142 }
2143
Craig Mautner5eda9b32013-07-02 11:58:16 -07002144 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2145 data.enforceInterface(IActivityManager.descriptor);
2146 IBinder token = data.readStrongBinder();
2147 notifyActivityDrawn(token);
2148 reply.writeNoException();
2149 return true;
2150 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002151
2152 case RESTART_TRANSACTION: {
2153 data.enforceInterface(IActivityManager.descriptor);
2154 restart();
2155 reply.writeNoException();
2156 return true;
2157 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002158
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002159 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2160 data.enforceInterface(IActivityManager.descriptor);
2161 performIdleMaintenance();
2162 reply.writeNoException();
2163 return true;
2164 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002165
2166 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2167 data.enforceInterface(IActivityManager.descriptor);
2168 IBinder parentActivityToken = data.readStrongBinder();
2169 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002170 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002171 IActivityContainer activityContainer =
2172 createActivityContainer(parentActivityToken, callback);
2173 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002174 if (activityContainer != null) {
2175 reply.writeInt(1);
2176 reply.writeStrongBinder(activityContainer.asBinder());
2177 } else {
2178 reply.writeInt(0);
2179 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002180 return true;
2181 }
2182
Craig Mautner95da1082014-02-24 17:54:35 -08002183 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2184 data.enforceInterface(IActivityManager.descriptor);
2185 IActivityContainer activityContainer =
2186 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2187 deleteActivityContainer(activityContainer);
2188 reply.writeNoException();
2189 return true;
2190 }
2191
Craig Mautnere0a38842013-12-16 16:14:02 -08002192 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2193 data.enforceInterface(IActivityManager.descriptor);
2194 IBinder activityToken = data.readStrongBinder();
2195 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2196 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002197 if (activityContainer != null) {
2198 reply.writeInt(1);
2199 reply.writeStrongBinder(activityContainer.asBinder());
2200 } else {
2201 reply.writeInt(0);
2202 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002203 return true;
2204 }
2205
Craig Mautner4a1cb222013-12-04 16:14:06 -08002206 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2207 data.enforceInterface(IActivityManager.descriptor);
2208 IBinder homeActivityToken = getHomeActivityToken();
2209 reply.writeNoException();
2210 reply.writeStrongBinder(homeActivityToken);
2211 return true;
2212 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002213
2214 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2215 data.enforceInterface(IActivityManager.descriptor);
2216 final int taskId = data.readInt();
2217 startLockTaskMode(taskId);
2218 reply.writeNoException();
2219 return true;
2220 }
2221
2222 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2223 data.enforceInterface(IActivityManager.descriptor);
2224 IBinder token = data.readStrongBinder();
2225 startLockTaskMode(token);
2226 reply.writeNoException();
2227 return true;
2228 }
2229
Craig Mautnerd61dc202014-07-07 11:09:11 -07002230 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002231 data.enforceInterface(IActivityManager.descriptor);
2232 startLockTaskModeOnCurrent();
2233 reply.writeNoException();
2234 return true;
2235 }
2236
Craig Mautneraea74a52014-03-08 14:23:10 -08002237 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2238 data.enforceInterface(IActivityManager.descriptor);
2239 stopLockTaskMode();
2240 reply.writeNoException();
2241 return true;
2242 }
2243
Craig Mautnerd61dc202014-07-07 11:09:11 -07002244 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002245 data.enforceInterface(IActivityManager.descriptor);
2246 stopLockTaskModeOnCurrent();
2247 reply.writeNoException();
2248 return true;
2249 }
2250
Craig Mautneraea74a52014-03-08 14:23:10 -08002251 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2252 data.enforceInterface(IActivityManager.descriptor);
2253 final boolean isInLockTaskMode = isInLockTaskMode();
2254 reply.writeNoException();
2255 reply.writeInt(isInLockTaskMode ? 1 : 0);
2256 return true;
2257 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002258
Winson Chunga449dc02014-05-16 11:15:04 -07002259 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002260 data.enforceInterface(IActivityManager.descriptor);
2261 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002262 ActivityManager.TaskDescription values =
2263 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2264 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002265 reply.writeNoException();
2266 return true;
2267 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002268
Craig Mautner648f69b2014-09-18 14:16:26 -07002269 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2270 data.enforceInterface(IActivityManager.descriptor);
2271 String filename = data.readString();
2272 Bitmap icon = getTaskDescriptionIcon(filename);
2273 reply.writeNoException();
2274 if (icon == null) {
2275 reply.writeInt(0);
2276 } else {
2277 reply.writeInt(1);
2278 icon.writeToParcel(reply, 0);
2279 }
2280 return true;
2281 }
2282
Jose Lima4b6c6692014-08-12 17:41:12 -07002283 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002284 data.enforceInterface(IActivityManager.descriptor);
2285 IBinder token = data.readStrongBinder();
2286 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002287 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002288 reply.writeNoException();
2289 reply.writeInt(success ? 1 : 0);
2290 return true;
2291 }
2292
Jose Lima4b6c6692014-08-12 17:41:12 -07002293 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002294 data.enforceInterface(IActivityManager.descriptor);
2295 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002296 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002297 reply.writeNoException();
2298 reply.writeInt(enabled ? 1 : 0);
2299 return true;
2300 }
2301
Jose Lima4b6c6692014-08-12 17:41:12 -07002302 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002303 data.enforceInterface(IActivityManager.descriptor);
2304 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002305 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002306 reply.writeNoException();
2307 return true;
2308 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002309
2310 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2311 data.enforceInterface(IActivityManager.descriptor);
2312 IBinder token = data.readStrongBinder();
2313 notifyLaunchTaskBehindComplete(token);
2314 reply.writeNoException();
2315 return true;
2316 }
Craig Mautner8746a472014-07-24 15:12:54 -07002317
2318 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2319 data.enforceInterface(IActivityManager.descriptor);
2320 IBinder token = data.readStrongBinder();
2321 notifyEnterAnimationComplete(token);
2322 reply.writeNoException();
2323 return true;
2324 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002325
2326 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2327 data.enforceInterface(IActivityManager.descriptor);
2328 bootAnimationComplete();
2329 reply.writeNoException();
2330 return true;
2331 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002332 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002333
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002334 return super.onTransact(code, data, reply, flags);
2335 }
2336
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002337 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002338 return this;
2339 }
2340
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002341 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2342 protected IActivityManager create() {
2343 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002344 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002345 Log.v("ActivityManager", "default service binder = " + b);
2346 }
2347 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002348 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002349 Log.v("ActivityManager", "default service = " + am);
2350 }
2351 return am;
2352 }
2353 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002354}
2355
2356class ActivityManagerProxy implements IActivityManager
2357{
2358 public ActivityManagerProxy(IBinder remote)
2359 {
2360 mRemote = remote;
2361 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002362
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002363 public IBinder asBinder()
2364 {
2365 return mRemote;
2366 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002367
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002368 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002369 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002370 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002371 Parcel data = Parcel.obtain();
2372 Parcel reply = Parcel.obtain();
2373 data.writeInterfaceToken(IActivityManager.descriptor);
2374 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002375 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002376 intent.writeToParcel(data, 0);
2377 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002378 data.writeStrongBinder(resultTo);
2379 data.writeString(resultWho);
2380 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002381 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002382 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002383 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002384 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002385 } else {
2386 data.writeInt(0);
2387 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002388 if (options != null) {
2389 data.writeInt(1);
2390 options.writeToParcel(data, 0);
2391 } else {
2392 data.writeInt(0);
2393 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002394 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2395 reply.readException();
2396 int result = reply.readInt();
2397 reply.recycle();
2398 data.recycle();
2399 return result;
2400 }
Amith Yamasani82644082012-08-03 13:09:11 -07002401
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002402 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002403 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002404 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2405 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002406 Parcel data = Parcel.obtain();
2407 Parcel reply = Parcel.obtain();
2408 data.writeInterfaceToken(IActivityManager.descriptor);
2409 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002410 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002411 intent.writeToParcel(data, 0);
2412 data.writeString(resolvedType);
2413 data.writeStrongBinder(resultTo);
2414 data.writeString(resultWho);
2415 data.writeInt(requestCode);
2416 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002417 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002418 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002419 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002420 } else {
2421 data.writeInt(0);
2422 }
2423 if (options != null) {
2424 data.writeInt(1);
2425 options.writeToParcel(data, 0);
2426 } else {
2427 data.writeInt(0);
2428 }
2429 data.writeInt(userId);
2430 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2431 reply.readException();
2432 int result = reply.readInt();
2433 reply.recycle();
2434 data.recycle();
2435 return result;
2436 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002437 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2438 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002439 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002440 Parcel data = Parcel.obtain();
2441 Parcel reply = Parcel.obtain();
2442 data.writeInterfaceToken(IActivityManager.descriptor);
2443 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2444 data.writeString(callingPackage);
2445 intent.writeToParcel(data, 0);
2446 data.writeString(resolvedType);
2447 data.writeStrongBinder(resultTo);
2448 data.writeString(resultWho);
2449 data.writeInt(requestCode);
2450 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002451 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002452 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002453 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002454 } else {
2455 data.writeInt(0);
2456 }
2457 if (options != null) {
2458 data.writeInt(1);
2459 options.writeToParcel(data, 0);
2460 } else {
2461 data.writeInt(0);
2462 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002463 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002464 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2465 reply.readException();
2466 int result = reply.readInt();
2467 reply.recycle();
2468 data.recycle();
2469 return result;
2470 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002471 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2472 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002473 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2474 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002475 Parcel data = Parcel.obtain();
2476 Parcel reply = Parcel.obtain();
2477 data.writeInterfaceToken(IActivityManager.descriptor);
2478 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002479 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002480 intent.writeToParcel(data, 0);
2481 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002482 data.writeStrongBinder(resultTo);
2483 data.writeString(resultWho);
2484 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002485 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002486 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002487 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002488 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002489 } else {
2490 data.writeInt(0);
2491 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002492 if (options != null) {
2493 data.writeInt(1);
2494 options.writeToParcel(data, 0);
2495 } else {
2496 data.writeInt(0);
2497 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002498 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002499 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2500 reply.readException();
2501 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2502 reply.recycle();
2503 data.recycle();
2504 return result;
2505 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002506 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2507 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002508 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002509 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002510 Parcel data = Parcel.obtain();
2511 Parcel reply = Parcel.obtain();
2512 data.writeInterfaceToken(IActivityManager.descriptor);
2513 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002514 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002515 intent.writeToParcel(data, 0);
2516 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002517 data.writeStrongBinder(resultTo);
2518 data.writeString(resultWho);
2519 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002520 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002521 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002522 if (options != null) {
2523 data.writeInt(1);
2524 options.writeToParcel(data, 0);
2525 } else {
2526 data.writeInt(0);
2527 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002528 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002529 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2530 reply.readException();
2531 int result = reply.readInt();
2532 reply.recycle();
2533 data.recycle();
2534 return result;
2535 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002536 public int startActivityIntentSender(IApplicationThread caller,
2537 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002538 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002539 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002540 Parcel data = Parcel.obtain();
2541 Parcel reply = Parcel.obtain();
2542 data.writeInterfaceToken(IActivityManager.descriptor);
2543 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2544 intent.writeToParcel(data, 0);
2545 if (fillInIntent != null) {
2546 data.writeInt(1);
2547 fillInIntent.writeToParcel(data, 0);
2548 } else {
2549 data.writeInt(0);
2550 }
2551 data.writeString(resolvedType);
2552 data.writeStrongBinder(resultTo);
2553 data.writeString(resultWho);
2554 data.writeInt(requestCode);
2555 data.writeInt(flagsMask);
2556 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002557 if (options != null) {
2558 data.writeInt(1);
2559 options.writeToParcel(data, 0);
2560 } else {
2561 data.writeInt(0);
2562 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002563 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002564 reply.readException();
2565 int result = reply.readInt();
2566 reply.recycle();
2567 data.recycle();
2568 return result;
2569 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002570 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2571 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002572 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2573 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002574 Parcel data = Parcel.obtain();
2575 Parcel reply = Parcel.obtain();
2576 data.writeInterfaceToken(IActivityManager.descriptor);
2577 data.writeString(callingPackage);
2578 data.writeInt(callingPid);
2579 data.writeInt(callingUid);
2580 intent.writeToParcel(data, 0);
2581 data.writeString(resolvedType);
2582 data.writeStrongBinder(session.asBinder());
2583 data.writeStrongBinder(interactor.asBinder());
2584 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002585 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002586 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002587 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002588 } else {
2589 data.writeInt(0);
2590 }
2591 if (options != null) {
2592 data.writeInt(1);
2593 options.writeToParcel(data, 0);
2594 } else {
2595 data.writeInt(0);
2596 }
2597 data.writeInt(userId);
2598 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2599 reply.readException();
2600 int result = reply.readInt();
2601 reply.recycle();
2602 data.recycle();
2603 return result;
2604 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002605 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002606 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002607 Parcel data = Parcel.obtain();
2608 Parcel reply = Parcel.obtain();
2609 data.writeInterfaceToken(IActivityManager.descriptor);
2610 data.writeStrongBinder(callingActivity);
2611 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002612 if (options != null) {
2613 data.writeInt(1);
2614 options.writeToParcel(data, 0);
2615 } else {
2616 data.writeInt(0);
2617 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002618 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2619 reply.readException();
2620 int result = reply.readInt();
2621 reply.recycle();
2622 data.recycle();
2623 return result != 0;
2624 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002625 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2626 Parcel data = Parcel.obtain();
2627 Parcel reply = Parcel.obtain();
2628 data.writeInterfaceToken(IActivityManager.descriptor);
2629 data.writeInt(taskId);
2630 if (options == null) {
2631 data.writeInt(0);
2632 } else {
2633 data.writeInt(1);
2634 options.writeToParcel(data, 0);
2635 }
2636 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2637 reply.readException();
2638 int result = reply.readInt();
2639 reply.recycle();
2640 data.recycle();
2641 return result;
2642 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002643 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002644 throws RemoteException {
2645 Parcel data = Parcel.obtain();
2646 Parcel reply = Parcel.obtain();
2647 data.writeInterfaceToken(IActivityManager.descriptor);
2648 data.writeStrongBinder(token);
2649 data.writeInt(resultCode);
2650 if (resultData != null) {
2651 data.writeInt(1);
2652 resultData.writeToParcel(data, 0);
2653 } else {
2654 data.writeInt(0);
2655 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002656 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002657 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2658 reply.readException();
2659 boolean res = reply.readInt() != 0;
2660 data.recycle();
2661 reply.recycle();
2662 return res;
2663 }
2664 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2665 {
2666 Parcel data = Parcel.obtain();
2667 Parcel reply = Parcel.obtain();
2668 data.writeInterfaceToken(IActivityManager.descriptor);
2669 data.writeStrongBinder(token);
2670 data.writeString(resultWho);
2671 data.writeInt(requestCode);
2672 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2673 reply.readException();
2674 data.recycle();
2675 reply.recycle();
2676 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002677 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2678 Parcel data = Parcel.obtain();
2679 Parcel reply = Parcel.obtain();
2680 data.writeInterfaceToken(IActivityManager.descriptor);
2681 data.writeStrongBinder(token);
2682 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2683 reply.readException();
2684 boolean res = reply.readInt() != 0;
2685 data.recycle();
2686 reply.recycle();
2687 return res;
2688 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002689 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2690 Parcel data = Parcel.obtain();
2691 Parcel reply = Parcel.obtain();
2692 data.writeInterfaceToken(IActivityManager.descriptor);
2693 data.writeStrongBinder(session.asBinder());
2694 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2695 reply.readException();
2696 data.recycle();
2697 reply.recycle();
2698 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002699 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2700 Parcel data = Parcel.obtain();
2701 Parcel reply = Parcel.obtain();
2702 data.writeInterfaceToken(IActivityManager.descriptor);
2703 data.writeStrongBinder(token);
2704 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2705 reply.readException();
2706 boolean res = reply.readInt() != 0;
2707 data.recycle();
2708 reply.recycle();
2709 return res;
2710 }
2711 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2712 Parcel data = Parcel.obtain();
2713 Parcel reply = Parcel.obtain();
2714 data.writeInterfaceToken(IActivityManager.descriptor);
2715 data.writeStrongBinder(app.asBinder());
2716 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2717 reply.readException();
2718 data.recycle();
2719 reply.recycle();
2720 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002721 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2722 Parcel data = Parcel.obtain();
2723 Parcel reply = Parcel.obtain();
2724 data.writeInterfaceToken(IActivityManager.descriptor);
2725 data.writeStrongBinder(token);
2726 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2727 reply.readException();
2728 boolean res = reply.readInt() != 0;
2729 data.recycle();
2730 reply.recycle();
2731 return res;
2732 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002733 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002734 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002735 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002736 {
2737 Parcel data = Parcel.obtain();
2738 Parcel reply = Parcel.obtain();
2739 data.writeInterfaceToken(IActivityManager.descriptor);
2740 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002741 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002742 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2743 filter.writeToParcel(data, 0);
2744 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002745 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002746 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2747 reply.readException();
2748 Intent intent = null;
2749 int haveIntent = reply.readInt();
2750 if (haveIntent != 0) {
2751 intent = Intent.CREATOR.createFromParcel(reply);
2752 }
2753 reply.recycle();
2754 data.recycle();
2755 return intent;
2756 }
2757 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2758 {
2759 Parcel data = Parcel.obtain();
2760 Parcel reply = Parcel.obtain();
2761 data.writeInterfaceToken(IActivityManager.descriptor);
2762 data.writeStrongBinder(receiver.asBinder());
2763 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2764 reply.readException();
2765 data.recycle();
2766 reply.recycle();
2767 }
2768 public int broadcastIntent(IApplicationThread caller,
2769 Intent intent, String resolvedType, IIntentReceiver resultTo,
2770 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002771 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002772 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002773 {
2774 Parcel data = Parcel.obtain();
2775 Parcel reply = Parcel.obtain();
2776 data.writeInterfaceToken(IActivityManager.descriptor);
2777 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2778 intent.writeToParcel(data, 0);
2779 data.writeString(resolvedType);
2780 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2781 data.writeInt(resultCode);
2782 data.writeString(resultData);
2783 data.writeBundle(map);
2784 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002785 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002786 data.writeInt(serialized ? 1 : 0);
2787 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002788 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002789 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2790 reply.readException();
2791 int res = reply.readInt();
2792 reply.recycle();
2793 data.recycle();
2794 return res;
2795 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002796 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2797 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002798 {
2799 Parcel data = Parcel.obtain();
2800 Parcel reply = Parcel.obtain();
2801 data.writeInterfaceToken(IActivityManager.descriptor);
2802 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2803 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002804 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002805 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2806 reply.readException();
2807 data.recycle();
2808 reply.recycle();
2809 }
2810 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2811 {
2812 Parcel data = Parcel.obtain();
2813 Parcel reply = Parcel.obtain();
2814 data.writeInterfaceToken(IActivityManager.descriptor);
2815 data.writeStrongBinder(who);
2816 data.writeInt(resultCode);
2817 data.writeString(resultData);
2818 data.writeBundle(map);
2819 data.writeInt(abortBroadcast ? 1 : 0);
2820 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2821 reply.readException();
2822 data.recycle();
2823 reply.recycle();
2824 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002825 public void attachApplication(IApplicationThread app) throws RemoteException
2826 {
2827 Parcel data = Parcel.obtain();
2828 Parcel reply = Parcel.obtain();
2829 data.writeInterfaceToken(IActivityManager.descriptor);
2830 data.writeStrongBinder(app.asBinder());
2831 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2832 reply.readException();
2833 data.recycle();
2834 reply.recycle();
2835 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002836 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2837 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002838 {
2839 Parcel data = Parcel.obtain();
2840 Parcel reply = Parcel.obtain();
2841 data.writeInterfaceToken(IActivityManager.descriptor);
2842 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002843 if (config != null) {
2844 data.writeInt(1);
2845 config.writeToParcel(data, 0);
2846 } else {
2847 data.writeInt(0);
2848 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002849 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002850 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2851 reply.readException();
2852 data.recycle();
2853 reply.recycle();
2854 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002855 public void activityResumed(IBinder token) throws RemoteException
2856 {
2857 Parcel data = Parcel.obtain();
2858 Parcel reply = Parcel.obtain();
2859 data.writeInterfaceToken(IActivityManager.descriptor);
2860 data.writeStrongBinder(token);
2861 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2862 reply.readException();
2863 data.recycle();
2864 reply.recycle();
2865 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07002866 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002867 {
2868 Parcel data = Parcel.obtain();
2869 Parcel reply = Parcel.obtain();
2870 data.writeInterfaceToken(IActivityManager.descriptor);
2871 data.writeStrongBinder(token);
2872 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2873 reply.readException();
2874 data.recycle();
2875 reply.recycle();
2876 }
2877 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002878 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002879 {
2880 Parcel data = Parcel.obtain();
2881 Parcel reply = Parcel.obtain();
2882 data.writeInterfaceToken(IActivityManager.descriptor);
2883 data.writeStrongBinder(token);
2884 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002885 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002886 TextUtils.writeToParcel(description, data, 0);
2887 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2888 reply.readException();
2889 data.recycle();
2890 reply.recycle();
2891 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002892 public void activitySlept(IBinder token) throws RemoteException
2893 {
2894 Parcel data = Parcel.obtain();
2895 Parcel reply = Parcel.obtain();
2896 data.writeInterfaceToken(IActivityManager.descriptor);
2897 data.writeStrongBinder(token);
2898 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2899 reply.readException();
2900 data.recycle();
2901 reply.recycle();
2902 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002903 public void activityDestroyed(IBinder token) throws RemoteException
2904 {
2905 Parcel data = Parcel.obtain();
2906 Parcel reply = Parcel.obtain();
2907 data.writeInterfaceToken(IActivityManager.descriptor);
2908 data.writeStrongBinder(token);
2909 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2910 reply.readException();
2911 data.recycle();
2912 reply.recycle();
2913 }
2914 public String getCallingPackage(IBinder token) throws RemoteException
2915 {
2916 Parcel data = Parcel.obtain();
2917 Parcel reply = Parcel.obtain();
2918 data.writeInterfaceToken(IActivityManager.descriptor);
2919 data.writeStrongBinder(token);
2920 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2921 reply.readException();
2922 String res = reply.readString();
2923 data.recycle();
2924 reply.recycle();
2925 return res;
2926 }
2927 public ComponentName getCallingActivity(IBinder token)
2928 throws RemoteException {
2929 Parcel data = Parcel.obtain();
2930 Parcel reply = Parcel.obtain();
2931 data.writeInterfaceToken(IActivityManager.descriptor);
2932 data.writeStrongBinder(token);
2933 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2934 reply.readException();
2935 ComponentName res = ComponentName.readFromParcel(reply);
2936 data.recycle();
2937 reply.recycle();
2938 return res;
2939 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002940 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07002941 Parcel data = Parcel.obtain();
2942 Parcel reply = Parcel.obtain();
2943 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07002944 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07002945 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2946 reply.readException();
2947 ArrayList<IAppTask> list = null;
2948 int N = reply.readInt();
2949 if (N >= 0) {
2950 list = new ArrayList<IAppTask>();
2951 while (N > 0) {
2952 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2953 list.add(task);
2954 N--;
2955 }
2956 }
2957 data.recycle();
2958 reply.recycle();
2959 return list;
2960 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07002961 public int addAppTask(IBinder activityToken, Intent intent,
2962 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
2963 Parcel data = Parcel.obtain();
2964 Parcel reply = Parcel.obtain();
2965 data.writeInterfaceToken(IActivityManager.descriptor);
2966 data.writeStrongBinder(activityToken);
2967 intent.writeToParcel(data, 0);
2968 description.writeToParcel(data, 0);
2969 thumbnail.writeToParcel(data, 0);
2970 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
2971 reply.readException();
2972 int res = reply.readInt();
2973 data.recycle();
2974 reply.recycle();
2975 return res;
2976 }
2977 public Point getAppTaskThumbnailSize() throws RemoteException {
2978 Parcel data = Parcel.obtain();
2979 Parcel reply = Parcel.obtain();
2980 data.writeInterfaceToken(IActivityManager.descriptor);
2981 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
2982 reply.readException();
2983 Point size = Point.CREATOR.createFromParcel(reply);
2984 data.recycle();
2985 reply.recycle();
2986 return size;
2987 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002988 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002989 Parcel data = Parcel.obtain();
2990 Parcel reply = Parcel.obtain();
2991 data.writeInterfaceToken(IActivityManager.descriptor);
2992 data.writeInt(maxNum);
2993 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002994 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2995 reply.readException();
2996 ArrayList list = null;
2997 int N = reply.readInt();
2998 if (N >= 0) {
2999 list = new ArrayList();
3000 while (N > 0) {
3001 ActivityManager.RunningTaskInfo info =
3002 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003003 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003004 list.add(info);
3005 N--;
3006 }
3007 }
3008 data.recycle();
3009 reply.recycle();
3010 return list;
3011 }
3012 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003013 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003014 Parcel data = Parcel.obtain();
3015 Parcel reply = Parcel.obtain();
3016 data.writeInterfaceToken(IActivityManager.descriptor);
3017 data.writeInt(maxNum);
3018 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003019 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003020 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3021 reply.readException();
3022 ArrayList<ActivityManager.RecentTaskInfo> list
3023 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3024 data.recycle();
3025 reply.recycle();
3026 return list;
3027 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003028 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003029 Parcel data = Parcel.obtain();
3030 Parcel reply = Parcel.obtain();
3031 data.writeInterfaceToken(IActivityManager.descriptor);
3032 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003033 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003034 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003035 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003036 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003037 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003038 }
3039 data.recycle();
3040 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003041 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003042 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003043 public List getServices(int maxNum, int flags) throws RemoteException {
3044 Parcel data = Parcel.obtain();
3045 Parcel reply = Parcel.obtain();
3046 data.writeInterfaceToken(IActivityManager.descriptor);
3047 data.writeInt(maxNum);
3048 data.writeInt(flags);
3049 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3050 reply.readException();
3051 ArrayList list = null;
3052 int N = reply.readInt();
3053 if (N >= 0) {
3054 list = new ArrayList();
3055 while (N > 0) {
3056 ActivityManager.RunningServiceInfo info =
3057 ActivityManager.RunningServiceInfo.CREATOR
3058 .createFromParcel(reply);
3059 list.add(info);
3060 N--;
3061 }
3062 }
3063 data.recycle();
3064 reply.recycle();
3065 return list;
3066 }
3067 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3068 throws RemoteException {
3069 Parcel data = Parcel.obtain();
3070 Parcel reply = Parcel.obtain();
3071 data.writeInterfaceToken(IActivityManager.descriptor);
3072 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3073 reply.readException();
3074 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3075 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3076 data.recycle();
3077 reply.recycle();
3078 return list;
3079 }
3080 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3081 throws RemoteException {
3082 Parcel data = Parcel.obtain();
3083 Parcel reply = Parcel.obtain();
3084 data.writeInterfaceToken(IActivityManager.descriptor);
3085 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3086 reply.readException();
3087 ArrayList<ActivityManager.RunningAppProcessInfo> list
3088 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3089 data.recycle();
3090 reply.recycle();
3091 return list;
3092 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003093 public List<ApplicationInfo> getRunningExternalApplications()
3094 throws RemoteException {
3095 Parcel data = Parcel.obtain();
3096 Parcel reply = Parcel.obtain();
3097 data.writeInterfaceToken(IActivityManager.descriptor);
3098 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3099 reply.readException();
3100 ArrayList<ApplicationInfo> list
3101 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3102 data.recycle();
3103 reply.recycle();
3104 return list;
3105 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003106 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003107 {
3108 Parcel data = Parcel.obtain();
3109 Parcel reply = Parcel.obtain();
3110 data.writeInterfaceToken(IActivityManager.descriptor);
3111 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003112 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003113 if (options != null) {
3114 data.writeInt(1);
3115 options.writeToParcel(data, 0);
3116 } else {
3117 data.writeInt(0);
3118 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003119 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3120 reply.readException();
3121 data.recycle();
3122 reply.recycle();
3123 }
3124 public void moveTaskToBack(int task) throws RemoteException
3125 {
3126 Parcel data = Parcel.obtain();
3127 Parcel reply = Parcel.obtain();
3128 data.writeInterfaceToken(IActivityManager.descriptor);
3129 data.writeInt(task);
3130 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3131 reply.readException();
3132 data.recycle();
3133 reply.recycle();
3134 }
3135 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3136 throws RemoteException {
3137 Parcel data = Parcel.obtain();
3138 Parcel reply = Parcel.obtain();
3139 data.writeInterfaceToken(IActivityManager.descriptor);
3140 data.writeStrongBinder(token);
3141 data.writeInt(nonRoot ? 1 : 0);
3142 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3143 reply.readException();
3144 boolean res = reply.readInt() != 0;
3145 data.recycle();
3146 reply.recycle();
3147 return res;
3148 }
3149 public void moveTaskBackwards(int task) throws RemoteException
3150 {
3151 Parcel data = Parcel.obtain();
3152 Parcel reply = Parcel.obtain();
3153 data.writeInterfaceToken(IActivityManager.descriptor);
3154 data.writeInt(task);
3155 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3156 reply.readException();
3157 data.recycle();
3158 reply.recycle();
3159 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003160 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003161 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3162 {
3163 Parcel data = Parcel.obtain();
3164 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003165 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003166 data.writeInt(taskId);
3167 data.writeInt(stackId);
3168 data.writeInt(toTop ? 1 : 0);
3169 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3170 reply.readException();
3171 data.recycle();
3172 reply.recycle();
3173 }
3174 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003175 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003176 {
3177 Parcel data = Parcel.obtain();
3178 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003179 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003180 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003181 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003182 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003183 reply.readException();
3184 data.recycle();
3185 reply.recycle();
3186 }
Craig Mautner967212c2013-04-13 21:10:58 -07003187 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003188 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003189 {
3190 Parcel data = Parcel.obtain();
3191 Parcel reply = Parcel.obtain();
3192 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003193 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003194 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003195 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003196 data.recycle();
3197 reply.recycle();
3198 return list;
3199 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003200 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003201 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003202 {
3203 Parcel data = Parcel.obtain();
3204 Parcel reply = Parcel.obtain();
3205 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003206 data.writeInt(stackId);
3207 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003208 reply.readException();
3209 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003210 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003211 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003212 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003213 }
3214 data.recycle();
3215 reply.recycle();
3216 return info;
3217 }
3218 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003219 public boolean isInHomeStack(int taskId) throws RemoteException {
3220 Parcel data = Parcel.obtain();
3221 Parcel reply = Parcel.obtain();
3222 data.writeInterfaceToken(IActivityManager.descriptor);
3223 data.writeInt(taskId);
3224 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3225 reply.readException();
3226 boolean isInHomeStack = reply.readInt() > 0;
3227 data.recycle();
3228 reply.recycle();
3229 return isInHomeStack;
3230 }
3231 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003232 public void setFocusedStack(int stackId) throws RemoteException
3233 {
3234 Parcel data = Parcel.obtain();
3235 Parcel reply = Parcel.obtain();
3236 data.writeInterfaceToken(IActivityManager.descriptor);
3237 data.writeInt(stackId);
3238 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3239 reply.readException();
3240 data.recycle();
3241 reply.recycle();
3242 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003243 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3244 {
3245 Parcel data = Parcel.obtain();
3246 Parcel reply = Parcel.obtain();
3247 data.writeInterfaceToken(IActivityManager.descriptor);
3248 data.writeStrongBinder(token);
3249 data.writeInt(onlyRoot ? 1 : 0);
3250 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3251 reply.readException();
3252 int res = reply.readInt();
3253 data.recycle();
3254 reply.recycle();
3255 return res;
3256 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003257 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003258 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003259 Parcel data = Parcel.obtain();
3260 Parcel reply = Parcel.obtain();
3261 data.writeInterfaceToken(IActivityManager.descriptor);
3262 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3263 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003264 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003265 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003266 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3267 reply.readException();
3268 int res = reply.readInt();
3269 ContentProviderHolder cph = null;
3270 if (res != 0) {
3271 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3272 }
3273 data.recycle();
3274 reply.recycle();
3275 return cph;
3276 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003277 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3278 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003279 Parcel data = Parcel.obtain();
3280 Parcel reply = Parcel.obtain();
3281 data.writeInterfaceToken(IActivityManager.descriptor);
3282 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003283 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003284 data.writeStrongBinder(token);
3285 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3286 reply.readException();
3287 int res = reply.readInt();
3288 ContentProviderHolder cph = null;
3289 if (res != 0) {
3290 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3291 }
3292 data.recycle();
3293 reply.recycle();
3294 return cph;
3295 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003296 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003297 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003298 {
3299 Parcel data = Parcel.obtain();
3300 Parcel reply = Parcel.obtain();
3301 data.writeInterfaceToken(IActivityManager.descriptor);
3302 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3303 data.writeTypedList(providers);
3304 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3305 reply.readException();
3306 data.recycle();
3307 reply.recycle();
3308 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003309 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3310 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003311 Parcel data = Parcel.obtain();
3312 Parcel reply = Parcel.obtain();
3313 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003314 data.writeStrongBinder(connection);
3315 data.writeInt(stable);
3316 data.writeInt(unstable);
3317 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3318 reply.readException();
3319 boolean res = reply.readInt() != 0;
3320 data.recycle();
3321 reply.recycle();
3322 return res;
3323 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003324
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003325 public void unstableProviderDied(IBinder connection) throws RemoteException {
3326 Parcel data = Parcel.obtain();
3327 Parcel reply = Parcel.obtain();
3328 data.writeInterfaceToken(IActivityManager.descriptor);
3329 data.writeStrongBinder(connection);
3330 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3331 reply.readException();
3332 data.recycle();
3333 reply.recycle();
3334 }
3335
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003336 @Override
3337 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3338 Parcel data = Parcel.obtain();
3339 Parcel reply = Parcel.obtain();
3340 data.writeInterfaceToken(IActivityManager.descriptor);
3341 data.writeStrongBinder(connection);
3342 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3343 reply.readException();
3344 data.recycle();
3345 reply.recycle();
3346 }
3347
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003348 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3349 Parcel data = Parcel.obtain();
3350 Parcel reply = Parcel.obtain();
3351 data.writeInterfaceToken(IActivityManager.descriptor);
3352 data.writeStrongBinder(connection);
3353 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003354 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3355 reply.readException();
3356 data.recycle();
3357 reply.recycle();
3358 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003359
3360 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3361 Parcel data = Parcel.obtain();
3362 Parcel reply = Parcel.obtain();
3363 data.writeInterfaceToken(IActivityManager.descriptor);
3364 data.writeString(name);
3365 data.writeStrongBinder(token);
3366 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3367 reply.readException();
3368 data.recycle();
3369 reply.recycle();
3370 }
3371
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003372 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3373 throws RemoteException
3374 {
3375 Parcel data = Parcel.obtain();
3376 Parcel reply = Parcel.obtain();
3377 data.writeInterfaceToken(IActivityManager.descriptor);
3378 service.writeToParcel(data, 0);
3379 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3380 reply.readException();
3381 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3382 data.recycle();
3383 reply.recycle();
3384 return res;
3385 }
3386
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003387 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003388 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003389 {
3390 Parcel data = Parcel.obtain();
3391 Parcel reply = Parcel.obtain();
3392 data.writeInterfaceToken(IActivityManager.descriptor);
3393 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3394 service.writeToParcel(data, 0);
3395 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003396 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003397 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3398 reply.readException();
3399 ComponentName res = ComponentName.readFromParcel(reply);
3400 data.recycle();
3401 reply.recycle();
3402 return res;
3403 }
3404 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003405 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003406 {
3407 Parcel data = Parcel.obtain();
3408 Parcel reply = Parcel.obtain();
3409 data.writeInterfaceToken(IActivityManager.descriptor);
3410 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3411 service.writeToParcel(data, 0);
3412 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003413 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003414 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3415 reply.readException();
3416 int res = reply.readInt();
3417 reply.recycle();
3418 data.recycle();
3419 return res;
3420 }
3421 public boolean stopServiceToken(ComponentName className, IBinder token,
3422 int startId) throws RemoteException {
3423 Parcel data = Parcel.obtain();
3424 Parcel reply = Parcel.obtain();
3425 data.writeInterfaceToken(IActivityManager.descriptor);
3426 ComponentName.writeToParcel(className, data);
3427 data.writeStrongBinder(token);
3428 data.writeInt(startId);
3429 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3430 reply.readException();
3431 boolean res = reply.readInt() != 0;
3432 data.recycle();
3433 reply.recycle();
3434 return res;
3435 }
3436 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003437 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003438 Parcel data = Parcel.obtain();
3439 Parcel reply = Parcel.obtain();
3440 data.writeInterfaceToken(IActivityManager.descriptor);
3441 ComponentName.writeToParcel(className, data);
3442 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003443 data.writeInt(id);
3444 if (notification != null) {
3445 data.writeInt(1);
3446 notification.writeToParcel(data, 0);
3447 } else {
3448 data.writeInt(0);
3449 }
3450 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003451 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3452 reply.readException();
3453 data.recycle();
3454 reply.recycle();
3455 }
3456 public int bindService(IApplicationThread caller, IBinder token,
3457 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003458 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003459 Parcel data = Parcel.obtain();
3460 Parcel reply = Parcel.obtain();
3461 data.writeInterfaceToken(IActivityManager.descriptor);
3462 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3463 data.writeStrongBinder(token);
3464 service.writeToParcel(data, 0);
3465 data.writeString(resolvedType);
3466 data.writeStrongBinder(connection.asBinder());
3467 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003468 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003469 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3470 reply.readException();
3471 int res = reply.readInt();
3472 data.recycle();
3473 reply.recycle();
3474 return res;
3475 }
3476 public boolean unbindService(IServiceConnection connection) throws RemoteException
3477 {
3478 Parcel data = Parcel.obtain();
3479 Parcel reply = Parcel.obtain();
3480 data.writeInterfaceToken(IActivityManager.descriptor);
3481 data.writeStrongBinder(connection.asBinder());
3482 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3483 reply.readException();
3484 boolean res = reply.readInt() != 0;
3485 data.recycle();
3486 reply.recycle();
3487 return res;
3488 }
3489
3490 public void publishService(IBinder token,
3491 Intent intent, IBinder service) throws RemoteException {
3492 Parcel data = Parcel.obtain();
3493 Parcel reply = Parcel.obtain();
3494 data.writeInterfaceToken(IActivityManager.descriptor);
3495 data.writeStrongBinder(token);
3496 intent.writeToParcel(data, 0);
3497 data.writeStrongBinder(service);
3498 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3499 reply.readException();
3500 data.recycle();
3501 reply.recycle();
3502 }
3503
3504 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3505 throws RemoteException {
3506 Parcel data = Parcel.obtain();
3507 Parcel reply = Parcel.obtain();
3508 data.writeInterfaceToken(IActivityManager.descriptor);
3509 data.writeStrongBinder(token);
3510 intent.writeToParcel(data, 0);
3511 data.writeInt(doRebind ? 1 : 0);
3512 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3513 reply.readException();
3514 data.recycle();
3515 reply.recycle();
3516 }
3517
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003518 public void serviceDoneExecuting(IBinder token, int type, int startId,
3519 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003520 Parcel data = Parcel.obtain();
3521 Parcel reply = Parcel.obtain();
3522 data.writeInterfaceToken(IActivityManager.descriptor);
3523 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003524 data.writeInt(type);
3525 data.writeInt(startId);
3526 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003527 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3528 reply.readException();
3529 data.recycle();
3530 reply.recycle();
3531 }
3532
3533 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3534 Parcel data = Parcel.obtain();
3535 Parcel reply = Parcel.obtain();
3536 data.writeInterfaceToken(IActivityManager.descriptor);
3537 service.writeToParcel(data, 0);
3538 data.writeString(resolvedType);
3539 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3540 reply.readException();
3541 IBinder binder = reply.readStrongBinder();
3542 reply.recycle();
3543 data.recycle();
3544 return binder;
3545 }
3546
Christopher Tate181fafa2009-05-14 11:12:14 -07003547 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3548 throws RemoteException {
3549 Parcel data = Parcel.obtain();
3550 Parcel reply = Parcel.obtain();
3551 data.writeInterfaceToken(IActivityManager.descriptor);
3552 app.writeToParcel(data, 0);
3553 data.writeInt(backupRestoreMode);
3554 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3555 reply.readException();
3556 boolean success = reply.readInt() != 0;
3557 reply.recycle();
3558 data.recycle();
3559 return success;
3560 }
3561
Christopher Tate346acb12012-10-15 19:20:25 -07003562 public void clearPendingBackup() throws RemoteException {
3563 Parcel data = Parcel.obtain();
3564 Parcel reply = Parcel.obtain();
3565 data.writeInterfaceToken(IActivityManager.descriptor);
3566 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3567 reply.recycle();
3568 data.recycle();
3569 }
3570
Christopher Tate181fafa2009-05-14 11:12:14 -07003571 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3572 Parcel data = Parcel.obtain();
3573 Parcel reply = Parcel.obtain();
3574 data.writeInterfaceToken(IActivityManager.descriptor);
3575 data.writeString(packageName);
3576 data.writeStrongBinder(agent);
3577 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3578 reply.recycle();
3579 data.recycle();
3580 }
3581
3582 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3583 Parcel data = Parcel.obtain();
3584 Parcel reply = Parcel.obtain();
3585 data.writeInterfaceToken(IActivityManager.descriptor);
3586 app.writeToParcel(data, 0);
3587 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3588 reply.readException();
3589 reply.recycle();
3590 data.recycle();
3591 }
3592
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003593 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003594 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003595 IUiAutomationConnection connection, int userId, String instructionSet)
3596 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003597 Parcel data = Parcel.obtain();
3598 Parcel reply = Parcel.obtain();
3599 data.writeInterfaceToken(IActivityManager.descriptor);
3600 ComponentName.writeToParcel(className, data);
3601 data.writeString(profileFile);
3602 data.writeInt(flags);
3603 data.writeBundle(arguments);
3604 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003605 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003606 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003607 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003608 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3609 reply.readException();
3610 boolean res = reply.readInt() != 0;
3611 reply.recycle();
3612 data.recycle();
3613 return res;
3614 }
3615
3616 public void finishInstrumentation(IApplicationThread target,
3617 int resultCode, Bundle results) throws RemoteException {
3618 Parcel data = Parcel.obtain();
3619 Parcel reply = Parcel.obtain();
3620 data.writeInterfaceToken(IActivityManager.descriptor);
3621 data.writeStrongBinder(target != null ? target.asBinder() : null);
3622 data.writeInt(resultCode);
3623 data.writeBundle(results);
3624 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3625 reply.readException();
3626 data.recycle();
3627 reply.recycle();
3628 }
3629 public Configuration getConfiguration() throws RemoteException
3630 {
3631 Parcel data = Parcel.obtain();
3632 Parcel reply = Parcel.obtain();
3633 data.writeInterfaceToken(IActivityManager.descriptor);
3634 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3635 reply.readException();
3636 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3637 reply.recycle();
3638 data.recycle();
3639 return res;
3640 }
3641 public void updateConfiguration(Configuration values) throws RemoteException
3642 {
3643 Parcel data = Parcel.obtain();
3644 Parcel reply = Parcel.obtain();
3645 data.writeInterfaceToken(IActivityManager.descriptor);
3646 values.writeToParcel(data, 0);
3647 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3648 reply.readException();
3649 data.recycle();
3650 reply.recycle();
3651 }
3652 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3653 throws RemoteException {
3654 Parcel data = Parcel.obtain();
3655 Parcel reply = Parcel.obtain();
3656 data.writeInterfaceToken(IActivityManager.descriptor);
3657 data.writeStrongBinder(token);
3658 data.writeInt(requestedOrientation);
3659 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3660 reply.readException();
3661 data.recycle();
3662 reply.recycle();
3663 }
3664 public int getRequestedOrientation(IBinder token) throws RemoteException {
3665 Parcel data = Parcel.obtain();
3666 Parcel reply = Parcel.obtain();
3667 data.writeInterfaceToken(IActivityManager.descriptor);
3668 data.writeStrongBinder(token);
3669 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3670 reply.readException();
3671 int res = reply.readInt();
3672 data.recycle();
3673 reply.recycle();
3674 return res;
3675 }
3676 public ComponentName getActivityClassForToken(IBinder token)
3677 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_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3683 reply.readException();
3684 ComponentName res = ComponentName.readFromParcel(reply);
3685 data.recycle();
3686 reply.recycle();
3687 return res;
3688 }
3689 public String getPackageForToken(IBinder token) throws RemoteException
3690 {
3691 Parcel data = Parcel.obtain();
3692 Parcel reply = Parcel.obtain();
3693 data.writeInterfaceToken(IActivityManager.descriptor);
3694 data.writeStrongBinder(token);
3695 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3696 reply.readException();
3697 String res = reply.readString();
3698 data.recycle();
3699 reply.recycle();
3700 return res;
3701 }
3702 public IIntentSender getIntentSender(int type,
3703 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003704 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003705 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003706 Parcel data = Parcel.obtain();
3707 Parcel reply = Parcel.obtain();
3708 data.writeInterfaceToken(IActivityManager.descriptor);
3709 data.writeInt(type);
3710 data.writeString(packageName);
3711 data.writeStrongBinder(token);
3712 data.writeString(resultWho);
3713 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003714 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003715 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003716 data.writeTypedArray(intents, 0);
3717 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003718 } else {
3719 data.writeInt(0);
3720 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003721 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003722 if (options != null) {
3723 data.writeInt(1);
3724 options.writeToParcel(data, 0);
3725 } else {
3726 data.writeInt(0);
3727 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003728 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003729 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3730 reply.readException();
3731 IIntentSender res = IIntentSender.Stub.asInterface(
3732 reply.readStrongBinder());
3733 data.recycle();
3734 reply.recycle();
3735 return res;
3736 }
3737 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3738 Parcel data = Parcel.obtain();
3739 Parcel reply = Parcel.obtain();
3740 data.writeInterfaceToken(IActivityManager.descriptor);
3741 data.writeStrongBinder(sender.asBinder());
3742 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3743 reply.readException();
3744 data.recycle();
3745 reply.recycle();
3746 }
3747 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3748 Parcel data = Parcel.obtain();
3749 Parcel reply = Parcel.obtain();
3750 data.writeInterfaceToken(IActivityManager.descriptor);
3751 data.writeStrongBinder(sender.asBinder());
3752 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3753 reply.readException();
3754 String res = reply.readString();
3755 data.recycle();
3756 reply.recycle();
3757 return res;
3758 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003759 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3760 Parcel data = Parcel.obtain();
3761 Parcel reply = Parcel.obtain();
3762 data.writeInterfaceToken(IActivityManager.descriptor);
3763 data.writeStrongBinder(sender.asBinder());
3764 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3765 reply.readException();
3766 int res = reply.readInt();
3767 data.recycle();
3768 reply.recycle();
3769 return res;
3770 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003771 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3772 boolean requireFull, String name, String callerPackage) throws RemoteException {
3773 Parcel data = Parcel.obtain();
3774 Parcel reply = Parcel.obtain();
3775 data.writeInterfaceToken(IActivityManager.descriptor);
3776 data.writeInt(callingPid);
3777 data.writeInt(callingUid);
3778 data.writeInt(userId);
3779 data.writeInt(allowAll ? 1 : 0);
3780 data.writeInt(requireFull ? 1 : 0);
3781 data.writeString(name);
3782 data.writeString(callerPackage);
3783 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3784 reply.readException();
3785 int res = reply.readInt();
3786 data.recycle();
3787 reply.recycle();
3788 return res;
3789 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003790 public void setProcessLimit(int max) throws RemoteException
3791 {
3792 Parcel data = Parcel.obtain();
3793 Parcel reply = Parcel.obtain();
3794 data.writeInterfaceToken(IActivityManager.descriptor);
3795 data.writeInt(max);
3796 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3797 reply.readException();
3798 data.recycle();
3799 reply.recycle();
3800 }
3801 public int getProcessLimit() throws RemoteException
3802 {
3803 Parcel data = Parcel.obtain();
3804 Parcel reply = Parcel.obtain();
3805 data.writeInterfaceToken(IActivityManager.descriptor);
3806 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3807 reply.readException();
3808 int res = reply.readInt();
3809 data.recycle();
3810 reply.recycle();
3811 return res;
3812 }
3813 public void setProcessForeground(IBinder token, int pid,
3814 boolean isForeground) throws RemoteException {
3815 Parcel data = Parcel.obtain();
3816 Parcel reply = Parcel.obtain();
3817 data.writeInterfaceToken(IActivityManager.descriptor);
3818 data.writeStrongBinder(token);
3819 data.writeInt(pid);
3820 data.writeInt(isForeground ? 1 : 0);
3821 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3822 reply.readException();
3823 data.recycle();
3824 reply.recycle();
3825 }
3826 public int checkPermission(String permission, int pid, int uid)
3827 throws RemoteException {
3828 Parcel data = Parcel.obtain();
3829 Parcel reply = Parcel.obtain();
3830 data.writeInterfaceToken(IActivityManager.descriptor);
3831 data.writeString(permission);
3832 data.writeInt(pid);
3833 data.writeInt(uid);
3834 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3835 reply.readException();
3836 int res = reply.readInt();
3837 data.recycle();
3838 reply.recycle();
3839 return res;
3840 }
3841 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003842 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003843 Parcel data = Parcel.obtain();
3844 Parcel reply = Parcel.obtain();
3845 data.writeInterfaceToken(IActivityManager.descriptor);
3846 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003847 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003848 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003849 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3850 reply.readException();
3851 boolean res = reply.readInt() != 0;
3852 data.recycle();
3853 reply.recycle();
3854 return res;
3855 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003856 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003857 throws RemoteException {
3858 Parcel data = Parcel.obtain();
3859 Parcel reply = Parcel.obtain();
3860 data.writeInterfaceToken(IActivityManager.descriptor);
3861 uri.writeToParcel(data, 0);
3862 data.writeInt(pid);
3863 data.writeInt(uid);
3864 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003865 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003866 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3867 reply.readException();
3868 int res = reply.readInt();
3869 data.recycle();
3870 reply.recycle();
3871 return res;
3872 }
3873 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003874 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003875 Parcel data = Parcel.obtain();
3876 Parcel reply = Parcel.obtain();
3877 data.writeInterfaceToken(IActivityManager.descriptor);
3878 data.writeStrongBinder(caller.asBinder());
3879 data.writeString(targetPkg);
3880 uri.writeToParcel(data, 0);
3881 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003882 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003883 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3884 reply.readException();
3885 data.recycle();
3886 reply.recycle();
3887 }
3888 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003889 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003890 Parcel data = Parcel.obtain();
3891 Parcel reply = Parcel.obtain();
3892 data.writeInterfaceToken(IActivityManager.descriptor);
3893 data.writeStrongBinder(caller.asBinder());
3894 uri.writeToParcel(data, 0);
3895 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003896 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003897 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3898 reply.readException();
3899 data.recycle();
3900 reply.recycle();
3901 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003902
3903 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003904 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3905 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003906 Parcel data = Parcel.obtain();
3907 Parcel reply = Parcel.obtain();
3908 data.writeInterfaceToken(IActivityManager.descriptor);
3909 uri.writeToParcel(data, 0);
3910 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003911 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003912 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3913 reply.readException();
3914 data.recycle();
3915 reply.recycle();
3916 }
3917
3918 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003919 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3920 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003921 Parcel data = Parcel.obtain();
3922 Parcel reply = Parcel.obtain();
3923 data.writeInterfaceToken(IActivityManager.descriptor);
3924 uri.writeToParcel(data, 0);
3925 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003926 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003927 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3928 reply.readException();
3929 data.recycle();
3930 reply.recycle();
3931 }
3932
3933 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003934 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3935 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003936 Parcel data = Parcel.obtain();
3937 Parcel reply = Parcel.obtain();
3938 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003939 data.writeString(packageName);
3940 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003941 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3942 reply.readException();
3943 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3944 reply);
3945 data.recycle();
3946 reply.recycle();
3947 return perms;
3948 }
3949
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003950 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3951 throws RemoteException {
3952 Parcel data = Parcel.obtain();
3953 Parcel reply = Parcel.obtain();
3954 data.writeInterfaceToken(IActivityManager.descriptor);
3955 data.writeStrongBinder(who.asBinder());
3956 data.writeInt(waiting ? 1 : 0);
3957 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3958 reply.readException();
3959 data.recycle();
3960 reply.recycle();
3961 }
3962 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3963 Parcel data = Parcel.obtain();
3964 Parcel reply = Parcel.obtain();
3965 data.writeInterfaceToken(IActivityManager.descriptor);
3966 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3967 reply.readException();
3968 outInfo.readFromParcel(reply);
3969 data.recycle();
3970 reply.recycle();
3971 }
3972 public void unhandledBack() throws RemoteException
3973 {
3974 Parcel data = Parcel.obtain();
3975 Parcel reply = Parcel.obtain();
3976 data.writeInterfaceToken(IActivityManager.descriptor);
3977 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3978 reply.readException();
3979 data.recycle();
3980 reply.recycle();
3981 }
3982 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3983 {
3984 Parcel data = Parcel.obtain();
3985 Parcel reply = Parcel.obtain();
3986 data.writeInterfaceToken(IActivityManager.descriptor);
3987 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3988 reply.readException();
3989 ParcelFileDescriptor pfd = null;
3990 if (reply.readInt() != 0) {
3991 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3992 }
3993 data.recycle();
3994 reply.recycle();
3995 return pfd;
3996 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003997 public void setLockScreenShown(boolean shown) throws RemoteException
3998 {
3999 Parcel data = Parcel.obtain();
4000 Parcel reply = Parcel.obtain();
4001 data.writeInterfaceToken(IActivityManager.descriptor);
4002 data.writeInt(shown ? 1 : 0);
4003 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4004 reply.readException();
4005 data.recycle();
4006 reply.recycle();
4007 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004008 public void setDebugApp(
4009 String packageName, boolean waitForDebugger, boolean persistent)
4010 throws RemoteException
4011 {
4012 Parcel data = Parcel.obtain();
4013 Parcel reply = Parcel.obtain();
4014 data.writeInterfaceToken(IActivityManager.descriptor);
4015 data.writeString(packageName);
4016 data.writeInt(waitForDebugger ? 1 : 0);
4017 data.writeInt(persistent ? 1 : 0);
4018 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4019 reply.readException();
4020 data.recycle();
4021 reply.recycle();
4022 }
4023 public void setAlwaysFinish(boolean enabled) throws RemoteException
4024 {
4025 Parcel data = Parcel.obtain();
4026 Parcel reply = Parcel.obtain();
4027 data.writeInterfaceToken(IActivityManager.descriptor);
4028 data.writeInt(enabled ? 1 : 0);
4029 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4030 reply.readException();
4031 data.recycle();
4032 reply.recycle();
4033 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004034 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004035 {
4036 Parcel data = Parcel.obtain();
4037 Parcel reply = Parcel.obtain();
4038 data.writeInterfaceToken(IActivityManager.descriptor);
4039 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004040 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004041 reply.readException();
4042 data.recycle();
4043 reply.recycle();
4044 }
4045 public void enterSafeMode() throws RemoteException {
4046 Parcel data = Parcel.obtain();
4047 data.writeInterfaceToken(IActivityManager.descriptor);
4048 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4049 data.recycle();
4050 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08004051 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
4052 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004053 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004054 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004055 data.writeStrongBinder(sender.asBinder());
4056 data.writeInt(sourceUid);
4057 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004058 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4059 data.recycle();
4060 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004061 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004062 Parcel data = Parcel.obtain();
4063 Parcel reply = Parcel.obtain();
4064 data.writeInterfaceToken(IActivityManager.descriptor);
4065 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004066 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004067 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004068 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004069 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004070 boolean res = reply.readInt() != 0;
4071 data.recycle();
4072 reply.recycle();
4073 return res;
4074 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004075 @Override
4076 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4077 Parcel data = Parcel.obtain();
4078 Parcel reply = Parcel.obtain();
4079 data.writeInterfaceToken(IActivityManager.descriptor);
4080 data.writeString(reason);
4081 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4082 boolean res = reply.readInt() != 0;
4083 data.recycle();
4084 reply.recycle();
4085 return res;
4086 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004087 public boolean testIsSystemReady()
4088 {
4089 /* this base class version is never called */
4090 return true;
4091 }
Dan Egnor60d87622009-12-16 16:32:58 -08004092 public void handleApplicationCrash(IBinder app,
4093 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4094 {
4095 Parcel data = Parcel.obtain();
4096 Parcel reply = Parcel.obtain();
4097 data.writeInterfaceToken(IActivityManager.descriptor);
4098 data.writeStrongBinder(app);
4099 crashInfo.writeToParcel(data, 0);
4100 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4101 reply.readException();
4102 reply.recycle();
4103 data.recycle();
4104 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004105
Dianne Hackborn52322712014-08-26 22:47:26 -07004106 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004107 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004108 {
4109 Parcel data = Parcel.obtain();
4110 Parcel reply = Parcel.obtain();
4111 data.writeInterfaceToken(IActivityManager.descriptor);
4112 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004113 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004114 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004115 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004116 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004117 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004118 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004119 reply.recycle();
4120 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004121 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004122 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004123
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004124 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004125 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004126 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004127 {
4128 Parcel data = Parcel.obtain();
4129 Parcel reply = Parcel.obtain();
4130 data.writeInterfaceToken(IActivityManager.descriptor);
4131 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004132 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004133 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004134 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4135 reply.readException();
4136 reply.recycle();
4137 data.recycle();
4138 }
4139
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004140 public void signalPersistentProcesses(int sig) throws RemoteException {
4141 Parcel data = Parcel.obtain();
4142 Parcel reply = Parcel.obtain();
4143 data.writeInterfaceToken(IActivityManager.descriptor);
4144 data.writeInt(sig);
4145 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4146 reply.readException();
4147 data.recycle();
4148 reply.recycle();
4149 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004150
Dianne Hackborn1676c852012-09-10 14:52:30 -07004151 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004152 Parcel data = Parcel.obtain();
4153 Parcel reply = Parcel.obtain();
4154 data.writeInterfaceToken(IActivityManager.descriptor);
4155 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004156 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004157 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4158 reply.readException();
4159 data.recycle();
4160 reply.recycle();
4161 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004162
4163 public void killAllBackgroundProcesses() throws RemoteException {
4164 Parcel data = Parcel.obtain();
4165 Parcel reply = Parcel.obtain();
4166 data.writeInterfaceToken(IActivityManager.descriptor);
4167 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4168 reply.readException();
4169 data.recycle();
4170 reply.recycle();
4171 }
4172
Dianne Hackborn1676c852012-09-10 14:52:30 -07004173 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004174 Parcel data = Parcel.obtain();
4175 Parcel reply = Parcel.obtain();
4176 data.writeInterfaceToken(IActivityManager.descriptor);
4177 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004178 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004179 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004180 reply.readException();
4181 data.recycle();
4182 reply.recycle();
4183 }
4184
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004185 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4186 throws RemoteException
4187 {
4188 Parcel data = Parcel.obtain();
4189 Parcel reply = Parcel.obtain();
4190 data.writeInterfaceToken(IActivityManager.descriptor);
4191 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4192 reply.readException();
4193 outInfo.readFromParcel(reply);
4194 reply.recycle();
4195 data.recycle();
4196 }
4197
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004198 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4199 {
4200 Parcel data = Parcel.obtain();
4201 Parcel reply = Parcel.obtain();
4202 data.writeInterfaceToken(IActivityManager.descriptor);
4203 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4204 reply.readException();
4205 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4206 reply.recycle();
4207 data.recycle();
4208 return res;
4209 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004210
Dianne Hackborn1676c852012-09-10 14:52:30 -07004211 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004212 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004213 {
4214 Parcel data = Parcel.obtain();
4215 Parcel reply = Parcel.obtain();
4216 data.writeInterfaceToken(IActivityManager.descriptor);
4217 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004218 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004219 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004220 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004221 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004222 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004223 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004224 } else {
4225 data.writeInt(0);
4226 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004227 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4228 reply.readException();
4229 boolean res = reply.readInt() != 0;
4230 reply.recycle();
4231 data.recycle();
4232 return res;
4233 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004234
Dianne Hackborn55280a92009-05-07 15:53:46 -07004235 public boolean shutdown(int timeout) throws RemoteException
4236 {
4237 Parcel data = Parcel.obtain();
4238 Parcel reply = Parcel.obtain();
4239 data.writeInterfaceToken(IActivityManager.descriptor);
4240 data.writeInt(timeout);
4241 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4242 reply.readException();
4243 boolean res = reply.readInt() != 0;
4244 reply.recycle();
4245 data.recycle();
4246 return res;
4247 }
4248
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004249 public void stopAppSwitches() throws RemoteException {
4250 Parcel data = Parcel.obtain();
4251 Parcel reply = Parcel.obtain();
4252 data.writeInterfaceToken(IActivityManager.descriptor);
4253 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4254 reply.readException();
4255 reply.recycle();
4256 data.recycle();
4257 }
4258
4259 public void resumeAppSwitches() throws RemoteException {
4260 Parcel data = Parcel.obtain();
4261 Parcel reply = Parcel.obtain();
4262 data.writeInterfaceToken(IActivityManager.descriptor);
4263 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4264 reply.readException();
4265 reply.recycle();
4266 data.recycle();
4267 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004268
4269 public void addPackageDependency(String packageName) throws RemoteException {
4270 Parcel data = Parcel.obtain();
4271 Parcel reply = Parcel.obtain();
4272 data.writeInterfaceToken(IActivityManager.descriptor);
4273 data.writeString(packageName);
4274 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4275 reply.readException();
4276 data.recycle();
4277 reply.recycle();
4278 }
4279
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004280 public void killApplicationWithAppId(String pkg, int appid, String reason)
4281 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004282 Parcel data = Parcel.obtain();
4283 Parcel reply = Parcel.obtain();
4284 data.writeInterfaceToken(IActivityManager.descriptor);
4285 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004286 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004287 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004288 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004289 reply.readException();
4290 data.recycle();
4291 reply.recycle();
4292 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004293
4294 public void closeSystemDialogs(String reason) throws RemoteException {
4295 Parcel data = Parcel.obtain();
4296 Parcel reply = Parcel.obtain();
4297 data.writeInterfaceToken(IActivityManager.descriptor);
4298 data.writeString(reason);
4299 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4300 reply.readException();
4301 data.recycle();
4302 reply.recycle();
4303 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004304
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004305 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004306 throws RemoteException {
4307 Parcel data = Parcel.obtain();
4308 Parcel reply = Parcel.obtain();
4309 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004310 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004311 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4312 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004313 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004314 data.recycle();
4315 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004316 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004317 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004318
4319 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4320 Parcel data = Parcel.obtain();
4321 Parcel reply = Parcel.obtain();
4322 data.writeInterfaceToken(IActivityManager.descriptor);
4323 data.writeString(processName);
4324 data.writeInt(uid);
4325 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4326 reply.readException();
4327 data.recycle();
4328 reply.recycle();
4329 }
4330
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004331 public void overridePendingTransition(IBinder token, String packageName,
4332 int enterAnim, int exitAnim) throws RemoteException {
4333 Parcel data = Parcel.obtain();
4334 Parcel reply = Parcel.obtain();
4335 data.writeInterfaceToken(IActivityManager.descriptor);
4336 data.writeStrongBinder(token);
4337 data.writeString(packageName);
4338 data.writeInt(enterAnim);
4339 data.writeInt(exitAnim);
4340 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4341 reply.readException();
4342 data.recycle();
4343 reply.recycle();
4344 }
4345
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004346 public boolean isUserAMonkey() throws RemoteException {
4347 Parcel data = Parcel.obtain();
4348 Parcel reply = Parcel.obtain();
4349 data.writeInterfaceToken(IActivityManager.descriptor);
4350 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4351 reply.readException();
4352 boolean res = reply.readInt() != 0;
4353 data.recycle();
4354 reply.recycle();
4355 return res;
4356 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004357
4358 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4359 Parcel data = Parcel.obtain();
4360 Parcel reply = Parcel.obtain();
4361 data.writeInterfaceToken(IActivityManager.descriptor);
4362 data.writeInt(monkey ? 1 : 0);
4363 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4364 reply.readException();
4365 data.recycle();
4366 reply.recycle();
4367 }
4368
Dianne Hackborn860755f2010-06-03 18:47:52 -07004369 public void finishHeavyWeightApp() throws RemoteException {
4370 Parcel data = Parcel.obtain();
4371 Parcel reply = Parcel.obtain();
4372 data.writeInterfaceToken(IActivityManager.descriptor);
4373 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4374 reply.readException();
4375 data.recycle();
4376 reply.recycle();
4377 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004378
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004379 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004380 throws RemoteException {
4381 Parcel data = Parcel.obtain();
4382 Parcel reply = Parcel.obtain();
4383 data.writeInterfaceToken(IActivityManager.descriptor);
4384 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004385 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4386 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004387 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004388 data.recycle();
4389 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004390 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004391 }
4392
Craig Mautner233ceee2014-05-09 17:05:11 -07004393 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004394 throws RemoteException {
4395 Parcel data = Parcel.obtain();
4396 Parcel reply = Parcel.obtain();
4397 data.writeInterfaceToken(IActivityManager.descriptor);
4398 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004399 if (options == null) {
4400 data.writeInt(0);
4401 } else {
4402 data.writeInt(1);
4403 data.writeBundle(options.toBundle());
4404 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004405 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004406 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004407 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004408 data.recycle();
4409 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004410 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004411 }
4412
Craig Mautner233ceee2014-05-09 17:05:11 -07004413 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4414 Parcel data = Parcel.obtain();
4415 Parcel reply = Parcel.obtain();
4416 data.writeInterfaceToken(IActivityManager.descriptor);
4417 data.writeStrongBinder(token);
4418 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4419 reply.readException();
4420 Bundle bundle = reply.readBundle();
4421 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4422 data.recycle();
4423 reply.recycle();
4424 return options;
4425 }
4426
Daniel Sandler69a48172010-06-23 16:29:36 -04004427 public void setImmersive(IBinder token, boolean immersive)
4428 throws RemoteException {
4429 Parcel data = Parcel.obtain();
4430 Parcel reply = Parcel.obtain();
4431 data.writeInterfaceToken(IActivityManager.descriptor);
4432 data.writeStrongBinder(token);
4433 data.writeInt(immersive ? 1 : 0);
4434 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4435 reply.readException();
4436 data.recycle();
4437 reply.recycle();
4438 }
4439
4440 public boolean isImmersive(IBinder token)
4441 throws RemoteException {
4442 Parcel data = Parcel.obtain();
4443 Parcel reply = Parcel.obtain();
4444 data.writeInterfaceToken(IActivityManager.descriptor);
4445 data.writeStrongBinder(token);
4446 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004447 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004448 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004449 data.recycle();
4450 reply.recycle();
4451 return res;
4452 }
4453
Craig Mautnerd61dc202014-07-07 11:09:11 -07004454 public boolean isTopOfTask(IBinder token) 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_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4460 reply.readException();
4461 boolean res = reply.readInt() == 1;
4462 data.recycle();
4463 reply.recycle();
4464 return res;
4465 }
4466
Daniel Sandler69a48172010-06-23 16:29:36 -04004467 public boolean isTopActivityImmersive()
4468 throws RemoteException {
4469 Parcel data = Parcel.obtain();
4470 Parcel reply = Parcel.obtain();
4471 data.writeInterfaceToken(IActivityManager.descriptor);
4472 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004473 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004474 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004475 data.recycle();
4476 reply.recycle();
4477 return res;
4478 }
4479
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004480 public void crashApplication(int uid, int initialPid, String packageName,
4481 String message) throws RemoteException {
4482 Parcel data = Parcel.obtain();
4483 Parcel reply = Parcel.obtain();
4484 data.writeInterfaceToken(IActivityManager.descriptor);
4485 data.writeInt(uid);
4486 data.writeInt(initialPid);
4487 data.writeString(packageName);
4488 data.writeString(message);
4489 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4490 reply.readException();
4491 data.recycle();
4492 reply.recycle();
4493 }
Andy McFadden824c5102010-07-09 16:26:57 -07004494
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004495 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004496 Parcel data = Parcel.obtain();
4497 Parcel reply = Parcel.obtain();
4498 data.writeInterfaceToken(IActivityManager.descriptor);
4499 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004500 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004501 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4502 reply.readException();
4503 String res = reply.readString();
4504 data.recycle();
4505 reply.recycle();
4506 return res;
4507 }
4508
Dianne Hackborn7e269642010-08-25 19:50:20 -07004509 public IBinder newUriPermissionOwner(String name)
4510 throws RemoteException {
4511 Parcel data = Parcel.obtain();
4512 Parcel reply = Parcel.obtain();
4513 data.writeInterfaceToken(IActivityManager.descriptor);
4514 data.writeString(name);
4515 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4516 reply.readException();
4517 IBinder res = reply.readStrongBinder();
4518 data.recycle();
4519 reply.recycle();
4520 return res;
4521 }
4522
4523 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004524 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004525 Parcel data = Parcel.obtain();
4526 Parcel reply = Parcel.obtain();
4527 data.writeInterfaceToken(IActivityManager.descriptor);
4528 data.writeStrongBinder(owner);
4529 data.writeInt(fromUid);
4530 data.writeString(targetPkg);
4531 uri.writeToParcel(data, 0);
4532 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004533 data.writeInt(sourceUserId);
4534 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004535 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4536 reply.readException();
4537 data.recycle();
4538 reply.recycle();
4539 }
4540
4541 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004542 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004543 Parcel data = Parcel.obtain();
4544 Parcel reply = Parcel.obtain();
4545 data.writeInterfaceToken(IActivityManager.descriptor);
4546 data.writeStrongBinder(owner);
4547 if (uri != null) {
4548 data.writeInt(1);
4549 uri.writeToParcel(data, 0);
4550 } else {
4551 data.writeInt(0);
4552 }
4553 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004554 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004555 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4556 reply.readException();
4557 data.recycle();
4558 reply.recycle();
4559 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004560
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004561 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004562 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004563 Parcel data = Parcel.obtain();
4564 Parcel reply = Parcel.obtain();
4565 data.writeInterfaceToken(IActivityManager.descriptor);
4566 data.writeInt(callingUid);
4567 data.writeString(targetPkg);
4568 uri.writeToParcel(data, 0);
4569 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004570 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004571 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4572 reply.readException();
4573 int res = reply.readInt();
4574 data.recycle();
4575 reply.recycle();
4576 return res;
4577 }
4578
Dianne Hackborn1676c852012-09-10 14:52:30 -07004579 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004580 String path, ParcelFileDescriptor fd) throws RemoteException {
4581 Parcel data = Parcel.obtain();
4582 Parcel reply = Parcel.obtain();
4583 data.writeInterfaceToken(IActivityManager.descriptor);
4584 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004585 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004586 data.writeInt(managed ? 1 : 0);
4587 data.writeString(path);
4588 if (fd != null) {
4589 data.writeInt(1);
4590 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4591 } else {
4592 data.writeInt(0);
4593 }
4594 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4595 reply.readException();
4596 boolean res = reply.readInt() != 0;
4597 reply.recycle();
4598 data.recycle();
4599 return res;
4600 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004601
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004602 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004603 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004604 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004605 Parcel data = Parcel.obtain();
4606 Parcel reply = Parcel.obtain();
4607 data.writeInterfaceToken(IActivityManager.descriptor);
4608 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004609 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004610 data.writeTypedArray(intents, 0);
4611 data.writeStringArray(resolvedTypes);
4612 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004613 if (options != null) {
4614 data.writeInt(1);
4615 options.writeToParcel(data, 0);
4616 } else {
4617 data.writeInt(0);
4618 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004619 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004620 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4621 reply.readException();
4622 int result = reply.readInt();
4623 reply.recycle();
4624 data.recycle();
4625 return result;
4626 }
4627
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004628 public int getFrontActivityScreenCompatMode() throws RemoteException {
4629 Parcel data = Parcel.obtain();
4630 Parcel reply = Parcel.obtain();
4631 data.writeInterfaceToken(IActivityManager.descriptor);
4632 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4633 reply.readException();
4634 int mode = reply.readInt();
4635 reply.recycle();
4636 data.recycle();
4637 return mode;
4638 }
4639
4640 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4641 Parcel data = Parcel.obtain();
4642 Parcel reply = Parcel.obtain();
4643 data.writeInterfaceToken(IActivityManager.descriptor);
4644 data.writeInt(mode);
4645 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4646 reply.readException();
4647 reply.recycle();
4648 data.recycle();
4649 }
4650
4651 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4652 Parcel data = Parcel.obtain();
4653 Parcel reply = Parcel.obtain();
4654 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004655 data.writeString(packageName);
4656 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004657 reply.readException();
4658 int mode = reply.readInt();
4659 reply.recycle();
4660 data.recycle();
4661 return mode;
4662 }
4663
4664 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004665 throws RemoteException {
4666 Parcel data = Parcel.obtain();
4667 Parcel reply = Parcel.obtain();
4668 data.writeInterfaceToken(IActivityManager.descriptor);
4669 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004670 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004671 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4672 reply.readException();
4673 reply.recycle();
4674 data.recycle();
4675 }
4676
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004677 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4678 Parcel data = Parcel.obtain();
4679 Parcel reply = Parcel.obtain();
4680 data.writeInterfaceToken(IActivityManager.descriptor);
4681 data.writeString(packageName);
4682 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4683 reply.readException();
4684 boolean ask = reply.readInt() != 0;
4685 reply.recycle();
4686 data.recycle();
4687 return ask;
4688 }
4689
4690 public void setPackageAskScreenCompat(String packageName, boolean ask)
4691 throws RemoteException {
4692 Parcel data = Parcel.obtain();
4693 Parcel reply = Parcel.obtain();
4694 data.writeInterfaceToken(IActivityManager.descriptor);
4695 data.writeString(packageName);
4696 data.writeInt(ask ? 1 : 0);
4697 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4698 reply.readException();
4699 reply.recycle();
4700 data.recycle();
4701 }
4702
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004703 public boolean switchUser(int userid) throws RemoteException {
4704 Parcel data = Parcel.obtain();
4705 Parcel reply = Parcel.obtain();
4706 data.writeInterfaceToken(IActivityManager.descriptor);
4707 data.writeInt(userid);
4708 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4709 reply.readException();
4710 boolean result = reply.readInt() != 0;
4711 reply.recycle();
4712 data.recycle();
4713 return result;
4714 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004715
Kenny Guy08488bf2014-02-21 17:40:37 +00004716 public boolean startUserInBackground(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(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4722 reply.readException();
4723 boolean result = reply.readInt() != 0;
4724 reply.recycle();
4725 data.recycle();
4726 return result;
4727 }
4728
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004729 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4730 Parcel data = Parcel.obtain();
4731 Parcel reply = Parcel.obtain();
4732 data.writeInterfaceToken(IActivityManager.descriptor);
4733 data.writeInt(userid);
4734 data.writeStrongInterface(callback);
4735 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4736 reply.readException();
4737 int result = reply.readInt();
4738 reply.recycle();
4739 data.recycle();
4740 return result;
4741 }
4742
Amith Yamasani52f1d752012-03-28 18:19:29 -07004743 public UserInfo getCurrentUser() throws RemoteException {
4744 Parcel data = Parcel.obtain();
4745 Parcel reply = Parcel.obtain();
4746 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004747 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004748 reply.readException();
4749 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4750 reply.recycle();
4751 data.recycle();
4752 return userInfo;
4753 }
4754
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004755 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004756 Parcel data = Parcel.obtain();
4757 Parcel reply = Parcel.obtain();
4758 data.writeInterfaceToken(IActivityManager.descriptor);
4759 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004760 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004761 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4762 reply.readException();
4763 boolean result = reply.readInt() != 0;
4764 reply.recycle();
4765 data.recycle();
4766 return result;
4767 }
4768
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004769 public int[] getRunningUserIds() throws RemoteException {
4770 Parcel data = Parcel.obtain();
4771 Parcel reply = Parcel.obtain();
4772 data.writeInterfaceToken(IActivityManager.descriptor);
4773 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4774 reply.readException();
4775 int[] result = reply.createIntArray();
4776 reply.recycle();
4777 data.recycle();
4778 return result;
4779 }
4780
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004781 public boolean removeTask(int taskId, int flags) throws RemoteException {
4782 Parcel data = Parcel.obtain();
4783 Parcel reply = Parcel.obtain();
4784 data.writeInterfaceToken(IActivityManager.descriptor);
4785 data.writeInt(taskId);
4786 data.writeInt(flags);
4787 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4788 reply.readException();
4789 boolean result = reply.readInt() != 0;
4790 reply.recycle();
4791 data.recycle();
4792 return result;
4793 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004794
Jeff Sharkeya4620792011-05-20 15:29:23 -07004795 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4796 Parcel data = Parcel.obtain();
4797 Parcel reply = Parcel.obtain();
4798 data.writeInterfaceToken(IActivityManager.descriptor);
4799 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4800 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4801 reply.readException();
4802 data.recycle();
4803 reply.recycle();
4804 }
4805
4806 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4807 Parcel data = Parcel.obtain();
4808 Parcel reply = Parcel.obtain();
4809 data.writeInterfaceToken(IActivityManager.descriptor);
4810 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4811 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4812 reply.readException();
4813 data.recycle();
4814 reply.recycle();
4815 }
4816
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004817 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4818 Parcel data = Parcel.obtain();
4819 Parcel reply = Parcel.obtain();
4820 data.writeInterfaceToken(IActivityManager.descriptor);
4821 data.writeStrongBinder(sender.asBinder());
4822 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4823 reply.readException();
4824 boolean res = reply.readInt() != 0;
4825 data.recycle();
4826 reply.recycle();
4827 return res;
4828 }
4829
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004830 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4831 Parcel data = Parcel.obtain();
4832 Parcel reply = Parcel.obtain();
4833 data.writeInterfaceToken(IActivityManager.descriptor);
4834 data.writeStrongBinder(sender.asBinder());
4835 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4836 reply.readException();
4837 boolean res = reply.readInt() != 0;
4838 data.recycle();
4839 reply.recycle();
4840 return res;
4841 }
4842
Dianne Hackborn81038902012-11-26 17:04:09 -08004843 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4844 Parcel data = Parcel.obtain();
4845 Parcel reply = Parcel.obtain();
4846 data.writeInterfaceToken(IActivityManager.descriptor);
4847 data.writeStrongBinder(sender.asBinder());
4848 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4849 reply.readException();
4850 Intent res = reply.readInt() != 0
4851 ? Intent.CREATOR.createFromParcel(reply) : null;
4852 data.recycle();
4853 reply.recycle();
4854 return res;
4855 }
4856
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004857 public String getTagForIntentSender(IIntentSender sender, String prefix)
4858 throws RemoteException {
4859 Parcel data = Parcel.obtain();
4860 Parcel reply = Parcel.obtain();
4861 data.writeInterfaceToken(IActivityManager.descriptor);
4862 data.writeStrongBinder(sender.asBinder());
4863 data.writeString(prefix);
4864 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4865 reply.readException();
4866 String res = reply.readString();
4867 data.recycle();
4868 reply.recycle();
4869 return res;
4870 }
4871
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004872 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4873 {
4874 Parcel data = Parcel.obtain();
4875 Parcel reply = Parcel.obtain();
4876 data.writeInterfaceToken(IActivityManager.descriptor);
4877 values.writeToParcel(data, 0);
4878 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4879 reply.readException();
4880 data.recycle();
4881 reply.recycle();
4882 }
4883
Dianne Hackbornb437e092011-08-05 17:50:29 -07004884 public long[] getProcessPss(int[] pids) throws RemoteException {
4885 Parcel data = Parcel.obtain();
4886 Parcel reply = Parcel.obtain();
4887 data.writeInterfaceToken(IActivityManager.descriptor);
4888 data.writeIntArray(pids);
4889 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4890 reply.readException();
4891 long[] res = reply.createLongArray();
4892 data.recycle();
4893 reply.recycle();
4894 return res;
4895 }
4896
Dianne Hackborn661cd522011-08-22 00:26:20 -07004897 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4898 Parcel data = Parcel.obtain();
4899 Parcel reply = Parcel.obtain();
4900 data.writeInterfaceToken(IActivityManager.descriptor);
4901 TextUtils.writeToParcel(msg, data, 0);
4902 data.writeInt(always ? 1 : 0);
4903 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4904 reply.readException();
4905 data.recycle();
4906 reply.recycle();
4907 }
4908
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004909 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004910 Parcel data = Parcel.obtain();
4911 Parcel reply = Parcel.obtain();
4912 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02004913 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004914 reply.readException();
4915 data.recycle();
4916 reply.recycle();
4917 }
4918
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004919 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07004920 throws RemoteException {
4921 Parcel data = Parcel.obtain();
4922 Parcel reply = Parcel.obtain();
4923 data.writeInterfaceToken(IActivityManager.descriptor);
4924 data.writeStrongBinder(token);
4925 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07004926 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07004927 reply.readException();
4928 boolean result = reply.readInt() != 0;
4929 data.recycle();
4930 reply.recycle();
4931 return result;
4932 }
4933
4934 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4935 throws RemoteException {
4936 Parcel data = Parcel.obtain();
4937 Parcel reply = Parcel.obtain();
4938 data.writeInterfaceToken(IActivityManager.descriptor);
4939 data.writeStrongBinder(token);
4940 target.writeToParcel(data, 0);
4941 data.writeInt(resultCode);
4942 if (resultData != null) {
4943 data.writeInt(1);
4944 resultData.writeToParcel(data, 0);
4945 } else {
4946 data.writeInt(0);
4947 }
4948 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4949 reply.readException();
4950 boolean result = reply.readInt() != 0;
4951 data.recycle();
4952 reply.recycle();
4953 return result;
4954 }
4955
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004956 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4957 Parcel data = Parcel.obtain();
4958 Parcel reply = Parcel.obtain();
4959 data.writeInterfaceToken(IActivityManager.descriptor);
4960 data.writeStrongBinder(activityToken);
4961 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4962 reply.readException();
4963 int result = reply.readInt();
4964 data.recycle();
4965 reply.recycle();
4966 return result;
4967 }
4968
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004969 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4970 Parcel data = Parcel.obtain();
4971 Parcel reply = Parcel.obtain();
4972 data.writeInterfaceToken(IActivityManager.descriptor);
4973 data.writeStrongBinder(activityToken);
4974 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4975 reply.readException();
4976 String result = reply.readString();
4977 data.recycle();
4978 reply.recycle();
4979 return result;
4980 }
4981
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004982 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4983 Parcel data = Parcel.obtain();
4984 Parcel reply = Parcel.obtain();
4985 data.writeInterfaceToken(IActivityManager.descriptor);
4986 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4987 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4988 reply.readException();
4989 data.recycle();
4990 reply.recycle();
4991 }
4992
4993 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4994 Parcel data = Parcel.obtain();
4995 Parcel reply = Parcel.obtain();
4996 data.writeInterfaceToken(IActivityManager.descriptor);
4997 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4998 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4999 reply.readException();
5000 data.recycle();
5001 reply.recycle();
5002 }
5003
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005004 public void requestBugReport() throws RemoteException {
5005 Parcel data = Parcel.obtain();
5006 Parcel reply = Parcel.obtain();
5007 data.writeInterfaceToken(IActivityManager.descriptor);
5008 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5009 reply.readException();
5010 data.recycle();
5011 reply.recycle();
5012 }
5013
Jeff Brownbd181bb2013-09-10 16:44:24 -07005014 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5015 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005016 Parcel data = Parcel.obtain();
5017 Parcel reply = Parcel.obtain();
5018 data.writeInterfaceToken(IActivityManager.descriptor);
5019 data.writeInt(pid);
5020 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005021 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005022 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5023 reply.readException();
5024 long res = reply.readInt();
5025 data.recycle();
5026 reply.recycle();
5027 return res;
5028 }
5029
Adam Skorydfc7fd72013-08-05 19:23:41 -07005030 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005031 Parcel data = Parcel.obtain();
5032 Parcel reply = Parcel.obtain();
5033 data.writeInterfaceToken(IActivityManager.descriptor);
5034 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005035 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005036 reply.readException();
5037 Bundle res = reply.readBundle();
5038 data.recycle();
5039 reply.recycle();
5040 return res;
5041 }
5042
Adam Skory7140a252013-09-11 12:04:58 +01005043 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005044 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005045 Parcel data = Parcel.obtain();
5046 Parcel reply = Parcel.obtain();
5047 data.writeInterfaceToken(IActivityManager.descriptor);
5048 data.writeStrongBinder(token);
5049 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005050 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005051 reply.readException();
5052 data.recycle();
5053 reply.recycle();
5054 }
5055
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005056 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
5057 throws RemoteException {
5058 Parcel data = Parcel.obtain();
5059 Parcel reply = Parcel.obtain();
5060 data.writeInterfaceToken(IActivityManager.descriptor);
5061 intent.writeToParcel(data, 0);
5062 data.writeInt(requestType);
5063 data.writeString(hint);
5064 data.writeInt(userHandle);
5065 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5066 reply.readException();
5067 boolean res = reply.readInt() != 0;
5068 data.recycle();
5069 reply.recycle();
5070 return res;
5071 }
5072
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005073 public void killUid(int uid, String reason) throws RemoteException {
5074 Parcel data = Parcel.obtain();
5075 Parcel reply = Parcel.obtain();
5076 data.writeInterfaceToken(IActivityManager.descriptor);
5077 data.writeInt(uid);
5078 data.writeString(reason);
5079 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5080 reply.readException();
5081 data.recycle();
5082 reply.recycle();
5083 }
5084
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005085 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5086 Parcel data = Parcel.obtain();
5087 Parcel reply = Parcel.obtain();
5088 data.writeInterfaceToken(IActivityManager.descriptor);
5089 data.writeStrongBinder(who);
5090 data.writeInt(allowRestart ? 1 : 0);
5091 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5092 reply.readException();
5093 data.recycle();
5094 reply.recycle();
5095 }
5096
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005097 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5098 Parcel data = Parcel.obtain();
5099 Parcel reply = Parcel.obtain();
5100 data.writeInterfaceToken(IActivityManager.descriptor);
5101 data.writeStrongBinder(token);
5102 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5103 reply.readException();
5104 data.recycle();
5105 reply.recycle();
5106 }
5107
Craig Mautner5eda9b32013-07-02 11:58:16 -07005108 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5109 Parcel data = Parcel.obtain();
5110 Parcel reply = Parcel.obtain();
5111 data.writeInterfaceToken(IActivityManager.descriptor);
5112 data.writeStrongBinder(token);
5113 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5114 reply.readException();
5115 data.recycle();
5116 reply.recycle();
5117 }
5118
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005119 public void restart() throws RemoteException {
5120 Parcel data = Parcel.obtain();
5121 Parcel reply = Parcel.obtain();
5122 data.writeInterfaceToken(IActivityManager.descriptor);
5123 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5124 reply.readException();
5125 data.recycle();
5126 reply.recycle();
5127 }
5128
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005129 public void performIdleMaintenance() throws RemoteException {
5130 Parcel data = Parcel.obtain();
5131 Parcel reply = Parcel.obtain();
5132 data.writeInterfaceToken(IActivityManager.descriptor);
5133 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5134 reply.readException();
5135 data.recycle();
5136 reply.recycle();
5137 }
5138
Craig Mautner4a1cb222013-12-04 16:14:06 -08005139 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
5140 IActivityContainerCallback callback) throws RemoteException {
5141 Parcel data = Parcel.obtain();
5142 Parcel reply = Parcel.obtain();
5143 data.writeInterfaceToken(IActivityManager.descriptor);
5144 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005145 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08005146 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5147 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005148 final int result = reply.readInt();
5149 final IActivityContainer res;
5150 if (result == 1) {
5151 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5152 } else {
5153 res = null;
5154 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005155 data.recycle();
5156 reply.recycle();
5157 return res;
5158 }
5159
Craig Mautner95da1082014-02-24 17:54:35 -08005160 public void deleteActivityContainer(IActivityContainer activityContainer)
5161 throws RemoteException {
5162 Parcel data = Parcel.obtain();
5163 Parcel reply = Parcel.obtain();
5164 data.writeInterfaceToken(IActivityManager.descriptor);
5165 data.writeStrongBinder(activityContainer.asBinder());
5166 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5167 reply.readException();
5168 data.recycle();
5169 reply.recycle();
5170 }
5171
Craig Mautnere0a38842013-12-16 16:14:02 -08005172 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
5173 throws RemoteException {
5174 Parcel data = Parcel.obtain();
5175 Parcel reply = Parcel.obtain();
5176 data.writeInterfaceToken(IActivityManager.descriptor);
5177 data.writeStrongBinder(activityToken);
5178 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5179 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005180 final int result = reply.readInt();
5181 final IActivityContainer res;
5182 if (result == 1) {
5183 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5184 } else {
5185 res = null;
5186 }
Craig Mautnere0a38842013-12-16 16:14:02 -08005187 data.recycle();
5188 reply.recycle();
5189 return res;
5190 }
5191
Craig Mautner4a1cb222013-12-04 16:14:06 -08005192 public IBinder getHomeActivityToken() throws RemoteException {
5193 Parcel data = Parcel.obtain();
5194 Parcel reply = Parcel.obtain();
5195 data.writeInterfaceToken(IActivityManager.descriptor);
5196 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5197 reply.readException();
5198 IBinder res = reply.readStrongBinder();
5199 data.recycle();
5200 reply.recycle();
5201 return res;
5202 }
5203
Craig Mautneraea74a52014-03-08 14:23:10 -08005204 @Override
5205 public void startLockTaskMode(int taskId) throws RemoteException {
5206 Parcel data = Parcel.obtain();
5207 Parcel reply = Parcel.obtain();
5208 data.writeInterfaceToken(IActivityManager.descriptor);
5209 data.writeInt(taskId);
5210 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5211 reply.readException();
5212 data.recycle();
5213 reply.recycle();
5214 }
5215
5216 @Override
5217 public void startLockTaskMode(IBinder token) throws RemoteException {
5218 Parcel data = Parcel.obtain();
5219 Parcel reply = Parcel.obtain();
5220 data.writeInterfaceToken(IActivityManager.descriptor);
5221 data.writeStrongBinder(token);
5222 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5223 reply.readException();
5224 data.recycle();
5225 reply.recycle();
5226 }
5227
5228 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005229 public void startLockTaskModeOnCurrent() throws RemoteException {
5230 Parcel data = Parcel.obtain();
5231 Parcel reply = Parcel.obtain();
5232 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005233 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005234 reply.readException();
5235 data.recycle();
5236 reply.recycle();
5237 }
5238
5239 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005240 public void stopLockTaskMode() throws RemoteException {
5241 Parcel data = Parcel.obtain();
5242 Parcel reply = Parcel.obtain();
5243 data.writeInterfaceToken(IActivityManager.descriptor);
5244 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5245 reply.readException();
5246 data.recycle();
5247 reply.recycle();
5248 }
5249
5250 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005251 public void stopLockTaskModeOnCurrent() throws RemoteException {
5252 Parcel data = Parcel.obtain();
5253 Parcel reply = Parcel.obtain();
5254 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005255 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005256 reply.readException();
5257 data.recycle();
5258 reply.recycle();
5259 }
5260
5261 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005262 public boolean isInLockTaskMode() throws RemoteException {
5263 Parcel data = Parcel.obtain();
5264 Parcel reply = Parcel.obtain();
5265 data.writeInterfaceToken(IActivityManager.descriptor);
5266 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5267 reply.readException();
5268 boolean isInLockTaskMode = reply.readInt() == 1;
5269 data.recycle();
5270 reply.recycle();
5271 return isInLockTaskMode;
5272 }
5273
Craig Mautner688b5102014-03-27 16:55:03 -07005274 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005275 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005276 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005277 Parcel data = Parcel.obtain();
5278 Parcel reply = Parcel.obtain();
5279 data.writeInterfaceToken(IActivityManager.descriptor);
5280 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005281 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005282 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005283 reply.readException();
5284 data.recycle();
5285 reply.recycle();
5286 }
5287
Craig Mautneree2e45a2014-06-27 12:10:03 -07005288 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005289 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5290 Parcel data = Parcel.obtain();
5291 Parcel reply = Parcel.obtain();
5292 data.writeInterfaceToken(IActivityManager.descriptor);
5293 data.writeString(filename);
5294 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5295 reply.readException();
5296 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5297 data.recycle();
5298 reply.recycle();
5299 return icon;
5300 }
5301
5302 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005303 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005304 Parcel data = Parcel.obtain();
5305 Parcel reply = Parcel.obtain();
5306 data.writeInterfaceToken(IActivityManager.descriptor);
5307 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005308 data.writeInt(visible ? 1 : 0);
5309 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005310 reply.readException();
5311 boolean success = reply.readInt() > 0;
5312 data.recycle();
5313 reply.recycle();
5314 return success;
5315 }
5316
5317 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005318 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005319 Parcel data = Parcel.obtain();
5320 Parcel reply = Parcel.obtain();
5321 data.writeInterfaceToken(IActivityManager.descriptor);
5322 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005323 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005324 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005325 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005326 data.recycle();
5327 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005328 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005329 }
5330
5331 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005332 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005333 Parcel data = Parcel.obtain();
5334 Parcel reply = Parcel.obtain();
5335 data.writeInterfaceToken(IActivityManager.descriptor);
5336 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005337 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5338 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005339 reply.readException();
5340 data.recycle();
5341 reply.recycle();
5342 }
5343
5344 @Override
5345 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5346 Parcel data = Parcel.obtain();
5347 Parcel reply = Parcel.obtain();
5348 data.writeInterfaceToken(IActivityManager.descriptor);
5349 data.writeStrongBinder(token);
5350 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5351 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005352 reply.readException();
5353 data.recycle();
5354 reply.recycle();
5355 }
5356
Craig Mautner8746a472014-07-24 15:12:54 -07005357 @Override
5358 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5359 Parcel data = Parcel.obtain();
5360 Parcel reply = Parcel.obtain();
5361 data.writeInterfaceToken(IActivityManager.descriptor);
5362 data.writeStrongBinder(token);
5363 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5364 IBinder.FLAG_ONEWAY);
5365 reply.readException();
5366 data.recycle();
5367 reply.recycle();
5368 }
5369
Craig Mautner6e2f3952014-09-09 14:26:41 -07005370 @Override
5371 public void bootAnimationComplete() throws RemoteException {
5372 Parcel data = Parcel.obtain();
5373 Parcel reply = Parcel.obtain();
5374 data.writeInterfaceToken(IActivityManager.descriptor);
5375 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5376 reply.readException();
5377 data.recycle();
5378 reply.recycle();
5379 }
5380
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005381 private IBinder mRemote;
5382}