blob: 1484af8aa69100606251cdf01be7828af3737b73 [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();
2430 long maxMemSize = data.readLong();
2431 setDumpHeapDebugLimit(procName, maxMemSize);
2432 reply.writeNoException();
2433 return true;
2434 }
2435
2436 case DUMP_HEAP_FINISHED_TRANSACTION: {
2437 data.enforceInterface(IActivityManager.descriptor);
2438 String path = data.readString();
2439 dumpHeapFinished(path);
2440 reply.writeNoException();
2441 return true;
2442 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002443
2444 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2445 data.enforceInterface(IActivityManager.descriptor);
2446 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2447 data.readStrongBinder());
2448 boolean keepAwake = data.readInt() != 0;
2449 setVoiceKeepAwake(session, keepAwake);
2450 reply.writeNoException();
2451 return true;
2452 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002453 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002454
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002455 return super.onTransact(code, data, reply, flags);
2456 }
2457
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002458 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002459 return this;
2460 }
2461
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002462 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2463 protected IActivityManager create() {
2464 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002465 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002466 Log.v("ActivityManager", "default service binder = " + b);
2467 }
2468 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002469 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002470 Log.v("ActivityManager", "default service = " + am);
2471 }
2472 return am;
2473 }
2474 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002475}
2476
2477class ActivityManagerProxy implements IActivityManager
2478{
2479 public ActivityManagerProxy(IBinder remote)
2480 {
2481 mRemote = remote;
2482 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002483
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002484 public IBinder asBinder()
2485 {
2486 return mRemote;
2487 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002488
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002489 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002490 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002491 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002492 Parcel data = Parcel.obtain();
2493 Parcel reply = Parcel.obtain();
2494 data.writeInterfaceToken(IActivityManager.descriptor);
2495 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002496 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002497 intent.writeToParcel(data, 0);
2498 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002499 data.writeStrongBinder(resultTo);
2500 data.writeString(resultWho);
2501 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002502 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002503 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002504 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002505 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002506 } else {
2507 data.writeInt(0);
2508 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002509 if (options != null) {
2510 data.writeInt(1);
2511 options.writeToParcel(data, 0);
2512 } else {
2513 data.writeInt(0);
2514 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002515 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2516 reply.readException();
2517 int result = reply.readInt();
2518 reply.recycle();
2519 data.recycle();
2520 return result;
2521 }
Amith Yamasani82644082012-08-03 13:09:11 -07002522
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002523 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002524 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002525 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2526 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002527 Parcel data = Parcel.obtain();
2528 Parcel reply = Parcel.obtain();
2529 data.writeInterfaceToken(IActivityManager.descriptor);
2530 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002531 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002532 intent.writeToParcel(data, 0);
2533 data.writeString(resolvedType);
2534 data.writeStrongBinder(resultTo);
2535 data.writeString(resultWho);
2536 data.writeInt(requestCode);
2537 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002538 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002539 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002540 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002541 } else {
2542 data.writeInt(0);
2543 }
2544 if (options != null) {
2545 data.writeInt(1);
2546 options.writeToParcel(data, 0);
2547 } else {
2548 data.writeInt(0);
2549 }
2550 data.writeInt(userId);
2551 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2552 reply.readException();
2553 int result = reply.readInt();
2554 reply.recycle();
2555 data.recycle();
2556 return result;
2557 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002558 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2559 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Sharkey97978802014-10-14 10:48:18 -07002560 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002561 Parcel data = Parcel.obtain();
2562 Parcel reply = Parcel.obtain();
2563 data.writeInterfaceToken(IActivityManager.descriptor);
2564 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2565 data.writeString(callingPackage);
2566 intent.writeToParcel(data, 0);
2567 data.writeString(resolvedType);
2568 data.writeStrongBinder(resultTo);
2569 data.writeString(resultWho);
2570 data.writeInt(requestCode);
2571 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002572 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002573 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002574 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002575 } else {
2576 data.writeInt(0);
2577 }
2578 if (options != null) {
2579 data.writeInt(1);
2580 options.writeToParcel(data, 0);
2581 } else {
2582 data.writeInt(0);
2583 }
Jeff Sharkey97978802014-10-14 10:48:18 -07002584 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002585 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2586 reply.readException();
2587 int result = reply.readInt();
2588 reply.recycle();
2589 data.recycle();
2590 return result;
2591 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002592 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2593 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002594 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2595 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002596 Parcel data = Parcel.obtain();
2597 Parcel reply = Parcel.obtain();
2598 data.writeInterfaceToken(IActivityManager.descriptor);
2599 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002600 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002601 intent.writeToParcel(data, 0);
2602 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002603 data.writeStrongBinder(resultTo);
2604 data.writeString(resultWho);
2605 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002606 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002607 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002608 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002609 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002610 } else {
2611 data.writeInt(0);
2612 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002613 if (options != null) {
2614 data.writeInt(1);
2615 options.writeToParcel(data, 0);
2616 } else {
2617 data.writeInt(0);
2618 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002619 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002620 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2621 reply.readException();
2622 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2623 reply.recycle();
2624 data.recycle();
2625 return result;
2626 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002627 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2628 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002629 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002630 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002631 Parcel data = Parcel.obtain();
2632 Parcel reply = Parcel.obtain();
2633 data.writeInterfaceToken(IActivityManager.descriptor);
2634 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002635 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002636 intent.writeToParcel(data, 0);
2637 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002638 data.writeStrongBinder(resultTo);
2639 data.writeString(resultWho);
2640 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002641 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002642 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002643 if (options != null) {
2644 data.writeInt(1);
2645 options.writeToParcel(data, 0);
2646 } else {
2647 data.writeInt(0);
2648 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002649 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002650 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2651 reply.readException();
2652 int result = reply.readInt();
2653 reply.recycle();
2654 data.recycle();
2655 return result;
2656 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002657 public int startActivityIntentSender(IApplicationThread caller,
2658 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002659 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002660 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002661 Parcel data = Parcel.obtain();
2662 Parcel reply = Parcel.obtain();
2663 data.writeInterfaceToken(IActivityManager.descriptor);
2664 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2665 intent.writeToParcel(data, 0);
2666 if (fillInIntent != null) {
2667 data.writeInt(1);
2668 fillInIntent.writeToParcel(data, 0);
2669 } else {
2670 data.writeInt(0);
2671 }
2672 data.writeString(resolvedType);
2673 data.writeStrongBinder(resultTo);
2674 data.writeString(resultWho);
2675 data.writeInt(requestCode);
2676 data.writeInt(flagsMask);
2677 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002678 if (options != null) {
2679 data.writeInt(1);
2680 options.writeToParcel(data, 0);
2681 } else {
2682 data.writeInt(0);
2683 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002684 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002685 reply.readException();
2686 int result = reply.readInt();
2687 reply.recycle();
2688 data.recycle();
2689 return result;
2690 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002691 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2692 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002693 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2694 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002695 Parcel data = Parcel.obtain();
2696 Parcel reply = Parcel.obtain();
2697 data.writeInterfaceToken(IActivityManager.descriptor);
2698 data.writeString(callingPackage);
2699 data.writeInt(callingPid);
2700 data.writeInt(callingUid);
2701 intent.writeToParcel(data, 0);
2702 data.writeString(resolvedType);
2703 data.writeStrongBinder(session.asBinder());
2704 data.writeStrongBinder(interactor.asBinder());
2705 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002706 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002707 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002708 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002709 } else {
2710 data.writeInt(0);
2711 }
2712 if (options != null) {
2713 data.writeInt(1);
2714 options.writeToParcel(data, 0);
2715 } else {
2716 data.writeInt(0);
2717 }
2718 data.writeInt(userId);
2719 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2720 reply.readException();
2721 int result = reply.readInt();
2722 reply.recycle();
2723 data.recycle();
2724 return result;
2725 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002726 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002727 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002728 Parcel data = Parcel.obtain();
2729 Parcel reply = Parcel.obtain();
2730 data.writeInterfaceToken(IActivityManager.descriptor);
2731 data.writeStrongBinder(callingActivity);
2732 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002733 if (options != null) {
2734 data.writeInt(1);
2735 options.writeToParcel(data, 0);
2736 } else {
2737 data.writeInt(0);
2738 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002739 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2740 reply.readException();
2741 int result = reply.readInt();
2742 reply.recycle();
2743 data.recycle();
2744 return result != 0;
2745 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002746 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2747 Parcel data = Parcel.obtain();
2748 Parcel reply = Parcel.obtain();
2749 data.writeInterfaceToken(IActivityManager.descriptor);
2750 data.writeInt(taskId);
2751 if (options == null) {
2752 data.writeInt(0);
2753 } else {
2754 data.writeInt(1);
2755 options.writeToParcel(data, 0);
2756 }
2757 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2758 reply.readException();
2759 int result = reply.readInt();
2760 reply.recycle();
2761 data.recycle();
2762 return result;
2763 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002764 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002765 throws RemoteException {
2766 Parcel data = Parcel.obtain();
2767 Parcel reply = Parcel.obtain();
2768 data.writeInterfaceToken(IActivityManager.descriptor);
2769 data.writeStrongBinder(token);
2770 data.writeInt(resultCode);
2771 if (resultData != null) {
2772 data.writeInt(1);
2773 resultData.writeToParcel(data, 0);
2774 } else {
2775 data.writeInt(0);
2776 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002777 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002778 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2779 reply.readException();
2780 boolean res = reply.readInt() != 0;
2781 data.recycle();
2782 reply.recycle();
2783 return res;
2784 }
2785 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2786 {
2787 Parcel data = Parcel.obtain();
2788 Parcel reply = Parcel.obtain();
2789 data.writeInterfaceToken(IActivityManager.descriptor);
2790 data.writeStrongBinder(token);
2791 data.writeString(resultWho);
2792 data.writeInt(requestCode);
2793 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2794 reply.readException();
2795 data.recycle();
2796 reply.recycle();
2797 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002798 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2799 Parcel data = Parcel.obtain();
2800 Parcel reply = Parcel.obtain();
2801 data.writeInterfaceToken(IActivityManager.descriptor);
2802 data.writeStrongBinder(token);
2803 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2804 reply.readException();
2805 boolean res = reply.readInt() != 0;
2806 data.recycle();
2807 reply.recycle();
2808 return res;
2809 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002810 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2811 Parcel data = Parcel.obtain();
2812 Parcel reply = Parcel.obtain();
2813 data.writeInterfaceToken(IActivityManager.descriptor);
2814 data.writeStrongBinder(session.asBinder());
2815 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2816 reply.readException();
2817 data.recycle();
2818 reply.recycle();
2819 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002820 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2821 Parcel data = Parcel.obtain();
2822 Parcel reply = Parcel.obtain();
2823 data.writeInterfaceToken(IActivityManager.descriptor);
2824 data.writeStrongBinder(token);
2825 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2826 reply.readException();
2827 boolean res = reply.readInt() != 0;
2828 data.recycle();
2829 reply.recycle();
2830 return res;
2831 }
2832 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2833 Parcel data = Parcel.obtain();
2834 Parcel reply = Parcel.obtain();
2835 data.writeInterfaceToken(IActivityManager.descriptor);
2836 data.writeStrongBinder(app.asBinder());
2837 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2838 reply.readException();
2839 data.recycle();
2840 reply.recycle();
2841 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002842 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2843 Parcel data = Parcel.obtain();
2844 Parcel reply = Parcel.obtain();
2845 data.writeInterfaceToken(IActivityManager.descriptor);
2846 data.writeStrongBinder(token);
2847 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2848 reply.readException();
2849 boolean res = reply.readInt() != 0;
2850 data.recycle();
2851 reply.recycle();
2852 return res;
2853 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002854 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002855 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002856 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002857 {
2858 Parcel data = Parcel.obtain();
2859 Parcel reply = Parcel.obtain();
2860 data.writeInterfaceToken(IActivityManager.descriptor);
2861 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002862 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002863 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2864 filter.writeToParcel(data, 0);
2865 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002866 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002867 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2868 reply.readException();
2869 Intent intent = null;
2870 int haveIntent = reply.readInt();
2871 if (haveIntent != 0) {
2872 intent = Intent.CREATOR.createFromParcel(reply);
2873 }
2874 reply.recycle();
2875 data.recycle();
2876 return intent;
2877 }
2878 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2879 {
2880 Parcel data = Parcel.obtain();
2881 Parcel reply = Parcel.obtain();
2882 data.writeInterfaceToken(IActivityManager.descriptor);
2883 data.writeStrongBinder(receiver.asBinder());
2884 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2885 reply.readException();
2886 data.recycle();
2887 reply.recycle();
2888 }
2889 public int broadcastIntent(IApplicationThread caller,
2890 Intent intent, String resolvedType, IIntentReceiver resultTo,
2891 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002892 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002893 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002894 {
2895 Parcel data = Parcel.obtain();
2896 Parcel reply = Parcel.obtain();
2897 data.writeInterfaceToken(IActivityManager.descriptor);
2898 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2899 intent.writeToParcel(data, 0);
2900 data.writeString(resolvedType);
2901 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2902 data.writeInt(resultCode);
2903 data.writeString(resultData);
2904 data.writeBundle(map);
2905 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002906 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002907 data.writeInt(serialized ? 1 : 0);
2908 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002909 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002910 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2911 reply.readException();
2912 int res = reply.readInt();
2913 reply.recycle();
2914 data.recycle();
2915 return res;
2916 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002917 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2918 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002919 {
2920 Parcel data = Parcel.obtain();
2921 Parcel reply = Parcel.obtain();
2922 data.writeInterfaceToken(IActivityManager.descriptor);
2923 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2924 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002925 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002926 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2927 reply.readException();
2928 data.recycle();
2929 reply.recycle();
2930 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002931 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
2932 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002933 {
2934 Parcel data = Parcel.obtain();
2935 Parcel reply = Parcel.obtain();
2936 data.writeInterfaceToken(IActivityManager.descriptor);
2937 data.writeStrongBinder(who);
2938 data.writeInt(resultCode);
2939 data.writeString(resultData);
2940 data.writeBundle(map);
2941 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08002942 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002943 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2944 reply.readException();
2945 data.recycle();
2946 reply.recycle();
2947 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002948 public void attachApplication(IApplicationThread app) throws RemoteException
2949 {
2950 Parcel data = Parcel.obtain();
2951 Parcel reply = Parcel.obtain();
2952 data.writeInterfaceToken(IActivityManager.descriptor);
2953 data.writeStrongBinder(app.asBinder());
2954 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2955 reply.readException();
2956 data.recycle();
2957 reply.recycle();
2958 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002959 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2960 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002961 {
2962 Parcel data = Parcel.obtain();
2963 Parcel reply = Parcel.obtain();
2964 data.writeInterfaceToken(IActivityManager.descriptor);
2965 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002966 if (config != null) {
2967 data.writeInt(1);
2968 config.writeToParcel(data, 0);
2969 } else {
2970 data.writeInt(0);
2971 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002972 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002973 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2974 reply.readException();
2975 data.recycle();
2976 reply.recycle();
2977 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002978 public void activityResumed(IBinder token) throws RemoteException
2979 {
2980 Parcel data = Parcel.obtain();
2981 Parcel reply = Parcel.obtain();
2982 data.writeInterfaceToken(IActivityManager.descriptor);
2983 data.writeStrongBinder(token);
2984 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2985 reply.readException();
2986 data.recycle();
2987 reply.recycle();
2988 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07002989 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002990 {
2991 Parcel data = Parcel.obtain();
2992 Parcel reply = Parcel.obtain();
2993 data.writeInterfaceToken(IActivityManager.descriptor);
2994 data.writeStrongBinder(token);
2995 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2996 reply.readException();
2997 data.recycle();
2998 reply.recycle();
2999 }
3000 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003001 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003002 {
3003 Parcel data = Parcel.obtain();
3004 Parcel reply = Parcel.obtain();
3005 data.writeInterfaceToken(IActivityManager.descriptor);
3006 data.writeStrongBinder(token);
3007 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003008 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003009 TextUtils.writeToParcel(description, data, 0);
3010 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3011 reply.readException();
3012 data.recycle();
3013 reply.recycle();
3014 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003015 public void activitySlept(IBinder token) throws RemoteException
3016 {
3017 Parcel data = Parcel.obtain();
3018 Parcel reply = Parcel.obtain();
3019 data.writeInterfaceToken(IActivityManager.descriptor);
3020 data.writeStrongBinder(token);
3021 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3022 reply.readException();
3023 data.recycle();
3024 reply.recycle();
3025 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003026 public void activityDestroyed(IBinder token) throws RemoteException
3027 {
3028 Parcel data = Parcel.obtain();
3029 Parcel reply = Parcel.obtain();
3030 data.writeInterfaceToken(IActivityManager.descriptor);
3031 data.writeStrongBinder(token);
3032 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3033 reply.readException();
3034 data.recycle();
3035 reply.recycle();
3036 }
3037 public String getCallingPackage(IBinder token) throws RemoteException
3038 {
3039 Parcel data = Parcel.obtain();
3040 Parcel reply = Parcel.obtain();
3041 data.writeInterfaceToken(IActivityManager.descriptor);
3042 data.writeStrongBinder(token);
3043 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3044 reply.readException();
3045 String res = reply.readString();
3046 data.recycle();
3047 reply.recycle();
3048 return res;
3049 }
3050 public ComponentName getCallingActivity(IBinder token)
3051 throws RemoteException {
3052 Parcel data = Parcel.obtain();
3053 Parcel reply = Parcel.obtain();
3054 data.writeInterfaceToken(IActivityManager.descriptor);
3055 data.writeStrongBinder(token);
3056 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3057 reply.readException();
3058 ComponentName res = ComponentName.readFromParcel(reply);
3059 data.recycle();
3060 reply.recycle();
3061 return res;
3062 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003063 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003064 Parcel data = Parcel.obtain();
3065 Parcel reply = Parcel.obtain();
3066 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003067 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003068 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3069 reply.readException();
3070 ArrayList<IAppTask> list = null;
3071 int N = reply.readInt();
3072 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003073 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003074 while (N > 0) {
3075 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3076 list.add(task);
3077 N--;
3078 }
3079 }
3080 data.recycle();
3081 reply.recycle();
3082 return list;
3083 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003084 public int addAppTask(IBinder activityToken, Intent intent,
3085 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3086 Parcel data = Parcel.obtain();
3087 Parcel reply = Parcel.obtain();
3088 data.writeInterfaceToken(IActivityManager.descriptor);
3089 data.writeStrongBinder(activityToken);
3090 intent.writeToParcel(data, 0);
3091 description.writeToParcel(data, 0);
3092 thumbnail.writeToParcel(data, 0);
3093 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3094 reply.readException();
3095 int res = reply.readInt();
3096 data.recycle();
3097 reply.recycle();
3098 return res;
3099 }
3100 public Point getAppTaskThumbnailSize() throws RemoteException {
3101 Parcel data = Parcel.obtain();
3102 Parcel reply = Parcel.obtain();
3103 data.writeInterfaceToken(IActivityManager.descriptor);
3104 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3105 reply.readException();
3106 Point size = Point.CREATOR.createFromParcel(reply);
3107 data.recycle();
3108 reply.recycle();
3109 return size;
3110 }
Todd Kennedye635f662015-01-20 10:36:49 -08003111 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3112 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003113 Parcel data = Parcel.obtain();
3114 Parcel reply = Parcel.obtain();
3115 data.writeInterfaceToken(IActivityManager.descriptor);
3116 data.writeInt(maxNum);
3117 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003118 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3119 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003120 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003121 int N = reply.readInt();
3122 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003123 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003124 while (N > 0) {
3125 ActivityManager.RunningTaskInfo info =
3126 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003127 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003128 list.add(info);
3129 N--;
3130 }
3131 }
3132 data.recycle();
3133 reply.recycle();
3134 return list;
3135 }
3136 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003137 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003138 Parcel data = Parcel.obtain();
3139 Parcel reply = Parcel.obtain();
3140 data.writeInterfaceToken(IActivityManager.descriptor);
3141 data.writeInt(maxNum);
3142 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003143 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003144 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3145 reply.readException();
3146 ArrayList<ActivityManager.RecentTaskInfo> list
3147 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3148 data.recycle();
3149 reply.recycle();
3150 return list;
3151 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003152 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003153 Parcel data = Parcel.obtain();
3154 Parcel reply = Parcel.obtain();
3155 data.writeInterfaceToken(IActivityManager.descriptor);
3156 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003157 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003158 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003159 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003160 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003161 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003162 }
3163 data.recycle();
3164 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003165 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003166 }
Todd Kennedye635f662015-01-20 10:36:49 -08003167 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3168 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003169 Parcel data = Parcel.obtain();
3170 Parcel reply = Parcel.obtain();
3171 data.writeInterfaceToken(IActivityManager.descriptor);
3172 data.writeInt(maxNum);
3173 data.writeInt(flags);
3174 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3175 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003176 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003177 int N = reply.readInt();
3178 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003179 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003180 while (N > 0) {
3181 ActivityManager.RunningServiceInfo info =
3182 ActivityManager.RunningServiceInfo.CREATOR
3183 .createFromParcel(reply);
3184 list.add(info);
3185 N--;
3186 }
3187 }
3188 data.recycle();
3189 reply.recycle();
3190 return list;
3191 }
3192 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3193 throws RemoteException {
3194 Parcel data = Parcel.obtain();
3195 Parcel reply = Parcel.obtain();
3196 data.writeInterfaceToken(IActivityManager.descriptor);
3197 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3198 reply.readException();
3199 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3200 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3201 data.recycle();
3202 reply.recycle();
3203 return list;
3204 }
3205 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3206 throws RemoteException {
3207 Parcel data = Parcel.obtain();
3208 Parcel reply = Parcel.obtain();
3209 data.writeInterfaceToken(IActivityManager.descriptor);
3210 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3211 reply.readException();
3212 ArrayList<ActivityManager.RunningAppProcessInfo> list
3213 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3214 data.recycle();
3215 reply.recycle();
3216 return list;
3217 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003218 public List<ApplicationInfo> getRunningExternalApplications()
3219 throws RemoteException {
3220 Parcel data = Parcel.obtain();
3221 Parcel reply = Parcel.obtain();
3222 data.writeInterfaceToken(IActivityManager.descriptor);
3223 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3224 reply.readException();
3225 ArrayList<ApplicationInfo> list
3226 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3227 data.recycle();
3228 reply.recycle();
3229 return list;
3230 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003231 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003232 {
3233 Parcel data = Parcel.obtain();
3234 Parcel reply = Parcel.obtain();
3235 data.writeInterfaceToken(IActivityManager.descriptor);
3236 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003237 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003238 if (options != null) {
3239 data.writeInt(1);
3240 options.writeToParcel(data, 0);
3241 } else {
3242 data.writeInt(0);
3243 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003244 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3245 reply.readException();
3246 data.recycle();
3247 reply.recycle();
3248 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003249 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3250 throws RemoteException {
3251 Parcel data = Parcel.obtain();
3252 Parcel reply = Parcel.obtain();
3253 data.writeInterfaceToken(IActivityManager.descriptor);
3254 data.writeStrongBinder(token);
3255 data.writeInt(nonRoot ? 1 : 0);
3256 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3257 reply.readException();
3258 boolean res = reply.readInt() != 0;
3259 data.recycle();
3260 reply.recycle();
3261 return res;
3262 }
3263 public void moveTaskBackwards(int task) throws RemoteException
3264 {
3265 Parcel data = Parcel.obtain();
3266 Parcel reply = Parcel.obtain();
3267 data.writeInterfaceToken(IActivityManager.descriptor);
3268 data.writeInt(task);
3269 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3270 reply.readException();
3271 data.recycle();
3272 reply.recycle();
3273 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003274 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003275 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3276 {
3277 Parcel data = Parcel.obtain();
3278 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003279 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003280 data.writeInt(taskId);
3281 data.writeInt(stackId);
3282 data.writeInt(toTop ? 1 : 0);
3283 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3284 reply.readException();
3285 data.recycle();
3286 reply.recycle();
3287 }
3288 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003289 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003290 {
3291 Parcel data = Parcel.obtain();
3292 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003293 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003294 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003295 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003296 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003297 reply.readException();
3298 data.recycle();
3299 reply.recycle();
3300 }
Craig Mautner967212c2013-04-13 21:10:58 -07003301 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003302 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003303 {
3304 Parcel data = Parcel.obtain();
3305 Parcel reply = Parcel.obtain();
3306 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003307 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003308 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003309 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003310 data.recycle();
3311 reply.recycle();
3312 return list;
3313 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003314 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003315 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003316 {
3317 Parcel data = Parcel.obtain();
3318 Parcel reply = Parcel.obtain();
3319 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003320 data.writeInt(stackId);
3321 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003322 reply.readException();
3323 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003324 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003325 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003326 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003327 }
3328 data.recycle();
3329 reply.recycle();
3330 return info;
3331 }
3332 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003333 public boolean isInHomeStack(int taskId) throws RemoteException {
3334 Parcel data = Parcel.obtain();
3335 Parcel reply = Parcel.obtain();
3336 data.writeInterfaceToken(IActivityManager.descriptor);
3337 data.writeInt(taskId);
3338 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3339 reply.readException();
3340 boolean isInHomeStack = reply.readInt() > 0;
3341 data.recycle();
3342 reply.recycle();
3343 return isInHomeStack;
3344 }
3345 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003346 public void setFocusedStack(int stackId) throws RemoteException
3347 {
3348 Parcel data = Parcel.obtain();
3349 Parcel reply = Parcel.obtain();
3350 data.writeInterfaceToken(IActivityManager.descriptor);
3351 data.writeInt(stackId);
3352 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3353 reply.readException();
3354 data.recycle();
3355 reply.recycle();
3356 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003357 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003358 public int getFocusedStackId() throws RemoteException {
3359 Parcel data = Parcel.obtain();
3360 Parcel reply = Parcel.obtain();
3361 data.writeInterfaceToken(IActivityManager.descriptor);
3362 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3363 reply.readException();
3364 int focusedStackId = reply.readInt();
3365 data.recycle();
3366 reply.recycle();
3367 return focusedStackId;
3368 }
3369 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003370 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3371 {
3372 Parcel data = Parcel.obtain();
3373 Parcel reply = Parcel.obtain();
3374 data.writeInterfaceToken(IActivityManager.descriptor);
3375 data.writeStrongBinder(listener.asBinder());
3376 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3377 reply.readException();
3378 data.recycle();
3379 reply.recycle();
3380 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003381 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3382 {
3383 Parcel data = Parcel.obtain();
3384 Parcel reply = Parcel.obtain();
3385 data.writeInterfaceToken(IActivityManager.descriptor);
3386 data.writeStrongBinder(token);
3387 data.writeInt(onlyRoot ? 1 : 0);
3388 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3389 reply.readException();
3390 int res = reply.readInt();
3391 data.recycle();
3392 reply.recycle();
3393 return res;
3394 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003395 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003396 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003397 Parcel data = Parcel.obtain();
3398 Parcel reply = Parcel.obtain();
3399 data.writeInterfaceToken(IActivityManager.descriptor);
3400 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3401 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003402 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003403 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003404 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3405 reply.readException();
3406 int res = reply.readInt();
3407 ContentProviderHolder cph = null;
3408 if (res != 0) {
3409 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3410 }
3411 data.recycle();
3412 reply.recycle();
3413 return cph;
3414 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003415 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3416 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003417 Parcel data = Parcel.obtain();
3418 Parcel reply = Parcel.obtain();
3419 data.writeInterfaceToken(IActivityManager.descriptor);
3420 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003421 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003422 data.writeStrongBinder(token);
3423 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3424 reply.readException();
3425 int res = reply.readInt();
3426 ContentProviderHolder cph = null;
3427 if (res != 0) {
3428 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3429 }
3430 data.recycle();
3431 reply.recycle();
3432 return cph;
3433 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003434 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003435 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003436 {
3437 Parcel data = Parcel.obtain();
3438 Parcel reply = Parcel.obtain();
3439 data.writeInterfaceToken(IActivityManager.descriptor);
3440 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3441 data.writeTypedList(providers);
3442 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3443 reply.readException();
3444 data.recycle();
3445 reply.recycle();
3446 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003447 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3448 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003449 Parcel data = Parcel.obtain();
3450 Parcel reply = Parcel.obtain();
3451 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003452 data.writeStrongBinder(connection);
3453 data.writeInt(stable);
3454 data.writeInt(unstable);
3455 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3456 reply.readException();
3457 boolean res = reply.readInt() != 0;
3458 data.recycle();
3459 reply.recycle();
3460 return res;
3461 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003462
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003463 public void unstableProviderDied(IBinder connection) throws RemoteException {
3464 Parcel data = Parcel.obtain();
3465 Parcel reply = Parcel.obtain();
3466 data.writeInterfaceToken(IActivityManager.descriptor);
3467 data.writeStrongBinder(connection);
3468 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3469 reply.readException();
3470 data.recycle();
3471 reply.recycle();
3472 }
3473
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003474 @Override
3475 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3476 Parcel data = Parcel.obtain();
3477 Parcel reply = Parcel.obtain();
3478 data.writeInterfaceToken(IActivityManager.descriptor);
3479 data.writeStrongBinder(connection);
3480 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3481 reply.readException();
3482 data.recycle();
3483 reply.recycle();
3484 }
3485
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003486 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3487 Parcel data = Parcel.obtain();
3488 Parcel reply = Parcel.obtain();
3489 data.writeInterfaceToken(IActivityManager.descriptor);
3490 data.writeStrongBinder(connection);
3491 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003492 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3493 reply.readException();
3494 data.recycle();
3495 reply.recycle();
3496 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003497
3498 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3499 Parcel data = Parcel.obtain();
3500 Parcel reply = Parcel.obtain();
3501 data.writeInterfaceToken(IActivityManager.descriptor);
3502 data.writeString(name);
3503 data.writeStrongBinder(token);
3504 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3505 reply.readException();
3506 data.recycle();
3507 reply.recycle();
3508 }
3509
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003510 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3511 throws RemoteException
3512 {
3513 Parcel data = Parcel.obtain();
3514 Parcel reply = Parcel.obtain();
3515 data.writeInterfaceToken(IActivityManager.descriptor);
3516 service.writeToParcel(data, 0);
3517 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3518 reply.readException();
3519 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3520 data.recycle();
3521 reply.recycle();
3522 return res;
3523 }
3524
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003525 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003526 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003527 {
3528 Parcel data = Parcel.obtain();
3529 Parcel reply = Parcel.obtain();
3530 data.writeInterfaceToken(IActivityManager.descriptor);
3531 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3532 service.writeToParcel(data, 0);
3533 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003534 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003535 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3536 reply.readException();
3537 ComponentName res = ComponentName.readFromParcel(reply);
3538 data.recycle();
3539 reply.recycle();
3540 return res;
3541 }
3542 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003543 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003544 {
3545 Parcel data = Parcel.obtain();
3546 Parcel reply = Parcel.obtain();
3547 data.writeInterfaceToken(IActivityManager.descriptor);
3548 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3549 service.writeToParcel(data, 0);
3550 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003551 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003552 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3553 reply.readException();
3554 int res = reply.readInt();
3555 reply.recycle();
3556 data.recycle();
3557 return res;
3558 }
3559 public boolean stopServiceToken(ComponentName className, IBinder token,
3560 int startId) throws RemoteException {
3561 Parcel data = Parcel.obtain();
3562 Parcel reply = Parcel.obtain();
3563 data.writeInterfaceToken(IActivityManager.descriptor);
3564 ComponentName.writeToParcel(className, data);
3565 data.writeStrongBinder(token);
3566 data.writeInt(startId);
3567 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3568 reply.readException();
3569 boolean res = reply.readInt() != 0;
3570 data.recycle();
3571 reply.recycle();
3572 return res;
3573 }
3574 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003575 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003576 Parcel data = Parcel.obtain();
3577 Parcel reply = Parcel.obtain();
3578 data.writeInterfaceToken(IActivityManager.descriptor);
3579 ComponentName.writeToParcel(className, data);
3580 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003581 data.writeInt(id);
3582 if (notification != null) {
3583 data.writeInt(1);
3584 notification.writeToParcel(data, 0);
3585 } else {
3586 data.writeInt(0);
3587 }
3588 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003589 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3590 reply.readException();
3591 data.recycle();
3592 reply.recycle();
3593 }
3594 public int bindService(IApplicationThread caller, IBinder token,
3595 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003596 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003597 Parcel data = Parcel.obtain();
3598 Parcel reply = Parcel.obtain();
3599 data.writeInterfaceToken(IActivityManager.descriptor);
3600 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3601 data.writeStrongBinder(token);
3602 service.writeToParcel(data, 0);
3603 data.writeString(resolvedType);
3604 data.writeStrongBinder(connection.asBinder());
3605 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003606 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003607 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3608 reply.readException();
3609 int res = reply.readInt();
3610 data.recycle();
3611 reply.recycle();
3612 return res;
3613 }
3614 public boolean unbindService(IServiceConnection connection) throws RemoteException
3615 {
3616 Parcel data = Parcel.obtain();
3617 Parcel reply = Parcel.obtain();
3618 data.writeInterfaceToken(IActivityManager.descriptor);
3619 data.writeStrongBinder(connection.asBinder());
3620 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3621 reply.readException();
3622 boolean res = reply.readInt() != 0;
3623 data.recycle();
3624 reply.recycle();
3625 return res;
3626 }
3627
3628 public void publishService(IBinder token,
3629 Intent intent, IBinder service) throws RemoteException {
3630 Parcel data = Parcel.obtain();
3631 Parcel reply = Parcel.obtain();
3632 data.writeInterfaceToken(IActivityManager.descriptor);
3633 data.writeStrongBinder(token);
3634 intent.writeToParcel(data, 0);
3635 data.writeStrongBinder(service);
3636 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3637 reply.readException();
3638 data.recycle();
3639 reply.recycle();
3640 }
3641
3642 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3643 throws RemoteException {
3644 Parcel data = Parcel.obtain();
3645 Parcel reply = Parcel.obtain();
3646 data.writeInterfaceToken(IActivityManager.descriptor);
3647 data.writeStrongBinder(token);
3648 intent.writeToParcel(data, 0);
3649 data.writeInt(doRebind ? 1 : 0);
3650 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3651 reply.readException();
3652 data.recycle();
3653 reply.recycle();
3654 }
3655
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003656 public void serviceDoneExecuting(IBinder token, int type, int startId,
3657 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003658 Parcel data = Parcel.obtain();
3659 Parcel reply = Parcel.obtain();
3660 data.writeInterfaceToken(IActivityManager.descriptor);
3661 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003662 data.writeInt(type);
3663 data.writeInt(startId);
3664 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003665 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3666 reply.readException();
3667 data.recycle();
3668 reply.recycle();
3669 }
3670
3671 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3672 Parcel data = Parcel.obtain();
3673 Parcel reply = Parcel.obtain();
3674 data.writeInterfaceToken(IActivityManager.descriptor);
3675 service.writeToParcel(data, 0);
3676 data.writeString(resolvedType);
3677 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3678 reply.readException();
3679 IBinder binder = reply.readStrongBinder();
3680 reply.recycle();
3681 data.recycle();
3682 return binder;
3683 }
3684
Christopher Tate181fafa2009-05-14 11:12:14 -07003685 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3686 throws RemoteException {
3687 Parcel data = Parcel.obtain();
3688 Parcel reply = Parcel.obtain();
3689 data.writeInterfaceToken(IActivityManager.descriptor);
3690 app.writeToParcel(data, 0);
3691 data.writeInt(backupRestoreMode);
3692 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3693 reply.readException();
3694 boolean success = reply.readInt() != 0;
3695 reply.recycle();
3696 data.recycle();
3697 return success;
3698 }
3699
Christopher Tate346acb12012-10-15 19:20:25 -07003700 public void clearPendingBackup() throws RemoteException {
3701 Parcel data = Parcel.obtain();
3702 Parcel reply = Parcel.obtain();
3703 data.writeInterfaceToken(IActivityManager.descriptor);
3704 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3705 reply.recycle();
3706 data.recycle();
3707 }
3708
Christopher Tate181fafa2009-05-14 11:12:14 -07003709 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3710 Parcel data = Parcel.obtain();
3711 Parcel reply = Parcel.obtain();
3712 data.writeInterfaceToken(IActivityManager.descriptor);
3713 data.writeString(packageName);
3714 data.writeStrongBinder(agent);
3715 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3716 reply.recycle();
3717 data.recycle();
3718 }
3719
3720 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3721 Parcel data = Parcel.obtain();
3722 Parcel reply = Parcel.obtain();
3723 data.writeInterfaceToken(IActivityManager.descriptor);
3724 app.writeToParcel(data, 0);
3725 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3726 reply.readException();
3727 reply.recycle();
3728 data.recycle();
3729 }
3730
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003731 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003732 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003733 IUiAutomationConnection connection, int userId, String instructionSet)
3734 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003735 Parcel data = Parcel.obtain();
3736 Parcel reply = Parcel.obtain();
3737 data.writeInterfaceToken(IActivityManager.descriptor);
3738 ComponentName.writeToParcel(className, data);
3739 data.writeString(profileFile);
3740 data.writeInt(flags);
3741 data.writeBundle(arguments);
3742 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003743 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003744 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003745 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003746 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3747 reply.readException();
3748 boolean res = reply.readInt() != 0;
3749 reply.recycle();
3750 data.recycle();
3751 return res;
3752 }
3753
3754 public void finishInstrumentation(IApplicationThread target,
3755 int resultCode, Bundle results) throws RemoteException {
3756 Parcel data = Parcel.obtain();
3757 Parcel reply = Parcel.obtain();
3758 data.writeInterfaceToken(IActivityManager.descriptor);
3759 data.writeStrongBinder(target != null ? target.asBinder() : null);
3760 data.writeInt(resultCode);
3761 data.writeBundle(results);
3762 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3763 reply.readException();
3764 data.recycle();
3765 reply.recycle();
3766 }
3767 public Configuration getConfiguration() throws RemoteException
3768 {
3769 Parcel data = Parcel.obtain();
3770 Parcel reply = Parcel.obtain();
3771 data.writeInterfaceToken(IActivityManager.descriptor);
3772 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3773 reply.readException();
3774 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3775 reply.recycle();
3776 data.recycle();
3777 return res;
3778 }
3779 public void updateConfiguration(Configuration values) throws RemoteException
3780 {
3781 Parcel data = Parcel.obtain();
3782 Parcel reply = Parcel.obtain();
3783 data.writeInterfaceToken(IActivityManager.descriptor);
3784 values.writeToParcel(data, 0);
3785 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3786 reply.readException();
3787 data.recycle();
3788 reply.recycle();
3789 }
3790 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3791 throws RemoteException {
3792 Parcel data = Parcel.obtain();
3793 Parcel reply = Parcel.obtain();
3794 data.writeInterfaceToken(IActivityManager.descriptor);
3795 data.writeStrongBinder(token);
3796 data.writeInt(requestedOrientation);
3797 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3798 reply.readException();
3799 data.recycle();
3800 reply.recycle();
3801 }
3802 public int getRequestedOrientation(IBinder token) throws RemoteException {
3803 Parcel data = Parcel.obtain();
3804 Parcel reply = Parcel.obtain();
3805 data.writeInterfaceToken(IActivityManager.descriptor);
3806 data.writeStrongBinder(token);
3807 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3808 reply.readException();
3809 int res = reply.readInt();
3810 data.recycle();
3811 reply.recycle();
3812 return res;
3813 }
3814 public ComponentName getActivityClassForToken(IBinder token)
3815 throws RemoteException {
3816 Parcel data = Parcel.obtain();
3817 Parcel reply = Parcel.obtain();
3818 data.writeInterfaceToken(IActivityManager.descriptor);
3819 data.writeStrongBinder(token);
3820 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3821 reply.readException();
3822 ComponentName res = ComponentName.readFromParcel(reply);
3823 data.recycle();
3824 reply.recycle();
3825 return res;
3826 }
3827 public String getPackageForToken(IBinder token) throws RemoteException
3828 {
3829 Parcel data = Parcel.obtain();
3830 Parcel reply = Parcel.obtain();
3831 data.writeInterfaceToken(IActivityManager.descriptor);
3832 data.writeStrongBinder(token);
3833 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3834 reply.readException();
3835 String res = reply.readString();
3836 data.recycle();
3837 reply.recycle();
3838 return res;
3839 }
3840 public IIntentSender getIntentSender(int type,
3841 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003842 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003843 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003844 Parcel data = Parcel.obtain();
3845 Parcel reply = Parcel.obtain();
3846 data.writeInterfaceToken(IActivityManager.descriptor);
3847 data.writeInt(type);
3848 data.writeString(packageName);
3849 data.writeStrongBinder(token);
3850 data.writeString(resultWho);
3851 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003852 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003853 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003854 data.writeTypedArray(intents, 0);
3855 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003856 } else {
3857 data.writeInt(0);
3858 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003859 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003860 if (options != null) {
3861 data.writeInt(1);
3862 options.writeToParcel(data, 0);
3863 } else {
3864 data.writeInt(0);
3865 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003866 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003867 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3868 reply.readException();
3869 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08003870 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003871 data.recycle();
3872 reply.recycle();
3873 return res;
3874 }
3875 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3876 Parcel data = Parcel.obtain();
3877 Parcel reply = Parcel.obtain();
3878 data.writeInterfaceToken(IActivityManager.descriptor);
3879 data.writeStrongBinder(sender.asBinder());
3880 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3881 reply.readException();
3882 data.recycle();
3883 reply.recycle();
3884 }
3885 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3886 Parcel data = Parcel.obtain();
3887 Parcel reply = Parcel.obtain();
3888 data.writeInterfaceToken(IActivityManager.descriptor);
3889 data.writeStrongBinder(sender.asBinder());
3890 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3891 reply.readException();
3892 String res = reply.readString();
3893 data.recycle();
3894 reply.recycle();
3895 return res;
3896 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003897 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3898 Parcel data = Parcel.obtain();
3899 Parcel reply = Parcel.obtain();
3900 data.writeInterfaceToken(IActivityManager.descriptor);
3901 data.writeStrongBinder(sender.asBinder());
3902 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3903 reply.readException();
3904 int res = reply.readInt();
3905 data.recycle();
3906 reply.recycle();
3907 return res;
3908 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003909 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3910 boolean requireFull, String name, String callerPackage) throws RemoteException {
3911 Parcel data = Parcel.obtain();
3912 Parcel reply = Parcel.obtain();
3913 data.writeInterfaceToken(IActivityManager.descriptor);
3914 data.writeInt(callingPid);
3915 data.writeInt(callingUid);
3916 data.writeInt(userId);
3917 data.writeInt(allowAll ? 1 : 0);
3918 data.writeInt(requireFull ? 1 : 0);
3919 data.writeString(name);
3920 data.writeString(callerPackage);
3921 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3922 reply.readException();
3923 int res = reply.readInt();
3924 data.recycle();
3925 reply.recycle();
3926 return res;
3927 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003928 public void setProcessLimit(int max) throws RemoteException
3929 {
3930 Parcel data = Parcel.obtain();
3931 Parcel reply = Parcel.obtain();
3932 data.writeInterfaceToken(IActivityManager.descriptor);
3933 data.writeInt(max);
3934 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3935 reply.readException();
3936 data.recycle();
3937 reply.recycle();
3938 }
3939 public int getProcessLimit() throws RemoteException
3940 {
3941 Parcel data = Parcel.obtain();
3942 Parcel reply = Parcel.obtain();
3943 data.writeInterfaceToken(IActivityManager.descriptor);
3944 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3945 reply.readException();
3946 int res = reply.readInt();
3947 data.recycle();
3948 reply.recycle();
3949 return res;
3950 }
3951 public void setProcessForeground(IBinder token, int pid,
3952 boolean isForeground) throws RemoteException {
3953 Parcel data = Parcel.obtain();
3954 Parcel reply = Parcel.obtain();
3955 data.writeInterfaceToken(IActivityManager.descriptor);
3956 data.writeStrongBinder(token);
3957 data.writeInt(pid);
3958 data.writeInt(isForeground ? 1 : 0);
3959 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3960 reply.readException();
3961 data.recycle();
3962 reply.recycle();
3963 }
3964 public int checkPermission(String permission, int pid, int uid)
3965 throws RemoteException {
3966 Parcel data = Parcel.obtain();
3967 Parcel reply = Parcel.obtain();
3968 data.writeInterfaceToken(IActivityManager.descriptor);
3969 data.writeString(permission);
3970 data.writeInt(pid);
3971 data.writeInt(uid);
3972 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3973 reply.readException();
3974 int res = reply.readInt();
3975 data.recycle();
3976 reply.recycle();
3977 return res;
3978 }
Dianne Hackbornff170242014-11-19 10:59:01 -08003979 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
3980 throws RemoteException {
3981 Parcel data = Parcel.obtain();
3982 Parcel reply = Parcel.obtain();
3983 data.writeInterfaceToken(IActivityManager.descriptor);
3984 data.writeString(permission);
3985 data.writeInt(pid);
3986 data.writeInt(uid);
3987 data.writeStrongBinder(callerToken);
3988 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
3989 reply.readException();
3990 int res = reply.readInt();
3991 data.recycle();
3992 reply.recycle();
3993 return res;
3994 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003995 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003996 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003997 Parcel data = Parcel.obtain();
3998 Parcel reply = Parcel.obtain();
3999 data.writeInterfaceToken(IActivityManager.descriptor);
4000 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004001 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004002 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004003 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4004 reply.readException();
4005 boolean res = reply.readInt() != 0;
4006 data.recycle();
4007 reply.recycle();
4008 return res;
4009 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004010 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4011 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004012 Parcel data = Parcel.obtain();
4013 Parcel reply = Parcel.obtain();
4014 data.writeInterfaceToken(IActivityManager.descriptor);
4015 uri.writeToParcel(data, 0);
4016 data.writeInt(pid);
4017 data.writeInt(uid);
4018 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004019 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004020 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004021 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4022 reply.readException();
4023 int res = reply.readInt();
4024 data.recycle();
4025 reply.recycle();
4026 return res;
4027 }
4028 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004029 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004030 Parcel data = Parcel.obtain();
4031 Parcel reply = Parcel.obtain();
4032 data.writeInterfaceToken(IActivityManager.descriptor);
4033 data.writeStrongBinder(caller.asBinder());
4034 data.writeString(targetPkg);
4035 uri.writeToParcel(data, 0);
4036 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004037 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004038 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4039 reply.readException();
4040 data.recycle();
4041 reply.recycle();
4042 }
4043 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004044 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004045 Parcel data = Parcel.obtain();
4046 Parcel reply = Parcel.obtain();
4047 data.writeInterfaceToken(IActivityManager.descriptor);
4048 data.writeStrongBinder(caller.asBinder());
4049 uri.writeToParcel(data, 0);
4050 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004051 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004052 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4053 reply.readException();
4054 data.recycle();
4055 reply.recycle();
4056 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004057
4058 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004059 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4060 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004061 Parcel data = Parcel.obtain();
4062 Parcel reply = Parcel.obtain();
4063 data.writeInterfaceToken(IActivityManager.descriptor);
4064 uri.writeToParcel(data, 0);
4065 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004066 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004067 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4068 reply.readException();
4069 data.recycle();
4070 reply.recycle();
4071 }
4072
4073 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004074 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4075 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004076 Parcel data = Parcel.obtain();
4077 Parcel reply = Parcel.obtain();
4078 data.writeInterfaceToken(IActivityManager.descriptor);
4079 uri.writeToParcel(data, 0);
4080 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004081 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004082 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4083 reply.readException();
4084 data.recycle();
4085 reply.recycle();
4086 }
4087
4088 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004089 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4090 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004091 Parcel data = Parcel.obtain();
4092 Parcel reply = Parcel.obtain();
4093 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004094 data.writeString(packageName);
4095 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004096 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4097 reply.readException();
4098 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4099 reply);
4100 data.recycle();
4101 reply.recycle();
4102 return perms;
4103 }
4104
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004105 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4106 throws RemoteException {
4107 Parcel data = Parcel.obtain();
4108 Parcel reply = Parcel.obtain();
4109 data.writeInterfaceToken(IActivityManager.descriptor);
4110 data.writeStrongBinder(who.asBinder());
4111 data.writeInt(waiting ? 1 : 0);
4112 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4113 reply.readException();
4114 data.recycle();
4115 reply.recycle();
4116 }
4117 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4118 Parcel data = Parcel.obtain();
4119 Parcel reply = Parcel.obtain();
4120 data.writeInterfaceToken(IActivityManager.descriptor);
4121 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4122 reply.readException();
4123 outInfo.readFromParcel(reply);
4124 data.recycle();
4125 reply.recycle();
4126 }
4127 public void unhandledBack() throws RemoteException
4128 {
4129 Parcel data = Parcel.obtain();
4130 Parcel reply = Parcel.obtain();
4131 data.writeInterfaceToken(IActivityManager.descriptor);
4132 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4133 reply.readException();
4134 data.recycle();
4135 reply.recycle();
4136 }
4137 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4138 {
4139 Parcel data = Parcel.obtain();
4140 Parcel reply = Parcel.obtain();
4141 data.writeInterfaceToken(IActivityManager.descriptor);
4142 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4143 reply.readException();
4144 ParcelFileDescriptor pfd = null;
4145 if (reply.readInt() != 0) {
4146 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4147 }
4148 data.recycle();
4149 reply.recycle();
4150 return pfd;
4151 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004152 public void setLockScreenShown(boolean shown) throws RemoteException
4153 {
4154 Parcel data = Parcel.obtain();
4155 Parcel reply = Parcel.obtain();
4156 data.writeInterfaceToken(IActivityManager.descriptor);
4157 data.writeInt(shown ? 1 : 0);
4158 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4159 reply.readException();
4160 data.recycle();
4161 reply.recycle();
4162 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004163 public void setDebugApp(
4164 String packageName, boolean waitForDebugger, boolean persistent)
4165 throws RemoteException
4166 {
4167 Parcel data = Parcel.obtain();
4168 Parcel reply = Parcel.obtain();
4169 data.writeInterfaceToken(IActivityManager.descriptor);
4170 data.writeString(packageName);
4171 data.writeInt(waitForDebugger ? 1 : 0);
4172 data.writeInt(persistent ? 1 : 0);
4173 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4174 reply.readException();
4175 data.recycle();
4176 reply.recycle();
4177 }
4178 public void setAlwaysFinish(boolean enabled) throws RemoteException
4179 {
4180 Parcel data = Parcel.obtain();
4181 Parcel reply = Parcel.obtain();
4182 data.writeInterfaceToken(IActivityManager.descriptor);
4183 data.writeInt(enabled ? 1 : 0);
4184 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4185 reply.readException();
4186 data.recycle();
4187 reply.recycle();
4188 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004189 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004190 {
4191 Parcel data = Parcel.obtain();
4192 Parcel reply = Parcel.obtain();
4193 data.writeInterfaceToken(IActivityManager.descriptor);
4194 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004195 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004196 reply.readException();
4197 data.recycle();
4198 reply.recycle();
4199 }
4200 public void enterSafeMode() throws RemoteException {
4201 Parcel data = Parcel.obtain();
4202 data.writeInterfaceToken(IActivityManager.descriptor);
4203 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4204 data.recycle();
4205 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08004206 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
4207 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004208 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004209 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004210 data.writeStrongBinder(sender.asBinder());
4211 data.writeInt(sourceUid);
4212 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004213 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4214 data.recycle();
4215 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004216 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004217 Parcel data = Parcel.obtain();
4218 Parcel reply = Parcel.obtain();
4219 data.writeInterfaceToken(IActivityManager.descriptor);
4220 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004221 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004222 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004223 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004224 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004225 boolean res = reply.readInt() != 0;
4226 data.recycle();
4227 reply.recycle();
4228 return res;
4229 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004230 @Override
4231 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4232 Parcel data = Parcel.obtain();
4233 Parcel reply = Parcel.obtain();
4234 data.writeInterfaceToken(IActivityManager.descriptor);
4235 data.writeString(reason);
4236 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4237 boolean res = reply.readInt() != 0;
4238 data.recycle();
4239 reply.recycle();
4240 return res;
4241 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004242 public boolean testIsSystemReady()
4243 {
4244 /* this base class version is never called */
4245 return true;
4246 }
Dan Egnor60d87622009-12-16 16:32:58 -08004247 public void handleApplicationCrash(IBinder app,
4248 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4249 {
4250 Parcel data = Parcel.obtain();
4251 Parcel reply = Parcel.obtain();
4252 data.writeInterfaceToken(IActivityManager.descriptor);
4253 data.writeStrongBinder(app);
4254 crashInfo.writeToParcel(data, 0);
4255 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4256 reply.readException();
4257 reply.recycle();
4258 data.recycle();
4259 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004260
Dianne Hackborn52322712014-08-26 22:47:26 -07004261 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004262 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004263 {
4264 Parcel data = Parcel.obtain();
4265 Parcel reply = Parcel.obtain();
4266 data.writeInterfaceToken(IActivityManager.descriptor);
4267 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004268 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004269 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004270 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004271 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004272 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004273 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004274 reply.recycle();
4275 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004276 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004277 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004278
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004279 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004280 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004281 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004282 {
4283 Parcel data = Parcel.obtain();
4284 Parcel reply = Parcel.obtain();
4285 data.writeInterfaceToken(IActivityManager.descriptor);
4286 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004287 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004288 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004289 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4290 reply.readException();
4291 reply.recycle();
4292 data.recycle();
4293 }
4294
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004295 public void signalPersistentProcesses(int sig) throws RemoteException {
4296 Parcel data = Parcel.obtain();
4297 Parcel reply = Parcel.obtain();
4298 data.writeInterfaceToken(IActivityManager.descriptor);
4299 data.writeInt(sig);
4300 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4301 reply.readException();
4302 data.recycle();
4303 reply.recycle();
4304 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004305
Dianne Hackborn1676c852012-09-10 14:52:30 -07004306 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004307 Parcel data = Parcel.obtain();
4308 Parcel reply = Parcel.obtain();
4309 data.writeInterfaceToken(IActivityManager.descriptor);
4310 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004311 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004312 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4313 reply.readException();
4314 data.recycle();
4315 reply.recycle();
4316 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004317
4318 public void killAllBackgroundProcesses() throws RemoteException {
4319 Parcel data = Parcel.obtain();
4320 Parcel reply = Parcel.obtain();
4321 data.writeInterfaceToken(IActivityManager.descriptor);
4322 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4323 reply.readException();
4324 data.recycle();
4325 reply.recycle();
4326 }
4327
Dianne Hackborn1676c852012-09-10 14:52:30 -07004328 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004329 Parcel data = Parcel.obtain();
4330 Parcel reply = Parcel.obtain();
4331 data.writeInterfaceToken(IActivityManager.descriptor);
4332 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004333 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004334 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004335 reply.readException();
4336 data.recycle();
4337 reply.recycle();
4338 }
4339
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004340 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4341 throws RemoteException
4342 {
4343 Parcel data = Parcel.obtain();
4344 Parcel reply = Parcel.obtain();
4345 data.writeInterfaceToken(IActivityManager.descriptor);
4346 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4347 reply.readException();
4348 outInfo.readFromParcel(reply);
4349 reply.recycle();
4350 data.recycle();
4351 }
4352
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004353 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4354 {
4355 Parcel data = Parcel.obtain();
4356 Parcel reply = Parcel.obtain();
4357 data.writeInterfaceToken(IActivityManager.descriptor);
4358 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4359 reply.readException();
4360 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4361 reply.recycle();
4362 data.recycle();
4363 return res;
4364 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004365
Dianne Hackborn1676c852012-09-10 14:52:30 -07004366 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004367 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004368 {
4369 Parcel data = Parcel.obtain();
4370 Parcel reply = Parcel.obtain();
4371 data.writeInterfaceToken(IActivityManager.descriptor);
4372 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004373 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004374 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004375 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004376 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004377 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004378 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004379 } else {
4380 data.writeInt(0);
4381 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004382 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4383 reply.readException();
4384 boolean res = reply.readInt() != 0;
4385 reply.recycle();
4386 data.recycle();
4387 return res;
4388 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004389
Dianne Hackborn55280a92009-05-07 15:53:46 -07004390 public boolean shutdown(int timeout) throws RemoteException
4391 {
4392 Parcel data = Parcel.obtain();
4393 Parcel reply = Parcel.obtain();
4394 data.writeInterfaceToken(IActivityManager.descriptor);
4395 data.writeInt(timeout);
4396 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4397 reply.readException();
4398 boolean res = reply.readInt() != 0;
4399 reply.recycle();
4400 data.recycle();
4401 return res;
4402 }
4403
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004404 public void stopAppSwitches() throws RemoteException {
4405 Parcel data = Parcel.obtain();
4406 Parcel reply = Parcel.obtain();
4407 data.writeInterfaceToken(IActivityManager.descriptor);
4408 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4409 reply.readException();
4410 reply.recycle();
4411 data.recycle();
4412 }
4413
4414 public void resumeAppSwitches() throws RemoteException {
4415 Parcel data = Parcel.obtain();
4416 Parcel reply = Parcel.obtain();
4417 data.writeInterfaceToken(IActivityManager.descriptor);
4418 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4419 reply.readException();
4420 reply.recycle();
4421 data.recycle();
4422 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004423
4424 public void addPackageDependency(String packageName) throws RemoteException {
4425 Parcel data = Parcel.obtain();
4426 Parcel reply = Parcel.obtain();
4427 data.writeInterfaceToken(IActivityManager.descriptor);
4428 data.writeString(packageName);
4429 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4430 reply.readException();
4431 data.recycle();
4432 reply.recycle();
4433 }
4434
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004435 public void killApplicationWithAppId(String pkg, int appid, String reason)
4436 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004437 Parcel data = Parcel.obtain();
4438 Parcel reply = Parcel.obtain();
4439 data.writeInterfaceToken(IActivityManager.descriptor);
4440 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004441 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004442 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004443 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004444 reply.readException();
4445 data.recycle();
4446 reply.recycle();
4447 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004448
4449 public void closeSystemDialogs(String reason) throws RemoteException {
4450 Parcel data = Parcel.obtain();
4451 Parcel reply = Parcel.obtain();
4452 data.writeInterfaceToken(IActivityManager.descriptor);
4453 data.writeString(reason);
4454 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4455 reply.readException();
4456 data.recycle();
4457 reply.recycle();
4458 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004459
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004460 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004461 throws RemoteException {
4462 Parcel data = Parcel.obtain();
4463 Parcel reply = Parcel.obtain();
4464 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004465 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004466 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4467 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004468 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004469 data.recycle();
4470 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004471 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004472 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004473
4474 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4475 Parcel data = Parcel.obtain();
4476 Parcel reply = Parcel.obtain();
4477 data.writeInterfaceToken(IActivityManager.descriptor);
4478 data.writeString(processName);
4479 data.writeInt(uid);
4480 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4481 reply.readException();
4482 data.recycle();
4483 reply.recycle();
4484 }
4485
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004486 public void overridePendingTransition(IBinder token, String packageName,
4487 int enterAnim, int exitAnim) throws RemoteException {
4488 Parcel data = Parcel.obtain();
4489 Parcel reply = Parcel.obtain();
4490 data.writeInterfaceToken(IActivityManager.descriptor);
4491 data.writeStrongBinder(token);
4492 data.writeString(packageName);
4493 data.writeInt(enterAnim);
4494 data.writeInt(exitAnim);
4495 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4496 reply.readException();
4497 data.recycle();
4498 reply.recycle();
4499 }
4500
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004501 public boolean isUserAMonkey() throws RemoteException {
4502 Parcel data = Parcel.obtain();
4503 Parcel reply = Parcel.obtain();
4504 data.writeInterfaceToken(IActivityManager.descriptor);
4505 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4506 reply.readException();
4507 boolean res = reply.readInt() != 0;
4508 data.recycle();
4509 reply.recycle();
4510 return res;
4511 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004512
4513 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4514 Parcel data = Parcel.obtain();
4515 Parcel reply = Parcel.obtain();
4516 data.writeInterfaceToken(IActivityManager.descriptor);
4517 data.writeInt(monkey ? 1 : 0);
4518 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4519 reply.readException();
4520 data.recycle();
4521 reply.recycle();
4522 }
4523
Dianne Hackborn860755f2010-06-03 18:47:52 -07004524 public void finishHeavyWeightApp() throws RemoteException {
4525 Parcel data = Parcel.obtain();
4526 Parcel reply = Parcel.obtain();
4527 data.writeInterfaceToken(IActivityManager.descriptor);
4528 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4529 reply.readException();
4530 data.recycle();
4531 reply.recycle();
4532 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004533
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004534 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004535 throws RemoteException {
4536 Parcel data = Parcel.obtain();
4537 Parcel reply = Parcel.obtain();
4538 data.writeInterfaceToken(IActivityManager.descriptor);
4539 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004540 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4541 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004542 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004543 data.recycle();
4544 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004545 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004546 }
4547
Craig Mautner233ceee2014-05-09 17:05:11 -07004548 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004549 throws RemoteException {
4550 Parcel data = Parcel.obtain();
4551 Parcel reply = Parcel.obtain();
4552 data.writeInterfaceToken(IActivityManager.descriptor);
4553 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004554 if (options == null) {
4555 data.writeInt(0);
4556 } else {
4557 data.writeInt(1);
4558 data.writeBundle(options.toBundle());
4559 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004560 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004561 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004562 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004563 data.recycle();
4564 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004565 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004566 }
4567
Craig Mautner233ceee2014-05-09 17:05:11 -07004568 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4569 Parcel data = Parcel.obtain();
4570 Parcel reply = Parcel.obtain();
4571 data.writeInterfaceToken(IActivityManager.descriptor);
4572 data.writeStrongBinder(token);
4573 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4574 reply.readException();
4575 Bundle bundle = reply.readBundle();
4576 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4577 data.recycle();
4578 reply.recycle();
4579 return options;
4580 }
4581
Daniel Sandler69a48172010-06-23 16:29:36 -04004582 public void setImmersive(IBinder token, boolean immersive)
4583 throws RemoteException {
4584 Parcel data = Parcel.obtain();
4585 Parcel reply = Parcel.obtain();
4586 data.writeInterfaceToken(IActivityManager.descriptor);
4587 data.writeStrongBinder(token);
4588 data.writeInt(immersive ? 1 : 0);
4589 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4590 reply.readException();
4591 data.recycle();
4592 reply.recycle();
4593 }
4594
4595 public boolean isImmersive(IBinder token)
4596 throws RemoteException {
4597 Parcel data = Parcel.obtain();
4598 Parcel reply = Parcel.obtain();
4599 data.writeInterfaceToken(IActivityManager.descriptor);
4600 data.writeStrongBinder(token);
4601 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004602 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004603 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004604 data.recycle();
4605 reply.recycle();
4606 return res;
4607 }
4608
Craig Mautnerd61dc202014-07-07 11:09:11 -07004609 public boolean isTopOfTask(IBinder token) throws RemoteException {
4610 Parcel data = Parcel.obtain();
4611 Parcel reply = Parcel.obtain();
4612 data.writeInterfaceToken(IActivityManager.descriptor);
4613 data.writeStrongBinder(token);
4614 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4615 reply.readException();
4616 boolean res = reply.readInt() == 1;
4617 data.recycle();
4618 reply.recycle();
4619 return res;
4620 }
4621
Daniel Sandler69a48172010-06-23 16:29:36 -04004622 public boolean isTopActivityImmersive()
4623 throws RemoteException {
4624 Parcel data = Parcel.obtain();
4625 Parcel reply = Parcel.obtain();
4626 data.writeInterfaceToken(IActivityManager.descriptor);
4627 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004628 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004629 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004630 data.recycle();
4631 reply.recycle();
4632 return res;
4633 }
4634
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004635 public void crashApplication(int uid, int initialPid, String packageName,
4636 String message) throws RemoteException {
4637 Parcel data = Parcel.obtain();
4638 Parcel reply = Parcel.obtain();
4639 data.writeInterfaceToken(IActivityManager.descriptor);
4640 data.writeInt(uid);
4641 data.writeInt(initialPid);
4642 data.writeString(packageName);
4643 data.writeString(message);
4644 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4645 reply.readException();
4646 data.recycle();
4647 reply.recycle();
4648 }
Andy McFadden824c5102010-07-09 16:26:57 -07004649
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004650 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004651 Parcel data = Parcel.obtain();
4652 Parcel reply = Parcel.obtain();
4653 data.writeInterfaceToken(IActivityManager.descriptor);
4654 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004655 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004656 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4657 reply.readException();
4658 String res = reply.readString();
4659 data.recycle();
4660 reply.recycle();
4661 return res;
4662 }
4663
Dianne Hackborn7e269642010-08-25 19:50:20 -07004664 public IBinder newUriPermissionOwner(String name)
4665 throws RemoteException {
4666 Parcel data = Parcel.obtain();
4667 Parcel reply = Parcel.obtain();
4668 data.writeInterfaceToken(IActivityManager.descriptor);
4669 data.writeString(name);
4670 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4671 reply.readException();
4672 IBinder res = reply.readStrongBinder();
4673 data.recycle();
4674 reply.recycle();
4675 return res;
4676 }
4677
4678 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004679 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004680 Parcel data = Parcel.obtain();
4681 Parcel reply = Parcel.obtain();
4682 data.writeInterfaceToken(IActivityManager.descriptor);
4683 data.writeStrongBinder(owner);
4684 data.writeInt(fromUid);
4685 data.writeString(targetPkg);
4686 uri.writeToParcel(data, 0);
4687 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004688 data.writeInt(sourceUserId);
4689 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004690 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4691 reply.readException();
4692 data.recycle();
4693 reply.recycle();
4694 }
4695
4696 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004697 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004698 Parcel data = Parcel.obtain();
4699 Parcel reply = Parcel.obtain();
4700 data.writeInterfaceToken(IActivityManager.descriptor);
4701 data.writeStrongBinder(owner);
4702 if (uri != null) {
4703 data.writeInt(1);
4704 uri.writeToParcel(data, 0);
4705 } else {
4706 data.writeInt(0);
4707 }
4708 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004709 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004710 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4711 reply.readException();
4712 data.recycle();
4713 reply.recycle();
4714 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004715
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004716 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004717 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004718 Parcel data = Parcel.obtain();
4719 Parcel reply = Parcel.obtain();
4720 data.writeInterfaceToken(IActivityManager.descriptor);
4721 data.writeInt(callingUid);
4722 data.writeString(targetPkg);
4723 uri.writeToParcel(data, 0);
4724 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004725 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004726 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4727 reply.readException();
4728 int res = reply.readInt();
4729 data.recycle();
4730 reply.recycle();
4731 return res;
4732 }
4733
Dianne Hackborn1676c852012-09-10 14:52:30 -07004734 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004735 String path, ParcelFileDescriptor fd) throws RemoteException {
4736 Parcel data = Parcel.obtain();
4737 Parcel reply = Parcel.obtain();
4738 data.writeInterfaceToken(IActivityManager.descriptor);
4739 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004740 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004741 data.writeInt(managed ? 1 : 0);
4742 data.writeString(path);
4743 if (fd != null) {
4744 data.writeInt(1);
4745 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4746 } else {
4747 data.writeInt(0);
4748 }
4749 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4750 reply.readException();
4751 boolean res = reply.readInt() != 0;
4752 reply.recycle();
4753 data.recycle();
4754 return res;
4755 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004756
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004757 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004758 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004759 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004760 Parcel data = Parcel.obtain();
4761 Parcel reply = Parcel.obtain();
4762 data.writeInterfaceToken(IActivityManager.descriptor);
4763 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004764 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004765 data.writeTypedArray(intents, 0);
4766 data.writeStringArray(resolvedTypes);
4767 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004768 if (options != null) {
4769 data.writeInt(1);
4770 options.writeToParcel(data, 0);
4771 } else {
4772 data.writeInt(0);
4773 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004774 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004775 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4776 reply.readException();
4777 int result = reply.readInt();
4778 reply.recycle();
4779 data.recycle();
4780 return result;
4781 }
4782
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004783 public int getFrontActivityScreenCompatMode() throws RemoteException {
4784 Parcel data = Parcel.obtain();
4785 Parcel reply = Parcel.obtain();
4786 data.writeInterfaceToken(IActivityManager.descriptor);
4787 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4788 reply.readException();
4789 int mode = reply.readInt();
4790 reply.recycle();
4791 data.recycle();
4792 return mode;
4793 }
4794
4795 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4796 Parcel data = Parcel.obtain();
4797 Parcel reply = Parcel.obtain();
4798 data.writeInterfaceToken(IActivityManager.descriptor);
4799 data.writeInt(mode);
4800 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4801 reply.readException();
4802 reply.recycle();
4803 data.recycle();
4804 }
4805
4806 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4807 Parcel data = Parcel.obtain();
4808 Parcel reply = Parcel.obtain();
4809 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004810 data.writeString(packageName);
4811 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004812 reply.readException();
4813 int mode = reply.readInt();
4814 reply.recycle();
4815 data.recycle();
4816 return mode;
4817 }
4818
4819 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004820 throws RemoteException {
4821 Parcel data = Parcel.obtain();
4822 Parcel reply = Parcel.obtain();
4823 data.writeInterfaceToken(IActivityManager.descriptor);
4824 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004825 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004826 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4827 reply.readException();
4828 reply.recycle();
4829 data.recycle();
4830 }
4831
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004832 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4833 Parcel data = Parcel.obtain();
4834 Parcel reply = Parcel.obtain();
4835 data.writeInterfaceToken(IActivityManager.descriptor);
4836 data.writeString(packageName);
4837 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4838 reply.readException();
4839 boolean ask = reply.readInt() != 0;
4840 reply.recycle();
4841 data.recycle();
4842 return ask;
4843 }
4844
4845 public void setPackageAskScreenCompat(String packageName, boolean ask)
4846 throws RemoteException {
4847 Parcel data = Parcel.obtain();
4848 Parcel reply = Parcel.obtain();
4849 data.writeInterfaceToken(IActivityManager.descriptor);
4850 data.writeString(packageName);
4851 data.writeInt(ask ? 1 : 0);
4852 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4853 reply.readException();
4854 reply.recycle();
4855 data.recycle();
4856 }
4857
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004858 public boolean switchUser(int userid) throws RemoteException {
4859 Parcel data = Parcel.obtain();
4860 Parcel reply = Parcel.obtain();
4861 data.writeInterfaceToken(IActivityManager.descriptor);
4862 data.writeInt(userid);
4863 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4864 reply.readException();
4865 boolean result = reply.readInt() != 0;
4866 reply.recycle();
4867 data.recycle();
4868 return result;
4869 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004870
Kenny Guy08488bf2014-02-21 17:40:37 +00004871 public boolean startUserInBackground(int userid) throws RemoteException {
4872 Parcel data = Parcel.obtain();
4873 Parcel reply = Parcel.obtain();
4874 data.writeInterfaceToken(IActivityManager.descriptor);
4875 data.writeInt(userid);
4876 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4877 reply.readException();
4878 boolean result = reply.readInt() != 0;
4879 reply.recycle();
4880 data.recycle();
4881 return result;
4882 }
4883
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004884 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4885 Parcel data = Parcel.obtain();
4886 Parcel reply = Parcel.obtain();
4887 data.writeInterfaceToken(IActivityManager.descriptor);
4888 data.writeInt(userid);
4889 data.writeStrongInterface(callback);
4890 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4891 reply.readException();
4892 int result = reply.readInt();
4893 reply.recycle();
4894 data.recycle();
4895 return result;
4896 }
4897
Amith Yamasani52f1d752012-03-28 18:19:29 -07004898 public UserInfo getCurrentUser() throws RemoteException {
4899 Parcel data = Parcel.obtain();
4900 Parcel reply = Parcel.obtain();
4901 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004902 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004903 reply.readException();
4904 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4905 reply.recycle();
4906 data.recycle();
4907 return userInfo;
4908 }
4909
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004910 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004911 Parcel data = Parcel.obtain();
4912 Parcel reply = Parcel.obtain();
4913 data.writeInterfaceToken(IActivityManager.descriptor);
4914 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004915 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004916 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4917 reply.readException();
4918 boolean result = reply.readInt() != 0;
4919 reply.recycle();
4920 data.recycle();
4921 return result;
4922 }
4923
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004924 public int[] getRunningUserIds() throws RemoteException {
4925 Parcel data = Parcel.obtain();
4926 Parcel reply = Parcel.obtain();
4927 data.writeInterfaceToken(IActivityManager.descriptor);
4928 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4929 reply.readException();
4930 int[] result = reply.createIntArray();
4931 reply.recycle();
4932 data.recycle();
4933 return result;
4934 }
4935
Wale Ogunwaled54b5782014-10-23 15:55:23 -07004936 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004937 Parcel data = Parcel.obtain();
4938 Parcel reply = Parcel.obtain();
4939 data.writeInterfaceToken(IActivityManager.descriptor);
4940 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004941 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4942 reply.readException();
4943 boolean result = reply.readInt() != 0;
4944 reply.recycle();
4945 data.recycle();
4946 return result;
4947 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004948
Jeff Sharkeya4620792011-05-20 15:29:23 -07004949 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4950 Parcel data = Parcel.obtain();
4951 Parcel reply = Parcel.obtain();
4952 data.writeInterfaceToken(IActivityManager.descriptor);
4953 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4954 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4955 reply.readException();
4956 data.recycle();
4957 reply.recycle();
4958 }
4959
4960 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4961 Parcel data = Parcel.obtain();
4962 Parcel reply = Parcel.obtain();
4963 data.writeInterfaceToken(IActivityManager.descriptor);
4964 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4965 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4966 reply.readException();
4967 data.recycle();
4968 reply.recycle();
4969 }
4970
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004971 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4972 Parcel data = Parcel.obtain();
4973 Parcel reply = Parcel.obtain();
4974 data.writeInterfaceToken(IActivityManager.descriptor);
4975 data.writeStrongBinder(sender.asBinder());
4976 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4977 reply.readException();
4978 boolean res = reply.readInt() != 0;
4979 data.recycle();
4980 reply.recycle();
4981 return res;
4982 }
4983
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004984 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4985 Parcel data = Parcel.obtain();
4986 Parcel reply = Parcel.obtain();
4987 data.writeInterfaceToken(IActivityManager.descriptor);
4988 data.writeStrongBinder(sender.asBinder());
4989 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4990 reply.readException();
4991 boolean res = reply.readInt() != 0;
4992 data.recycle();
4993 reply.recycle();
4994 return res;
4995 }
4996
Dianne Hackborn81038902012-11-26 17:04:09 -08004997 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4998 Parcel data = Parcel.obtain();
4999 Parcel reply = Parcel.obtain();
5000 data.writeInterfaceToken(IActivityManager.descriptor);
5001 data.writeStrongBinder(sender.asBinder());
5002 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5003 reply.readException();
5004 Intent res = reply.readInt() != 0
5005 ? Intent.CREATOR.createFromParcel(reply) : null;
5006 data.recycle();
5007 reply.recycle();
5008 return res;
5009 }
5010
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005011 public String getTagForIntentSender(IIntentSender sender, String prefix)
5012 throws RemoteException {
5013 Parcel data = Parcel.obtain();
5014 Parcel reply = Parcel.obtain();
5015 data.writeInterfaceToken(IActivityManager.descriptor);
5016 data.writeStrongBinder(sender.asBinder());
5017 data.writeString(prefix);
5018 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5019 reply.readException();
5020 String res = reply.readString();
5021 data.recycle();
5022 reply.recycle();
5023 return res;
5024 }
5025
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005026 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5027 {
5028 Parcel data = Parcel.obtain();
5029 Parcel reply = Parcel.obtain();
5030 data.writeInterfaceToken(IActivityManager.descriptor);
5031 values.writeToParcel(data, 0);
5032 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5033 reply.readException();
5034 data.recycle();
5035 reply.recycle();
5036 }
5037
Dianne Hackbornb437e092011-08-05 17:50:29 -07005038 public long[] getProcessPss(int[] pids) throws RemoteException {
5039 Parcel data = Parcel.obtain();
5040 Parcel reply = Parcel.obtain();
5041 data.writeInterfaceToken(IActivityManager.descriptor);
5042 data.writeIntArray(pids);
5043 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5044 reply.readException();
5045 long[] res = reply.createLongArray();
5046 data.recycle();
5047 reply.recycle();
5048 return res;
5049 }
5050
Dianne Hackborn661cd522011-08-22 00:26:20 -07005051 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5052 Parcel data = Parcel.obtain();
5053 Parcel reply = Parcel.obtain();
5054 data.writeInterfaceToken(IActivityManager.descriptor);
5055 TextUtils.writeToParcel(msg, data, 0);
5056 data.writeInt(always ? 1 : 0);
5057 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5058 reply.readException();
5059 data.recycle();
5060 reply.recycle();
5061 }
5062
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005063 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005064 Parcel data = Parcel.obtain();
5065 Parcel reply = Parcel.obtain();
5066 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005067 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005068 reply.readException();
5069 data.recycle();
5070 reply.recycle();
5071 }
5072
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005073 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005074 throws RemoteException {
5075 Parcel data = Parcel.obtain();
5076 Parcel reply = Parcel.obtain();
5077 data.writeInterfaceToken(IActivityManager.descriptor);
5078 data.writeStrongBinder(token);
5079 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005080 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005081 reply.readException();
5082 boolean result = reply.readInt() != 0;
5083 data.recycle();
5084 reply.recycle();
5085 return result;
5086 }
5087
5088 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5089 throws RemoteException {
5090 Parcel data = Parcel.obtain();
5091 Parcel reply = Parcel.obtain();
5092 data.writeInterfaceToken(IActivityManager.descriptor);
5093 data.writeStrongBinder(token);
5094 target.writeToParcel(data, 0);
5095 data.writeInt(resultCode);
5096 if (resultData != null) {
5097 data.writeInt(1);
5098 resultData.writeToParcel(data, 0);
5099 } else {
5100 data.writeInt(0);
5101 }
5102 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5103 reply.readException();
5104 boolean result = reply.readInt() != 0;
5105 data.recycle();
5106 reply.recycle();
5107 return result;
5108 }
5109
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005110 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5111 Parcel data = Parcel.obtain();
5112 Parcel reply = Parcel.obtain();
5113 data.writeInterfaceToken(IActivityManager.descriptor);
5114 data.writeStrongBinder(activityToken);
5115 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5116 reply.readException();
5117 int result = reply.readInt();
5118 data.recycle();
5119 reply.recycle();
5120 return result;
5121 }
5122
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005123 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5124 Parcel data = Parcel.obtain();
5125 Parcel reply = Parcel.obtain();
5126 data.writeInterfaceToken(IActivityManager.descriptor);
5127 data.writeStrongBinder(activityToken);
5128 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5129 reply.readException();
5130 String result = reply.readString();
5131 data.recycle();
5132 reply.recycle();
5133 return result;
5134 }
5135
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005136 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5137 Parcel data = Parcel.obtain();
5138 Parcel reply = Parcel.obtain();
5139 data.writeInterfaceToken(IActivityManager.descriptor);
5140 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5141 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5142 reply.readException();
5143 data.recycle();
5144 reply.recycle();
5145 }
5146
5147 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5148 Parcel data = Parcel.obtain();
5149 Parcel reply = Parcel.obtain();
5150 data.writeInterfaceToken(IActivityManager.descriptor);
5151 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5152 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5153 reply.readException();
5154 data.recycle();
5155 reply.recycle();
5156 }
5157
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005158 public void requestBugReport() throws RemoteException {
5159 Parcel data = Parcel.obtain();
5160 Parcel reply = Parcel.obtain();
5161 data.writeInterfaceToken(IActivityManager.descriptor);
5162 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5163 reply.readException();
5164 data.recycle();
5165 reply.recycle();
5166 }
5167
Jeff Brownbd181bb2013-09-10 16:44:24 -07005168 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5169 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005170 Parcel data = Parcel.obtain();
5171 Parcel reply = Parcel.obtain();
5172 data.writeInterfaceToken(IActivityManager.descriptor);
5173 data.writeInt(pid);
5174 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005175 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005176 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5177 reply.readException();
5178 long res = reply.readInt();
5179 data.recycle();
5180 reply.recycle();
5181 return res;
5182 }
5183
Adam Skorydfc7fd72013-08-05 19:23:41 -07005184 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005185 Parcel data = Parcel.obtain();
5186 Parcel reply = Parcel.obtain();
5187 data.writeInterfaceToken(IActivityManager.descriptor);
5188 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005189 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005190 reply.readException();
5191 Bundle res = reply.readBundle();
5192 data.recycle();
5193 reply.recycle();
5194 return res;
5195 }
5196
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005197 public void requestAssistContextExtras(int requestType, IResultReceiver receiver)
5198 throws RemoteException {
5199 Parcel data = Parcel.obtain();
5200 Parcel reply = Parcel.obtain();
5201 data.writeInterfaceToken(IActivityManager.descriptor);
5202 data.writeInt(requestType);
5203 data.writeStrongBinder(receiver.asBinder());
5204 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5205 reply.readException();
5206 data.recycle();
5207 reply.recycle();
5208 }
5209
Adam Skory7140a252013-09-11 12:04:58 +01005210 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07005211 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005212 Parcel data = Parcel.obtain();
5213 Parcel reply = Parcel.obtain();
5214 data.writeInterfaceToken(IActivityManager.descriptor);
5215 data.writeStrongBinder(token);
5216 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005217 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005218 reply.readException();
5219 data.recycle();
5220 reply.recycle();
5221 }
5222
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005223 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle)
5224 throws RemoteException {
5225 Parcel data = Parcel.obtain();
5226 Parcel reply = Parcel.obtain();
5227 data.writeInterfaceToken(IActivityManager.descriptor);
5228 intent.writeToParcel(data, 0);
5229 data.writeInt(requestType);
5230 data.writeString(hint);
5231 data.writeInt(userHandle);
5232 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5233 reply.readException();
5234 boolean res = reply.readInt() != 0;
5235 data.recycle();
5236 reply.recycle();
5237 return res;
5238 }
5239
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005240 public void killUid(int uid, String reason) throws RemoteException {
5241 Parcel data = Parcel.obtain();
5242 Parcel reply = Parcel.obtain();
5243 data.writeInterfaceToken(IActivityManager.descriptor);
5244 data.writeInt(uid);
5245 data.writeString(reason);
5246 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5247 reply.readException();
5248 data.recycle();
5249 reply.recycle();
5250 }
5251
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005252 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5253 Parcel data = Parcel.obtain();
5254 Parcel reply = Parcel.obtain();
5255 data.writeInterfaceToken(IActivityManager.descriptor);
5256 data.writeStrongBinder(who);
5257 data.writeInt(allowRestart ? 1 : 0);
5258 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5259 reply.readException();
5260 data.recycle();
5261 reply.recycle();
5262 }
5263
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005264 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5265 Parcel data = Parcel.obtain();
5266 Parcel reply = Parcel.obtain();
5267 data.writeInterfaceToken(IActivityManager.descriptor);
5268 data.writeStrongBinder(token);
5269 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5270 reply.readException();
5271 data.recycle();
5272 reply.recycle();
5273 }
5274
Craig Mautner5eda9b32013-07-02 11:58:16 -07005275 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5276 Parcel data = Parcel.obtain();
5277 Parcel reply = Parcel.obtain();
5278 data.writeInterfaceToken(IActivityManager.descriptor);
5279 data.writeStrongBinder(token);
5280 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5281 reply.readException();
5282 data.recycle();
5283 reply.recycle();
5284 }
5285
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005286 public void restart() throws RemoteException {
5287 Parcel data = Parcel.obtain();
5288 Parcel reply = Parcel.obtain();
5289 data.writeInterfaceToken(IActivityManager.descriptor);
5290 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5291 reply.readException();
5292 data.recycle();
5293 reply.recycle();
5294 }
5295
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005296 public void performIdleMaintenance() throws RemoteException {
5297 Parcel data = Parcel.obtain();
5298 Parcel reply = Parcel.obtain();
5299 data.writeInterfaceToken(IActivityManager.descriptor);
5300 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5301 reply.readException();
5302 data.recycle();
5303 reply.recycle();
5304 }
5305
Todd Kennedyca4d8422015-01-15 15:19:22 -08005306 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005307 IActivityContainerCallback callback) throws RemoteException {
5308 Parcel data = Parcel.obtain();
5309 Parcel reply = Parcel.obtain();
5310 data.writeInterfaceToken(IActivityManager.descriptor);
5311 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005312 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005313 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005314 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005315 final int result = reply.readInt();
5316 final IActivityContainer res;
5317 if (result == 1) {
5318 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5319 } else {
5320 res = null;
5321 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005322 data.recycle();
5323 reply.recycle();
5324 return res;
5325 }
5326
Craig Mautner95da1082014-02-24 17:54:35 -08005327 public void deleteActivityContainer(IActivityContainer activityContainer)
5328 throws RemoteException {
5329 Parcel data = Parcel.obtain();
5330 Parcel reply = Parcel.obtain();
5331 data.writeInterfaceToken(IActivityManager.descriptor);
5332 data.writeStrongBinder(activityContainer.asBinder());
5333 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5334 reply.readException();
5335 data.recycle();
5336 reply.recycle();
5337 }
5338
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005339 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005340 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5341 Parcel data = Parcel.obtain();
5342 Parcel reply = Parcel.obtain();
5343 data.writeInterfaceToken(IActivityManager.descriptor);
5344 data.writeInt(displayId);
5345 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5346 reply.readException();
5347 final int result = reply.readInt();
5348 final IActivityContainer res;
5349 if (result == 1) {
5350 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5351 } else {
5352 res = null;
5353 }
5354 data.recycle();
5355 reply.recycle();
5356 return res;
5357 }
5358
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005359 @Override
5360 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005361 throws RemoteException {
5362 Parcel data = Parcel.obtain();
5363 Parcel reply = Parcel.obtain();
5364 data.writeInterfaceToken(IActivityManager.descriptor);
5365 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005366 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005367 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005368 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005369 data.recycle();
5370 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005371 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005372 }
5373
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005374 @Override
Craig Mautner4a1cb222013-12-04 16:14:06 -08005375 public IBinder getHomeActivityToken() throws RemoteException {
5376 Parcel data = Parcel.obtain();
5377 Parcel reply = Parcel.obtain();
5378 data.writeInterfaceToken(IActivityManager.descriptor);
5379 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
5380 reply.readException();
5381 IBinder res = reply.readStrongBinder();
5382 data.recycle();
5383 reply.recycle();
5384 return res;
5385 }
5386
Craig Mautneraea74a52014-03-08 14:23:10 -08005387 @Override
5388 public void startLockTaskMode(int taskId) throws RemoteException {
5389 Parcel data = Parcel.obtain();
5390 Parcel reply = Parcel.obtain();
5391 data.writeInterfaceToken(IActivityManager.descriptor);
5392 data.writeInt(taskId);
5393 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5394 reply.readException();
5395 data.recycle();
5396 reply.recycle();
5397 }
5398
5399 @Override
5400 public void startLockTaskMode(IBinder token) throws RemoteException {
5401 Parcel data = Parcel.obtain();
5402 Parcel reply = Parcel.obtain();
5403 data.writeInterfaceToken(IActivityManager.descriptor);
5404 data.writeStrongBinder(token);
5405 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5406 reply.readException();
5407 data.recycle();
5408 reply.recycle();
5409 }
5410
5411 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005412 public void startLockTaskModeOnCurrent() throws RemoteException {
5413 Parcel data = Parcel.obtain();
5414 Parcel reply = Parcel.obtain();
5415 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005416 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005417 reply.readException();
5418 data.recycle();
5419 reply.recycle();
5420 }
5421
5422 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005423 public void stopLockTaskMode() throws RemoteException {
5424 Parcel data = Parcel.obtain();
5425 Parcel reply = Parcel.obtain();
5426 data.writeInterfaceToken(IActivityManager.descriptor);
5427 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5428 reply.readException();
5429 data.recycle();
5430 reply.recycle();
5431 }
5432
5433 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005434 public void stopLockTaskModeOnCurrent() throws RemoteException {
5435 Parcel data = Parcel.obtain();
5436 Parcel reply = Parcel.obtain();
5437 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005438 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005439 reply.readException();
5440 data.recycle();
5441 reply.recycle();
5442 }
5443
5444 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005445 public boolean isInLockTaskMode() throws RemoteException {
5446 Parcel data = Parcel.obtain();
5447 Parcel reply = Parcel.obtain();
5448 data.writeInterfaceToken(IActivityManager.descriptor);
5449 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5450 reply.readException();
5451 boolean isInLockTaskMode = reply.readInt() == 1;
5452 data.recycle();
5453 reply.recycle();
5454 return isInLockTaskMode;
5455 }
5456
Craig Mautner688b5102014-03-27 16:55:03 -07005457 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005458 public int getLockTaskModeState() throws RemoteException {
5459 Parcel data = Parcel.obtain();
5460 Parcel reply = Parcel.obtain();
5461 data.writeInterfaceToken(IActivityManager.descriptor);
5462 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5463 reply.readException();
5464 int lockTaskModeState = reply.readInt();
5465 data.recycle();
5466 reply.recycle();
5467 return lockTaskModeState;
5468 }
5469
5470 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005471 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005472 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005473 Parcel data = Parcel.obtain();
5474 Parcel reply = Parcel.obtain();
5475 data.writeInterfaceToken(IActivityManager.descriptor);
5476 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005477 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005478 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005479 reply.readException();
5480 data.recycle();
5481 reply.recycle();
5482 }
5483
Craig Mautneree2e45a2014-06-27 12:10:03 -07005484 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005485 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5486 Parcel data = Parcel.obtain();
5487 Parcel reply = Parcel.obtain();
5488 data.writeInterfaceToken(IActivityManager.descriptor);
5489 data.writeInt(taskId);
5490 data.writeInt(resizeable ? 1 : 0);
5491 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5492 reply.readException();
5493 data.recycle();
5494 reply.recycle();
5495 }
5496
5497 @Override
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005498 public void resizeTask(int taskId, Rect r) throws RemoteException
5499 {
5500 Parcel data = Parcel.obtain();
5501 Parcel reply = Parcel.obtain();
5502 data.writeInterfaceToken(IActivityManager.descriptor);
5503 data.writeInt(taskId);
5504 r.writeToParcel(data, 0);
5505 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5506 reply.readException();
5507 data.recycle();
5508 reply.recycle();
5509 }
5510
5511 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005512 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5513 Parcel data = Parcel.obtain();
5514 Parcel reply = Parcel.obtain();
5515 data.writeInterfaceToken(IActivityManager.descriptor);
5516 data.writeString(filename);
5517 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5518 reply.readException();
5519 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5520 data.recycle();
5521 reply.recycle();
5522 return icon;
5523 }
5524
5525 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005526 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5527 throws RemoteException {
5528 Parcel data = Parcel.obtain();
5529 Parcel reply = Parcel.obtain();
5530 data.writeInterfaceToken(IActivityManager.descriptor);
5531 if (options == null) {
5532 data.writeInt(0);
5533 } else {
5534 data.writeInt(1);
5535 data.writeBundle(options.toBundle());
5536 }
5537 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
5538 reply.readException();
5539 data.recycle();
5540 reply.recycle();
5541 }
5542
5543 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005544 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005545 Parcel data = Parcel.obtain();
5546 Parcel reply = Parcel.obtain();
5547 data.writeInterfaceToken(IActivityManager.descriptor);
5548 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005549 data.writeInt(visible ? 1 : 0);
5550 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005551 reply.readException();
5552 boolean success = reply.readInt() > 0;
5553 data.recycle();
5554 reply.recycle();
5555 return success;
5556 }
5557
5558 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005559 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005560 Parcel data = Parcel.obtain();
5561 Parcel reply = Parcel.obtain();
5562 data.writeInterfaceToken(IActivityManager.descriptor);
5563 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005564 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005565 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005566 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005567 data.recycle();
5568 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005569 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005570 }
5571
5572 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005573 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005574 Parcel data = Parcel.obtain();
5575 Parcel reply = Parcel.obtain();
5576 data.writeInterfaceToken(IActivityManager.descriptor);
5577 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005578 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply,
5579 IBinder.FLAG_ONEWAY);
Craig Mautnerbb742462014-07-07 15:28:55 -07005580 reply.readException();
5581 data.recycle();
5582 reply.recycle();
5583 }
5584
5585 @Override
5586 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5587 Parcel data = Parcel.obtain();
5588 Parcel reply = Parcel.obtain();
5589 data.writeInterfaceToken(IActivityManager.descriptor);
5590 data.writeStrongBinder(token);
5591 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply,
5592 IBinder.FLAG_ONEWAY);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005593 reply.readException();
5594 data.recycle();
5595 reply.recycle();
5596 }
5597
Craig Mautner8746a472014-07-24 15:12:54 -07005598 @Override
5599 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5600 Parcel data = Parcel.obtain();
5601 Parcel reply = Parcel.obtain();
5602 data.writeInterfaceToken(IActivityManager.descriptor);
5603 data.writeStrongBinder(token);
5604 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply,
5605 IBinder.FLAG_ONEWAY);
5606 reply.readException();
5607 data.recycle();
5608 reply.recycle();
5609 }
5610
Craig Mautner6e2f3952014-09-09 14:26:41 -07005611 @Override
5612 public void bootAnimationComplete() throws RemoteException {
5613 Parcel data = Parcel.obtain();
5614 Parcel reply = Parcel.obtain();
5615 data.writeInterfaceToken(IActivityManager.descriptor);
5616 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5617 reply.readException();
5618 data.recycle();
5619 reply.recycle();
5620 }
5621
Wale Ogunwale18795a22014-12-03 11:38:33 -08005622 @Override
5623 public void systemBackupRestored() throws RemoteException {
5624 Parcel data = Parcel.obtain();
5625 Parcel reply = Parcel.obtain();
5626 data.writeInterfaceToken(IActivityManager.descriptor);
5627 mRemote.transact(SYSTEM_BACKUP_RESTORED, data, reply, 0);
5628 reply.readException();
5629 data.recycle();
5630 reply.recycle();
5631 }
5632
Jeff Sharkeyc2ae6fb2015-01-15 21:27:13 -08005633 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005634 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5635 Parcel data = Parcel.obtain();
5636 Parcel reply = Parcel.obtain();
5637 data.writeInterfaceToken(IActivityManager.descriptor);
5638 data.writeInt(uid);
5639 data.writeByteArray(firstPacket);
5640 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5641 reply.readException();
5642 data.recycle();
5643 reply.recycle();
5644 }
5645
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005646 @Override
5647 public void setDumpHeapDebugLimit(String processName, long maxMemSize) throws RemoteException {
5648 Parcel data = Parcel.obtain();
5649 Parcel reply = Parcel.obtain();
5650 data.writeInterfaceToken(IActivityManager.descriptor);
5651 data.writeString(processName);
5652 data.writeLong(maxMemSize);
5653 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
5654 reply.readException();
5655 data.recycle();
5656 reply.recycle();
5657 }
5658
5659 @Override
5660 public void dumpHeapFinished(String path) throws RemoteException {
5661 Parcel data = Parcel.obtain();
5662 Parcel reply = Parcel.obtain();
5663 data.writeInterfaceToken(IActivityManager.descriptor);
5664 data.writeString(path);
5665 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
5666 reply.readException();
5667 data.recycle();
5668 reply.recycle();
5669 }
5670
Dianne Hackborn3d07c942015-03-13 18:02:54 -07005671 @Override
5672 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
5673 throws RemoteException {
5674 Parcel data = Parcel.obtain();
5675 Parcel reply = Parcel.obtain();
5676 data.writeInterfaceToken(IActivityManager.descriptor);
5677 data.writeStrongBinder(session.asBinder());
5678 data.writeInt(keepAwake ? 1 : 0);
5679 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
5680 reply.readException();
5681 data.recycle();
5682 reply.recycle();
5683 }
5684
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005685 private IBinder mRemote;
5686}