blob: be7287f6d123e1f640d361f86b07edbf57c57959 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070021import android.content.IIntentReceiver;
22import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.Intent;
24import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070025import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070026import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070027import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.pm.ConfigurationInfo;
29import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070030import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070031import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070033import android.graphics.Bitmap;
34import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080035import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036import android.net.Uri;
37import android.os.Binder;
38import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070039import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.os.IBinder;
41import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070042import android.os.ParcelFileDescriptor;
43import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070044import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070045import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070047import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070048import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080051import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070052import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080053import com.android.internal.os.IResultReceiver;
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;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800469 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800471 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800472 }
473 reply.writeNoException();
474 return true;
475 }
476
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800477 case ATTACH_APPLICATION_TRANSACTION: {
478 data.enforceInterface(IActivityManager.descriptor);
479 IApplicationThread app = ApplicationThreadNative.asInterface(
480 data.readStrongBinder());
481 if (app != null) {
482 attachApplication(app);
483 }
484 reply.writeNoException();
485 return true;
486 }
487
488 case ACTIVITY_IDLE_TRANSACTION: {
489 data.enforceInterface(IActivityManager.descriptor);
490 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700491 Configuration config = null;
492 if (data.readInt() != 0) {
493 config = Configuration.CREATOR.createFromParcel(data);
494 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700495 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800496 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700497 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800498 }
499 reply.writeNoException();
500 return true;
501 }
502
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700503 case ACTIVITY_RESUMED_TRANSACTION: {
504 data.enforceInterface(IActivityManager.descriptor);
505 IBinder token = data.readStrongBinder();
506 activityResumed(token);
507 reply.writeNoException();
508 return true;
509 }
510
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800511 case ACTIVITY_PAUSED_TRANSACTION: {
512 data.enforceInterface(IActivityManager.descriptor);
513 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700514 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800515 reply.writeNoException();
516 return true;
517 }
518
519 case ACTIVITY_STOPPED_TRANSACTION: {
520 data.enforceInterface(IActivityManager.descriptor);
521 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800522 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700523 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800524 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700525 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 reply.writeNoException();
527 return true;
528 }
529
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800530 case ACTIVITY_SLEPT_TRANSACTION: {
531 data.enforceInterface(IActivityManager.descriptor);
532 IBinder token = data.readStrongBinder();
533 activitySlept(token);
534 reply.writeNoException();
535 return true;
536 }
537
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800538 case ACTIVITY_DESTROYED_TRANSACTION: {
539 data.enforceInterface(IActivityManager.descriptor);
540 IBinder token = data.readStrongBinder();
541 activityDestroyed(token);
542 reply.writeNoException();
543 return true;
544 }
545
546 case GET_CALLING_PACKAGE_TRANSACTION: {
547 data.enforceInterface(IActivityManager.descriptor);
548 IBinder token = data.readStrongBinder();
549 String res = token != null ? getCallingPackage(token) : null;
550 reply.writeNoException();
551 reply.writeString(res);
552 return true;
553 }
554
555 case GET_CALLING_ACTIVITY_TRANSACTION: {
556 data.enforceInterface(IActivityManager.descriptor);
557 IBinder token = data.readStrongBinder();
558 ComponentName cn = getCallingActivity(token);
559 reply.writeNoException();
560 ComponentName.writeToParcel(cn, reply);
561 return true;
562 }
563
Winson Chung1147c402014-05-14 11:05:00 -0700564 case GET_APP_TASKS_TRANSACTION: {
565 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700566 String callingPackage = data.readString();
567 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700568 reply.writeNoException();
569 int N = list != null ? list.size() : -1;
570 reply.writeInt(N);
571 int i;
572 for (i=0; i<N; i++) {
573 IAppTask task = list.get(i);
574 reply.writeStrongBinder(task.asBinder());
575 }
576 return true;
577 }
578
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700579 case ADD_APP_TASK_TRANSACTION: {
580 data.enforceInterface(IActivityManager.descriptor);
581 IBinder activityToken = data.readStrongBinder();
582 Intent intent = Intent.CREATOR.createFromParcel(data);
583 ActivityManager.TaskDescription descr
584 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
585 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
586 int res = addAppTask(activityToken, intent, descr, thumbnail);
587 reply.writeNoException();
588 reply.writeInt(res);
589 return true;
590 }
591
592 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
593 data.enforceInterface(IActivityManager.descriptor);
594 Point size = getAppTaskThumbnailSize();
595 reply.writeNoException();
596 size.writeToParcel(reply, 0);
597 return true;
598 }
599
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800600 case GET_TASKS_TRANSACTION: {
601 data.enforceInterface(IActivityManager.descriptor);
602 int maxNum = data.readInt();
603 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700604 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800605 reply.writeNoException();
606 int N = list != null ? list.size() : -1;
607 reply.writeInt(N);
608 int i;
609 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700610 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800611 info.writeToParcel(reply, 0);
612 }
613 return true;
614 }
615
616 case GET_RECENT_TASKS_TRANSACTION: {
617 data.enforceInterface(IActivityManager.descriptor);
618 int maxNum = data.readInt();
619 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700620 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800621 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700622 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800623 reply.writeNoException();
624 reply.writeTypedList(list);
625 return true;
626 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700627
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700628 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800629 data.enforceInterface(IActivityManager.descriptor);
630 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700631 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800632 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700633 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800634 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700635 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700636 } else {
637 reply.writeInt(0);
638 }
639 return true;
640 }
641
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800642 case GET_SERVICES_TRANSACTION: {
643 data.enforceInterface(IActivityManager.descriptor);
644 int maxNum = data.readInt();
645 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700646 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800647 reply.writeNoException();
648 int N = list != null ? list.size() : -1;
649 reply.writeInt(N);
650 int i;
651 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700652 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800653 info.writeToParcel(reply, 0);
654 }
655 return true;
656 }
657
658 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
659 data.enforceInterface(IActivityManager.descriptor);
660 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
661 reply.writeNoException();
662 reply.writeTypedList(list);
663 return true;
664 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700665
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800666 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
667 data.enforceInterface(IActivityManager.descriptor);
668 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
669 reply.writeNoException();
670 reply.writeTypedList(list);
671 return true;
672 }
673
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700674 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
675 data.enforceInterface(IActivityManager.descriptor);
676 List<ApplicationInfo> list = getRunningExternalApplications();
677 reply.writeNoException();
678 reply.writeTypedList(list);
679 return true;
680 }
681
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800682 case MOVE_TASK_TO_FRONT_TRANSACTION: {
683 data.enforceInterface(IActivityManager.descriptor);
684 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800685 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700686 Bundle options = data.readInt() != 0
687 ? Bundle.CREATOR.createFromParcel(data) : null;
688 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800689 reply.writeNoException();
690 return true;
691 }
692
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800693 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
694 data.enforceInterface(IActivityManager.descriptor);
695 IBinder token = data.readStrongBinder();
696 boolean nonRoot = data.readInt() != 0;
697 boolean res = moveActivityTaskToBack(token, nonRoot);
698 reply.writeNoException();
699 reply.writeInt(res ? 1 : 0);
700 return true;
701 }
702
703 case MOVE_TASK_BACKWARDS_TRANSACTION: {
704 data.enforceInterface(IActivityManager.descriptor);
705 int task = data.readInt();
706 moveTaskBackwards(task);
707 reply.writeNoException();
708 return true;
709 }
710
Craig Mautnerc00204b2013-03-05 15:02:14 -0800711 case MOVE_TASK_TO_STACK_TRANSACTION: {
712 data.enforceInterface(IActivityManager.descriptor);
713 int taskId = data.readInt();
714 int stackId = data.readInt();
715 boolean toTop = data.readInt() != 0;
716 moveTaskToStack(taskId, stackId, toTop);
717 reply.writeNoException();
718 return true;
719 }
720
721 case RESIZE_STACK_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800723 int stackId = data.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800724 Rect r = Rect.CREATOR.createFromParcel(data);
725 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800726 reply.writeNoException();
727 return true;
728 }
729
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800730 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700731 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800732 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700733 reply.writeNoException();
734 reply.writeTypedList(list);
735 return true;
736 }
737
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800738 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700739 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800740 int stackId = data.readInt();
741 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700742 reply.writeNoException();
743 if (info != null) {
744 reply.writeInt(1);
745 info.writeToParcel(reply, 0);
746 } else {
747 reply.writeInt(0);
748 }
749 return true;
750 }
751
Winson Chung303e1ff2014-03-07 15:06:19 -0800752 case IS_IN_HOME_STACK_TRANSACTION: {
753 data.enforceInterface(IActivityManager.descriptor);
754 int taskId = data.readInt();
755 boolean isInHomeStack = isInHomeStack(taskId);
756 reply.writeNoException();
757 reply.writeInt(isInHomeStack ? 1 : 0);
758 return true;
759 }
760
Craig Mautnercf910b02013-04-23 11:23:27 -0700761 case SET_FOCUSED_STACK_TRANSACTION: {
762 data.enforceInterface(IActivityManager.descriptor);
763 int stackId = data.readInt();
764 setFocusedStack(stackId);
765 reply.writeNoException();
766 return true;
767 }
768
Winson Chungd16c5652015-01-26 16:11:07 -0800769 case GET_FOCUSED_STACK_ID_TRANSACTION: {
770 data.enforceInterface(IActivityManager.descriptor);
771 int focusedStackId = getFocusedStackId();
772 reply.writeNoException();
773 reply.writeInt(focusedStackId);
774 return true;
775 }
776
Winson Chung740c3ac2014-11-12 16:14:38 -0800777 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 IBinder token = data.readStrongBinder();
780 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
781 reply.writeNoException();
782 return true;
783 }
784
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800785 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
786 data.enforceInterface(IActivityManager.descriptor);
787 IBinder token = data.readStrongBinder();
788 boolean onlyRoot = data.readInt() != 0;
789 int res = token != null
790 ? getTaskForActivity(token, onlyRoot) : -1;
791 reply.writeNoException();
792 reply.writeInt(res);
793 return true;
794 }
795
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800796 case GET_CONTENT_PROVIDER_TRANSACTION: {
797 data.enforceInterface(IActivityManager.descriptor);
798 IBinder b = data.readStrongBinder();
799 IApplicationThread app = ApplicationThreadNative.asInterface(b);
800 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700801 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700802 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700803 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800804 reply.writeNoException();
805 if (cph != null) {
806 reply.writeInt(1);
807 cph.writeToParcel(reply, 0);
808 } else {
809 reply.writeInt(0);
810 }
811 return true;
812 }
813
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800814 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
815 data.enforceInterface(IActivityManager.descriptor);
816 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700817 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800818 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700819 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800820 reply.writeNoException();
821 if (cph != null) {
822 reply.writeInt(1);
823 cph.writeToParcel(reply, 0);
824 } else {
825 reply.writeInt(0);
826 }
827 return true;
828 }
829
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800830 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
831 data.enforceInterface(IActivityManager.descriptor);
832 IBinder b = data.readStrongBinder();
833 IApplicationThread app = ApplicationThreadNative.asInterface(b);
834 ArrayList<ContentProviderHolder> providers =
835 data.createTypedArrayList(ContentProviderHolder.CREATOR);
836 publishContentProviders(app, providers);
837 reply.writeNoException();
838 return true;
839 }
840
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700841 case REF_CONTENT_PROVIDER_TRANSACTION: {
842 data.enforceInterface(IActivityManager.descriptor);
843 IBinder b = data.readStrongBinder();
844 int stable = data.readInt();
845 int unstable = data.readInt();
846 boolean res = refContentProvider(b, stable, unstable);
847 reply.writeNoException();
848 reply.writeInt(res ? 1 : 0);
849 return true;
850 }
851
852 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
853 data.enforceInterface(IActivityManager.descriptor);
854 IBinder b = data.readStrongBinder();
855 unstableProviderDied(b);
856 reply.writeNoException();
857 return true;
858 }
859
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700860 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
861 data.enforceInterface(IActivityManager.descriptor);
862 IBinder b = data.readStrongBinder();
863 appNotRespondingViaProvider(b);
864 reply.writeNoException();
865 return true;
866 }
867
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800868 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
869 data.enforceInterface(IActivityManager.descriptor);
870 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700871 boolean stable = data.readInt() != 0;
872 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 reply.writeNoException();
874 return true;
875 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800876
877 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
878 data.enforceInterface(IActivityManager.descriptor);
879 String name = data.readString();
880 IBinder token = data.readStrongBinder();
881 removeContentProviderExternal(name, token);
882 reply.writeNoException();
883 return true;
884 }
885
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700886 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
887 data.enforceInterface(IActivityManager.descriptor);
888 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
889 PendingIntent pi = getRunningServiceControlPanel(comp);
890 reply.writeNoException();
891 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
892 return true;
893 }
894
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800895 case START_SERVICE_TRANSACTION: {
896 data.enforceInterface(IActivityManager.descriptor);
897 IBinder b = data.readStrongBinder();
898 IApplicationThread app = ApplicationThreadNative.asInterface(b);
899 Intent service = Intent.CREATOR.createFromParcel(data);
900 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700901 int userId = data.readInt();
902 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800903 reply.writeNoException();
904 ComponentName.writeToParcel(cn, reply);
905 return true;
906 }
907
908 case STOP_SERVICE_TRANSACTION: {
909 data.enforceInterface(IActivityManager.descriptor);
910 IBinder b = data.readStrongBinder();
911 IApplicationThread app = ApplicationThreadNative.asInterface(b);
912 Intent service = Intent.CREATOR.createFromParcel(data);
913 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700914 int userId = data.readInt();
915 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800916 reply.writeNoException();
917 reply.writeInt(res);
918 return true;
919 }
920
921 case STOP_SERVICE_TOKEN_TRANSACTION: {
922 data.enforceInterface(IActivityManager.descriptor);
923 ComponentName className = ComponentName.readFromParcel(data);
924 IBinder token = data.readStrongBinder();
925 int startId = data.readInt();
926 boolean res = stopServiceToken(className, token, startId);
927 reply.writeNoException();
928 reply.writeInt(res ? 1 : 0);
929 return true;
930 }
931
932 case SET_SERVICE_FOREGROUND_TRANSACTION: {
933 data.enforceInterface(IActivityManager.descriptor);
934 ComponentName className = ComponentName.readFromParcel(data);
935 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700936 int id = data.readInt();
937 Notification notification = null;
938 if (data.readInt() != 0) {
939 notification = Notification.CREATOR.createFromParcel(data);
940 }
941 boolean removeNotification = data.readInt() != 0;
942 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800943 reply.writeNoException();
944 return true;
945 }
946
947 case BIND_SERVICE_TRANSACTION: {
948 data.enforceInterface(IActivityManager.descriptor);
949 IBinder b = data.readStrongBinder();
950 IApplicationThread app = ApplicationThreadNative.asInterface(b);
951 IBinder token = data.readStrongBinder();
952 Intent service = Intent.CREATOR.createFromParcel(data);
953 String resolvedType = data.readString();
954 b = data.readStrongBinder();
955 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800956 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800957 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800958 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800959 reply.writeNoException();
960 reply.writeInt(res);
961 return true;
962 }
963
964 case UNBIND_SERVICE_TRANSACTION: {
965 data.enforceInterface(IActivityManager.descriptor);
966 IBinder b = data.readStrongBinder();
967 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
968 boolean res = unbindService(conn);
969 reply.writeNoException();
970 reply.writeInt(res ? 1 : 0);
971 return true;
972 }
973
974 case PUBLISH_SERVICE_TRANSACTION: {
975 data.enforceInterface(IActivityManager.descriptor);
976 IBinder token = data.readStrongBinder();
977 Intent intent = Intent.CREATOR.createFromParcel(data);
978 IBinder service = data.readStrongBinder();
979 publishService(token, intent, service);
980 reply.writeNoException();
981 return true;
982 }
983
984 case UNBIND_FINISHED_TRANSACTION: {
985 data.enforceInterface(IActivityManager.descriptor);
986 IBinder token = data.readStrongBinder();
987 Intent intent = Intent.CREATOR.createFromParcel(data);
988 boolean doRebind = data.readInt() != 0;
989 unbindFinished(token, intent, doRebind);
990 reply.writeNoException();
991 return true;
992 }
993
994 case SERVICE_DONE_EXECUTING_TRANSACTION: {
995 data.enforceInterface(IActivityManager.descriptor);
996 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700997 int type = data.readInt();
998 int startId = data.readInt();
999 int res = data.readInt();
1000 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001001 reply.writeNoException();
1002 return true;
1003 }
1004
1005 case START_INSTRUMENTATION_TRANSACTION: {
1006 data.enforceInterface(IActivityManager.descriptor);
1007 ComponentName className = ComponentName.readFromParcel(data);
1008 String profileFile = data.readString();
1009 int fl = data.readInt();
1010 Bundle arguments = data.readBundle();
1011 IBinder b = data.readStrongBinder();
1012 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001013 b = data.readStrongBinder();
1014 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001015 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001016 String abiOverride = data.readString();
1017 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1018 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001019 reply.writeNoException();
1020 reply.writeInt(res ? 1 : 0);
1021 return true;
1022 }
1023
1024
1025 case FINISH_INSTRUMENTATION_TRANSACTION: {
1026 data.enforceInterface(IActivityManager.descriptor);
1027 IBinder b = data.readStrongBinder();
1028 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1029 int resultCode = data.readInt();
1030 Bundle results = data.readBundle();
1031 finishInstrumentation(app, resultCode, results);
1032 reply.writeNoException();
1033 return true;
1034 }
1035
1036 case GET_CONFIGURATION_TRANSACTION: {
1037 data.enforceInterface(IActivityManager.descriptor);
1038 Configuration config = getConfiguration();
1039 reply.writeNoException();
1040 config.writeToParcel(reply, 0);
1041 return true;
1042 }
1043
1044 case UPDATE_CONFIGURATION_TRANSACTION: {
1045 data.enforceInterface(IActivityManager.descriptor);
1046 Configuration config = Configuration.CREATOR.createFromParcel(data);
1047 updateConfiguration(config);
1048 reply.writeNoException();
1049 return true;
1050 }
1051
1052 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1053 data.enforceInterface(IActivityManager.descriptor);
1054 IBinder token = data.readStrongBinder();
1055 int requestedOrientation = data.readInt();
1056 setRequestedOrientation(token, requestedOrientation);
1057 reply.writeNoException();
1058 return true;
1059 }
1060
1061 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1062 data.enforceInterface(IActivityManager.descriptor);
1063 IBinder token = data.readStrongBinder();
1064 int req = getRequestedOrientation(token);
1065 reply.writeNoException();
1066 reply.writeInt(req);
1067 return true;
1068 }
1069
1070 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1071 data.enforceInterface(IActivityManager.descriptor);
1072 IBinder token = data.readStrongBinder();
1073 ComponentName cn = getActivityClassForToken(token);
1074 reply.writeNoException();
1075 ComponentName.writeToParcel(cn, reply);
1076 return true;
1077 }
1078
1079 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1080 data.enforceInterface(IActivityManager.descriptor);
1081 IBinder token = data.readStrongBinder();
1082 reply.writeNoException();
1083 reply.writeString(getPackageForToken(token));
1084 return true;
1085 }
1086
1087 case GET_INTENT_SENDER_TRANSACTION: {
1088 data.enforceInterface(IActivityManager.descriptor);
1089 int type = data.readInt();
1090 String packageName = data.readString();
1091 IBinder token = data.readStrongBinder();
1092 String resultWho = data.readString();
1093 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001094 Intent[] requestIntents;
1095 String[] requestResolvedTypes;
1096 if (data.readInt() != 0) {
1097 requestIntents = data.createTypedArray(Intent.CREATOR);
1098 requestResolvedTypes = data.createStringArray();
1099 } else {
1100 requestIntents = null;
1101 requestResolvedTypes = null;
1102 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001103 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001104 Bundle options = data.readInt() != 0
1105 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001106 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001107 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001108 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001109 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001110 reply.writeNoException();
1111 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1112 return true;
1113 }
1114
1115 case CANCEL_INTENT_SENDER_TRANSACTION: {
1116 data.enforceInterface(IActivityManager.descriptor);
1117 IIntentSender r = IIntentSender.Stub.asInterface(
1118 data.readStrongBinder());
1119 cancelIntentSender(r);
1120 reply.writeNoException();
1121 return true;
1122 }
1123
1124 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1125 data.enforceInterface(IActivityManager.descriptor);
1126 IIntentSender r = IIntentSender.Stub.asInterface(
1127 data.readStrongBinder());
1128 String res = getPackageForIntentSender(r);
1129 reply.writeNoException();
1130 reply.writeString(res);
1131 return true;
1132 }
1133
Christopher Tatec4a07d12012-04-06 14:19:13 -07001134 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1135 data.enforceInterface(IActivityManager.descriptor);
1136 IIntentSender r = IIntentSender.Stub.asInterface(
1137 data.readStrongBinder());
1138 int res = getUidForIntentSender(r);
1139 reply.writeNoException();
1140 reply.writeInt(res);
1141 return true;
1142 }
1143
Dianne Hackborn41203752012-08-31 14:05:51 -07001144 case HANDLE_INCOMING_USER_TRANSACTION: {
1145 data.enforceInterface(IActivityManager.descriptor);
1146 int callingPid = data.readInt();
1147 int callingUid = data.readInt();
1148 int userId = data.readInt();
1149 boolean allowAll = data.readInt() != 0 ;
1150 boolean requireFull = data.readInt() != 0;
1151 String name = data.readString();
1152 String callerPackage = data.readString();
1153 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1154 requireFull, name, callerPackage);
1155 reply.writeNoException();
1156 reply.writeInt(res);
1157 return true;
1158 }
1159
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001160 case SET_PROCESS_LIMIT_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 int max = data.readInt();
1163 setProcessLimit(max);
1164 reply.writeNoException();
1165 return true;
1166 }
1167
1168 case GET_PROCESS_LIMIT_TRANSACTION: {
1169 data.enforceInterface(IActivityManager.descriptor);
1170 int limit = getProcessLimit();
1171 reply.writeNoException();
1172 reply.writeInt(limit);
1173 return true;
1174 }
1175
1176 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1177 data.enforceInterface(IActivityManager.descriptor);
1178 IBinder token = data.readStrongBinder();
1179 int pid = data.readInt();
1180 boolean isForeground = data.readInt() != 0;
1181 setProcessForeground(token, pid, isForeground);
1182 reply.writeNoException();
1183 return true;
1184 }
1185
1186 case CHECK_PERMISSION_TRANSACTION: {
1187 data.enforceInterface(IActivityManager.descriptor);
1188 String perm = data.readString();
1189 int pid = data.readInt();
1190 int uid = data.readInt();
1191 int res = checkPermission(perm, pid, uid);
1192 reply.writeNoException();
1193 reply.writeInt(res);
1194 return true;
1195 }
1196
Dianne Hackbornff170242014-11-19 10:59:01 -08001197 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1198 data.enforceInterface(IActivityManager.descriptor);
1199 String perm = data.readString();
1200 int pid = data.readInt();
1201 int uid = data.readInt();
1202 IBinder token = data.readStrongBinder();
1203 int res = checkPermissionWithToken(perm, pid, uid, token);
1204 reply.writeNoException();
1205 reply.writeInt(res);
1206 return true;
1207 }
1208
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001209 case CHECK_URI_PERMISSION_TRANSACTION: {
1210 data.enforceInterface(IActivityManager.descriptor);
1211 Uri uri = Uri.CREATOR.createFromParcel(data);
1212 int pid = data.readInt();
1213 int uid = data.readInt();
1214 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001215 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001216 IBinder callerToken = data.readStrongBinder();
1217 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001218 reply.writeNoException();
1219 reply.writeInt(res);
1220 return true;
1221 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001222
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001224 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001225 String packageName = data.readString();
1226 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1227 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001228 int userId = data.readInt();
1229 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001230 reply.writeNoException();
1231 reply.writeInt(res ? 1 : 0);
1232 return true;
1233 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001234
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001235 case GRANT_URI_PERMISSION_TRANSACTION: {
1236 data.enforceInterface(IActivityManager.descriptor);
1237 IBinder b = data.readStrongBinder();
1238 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1239 String targetPkg = data.readString();
1240 Uri uri = Uri.CREATOR.createFromParcel(data);
1241 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001242 int userId = data.readInt();
1243 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001244 reply.writeNoException();
1245 return true;
1246 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001247
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001248 case REVOKE_URI_PERMISSION_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 IBinder b = data.readStrongBinder();
1251 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1252 Uri uri = Uri.CREATOR.createFromParcel(data);
1253 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001254 int userId = data.readInt();
1255 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001256 reply.writeNoException();
1257 return true;
1258 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001259
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001260 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1261 data.enforceInterface(IActivityManager.descriptor);
1262 Uri uri = Uri.CREATOR.createFromParcel(data);
1263 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001264 int userId = data.readInt();
1265 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001266 reply.writeNoException();
1267 return true;
1268 }
1269
1270 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1271 data.enforceInterface(IActivityManager.descriptor);
1272 Uri uri = Uri.CREATOR.createFromParcel(data);
1273 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001274 int userId = data.readInt();
1275 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001276 reply.writeNoException();
1277 return true;
1278 }
1279
1280 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001282 final String packageName = data.readString();
1283 final boolean incoming = data.readInt() != 0;
1284 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1285 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001286 reply.writeNoException();
1287 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1288 return true;
1289 }
1290
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001291 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1292 data.enforceInterface(IActivityManager.descriptor);
1293 IBinder b = data.readStrongBinder();
1294 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1295 boolean waiting = data.readInt() != 0;
1296 showWaitingForDebugger(app, waiting);
1297 reply.writeNoException();
1298 return true;
1299 }
1300
1301 case GET_MEMORY_INFO_TRANSACTION: {
1302 data.enforceInterface(IActivityManager.descriptor);
1303 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1304 getMemoryInfo(mi);
1305 reply.writeNoException();
1306 mi.writeToParcel(reply, 0);
1307 return true;
1308 }
1309
1310 case UNHANDLED_BACK_TRANSACTION: {
1311 data.enforceInterface(IActivityManager.descriptor);
1312 unhandledBack();
1313 reply.writeNoException();
1314 return true;
1315 }
1316
1317 case OPEN_CONTENT_URI_TRANSACTION: {
1318 data.enforceInterface(IActivityManager.descriptor);
1319 Uri uri = Uri.parse(data.readString());
1320 ParcelFileDescriptor pfd = openContentUri(uri);
1321 reply.writeNoException();
1322 if (pfd != null) {
1323 reply.writeInt(1);
1324 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1325 } else {
1326 reply.writeInt(0);
1327 }
1328 return true;
1329 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001330
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001331 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1332 data.enforceInterface(IActivityManager.descriptor);
1333 setLockScreenShown(data.readInt() != 0);
1334 reply.writeNoException();
1335 return true;
1336 }
1337
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001338 case SET_DEBUG_APP_TRANSACTION: {
1339 data.enforceInterface(IActivityManager.descriptor);
1340 String pn = data.readString();
1341 boolean wfd = data.readInt() != 0;
1342 boolean per = data.readInt() != 0;
1343 setDebugApp(pn, wfd, per);
1344 reply.writeNoException();
1345 return true;
1346 }
1347
1348 case SET_ALWAYS_FINISH_TRANSACTION: {
1349 data.enforceInterface(IActivityManager.descriptor);
1350 boolean enabled = data.readInt() != 0;
1351 setAlwaysFinish(enabled);
1352 reply.writeNoException();
1353 return true;
1354 }
1355
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001356 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001357 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001358 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001359 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001360 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001361 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001362 return true;
1363 }
1364
1365 case ENTER_SAFE_MODE_TRANSACTION: {
1366 data.enforceInterface(IActivityManager.descriptor);
1367 enterSafeMode();
1368 reply.writeNoException();
1369 return true;
1370 }
1371
1372 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
1374 IIntentSender is = IIntentSender.Stub.asInterface(
1375 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001376 int sourceUid = data.readInt();
1377 String sourcePkg = data.readString();
1378 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001379 reply.writeNoException();
1380 return true;
1381 }
1382
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001383 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001384 data.enforceInterface(IActivityManager.descriptor);
1385 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001386 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001387 boolean secure = data.readInt() != 0;
1388 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001389 reply.writeNoException();
1390 reply.writeInt(res ? 1 : 0);
1391 return true;
1392 }
1393
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001394 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1395 data.enforceInterface(IActivityManager.descriptor);
1396 String reason = data.readString();
1397 boolean res = killProcessesBelowForeground(reason);
1398 reply.writeNoException();
1399 reply.writeInt(res ? 1 : 0);
1400 return true;
1401 }
1402
Dan Egnor60d87622009-12-16 16:32:58 -08001403 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1404 data.enforceInterface(IActivityManager.descriptor);
1405 IBinder app = data.readStrongBinder();
1406 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1407 handleApplicationCrash(app, ci);
1408 reply.writeNoException();
1409 return true;
1410 }
1411
1412 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001413 data.enforceInterface(IActivityManager.descriptor);
1414 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001415 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001416 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001417 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001418 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001419 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001420 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001421 return true;
1422 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001423
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001424 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1425 data.enforceInterface(IActivityManager.descriptor);
1426 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001427 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001428 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1429 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001430 reply.writeNoException();
1431 return true;
1432 }
1433
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001434 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1435 data.enforceInterface(IActivityManager.descriptor);
1436 int sig = data.readInt();
1437 signalPersistentProcesses(sig);
1438 reply.writeNoException();
1439 return true;
1440 }
1441
Dianne Hackborn03abb812010-01-04 18:43:19 -08001442 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1443 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001444 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001445 int userId = data.readInt();
1446 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001447 reply.writeNoException();
1448 return true;
1449 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001450
1451 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1452 data.enforceInterface(IActivityManager.descriptor);
1453 killAllBackgroundProcesses();
1454 reply.writeNoException();
1455 return true;
1456 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001457
Dianne Hackborn03abb812010-01-04 18:43:19 -08001458 case FORCE_STOP_PACKAGE_TRANSACTION: {
1459 data.enforceInterface(IActivityManager.descriptor);
1460 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001461 int userId = data.readInt();
1462 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001463 reply.writeNoException();
1464 return true;
1465 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001466
1467 case GET_MY_MEMORY_STATE_TRANSACTION: {
1468 data.enforceInterface(IActivityManager.descriptor);
1469 ActivityManager.RunningAppProcessInfo info =
1470 new ActivityManager.RunningAppProcessInfo();
1471 getMyMemoryState(info);
1472 reply.writeNoException();
1473 info.writeToParcel(reply, 0);
1474 return true;
1475 }
1476
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001477 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1478 data.enforceInterface(IActivityManager.descriptor);
1479 ConfigurationInfo config = getDeviceConfigurationInfo();
1480 reply.writeNoException();
1481 config.writeToParcel(reply, 0);
1482 return true;
1483 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001484
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001485 case PROFILE_CONTROL_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001488 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001489 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001490 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001491 ProfilerInfo profilerInfo = data.readInt() != 0
1492 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1493 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001494 reply.writeNoException();
1495 reply.writeInt(res ? 1 : 0);
1496 return true;
1497 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001498
Dianne Hackborn55280a92009-05-07 15:53:46 -07001499 case SHUTDOWN_TRANSACTION: {
1500 data.enforceInterface(IActivityManager.descriptor);
1501 boolean res = shutdown(data.readInt());
1502 reply.writeNoException();
1503 reply.writeInt(res ? 1 : 0);
1504 return true;
1505 }
1506
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001507 case STOP_APP_SWITCHES_TRANSACTION: {
1508 data.enforceInterface(IActivityManager.descriptor);
1509 stopAppSwitches();
1510 reply.writeNoException();
1511 return true;
1512 }
1513
1514 case RESUME_APP_SWITCHES_TRANSACTION: {
1515 data.enforceInterface(IActivityManager.descriptor);
1516 resumeAppSwitches();
1517 reply.writeNoException();
1518 return true;
1519 }
1520
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001521 case PEEK_SERVICE_TRANSACTION: {
1522 data.enforceInterface(IActivityManager.descriptor);
1523 Intent service = Intent.CREATOR.createFromParcel(data);
1524 String resolvedType = data.readString();
1525 IBinder binder = peekService(service, resolvedType);
1526 reply.writeNoException();
1527 reply.writeStrongBinder(binder);
1528 return true;
1529 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001530
1531 case START_BACKUP_AGENT_TRANSACTION: {
1532 data.enforceInterface(IActivityManager.descriptor);
1533 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1534 int backupRestoreMode = data.readInt();
1535 boolean success = bindBackupAgent(info, backupRestoreMode);
1536 reply.writeNoException();
1537 reply.writeInt(success ? 1 : 0);
1538 return true;
1539 }
1540
1541 case BACKUP_AGENT_CREATED_TRANSACTION: {
1542 data.enforceInterface(IActivityManager.descriptor);
1543 String packageName = data.readString();
1544 IBinder agent = data.readStrongBinder();
1545 backupAgentCreated(packageName, agent);
1546 reply.writeNoException();
1547 return true;
1548 }
1549
1550 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1551 data.enforceInterface(IActivityManager.descriptor);
1552 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1553 unbindBackupAgent(info);
1554 reply.writeNoException();
1555 return true;
1556 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001557
1558 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1559 data.enforceInterface(IActivityManager.descriptor);
1560 String packageName = data.readString();
1561 addPackageDependency(packageName);
1562 reply.writeNoException();
1563 return true;
1564 }
1565
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001566 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001567 data.enforceInterface(IActivityManager.descriptor);
1568 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001569 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001570 String reason = data.readString();
1571 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001572 reply.writeNoException();
1573 return true;
1574 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001575
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001576 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1577 data.enforceInterface(IActivityManager.descriptor);
1578 String reason = data.readString();
1579 closeSystemDialogs(reason);
1580 reply.writeNoException();
1581 return true;
1582 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001583
1584 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1585 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001586 int[] pids = data.createIntArray();
1587 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001588 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001589 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001590 return true;
1591 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001592
1593 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1594 data.enforceInterface(IActivityManager.descriptor);
1595 String processName = data.readString();
1596 int uid = data.readInt();
1597 killApplicationProcess(processName, uid);
1598 reply.writeNoException();
1599 return true;
1600 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001601
1602 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1603 data.enforceInterface(IActivityManager.descriptor);
1604 IBinder token = data.readStrongBinder();
1605 String packageName = data.readString();
1606 int enterAnim = data.readInt();
1607 int exitAnim = data.readInt();
1608 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001609 reply.writeNoException();
1610 return true;
1611 }
1612
1613 case IS_USER_A_MONKEY_TRANSACTION: {
1614 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001615 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001616 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001617 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001618 return true;
1619 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001620
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001621 case SET_USER_IS_MONKEY_TRANSACTION: {
1622 data.enforceInterface(IActivityManager.descriptor);
1623 final boolean monkey = (data.readInt() == 1);
1624 setUserIsMonkey(monkey);
1625 reply.writeNoException();
1626 return true;
1627 }
1628
Dianne Hackborn860755f2010-06-03 18:47:52 -07001629 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1630 data.enforceInterface(IActivityManager.descriptor);
1631 finishHeavyWeightApp();
1632 reply.writeNoException();
1633 return true;
1634 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001635
1636 case IS_IMMERSIVE_TRANSACTION: {
1637 data.enforceInterface(IActivityManager.descriptor);
1638 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001639 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001640 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001641 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001642 return true;
1643 }
1644
Craig Mautnerd61dc202014-07-07 11:09:11 -07001645 case IS_TOP_OF_TASK_TRANSACTION: {
1646 data.enforceInterface(IActivityManager.descriptor);
1647 IBinder token = data.readStrongBinder();
1648 final boolean isTopOfTask = isTopOfTask(token);
1649 reply.writeNoException();
1650 reply.writeInt(isTopOfTask ? 1 : 0);
1651 return true;
1652 }
1653
Craig Mautner5eda9b32013-07-02 11:58:16 -07001654 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001655 data.enforceInterface(IActivityManager.descriptor);
1656 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001657 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001658 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001659 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001660 return true;
1661 }
1662
1663 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1664 data.enforceInterface(IActivityManager.descriptor);
1665 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001666 final Bundle bundle;
1667 if (data.readInt() == 0) {
1668 bundle = null;
1669 } else {
1670 bundle = data.readBundle();
1671 }
1672 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1673 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001674 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001675 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001676 return true;
1677 }
1678
Craig Mautner233ceee2014-05-09 17:05:11 -07001679 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1680 data.enforceInterface(IActivityManager.descriptor);
1681 IBinder token = data.readStrongBinder();
1682 final ActivityOptions options = getActivityOptions(token);
1683 reply.writeNoException();
1684 reply.writeBundle(options == null ? null : options.toBundle());
1685 return true;
1686 }
1687
Daniel Sandler69a48172010-06-23 16:29:36 -04001688 case SET_IMMERSIVE_TRANSACTION: {
1689 data.enforceInterface(IActivityManager.descriptor);
1690 IBinder token = data.readStrongBinder();
1691 boolean imm = data.readInt() == 1;
1692 setImmersive(token, imm);
1693 reply.writeNoException();
1694 return true;
1695 }
1696
1697 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1698 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001699 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001700 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001701 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001702 return true;
1703 }
1704
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001705 case CRASH_APPLICATION_TRANSACTION: {
1706 data.enforceInterface(IActivityManager.descriptor);
1707 int uid = data.readInt();
1708 int initialPid = data.readInt();
1709 String packageName = data.readString();
1710 String message = data.readString();
1711 crashApplication(uid, initialPid, packageName, message);
1712 reply.writeNoException();
1713 return true;
1714 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001715
1716 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1717 data.enforceInterface(IActivityManager.descriptor);
1718 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001719 int userId = data.readInt();
1720 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001721 reply.writeNoException();
1722 reply.writeString(type);
1723 return true;
1724 }
1725
Dianne Hackborn7e269642010-08-25 19:50:20 -07001726 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1727 data.enforceInterface(IActivityManager.descriptor);
1728 String name = data.readString();
1729 IBinder perm = newUriPermissionOwner(name);
1730 reply.writeNoException();
1731 reply.writeStrongBinder(perm);
1732 return true;
1733 }
1734
1735 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1736 data.enforceInterface(IActivityManager.descriptor);
1737 IBinder owner = data.readStrongBinder();
1738 int fromUid = data.readInt();
1739 String targetPkg = data.readString();
1740 Uri uri = Uri.CREATOR.createFromParcel(data);
1741 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001742 int sourceUserId = data.readInt();
1743 int targetUserId = data.readInt();
1744 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1745 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001746 reply.writeNoException();
1747 return true;
1748 }
1749
1750 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1751 data.enforceInterface(IActivityManager.descriptor);
1752 IBinder owner = data.readStrongBinder();
1753 Uri uri = null;
1754 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001755 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001756 }
1757 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001758 int userId = data.readInt();
1759 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001760 reply.writeNoException();
1761 return true;
1762 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001763
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001764 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1765 data.enforceInterface(IActivityManager.descriptor);
1766 int callingUid = data.readInt();
1767 String targetPkg = data.readString();
1768 Uri uri = Uri.CREATOR.createFromParcel(data);
1769 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001770 int userId = data.readInt();
1771 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001772 reply.writeNoException();
1773 reply.writeInt(res);
1774 return true;
1775 }
1776
Andy McFadden824c5102010-07-09 16:26:57 -07001777 case DUMP_HEAP_TRANSACTION: {
1778 data.enforceInterface(IActivityManager.descriptor);
1779 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001780 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001781 boolean managed = data.readInt() != 0;
1782 String path = data.readString();
1783 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001784 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001785 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001786 reply.writeNoException();
1787 reply.writeInt(res ? 1 : 0);
1788 return true;
1789 }
1790
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001791 case START_ACTIVITIES_TRANSACTION:
1792 {
1793 data.enforceInterface(IActivityManager.descriptor);
1794 IBinder b = data.readStrongBinder();
1795 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001796 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001797 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1798 String[] resolvedTypes = data.createStringArray();
1799 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001800 Bundle options = data.readInt() != 0
1801 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001802 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001803 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001804 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001805 reply.writeNoException();
1806 reply.writeInt(result);
1807 return true;
1808 }
1809
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001810 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1811 {
1812 data.enforceInterface(IActivityManager.descriptor);
1813 int mode = getFrontActivityScreenCompatMode();
1814 reply.writeNoException();
1815 reply.writeInt(mode);
1816 return true;
1817 }
1818
1819 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1820 {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 int mode = data.readInt();
1823 setFrontActivityScreenCompatMode(mode);
1824 reply.writeNoException();
1825 reply.writeInt(mode);
1826 return true;
1827 }
1828
1829 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1830 {
1831 data.enforceInterface(IActivityManager.descriptor);
1832 String pkg = data.readString();
1833 int mode = getPackageScreenCompatMode(pkg);
1834 reply.writeNoException();
1835 reply.writeInt(mode);
1836 return true;
1837 }
1838
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001839 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1840 {
1841 data.enforceInterface(IActivityManager.descriptor);
1842 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001843 int mode = data.readInt();
1844 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001845 reply.writeNoException();
1846 return true;
1847 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001848
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001849 case SWITCH_USER_TRANSACTION: {
1850 data.enforceInterface(IActivityManager.descriptor);
1851 int userid = data.readInt();
1852 boolean result = switchUser(userid);
1853 reply.writeNoException();
1854 reply.writeInt(result ? 1 : 0);
1855 return true;
1856 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001857
Kenny Guy08488bf2014-02-21 17:40:37 +00001858 case START_USER_IN_BACKGROUND_TRANSACTION: {
1859 data.enforceInterface(IActivityManager.descriptor);
1860 int userid = data.readInt();
1861 boolean result = startUserInBackground(userid);
1862 reply.writeNoException();
1863 reply.writeInt(result ? 1 : 0);
1864 return true;
1865 }
1866
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001867 case STOP_USER_TRANSACTION: {
1868 data.enforceInterface(IActivityManager.descriptor);
1869 int userid = data.readInt();
1870 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1871 data.readStrongBinder());
1872 int result = stopUser(userid, callback);
1873 reply.writeNoException();
1874 reply.writeInt(result);
1875 return true;
1876 }
1877
Amith Yamasani52f1d752012-03-28 18:19:29 -07001878 case GET_CURRENT_USER_TRANSACTION: {
1879 data.enforceInterface(IActivityManager.descriptor);
1880 UserInfo userInfo = getCurrentUser();
1881 reply.writeNoException();
1882 userInfo.writeToParcel(reply, 0);
1883 return true;
1884 }
1885
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001886 case IS_USER_RUNNING_TRANSACTION: {
1887 data.enforceInterface(IActivityManager.descriptor);
1888 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001889 boolean orStopping = data.readInt() != 0;
1890 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001891 reply.writeNoException();
1892 reply.writeInt(result ? 1 : 0);
1893 return true;
1894 }
1895
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001896 case GET_RUNNING_USER_IDS_TRANSACTION: {
1897 data.enforceInterface(IActivityManager.descriptor);
1898 int[] result = getRunningUserIds();
1899 reply.writeNoException();
1900 reply.writeIntArray(result);
1901 return true;
1902 }
1903
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001904 case REMOVE_TASK_TRANSACTION:
1905 {
1906 data.enforceInterface(IActivityManager.descriptor);
1907 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001908 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001909 reply.writeNoException();
1910 reply.writeInt(result ? 1 : 0);
1911 return true;
1912 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001913
Jeff Sharkeya4620792011-05-20 15:29:23 -07001914 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1915 data.enforceInterface(IActivityManager.descriptor);
1916 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1917 data.readStrongBinder());
1918 registerProcessObserver(observer);
1919 return true;
1920 }
1921
1922 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1923 data.enforceInterface(IActivityManager.descriptor);
1924 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1925 data.readStrongBinder());
1926 unregisterProcessObserver(observer);
1927 return true;
1928 }
1929
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001930 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1931 {
1932 data.enforceInterface(IActivityManager.descriptor);
1933 String pkg = data.readString();
1934 boolean ask = getPackageAskScreenCompat(pkg);
1935 reply.writeNoException();
1936 reply.writeInt(ask ? 1 : 0);
1937 return true;
1938 }
1939
1940 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1941 {
1942 data.enforceInterface(IActivityManager.descriptor);
1943 String pkg = data.readString();
1944 boolean ask = data.readInt() != 0;
1945 setPackageAskScreenCompat(pkg, ask);
1946 reply.writeNoException();
1947 return true;
1948 }
1949
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001950 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1951 data.enforceInterface(IActivityManager.descriptor);
1952 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07001953 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001954 boolean res = isIntentSenderTargetedToPackage(r);
1955 reply.writeNoException();
1956 reply.writeInt(res ? 1 : 0);
1957 return true;
1958 }
1959
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001960 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1961 data.enforceInterface(IActivityManager.descriptor);
1962 IIntentSender r = IIntentSender.Stub.asInterface(
1963 data.readStrongBinder());
1964 boolean res = isIntentSenderAnActivity(r);
1965 reply.writeNoException();
1966 reply.writeInt(res ? 1 : 0);
1967 return true;
1968 }
1969
Dianne Hackborn81038902012-11-26 17:04:09 -08001970 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1971 data.enforceInterface(IActivityManager.descriptor);
1972 IIntentSender r = IIntentSender.Stub.asInterface(
1973 data.readStrongBinder());
1974 Intent intent = getIntentForIntentSender(r);
1975 reply.writeNoException();
1976 if (intent != null) {
1977 reply.writeInt(1);
1978 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1979 } else {
1980 reply.writeInt(0);
1981 }
1982 return true;
1983 }
1984
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001985 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1986 data.enforceInterface(IActivityManager.descriptor);
1987 IIntentSender r = IIntentSender.Stub.asInterface(
1988 data.readStrongBinder());
1989 String prefix = data.readString();
1990 String tag = getTagForIntentSender(r, prefix);
1991 reply.writeNoException();
1992 reply.writeString(tag);
1993 return true;
1994 }
1995
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001996 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1997 data.enforceInterface(IActivityManager.descriptor);
1998 Configuration config = Configuration.CREATOR.createFromParcel(data);
1999 updatePersistentConfiguration(config);
2000 reply.writeNoException();
2001 return true;
2002 }
2003
Dianne Hackbornb437e092011-08-05 17:50:29 -07002004 case GET_PROCESS_PSS_TRANSACTION: {
2005 data.enforceInterface(IActivityManager.descriptor);
2006 int[] pids = data.createIntArray();
2007 long[] pss = getProcessPss(pids);
2008 reply.writeNoException();
2009 reply.writeLongArray(pss);
2010 return true;
2011 }
2012
Dianne Hackborn661cd522011-08-22 00:26:20 -07002013 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2014 data.enforceInterface(IActivityManager.descriptor);
2015 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2016 boolean always = data.readInt() != 0;
2017 showBootMessage(msg, always);
2018 reply.writeNoException();
2019 return true;
2020 }
2021
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002022 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002023 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002024 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002025 reply.writeNoException();
2026 return true;
2027 }
2028
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002029 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002030 data.enforceInterface(IActivityManager.descriptor);
2031 IBinder token = data.readStrongBinder();
2032 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002033 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002034 reply.writeNoException();
2035 reply.writeInt(res ? 1 : 0);
2036 return true;
2037 }
2038
2039 case NAVIGATE_UP_TO_TRANSACTION: {
2040 data.enforceInterface(IActivityManager.descriptor);
2041 IBinder token = data.readStrongBinder();
2042 Intent target = Intent.CREATOR.createFromParcel(data);
2043 int resultCode = data.readInt();
2044 Intent resultData = null;
2045 if (data.readInt() != 0) {
2046 resultData = Intent.CREATOR.createFromParcel(data);
2047 }
2048 boolean res = navigateUpTo(token, target, resultCode, resultData);
2049 reply.writeNoException();
2050 reply.writeInt(res ? 1 : 0);
2051 return true;
2052 }
2053
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002054 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2055 data.enforceInterface(IActivityManager.descriptor);
2056 IBinder token = data.readStrongBinder();
2057 int res = getLaunchedFromUid(token);
2058 reply.writeNoException();
2059 reply.writeInt(res);
2060 return true;
2061 }
2062
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002063 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2064 data.enforceInterface(IActivityManager.descriptor);
2065 IBinder token = data.readStrongBinder();
2066 String res = getLaunchedFromPackage(token);
2067 reply.writeNoException();
2068 reply.writeString(res);
2069 return true;
2070 }
2071
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002072 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2073 data.enforceInterface(IActivityManager.descriptor);
2074 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2075 data.readStrongBinder());
2076 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002077 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002078 return true;
2079 }
2080
2081 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2082 data.enforceInterface(IActivityManager.descriptor);
2083 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2084 data.readStrongBinder());
2085 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002086 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002087 return true;
2088 }
2089
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002090 case REQUEST_BUG_REPORT_TRANSACTION: {
2091 data.enforceInterface(IActivityManager.descriptor);
2092 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002093 reply.writeNoException();
2094 return true;
2095 }
2096
2097 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2098 data.enforceInterface(IActivityManager.descriptor);
2099 int pid = data.readInt();
2100 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002101 String reason = data.readString();
2102 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002103 reply.writeNoException();
2104 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002105 return true;
2106 }
2107
Adam Skorydfc7fd72013-08-05 19:23:41 -07002108 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002109 data.enforceInterface(IActivityManager.descriptor);
2110 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002111 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002112 reply.writeNoException();
2113 reply.writeBundle(res);
2114 return true;
2115 }
2116
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002117 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2118 data.enforceInterface(IActivityManager.descriptor);
2119 int requestType = data.readInt();
2120 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
2121 requestAssistContextExtras(requestType, receiver);
2122 reply.writeNoException();
2123 return true;
2124 }
2125
Adam Skorydfc7fd72013-08-05 19:23:41 -07002126 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002127 data.enforceInterface(IActivityManager.descriptor);
2128 IBinder token = data.readStrongBinder();
2129 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002130 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002131 reply.writeNoException();
2132 return true;
2133 }
2134
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002135 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2136 data.enforceInterface(IActivityManager.descriptor);
2137 Intent intent = Intent.CREATOR.createFromParcel(data);
2138 int requestType = data.readInt();
2139 String hint = data.readString();
2140 int userHandle = data.readInt();
2141 boolean res = launchAssistIntent(intent, requestType, hint, userHandle);
2142 reply.writeNoException();
2143 reply.writeInt(res ? 1 : 0);
2144 return true;
2145 }
2146
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002147 case KILL_UID_TRANSACTION: {
2148 data.enforceInterface(IActivityManager.descriptor);
2149 int uid = data.readInt();
2150 String reason = data.readString();
2151 killUid(uid, reason);
2152 reply.writeNoException();
2153 return true;
2154 }
2155
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002156 case HANG_TRANSACTION: {
2157 data.enforceInterface(IActivityManager.descriptor);
2158 IBinder who = data.readStrongBinder();
2159 boolean allowRestart = data.readInt() != 0;
2160 hang(who, allowRestart);
2161 reply.writeNoException();
2162 return true;
2163 }
2164
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002165 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2166 data.enforceInterface(IActivityManager.descriptor);
2167 IBinder token = data.readStrongBinder();
2168 reportActivityFullyDrawn(token);
2169 reply.writeNoException();
2170 return true;
2171 }
2172
Craig Mautner5eda9b32013-07-02 11:58:16 -07002173 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2174 data.enforceInterface(IActivityManager.descriptor);
2175 IBinder token = data.readStrongBinder();
2176 notifyActivityDrawn(token);
2177 reply.writeNoException();
2178 return true;
2179 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002180
2181 case RESTART_TRANSACTION: {
2182 data.enforceInterface(IActivityManager.descriptor);
2183 restart();
2184 reply.writeNoException();
2185 return true;
2186 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002187
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002188 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2189 data.enforceInterface(IActivityManager.descriptor);
2190 performIdleMaintenance();
2191 reply.writeNoException();
2192 return true;
2193 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002194
Todd Kennedyca4d8422015-01-15 15:19:22 -08002195 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002196 data.enforceInterface(IActivityManager.descriptor);
2197 IBinder parentActivityToken = data.readStrongBinder();
2198 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002199 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002200 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002201 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002202 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002203 if (activityContainer != null) {
2204 reply.writeInt(1);
2205 reply.writeStrongBinder(activityContainer.asBinder());
2206 } else {
2207 reply.writeInt(0);
2208 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002209 return true;
2210 }
2211
Craig Mautner95da1082014-02-24 17:54:35 -08002212 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2213 data.enforceInterface(IActivityManager.descriptor);
2214 IActivityContainer activityContainer =
2215 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2216 deleteActivityContainer(activityContainer);
2217 reply.writeNoException();
2218 return true;
2219 }
2220
Todd Kennedy4900bf92015-01-16 16:05:14 -08002221 case CREATE_STACK_ON_DISPLAY: {
2222 data.enforceInterface(IActivityManager.descriptor);
2223 int displayId = data.readInt();
2224 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2225 reply.writeNoException();
2226 if (activityContainer != null) {
2227 reply.writeInt(1);
2228 reply.writeStrongBinder(activityContainer.asBinder());
2229 } else {
2230 reply.writeInt(0);
2231 }
2232 return true;
2233 }
2234
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002235 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002236 data.enforceInterface(IActivityManager.descriptor);
2237 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002238 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002239 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002240 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002241 return true;
2242 }
2243
Craig Mautner4a1cb222013-12-04 16:14:06 -08002244 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2245 data.enforceInterface(IActivityManager.descriptor);
2246 IBinder homeActivityToken = getHomeActivityToken();
2247 reply.writeNoException();
2248 reply.writeStrongBinder(homeActivityToken);
2249 return true;
2250 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002251
2252 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2253 data.enforceInterface(IActivityManager.descriptor);
2254 final int taskId = data.readInt();
2255 startLockTaskMode(taskId);
2256 reply.writeNoException();
2257 return true;
2258 }
2259
2260 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2261 data.enforceInterface(IActivityManager.descriptor);
2262 IBinder token = data.readStrongBinder();
2263 startLockTaskMode(token);
2264 reply.writeNoException();
2265 return true;
2266 }
2267
Craig Mautnerd61dc202014-07-07 11:09:11 -07002268 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002269 data.enforceInterface(IActivityManager.descriptor);
2270 startLockTaskModeOnCurrent();
2271 reply.writeNoException();
2272 return true;
2273 }
2274
Craig Mautneraea74a52014-03-08 14:23:10 -08002275 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2276 data.enforceInterface(IActivityManager.descriptor);
2277 stopLockTaskMode();
2278 reply.writeNoException();
2279 return true;
2280 }
2281
Craig Mautnerd61dc202014-07-07 11:09:11 -07002282 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002283 data.enforceInterface(IActivityManager.descriptor);
2284 stopLockTaskModeOnCurrent();
2285 reply.writeNoException();
2286 return true;
2287 }
2288
Craig Mautneraea74a52014-03-08 14:23:10 -08002289 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2290 data.enforceInterface(IActivityManager.descriptor);
2291 final boolean isInLockTaskMode = isInLockTaskMode();
2292 reply.writeNoException();
2293 reply.writeInt(isInLockTaskMode ? 1 : 0);
2294 return true;
2295 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002296
Benjamin Franz43261142015-02-11 15:59:44 +00002297 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2298 data.enforceInterface(IActivityManager.descriptor);
2299 final int lockTaskModeState = getLockTaskModeState();
2300 reply.writeNoException();
2301 reply.writeInt(lockTaskModeState);
2302 return true;
2303 }
2304
Winson Chunga449dc02014-05-16 11:15:04 -07002305 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002306 data.enforceInterface(IActivityManager.descriptor);
2307 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002308 ActivityManager.TaskDescription values =
2309 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2310 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002311 reply.writeNoException();
2312 return true;
2313 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002314
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002315 case SET_TASK_RESIZEABLE_TRANSACTION: {
2316 data.enforceInterface(IActivityManager.descriptor);
2317 int taskId = data.readInt();
2318 boolean resizeable = (data.readInt() == 1) ? true : false;
2319 setTaskResizeable(taskId, resizeable);
2320 reply.writeNoException();
2321 return true;
2322 }
2323
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002324 case RESIZE_TASK_TRANSACTION: {
2325 data.enforceInterface(IActivityManager.descriptor);
2326 int taskId = data.readInt();
2327 Rect r = Rect.CREATOR.createFromParcel(data);
2328 resizeTask(taskId, r);
2329 reply.writeNoException();
2330 return true;
2331 }
2332
Craig Mautner648f69b2014-09-18 14:16:26 -07002333 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2334 data.enforceInterface(IActivityManager.descriptor);
2335 String filename = data.readString();
2336 Bitmap icon = getTaskDescriptionIcon(filename);
2337 reply.writeNoException();
2338 if (icon == null) {
2339 reply.writeInt(0);
2340 } else {
2341 reply.writeInt(1);
2342 icon.writeToParcel(reply, 0);
2343 }
2344 return true;
2345 }
2346
Winson Chung044d5292014-11-06 11:05:19 -08002347 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2348 data.enforceInterface(IActivityManager.descriptor);
2349 final Bundle bundle;
2350 if (data.readInt() == 0) {
2351 bundle = null;
2352 } else {
2353 bundle = data.readBundle();
2354 }
2355 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2356 startInPlaceAnimationOnFrontMostApplication(options);
2357 reply.writeNoException();
2358 return true;
2359 }
2360
Jose Lima4b6c6692014-08-12 17:41:12 -07002361 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002362 data.enforceInterface(IActivityManager.descriptor);
2363 IBinder token = data.readStrongBinder();
2364 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002365 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002366 reply.writeNoException();
2367 reply.writeInt(success ? 1 : 0);
2368 return true;
2369 }
2370
Jose Lima4b6c6692014-08-12 17:41:12 -07002371 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002372 data.enforceInterface(IActivityManager.descriptor);
2373 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002374 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002375 reply.writeNoException();
2376 reply.writeInt(enabled ? 1 : 0);
2377 return true;
2378 }
2379
Jose Lima4b6c6692014-08-12 17:41:12 -07002380 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002381 data.enforceInterface(IActivityManager.descriptor);
2382 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002383 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002384 reply.writeNoException();
2385 return true;
2386 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002387
2388 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2389 data.enforceInterface(IActivityManager.descriptor);
2390 IBinder token = data.readStrongBinder();
2391 notifyLaunchTaskBehindComplete(token);
2392 reply.writeNoException();
2393 return true;
2394 }
Craig Mautner8746a472014-07-24 15:12:54 -07002395
2396 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2397 data.enforceInterface(IActivityManager.descriptor);
2398 IBinder token = data.readStrongBinder();
2399 notifyEnterAnimationComplete(token);
2400 reply.writeNoException();
2401 return true;
2402 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002403
2404 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2405 data.enforceInterface(IActivityManager.descriptor);
2406 bootAnimationComplete();
2407 reply.writeNoException();
2408 return true;
2409 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002410
2411 case SYSTEM_BACKUP_RESTORED: {
2412 data.enforceInterface(IActivityManager.descriptor);
2413 systemBackupRestored();
2414 reply.writeNoException();
2415 return true;
2416 }
Jeff Sharkeyc2ae6fb2015-01-15 21:27:13 -08002417
Jeff Sharkey605eb792014-11-04 13:34:06 -08002418 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2419 data.enforceInterface(IActivityManager.descriptor);
2420 final int uid = data.readInt();
2421 final byte[] firstPacket = data.createByteArray();
2422 notifyCleartextNetwork(uid, firstPacket);
2423 reply.writeNoException();
2424 return true;
2425 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002426
2427 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2428 data.enforceInterface(IActivityManager.descriptor);
2429 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002430 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002431 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002432 String reportPackage = data.readString();
2433 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002434 reply.writeNoException();
2435 return true;
2436 }
2437
2438 case DUMP_HEAP_FINISHED_TRANSACTION: {
2439 data.enforceInterface(IActivityManager.descriptor);
2440 String path = data.readString();
2441 dumpHeapFinished(path);
2442 reply.writeNoException();
2443 return true;
2444 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002445
2446 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2447 data.enforceInterface(IActivityManager.descriptor);
2448 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2449 data.readStrongBinder());
2450 boolean keepAwake = data.readInt() != 0;
2451 setVoiceKeepAwake(session, keepAwake);
2452 reply.writeNoException();
2453 return true;
2454 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002455 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002456
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002457 return super.onTransact(code, data, reply, flags);
2458 }
2459
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002460 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002461 return this;
2462 }
2463
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002464 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2465 protected IActivityManager create() {
2466 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002467 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002468 Log.v("ActivityManager", "default service binder = " + b);
2469 }
2470 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002471 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002472 Log.v("ActivityManager", "default service = " + am);
2473 }
2474 return am;
2475 }
2476 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002477}
2478
2479class ActivityManagerProxy implements IActivityManager
2480{
2481 public ActivityManagerProxy(IBinder remote)
2482 {
2483 mRemote = remote;
2484 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002485
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002486 public IBinder asBinder()
2487 {
2488 return mRemote;
2489 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002490
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002491 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002492 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002493 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002494 Parcel data = Parcel.obtain();
2495 Parcel reply = Parcel.obtain();
2496 data.writeInterfaceToken(IActivityManager.descriptor);
2497 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002498 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002499 intent.writeToParcel(data, 0);
2500 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002501 data.writeStrongBinder(resultTo);
2502 data.writeString(resultWho);
2503 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002504 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002505 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002506 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002507 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002508 } else {
2509 data.writeInt(0);
2510 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002511 if (options != null) {
2512 data.writeInt(1);
2513 options.writeToParcel(data, 0);
2514 } else {
2515 data.writeInt(0);
2516 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002517 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2518 reply.readException();
2519 int result = reply.readInt();
2520 reply.recycle();
2521 data.recycle();
2522 return result;
2523 }
Amith Yamasani82644082012-08-03 13:09:11 -07002524
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002525 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002526 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002527 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2528 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002529 Parcel data = Parcel.obtain();
2530 Parcel reply = Parcel.obtain();
2531 data.writeInterfaceToken(IActivityManager.descriptor);
2532 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002533 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002534 intent.writeToParcel(data, 0);
2535 data.writeString(resolvedType);
2536 data.writeStrongBinder(resultTo);
2537 data.writeString(resultWho);
2538 data.writeInt(requestCode);
2539 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002540 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002541 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002542 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002543 } else {
2544 data.writeInt(0);
2545 }
2546 if (options != null) {
2547 data.writeInt(1);
2548 options.writeToParcel(data, 0);
2549 } else {
2550 data.writeInt(0);
2551 }
2552 data.writeInt(userId);
2553 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2554 reply.readException();
2555 int result = reply.readInt();
2556 reply.recycle();
2557 data.recycle();
2558 return result;
2559 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002560 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2561 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002562 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002563 Parcel data = Parcel.obtain();
2564 Parcel reply = Parcel.obtain();
2565 data.writeInterfaceToken(IActivityManager.descriptor);
2566 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2567 data.writeString(callingPackage);
2568 intent.writeToParcel(data, 0);
2569 data.writeString(resolvedType);
2570 data.writeStrongBinder(resultTo);
2571 data.writeString(resultWho);
2572 data.writeInt(requestCode);
2573 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002574 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002575 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002576 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002577 } else {
2578 data.writeInt(0);
2579 }
2580 if (options != null) {
2581 data.writeInt(1);
2582 options.writeToParcel(data, 0);
2583 } else {
2584 data.writeInt(0);
2585 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002586 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002587 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2588 reply.readException();
2589 int result = reply.readInt();
2590 reply.recycle();
2591 data.recycle();
2592 return result;
2593 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002594 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2595 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002596 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2597 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002598 Parcel data = Parcel.obtain();
2599 Parcel reply = Parcel.obtain();
2600 data.writeInterfaceToken(IActivityManager.descriptor);
2601 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002602 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002603 intent.writeToParcel(data, 0);
2604 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002605 data.writeStrongBinder(resultTo);
2606 data.writeString(resultWho);
2607 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002608 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002609 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002610 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002611 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002612 } else {
2613 data.writeInt(0);
2614 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002615 if (options != null) {
2616 data.writeInt(1);
2617 options.writeToParcel(data, 0);
2618 } else {
2619 data.writeInt(0);
2620 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002621 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002622 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2623 reply.readException();
2624 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2625 reply.recycle();
2626 data.recycle();
2627 return result;
2628 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002629 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2630 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002631 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002632 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002633 Parcel data = Parcel.obtain();
2634 Parcel reply = Parcel.obtain();
2635 data.writeInterfaceToken(IActivityManager.descriptor);
2636 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002637 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002638 intent.writeToParcel(data, 0);
2639 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002640 data.writeStrongBinder(resultTo);
2641 data.writeString(resultWho);
2642 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002643 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002644 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002645 if (options != null) {
2646 data.writeInt(1);
2647 options.writeToParcel(data, 0);
2648 } else {
2649 data.writeInt(0);
2650 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002651 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002652 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2653 reply.readException();
2654 int result = reply.readInt();
2655 reply.recycle();
2656 data.recycle();
2657 return result;
2658 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002659 public int startActivityIntentSender(IApplicationThread caller,
2660 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002661 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002662 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002663 Parcel data = Parcel.obtain();
2664 Parcel reply = Parcel.obtain();
2665 data.writeInterfaceToken(IActivityManager.descriptor);
2666 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2667 intent.writeToParcel(data, 0);
2668 if (fillInIntent != null) {
2669 data.writeInt(1);
2670 fillInIntent.writeToParcel(data, 0);
2671 } else {
2672 data.writeInt(0);
2673 }
2674 data.writeString(resolvedType);
2675 data.writeStrongBinder(resultTo);
2676 data.writeString(resultWho);
2677 data.writeInt(requestCode);
2678 data.writeInt(flagsMask);
2679 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002680 if (options != null) {
2681 data.writeInt(1);
2682 options.writeToParcel(data, 0);
2683 } else {
2684 data.writeInt(0);
2685 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002686 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002687 reply.readException();
2688 int result = reply.readInt();
2689 reply.recycle();
2690 data.recycle();
2691 return result;
2692 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002693 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2694 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002695 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2696 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002697 Parcel data = Parcel.obtain();
2698 Parcel reply = Parcel.obtain();
2699 data.writeInterfaceToken(IActivityManager.descriptor);
2700 data.writeString(callingPackage);
2701 data.writeInt(callingPid);
2702 data.writeInt(callingUid);
2703 intent.writeToParcel(data, 0);
2704 data.writeString(resolvedType);
2705 data.writeStrongBinder(session.asBinder());
2706 data.writeStrongBinder(interactor.asBinder());
2707 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002708 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002709 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002710 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002711 } else {
2712 data.writeInt(0);
2713 }
2714 if (options != null) {
2715 data.writeInt(1);
2716 options.writeToParcel(data, 0);
2717 } else {
2718 data.writeInt(0);
2719 }
2720 data.writeInt(userId);
2721 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2722 reply.readException();
2723 int result = reply.readInt();
2724 reply.recycle();
2725 data.recycle();
2726 return result;
2727 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002728 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002729 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002730 Parcel data = Parcel.obtain();
2731 Parcel reply = Parcel.obtain();
2732 data.writeInterfaceToken(IActivityManager.descriptor);
2733 data.writeStrongBinder(callingActivity);
2734 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002735 if (options != null) {
2736 data.writeInt(1);
2737 options.writeToParcel(data, 0);
2738 } else {
2739 data.writeInt(0);
2740 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002741 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2742 reply.readException();
2743 int result = reply.readInt();
2744 reply.recycle();
2745 data.recycle();
2746 return result != 0;
2747 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002748 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2749 Parcel data = Parcel.obtain();
2750 Parcel reply = Parcel.obtain();
2751 data.writeInterfaceToken(IActivityManager.descriptor);
2752 data.writeInt(taskId);
2753 if (options == null) {
2754 data.writeInt(0);
2755 } else {
2756 data.writeInt(1);
2757 options.writeToParcel(data, 0);
2758 }
2759 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2760 reply.readException();
2761 int result = reply.readInt();
2762 reply.recycle();
2763 data.recycle();
2764 return result;
2765 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002766 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002767 throws RemoteException {
2768 Parcel data = Parcel.obtain();
2769 Parcel reply = Parcel.obtain();
2770 data.writeInterfaceToken(IActivityManager.descriptor);
2771 data.writeStrongBinder(token);
2772 data.writeInt(resultCode);
2773 if (resultData != null) {
2774 data.writeInt(1);
2775 resultData.writeToParcel(data, 0);
2776 } else {
2777 data.writeInt(0);
2778 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002779 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002780 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2781 reply.readException();
2782 boolean res = reply.readInt() != 0;
2783 data.recycle();
2784 reply.recycle();
2785 return res;
2786 }
2787 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2788 {
2789 Parcel data = Parcel.obtain();
2790 Parcel reply = Parcel.obtain();
2791 data.writeInterfaceToken(IActivityManager.descriptor);
2792 data.writeStrongBinder(token);
2793 data.writeString(resultWho);
2794 data.writeInt(requestCode);
2795 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2796 reply.readException();
2797 data.recycle();
2798 reply.recycle();
2799 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002800 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2801 Parcel data = Parcel.obtain();
2802 Parcel reply = Parcel.obtain();
2803 data.writeInterfaceToken(IActivityManager.descriptor);
2804 data.writeStrongBinder(token);
2805 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2806 reply.readException();
2807 boolean res = reply.readInt() != 0;
2808 data.recycle();
2809 reply.recycle();
2810 return res;
2811 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002812 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2813 Parcel data = Parcel.obtain();
2814 Parcel reply = Parcel.obtain();
2815 data.writeInterfaceToken(IActivityManager.descriptor);
2816 data.writeStrongBinder(session.asBinder());
2817 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2818 reply.readException();
2819 data.recycle();
2820 reply.recycle();
2821 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002822 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2823 Parcel data = Parcel.obtain();
2824 Parcel reply = Parcel.obtain();
2825 data.writeInterfaceToken(IActivityManager.descriptor);
2826 data.writeStrongBinder(token);
2827 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2828 reply.readException();
2829 boolean res = reply.readInt() != 0;
2830 data.recycle();
2831 reply.recycle();
2832 return res;
2833 }
2834 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2835 Parcel data = Parcel.obtain();
2836 Parcel reply = Parcel.obtain();
2837 data.writeInterfaceToken(IActivityManager.descriptor);
2838 data.writeStrongBinder(app.asBinder());
2839 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2840 reply.readException();
2841 data.recycle();
2842 reply.recycle();
2843 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002844 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2845 Parcel data = Parcel.obtain();
2846 Parcel reply = Parcel.obtain();
2847 data.writeInterfaceToken(IActivityManager.descriptor);
2848 data.writeStrongBinder(token);
2849 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2850 reply.readException();
2851 boolean res = reply.readInt() != 0;
2852 data.recycle();
2853 reply.recycle();
2854 return res;
2855 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002856 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002857 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002858 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002859 {
2860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
2863 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002864 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002865 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2866 filter.writeToParcel(data, 0);
2867 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002868 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002869 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2870 reply.readException();
2871 Intent intent = null;
2872 int haveIntent = reply.readInt();
2873 if (haveIntent != 0) {
2874 intent = Intent.CREATOR.createFromParcel(reply);
2875 }
2876 reply.recycle();
2877 data.recycle();
2878 return intent;
2879 }
2880 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2881 {
2882 Parcel data = Parcel.obtain();
2883 Parcel reply = Parcel.obtain();
2884 data.writeInterfaceToken(IActivityManager.descriptor);
2885 data.writeStrongBinder(receiver.asBinder());
2886 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2887 reply.readException();
2888 data.recycle();
2889 reply.recycle();
2890 }
2891 public int broadcastIntent(IApplicationThread caller,
2892 Intent intent, String resolvedType, IIntentReceiver resultTo,
2893 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002894 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002895 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002896 {
2897 Parcel data = Parcel.obtain();
2898 Parcel reply = Parcel.obtain();
2899 data.writeInterfaceToken(IActivityManager.descriptor);
2900 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2901 intent.writeToParcel(data, 0);
2902 data.writeString(resolvedType);
2903 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2904 data.writeInt(resultCode);
2905 data.writeString(resultData);
2906 data.writeBundle(map);
2907 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002908 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002909 data.writeInt(serialized ? 1 : 0);
2910 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002911 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002912 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2913 reply.readException();
2914 int res = reply.readInt();
2915 reply.recycle();
2916 data.recycle();
2917 return res;
2918 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002919 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2920 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002921 {
2922 Parcel data = Parcel.obtain();
2923 Parcel reply = Parcel.obtain();
2924 data.writeInterfaceToken(IActivityManager.descriptor);
2925 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2926 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002927 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002928 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2929 reply.readException();
2930 data.recycle();
2931 reply.recycle();
2932 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002933 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
2934 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002935 {
2936 Parcel data = Parcel.obtain();
2937 Parcel reply = Parcel.obtain();
2938 data.writeInterfaceToken(IActivityManager.descriptor);
2939 data.writeStrongBinder(who);
2940 data.writeInt(resultCode);
2941 data.writeString(resultData);
2942 data.writeBundle(map);
2943 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002944 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002945 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2946 reply.readException();
2947 data.recycle();
2948 reply.recycle();
2949 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002950 public void attachApplication(IApplicationThread app) throws RemoteException
2951 {
2952 Parcel data = Parcel.obtain();
2953 Parcel reply = Parcel.obtain();
2954 data.writeInterfaceToken(IActivityManager.descriptor);
2955 data.writeStrongBinder(app.asBinder());
2956 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2957 reply.readException();
2958 data.recycle();
2959 reply.recycle();
2960 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002961 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2962 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002963 {
2964 Parcel data = Parcel.obtain();
2965 Parcel reply = Parcel.obtain();
2966 data.writeInterfaceToken(IActivityManager.descriptor);
2967 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002968 if (config != null) {
2969 data.writeInt(1);
2970 config.writeToParcel(data, 0);
2971 } else {
2972 data.writeInt(0);
2973 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002974 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002975 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2976 reply.readException();
2977 data.recycle();
2978 reply.recycle();
2979 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002980 public void activityResumed(IBinder token) throws RemoteException
2981 {
2982 Parcel data = Parcel.obtain();
2983 Parcel reply = Parcel.obtain();
2984 data.writeInterfaceToken(IActivityManager.descriptor);
2985 data.writeStrongBinder(token);
2986 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2987 reply.readException();
2988 data.recycle();
2989 reply.recycle();
2990 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07002991 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002992 {
2993 Parcel data = Parcel.obtain();
2994 Parcel reply = Parcel.obtain();
2995 data.writeInterfaceToken(IActivityManager.descriptor);
2996 data.writeStrongBinder(token);
2997 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2998 reply.readException();
2999 data.recycle();
3000 reply.recycle();
3001 }
3002 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003003 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003004 {
3005 Parcel data = Parcel.obtain();
3006 Parcel reply = Parcel.obtain();
3007 data.writeInterfaceToken(IActivityManager.descriptor);
3008 data.writeStrongBinder(token);
3009 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003010 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003011 TextUtils.writeToParcel(description, data, 0);
3012 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3013 reply.readException();
3014 data.recycle();
3015 reply.recycle();
3016 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003017 public void activitySlept(IBinder token) throws RemoteException
3018 {
3019 Parcel data = Parcel.obtain();
3020 Parcel reply = Parcel.obtain();
3021 data.writeInterfaceToken(IActivityManager.descriptor);
3022 data.writeStrongBinder(token);
3023 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3024 reply.readException();
3025 data.recycle();
3026 reply.recycle();
3027 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003028 public void activityDestroyed(IBinder token) throws RemoteException
3029 {
3030 Parcel data = Parcel.obtain();
3031 Parcel reply = Parcel.obtain();
3032 data.writeInterfaceToken(IActivityManager.descriptor);
3033 data.writeStrongBinder(token);
3034 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3035 reply.readException();
3036 data.recycle();
3037 reply.recycle();
3038 }
3039 public String getCallingPackage(IBinder token) throws RemoteException
3040 {
3041 Parcel data = Parcel.obtain();
3042 Parcel reply = Parcel.obtain();
3043 data.writeInterfaceToken(IActivityManager.descriptor);
3044 data.writeStrongBinder(token);
3045 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3046 reply.readException();
3047 String res = reply.readString();
3048 data.recycle();
3049 reply.recycle();
3050 return res;
3051 }
3052 public ComponentName getCallingActivity(IBinder token)
3053 throws RemoteException {
3054 Parcel data = Parcel.obtain();
3055 Parcel reply = Parcel.obtain();
3056 data.writeInterfaceToken(IActivityManager.descriptor);
3057 data.writeStrongBinder(token);
3058 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3059 reply.readException();
3060 ComponentName res = ComponentName.readFromParcel(reply);
3061 data.recycle();
3062 reply.recycle();
3063 return res;
3064 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003065 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003066 Parcel data = Parcel.obtain();
3067 Parcel reply = Parcel.obtain();
3068 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003069 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003070 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3071 reply.readException();
3072 ArrayList<IAppTask> list = null;
3073 int N = reply.readInt();
3074 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003075 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003076 while (N > 0) {
3077 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3078 list.add(task);
3079 N--;
3080 }
3081 }
3082 data.recycle();
3083 reply.recycle();
3084 return list;
3085 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003086 public int addAppTask(IBinder activityToken, Intent intent,
3087 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3088 Parcel data = Parcel.obtain();
3089 Parcel reply = Parcel.obtain();
3090 data.writeInterfaceToken(IActivityManager.descriptor);
3091 data.writeStrongBinder(activityToken);
3092 intent.writeToParcel(data, 0);
3093 description.writeToParcel(data, 0);
3094 thumbnail.writeToParcel(data, 0);
3095 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3096 reply.readException();
3097 int res = reply.readInt();
3098 data.recycle();
3099 reply.recycle();
3100 return res;
3101 }
3102 public Point getAppTaskThumbnailSize() throws RemoteException {
3103 Parcel data = Parcel.obtain();
3104 Parcel reply = Parcel.obtain();
3105 data.writeInterfaceToken(IActivityManager.descriptor);
3106 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3107 reply.readException();
3108 Point size = Point.CREATOR.createFromParcel(reply);
3109 data.recycle();
3110 reply.recycle();
3111 return size;
3112 }
Todd Kennedye635f662015-01-20 10:36:49 -08003113 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3114 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003115 Parcel data = Parcel.obtain();
3116 Parcel reply = Parcel.obtain();
3117 data.writeInterfaceToken(IActivityManager.descriptor);
3118 data.writeInt(maxNum);
3119 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003120 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3121 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003122 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003123 int N = reply.readInt();
3124 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003125 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003126 while (N > 0) {
3127 ActivityManager.RunningTaskInfo info =
3128 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003129 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003130 list.add(info);
3131 N--;
3132 }
3133 }
3134 data.recycle();
3135 reply.recycle();
3136 return list;
3137 }
3138 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003139 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003140 Parcel data = Parcel.obtain();
3141 Parcel reply = Parcel.obtain();
3142 data.writeInterfaceToken(IActivityManager.descriptor);
3143 data.writeInt(maxNum);
3144 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003145 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003146 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3147 reply.readException();
3148 ArrayList<ActivityManager.RecentTaskInfo> list
3149 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3150 data.recycle();
3151 reply.recycle();
3152 return list;
3153 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003154 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003155 Parcel data = Parcel.obtain();
3156 Parcel reply = Parcel.obtain();
3157 data.writeInterfaceToken(IActivityManager.descriptor);
3158 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003159 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003160 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003161 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003162 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003163 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003164 }
3165 data.recycle();
3166 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003167 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003168 }
Todd Kennedye635f662015-01-20 10:36:49 -08003169 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3170 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003171 Parcel data = Parcel.obtain();
3172 Parcel reply = Parcel.obtain();
3173 data.writeInterfaceToken(IActivityManager.descriptor);
3174 data.writeInt(maxNum);
3175 data.writeInt(flags);
3176 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3177 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003178 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003179 int N = reply.readInt();
3180 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003181 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003182 while (N > 0) {
3183 ActivityManager.RunningServiceInfo info =
3184 ActivityManager.RunningServiceInfo.CREATOR
3185 .createFromParcel(reply);
3186 list.add(info);
3187 N--;
3188 }
3189 }
3190 data.recycle();
3191 reply.recycle();
3192 return list;
3193 }
3194 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3195 throws RemoteException {
3196 Parcel data = Parcel.obtain();
3197 Parcel reply = Parcel.obtain();
3198 data.writeInterfaceToken(IActivityManager.descriptor);
3199 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3200 reply.readException();
3201 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3202 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3203 data.recycle();
3204 reply.recycle();
3205 return list;
3206 }
3207 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3208 throws RemoteException {
3209 Parcel data = Parcel.obtain();
3210 Parcel reply = Parcel.obtain();
3211 data.writeInterfaceToken(IActivityManager.descriptor);
3212 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3213 reply.readException();
3214 ArrayList<ActivityManager.RunningAppProcessInfo> list
3215 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3216 data.recycle();
3217 reply.recycle();
3218 return list;
3219 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003220 public List<ApplicationInfo> getRunningExternalApplications()
3221 throws RemoteException {
3222 Parcel data = Parcel.obtain();
3223 Parcel reply = Parcel.obtain();
3224 data.writeInterfaceToken(IActivityManager.descriptor);
3225 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3226 reply.readException();
3227 ArrayList<ApplicationInfo> list
3228 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3229 data.recycle();
3230 reply.recycle();
3231 return list;
3232 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003233 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003234 {
3235 Parcel data = Parcel.obtain();
3236 Parcel reply = Parcel.obtain();
3237 data.writeInterfaceToken(IActivityManager.descriptor);
3238 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003239 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003240 if (options != null) {
3241 data.writeInt(1);
3242 options.writeToParcel(data, 0);
3243 } else {
3244 data.writeInt(0);
3245 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003246 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3247 reply.readException();
3248 data.recycle();
3249 reply.recycle();
3250 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003251 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3252 throws RemoteException {
3253 Parcel data = Parcel.obtain();
3254 Parcel reply = Parcel.obtain();
3255 data.writeInterfaceToken(IActivityManager.descriptor);
3256 data.writeStrongBinder(token);
3257 data.writeInt(nonRoot ? 1 : 0);
3258 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3259 reply.readException();
3260 boolean res = reply.readInt() != 0;
3261 data.recycle();
3262 reply.recycle();
3263 return res;
3264 }
3265 public void moveTaskBackwards(int task) throws RemoteException
3266 {
3267 Parcel data = Parcel.obtain();
3268 Parcel reply = Parcel.obtain();
3269 data.writeInterfaceToken(IActivityManager.descriptor);
3270 data.writeInt(task);
3271 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3272 reply.readException();
3273 data.recycle();
3274 reply.recycle();
3275 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003276 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003277 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3278 {
3279 Parcel data = Parcel.obtain();
3280 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003281 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003282 data.writeInt(taskId);
3283 data.writeInt(stackId);
3284 data.writeInt(toTop ? 1 : 0);
3285 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3286 reply.readException();
3287 data.recycle();
3288 reply.recycle();
3289 }
3290 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003291 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003292 {
3293 Parcel data = Parcel.obtain();
3294 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003295 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003296 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003297 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003298 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003299 reply.readException();
3300 data.recycle();
3301 reply.recycle();
3302 }
Craig Mautner967212c2013-04-13 21:10:58 -07003303 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003304 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003305 {
3306 Parcel data = Parcel.obtain();
3307 Parcel reply = Parcel.obtain();
3308 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003309 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003310 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003311 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003312 data.recycle();
3313 reply.recycle();
3314 return list;
3315 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003316 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003317 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003318 {
3319 Parcel data = Parcel.obtain();
3320 Parcel reply = Parcel.obtain();
3321 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003322 data.writeInt(stackId);
3323 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003324 reply.readException();
3325 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003326 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003327 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003328 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003329 }
3330 data.recycle();
3331 reply.recycle();
3332 return info;
3333 }
3334 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003335 public boolean isInHomeStack(int taskId) throws RemoteException {
3336 Parcel data = Parcel.obtain();
3337 Parcel reply = Parcel.obtain();
3338 data.writeInterfaceToken(IActivityManager.descriptor);
3339 data.writeInt(taskId);
3340 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3341 reply.readException();
3342 boolean isInHomeStack = reply.readInt() > 0;
3343 data.recycle();
3344 reply.recycle();
3345 return isInHomeStack;
3346 }
3347 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003348 public void setFocusedStack(int stackId) throws RemoteException
3349 {
3350 Parcel data = Parcel.obtain();
3351 Parcel reply = Parcel.obtain();
3352 data.writeInterfaceToken(IActivityManager.descriptor);
3353 data.writeInt(stackId);
3354 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3355 reply.readException();
3356 data.recycle();
3357 reply.recycle();
3358 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003359 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003360 public int getFocusedStackId() throws RemoteException {
3361 Parcel data = Parcel.obtain();
3362 Parcel reply = Parcel.obtain();
3363 data.writeInterfaceToken(IActivityManager.descriptor);
3364 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3365 reply.readException();
3366 int focusedStackId = reply.readInt();
3367 data.recycle();
3368 reply.recycle();
3369 return focusedStackId;
3370 }
3371 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003372 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3373 {
3374 Parcel data = Parcel.obtain();
3375 Parcel reply = Parcel.obtain();
3376 data.writeInterfaceToken(IActivityManager.descriptor);
3377 data.writeStrongBinder(listener.asBinder());
3378 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3379 reply.readException();
3380 data.recycle();
3381 reply.recycle();
3382 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003383 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3384 {
3385 Parcel data = Parcel.obtain();
3386 Parcel reply = Parcel.obtain();
3387 data.writeInterfaceToken(IActivityManager.descriptor);
3388 data.writeStrongBinder(token);
3389 data.writeInt(onlyRoot ? 1 : 0);
3390 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3391 reply.readException();
3392 int res = reply.readInt();
3393 data.recycle();
3394 reply.recycle();
3395 return res;
3396 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003397 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003398 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003399 Parcel data = Parcel.obtain();
3400 Parcel reply = Parcel.obtain();
3401 data.writeInterfaceToken(IActivityManager.descriptor);
3402 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3403 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003404 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003405 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003406 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3407 reply.readException();
3408 int res = reply.readInt();
3409 ContentProviderHolder cph = null;
3410 if (res != 0) {
3411 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3412 }
3413 data.recycle();
3414 reply.recycle();
3415 return cph;
3416 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003417 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3418 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003419 Parcel data = Parcel.obtain();
3420 Parcel reply = Parcel.obtain();
3421 data.writeInterfaceToken(IActivityManager.descriptor);
3422 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003423 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003424 data.writeStrongBinder(token);
3425 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3426 reply.readException();
3427 int res = reply.readInt();
3428 ContentProviderHolder cph = null;
3429 if (res != 0) {
3430 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3431 }
3432 data.recycle();
3433 reply.recycle();
3434 return cph;
3435 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003436 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003437 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003438 {
3439 Parcel data = Parcel.obtain();
3440 Parcel reply = Parcel.obtain();
3441 data.writeInterfaceToken(IActivityManager.descriptor);
3442 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3443 data.writeTypedList(providers);
3444 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3445 reply.readException();
3446 data.recycle();
3447 reply.recycle();
3448 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003449 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3450 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003451 Parcel data = Parcel.obtain();
3452 Parcel reply = Parcel.obtain();
3453 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003454 data.writeStrongBinder(connection);
3455 data.writeInt(stable);
3456 data.writeInt(unstable);
3457 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3458 reply.readException();
3459 boolean res = reply.readInt() != 0;
3460 data.recycle();
3461 reply.recycle();
3462 return res;
3463 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003464
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003465 public void unstableProviderDied(IBinder connection) throws RemoteException {
3466 Parcel data = Parcel.obtain();
3467 Parcel reply = Parcel.obtain();
3468 data.writeInterfaceToken(IActivityManager.descriptor);
3469 data.writeStrongBinder(connection);
3470 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3471 reply.readException();
3472 data.recycle();
3473 reply.recycle();
3474 }
3475
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003476 @Override
3477 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3478 Parcel data = Parcel.obtain();
3479 Parcel reply = Parcel.obtain();
3480 data.writeInterfaceToken(IActivityManager.descriptor);
3481 data.writeStrongBinder(connection);
3482 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3483 reply.readException();
3484 data.recycle();
3485 reply.recycle();
3486 }
3487
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003488 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3489 Parcel data = Parcel.obtain();
3490 Parcel reply = Parcel.obtain();
3491 data.writeInterfaceToken(IActivityManager.descriptor);
3492 data.writeStrongBinder(connection);
3493 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003494 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3495 reply.readException();
3496 data.recycle();
3497 reply.recycle();
3498 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003499
3500 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3501 Parcel data = Parcel.obtain();
3502 Parcel reply = Parcel.obtain();
3503 data.writeInterfaceToken(IActivityManager.descriptor);
3504 data.writeString(name);
3505 data.writeStrongBinder(token);
3506 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3507 reply.readException();
3508 data.recycle();
3509 reply.recycle();
3510 }
3511
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003512 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3513 throws RemoteException
3514 {
3515 Parcel data = Parcel.obtain();
3516 Parcel reply = Parcel.obtain();
3517 data.writeInterfaceToken(IActivityManager.descriptor);
3518 service.writeToParcel(data, 0);
3519 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3520 reply.readException();
3521 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3522 data.recycle();
3523 reply.recycle();
3524 return res;
3525 }
3526
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003527 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003528 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003529 {
3530 Parcel data = Parcel.obtain();
3531 Parcel reply = Parcel.obtain();
3532 data.writeInterfaceToken(IActivityManager.descriptor);
3533 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3534 service.writeToParcel(data, 0);
3535 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003536 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003537 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3538 reply.readException();
3539 ComponentName res = ComponentName.readFromParcel(reply);
3540 data.recycle();
3541 reply.recycle();
3542 return res;
3543 }
3544 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003545 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003546 {
3547 Parcel data = Parcel.obtain();
3548 Parcel reply = Parcel.obtain();
3549 data.writeInterfaceToken(IActivityManager.descriptor);
3550 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3551 service.writeToParcel(data, 0);
3552 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003553 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003554 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3555 reply.readException();
3556 int res = reply.readInt();
3557 reply.recycle();
3558 data.recycle();
3559 return res;
3560 }
3561 public boolean stopServiceToken(ComponentName className, IBinder token,
3562 int startId) throws RemoteException {
3563 Parcel data = Parcel.obtain();
3564 Parcel reply = Parcel.obtain();
3565 data.writeInterfaceToken(IActivityManager.descriptor);
3566 ComponentName.writeToParcel(className, data);
3567 data.writeStrongBinder(token);
3568 data.writeInt(startId);
3569 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3570 reply.readException();
3571 boolean res = reply.readInt() != 0;
3572 data.recycle();
3573 reply.recycle();
3574 return res;
3575 }
3576 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003577 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003578 Parcel data = Parcel.obtain();
3579 Parcel reply = Parcel.obtain();
3580 data.writeInterfaceToken(IActivityManager.descriptor);
3581 ComponentName.writeToParcel(className, data);
3582 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003583 data.writeInt(id);
3584 if (notification != null) {
3585 data.writeInt(1);
3586 notification.writeToParcel(data, 0);
3587 } else {
3588 data.writeInt(0);
3589 }
3590 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003591 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3592 reply.readException();
3593 data.recycle();
3594 reply.recycle();
3595 }
3596 public int bindService(IApplicationThread caller, IBinder token,
3597 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003598 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003599 Parcel data = Parcel.obtain();
3600 Parcel reply = Parcel.obtain();
3601 data.writeInterfaceToken(IActivityManager.descriptor);
3602 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3603 data.writeStrongBinder(token);
3604 service.writeToParcel(data, 0);
3605 data.writeString(resolvedType);
3606 data.writeStrongBinder(connection.asBinder());
3607 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003608 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003609 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3610 reply.readException();
3611 int res = reply.readInt();
3612 data.recycle();
3613 reply.recycle();
3614 return res;
3615 }
3616 public boolean unbindService(IServiceConnection connection) throws RemoteException
3617 {
3618 Parcel data = Parcel.obtain();
3619 Parcel reply = Parcel.obtain();
3620 data.writeInterfaceToken(IActivityManager.descriptor);
3621 data.writeStrongBinder(connection.asBinder());
3622 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3623 reply.readException();
3624 boolean res = reply.readInt() != 0;
3625 data.recycle();
3626 reply.recycle();
3627 return res;
3628 }
3629
3630 public void publishService(IBinder token,
3631 Intent intent, IBinder service) throws RemoteException {
3632 Parcel data = Parcel.obtain();
3633 Parcel reply = Parcel.obtain();
3634 data.writeInterfaceToken(IActivityManager.descriptor);
3635 data.writeStrongBinder(token);
3636 intent.writeToParcel(data, 0);
3637 data.writeStrongBinder(service);
3638 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3639 reply.readException();
3640 data.recycle();
3641 reply.recycle();
3642 }
3643
3644 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3645 throws RemoteException {
3646 Parcel data = Parcel.obtain();
3647 Parcel reply = Parcel.obtain();
3648 data.writeInterfaceToken(IActivityManager.descriptor);
3649 data.writeStrongBinder(token);
3650 intent.writeToParcel(data, 0);
3651 data.writeInt(doRebind ? 1 : 0);
3652 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3653 reply.readException();
3654 data.recycle();
3655 reply.recycle();
3656 }
3657
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003658 public void serviceDoneExecuting(IBinder token, int type, int startId,
3659 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003660 Parcel data = Parcel.obtain();
3661 Parcel reply = Parcel.obtain();
3662 data.writeInterfaceToken(IActivityManager.descriptor);
3663 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003664 data.writeInt(type);
3665 data.writeInt(startId);
3666 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003667 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3668 reply.readException();
3669 data.recycle();
3670 reply.recycle();
3671 }
3672
3673 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3674 Parcel data = Parcel.obtain();
3675 Parcel reply = Parcel.obtain();
3676 data.writeInterfaceToken(IActivityManager.descriptor);
3677 service.writeToParcel(data, 0);
3678 data.writeString(resolvedType);
3679 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3680 reply.readException();
3681 IBinder binder = reply.readStrongBinder();
3682 reply.recycle();
3683 data.recycle();
3684 return binder;
3685 }
3686
Christopher Tate181fafa2009-05-14 11:12:14 -07003687 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3688 throws RemoteException {
3689 Parcel data = Parcel.obtain();
3690 Parcel reply = Parcel.obtain();
3691 data.writeInterfaceToken(IActivityManager.descriptor);
3692 app.writeToParcel(data, 0);
3693 data.writeInt(backupRestoreMode);
3694 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3695 reply.readException();
3696 boolean success = reply.readInt() != 0;
3697 reply.recycle();
3698 data.recycle();
3699 return success;
3700 }
3701
Christopher Tate346acb12012-10-15 19:20:25 -07003702 public void clearPendingBackup() throws RemoteException {
3703 Parcel data = Parcel.obtain();
3704 Parcel reply = Parcel.obtain();
3705 data.writeInterfaceToken(IActivityManager.descriptor);
3706 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3707 reply.recycle();
3708 data.recycle();
3709 }
3710
Christopher Tate181fafa2009-05-14 11:12:14 -07003711 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3712 Parcel data = Parcel.obtain();
3713 Parcel reply = Parcel.obtain();
3714 data.writeInterfaceToken(IActivityManager.descriptor);
3715 data.writeString(packageName);
3716 data.writeStrongBinder(agent);
3717 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3718 reply.recycle();
3719 data.recycle();
3720 }
3721
3722 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3723 Parcel data = Parcel.obtain();
3724 Parcel reply = Parcel.obtain();
3725 data.writeInterfaceToken(IActivityManager.descriptor);
3726 app.writeToParcel(data, 0);
3727 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3728 reply.readException();
3729 reply.recycle();
3730 data.recycle();
3731 }
3732
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003733 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003734 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003735 IUiAutomationConnection connection, int userId, String instructionSet)
3736 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003737 Parcel data = Parcel.obtain();
3738 Parcel reply = Parcel.obtain();
3739 data.writeInterfaceToken(IActivityManager.descriptor);
3740 ComponentName.writeToParcel(className, data);
3741 data.writeString(profileFile);
3742 data.writeInt(flags);
3743 data.writeBundle(arguments);
3744 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003745 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003746 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003747 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003748 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3749 reply.readException();
3750 boolean res = reply.readInt() != 0;
3751 reply.recycle();
3752 data.recycle();
3753 return res;
3754 }
3755
3756 public void finishInstrumentation(IApplicationThread target,
3757 int resultCode, Bundle results) throws RemoteException {
3758 Parcel data = Parcel.obtain();
3759 Parcel reply = Parcel.obtain();
3760 data.writeInterfaceToken(IActivityManager.descriptor);
3761 data.writeStrongBinder(target != null ? target.asBinder() : null);
3762 data.writeInt(resultCode);
3763 data.writeBundle(results);
3764 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3765 reply.readException();
3766 data.recycle();
3767 reply.recycle();
3768 }
3769 public Configuration getConfiguration() throws RemoteException
3770 {
3771 Parcel data = Parcel.obtain();
3772 Parcel reply = Parcel.obtain();
3773 data.writeInterfaceToken(IActivityManager.descriptor);
3774 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3775 reply.readException();
3776 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3777 reply.recycle();
3778 data.recycle();
3779 return res;
3780 }
3781 public void updateConfiguration(Configuration values) throws RemoteException
3782 {
3783 Parcel data = Parcel.obtain();
3784 Parcel reply = Parcel.obtain();
3785 data.writeInterfaceToken(IActivityManager.descriptor);
3786 values.writeToParcel(data, 0);
3787 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3788 reply.readException();
3789 data.recycle();
3790 reply.recycle();
3791 }
3792 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3793 throws RemoteException {
3794 Parcel data = Parcel.obtain();
3795 Parcel reply = Parcel.obtain();
3796 data.writeInterfaceToken(IActivityManager.descriptor);
3797 data.writeStrongBinder(token);
3798 data.writeInt(requestedOrientation);
3799 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3800 reply.readException();
3801 data.recycle();
3802 reply.recycle();
3803 }
3804 public int getRequestedOrientation(IBinder token) throws RemoteException {
3805 Parcel data = Parcel.obtain();
3806 Parcel reply = Parcel.obtain();
3807 data.writeInterfaceToken(IActivityManager.descriptor);
3808 data.writeStrongBinder(token);
3809 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3810 reply.readException();
3811 int res = reply.readInt();
3812 data.recycle();
3813 reply.recycle();
3814 return res;
3815 }
3816 public ComponentName getActivityClassForToken(IBinder token)
3817 throws RemoteException {
3818 Parcel data = Parcel.obtain();
3819 Parcel reply = Parcel.obtain();
3820 data.writeInterfaceToken(IActivityManager.descriptor);
3821 data.writeStrongBinder(token);
3822 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3823 reply.readException();
3824 ComponentName res = ComponentName.readFromParcel(reply);
3825 data.recycle();
3826 reply.recycle();
3827 return res;
3828 }
3829 public String getPackageForToken(IBinder token) throws RemoteException
3830 {
3831 Parcel data = Parcel.obtain();
3832 Parcel reply = Parcel.obtain();
3833 data.writeInterfaceToken(IActivityManager.descriptor);
3834 data.writeStrongBinder(token);
3835 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3836 reply.readException();
3837 String res = reply.readString();
3838 data.recycle();
3839 reply.recycle();
3840 return res;
3841 }
3842 public IIntentSender getIntentSender(int type,
3843 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003844 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003845 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003846 Parcel data = Parcel.obtain();
3847 Parcel reply = Parcel.obtain();
3848 data.writeInterfaceToken(IActivityManager.descriptor);
3849 data.writeInt(type);
3850 data.writeString(packageName);
3851 data.writeStrongBinder(token);
3852 data.writeString(resultWho);
3853 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003854 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003855 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003856 data.writeTypedArray(intents, 0);
3857 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003858 } else {
3859 data.writeInt(0);
3860 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003861 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003862 if (options != null) {
3863 data.writeInt(1);
3864 options.writeToParcel(data, 0);
3865 } else {
3866 data.writeInt(0);
3867 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003868 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003869 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3870 reply.readException();
3871 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08003872 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003873 data.recycle();
3874 reply.recycle();
3875 return res;
3876 }
3877 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3878 Parcel data = Parcel.obtain();
3879 Parcel reply = Parcel.obtain();
3880 data.writeInterfaceToken(IActivityManager.descriptor);
3881 data.writeStrongBinder(sender.asBinder());
3882 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3883 reply.readException();
3884 data.recycle();
3885 reply.recycle();
3886 }
3887 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3888 Parcel data = Parcel.obtain();
3889 Parcel reply = Parcel.obtain();
3890 data.writeInterfaceToken(IActivityManager.descriptor);
3891 data.writeStrongBinder(sender.asBinder());
3892 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3893 reply.readException();
3894 String res = reply.readString();
3895 data.recycle();
3896 reply.recycle();
3897 return res;
3898 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003899 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3900 Parcel data = Parcel.obtain();
3901 Parcel reply = Parcel.obtain();
3902 data.writeInterfaceToken(IActivityManager.descriptor);
3903 data.writeStrongBinder(sender.asBinder());
3904 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3905 reply.readException();
3906 int res = reply.readInt();
3907 data.recycle();
3908 reply.recycle();
3909 return res;
3910 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003911 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3912 boolean requireFull, String name, String callerPackage) throws RemoteException {
3913 Parcel data = Parcel.obtain();
3914 Parcel reply = Parcel.obtain();
3915 data.writeInterfaceToken(IActivityManager.descriptor);
3916 data.writeInt(callingPid);
3917 data.writeInt(callingUid);
3918 data.writeInt(userId);
3919 data.writeInt(allowAll ? 1 : 0);
3920 data.writeInt(requireFull ? 1 : 0);
3921 data.writeString(name);
3922 data.writeString(callerPackage);
3923 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3924 reply.readException();
3925 int res = reply.readInt();
3926 data.recycle();
3927 reply.recycle();
3928 return res;
3929 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003930 public void setProcessLimit(int max) throws RemoteException
3931 {
3932 Parcel data = Parcel.obtain();
3933 Parcel reply = Parcel.obtain();
3934 data.writeInterfaceToken(IActivityManager.descriptor);
3935 data.writeInt(max);
3936 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3937 reply.readException();
3938 data.recycle();
3939 reply.recycle();
3940 }
3941 public int getProcessLimit() throws RemoteException
3942 {
3943 Parcel data = Parcel.obtain();
3944 Parcel reply = Parcel.obtain();
3945 data.writeInterfaceToken(IActivityManager.descriptor);
3946 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3947 reply.readException();
3948 int res = reply.readInt();
3949 data.recycle();
3950 reply.recycle();
3951 return res;
3952 }
3953 public void setProcessForeground(IBinder token, int pid,
3954 boolean isForeground) throws RemoteException {
3955 Parcel data = Parcel.obtain();
3956 Parcel reply = Parcel.obtain();
3957 data.writeInterfaceToken(IActivityManager.descriptor);
3958 data.writeStrongBinder(token);
3959 data.writeInt(pid);
3960 data.writeInt(isForeground ? 1 : 0);
3961 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3962 reply.readException();
3963 data.recycle();
3964 reply.recycle();
3965 }
3966 public int checkPermission(String permission, int pid, int uid)
3967 throws RemoteException {
3968 Parcel data = Parcel.obtain();
3969 Parcel reply = Parcel.obtain();
3970 data.writeInterfaceToken(IActivityManager.descriptor);
3971 data.writeString(permission);
3972 data.writeInt(pid);
3973 data.writeInt(uid);
3974 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3975 reply.readException();
3976 int res = reply.readInt();
3977 data.recycle();
3978 reply.recycle();
3979 return res;
3980 }
Dianne Hackbornff170242014-11-19 10:59:01 -08003981 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
3982 throws RemoteException {
3983 Parcel data = Parcel.obtain();
3984 Parcel reply = Parcel.obtain();
3985 data.writeInterfaceToken(IActivityManager.descriptor);
3986 data.writeString(permission);
3987 data.writeInt(pid);
3988 data.writeInt(uid);
3989 data.writeStrongBinder(callerToken);
3990 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
3991 reply.readException();
3992 int res = reply.readInt();
3993 data.recycle();
3994 reply.recycle();
3995 return res;
3996 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003997 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003998 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003999 Parcel data = Parcel.obtain();
4000 Parcel reply = Parcel.obtain();
4001 data.writeInterfaceToken(IActivityManager.descriptor);
4002 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004003 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004004 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004005 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4006 reply.readException();
4007 boolean res = reply.readInt() != 0;
4008 data.recycle();
4009 reply.recycle();
4010 return res;
4011 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004012 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4013 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004014 Parcel data = Parcel.obtain();
4015 Parcel reply = Parcel.obtain();
4016 data.writeInterfaceToken(IActivityManager.descriptor);
4017 uri.writeToParcel(data, 0);
4018 data.writeInt(pid);
4019 data.writeInt(uid);
4020 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004021 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004022 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004023 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4024 reply.readException();
4025 int res = reply.readInt();
4026 data.recycle();
4027 reply.recycle();
4028 return res;
4029 }
4030 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004031 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004032 Parcel data = Parcel.obtain();
4033 Parcel reply = Parcel.obtain();
4034 data.writeInterfaceToken(IActivityManager.descriptor);
4035 data.writeStrongBinder(caller.asBinder());
4036 data.writeString(targetPkg);
4037 uri.writeToParcel(data, 0);
4038 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004039 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004040 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4041 reply.readException();
4042 data.recycle();
4043 reply.recycle();
4044 }
4045 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004046 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004047 Parcel data = Parcel.obtain();
4048 Parcel reply = Parcel.obtain();
4049 data.writeInterfaceToken(IActivityManager.descriptor);
4050 data.writeStrongBinder(caller.asBinder());
4051 uri.writeToParcel(data, 0);
4052 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004053 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004054 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4055 reply.readException();
4056 data.recycle();
4057 reply.recycle();
4058 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004059
4060 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004061 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4062 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004063 Parcel data = Parcel.obtain();
4064 Parcel reply = Parcel.obtain();
4065 data.writeInterfaceToken(IActivityManager.descriptor);
4066 uri.writeToParcel(data, 0);
4067 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004068 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004069 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4070 reply.readException();
4071 data.recycle();
4072 reply.recycle();
4073 }
4074
4075 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004076 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4077 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004078 Parcel data = Parcel.obtain();
4079 Parcel reply = Parcel.obtain();
4080 data.writeInterfaceToken(IActivityManager.descriptor);
4081 uri.writeToParcel(data, 0);
4082 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004083 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004084 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4085 reply.readException();
4086 data.recycle();
4087 reply.recycle();
4088 }
4089
4090 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004091 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4092 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004093 Parcel data = Parcel.obtain();
4094 Parcel reply = Parcel.obtain();
4095 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004096 data.writeString(packageName);
4097 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004098 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4099 reply.readException();
4100 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4101 reply);
4102 data.recycle();
4103 reply.recycle();
4104 return perms;
4105 }
4106
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004107 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4108 throws RemoteException {
4109 Parcel data = Parcel.obtain();
4110 Parcel reply = Parcel.obtain();
4111 data.writeInterfaceToken(IActivityManager.descriptor);
4112 data.writeStrongBinder(who.asBinder());
4113 data.writeInt(waiting ? 1 : 0);
4114 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4115 reply.readException();
4116 data.recycle();
4117 reply.recycle();
4118 }
4119 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4120 Parcel data = Parcel.obtain();
4121 Parcel reply = Parcel.obtain();
4122 data.writeInterfaceToken(IActivityManager.descriptor);
4123 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4124 reply.readException();
4125 outInfo.readFromParcel(reply);
4126 data.recycle();
4127 reply.recycle();
4128 }
4129 public void unhandledBack() throws RemoteException
4130 {
4131 Parcel data = Parcel.obtain();
4132 Parcel reply = Parcel.obtain();
4133 data.writeInterfaceToken(IActivityManager.descriptor);
4134 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4135 reply.readException();
4136 data.recycle();
4137 reply.recycle();
4138 }
4139 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4140 {
4141 Parcel data = Parcel.obtain();
4142 Parcel reply = Parcel.obtain();
4143 data.writeInterfaceToken(IActivityManager.descriptor);
4144 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4145 reply.readException();
4146 ParcelFileDescriptor pfd = null;
4147 if (reply.readInt() != 0) {
4148 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4149 }
4150 data.recycle();
4151 reply.recycle();
4152 return pfd;
4153 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004154 public void setLockScreenShown(boolean shown) throws RemoteException
4155 {
4156 Parcel data = Parcel.obtain();
4157 Parcel reply = Parcel.obtain();
4158 data.writeInterfaceToken(IActivityManager.descriptor);
4159 data.writeInt(shown ? 1 : 0);
4160 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4161 reply.readException();
4162 data.recycle();
4163 reply.recycle();
4164 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004165 public void setDebugApp(
4166 String packageName, boolean waitForDebugger, boolean persistent)
4167 throws RemoteException
4168 {
4169 Parcel data = Parcel.obtain();
4170 Parcel reply = Parcel.obtain();
4171 data.writeInterfaceToken(IActivityManager.descriptor);
4172 data.writeString(packageName);
4173 data.writeInt(waitForDebugger ? 1 : 0);
4174 data.writeInt(persistent ? 1 : 0);
4175 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4176 reply.readException();
4177 data.recycle();
4178 reply.recycle();
4179 }
4180 public void setAlwaysFinish(boolean enabled) throws RemoteException
4181 {
4182 Parcel data = Parcel.obtain();
4183 Parcel reply = Parcel.obtain();
4184 data.writeInterfaceToken(IActivityManager.descriptor);
4185 data.writeInt(enabled ? 1 : 0);
4186 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4187 reply.readException();
4188 data.recycle();
4189 reply.recycle();
4190 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004191 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004192 {
4193 Parcel data = Parcel.obtain();
4194 Parcel reply = Parcel.obtain();
4195 data.writeInterfaceToken(IActivityManager.descriptor);
4196 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004197 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004198 reply.readException();
4199 data.recycle();
4200 reply.recycle();
4201 }
4202 public void enterSafeMode() throws RemoteException {
4203 Parcel data = Parcel.obtain();
4204 data.writeInterfaceToken(IActivityManager.descriptor);
4205 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4206 data.recycle();
4207 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08004208 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
4209 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004210 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004211 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004212 data.writeStrongBinder(sender.asBinder());
4213 data.writeInt(sourceUid);
4214 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004215 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4216 data.recycle();
4217 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004218 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004219 Parcel data = Parcel.obtain();
4220 Parcel reply = Parcel.obtain();
4221 data.writeInterfaceToken(IActivityManager.descriptor);
4222 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004223 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004224 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004225 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004226 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004227 boolean res = reply.readInt() != 0;
4228 data.recycle();
4229 reply.recycle();
4230 return res;
4231 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004232 @Override
4233 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4234 Parcel data = Parcel.obtain();
4235 Parcel reply = Parcel.obtain();
4236 data.writeInterfaceToken(IActivityManager.descriptor);
4237 data.writeString(reason);
4238 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4239 boolean res = reply.readInt() != 0;
4240 data.recycle();
4241 reply.recycle();
4242 return res;
4243 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004244 public boolean testIsSystemReady()
4245 {
4246 /* this base class version is never called */
4247 return true;
4248 }
Dan Egnor60d87622009-12-16 16:32:58 -08004249 public void handleApplicationCrash(IBinder app,
4250 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4251 {
4252 Parcel data = Parcel.obtain();
4253 Parcel reply = Parcel.obtain();
4254 data.writeInterfaceToken(IActivityManager.descriptor);
4255 data.writeStrongBinder(app);
4256 crashInfo.writeToParcel(data, 0);
4257 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4258 reply.readException();
4259 reply.recycle();
4260 data.recycle();
4261 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004262
Dianne Hackborn52322712014-08-26 22:47:26 -07004263 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004264 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004265 {
4266 Parcel data = Parcel.obtain();
4267 Parcel reply = Parcel.obtain();
4268 data.writeInterfaceToken(IActivityManager.descriptor);
4269 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004270 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004271 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004272 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004273 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004274 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004275 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004276 reply.recycle();
4277 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004278 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004279 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004280
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004281 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004282 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004283 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004284 {
4285 Parcel data = Parcel.obtain();
4286 Parcel reply = Parcel.obtain();
4287 data.writeInterfaceToken(IActivityManager.descriptor);
4288 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004289 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004290 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004291 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4292 reply.readException();
4293 reply.recycle();
4294 data.recycle();
4295 }
4296
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004297 public void signalPersistentProcesses(int sig) throws RemoteException {
4298 Parcel data = Parcel.obtain();
4299 Parcel reply = Parcel.obtain();
4300 data.writeInterfaceToken(IActivityManager.descriptor);
4301 data.writeInt(sig);
4302 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4303 reply.readException();
4304 data.recycle();
4305 reply.recycle();
4306 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004307
Dianne Hackborn1676c852012-09-10 14:52:30 -07004308 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004309 Parcel data = Parcel.obtain();
4310 Parcel reply = Parcel.obtain();
4311 data.writeInterfaceToken(IActivityManager.descriptor);
4312 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004313 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004314 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4315 reply.readException();
4316 data.recycle();
4317 reply.recycle();
4318 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004319
4320 public void killAllBackgroundProcesses() throws RemoteException {
4321 Parcel data = Parcel.obtain();
4322 Parcel reply = Parcel.obtain();
4323 data.writeInterfaceToken(IActivityManager.descriptor);
4324 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4325 reply.readException();
4326 data.recycle();
4327 reply.recycle();
4328 }
4329
Dianne Hackborn1676c852012-09-10 14:52:30 -07004330 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004331 Parcel data = Parcel.obtain();
4332 Parcel reply = Parcel.obtain();
4333 data.writeInterfaceToken(IActivityManager.descriptor);
4334 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004335 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004336 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004337 reply.readException();
4338 data.recycle();
4339 reply.recycle();
4340 }
4341
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004342 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4343 throws RemoteException
4344 {
4345 Parcel data = Parcel.obtain();
4346 Parcel reply = Parcel.obtain();
4347 data.writeInterfaceToken(IActivityManager.descriptor);
4348 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4349 reply.readException();
4350 outInfo.readFromParcel(reply);
4351 reply.recycle();
4352 data.recycle();
4353 }
4354
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004355 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4356 {
4357 Parcel data = Parcel.obtain();
4358 Parcel reply = Parcel.obtain();
4359 data.writeInterfaceToken(IActivityManager.descriptor);
4360 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4361 reply.readException();
4362 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4363 reply.recycle();
4364 data.recycle();
4365 return res;
4366 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004367
Dianne Hackborn1676c852012-09-10 14:52:30 -07004368 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004369 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004370 {
4371 Parcel data = Parcel.obtain();
4372 Parcel reply = Parcel.obtain();
4373 data.writeInterfaceToken(IActivityManager.descriptor);
4374 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004375 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004376 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004377 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004378 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004379 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004380 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004381 } else {
4382 data.writeInt(0);
4383 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004384 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4385 reply.readException();
4386 boolean res = reply.readInt() != 0;
4387 reply.recycle();
4388 data.recycle();
4389 return res;
4390 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004391
Dianne Hackborn55280a92009-05-07 15:53:46 -07004392 public boolean shutdown(int timeout) throws RemoteException
4393 {
4394 Parcel data = Parcel.obtain();
4395 Parcel reply = Parcel.obtain();
4396 data.writeInterfaceToken(IActivityManager.descriptor);
4397 data.writeInt(timeout);
4398 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4399 reply.readException();
4400 boolean res = reply.readInt() != 0;
4401 reply.recycle();
4402 data.recycle();
4403 return res;
4404 }
4405
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004406 public void stopAppSwitches() throws RemoteException {
4407 Parcel data = Parcel.obtain();
4408 Parcel reply = Parcel.obtain();
4409 data.writeInterfaceToken(IActivityManager.descriptor);
4410 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4411 reply.readException();
4412 reply.recycle();
4413 data.recycle();
4414 }
4415
4416 public void resumeAppSwitches() throws RemoteException {
4417 Parcel data = Parcel.obtain();
4418 Parcel reply = Parcel.obtain();
4419 data.writeInterfaceToken(IActivityManager.descriptor);
4420 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4421 reply.readException();
4422 reply.recycle();
4423 data.recycle();
4424 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004425
4426 public void addPackageDependency(String packageName) throws RemoteException {
4427 Parcel data = Parcel.obtain();
4428 Parcel reply = Parcel.obtain();
4429 data.writeInterfaceToken(IActivityManager.descriptor);
4430 data.writeString(packageName);
4431 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4432 reply.readException();
4433 data.recycle();
4434 reply.recycle();
4435 }
4436
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004437 public void killApplicationWithAppId(String pkg, int appid, String reason)
4438 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004439 Parcel data = Parcel.obtain();
4440 Parcel reply = Parcel.obtain();
4441 data.writeInterfaceToken(IActivityManager.descriptor);
4442 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004443 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004444 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004445 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004446 reply.readException();
4447 data.recycle();
4448 reply.recycle();
4449 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004450
4451 public void closeSystemDialogs(String reason) throws RemoteException {
4452 Parcel data = Parcel.obtain();
4453 Parcel reply = Parcel.obtain();
4454 data.writeInterfaceToken(IActivityManager.descriptor);
4455 data.writeString(reason);
4456 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4457 reply.readException();
4458 data.recycle();
4459 reply.recycle();
4460 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004461
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004462 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004463 throws RemoteException {
4464 Parcel data = Parcel.obtain();
4465 Parcel reply = Parcel.obtain();
4466 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004467 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004468 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4469 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004470 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004471 data.recycle();
4472 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004473 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004474 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004475
4476 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4477 Parcel data = Parcel.obtain();
4478 Parcel reply = Parcel.obtain();
4479 data.writeInterfaceToken(IActivityManager.descriptor);
4480 data.writeString(processName);
4481 data.writeInt(uid);
4482 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4483 reply.readException();
4484 data.recycle();
4485 reply.recycle();
4486 }
4487
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004488 public void overridePendingTransition(IBinder token, String packageName,
4489 int enterAnim, int exitAnim) throws RemoteException {
4490 Parcel data = Parcel.obtain();
4491 Parcel reply = Parcel.obtain();
4492 data.writeInterfaceToken(IActivityManager.descriptor);
4493 data.writeStrongBinder(token);
4494 data.writeString(packageName);
4495 data.writeInt(enterAnim);
4496 data.writeInt(exitAnim);
4497 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4498 reply.readException();
4499 data.recycle();
4500 reply.recycle();
4501 }
4502
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004503 public boolean isUserAMonkey() throws RemoteException {
4504 Parcel data = Parcel.obtain();
4505 Parcel reply = Parcel.obtain();
4506 data.writeInterfaceToken(IActivityManager.descriptor);
4507 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4508 reply.readException();
4509 boolean res = reply.readInt() != 0;
4510 data.recycle();
4511 reply.recycle();
4512 return res;
4513 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004514
4515 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4516 Parcel data = Parcel.obtain();
4517 Parcel reply = Parcel.obtain();
4518 data.writeInterfaceToken(IActivityManager.descriptor);
4519 data.writeInt(monkey ? 1 : 0);
4520 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4521 reply.readException();
4522 data.recycle();
4523 reply.recycle();
4524 }
4525
Dianne Hackborn860755f2010-06-03 18:47:52 -07004526 public void finishHeavyWeightApp() throws RemoteException {
4527 Parcel data = Parcel.obtain();
4528 Parcel reply = Parcel.obtain();
4529 data.writeInterfaceToken(IActivityManager.descriptor);
4530 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4531 reply.readException();
4532 data.recycle();
4533 reply.recycle();
4534 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004535
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004536 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004537 throws RemoteException {
4538 Parcel data = Parcel.obtain();
4539 Parcel reply = Parcel.obtain();
4540 data.writeInterfaceToken(IActivityManager.descriptor);
4541 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004542 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4543 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004544 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004545 data.recycle();
4546 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004547 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004548 }
4549
Craig Mautner233ceee2014-05-09 17:05:11 -07004550 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004551 throws RemoteException {
4552 Parcel data = Parcel.obtain();
4553 Parcel reply = Parcel.obtain();
4554 data.writeInterfaceToken(IActivityManager.descriptor);
4555 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004556 if (options == null) {
4557 data.writeInt(0);
4558 } else {
4559 data.writeInt(1);
4560 data.writeBundle(options.toBundle());
4561 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004562 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004563 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004564 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004565 data.recycle();
4566 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004567 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004568 }
4569
Craig Mautner233ceee2014-05-09 17:05:11 -07004570 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4571 Parcel data = Parcel.obtain();
4572 Parcel reply = Parcel.obtain();
4573 data.writeInterfaceToken(IActivityManager.descriptor);
4574 data.writeStrongBinder(token);
4575 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4576 reply.readException();
4577 Bundle bundle = reply.readBundle();
4578 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4579 data.recycle();
4580 reply.recycle();
4581 return options;
4582 }
4583
Daniel Sandler69a48172010-06-23 16:29:36 -04004584 public void setImmersive(IBinder token, boolean immersive)
4585 throws RemoteException {
4586 Parcel data = Parcel.obtain();
4587 Parcel reply = Parcel.obtain();
4588 data.writeInterfaceToken(IActivityManager.descriptor);
4589 data.writeStrongBinder(token);
4590 data.writeInt(immersive ? 1 : 0);
4591 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4592 reply.readException();
4593 data.recycle();
4594 reply.recycle();
4595 }
4596
4597 public boolean isImmersive(IBinder token)
4598 throws RemoteException {
4599 Parcel data = Parcel.obtain();
4600 Parcel reply = Parcel.obtain();
4601 data.writeInterfaceToken(IActivityManager.descriptor);
4602 data.writeStrongBinder(token);
4603 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004604 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004605 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004606 data.recycle();
4607 reply.recycle();
4608 return res;
4609 }
4610
Craig Mautnerd61dc202014-07-07 11:09:11 -07004611 public boolean isTopOfTask(IBinder token) throws RemoteException {
4612 Parcel data = Parcel.obtain();
4613 Parcel reply = Parcel.obtain();
4614 data.writeInterfaceToken(IActivityManager.descriptor);
4615 data.writeStrongBinder(token);
4616 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4617 reply.readException();
4618 boolean res = reply.readInt() == 1;
4619 data.recycle();
4620 reply.recycle();
4621 return res;
4622 }
4623
Daniel Sandler69a48172010-06-23 16:29:36 -04004624 public boolean isTopActivityImmersive()
4625 throws RemoteException {
4626 Parcel data = Parcel.obtain();
4627 Parcel reply = Parcel.obtain();
4628 data.writeInterfaceToken(IActivityManager.descriptor);
4629 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004630 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004631 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004632 data.recycle();
4633 reply.recycle();
4634 return res;
4635 }
4636
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004637 public void crashApplication(int uid, int initialPid, String packageName,
4638 String message) throws RemoteException {
4639 Parcel data = Parcel.obtain();
4640 Parcel reply = Parcel.obtain();
4641 data.writeInterfaceToken(IActivityManager.descriptor);
4642 data.writeInt(uid);
4643 data.writeInt(initialPid);
4644 data.writeString(packageName);
4645 data.writeString(message);
4646 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4647 reply.readException();
4648 data.recycle();
4649 reply.recycle();
4650 }
Andy McFadden824c5102010-07-09 16:26:57 -07004651
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004652 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004653 Parcel data = Parcel.obtain();
4654 Parcel reply = Parcel.obtain();
4655 data.writeInterfaceToken(IActivityManager.descriptor);
4656 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004657 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004658 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4659 reply.readException();
4660 String res = reply.readString();
4661 data.recycle();
4662 reply.recycle();
4663 return res;
4664 }
4665
Dianne Hackborn7e269642010-08-25 19:50:20 -07004666 public IBinder newUriPermissionOwner(String name)
4667 throws RemoteException {
4668 Parcel data = Parcel.obtain();
4669 Parcel reply = Parcel.obtain();
4670 data.writeInterfaceToken(IActivityManager.descriptor);
4671 data.writeString(name);
4672 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4673 reply.readException();
4674 IBinder res = reply.readStrongBinder();
4675 data.recycle();
4676 reply.recycle();
4677 return res;
4678 }
4679
4680 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004681 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004682 Parcel data = Parcel.obtain();
4683 Parcel reply = Parcel.obtain();
4684 data.writeInterfaceToken(IActivityManager.descriptor);
4685 data.writeStrongBinder(owner);
4686 data.writeInt(fromUid);
4687 data.writeString(targetPkg);
4688 uri.writeToParcel(data, 0);
4689 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004690 data.writeInt(sourceUserId);
4691 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004692 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4693 reply.readException();
4694 data.recycle();
4695 reply.recycle();
4696 }
4697
4698 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004699 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004700 Parcel data = Parcel.obtain();
4701 Parcel reply = Parcel.obtain();
4702 data.writeInterfaceToken(IActivityManager.descriptor);
4703 data.writeStrongBinder(owner);
4704 if (uri != null) {
4705 data.writeInt(1);
4706 uri.writeToParcel(data, 0);
4707 } else {
4708 data.writeInt(0);
4709 }
4710 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004711 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004712 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4713 reply.readException();
4714 data.recycle();
4715 reply.recycle();
4716 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004717
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004718 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004719 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004720 Parcel data = Parcel.obtain();
4721 Parcel reply = Parcel.obtain();
4722 data.writeInterfaceToken(IActivityManager.descriptor);
4723 data.writeInt(callingUid);
4724 data.writeString(targetPkg);
4725 uri.writeToParcel(data, 0);
4726 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004727 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004728 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4729 reply.readException();
4730 int res = reply.readInt();
4731 data.recycle();
4732 reply.recycle();
4733 return res;
4734 }
4735
Dianne Hackborn1676c852012-09-10 14:52:30 -07004736 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004737 String path, ParcelFileDescriptor fd) throws RemoteException {
4738 Parcel data = Parcel.obtain();
4739 Parcel reply = Parcel.obtain();
4740 data.writeInterfaceToken(IActivityManager.descriptor);
4741 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004742 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004743 data.writeInt(managed ? 1 : 0);
4744 data.writeString(path);
4745 if (fd != null) {
4746 data.writeInt(1);
4747 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4748 } else {
4749 data.writeInt(0);
4750 }
4751 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4752 reply.readException();
4753 boolean res = reply.readInt() != 0;
4754 reply.recycle();
4755 data.recycle();
4756 return res;
4757 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004758
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004759 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004760 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004761 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004762 Parcel data = Parcel.obtain();
4763 Parcel reply = Parcel.obtain();
4764 data.writeInterfaceToken(IActivityManager.descriptor);
4765 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004766 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004767 data.writeTypedArray(intents, 0);
4768 data.writeStringArray(resolvedTypes);
4769 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004770 if (options != null) {
4771 data.writeInt(1);
4772 options.writeToParcel(data, 0);
4773 } else {
4774 data.writeInt(0);
4775 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004776 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004777 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4778 reply.readException();
4779 int result = reply.readInt();
4780 reply.recycle();
4781 data.recycle();
4782 return result;
4783 }
4784
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004785 public int getFrontActivityScreenCompatMode() throws RemoteException {
4786 Parcel data = Parcel.obtain();
4787 Parcel reply = Parcel.obtain();
4788 data.writeInterfaceToken(IActivityManager.descriptor);
4789 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4790 reply.readException();
4791 int mode = reply.readInt();
4792 reply.recycle();
4793 data.recycle();
4794 return mode;
4795 }
4796
4797 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4798 Parcel data = Parcel.obtain();
4799 Parcel reply = Parcel.obtain();
4800 data.writeInterfaceToken(IActivityManager.descriptor);
4801 data.writeInt(mode);
4802 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4803 reply.readException();
4804 reply.recycle();
4805 data.recycle();
4806 }
4807
4808 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4809 Parcel data = Parcel.obtain();
4810 Parcel reply = Parcel.obtain();
4811 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004812 data.writeString(packageName);
4813 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004814 reply.readException();
4815 int mode = reply.readInt();
4816 reply.recycle();
4817 data.recycle();
4818 return mode;
4819 }
4820
4821 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004822 throws RemoteException {
4823 Parcel data = Parcel.obtain();
4824 Parcel reply = Parcel.obtain();
4825 data.writeInterfaceToken(IActivityManager.descriptor);
4826 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004827 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004828 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4829 reply.readException();
4830 reply.recycle();
4831 data.recycle();
4832 }
4833
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004834 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4835 Parcel data = Parcel.obtain();
4836 Parcel reply = Parcel.obtain();
4837 data.writeInterfaceToken(IActivityManager.descriptor);
4838 data.writeString(packageName);
4839 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4840 reply.readException();
4841 boolean ask = reply.readInt() != 0;
4842 reply.recycle();
4843 data.recycle();
4844 return ask;
4845 }
4846
4847 public void setPackageAskScreenCompat(String packageName, boolean ask)
4848 throws RemoteException {
4849 Parcel data = Parcel.obtain();
4850 Parcel reply = Parcel.obtain();
4851 data.writeInterfaceToken(IActivityManager.descriptor);
4852 data.writeString(packageName);
4853 data.writeInt(ask ? 1 : 0);
4854 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4855 reply.readException();
4856 reply.recycle();
4857 data.recycle();
4858 }
4859
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004860 public boolean switchUser(int userid) throws RemoteException {
4861 Parcel data = Parcel.obtain();
4862 Parcel reply = Parcel.obtain();
4863 data.writeInterfaceToken(IActivityManager.descriptor);
4864 data.writeInt(userid);
4865 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4866 reply.readException();
4867 boolean result = reply.readInt() != 0;
4868 reply.recycle();
4869 data.recycle();
4870 return result;
4871 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004872
Kenny Guy08488bf2014-02-21 17:40:37 +00004873 public boolean startUserInBackground(int userid) throws RemoteException {
4874 Parcel data = Parcel.obtain();
4875 Parcel reply = Parcel.obtain();
4876 data.writeInterfaceToken(IActivityManager.descriptor);
4877 data.writeInt(userid);
4878 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4879 reply.readException();
4880 boolean result = reply.readInt() != 0;
4881 reply.recycle();
4882 data.recycle();
4883 return result;
4884 }
4885
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004886 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4887 Parcel data = Parcel.obtain();
4888 Parcel reply = Parcel.obtain();
4889 data.writeInterfaceToken(IActivityManager.descriptor);
4890 data.writeInt(userid);
4891 data.writeStrongInterface(callback);
4892 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4893 reply.readException();
4894 int result = reply.readInt();
4895 reply.recycle();
4896 data.recycle();
4897 return result;
4898 }
4899
Amith Yamasani52f1d752012-03-28 18:19:29 -07004900 public UserInfo getCurrentUser() throws RemoteException {
4901 Parcel data = Parcel.obtain();
4902 Parcel reply = Parcel.obtain();
4903 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004904 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004905 reply.readException();
4906 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4907 reply.recycle();
4908 data.recycle();
4909 return userInfo;
4910 }
4911
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004912 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004913 Parcel data = Parcel.obtain();
4914 Parcel reply = Parcel.obtain();
4915 data.writeInterfaceToken(IActivityManager.descriptor);
4916 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004917 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004918 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4919 reply.readException();
4920 boolean result = reply.readInt() != 0;
4921 reply.recycle();
4922 data.recycle();
4923 return result;
4924 }
4925
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004926 public int[] getRunningUserIds() throws RemoteException {
4927 Parcel data = Parcel.obtain();
4928 Parcel reply = Parcel.obtain();
4929 data.writeInterfaceToken(IActivityManager.descriptor);
4930 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4931 reply.readException();
4932 int[] result = reply.createIntArray();
4933 reply.recycle();
4934 data.recycle();
4935 return result;
4936 }
4937
Wale Ogunwaled54b5782014-10-23 15:55:23 -07004938 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004939 Parcel data = Parcel.obtain();
4940 Parcel reply = Parcel.obtain();
4941 data.writeInterfaceToken(IActivityManager.descriptor);
4942 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004943 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4944 reply.readException();
4945 boolean result = reply.readInt() != 0;
4946 reply.recycle();
4947 data.recycle();
4948 return result;
4949 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004950
Jeff Sharkeya4620792011-05-20 15:29:23 -07004951 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4952 Parcel data = Parcel.obtain();
4953 Parcel reply = Parcel.obtain();
4954 data.writeInterfaceToken(IActivityManager.descriptor);
4955 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4956 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4957 reply.readException();
4958 data.recycle();
4959 reply.recycle();
4960 }
4961
4962 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4963 Parcel data = Parcel.obtain();
4964 Parcel reply = Parcel.obtain();
4965 data.writeInterfaceToken(IActivityManager.descriptor);
4966 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4967 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4968 reply.readException();
4969 data.recycle();
4970 reply.recycle();
4971 }
4972
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004973 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4974 Parcel data = Parcel.obtain();
4975 Parcel reply = Parcel.obtain();
4976 data.writeInterfaceToken(IActivityManager.descriptor);
4977 data.writeStrongBinder(sender.asBinder());
4978 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4979 reply.readException();
4980 boolean res = reply.readInt() != 0;
4981 data.recycle();
4982 reply.recycle();
4983 return res;
4984 }
4985
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004986 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4987 Parcel data = Parcel.obtain();
4988 Parcel reply = Parcel.obtain();
4989 data.writeInterfaceToken(IActivityManager.descriptor);
4990 data.writeStrongBinder(sender.asBinder());
4991 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4992 reply.readException();
4993 boolean res = reply.readInt() != 0;
4994 data.recycle();
4995 reply.recycle();
4996 return res;
4997 }
4998
Dianne Hackborn81038902012-11-26 17:04:09 -08004999 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5000 Parcel data = Parcel.obtain();
5001 Parcel reply = Parcel.obtain();
5002 data.writeInterfaceToken(IActivityManager.descriptor);
5003 data.writeStrongBinder(sender.asBinder());
5004 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5005 reply.readException();
5006 Intent res = reply.readInt() != 0
5007 ? Intent.CREATOR.createFromParcel(reply) : null;
5008 data.recycle();
5009 reply.recycle();
5010 return res;
5011 }
5012
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005013 public String getTagForIntentSender(IIntentSender sender, String prefix)
5014 throws RemoteException {
5015 Parcel data = Parcel.obtain();
5016 Parcel reply = Parcel.obtain();
5017 data.writeInterfaceToken(IActivityManager.descriptor);
5018 data.writeStrongBinder(sender.asBinder());
5019 data.writeString(prefix);
5020 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5021 reply.readException();
5022 String res = reply.readString();
5023 data.recycle();
5024 reply.recycle();
5025 return res;
5026 }
5027
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005028 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5029 {
5030 Parcel data = Parcel.obtain();
5031 Parcel reply = Parcel.obtain();
5032 data.writeInterfaceToken(IActivityManager.descriptor);
5033 values.writeToParcel(data, 0);
5034 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5035 reply.readException();
5036 data.recycle();
5037 reply.recycle();
5038 }
5039
Dianne Hackbornb437e092011-08-05 17:50:29 -07005040 public long[] getProcessPss(int[] pids) throws RemoteException {
5041 Parcel data = Parcel.obtain();
5042 Parcel reply = Parcel.obtain();
5043 data.writeInterfaceToken(IActivityManager.descriptor);
5044 data.writeIntArray(pids);
5045 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5046 reply.readException();
5047 long[] res = reply.createLongArray();
5048 data.recycle();
5049 reply.recycle();
5050 return res;
5051 }
5052
Dianne Hackborn661cd522011-08-22 00:26:20 -07005053 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5054 Parcel data = Parcel.obtain();
5055 Parcel reply = Parcel.obtain();
5056 data.writeInterfaceToken(IActivityManager.descriptor);
5057 TextUtils.writeToParcel(msg, data, 0);
5058 data.writeInt(always ? 1 : 0);
5059 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5060 reply.readException();
5061 data.recycle();
5062 reply.recycle();
5063 }
5064
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005065 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005066 Parcel data = Parcel.obtain();
5067 Parcel reply = Parcel.obtain();
5068 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005069 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005070 reply.readException();
5071 data.recycle();
5072 reply.recycle();
5073 }
5074
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005075 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005076 throws RemoteException {
5077 Parcel data = Parcel.obtain();
5078 Parcel reply = Parcel.obtain();
5079 data.writeInterfaceToken(IActivityManager.descriptor);
5080 data.writeStrongBinder(token);
5081 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005082 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005083 reply.readException();
5084 boolean result = reply.readInt() != 0;
5085 data.recycle();
5086 reply.recycle();
5087 return result;
5088 }
5089
5090 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5091 throws RemoteException {
5092 Parcel data = Parcel.obtain();
5093 Parcel reply = Parcel.obtain();
5094 data.writeInterfaceToken(IActivityManager.descriptor);
5095 data.writeStrongBinder(token);
5096 target.writeToParcel(data, 0);
5097 data.writeInt(resultCode);
5098 if (resultData != null) {
5099 data.writeInt(1);
5100 resultData.writeToParcel(data, 0);
5101 } else {
5102 data.writeInt(0);
5103 }
5104 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5105 reply.readException();
5106 boolean result = reply.readInt() != 0;
5107 data.recycle();
5108 reply.recycle();
5109 return result;
5110 }
5111
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005112 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5113 Parcel data = Parcel.obtain();
5114 Parcel reply = Parcel.obtain();
5115 data.writeInterfaceToken(IActivityManager.descriptor);
5116 data.writeStrongBinder(activityToken);
5117 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5118 reply.readException();
5119 int result = reply.readInt();
5120 data.recycle();
5121 reply.recycle();
5122 return result;
5123 }
5124
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005125 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5126 Parcel data = Parcel.obtain();
5127 Parcel reply = Parcel.obtain();
5128 data.writeInterfaceToken(IActivityManager.descriptor);
5129 data.writeStrongBinder(activityToken);
5130 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5131 reply.readException();
5132 String result = reply.readString();
5133 data.recycle();
5134 reply.recycle();
5135 return result;
5136 }
5137
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005138 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5139 Parcel data = Parcel.obtain();
5140 Parcel reply = Parcel.obtain();
5141 data.writeInterfaceToken(IActivityManager.descriptor);
5142 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5143 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5144 reply.readException();
5145 data.recycle();
5146 reply.recycle();
5147 }
5148
5149 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5150 Parcel data = Parcel.obtain();
5151 Parcel reply = Parcel.obtain();
5152 data.writeInterfaceToken(IActivityManager.descriptor);
5153 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5154 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5155 reply.readException();
5156 data.recycle();
5157 reply.recycle();
5158 }
5159
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005160 public void requestBugReport() throws RemoteException {
5161 Parcel data = Parcel.obtain();
5162 Parcel reply = Parcel.obtain();
5163 data.writeInterfaceToken(IActivityManager.descriptor);
5164 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5165 reply.readException();
5166 data.recycle();
5167 reply.recycle();
5168 }
5169
Jeff Brownbd181bb2013-09-10 16:44:24 -07005170 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5171 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005172 Parcel data = Parcel.obtain();
5173 Parcel reply = Parcel.obtain();
5174 data.writeInterfaceToken(IActivityManager.descriptor);
5175 data.writeInt(pid);
5176 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005177 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005178 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5179 reply.readException();
5180 long res = reply.readInt();
5181 data.recycle();
5182 reply.recycle();
5183 return res;
5184 }
5185
Adam Skorydfc7fd72013-08-05 19:23:41 -07005186 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005187 Parcel data = Parcel.obtain();
5188 Parcel reply = Parcel.obtain();
5189 data.writeInterfaceToken(IActivityManager.descriptor);
5190 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005191 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005192 reply.readException();
5193 Bundle res = reply.readBundle();
5194 data.recycle();
5195 reply.recycle();
5196 return res;
5197 }
5198
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005199 public void requestAssistContextExtras(int requestType, IResultReceiver receiver)
5200 throws RemoteException {
5201 Parcel data = Parcel.obtain();
5202 Parcel reply = Parcel.obtain();
5203 data.writeInterfaceToken(IActivityManager.descriptor);
5204 data.writeInt(requestType);
5205 data.writeStrongBinder(receiver.asBinder());
5206 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5207 reply.readException();
5208 data.recycle();
5209 reply.recycle();
5210 }
5211
Adam Skory7140a252013-09-11 12:04:58 +01005212 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005213 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005214 Parcel data = Parcel.obtain();
5215 Parcel reply = Parcel.obtain();
5216 data.writeInterfaceToken(IActivityManager.descriptor);
5217 data.writeStrongBinder(token);
5218 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005219 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005220 reply.readException();
5221 data.recycle();
5222 reply.recycle();
5223 }
5224
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005225 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
5226 throws RemoteException {
5227 Parcel data = Parcel.obtain();
5228 Parcel reply = Parcel.obtain();
5229 data.writeInterfaceToken(IActivityManager.descriptor);
5230 intent.writeToParcel(data, 0);
5231 data.writeInt(requestType);
5232 data.writeString(hint);
5233 data.writeInt(userHandle);
5234 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5235 reply.readException();
5236 boolean res = reply.readInt() != 0;
5237 data.recycle();
5238 reply.recycle();
5239 return res;
5240 }
5241
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005242 public void killUid(int uid, String reason) throws RemoteException {
5243 Parcel data = Parcel.obtain();
5244 Parcel reply = Parcel.obtain();
5245 data.writeInterfaceToken(IActivityManager.descriptor);
5246 data.writeInt(uid);
5247 data.writeString(reason);
5248 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5249 reply.readException();
5250 data.recycle();
5251 reply.recycle();
5252 }
5253
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005254 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5255 Parcel data = Parcel.obtain();
5256 Parcel reply = Parcel.obtain();
5257 data.writeInterfaceToken(IActivityManager.descriptor);
5258 data.writeStrongBinder(who);
5259 data.writeInt(allowRestart ? 1 : 0);
5260 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5261 reply.readException();
5262 data.recycle();
5263 reply.recycle();
5264 }
5265
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005266 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5267 Parcel data = Parcel.obtain();
5268 Parcel reply = Parcel.obtain();
5269 data.writeInterfaceToken(IActivityManager.descriptor);
5270 data.writeStrongBinder(token);
5271 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5272 reply.readException();
5273 data.recycle();
5274 reply.recycle();
5275 }
5276
Craig Mautner5eda9b32013-07-02 11:58:16 -07005277 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5278 Parcel data = Parcel.obtain();
5279 Parcel reply = Parcel.obtain();
5280 data.writeInterfaceToken(IActivityManager.descriptor);
5281 data.writeStrongBinder(token);
5282 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5283 reply.readException();
5284 data.recycle();
5285 reply.recycle();
5286 }
5287
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005288 public void restart() throws RemoteException {
5289 Parcel data = Parcel.obtain();
5290 Parcel reply = Parcel.obtain();
5291 data.writeInterfaceToken(IActivityManager.descriptor);
5292 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5293 reply.readException();
5294 data.recycle();
5295 reply.recycle();
5296 }
5297
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005298 public void performIdleMaintenance() throws RemoteException {
5299 Parcel data = Parcel.obtain();
5300 Parcel reply = Parcel.obtain();
5301 data.writeInterfaceToken(IActivityManager.descriptor);
5302 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5303 reply.readException();
5304 data.recycle();
5305 reply.recycle();
5306 }
5307
Todd Kennedyca4d8422015-01-15 15:19:22 -08005308 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005309 IActivityContainerCallback callback) throws RemoteException {
5310 Parcel data = Parcel.obtain();
5311 Parcel reply = Parcel.obtain();
5312 data.writeInterfaceToken(IActivityManager.descriptor);
5313 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005314 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005315 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005316 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005317 final int result = reply.readInt();
5318 final IActivityContainer res;
5319 if (result == 1) {
5320 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5321 } else {
5322 res = null;
5323 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005324 data.recycle();
5325 reply.recycle();
5326 return res;
5327 }
5328
Craig Mautner95da1082014-02-24 17:54:35 -08005329 public void deleteActivityContainer(IActivityContainer activityContainer)
5330 throws RemoteException {
5331 Parcel data = Parcel.obtain();
5332 Parcel reply = Parcel.obtain();
5333 data.writeInterfaceToken(IActivityManager.descriptor);
5334 data.writeStrongBinder(activityContainer.asBinder());
5335 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5336 reply.readException();
5337 data.recycle();
5338 reply.recycle();
5339 }
5340
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005341 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005342 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5343 Parcel data = Parcel.obtain();
5344 Parcel reply = Parcel.obtain();
5345 data.writeInterfaceToken(IActivityManager.descriptor);
5346 data.writeInt(displayId);
5347 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5348 reply.readException();
5349 final int result = reply.readInt();
5350 final IActivityContainer res;
5351 if (result == 1) {
5352 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5353 } else {
5354 res = null;
5355 }
5356 data.recycle();
5357 reply.recycle();
5358 return res;
5359 }
5360
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005361 @Override
5362 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005363 throws RemoteException {
5364 Parcel data = Parcel.obtain();
5365 Parcel reply = Parcel.obtain();
5366 data.writeInterfaceToken(IActivityManager.descriptor);
5367 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005368 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005369 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005370 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005371 data.recycle();
5372 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005373 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005374 }
5375
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005376 @Override
Craig Mautner4a1cb222013-12-04 16:14:06 -08005377 public IBinder getHomeActivityToken() throws RemoteException {
5378 Parcel data = Parcel.obtain();
5379 Parcel reply = Parcel.obtain();
5380 data.writeInterfaceToken(IActivityManager.descriptor);
5381 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5382 reply.readException();
5383 IBinder res = reply.readStrongBinder();
5384 data.recycle();
5385 reply.recycle();
5386 return res;
5387 }
5388
Craig Mautneraea74a52014-03-08 14:23:10 -08005389 @Override
5390 public void startLockTaskMode(int taskId) throws RemoteException {
5391 Parcel data = Parcel.obtain();
5392 Parcel reply = Parcel.obtain();
5393 data.writeInterfaceToken(IActivityManager.descriptor);
5394 data.writeInt(taskId);
5395 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5396 reply.readException();
5397 data.recycle();
5398 reply.recycle();
5399 }
5400
5401 @Override
5402 public void startLockTaskMode(IBinder token) throws RemoteException {
5403 Parcel data = Parcel.obtain();
5404 Parcel reply = Parcel.obtain();
5405 data.writeInterfaceToken(IActivityManager.descriptor);
5406 data.writeStrongBinder(token);
5407 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5408 reply.readException();
5409 data.recycle();
5410 reply.recycle();
5411 }
5412
5413 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005414 public void startLockTaskModeOnCurrent() throws RemoteException {
5415 Parcel data = Parcel.obtain();
5416 Parcel reply = Parcel.obtain();
5417 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005418 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005419 reply.readException();
5420 data.recycle();
5421 reply.recycle();
5422 }
5423
5424 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005425 public void stopLockTaskMode() throws RemoteException {
5426 Parcel data = Parcel.obtain();
5427 Parcel reply = Parcel.obtain();
5428 data.writeInterfaceToken(IActivityManager.descriptor);
5429 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5430 reply.readException();
5431 data.recycle();
5432 reply.recycle();
5433 }
5434
5435 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005436 public void stopLockTaskModeOnCurrent() throws RemoteException {
5437 Parcel data = Parcel.obtain();
5438 Parcel reply = Parcel.obtain();
5439 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005440 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005441 reply.readException();
5442 data.recycle();
5443 reply.recycle();
5444 }
5445
5446 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005447 public boolean isInLockTaskMode() throws RemoteException {
5448 Parcel data = Parcel.obtain();
5449 Parcel reply = Parcel.obtain();
5450 data.writeInterfaceToken(IActivityManager.descriptor);
5451 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5452 reply.readException();
5453 boolean isInLockTaskMode = reply.readInt() == 1;
5454 data.recycle();
5455 reply.recycle();
5456 return isInLockTaskMode;
5457 }
5458
Craig Mautner688b5102014-03-27 16:55:03 -07005459 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005460 public int getLockTaskModeState() throws RemoteException {
5461 Parcel data = Parcel.obtain();
5462 Parcel reply = Parcel.obtain();
5463 data.writeInterfaceToken(IActivityManager.descriptor);
5464 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5465 reply.readException();
5466 int lockTaskModeState = reply.readInt();
5467 data.recycle();
5468 reply.recycle();
5469 return lockTaskModeState;
5470 }
5471
5472 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005473 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005474 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005475 Parcel data = Parcel.obtain();
5476 Parcel reply = Parcel.obtain();
5477 data.writeInterfaceToken(IActivityManager.descriptor);
5478 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005479 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005480 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005481 reply.readException();
5482 data.recycle();
5483 reply.recycle();
5484 }
5485
Craig Mautneree2e45a2014-06-27 12:10:03 -07005486 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005487 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5488 Parcel data = Parcel.obtain();
5489 Parcel reply = Parcel.obtain();
5490 data.writeInterfaceToken(IActivityManager.descriptor);
5491 data.writeInt(taskId);
5492 data.writeInt(resizeable ? 1 : 0);
5493 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5494 reply.readException();
5495 data.recycle();
5496 reply.recycle();
5497 }
5498
5499 @Override
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005500 public void resizeTask(int taskId, Rect r) throws RemoteException
5501 {
5502 Parcel data = Parcel.obtain();
5503 Parcel reply = Parcel.obtain();
5504 data.writeInterfaceToken(IActivityManager.descriptor);
5505 data.writeInt(taskId);
5506 r.writeToParcel(data, 0);
5507 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5508 reply.readException();
5509 data.recycle();
5510 reply.recycle();
5511 }
5512
5513 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005514 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5515 Parcel data = Parcel.obtain();
5516 Parcel reply = Parcel.obtain();
5517 data.writeInterfaceToken(IActivityManager.descriptor);
5518 data.writeString(filename);
5519 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5520 reply.readException();
5521 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5522 data.recycle();
5523 reply.recycle();
5524 return icon;
5525 }
5526
5527 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005528 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5529 throws RemoteException {
5530 Parcel data = Parcel.obtain();
5531 Parcel reply = Parcel.obtain();
5532 data.writeInterfaceToken(IActivityManager.descriptor);
5533 if (options == null) {
5534 data.writeInt(0);
5535 } else {
5536 data.writeInt(1);
5537 data.writeBundle(options.toBundle());
5538 }
5539 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5540 reply.readException();
5541 data.recycle();
5542 reply.recycle();
5543 }
5544
5545 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005546 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005547 Parcel data = Parcel.obtain();
5548 Parcel reply = Parcel.obtain();
5549 data.writeInterfaceToken(IActivityManager.descriptor);
5550 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005551 data.writeInt(visible ? 1 : 0);
5552 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005553 reply.readException();
5554 boolean success = reply.readInt() > 0;
5555 data.recycle();
5556 reply.recycle();
5557 return success;
5558 }
5559
5560 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005561 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005562 Parcel data = Parcel.obtain();
5563 Parcel reply = Parcel.obtain();
5564 data.writeInterfaceToken(IActivityManager.descriptor);
5565 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005566 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005567 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005568 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005569 data.recycle();
5570 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005571 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005572 }
5573
5574 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005575 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005576 Parcel data = Parcel.obtain();
5577 Parcel reply = Parcel.obtain();
5578 data.writeInterfaceToken(IActivityManager.descriptor);
5579 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005580 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5581 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005582 reply.readException();
5583 data.recycle();
5584 reply.recycle();
5585 }
5586
5587 @Override
5588 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5589 Parcel data = Parcel.obtain();
5590 Parcel reply = Parcel.obtain();
5591 data.writeInterfaceToken(IActivityManager.descriptor);
5592 data.writeStrongBinder(token);
5593 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5594 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005595 reply.readException();
5596 data.recycle();
5597 reply.recycle();
5598 }
5599
Craig Mautner8746a472014-07-24 15:12:54 -07005600 @Override
5601 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5602 Parcel data = Parcel.obtain();
5603 Parcel reply = Parcel.obtain();
5604 data.writeInterfaceToken(IActivityManager.descriptor);
5605 data.writeStrongBinder(token);
5606 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5607 IBinder.FLAG_ONEWAY);
5608 reply.readException();
5609 data.recycle();
5610 reply.recycle();
5611 }
5612
Craig Mautner6e2f3952014-09-09 14:26:41 -07005613 @Override
5614 public void bootAnimationComplete() throws RemoteException {
5615 Parcel data = Parcel.obtain();
5616 Parcel reply = Parcel.obtain();
5617 data.writeInterfaceToken(IActivityManager.descriptor);
5618 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5619 reply.readException();
5620 data.recycle();
5621 reply.recycle();
5622 }
5623
Wale Ogunwale18795a22014-12-03 11:38:33 -08005624 @Override
5625 public void systemBackupRestored() throws RemoteException {
5626 Parcel data = Parcel.obtain();
5627 Parcel reply = Parcel.obtain();
5628 data.writeInterfaceToken(IActivityManager.descriptor);
5629 mRemote.transact(SYSTEM_BACKUP_RESTORED, data, reply, 0);
5630 reply.readException();
5631 data.recycle();
5632 reply.recycle();
5633 }
5634
Jeff Sharkeyc2ae6fb2015-01-15 21:27:13 -08005635 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005636 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5637 Parcel data = Parcel.obtain();
5638 Parcel reply = Parcel.obtain();
5639 data.writeInterfaceToken(IActivityManager.descriptor);
5640 data.writeInt(uid);
5641 data.writeByteArray(firstPacket);
5642 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5643 reply.readException();
5644 data.recycle();
5645 reply.recycle();
5646 }
5647
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005648 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005649 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
5650 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005651 Parcel data = Parcel.obtain();
5652 Parcel reply = Parcel.obtain();
5653 data.writeInterfaceToken(IActivityManager.descriptor);
5654 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005655 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005656 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005657 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005658 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
5659 reply.readException();
5660 data.recycle();
5661 reply.recycle();
5662 }
5663
5664 @Override
5665 public void dumpHeapFinished(String path) throws RemoteException {
5666 Parcel data = Parcel.obtain();
5667 Parcel reply = Parcel.obtain();
5668 data.writeInterfaceToken(IActivityManager.descriptor);
5669 data.writeString(path);
5670 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
5671 reply.readException();
5672 data.recycle();
5673 reply.recycle();
5674 }
5675
Dianne Hackborn3d07c942015-03-13 18:02:54 -07005676 @Override
5677 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
5678 throws RemoteException {
5679 Parcel data = Parcel.obtain();
5680 Parcel reply = Parcel.obtain();
5681 data.writeInterfaceToken(IActivityManager.descriptor);
5682 data.writeStrongBinder(session.asBinder());
5683 data.writeInt(keepAwake ? 1 : 0);
5684 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
5685 reply.readException();
5686 data.recycle();
5687 reply.recycle();
5688 }
5689
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005690 private IBinder mRemote;
5691}