blob: 3864a4bba1f9bfde2d2250d066942bc6e1937aea [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;
Dianne Hackborn69c6adc2015-06-02 10:52:59 -070020import android.app.assist.AssistContent;
21import android.app.assist.AssistStructure;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070023import android.content.IIntentReceiver;
24import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.content.Intent;
26import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070027import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070028import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070029import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.pm.ConfigurationInfo;
31import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070032import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070033import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070035import android.graphics.Bitmap;
36import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080037import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.net.Uri;
39import android.os.Binder;
40import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070041import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.os.IBinder;
43import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.ParcelFileDescriptor;
45import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070046import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070047import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070049import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070050import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080053import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070054import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080055import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057import java.util.ArrayList;
58import java.util.List;
59
60/** {@hide} */
61public abstract class ActivityManagerNative extends Binder implements IActivityManager
62{
63 /**
64 * Cast a Binder object into an activity manager interface, generating
65 * a proxy if needed.
66 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080067 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 if (obj == null) {
69 return null;
70 }
71 IActivityManager in =
72 (IActivityManager)obj.queryLocalInterface(descriptor);
73 if (in != null) {
74 return in;
75 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 return new ActivityManagerProxy(obj);
78 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 /**
81 * Retrieve the system's default/global activity manager.
82 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080083 static public IActivityManager getDefault() {
84 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 }
86
87 /**
88 * Convenience for checking whether the system is ready. For internal use only.
89 */
90 static public boolean isSystemReady() {
91 if (!sSystemReady) {
92 sSystemReady = getDefault().testIsSystemReady();
93 }
94 return sSystemReady;
95 }
96 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080097
Svet Ganov16a16892015-04-16 10:32:04 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
99 broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId);
100 }
101
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 /**
103 * Convenience for sending a sticky broadcast. For internal use only.
104 * If you don't care about permission, use null.
105 */
Svet Ganov16a16892015-04-16 10:32:04 -0700106 static public void broadcastStickyIntent(Intent intent, String permission, int appOp,
107 int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
109 getDefault().broadcastIntent(
Filip Gruszczynski23493322015-07-29 17:02:59 -0700110 null, intent, null, null, Activity.RESULT_OK, null, null,
111 null /*permission*/, appOp, null, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Dianne Hackborn1e383822015-04-10 14:02:33 -0700116 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
117 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 try {
Dianne Hackborn1e383822015-04-10 14:02:33 -0700119 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg, tag);
120 } catch (RemoteException ex) {
121 }
122 }
123
124 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
125 try {
126 getDefault().noteAlarmStart(ps.getTarget(), sourceUid, tag);
127 } catch (RemoteException ex) {
128 }
129 }
130
131 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
132 try {
133 getDefault().noteAlarmFinish(ps.getTarget(), sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 } catch (RemoteException ex) {
135 }
136 }
137
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800138 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 attachInterface(this, descriptor);
140 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700141
142 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800143 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
144 throws RemoteException {
145 switch (code) {
146 case START_ACTIVITY_TRANSACTION:
147 {
148 data.enforceInterface(IActivityManager.descriptor);
149 IBinder b = data.readStrongBinder();
150 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800151 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800152 Intent intent = Intent.CREATOR.createFromParcel(data);
153 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800154 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800155 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800156 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700157 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700158 ProfilerInfo profilerInfo = data.readInt() != 0
159 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700160 Bundle options = data.readInt() != 0
161 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800162 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700163 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800164 reply.writeNoException();
165 reply.writeInt(result);
166 return true;
167 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700168
Amith Yamasani82644082012-08-03 13:09:11 -0700169 case START_ACTIVITY_AS_USER_TRANSACTION:
170 {
171 data.enforceInterface(IActivityManager.descriptor);
172 IBinder b = data.readStrongBinder();
173 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800174 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700175 Intent intent = Intent.CREATOR.createFromParcel(data);
176 String resolvedType = data.readString();
177 IBinder resultTo = data.readStrongBinder();
178 String resultWho = data.readString();
179 int requestCode = data.readInt();
180 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700181 ProfilerInfo profilerInfo = data.readInt() != 0
182 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700183 Bundle options = data.readInt() != 0
184 ? Bundle.CREATOR.createFromParcel(data) : null;
185 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800186 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700187 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700188 reply.writeNoException();
189 reply.writeInt(result);
190 return true;
191 }
192
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700193 case START_ACTIVITY_AS_CALLER_TRANSACTION:
194 {
195 data.enforceInterface(IActivityManager.descriptor);
196 IBinder b = data.readStrongBinder();
197 IApplicationThread app = ApplicationThreadNative.asInterface(b);
198 String callingPackage = data.readString();
199 Intent intent = Intent.CREATOR.createFromParcel(data);
200 String resolvedType = data.readString();
201 IBinder resultTo = data.readStrongBinder();
202 String resultWho = data.readString();
203 int requestCode = data.readInt();
204 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700205 ProfilerInfo profilerInfo = data.readInt() != 0
206 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700207 Bundle options = data.readInt() != 0
208 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700209 boolean ignoreTargetSecurity = data.readInt() != 0;
Jeff Sharkey97978802014-10-14 10:48:18 -0700210 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700211 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700212 resultTo, resultWho, requestCode, startFlags, profilerInfo, options,
213 ignoreTargetSecurity, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700214 reply.writeNoException();
215 reply.writeInt(result);
216 return true;
217 }
218
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800219 case START_ACTIVITY_AND_WAIT_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 Hackborn8f7f35e2010-02-25 18:48:12 -0800225 Intent intent = Intent.CREATOR.createFromParcel(data);
226 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800227 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800228 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800229 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700230 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700231 ProfilerInfo profilerInfo = data.readInt() != 0
232 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700233 Bundle options = data.readInt() != 0
234 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700235 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800236 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700237 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800238 reply.writeNoException();
239 result.writeToParcel(reply, 0);
240 return true;
241 }
242
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700243 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
244 {
245 data.enforceInterface(IActivityManager.descriptor);
246 IBinder b = data.readStrongBinder();
247 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800248 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700249 Intent intent = Intent.CREATOR.createFromParcel(data);
250 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700251 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700252 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700253 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700254 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700255 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700256 Bundle options = data.readInt() != 0
257 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700258 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800259 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700260 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700261 reply.writeNoException();
262 reply.writeInt(result);
263 return true;
264 }
265
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700266 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700267 {
268 data.enforceInterface(IActivityManager.descriptor);
269 IBinder b = data.readStrongBinder();
270 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700271 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700272 Intent fillInIntent = null;
273 if (data.readInt() != 0) {
274 fillInIntent = Intent.CREATOR.createFromParcel(data);
275 }
276 String resolvedType = data.readString();
277 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700278 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700279 int requestCode = data.readInt();
280 int flagsMask = data.readInt();
281 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700282 Bundle options = data.readInt() != 0
283 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700284 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700285 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700286 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700287 reply.writeNoException();
288 reply.writeInt(result);
289 return true;
290 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700291
Dianne Hackborn91097de2014-04-04 18:02:06 -0700292 case START_VOICE_ACTIVITY_TRANSACTION:
293 {
294 data.enforceInterface(IActivityManager.descriptor);
295 String callingPackage = data.readString();
296 int callingPid = data.readInt();
297 int callingUid = data.readInt();
298 Intent intent = Intent.CREATOR.createFromParcel(data);
299 String resolvedType = data.readString();
300 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
301 data.readStrongBinder());
302 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
303 data.readStrongBinder());
304 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700305 ProfilerInfo profilerInfo = data.readInt() != 0
306 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700307 Bundle options = data.readInt() != 0
308 ? Bundle.CREATOR.createFromParcel(data) : null;
309 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700310 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
311 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700312 reply.writeNoException();
313 reply.writeInt(result);
314 return true;
315 }
316
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800317 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
318 {
319 data.enforceInterface(IActivityManager.descriptor);
320 IBinder callingActivity = data.readStrongBinder();
321 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700322 Bundle options = data.readInt() != 0
323 ? Bundle.CREATOR.createFromParcel(data) : null;
324 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800325 reply.writeNoException();
326 reply.writeInt(result ? 1 : 0);
327 return true;
328 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700329
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700330 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
331 {
332 data.enforceInterface(IActivityManager.descriptor);
333 int taskId = data.readInt();
334 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
335 int result = startActivityFromRecents(taskId, options);
336 reply.writeNoException();
337 reply.writeInt(result);
338 return true;
339 }
340
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800341 case FINISH_ACTIVITY_TRANSACTION: {
342 data.enforceInterface(IActivityManager.descriptor);
343 IBinder token = data.readStrongBinder();
344 Intent resultData = null;
345 int resultCode = data.readInt();
346 if (data.readInt() != 0) {
347 resultData = Intent.CREATOR.createFromParcel(data);
348 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700349 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700350 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 reply.writeNoException();
352 reply.writeInt(res ? 1 : 0);
353 return true;
354 }
355
356 case FINISH_SUB_ACTIVITY_TRANSACTION: {
357 data.enforceInterface(IActivityManager.descriptor);
358 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700359 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800360 int requestCode = data.readInt();
361 finishSubActivity(token, resultWho, requestCode);
362 reply.writeNoException();
363 return true;
364 }
365
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700366 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
367 data.enforceInterface(IActivityManager.descriptor);
368 IBinder token = data.readStrongBinder();
369 boolean res = finishActivityAffinity(token);
370 reply.writeNoException();
371 reply.writeInt(res ? 1 : 0);
372 return true;
373 }
374
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700375 case FINISH_VOICE_TASK_TRANSACTION: {
376 data.enforceInterface(IActivityManager.descriptor);
377 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
378 data.readStrongBinder());
379 finishVoiceTask(session);
380 reply.writeNoException();
381 return true;
382 }
383
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700384 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
385 data.enforceInterface(IActivityManager.descriptor);
386 IBinder token = data.readStrongBinder();
387 boolean res = releaseActivityInstance(token);
388 reply.writeNoException();
389 reply.writeInt(res ? 1 : 0);
390 return true;
391 }
392
393 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
394 data.enforceInterface(IActivityManager.descriptor);
395 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
396 releaseSomeActivities(app);
397 reply.writeNoException();
398 return true;
399 }
400
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800401 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
402 data.enforceInterface(IActivityManager.descriptor);
403 IBinder token = data.readStrongBinder();
404 boolean res = willActivityBeVisible(token);
405 reply.writeNoException();
406 reply.writeInt(res ? 1 : 0);
407 return true;
408 }
409
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800410 case REGISTER_RECEIVER_TRANSACTION:
411 {
412 data.enforceInterface(IActivityManager.descriptor);
413 IBinder b = data.readStrongBinder();
414 IApplicationThread app =
415 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700416 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800417 b = data.readStrongBinder();
418 IIntentReceiver rec
419 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
420 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
421 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700422 int userId = data.readInt();
423 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800424 reply.writeNoException();
425 if (intent != null) {
426 reply.writeInt(1);
427 intent.writeToParcel(reply, 0);
428 } else {
429 reply.writeInt(0);
430 }
431 return true;
432 }
433
434 case UNREGISTER_RECEIVER_TRANSACTION:
435 {
436 data.enforceInterface(IActivityManager.descriptor);
437 IBinder b = data.readStrongBinder();
438 if (b == null) {
439 return true;
440 }
441 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
442 unregisterReceiver(rec);
443 reply.writeNoException();
444 return true;
445 }
446
447 case BROADCAST_INTENT_TRANSACTION:
448 {
449 data.enforceInterface(IActivityManager.descriptor);
450 IBinder b = data.readStrongBinder();
451 IApplicationThread app =
452 b != null ? ApplicationThreadNative.asInterface(b) : null;
453 Intent intent = Intent.CREATOR.createFromParcel(data);
454 String resolvedType = data.readString();
455 b = data.readStrongBinder();
456 IIntentReceiver resultTo =
457 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
458 int resultCode = data.readInt();
459 String resultData = data.readString();
460 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700461 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800462 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700463 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800464 boolean serialized = data.readInt() != 0;
465 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700466 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700468 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700469 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 reply.writeNoException();
471 reply.writeInt(res);
472 return true;
473 }
474
475 case UNBROADCAST_INTENT_TRANSACTION:
476 {
477 data.enforceInterface(IActivityManager.descriptor);
478 IBinder b = data.readStrongBinder();
479 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
480 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700481 int userId = data.readInt();
482 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800483 reply.writeNoException();
484 return true;
485 }
486
487 case FINISH_RECEIVER_TRANSACTION: {
488 data.enforceInterface(IActivityManager.descriptor);
489 IBinder who = data.readStrongBinder();
490 int resultCode = data.readInt();
491 String resultData = data.readString();
492 Bundle resultExtras = data.readBundle();
493 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800494 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800495 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800496 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 }
498 reply.writeNoException();
499 return true;
500 }
501
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800502 case ATTACH_APPLICATION_TRANSACTION: {
503 data.enforceInterface(IActivityManager.descriptor);
504 IApplicationThread app = ApplicationThreadNative.asInterface(
505 data.readStrongBinder());
506 if (app != null) {
507 attachApplication(app);
508 }
509 reply.writeNoException();
510 return true;
511 }
512
513 case ACTIVITY_IDLE_TRANSACTION: {
514 data.enforceInterface(IActivityManager.descriptor);
515 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700516 Configuration config = null;
517 if (data.readInt() != 0) {
518 config = Configuration.CREATOR.createFromParcel(data);
519 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700520 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800521 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700522 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800523 }
524 reply.writeNoException();
525 return true;
526 }
527
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700528 case ACTIVITY_RESUMED_TRANSACTION: {
529 data.enforceInterface(IActivityManager.descriptor);
530 IBinder token = data.readStrongBinder();
531 activityResumed(token);
532 reply.writeNoException();
533 return true;
534 }
535
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800536 case ACTIVITY_PAUSED_TRANSACTION: {
537 data.enforceInterface(IActivityManager.descriptor);
538 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700539 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800540 reply.writeNoException();
541 return true;
542 }
543
544 case ACTIVITY_STOPPED_TRANSACTION: {
545 data.enforceInterface(IActivityManager.descriptor);
546 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800547 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700548 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800549 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700550 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800551 reply.writeNoException();
552 return true;
553 }
554
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800555 case ACTIVITY_SLEPT_TRANSACTION: {
556 data.enforceInterface(IActivityManager.descriptor);
557 IBinder token = data.readStrongBinder();
558 activitySlept(token);
559 reply.writeNoException();
560 return true;
561 }
562
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800563 case ACTIVITY_DESTROYED_TRANSACTION: {
564 data.enforceInterface(IActivityManager.descriptor);
565 IBinder token = data.readStrongBinder();
566 activityDestroyed(token);
567 reply.writeNoException();
568 return true;
569 }
570
571 case GET_CALLING_PACKAGE_TRANSACTION: {
572 data.enforceInterface(IActivityManager.descriptor);
573 IBinder token = data.readStrongBinder();
574 String res = token != null ? getCallingPackage(token) : null;
575 reply.writeNoException();
576 reply.writeString(res);
577 return true;
578 }
579
580 case GET_CALLING_ACTIVITY_TRANSACTION: {
581 data.enforceInterface(IActivityManager.descriptor);
582 IBinder token = data.readStrongBinder();
583 ComponentName cn = getCallingActivity(token);
584 reply.writeNoException();
585 ComponentName.writeToParcel(cn, reply);
586 return true;
587 }
588
Winson Chung1147c402014-05-14 11:05:00 -0700589 case GET_APP_TASKS_TRANSACTION: {
590 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700591 String callingPackage = data.readString();
592 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700593 reply.writeNoException();
594 int N = list != null ? list.size() : -1;
595 reply.writeInt(N);
596 int i;
597 for (i=0; i<N; i++) {
598 IAppTask task = list.get(i);
599 reply.writeStrongBinder(task.asBinder());
600 }
601 return true;
602 }
603
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700604 case ADD_APP_TASK_TRANSACTION: {
605 data.enforceInterface(IActivityManager.descriptor);
606 IBinder activityToken = data.readStrongBinder();
607 Intent intent = Intent.CREATOR.createFromParcel(data);
608 ActivityManager.TaskDescription descr
609 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
610 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
611 int res = addAppTask(activityToken, intent, descr, thumbnail);
612 reply.writeNoException();
613 reply.writeInt(res);
614 return true;
615 }
616
617 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
618 data.enforceInterface(IActivityManager.descriptor);
619 Point size = getAppTaskThumbnailSize();
620 reply.writeNoException();
621 size.writeToParcel(reply, 0);
622 return true;
623 }
624
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800625 case GET_TASKS_TRANSACTION: {
626 data.enforceInterface(IActivityManager.descriptor);
627 int maxNum = data.readInt();
628 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700629 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800630 reply.writeNoException();
631 int N = list != null ? list.size() : -1;
632 reply.writeInt(N);
633 int i;
634 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700635 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800636 info.writeToParcel(reply, 0);
637 }
638 return true;
639 }
640
641 case GET_RECENT_TASKS_TRANSACTION: {
642 data.enforceInterface(IActivityManager.descriptor);
643 int maxNum = data.readInt();
644 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700645 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800646 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700647 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800648 reply.writeNoException();
649 reply.writeTypedList(list);
650 return true;
651 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700652
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700653 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800654 data.enforceInterface(IActivityManager.descriptor);
655 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700656 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800657 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700658 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800659 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700660 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700661 } else {
662 reply.writeInt(0);
663 }
664 return true;
665 }
666
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800667 case GET_SERVICES_TRANSACTION: {
668 data.enforceInterface(IActivityManager.descriptor);
669 int maxNum = data.readInt();
670 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700671 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800672 reply.writeNoException();
673 int N = list != null ? list.size() : -1;
674 reply.writeInt(N);
675 int i;
676 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700677 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800678 info.writeToParcel(reply, 0);
679 }
680 return true;
681 }
682
683 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
684 data.enforceInterface(IActivityManager.descriptor);
685 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
686 reply.writeNoException();
687 reply.writeTypedList(list);
688 return true;
689 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700690
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800691 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
692 data.enforceInterface(IActivityManager.descriptor);
693 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
694 reply.writeNoException();
695 reply.writeTypedList(list);
696 return true;
697 }
698
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700699 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
700 data.enforceInterface(IActivityManager.descriptor);
701 List<ApplicationInfo> list = getRunningExternalApplications();
702 reply.writeNoException();
703 reply.writeTypedList(list);
704 return true;
705 }
706
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800707 case MOVE_TASK_TO_FRONT_TRANSACTION: {
708 data.enforceInterface(IActivityManager.descriptor);
709 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800710 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700711 Bundle options = data.readInt() != 0
712 ? Bundle.CREATOR.createFromParcel(data) : null;
713 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800714 reply.writeNoException();
715 return true;
716 }
717
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800718 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
719 data.enforceInterface(IActivityManager.descriptor);
720 IBinder token = data.readStrongBinder();
721 boolean nonRoot = data.readInt() != 0;
722 boolean res = moveActivityTaskToBack(token, nonRoot);
723 reply.writeNoException();
724 reply.writeInt(res ? 1 : 0);
725 return true;
726 }
727
728 case MOVE_TASK_BACKWARDS_TRANSACTION: {
729 data.enforceInterface(IActivityManager.descriptor);
730 int task = data.readInt();
731 moveTaskBackwards(task);
732 reply.writeNoException();
733 return true;
734 }
735
Craig Mautnerc00204b2013-03-05 15:02:14 -0800736 case MOVE_TASK_TO_STACK_TRANSACTION: {
737 data.enforceInterface(IActivityManager.descriptor);
738 int taskId = data.readInt();
739 int stackId = data.readInt();
740 boolean toTop = data.readInt() != 0;
741 moveTaskToStack(taskId, stackId, toTop);
742 reply.writeNoException();
743 return true;
744 }
745
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700746 case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: {
747 data.enforceInterface(IActivityManager.descriptor);
748 int taskId = data.readInt();
749 int createMode = data.readInt();
750 boolean toTop = data.readInt() != 0;
751 moveTaskToDockedStack(taskId, createMode, toTop);
752 reply.writeNoException();
753 return true;
754 }
755
Craig Mautnerc00204b2013-03-05 15:02:14 -0800756 case RESIZE_STACK_TRANSACTION: {
757 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800758 int stackId = data.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800759 Rect r = Rect.CREATOR.createFromParcel(data);
760 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800761 reply.writeNoException();
762 return true;
763 }
764
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700765 case POSITION_TASK_IN_STACK_TRANSACTION: {
766 data.enforceInterface(IActivityManager.descriptor);
767 int taskId = data.readInt();
768 int stackId = data.readInt();
769 int position = data.readInt();
770 positionTaskInStack(taskId, stackId, position);
771 reply.writeNoException();
772 return true;
773 }
774
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800775 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700776 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800777 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700778 reply.writeNoException();
779 reply.writeTypedList(list);
780 return true;
781 }
782
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800783 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700784 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800785 int stackId = data.readInt();
786 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700787 reply.writeNoException();
788 if (info != null) {
789 reply.writeInt(1);
790 info.writeToParcel(reply, 0);
791 } else {
792 reply.writeInt(0);
793 }
794 return true;
795 }
796
Winson Chung303e1ff2014-03-07 15:06:19 -0800797 case IS_IN_HOME_STACK_TRANSACTION: {
798 data.enforceInterface(IActivityManager.descriptor);
799 int taskId = data.readInt();
800 boolean isInHomeStack = isInHomeStack(taskId);
801 reply.writeNoException();
802 reply.writeInt(isInHomeStack ? 1 : 0);
803 return true;
804 }
805
Craig Mautnercf910b02013-04-23 11:23:27 -0700806 case SET_FOCUSED_STACK_TRANSACTION: {
807 data.enforceInterface(IActivityManager.descriptor);
808 int stackId = data.readInt();
809 setFocusedStack(stackId);
810 reply.writeNoException();
811 return true;
812 }
813
Winson Chungd16c5652015-01-26 16:11:07 -0800814 case GET_FOCUSED_STACK_ID_TRANSACTION: {
815 data.enforceInterface(IActivityManager.descriptor);
816 int focusedStackId = getFocusedStackId();
817 reply.writeNoException();
818 reply.writeInt(focusedStackId);
819 return true;
820 }
821
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700822 case SET_FOCUSED_TASK_TRANSACTION: {
823 data.enforceInterface(IActivityManager.descriptor);
824 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700825 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700826 reply.writeNoException();
827 return true;
828 }
829
Winson Chung740c3ac2014-11-12 16:14:38 -0800830 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
831 data.enforceInterface(IActivityManager.descriptor);
832 IBinder token = data.readStrongBinder();
833 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
834 reply.writeNoException();
835 return true;
836 }
837
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800838 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
839 data.enforceInterface(IActivityManager.descriptor);
840 IBinder token = data.readStrongBinder();
841 boolean onlyRoot = data.readInt() != 0;
842 int res = token != null
843 ? getTaskForActivity(token, onlyRoot) : -1;
844 reply.writeNoException();
845 reply.writeInt(res);
846 return true;
847 }
848
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800849 case GET_CONTENT_PROVIDER_TRANSACTION: {
850 data.enforceInterface(IActivityManager.descriptor);
851 IBinder b = data.readStrongBinder();
852 IApplicationThread app = ApplicationThreadNative.asInterface(b);
853 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700854 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700855 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700856 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800857 reply.writeNoException();
858 if (cph != null) {
859 reply.writeInt(1);
860 cph.writeToParcel(reply, 0);
861 } else {
862 reply.writeInt(0);
863 }
864 return true;
865 }
866
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800867 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
868 data.enforceInterface(IActivityManager.descriptor);
869 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700870 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800871 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700872 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800873 reply.writeNoException();
874 if (cph != null) {
875 reply.writeInt(1);
876 cph.writeToParcel(reply, 0);
877 } else {
878 reply.writeInt(0);
879 }
880 return true;
881 }
882
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800883 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
884 data.enforceInterface(IActivityManager.descriptor);
885 IBinder b = data.readStrongBinder();
886 IApplicationThread app = ApplicationThreadNative.asInterface(b);
887 ArrayList<ContentProviderHolder> providers =
888 data.createTypedArrayList(ContentProviderHolder.CREATOR);
889 publishContentProviders(app, providers);
890 reply.writeNoException();
891 return true;
892 }
893
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700894 case REF_CONTENT_PROVIDER_TRANSACTION: {
895 data.enforceInterface(IActivityManager.descriptor);
896 IBinder b = data.readStrongBinder();
897 int stable = data.readInt();
898 int unstable = data.readInt();
899 boolean res = refContentProvider(b, stable, unstable);
900 reply.writeNoException();
901 reply.writeInt(res ? 1 : 0);
902 return true;
903 }
904
905 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
906 data.enforceInterface(IActivityManager.descriptor);
907 IBinder b = data.readStrongBinder();
908 unstableProviderDied(b);
909 reply.writeNoException();
910 return true;
911 }
912
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700913 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
914 data.enforceInterface(IActivityManager.descriptor);
915 IBinder b = data.readStrongBinder();
916 appNotRespondingViaProvider(b);
917 reply.writeNoException();
918 return true;
919 }
920
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800921 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
922 data.enforceInterface(IActivityManager.descriptor);
923 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700924 boolean stable = data.readInt() != 0;
925 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800926 reply.writeNoException();
927 return true;
928 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800929
930 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
931 data.enforceInterface(IActivityManager.descriptor);
932 String name = data.readString();
933 IBinder token = data.readStrongBinder();
934 removeContentProviderExternal(name, token);
935 reply.writeNoException();
936 return true;
937 }
938
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700939 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
940 data.enforceInterface(IActivityManager.descriptor);
941 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
942 PendingIntent pi = getRunningServiceControlPanel(comp);
943 reply.writeNoException();
944 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
945 return true;
946 }
947
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800948 case START_SERVICE_TRANSACTION: {
949 data.enforceInterface(IActivityManager.descriptor);
950 IBinder b = data.readStrongBinder();
951 IApplicationThread app = ApplicationThreadNative.asInterface(b);
952 Intent service = Intent.CREATOR.createFromParcel(data);
953 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -0700954 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700955 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700956 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800957 reply.writeNoException();
958 ComponentName.writeToParcel(cn, reply);
959 return true;
960 }
961
962 case STOP_SERVICE_TRANSACTION: {
963 data.enforceInterface(IActivityManager.descriptor);
964 IBinder b = data.readStrongBinder();
965 IApplicationThread app = ApplicationThreadNative.asInterface(b);
966 Intent service = Intent.CREATOR.createFromParcel(data);
967 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700968 int userId = data.readInt();
969 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800970 reply.writeNoException();
971 reply.writeInt(res);
972 return true;
973 }
974
975 case STOP_SERVICE_TOKEN_TRANSACTION: {
976 data.enforceInterface(IActivityManager.descriptor);
977 ComponentName className = ComponentName.readFromParcel(data);
978 IBinder token = data.readStrongBinder();
979 int startId = data.readInt();
980 boolean res = stopServiceToken(className, token, startId);
981 reply.writeNoException();
982 reply.writeInt(res ? 1 : 0);
983 return true;
984 }
985
986 case SET_SERVICE_FOREGROUND_TRANSACTION: {
987 data.enforceInterface(IActivityManager.descriptor);
988 ComponentName className = ComponentName.readFromParcel(data);
989 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700990 int id = data.readInt();
991 Notification notification = null;
992 if (data.readInt() != 0) {
993 notification = Notification.CREATOR.createFromParcel(data);
994 }
995 boolean removeNotification = data.readInt() != 0;
996 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800997 reply.writeNoException();
998 return true;
999 }
1000
1001 case BIND_SERVICE_TRANSACTION: {
1002 data.enforceInterface(IActivityManager.descriptor);
1003 IBinder b = data.readStrongBinder();
1004 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1005 IBinder token = data.readStrongBinder();
1006 Intent service = Intent.CREATOR.createFromParcel(data);
1007 String resolvedType = data.readString();
1008 b = data.readStrongBinder();
1009 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001010 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001011 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001012 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001013 int res = bindService(app, token, service, resolvedType, conn, fl,
1014 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001015 reply.writeNoException();
1016 reply.writeInt(res);
1017 return true;
1018 }
1019
1020 case UNBIND_SERVICE_TRANSACTION: {
1021 data.enforceInterface(IActivityManager.descriptor);
1022 IBinder b = data.readStrongBinder();
1023 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1024 boolean res = unbindService(conn);
1025 reply.writeNoException();
1026 reply.writeInt(res ? 1 : 0);
1027 return true;
1028 }
1029
1030 case PUBLISH_SERVICE_TRANSACTION: {
1031 data.enforceInterface(IActivityManager.descriptor);
1032 IBinder token = data.readStrongBinder();
1033 Intent intent = Intent.CREATOR.createFromParcel(data);
1034 IBinder service = data.readStrongBinder();
1035 publishService(token, intent, service);
1036 reply.writeNoException();
1037 return true;
1038 }
1039
1040 case UNBIND_FINISHED_TRANSACTION: {
1041 data.enforceInterface(IActivityManager.descriptor);
1042 IBinder token = data.readStrongBinder();
1043 Intent intent = Intent.CREATOR.createFromParcel(data);
1044 boolean doRebind = data.readInt() != 0;
1045 unbindFinished(token, intent, doRebind);
1046 reply.writeNoException();
1047 return true;
1048 }
1049
1050 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1051 data.enforceInterface(IActivityManager.descriptor);
1052 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001053 int type = data.readInt();
1054 int startId = data.readInt();
1055 int res = data.readInt();
1056 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001057 reply.writeNoException();
1058 return true;
1059 }
1060
1061 case START_INSTRUMENTATION_TRANSACTION: {
1062 data.enforceInterface(IActivityManager.descriptor);
1063 ComponentName className = ComponentName.readFromParcel(data);
1064 String profileFile = data.readString();
1065 int fl = data.readInt();
1066 Bundle arguments = data.readBundle();
1067 IBinder b = data.readStrongBinder();
1068 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001069 b = data.readStrongBinder();
1070 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001071 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001072 String abiOverride = data.readString();
1073 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1074 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001075 reply.writeNoException();
1076 reply.writeInt(res ? 1 : 0);
1077 return true;
1078 }
1079
1080
1081 case FINISH_INSTRUMENTATION_TRANSACTION: {
1082 data.enforceInterface(IActivityManager.descriptor);
1083 IBinder b = data.readStrongBinder();
1084 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1085 int resultCode = data.readInt();
1086 Bundle results = data.readBundle();
1087 finishInstrumentation(app, resultCode, results);
1088 reply.writeNoException();
1089 return true;
1090 }
1091
1092 case GET_CONFIGURATION_TRANSACTION: {
1093 data.enforceInterface(IActivityManager.descriptor);
1094 Configuration config = getConfiguration();
1095 reply.writeNoException();
1096 config.writeToParcel(reply, 0);
1097 return true;
1098 }
1099
1100 case UPDATE_CONFIGURATION_TRANSACTION: {
1101 data.enforceInterface(IActivityManager.descriptor);
1102 Configuration config = Configuration.CREATOR.createFromParcel(data);
1103 updateConfiguration(config);
1104 reply.writeNoException();
1105 return true;
1106 }
1107
1108 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1109 data.enforceInterface(IActivityManager.descriptor);
1110 IBinder token = data.readStrongBinder();
1111 int requestedOrientation = data.readInt();
1112 setRequestedOrientation(token, requestedOrientation);
1113 reply.writeNoException();
1114 return true;
1115 }
1116
1117 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1118 data.enforceInterface(IActivityManager.descriptor);
1119 IBinder token = data.readStrongBinder();
1120 int req = getRequestedOrientation(token);
1121 reply.writeNoException();
1122 reply.writeInt(req);
1123 return true;
1124 }
1125
1126 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1127 data.enforceInterface(IActivityManager.descriptor);
1128 IBinder token = data.readStrongBinder();
1129 ComponentName cn = getActivityClassForToken(token);
1130 reply.writeNoException();
1131 ComponentName.writeToParcel(cn, reply);
1132 return true;
1133 }
1134
1135 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1136 data.enforceInterface(IActivityManager.descriptor);
1137 IBinder token = data.readStrongBinder();
1138 reply.writeNoException();
1139 reply.writeString(getPackageForToken(token));
1140 return true;
1141 }
1142
1143 case GET_INTENT_SENDER_TRANSACTION: {
1144 data.enforceInterface(IActivityManager.descriptor);
1145 int type = data.readInt();
1146 String packageName = data.readString();
1147 IBinder token = data.readStrongBinder();
1148 String resultWho = data.readString();
1149 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001150 Intent[] requestIntents;
1151 String[] requestResolvedTypes;
1152 if (data.readInt() != 0) {
1153 requestIntents = data.createTypedArray(Intent.CREATOR);
1154 requestResolvedTypes = data.createStringArray();
1155 } else {
1156 requestIntents = null;
1157 requestResolvedTypes = null;
1158 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001159 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001160 Bundle options = data.readInt() != 0
1161 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001162 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001163 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001164 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001165 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001166 reply.writeNoException();
1167 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1168 return true;
1169 }
1170
1171 case CANCEL_INTENT_SENDER_TRANSACTION: {
1172 data.enforceInterface(IActivityManager.descriptor);
1173 IIntentSender r = IIntentSender.Stub.asInterface(
1174 data.readStrongBinder());
1175 cancelIntentSender(r);
1176 reply.writeNoException();
1177 return true;
1178 }
1179
1180 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1181 data.enforceInterface(IActivityManager.descriptor);
1182 IIntentSender r = IIntentSender.Stub.asInterface(
1183 data.readStrongBinder());
1184 String res = getPackageForIntentSender(r);
1185 reply.writeNoException();
1186 reply.writeString(res);
1187 return true;
1188 }
1189
Christopher Tatec4a07d12012-04-06 14:19:13 -07001190 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1191 data.enforceInterface(IActivityManager.descriptor);
1192 IIntentSender r = IIntentSender.Stub.asInterface(
1193 data.readStrongBinder());
1194 int res = getUidForIntentSender(r);
1195 reply.writeNoException();
1196 reply.writeInt(res);
1197 return true;
1198 }
1199
Dianne Hackborn41203752012-08-31 14:05:51 -07001200 case HANDLE_INCOMING_USER_TRANSACTION: {
1201 data.enforceInterface(IActivityManager.descriptor);
1202 int callingPid = data.readInt();
1203 int callingUid = data.readInt();
1204 int userId = data.readInt();
1205 boolean allowAll = data.readInt() != 0 ;
1206 boolean requireFull = data.readInt() != 0;
1207 String name = data.readString();
1208 String callerPackage = data.readString();
1209 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1210 requireFull, name, callerPackage);
1211 reply.writeNoException();
1212 reply.writeInt(res);
1213 return true;
1214 }
1215
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001216 case SET_PROCESS_LIMIT_TRANSACTION: {
1217 data.enforceInterface(IActivityManager.descriptor);
1218 int max = data.readInt();
1219 setProcessLimit(max);
1220 reply.writeNoException();
1221 return true;
1222 }
1223
1224 case GET_PROCESS_LIMIT_TRANSACTION: {
1225 data.enforceInterface(IActivityManager.descriptor);
1226 int limit = getProcessLimit();
1227 reply.writeNoException();
1228 reply.writeInt(limit);
1229 return true;
1230 }
1231
1232 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1233 data.enforceInterface(IActivityManager.descriptor);
1234 IBinder token = data.readStrongBinder();
1235 int pid = data.readInt();
1236 boolean isForeground = data.readInt() != 0;
1237 setProcessForeground(token, pid, isForeground);
1238 reply.writeNoException();
1239 return true;
1240 }
1241
1242 case CHECK_PERMISSION_TRANSACTION: {
1243 data.enforceInterface(IActivityManager.descriptor);
1244 String perm = data.readString();
1245 int pid = data.readInt();
1246 int uid = data.readInt();
1247 int res = checkPermission(perm, pid, uid);
1248 reply.writeNoException();
1249 reply.writeInt(res);
1250 return true;
1251 }
1252
Dianne Hackbornff170242014-11-19 10:59:01 -08001253 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1254 data.enforceInterface(IActivityManager.descriptor);
1255 String perm = data.readString();
1256 int pid = data.readInt();
1257 int uid = data.readInt();
1258 IBinder token = data.readStrongBinder();
1259 int res = checkPermissionWithToken(perm, pid, uid, token);
1260 reply.writeNoException();
1261 reply.writeInt(res);
1262 return true;
1263 }
1264
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001265 case CHECK_URI_PERMISSION_TRANSACTION: {
1266 data.enforceInterface(IActivityManager.descriptor);
1267 Uri uri = Uri.CREATOR.createFromParcel(data);
1268 int pid = data.readInt();
1269 int uid = data.readInt();
1270 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001271 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001272 IBinder callerToken = data.readStrongBinder();
1273 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001274 reply.writeNoException();
1275 reply.writeInt(res);
1276 return true;
1277 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001278
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001279 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001280 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001281 String packageName = data.readString();
1282 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1283 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001284 int userId = data.readInt();
1285 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001286 reply.writeNoException();
1287 reply.writeInt(res ? 1 : 0);
1288 return true;
1289 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001290
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001291 case GRANT_URI_PERMISSION_TRANSACTION: {
1292 data.enforceInterface(IActivityManager.descriptor);
1293 IBinder b = data.readStrongBinder();
1294 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1295 String targetPkg = data.readString();
1296 Uri uri = Uri.CREATOR.createFromParcel(data);
1297 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001298 int userId = data.readInt();
1299 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001300 reply.writeNoException();
1301 return true;
1302 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001303
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001304 case REVOKE_URI_PERMISSION_TRANSACTION: {
1305 data.enforceInterface(IActivityManager.descriptor);
1306 IBinder b = data.readStrongBinder();
1307 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1308 Uri uri = Uri.CREATOR.createFromParcel(data);
1309 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001310 int userId = data.readInt();
1311 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001312 reply.writeNoException();
1313 return true;
1314 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001315
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001316 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1317 data.enforceInterface(IActivityManager.descriptor);
1318 Uri uri = Uri.CREATOR.createFromParcel(data);
1319 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001320 int userId = data.readInt();
1321 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001322 reply.writeNoException();
1323 return true;
1324 }
1325
1326 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1327 data.enforceInterface(IActivityManager.descriptor);
1328 Uri uri = Uri.CREATOR.createFromParcel(data);
1329 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001330 int userId = data.readInt();
1331 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001332 reply.writeNoException();
1333 return true;
1334 }
1335
1336 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1337 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001338 final String packageName = data.readString();
1339 final boolean incoming = data.readInt() != 0;
1340 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1341 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001342 reply.writeNoException();
1343 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1344 return true;
1345 }
1346
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001347 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1348 data.enforceInterface(IActivityManager.descriptor);
1349 IBinder b = data.readStrongBinder();
1350 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1351 boolean waiting = data.readInt() != 0;
1352 showWaitingForDebugger(app, waiting);
1353 reply.writeNoException();
1354 return true;
1355 }
1356
1357 case GET_MEMORY_INFO_TRANSACTION: {
1358 data.enforceInterface(IActivityManager.descriptor);
1359 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1360 getMemoryInfo(mi);
1361 reply.writeNoException();
1362 mi.writeToParcel(reply, 0);
1363 return true;
1364 }
1365
1366 case UNHANDLED_BACK_TRANSACTION: {
1367 data.enforceInterface(IActivityManager.descriptor);
1368 unhandledBack();
1369 reply.writeNoException();
1370 return true;
1371 }
1372
1373 case OPEN_CONTENT_URI_TRANSACTION: {
1374 data.enforceInterface(IActivityManager.descriptor);
1375 Uri uri = Uri.parse(data.readString());
1376 ParcelFileDescriptor pfd = openContentUri(uri);
1377 reply.writeNoException();
1378 if (pfd != null) {
1379 reply.writeInt(1);
1380 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1381 } else {
1382 reply.writeInt(0);
1383 }
1384 return true;
1385 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001386
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001387 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1388 data.enforceInterface(IActivityManager.descriptor);
1389 setLockScreenShown(data.readInt() != 0);
1390 reply.writeNoException();
1391 return true;
1392 }
1393
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001394 case SET_DEBUG_APP_TRANSACTION: {
1395 data.enforceInterface(IActivityManager.descriptor);
1396 String pn = data.readString();
1397 boolean wfd = data.readInt() != 0;
1398 boolean per = data.readInt() != 0;
1399 setDebugApp(pn, wfd, per);
1400 reply.writeNoException();
1401 return true;
1402 }
1403
1404 case SET_ALWAYS_FINISH_TRANSACTION: {
1405 data.enforceInterface(IActivityManager.descriptor);
1406 boolean enabled = data.readInt() != 0;
1407 setAlwaysFinish(enabled);
1408 reply.writeNoException();
1409 return true;
1410 }
1411
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001412 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001413 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001414 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001415 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001416 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001417 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001418 return true;
1419 }
1420
1421 case ENTER_SAFE_MODE_TRANSACTION: {
1422 data.enforceInterface(IActivityManager.descriptor);
1423 enterSafeMode();
1424 reply.writeNoException();
1425 return true;
1426 }
1427
1428 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1429 data.enforceInterface(IActivityManager.descriptor);
1430 IIntentSender is = IIntentSender.Stub.asInterface(
1431 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001432 int sourceUid = data.readInt();
1433 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001434 String tag = data.readString();
1435 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1436 reply.writeNoException();
1437 return true;
1438 }
1439
1440 case NOTE_ALARM_START_TRANSACTION: {
1441 data.enforceInterface(IActivityManager.descriptor);
1442 IIntentSender is = IIntentSender.Stub.asInterface(
1443 data.readStrongBinder());
1444 int sourceUid = data.readInt();
1445 String tag = data.readString();
1446 noteAlarmStart(is, sourceUid, tag);
1447 reply.writeNoException();
1448 return true;
1449 }
1450
1451 case NOTE_ALARM_FINISH_TRANSACTION: {
1452 data.enforceInterface(IActivityManager.descriptor);
1453 IIntentSender is = IIntentSender.Stub.asInterface(
1454 data.readStrongBinder());
1455 int sourceUid = data.readInt();
1456 String tag = data.readString();
1457 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001458 reply.writeNoException();
1459 return true;
1460 }
1461
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001462 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001463 data.enforceInterface(IActivityManager.descriptor);
1464 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001465 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001466 boolean secure = data.readInt() != 0;
1467 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001468 reply.writeNoException();
1469 reply.writeInt(res ? 1 : 0);
1470 return true;
1471 }
1472
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001473 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1474 data.enforceInterface(IActivityManager.descriptor);
1475 String reason = data.readString();
1476 boolean res = killProcessesBelowForeground(reason);
1477 reply.writeNoException();
1478 reply.writeInt(res ? 1 : 0);
1479 return true;
1480 }
1481
Dan Egnor60d87622009-12-16 16:32:58 -08001482 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1483 data.enforceInterface(IActivityManager.descriptor);
1484 IBinder app = data.readStrongBinder();
1485 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1486 handleApplicationCrash(app, ci);
1487 reply.writeNoException();
1488 return true;
1489 }
1490
1491 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001492 data.enforceInterface(IActivityManager.descriptor);
1493 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001494 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001495 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001496 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001497 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001498 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001499 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001500 return true;
1501 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001502
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001503 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1504 data.enforceInterface(IActivityManager.descriptor);
1505 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001506 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001507 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1508 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001509 reply.writeNoException();
1510 return true;
1511 }
1512
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001513 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1514 data.enforceInterface(IActivityManager.descriptor);
1515 int sig = data.readInt();
1516 signalPersistentProcesses(sig);
1517 reply.writeNoException();
1518 return true;
1519 }
1520
Dianne Hackborn03abb812010-01-04 18:43:19 -08001521 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1522 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001523 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001524 int userId = data.readInt();
1525 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001526 reply.writeNoException();
1527 return true;
1528 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001529
1530 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1531 data.enforceInterface(IActivityManager.descriptor);
1532 killAllBackgroundProcesses();
1533 reply.writeNoException();
1534 return true;
1535 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001536
Dianne Hackborn03abb812010-01-04 18:43:19 -08001537 case FORCE_STOP_PACKAGE_TRANSACTION: {
1538 data.enforceInterface(IActivityManager.descriptor);
1539 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001540 int userId = data.readInt();
1541 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001542 reply.writeNoException();
1543 return true;
1544 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001545
1546 case GET_MY_MEMORY_STATE_TRANSACTION: {
1547 data.enforceInterface(IActivityManager.descriptor);
1548 ActivityManager.RunningAppProcessInfo info =
1549 new ActivityManager.RunningAppProcessInfo();
1550 getMyMemoryState(info);
1551 reply.writeNoException();
1552 info.writeToParcel(reply, 0);
1553 return true;
1554 }
1555
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001556 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1557 data.enforceInterface(IActivityManager.descriptor);
1558 ConfigurationInfo config = getDeviceConfigurationInfo();
1559 reply.writeNoException();
1560 config.writeToParcel(reply, 0);
1561 return true;
1562 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001563
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001564 case PROFILE_CONTROL_TRANSACTION: {
1565 data.enforceInterface(IActivityManager.descriptor);
1566 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001567 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001568 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001569 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001570 ProfilerInfo profilerInfo = data.readInt() != 0
1571 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1572 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001573 reply.writeNoException();
1574 reply.writeInt(res ? 1 : 0);
1575 return true;
1576 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001577
Dianne Hackborn55280a92009-05-07 15:53:46 -07001578 case SHUTDOWN_TRANSACTION: {
1579 data.enforceInterface(IActivityManager.descriptor);
1580 boolean res = shutdown(data.readInt());
1581 reply.writeNoException();
1582 reply.writeInt(res ? 1 : 0);
1583 return true;
1584 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001585
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001586 case STOP_APP_SWITCHES_TRANSACTION: {
1587 data.enforceInterface(IActivityManager.descriptor);
1588 stopAppSwitches();
1589 reply.writeNoException();
1590 return true;
1591 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001592
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001593 case RESUME_APP_SWITCHES_TRANSACTION: {
1594 data.enforceInterface(IActivityManager.descriptor);
1595 resumeAppSwitches();
1596 reply.writeNoException();
1597 return true;
1598 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001599
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001600 case PEEK_SERVICE_TRANSACTION: {
1601 data.enforceInterface(IActivityManager.descriptor);
1602 Intent service = Intent.CREATOR.createFromParcel(data);
1603 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001604 String callingPackage = data.readString();
1605 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001606 reply.writeNoException();
1607 reply.writeStrongBinder(binder);
1608 return true;
1609 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001610
Christopher Tate181fafa2009-05-14 11:12:14 -07001611 case START_BACKUP_AGENT_TRANSACTION: {
1612 data.enforceInterface(IActivityManager.descriptor);
1613 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1614 int backupRestoreMode = data.readInt();
1615 boolean success = bindBackupAgent(info, backupRestoreMode);
1616 reply.writeNoException();
1617 reply.writeInt(success ? 1 : 0);
1618 return true;
1619 }
1620
1621 case BACKUP_AGENT_CREATED_TRANSACTION: {
1622 data.enforceInterface(IActivityManager.descriptor);
1623 String packageName = data.readString();
1624 IBinder agent = data.readStrongBinder();
1625 backupAgentCreated(packageName, agent);
1626 reply.writeNoException();
1627 return true;
1628 }
1629
1630 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1631 data.enforceInterface(IActivityManager.descriptor);
1632 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1633 unbindBackupAgent(info);
1634 reply.writeNoException();
1635 return true;
1636 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001637
1638 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1639 data.enforceInterface(IActivityManager.descriptor);
1640 String packageName = data.readString();
1641 addPackageDependency(packageName);
1642 reply.writeNoException();
1643 return true;
1644 }
1645
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001646 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001647 data.enforceInterface(IActivityManager.descriptor);
1648 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001649 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001650 String reason = data.readString();
1651 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001652 reply.writeNoException();
1653 return true;
1654 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001655
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001656 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1657 data.enforceInterface(IActivityManager.descriptor);
1658 String reason = data.readString();
1659 closeSystemDialogs(reason);
1660 reply.writeNoException();
1661 return true;
1662 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001663
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001664 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1665 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001666 int[] pids = data.createIntArray();
1667 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001668 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001669 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001670 return true;
1671 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001672
1673 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1674 data.enforceInterface(IActivityManager.descriptor);
1675 String processName = data.readString();
1676 int uid = data.readInt();
1677 killApplicationProcess(processName, uid);
1678 reply.writeNoException();
1679 return true;
1680 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001681
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001682 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1683 data.enforceInterface(IActivityManager.descriptor);
1684 IBinder token = data.readStrongBinder();
1685 String packageName = data.readString();
1686 int enterAnim = data.readInt();
1687 int exitAnim = data.readInt();
1688 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001689 reply.writeNoException();
1690 return true;
1691 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001692
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001693 case IS_USER_A_MONKEY_TRANSACTION: {
1694 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001695 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001696 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001697 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001698 return true;
1699 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001700
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001701 case SET_USER_IS_MONKEY_TRANSACTION: {
1702 data.enforceInterface(IActivityManager.descriptor);
1703 final boolean monkey = (data.readInt() == 1);
1704 setUserIsMonkey(monkey);
1705 reply.writeNoException();
1706 return true;
1707 }
1708
Dianne Hackborn860755f2010-06-03 18:47:52 -07001709 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1710 data.enforceInterface(IActivityManager.descriptor);
1711 finishHeavyWeightApp();
1712 reply.writeNoException();
1713 return true;
1714 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001715
1716 case IS_IMMERSIVE_TRANSACTION: {
1717 data.enforceInterface(IActivityManager.descriptor);
1718 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001719 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001720 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001721 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001722 return true;
1723 }
1724
Craig Mautnerd61dc202014-07-07 11:09:11 -07001725 case IS_TOP_OF_TASK_TRANSACTION: {
1726 data.enforceInterface(IActivityManager.descriptor);
1727 IBinder token = data.readStrongBinder();
1728 final boolean isTopOfTask = isTopOfTask(token);
1729 reply.writeNoException();
1730 reply.writeInt(isTopOfTask ? 1 : 0);
1731 return true;
1732 }
1733
Craig Mautner5eda9b32013-07-02 11:58:16 -07001734 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001735 data.enforceInterface(IActivityManager.descriptor);
1736 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001737 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001738 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001739 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001740 return true;
1741 }
1742
1743 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1744 data.enforceInterface(IActivityManager.descriptor);
1745 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001746 final Bundle bundle;
1747 if (data.readInt() == 0) {
1748 bundle = null;
1749 } else {
1750 bundle = data.readBundle();
1751 }
1752 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1753 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001754 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001755 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001756 return true;
1757 }
1758
Craig Mautner233ceee2014-05-09 17:05:11 -07001759 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1760 data.enforceInterface(IActivityManager.descriptor);
1761 IBinder token = data.readStrongBinder();
1762 final ActivityOptions options = getActivityOptions(token);
1763 reply.writeNoException();
1764 reply.writeBundle(options == null ? null : options.toBundle());
1765 return true;
1766 }
1767
Daniel Sandler69a48172010-06-23 16:29:36 -04001768 case SET_IMMERSIVE_TRANSACTION: {
1769 data.enforceInterface(IActivityManager.descriptor);
1770 IBinder token = data.readStrongBinder();
1771 boolean imm = data.readInt() == 1;
1772 setImmersive(token, imm);
1773 reply.writeNoException();
1774 return true;
1775 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001776
Daniel Sandler69a48172010-06-23 16:29:36 -04001777 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1778 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001779 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001780 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001781 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001782 return true;
1783 }
1784
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001785 case CRASH_APPLICATION_TRANSACTION: {
1786 data.enforceInterface(IActivityManager.descriptor);
1787 int uid = data.readInt();
1788 int initialPid = data.readInt();
1789 String packageName = data.readString();
1790 String message = data.readString();
1791 crashApplication(uid, initialPid, packageName, message);
1792 reply.writeNoException();
1793 return true;
1794 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001795
1796 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1797 data.enforceInterface(IActivityManager.descriptor);
1798 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001799 int userId = data.readInt();
1800 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001801 reply.writeNoException();
1802 reply.writeString(type);
1803 return true;
1804 }
1805
Dianne Hackborn7e269642010-08-25 19:50:20 -07001806 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1807 data.enforceInterface(IActivityManager.descriptor);
1808 String name = data.readString();
1809 IBinder perm = newUriPermissionOwner(name);
1810 reply.writeNoException();
1811 reply.writeStrongBinder(perm);
1812 return true;
1813 }
1814
1815 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1816 data.enforceInterface(IActivityManager.descriptor);
1817 IBinder owner = data.readStrongBinder();
1818 int fromUid = data.readInt();
1819 String targetPkg = data.readString();
1820 Uri uri = Uri.CREATOR.createFromParcel(data);
1821 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001822 int sourceUserId = data.readInt();
1823 int targetUserId = data.readInt();
1824 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1825 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001826 reply.writeNoException();
1827 return true;
1828 }
1829
1830 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1831 data.enforceInterface(IActivityManager.descriptor);
1832 IBinder owner = data.readStrongBinder();
1833 Uri uri = null;
1834 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001835 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001836 }
1837 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001838 int userId = data.readInt();
1839 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001840 reply.writeNoException();
1841 return true;
1842 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001843
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001844 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1845 data.enforceInterface(IActivityManager.descriptor);
1846 int callingUid = data.readInt();
1847 String targetPkg = data.readString();
1848 Uri uri = Uri.CREATOR.createFromParcel(data);
1849 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001850 int userId = data.readInt();
1851 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001852 reply.writeNoException();
1853 reply.writeInt(res);
1854 return true;
1855 }
1856
Andy McFadden824c5102010-07-09 16:26:57 -07001857 case DUMP_HEAP_TRANSACTION: {
1858 data.enforceInterface(IActivityManager.descriptor);
1859 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001860 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001861 boolean managed = data.readInt() != 0;
1862 String path = data.readString();
1863 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001864 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001865 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001866 reply.writeNoException();
1867 reply.writeInt(res ? 1 : 0);
1868 return true;
1869 }
1870
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001871 case START_ACTIVITIES_TRANSACTION:
1872 {
1873 data.enforceInterface(IActivityManager.descriptor);
1874 IBinder b = data.readStrongBinder();
1875 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001876 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001877 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1878 String[] resolvedTypes = data.createStringArray();
1879 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001880 Bundle options = data.readInt() != 0
1881 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001882 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001883 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001884 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001885 reply.writeNoException();
1886 reply.writeInt(result);
1887 return true;
1888 }
1889
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001890 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1891 {
1892 data.enforceInterface(IActivityManager.descriptor);
1893 int mode = getFrontActivityScreenCompatMode();
1894 reply.writeNoException();
1895 reply.writeInt(mode);
1896 return true;
1897 }
1898
1899 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1900 {
1901 data.enforceInterface(IActivityManager.descriptor);
1902 int mode = data.readInt();
1903 setFrontActivityScreenCompatMode(mode);
1904 reply.writeNoException();
1905 reply.writeInt(mode);
1906 return true;
1907 }
1908
1909 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1910 {
1911 data.enforceInterface(IActivityManager.descriptor);
1912 String pkg = data.readString();
1913 int mode = getPackageScreenCompatMode(pkg);
1914 reply.writeNoException();
1915 reply.writeInt(mode);
1916 return true;
1917 }
1918
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001919 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1920 {
1921 data.enforceInterface(IActivityManager.descriptor);
1922 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001923 int mode = data.readInt();
1924 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001925 reply.writeNoException();
1926 return true;
1927 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001928
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001929 case SWITCH_USER_TRANSACTION: {
1930 data.enforceInterface(IActivityManager.descriptor);
1931 int userid = data.readInt();
1932 boolean result = switchUser(userid);
1933 reply.writeNoException();
1934 reply.writeInt(result ? 1 : 0);
1935 return true;
1936 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001937
Kenny Guy08488bf2014-02-21 17:40:37 +00001938 case START_USER_IN_BACKGROUND_TRANSACTION: {
1939 data.enforceInterface(IActivityManager.descriptor);
1940 int userid = data.readInt();
1941 boolean result = startUserInBackground(userid);
1942 reply.writeNoException();
1943 reply.writeInt(result ? 1 : 0);
1944 return true;
1945 }
1946
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001947 case STOP_USER_TRANSACTION: {
1948 data.enforceInterface(IActivityManager.descriptor);
1949 int userid = data.readInt();
1950 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1951 data.readStrongBinder());
1952 int result = stopUser(userid, callback);
1953 reply.writeNoException();
1954 reply.writeInt(result);
1955 return true;
1956 }
1957
Amith Yamasani52f1d752012-03-28 18:19:29 -07001958 case GET_CURRENT_USER_TRANSACTION: {
1959 data.enforceInterface(IActivityManager.descriptor);
1960 UserInfo userInfo = getCurrentUser();
1961 reply.writeNoException();
1962 userInfo.writeToParcel(reply, 0);
1963 return true;
1964 }
1965
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001966 case IS_USER_RUNNING_TRANSACTION: {
1967 data.enforceInterface(IActivityManager.descriptor);
1968 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001969 boolean orStopping = data.readInt() != 0;
1970 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001971 reply.writeNoException();
1972 reply.writeInt(result ? 1 : 0);
1973 return true;
1974 }
1975
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001976 case GET_RUNNING_USER_IDS_TRANSACTION: {
1977 data.enforceInterface(IActivityManager.descriptor);
1978 int[] result = getRunningUserIds();
1979 reply.writeNoException();
1980 reply.writeIntArray(result);
1981 return true;
1982 }
1983
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001984 case REMOVE_TASK_TRANSACTION:
1985 {
1986 data.enforceInterface(IActivityManager.descriptor);
1987 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001988 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001989 reply.writeNoException();
1990 reply.writeInt(result ? 1 : 0);
1991 return true;
1992 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001993
Jeff Sharkeya4620792011-05-20 15:29:23 -07001994 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1995 data.enforceInterface(IActivityManager.descriptor);
1996 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1997 data.readStrongBinder());
1998 registerProcessObserver(observer);
1999 return true;
2000 }
2001
2002 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2003 data.enforceInterface(IActivityManager.descriptor);
2004 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2005 data.readStrongBinder());
2006 unregisterProcessObserver(observer);
2007 return true;
2008 }
2009
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002010 case REGISTER_UID_OBSERVER_TRANSACTION: {
2011 data.enforceInterface(IActivityManager.descriptor);
2012 IUidObserver observer = IUidObserver.Stub.asInterface(
2013 data.readStrongBinder());
2014 registerUidObserver(observer);
2015 return true;
2016 }
2017
2018 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2019 data.enforceInterface(IActivityManager.descriptor);
2020 IUidObserver observer = IUidObserver.Stub.asInterface(
2021 data.readStrongBinder());
2022 unregisterUidObserver(observer);
2023 return true;
2024 }
2025
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002026 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2027 {
2028 data.enforceInterface(IActivityManager.descriptor);
2029 String pkg = data.readString();
2030 boolean ask = getPackageAskScreenCompat(pkg);
2031 reply.writeNoException();
2032 reply.writeInt(ask ? 1 : 0);
2033 return true;
2034 }
2035
2036 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2037 {
2038 data.enforceInterface(IActivityManager.descriptor);
2039 String pkg = data.readString();
2040 boolean ask = data.readInt() != 0;
2041 setPackageAskScreenCompat(pkg, ask);
2042 reply.writeNoException();
2043 return true;
2044 }
2045
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002046 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2047 data.enforceInterface(IActivityManager.descriptor);
2048 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002049 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002050 boolean res = isIntentSenderTargetedToPackage(r);
2051 reply.writeNoException();
2052 reply.writeInt(res ? 1 : 0);
2053 return true;
2054 }
2055
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002056 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2057 data.enforceInterface(IActivityManager.descriptor);
2058 IIntentSender r = IIntentSender.Stub.asInterface(
2059 data.readStrongBinder());
2060 boolean res = isIntentSenderAnActivity(r);
2061 reply.writeNoException();
2062 reply.writeInt(res ? 1 : 0);
2063 return true;
2064 }
2065
Dianne Hackborn81038902012-11-26 17:04:09 -08002066 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2067 data.enforceInterface(IActivityManager.descriptor);
2068 IIntentSender r = IIntentSender.Stub.asInterface(
2069 data.readStrongBinder());
2070 Intent intent = getIntentForIntentSender(r);
2071 reply.writeNoException();
2072 if (intent != null) {
2073 reply.writeInt(1);
2074 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2075 } else {
2076 reply.writeInt(0);
2077 }
2078 return true;
2079 }
2080
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002081 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2082 data.enforceInterface(IActivityManager.descriptor);
2083 IIntentSender r = IIntentSender.Stub.asInterface(
2084 data.readStrongBinder());
2085 String prefix = data.readString();
2086 String tag = getTagForIntentSender(r, prefix);
2087 reply.writeNoException();
2088 reply.writeString(tag);
2089 return true;
2090 }
2091
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002092 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2093 data.enforceInterface(IActivityManager.descriptor);
2094 Configuration config = Configuration.CREATOR.createFromParcel(data);
2095 updatePersistentConfiguration(config);
2096 reply.writeNoException();
2097 return true;
2098 }
2099
Dianne Hackbornb437e092011-08-05 17:50:29 -07002100 case GET_PROCESS_PSS_TRANSACTION: {
2101 data.enforceInterface(IActivityManager.descriptor);
2102 int[] pids = data.createIntArray();
2103 long[] pss = getProcessPss(pids);
2104 reply.writeNoException();
2105 reply.writeLongArray(pss);
2106 return true;
2107 }
2108
Dianne Hackborn661cd522011-08-22 00:26:20 -07002109 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2110 data.enforceInterface(IActivityManager.descriptor);
2111 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2112 boolean always = data.readInt() != 0;
2113 showBootMessage(msg, always);
2114 reply.writeNoException();
2115 return true;
2116 }
2117
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002118 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002119 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002120 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002121 reply.writeNoException();
2122 return true;
2123 }
2124
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002125 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2126 data.enforceInterface(IActivityManager.descriptor);
2127 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2128 reply.writeNoException();
2129 return true;
2130 }
2131
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002132 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002133 data.enforceInterface(IActivityManager.descriptor);
2134 IBinder token = data.readStrongBinder();
2135 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002136 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002137 reply.writeNoException();
2138 reply.writeInt(res ? 1 : 0);
2139 return true;
2140 }
2141
2142 case NAVIGATE_UP_TO_TRANSACTION: {
2143 data.enforceInterface(IActivityManager.descriptor);
2144 IBinder token = data.readStrongBinder();
2145 Intent target = Intent.CREATOR.createFromParcel(data);
2146 int resultCode = data.readInt();
2147 Intent resultData = null;
2148 if (data.readInt() != 0) {
2149 resultData = Intent.CREATOR.createFromParcel(data);
2150 }
2151 boolean res = navigateUpTo(token, target, resultCode, resultData);
2152 reply.writeNoException();
2153 reply.writeInt(res ? 1 : 0);
2154 return true;
2155 }
2156
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002157 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2158 data.enforceInterface(IActivityManager.descriptor);
2159 IBinder token = data.readStrongBinder();
2160 int res = getLaunchedFromUid(token);
2161 reply.writeNoException();
2162 reply.writeInt(res);
2163 return true;
2164 }
2165
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002166 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2167 data.enforceInterface(IActivityManager.descriptor);
2168 IBinder token = data.readStrongBinder();
2169 String res = getLaunchedFromPackage(token);
2170 reply.writeNoException();
2171 reply.writeString(res);
2172 return true;
2173 }
2174
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002175 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2176 data.enforceInterface(IActivityManager.descriptor);
2177 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2178 data.readStrongBinder());
2179 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002180 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002181 return true;
2182 }
2183
2184 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2185 data.enforceInterface(IActivityManager.descriptor);
2186 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2187 data.readStrongBinder());
2188 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002189 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002190 return true;
2191 }
2192
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002193 case REQUEST_BUG_REPORT_TRANSACTION: {
2194 data.enforceInterface(IActivityManager.descriptor);
2195 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002196 reply.writeNoException();
2197 return true;
2198 }
2199
2200 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2201 data.enforceInterface(IActivityManager.descriptor);
2202 int pid = data.readInt();
2203 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002204 String reason = data.readString();
2205 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002206 reply.writeNoException();
2207 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002208 return true;
2209 }
2210
Adam Skorydfc7fd72013-08-05 19:23:41 -07002211 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002212 data.enforceInterface(IActivityManager.descriptor);
2213 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002214 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002215 reply.writeNoException();
2216 reply.writeBundle(res);
2217 return true;
2218 }
2219
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002220 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2221 data.enforceInterface(IActivityManager.descriptor);
2222 int requestType = data.readInt();
2223 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002224 IBinder activityToken = data.readStrongBinder();
2225 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002226 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002227 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002228 return true;
2229 }
2230
Adam Skorydfc7fd72013-08-05 19:23:41 -07002231 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002232 data.enforceInterface(IActivityManager.descriptor);
2233 IBinder token = data.readStrongBinder();
2234 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002235 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2236 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002237 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2238 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002239 reply.writeNoException();
2240 return true;
2241 }
2242
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002243 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2244 data.enforceInterface(IActivityManager.descriptor);
2245 Intent intent = Intent.CREATOR.createFromParcel(data);
2246 int requestType = data.readInt();
2247 String hint = data.readString();
2248 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002249 Bundle args = data.readBundle();
2250 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002251 reply.writeNoException();
2252 reply.writeInt(res ? 1 : 0);
2253 return true;
2254 }
2255
Benjamin Franzc200f442015-06-25 18:20:04 +01002256 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2257 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002258 boolean res = isAssistDataAllowedOnCurrentActivity();
2259 reply.writeNoException();
2260 reply.writeInt(res ? 1 : 0);
2261 return true;
2262 }
2263
2264 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2265 data.enforceInterface(IActivityManager.descriptor);
2266 IBinder token = data.readStrongBinder();
2267 Bundle args = data.readBundle();
2268 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002269 reply.writeNoException();
2270 reply.writeInt(res ? 1 : 0);
2271 return true;
2272 }
2273
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002274 case KILL_UID_TRANSACTION: {
2275 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002276 int appId = data.readInt();
2277 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002278 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002279 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002280 reply.writeNoException();
2281 return true;
2282 }
2283
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002284 case HANG_TRANSACTION: {
2285 data.enforceInterface(IActivityManager.descriptor);
2286 IBinder who = data.readStrongBinder();
2287 boolean allowRestart = data.readInt() != 0;
2288 hang(who, allowRestart);
2289 reply.writeNoException();
2290 return true;
2291 }
2292
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002293 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2294 data.enforceInterface(IActivityManager.descriptor);
2295 IBinder token = data.readStrongBinder();
2296 reportActivityFullyDrawn(token);
2297 reply.writeNoException();
2298 return true;
2299 }
2300
Craig Mautner5eda9b32013-07-02 11:58:16 -07002301 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2302 data.enforceInterface(IActivityManager.descriptor);
2303 IBinder token = data.readStrongBinder();
2304 notifyActivityDrawn(token);
2305 reply.writeNoException();
2306 return true;
2307 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002308
2309 case RESTART_TRANSACTION: {
2310 data.enforceInterface(IActivityManager.descriptor);
2311 restart();
2312 reply.writeNoException();
2313 return true;
2314 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002315
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002316 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2317 data.enforceInterface(IActivityManager.descriptor);
2318 performIdleMaintenance();
2319 reply.writeNoException();
2320 return true;
2321 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002322
Todd Kennedyca4d8422015-01-15 15:19:22 -08002323 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002324 data.enforceInterface(IActivityManager.descriptor);
2325 IBinder parentActivityToken = data.readStrongBinder();
2326 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002327 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002328 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002329 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002330 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002331 if (activityContainer != null) {
2332 reply.writeInt(1);
2333 reply.writeStrongBinder(activityContainer.asBinder());
2334 } else {
2335 reply.writeInt(0);
2336 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002337 return true;
2338 }
2339
Craig Mautner95da1082014-02-24 17:54:35 -08002340 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2341 data.enforceInterface(IActivityManager.descriptor);
2342 IActivityContainer activityContainer =
2343 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2344 deleteActivityContainer(activityContainer);
2345 reply.writeNoException();
2346 return true;
2347 }
2348
Todd Kennedy4900bf92015-01-16 16:05:14 -08002349 case CREATE_STACK_ON_DISPLAY: {
2350 data.enforceInterface(IActivityManager.descriptor);
2351 int displayId = data.readInt();
2352 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2353 reply.writeNoException();
2354 if (activityContainer != null) {
2355 reply.writeInt(1);
2356 reply.writeStrongBinder(activityContainer.asBinder());
2357 } else {
2358 reply.writeInt(0);
2359 }
2360 return true;
2361 }
2362
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002363 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002364 data.enforceInterface(IActivityManager.descriptor);
2365 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002366 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002367 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002368 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002369 return true;
2370 }
2371
Craig Mautneraea74a52014-03-08 14:23:10 -08002372 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2373 data.enforceInterface(IActivityManager.descriptor);
2374 final int taskId = data.readInt();
2375 startLockTaskMode(taskId);
2376 reply.writeNoException();
2377 return true;
2378 }
2379
2380 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2381 data.enforceInterface(IActivityManager.descriptor);
2382 IBinder token = data.readStrongBinder();
2383 startLockTaskMode(token);
2384 reply.writeNoException();
2385 return true;
2386 }
2387
Craig Mautnerd61dc202014-07-07 11:09:11 -07002388 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002389 data.enforceInterface(IActivityManager.descriptor);
2390 startLockTaskModeOnCurrent();
2391 reply.writeNoException();
2392 return true;
2393 }
2394
Craig Mautneraea74a52014-03-08 14:23:10 -08002395 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2396 data.enforceInterface(IActivityManager.descriptor);
2397 stopLockTaskMode();
2398 reply.writeNoException();
2399 return true;
2400 }
2401
Craig Mautnerd61dc202014-07-07 11:09:11 -07002402 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002403 data.enforceInterface(IActivityManager.descriptor);
2404 stopLockTaskModeOnCurrent();
2405 reply.writeNoException();
2406 return true;
2407 }
2408
Craig Mautneraea74a52014-03-08 14:23:10 -08002409 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2410 data.enforceInterface(IActivityManager.descriptor);
2411 final boolean isInLockTaskMode = isInLockTaskMode();
2412 reply.writeNoException();
2413 reply.writeInt(isInLockTaskMode ? 1 : 0);
2414 return true;
2415 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002416
Benjamin Franz43261142015-02-11 15:59:44 +00002417 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2418 data.enforceInterface(IActivityManager.descriptor);
2419 final int lockTaskModeState = getLockTaskModeState();
2420 reply.writeNoException();
2421 reply.writeInt(lockTaskModeState);
2422 return true;
2423 }
2424
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002425 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2426 data.enforceInterface(IActivityManager.descriptor);
2427 final IBinder token = data.readStrongBinder();
2428 showLockTaskEscapeMessage(token);
2429 reply.writeNoException();
2430 return true;
2431 }
2432
Winson Chunga449dc02014-05-16 11:15:04 -07002433 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002434 data.enforceInterface(IActivityManager.descriptor);
2435 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002436 ActivityManager.TaskDescription values =
2437 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2438 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002439 reply.writeNoException();
2440 return true;
2441 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002442
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002443 case SET_TASK_RESIZEABLE_TRANSACTION: {
2444 data.enforceInterface(IActivityManager.descriptor);
2445 int taskId = data.readInt();
2446 boolean resizeable = (data.readInt() == 1) ? true : false;
2447 setTaskResizeable(taskId, resizeable);
2448 reply.writeNoException();
2449 return true;
2450 }
2451
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002452 case RESIZE_TASK_TRANSACTION: {
2453 data.enforceInterface(IActivityManager.descriptor);
2454 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002455 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002456 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002457 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002458 reply.writeNoException();
2459 return true;
2460 }
2461
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002462 case GET_TASK_BOUNDS_TRANSACTION: {
2463 data.enforceInterface(IActivityManager.descriptor);
2464 int taskId = data.readInt();
2465 Rect r = getTaskBounds(taskId);
2466 reply.writeNoException();
2467 r.writeToParcel(reply, 0);
2468 return true;
2469 }
2470
Craig Mautner648f69b2014-09-18 14:16:26 -07002471 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2472 data.enforceInterface(IActivityManager.descriptor);
2473 String filename = data.readString();
2474 Bitmap icon = getTaskDescriptionIcon(filename);
2475 reply.writeNoException();
2476 if (icon == null) {
2477 reply.writeInt(0);
2478 } else {
2479 reply.writeInt(1);
2480 icon.writeToParcel(reply, 0);
2481 }
2482 return true;
2483 }
2484
Winson Chung044d5292014-11-06 11:05:19 -08002485 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2486 data.enforceInterface(IActivityManager.descriptor);
2487 final Bundle bundle;
2488 if (data.readInt() == 0) {
2489 bundle = null;
2490 } else {
2491 bundle = data.readBundle();
2492 }
2493 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2494 startInPlaceAnimationOnFrontMostApplication(options);
2495 reply.writeNoException();
2496 return true;
2497 }
2498
Jose Lima4b6c6692014-08-12 17:41:12 -07002499 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002500 data.enforceInterface(IActivityManager.descriptor);
2501 IBinder token = data.readStrongBinder();
2502 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002503 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002504 reply.writeNoException();
2505 reply.writeInt(success ? 1 : 0);
2506 return true;
2507 }
2508
Jose Lima4b6c6692014-08-12 17:41:12 -07002509 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002510 data.enforceInterface(IActivityManager.descriptor);
2511 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002512 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002513 reply.writeNoException();
2514 reply.writeInt(enabled ? 1 : 0);
2515 return true;
2516 }
2517
Jose Lima4b6c6692014-08-12 17:41:12 -07002518 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002519 data.enforceInterface(IActivityManager.descriptor);
2520 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002521 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002522 reply.writeNoException();
2523 return true;
2524 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002525
2526 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2527 data.enforceInterface(IActivityManager.descriptor);
2528 IBinder token = data.readStrongBinder();
2529 notifyLaunchTaskBehindComplete(token);
2530 reply.writeNoException();
2531 return true;
2532 }
Craig Mautner8746a472014-07-24 15:12:54 -07002533
2534 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2535 data.enforceInterface(IActivityManager.descriptor);
2536 IBinder token = data.readStrongBinder();
2537 notifyEnterAnimationComplete(token);
2538 reply.writeNoException();
2539 return true;
2540 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002541
2542 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2543 data.enforceInterface(IActivityManager.descriptor);
2544 bootAnimationComplete();
2545 reply.writeNoException();
2546 return true;
2547 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002548
Jeff Sharkey605eb792014-11-04 13:34:06 -08002549 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2550 data.enforceInterface(IActivityManager.descriptor);
2551 final int uid = data.readInt();
2552 final byte[] firstPacket = data.createByteArray();
2553 notifyCleartextNetwork(uid, firstPacket);
2554 reply.writeNoException();
2555 return true;
2556 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002557
2558 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2559 data.enforceInterface(IActivityManager.descriptor);
2560 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002561 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002562 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002563 String reportPackage = data.readString();
2564 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002565 reply.writeNoException();
2566 return true;
2567 }
2568
2569 case DUMP_HEAP_FINISHED_TRANSACTION: {
2570 data.enforceInterface(IActivityManager.descriptor);
2571 String path = data.readString();
2572 dumpHeapFinished(path);
2573 reply.writeNoException();
2574 return true;
2575 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002576
2577 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2578 data.enforceInterface(IActivityManager.descriptor);
2579 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2580 data.readStrongBinder());
2581 boolean keepAwake = data.readInt() != 0;
2582 setVoiceKeepAwake(session, keepAwake);
2583 reply.writeNoException();
2584 return true;
2585 }
Craig Mautnere5600772015-04-03 21:36:37 -07002586
2587 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2588 data.enforceInterface(IActivityManager.descriptor);
2589 int userId = data.readInt();
2590 String[] packages = data.readStringArray();
2591 updateLockTaskPackages(userId, packages);
2592 reply.writeNoException();
2593 return true;
2594 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002595
Craig Mautner015c5e52015-04-23 10:39:39 -07002596 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2597 data.enforceInterface(IActivityManager.descriptor);
2598 String packageName = data.readString();
2599 updateDeviceOwner(packageName);
2600 reply.writeNoException();
2601 return true;
2602 }
2603
Dianne Hackborn1e383822015-04-10 14:02:33 -07002604 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2605 data.enforceInterface(IActivityManager.descriptor);
2606 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002607 String callingPackage = data.readString();
2608 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002609 reply.writeNoException();
2610 reply.writeInt(res);
2611 return true;
2612 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002613
2614 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2615 data.enforceInterface(IActivityManager.descriptor);
2616 String process = data.readString();
2617 int userId = data.readInt();
2618 int level = data.readInt();
2619 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2620 reply.writeNoException();
2621 reply.writeInt(res ? 1 : 0);
2622 return true;
2623 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002624
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002625 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2626 data.enforceInterface(IActivityManager.descriptor);
2627 IBinder token = data.readStrongBinder();
2628 boolean res = isRootVoiceInteraction(token);
2629 reply.writeNoException();
2630 reply.writeInt(res ? 1 : 0);
2631 return true;
2632 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002633
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002634 case START_BINDER_TRACKING_TRANSACTION: {
2635 data.enforceInterface(IActivityManager.descriptor);
2636 boolean res = startBinderTracking();
2637 reply.writeNoException();
2638 reply.writeInt(res ? 1 : 0);
2639 return true;
2640 }
2641
2642 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2643 data.enforceInterface(IActivityManager.descriptor);
2644 ParcelFileDescriptor fd = data.readInt() != 0
2645 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2646 boolean res = stopBinderTrackingAndDump(fd);
2647 reply.writeNoException();
2648 reply.writeInt(res ? 1 : 0);
2649 return true;
2650 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002651 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2652 data.enforceInterface(IActivityManager.descriptor);
2653 IBinder token = data.readStrongBinder();
2654 int stackId = getActivityStackId(token);
2655 reply.writeNoException();
2656 reply.writeInt(stackId);
2657 return true;
2658 }
2659 case MOVE_ACTIVITY_TO_STACK_TRANSACTION: {
2660 data.enforceInterface(IActivityManager.descriptor);
2661 IBinder token = data.readStrongBinder();
2662 int stackId = data.readInt();
2663 moveActivityToStack(token, stackId);
2664 reply.writeNoException();
2665 return true;
2666 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002667 case REPORT_SIZE_CONFIGURATIONS: {
2668 data.enforceInterface(IActivityManager.descriptor);
2669 IBinder token = data.readStrongBinder();
2670 int horizontalSize = data.readInt();
2671 int[] horizontal = null;
2672 if (horizontalSize > 0) {
2673 horizontal = new int[horizontalSize];
2674 data.readIntArray(horizontal);
2675 }
2676 int[] vertical = null;
2677 int verticalSize = data.readInt();
2678 if (verticalSize > 0) {
2679 vertical = new int[verticalSize];
2680 data.readIntArray(vertical);
2681 }
2682 reportSizeConfigurations(token, horizontal, vertical);
2683 return true;
2684 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002685 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002686
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002687 return super.onTransact(code, data, reply, flags);
2688 }
2689
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002690 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002691 return this;
2692 }
2693
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002694 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2695 protected IActivityManager create() {
2696 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002697 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002698 Log.v("ActivityManager", "default service binder = " + b);
2699 }
2700 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002701 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002702 Log.v("ActivityManager", "default service = " + am);
2703 }
2704 return am;
2705 }
2706 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002707}
2708
2709class ActivityManagerProxy implements IActivityManager
2710{
2711 public ActivityManagerProxy(IBinder remote)
2712 {
2713 mRemote = remote;
2714 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002715
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002716 public IBinder asBinder()
2717 {
2718 return mRemote;
2719 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002720
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002721 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002722 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002723 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002724 Parcel data = Parcel.obtain();
2725 Parcel reply = Parcel.obtain();
2726 data.writeInterfaceToken(IActivityManager.descriptor);
2727 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002728 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002729 intent.writeToParcel(data, 0);
2730 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002731 data.writeStrongBinder(resultTo);
2732 data.writeString(resultWho);
2733 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002734 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002735 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002736 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002737 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002738 } else {
2739 data.writeInt(0);
2740 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002741 if (options != null) {
2742 data.writeInt(1);
2743 options.writeToParcel(data, 0);
2744 } else {
2745 data.writeInt(0);
2746 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002747 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2748 reply.readException();
2749 int result = reply.readInt();
2750 reply.recycle();
2751 data.recycle();
2752 return result;
2753 }
Amith Yamasani82644082012-08-03 13:09:11 -07002754
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002755 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002756 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002757 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2758 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002759 Parcel data = Parcel.obtain();
2760 Parcel reply = Parcel.obtain();
2761 data.writeInterfaceToken(IActivityManager.descriptor);
2762 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002763 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002764 intent.writeToParcel(data, 0);
2765 data.writeString(resolvedType);
2766 data.writeStrongBinder(resultTo);
2767 data.writeString(resultWho);
2768 data.writeInt(requestCode);
2769 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002770 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002771 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002772 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002773 } else {
2774 data.writeInt(0);
2775 }
2776 if (options != null) {
2777 data.writeInt(1);
2778 options.writeToParcel(data, 0);
2779 } else {
2780 data.writeInt(0);
2781 }
2782 data.writeInt(userId);
2783 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2784 reply.readException();
2785 int result = reply.readInt();
2786 reply.recycle();
2787 data.recycle();
2788 return result;
2789 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002790 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2791 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002792 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2793 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002794 Parcel data = Parcel.obtain();
2795 Parcel reply = Parcel.obtain();
2796 data.writeInterfaceToken(IActivityManager.descriptor);
2797 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2798 data.writeString(callingPackage);
2799 intent.writeToParcel(data, 0);
2800 data.writeString(resolvedType);
2801 data.writeStrongBinder(resultTo);
2802 data.writeString(resultWho);
2803 data.writeInt(requestCode);
2804 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002805 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002806 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002807 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002808 } else {
2809 data.writeInt(0);
2810 }
2811 if (options != null) {
2812 data.writeInt(1);
2813 options.writeToParcel(data, 0);
2814 } else {
2815 data.writeInt(0);
2816 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002817 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002818 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002819 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2820 reply.readException();
2821 int result = reply.readInt();
2822 reply.recycle();
2823 data.recycle();
2824 return result;
2825 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002826 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2827 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002828 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2829 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002830 Parcel data = Parcel.obtain();
2831 Parcel reply = Parcel.obtain();
2832 data.writeInterfaceToken(IActivityManager.descriptor);
2833 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002834 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002835 intent.writeToParcel(data, 0);
2836 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002837 data.writeStrongBinder(resultTo);
2838 data.writeString(resultWho);
2839 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002840 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002841 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002842 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002843 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002844 } else {
2845 data.writeInt(0);
2846 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002847 if (options != null) {
2848 data.writeInt(1);
2849 options.writeToParcel(data, 0);
2850 } else {
2851 data.writeInt(0);
2852 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002853 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002854 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2855 reply.readException();
2856 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2857 reply.recycle();
2858 data.recycle();
2859 return result;
2860 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002861 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2862 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002863 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002864 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002865 Parcel data = Parcel.obtain();
2866 Parcel reply = Parcel.obtain();
2867 data.writeInterfaceToken(IActivityManager.descriptor);
2868 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002869 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002870 intent.writeToParcel(data, 0);
2871 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002872 data.writeStrongBinder(resultTo);
2873 data.writeString(resultWho);
2874 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002875 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002876 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002877 if (options != null) {
2878 data.writeInt(1);
2879 options.writeToParcel(data, 0);
2880 } else {
2881 data.writeInt(0);
2882 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002883 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002884 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2885 reply.readException();
2886 int result = reply.readInt();
2887 reply.recycle();
2888 data.recycle();
2889 return result;
2890 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002891 public int startActivityIntentSender(IApplicationThread caller,
2892 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002893 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002894 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002895 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 if (fillInIntent != null) {
2901 data.writeInt(1);
2902 fillInIntent.writeToParcel(data, 0);
2903 } else {
2904 data.writeInt(0);
2905 }
2906 data.writeString(resolvedType);
2907 data.writeStrongBinder(resultTo);
2908 data.writeString(resultWho);
2909 data.writeInt(requestCode);
2910 data.writeInt(flagsMask);
2911 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002912 if (options != null) {
2913 data.writeInt(1);
2914 options.writeToParcel(data, 0);
2915 } else {
2916 data.writeInt(0);
2917 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002918 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002919 reply.readException();
2920 int result = reply.readInt();
2921 reply.recycle();
2922 data.recycle();
2923 return result;
2924 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002925 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2926 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002927 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2928 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002929 Parcel data = Parcel.obtain();
2930 Parcel reply = Parcel.obtain();
2931 data.writeInterfaceToken(IActivityManager.descriptor);
2932 data.writeString(callingPackage);
2933 data.writeInt(callingPid);
2934 data.writeInt(callingUid);
2935 intent.writeToParcel(data, 0);
2936 data.writeString(resolvedType);
2937 data.writeStrongBinder(session.asBinder());
2938 data.writeStrongBinder(interactor.asBinder());
2939 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002940 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002941 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002942 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002943 } else {
2944 data.writeInt(0);
2945 }
2946 if (options != null) {
2947 data.writeInt(1);
2948 options.writeToParcel(data, 0);
2949 } else {
2950 data.writeInt(0);
2951 }
2952 data.writeInt(userId);
2953 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2954 reply.readException();
2955 int result = reply.readInt();
2956 reply.recycle();
2957 data.recycle();
2958 return result;
2959 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002960 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002961 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002962 Parcel data = Parcel.obtain();
2963 Parcel reply = Parcel.obtain();
2964 data.writeInterfaceToken(IActivityManager.descriptor);
2965 data.writeStrongBinder(callingActivity);
2966 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002967 if (options != null) {
2968 data.writeInt(1);
2969 options.writeToParcel(data, 0);
2970 } else {
2971 data.writeInt(0);
2972 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002973 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2974 reply.readException();
2975 int result = reply.readInt();
2976 reply.recycle();
2977 data.recycle();
2978 return result != 0;
2979 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002980 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2981 Parcel data = Parcel.obtain();
2982 Parcel reply = Parcel.obtain();
2983 data.writeInterfaceToken(IActivityManager.descriptor);
2984 data.writeInt(taskId);
2985 if (options == null) {
2986 data.writeInt(0);
2987 } else {
2988 data.writeInt(1);
2989 options.writeToParcel(data, 0);
2990 }
2991 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2992 reply.readException();
2993 int result = reply.readInt();
2994 reply.recycle();
2995 data.recycle();
2996 return result;
2997 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07002998 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002999 throws RemoteException {
3000 Parcel data = Parcel.obtain();
3001 Parcel reply = Parcel.obtain();
3002 data.writeInterfaceToken(IActivityManager.descriptor);
3003 data.writeStrongBinder(token);
3004 data.writeInt(resultCode);
3005 if (resultData != null) {
3006 data.writeInt(1);
3007 resultData.writeToParcel(data, 0);
3008 } else {
3009 data.writeInt(0);
3010 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003011 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003012 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3013 reply.readException();
3014 boolean res = reply.readInt() != 0;
3015 data.recycle();
3016 reply.recycle();
3017 return res;
3018 }
3019 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3020 {
3021 Parcel data = Parcel.obtain();
3022 Parcel reply = Parcel.obtain();
3023 data.writeInterfaceToken(IActivityManager.descriptor);
3024 data.writeStrongBinder(token);
3025 data.writeString(resultWho);
3026 data.writeInt(requestCode);
3027 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3028 reply.readException();
3029 data.recycle();
3030 reply.recycle();
3031 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003032 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3033 Parcel data = Parcel.obtain();
3034 Parcel reply = Parcel.obtain();
3035 data.writeInterfaceToken(IActivityManager.descriptor);
3036 data.writeStrongBinder(token);
3037 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3038 reply.readException();
3039 boolean res = reply.readInt() != 0;
3040 data.recycle();
3041 reply.recycle();
3042 return res;
3043 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003044 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3045 Parcel data = Parcel.obtain();
3046 Parcel reply = Parcel.obtain();
3047 data.writeInterfaceToken(IActivityManager.descriptor);
3048 data.writeStrongBinder(session.asBinder());
3049 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3050 reply.readException();
3051 data.recycle();
3052 reply.recycle();
3053 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003054 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3055 Parcel data = Parcel.obtain();
3056 Parcel reply = Parcel.obtain();
3057 data.writeInterfaceToken(IActivityManager.descriptor);
3058 data.writeStrongBinder(token);
3059 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3060 reply.readException();
3061 boolean res = reply.readInt() != 0;
3062 data.recycle();
3063 reply.recycle();
3064 return res;
3065 }
3066 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3067 Parcel data = Parcel.obtain();
3068 Parcel reply = Parcel.obtain();
3069 data.writeInterfaceToken(IActivityManager.descriptor);
3070 data.writeStrongBinder(app.asBinder());
3071 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3072 reply.readException();
3073 data.recycle();
3074 reply.recycle();
3075 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003076 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3077 Parcel data = Parcel.obtain();
3078 Parcel reply = Parcel.obtain();
3079 data.writeInterfaceToken(IActivityManager.descriptor);
3080 data.writeStrongBinder(token);
3081 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3082 reply.readException();
3083 boolean res = reply.readInt() != 0;
3084 data.recycle();
3085 reply.recycle();
3086 return res;
3087 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003088 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003089 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003090 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003091 {
3092 Parcel data = Parcel.obtain();
3093 Parcel reply = Parcel.obtain();
3094 data.writeInterfaceToken(IActivityManager.descriptor);
3095 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003096 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003097 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3098 filter.writeToParcel(data, 0);
3099 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003100 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003101 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3102 reply.readException();
3103 Intent intent = null;
3104 int haveIntent = reply.readInt();
3105 if (haveIntent != 0) {
3106 intent = Intent.CREATOR.createFromParcel(reply);
3107 }
3108 reply.recycle();
3109 data.recycle();
3110 return intent;
3111 }
3112 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3113 {
3114 Parcel data = Parcel.obtain();
3115 Parcel reply = Parcel.obtain();
3116 data.writeInterfaceToken(IActivityManager.descriptor);
3117 data.writeStrongBinder(receiver.asBinder());
3118 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3119 reply.readException();
3120 data.recycle();
3121 reply.recycle();
3122 }
3123 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003124 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003125 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003126 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003127 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003128 {
3129 Parcel data = Parcel.obtain();
3130 Parcel reply = Parcel.obtain();
3131 data.writeInterfaceToken(IActivityManager.descriptor);
3132 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3133 intent.writeToParcel(data, 0);
3134 data.writeString(resolvedType);
3135 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3136 data.writeInt(resultCode);
3137 data.writeString(resultData);
3138 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003139 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003140 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003141 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003142 data.writeInt(serialized ? 1 : 0);
3143 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003144 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003145 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3146 reply.readException();
3147 int res = reply.readInt();
3148 reply.recycle();
3149 data.recycle();
3150 return res;
3151 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003152 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3153 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003154 {
3155 Parcel data = Parcel.obtain();
3156 Parcel reply = Parcel.obtain();
3157 data.writeInterfaceToken(IActivityManager.descriptor);
3158 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3159 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003160 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003161 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3162 reply.readException();
3163 data.recycle();
3164 reply.recycle();
3165 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003166 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3167 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003168 {
3169 Parcel data = Parcel.obtain();
3170 Parcel reply = Parcel.obtain();
3171 data.writeInterfaceToken(IActivityManager.descriptor);
3172 data.writeStrongBinder(who);
3173 data.writeInt(resultCode);
3174 data.writeString(resultData);
3175 data.writeBundle(map);
3176 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003177 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003178 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3179 reply.readException();
3180 data.recycle();
3181 reply.recycle();
3182 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003183 public void attachApplication(IApplicationThread app) throws RemoteException
3184 {
3185 Parcel data = Parcel.obtain();
3186 Parcel reply = Parcel.obtain();
3187 data.writeInterfaceToken(IActivityManager.descriptor);
3188 data.writeStrongBinder(app.asBinder());
3189 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3190 reply.readException();
3191 data.recycle();
3192 reply.recycle();
3193 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003194 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3195 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003196 {
3197 Parcel data = Parcel.obtain();
3198 Parcel reply = Parcel.obtain();
3199 data.writeInterfaceToken(IActivityManager.descriptor);
3200 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003201 if (config != null) {
3202 data.writeInt(1);
3203 config.writeToParcel(data, 0);
3204 } else {
3205 data.writeInt(0);
3206 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003207 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003208 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3209 reply.readException();
3210 data.recycle();
3211 reply.recycle();
3212 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003213 public void activityResumed(IBinder token) throws RemoteException
3214 {
3215 Parcel data = Parcel.obtain();
3216 Parcel reply = Parcel.obtain();
3217 data.writeInterfaceToken(IActivityManager.descriptor);
3218 data.writeStrongBinder(token);
3219 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3220 reply.readException();
3221 data.recycle();
3222 reply.recycle();
3223 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003224 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003225 {
3226 Parcel data = Parcel.obtain();
3227 Parcel reply = Parcel.obtain();
3228 data.writeInterfaceToken(IActivityManager.descriptor);
3229 data.writeStrongBinder(token);
3230 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3231 reply.readException();
3232 data.recycle();
3233 reply.recycle();
3234 }
3235 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003236 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003237 {
3238 Parcel data = Parcel.obtain();
3239 Parcel reply = Parcel.obtain();
3240 data.writeInterfaceToken(IActivityManager.descriptor);
3241 data.writeStrongBinder(token);
3242 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003243 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003244 TextUtils.writeToParcel(description, data, 0);
3245 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3246 reply.readException();
3247 data.recycle();
3248 reply.recycle();
3249 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003250 public void activitySlept(IBinder token) throws RemoteException
3251 {
3252 Parcel data = Parcel.obtain();
3253 Parcel reply = Parcel.obtain();
3254 data.writeInterfaceToken(IActivityManager.descriptor);
3255 data.writeStrongBinder(token);
3256 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3257 reply.readException();
3258 data.recycle();
3259 reply.recycle();
3260 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003261 public void activityDestroyed(IBinder token) throws RemoteException
3262 {
3263 Parcel data = Parcel.obtain();
3264 Parcel reply = Parcel.obtain();
3265 data.writeInterfaceToken(IActivityManager.descriptor);
3266 data.writeStrongBinder(token);
3267 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3268 reply.readException();
3269 data.recycle();
3270 reply.recycle();
3271 }
3272 public String getCallingPackage(IBinder token) throws RemoteException
3273 {
3274 Parcel data = Parcel.obtain();
3275 Parcel reply = Parcel.obtain();
3276 data.writeInterfaceToken(IActivityManager.descriptor);
3277 data.writeStrongBinder(token);
3278 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3279 reply.readException();
3280 String res = reply.readString();
3281 data.recycle();
3282 reply.recycle();
3283 return res;
3284 }
3285 public ComponentName getCallingActivity(IBinder token)
3286 throws RemoteException {
3287 Parcel data = Parcel.obtain();
3288 Parcel reply = Parcel.obtain();
3289 data.writeInterfaceToken(IActivityManager.descriptor);
3290 data.writeStrongBinder(token);
3291 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3292 reply.readException();
3293 ComponentName res = ComponentName.readFromParcel(reply);
3294 data.recycle();
3295 reply.recycle();
3296 return res;
3297 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003298 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003299 Parcel data = Parcel.obtain();
3300 Parcel reply = Parcel.obtain();
3301 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003302 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003303 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3304 reply.readException();
3305 ArrayList<IAppTask> list = null;
3306 int N = reply.readInt();
3307 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003308 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003309 while (N > 0) {
3310 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3311 list.add(task);
3312 N--;
3313 }
3314 }
3315 data.recycle();
3316 reply.recycle();
3317 return list;
3318 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003319 public int addAppTask(IBinder activityToken, Intent intent,
3320 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3321 Parcel data = Parcel.obtain();
3322 Parcel reply = Parcel.obtain();
3323 data.writeInterfaceToken(IActivityManager.descriptor);
3324 data.writeStrongBinder(activityToken);
3325 intent.writeToParcel(data, 0);
3326 description.writeToParcel(data, 0);
3327 thumbnail.writeToParcel(data, 0);
3328 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3329 reply.readException();
3330 int res = reply.readInt();
3331 data.recycle();
3332 reply.recycle();
3333 return res;
3334 }
3335 public Point getAppTaskThumbnailSize() throws RemoteException {
3336 Parcel data = Parcel.obtain();
3337 Parcel reply = Parcel.obtain();
3338 data.writeInterfaceToken(IActivityManager.descriptor);
3339 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3340 reply.readException();
3341 Point size = Point.CREATOR.createFromParcel(reply);
3342 data.recycle();
3343 reply.recycle();
3344 return size;
3345 }
Todd Kennedye635f662015-01-20 10:36:49 -08003346 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3347 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003348 Parcel data = Parcel.obtain();
3349 Parcel reply = Parcel.obtain();
3350 data.writeInterfaceToken(IActivityManager.descriptor);
3351 data.writeInt(maxNum);
3352 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003353 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3354 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003355 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003356 int N = reply.readInt();
3357 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003358 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003359 while (N > 0) {
3360 ActivityManager.RunningTaskInfo info =
3361 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003362 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003363 list.add(info);
3364 N--;
3365 }
3366 }
3367 data.recycle();
3368 reply.recycle();
3369 return list;
3370 }
3371 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003372 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003373 Parcel data = Parcel.obtain();
3374 Parcel reply = Parcel.obtain();
3375 data.writeInterfaceToken(IActivityManager.descriptor);
3376 data.writeInt(maxNum);
3377 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003378 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003379 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3380 reply.readException();
3381 ArrayList<ActivityManager.RecentTaskInfo> list
3382 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3383 data.recycle();
3384 reply.recycle();
3385 return list;
3386 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003387 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003388 Parcel data = Parcel.obtain();
3389 Parcel reply = Parcel.obtain();
3390 data.writeInterfaceToken(IActivityManager.descriptor);
3391 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003392 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003393 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003394 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003395 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003396 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003397 }
3398 data.recycle();
3399 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003400 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003401 }
Todd Kennedye635f662015-01-20 10:36:49 -08003402 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3403 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003404 Parcel data = Parcel.obtain();
3405 Parcel reply = Parcel.obtain();
3406 data.writeInterfaceToken(IActivityManager.descriptor);
3407 data.writeInt(maxNum);
3408 data.writeInt(flags);
3409 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3410 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003411 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003412 int N = reply.readInt();
3413 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003414 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003415 while (N > 0) {
3416 ActivityManager.RunningServiceInfo info =
3417 ActivityManager.RunningServiceInfo.CREATOR
3418 .createFromParcel(reply);
3419 list.add(info);
3420 N--;
3421 }
3422 }
3423 data.recycle();
3424 reply.recycle();
3425 return list;
3426 }
3427 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3428 throws RemoteException {
3429 Parcel data = Parcel.obtain();
3430 Parcel reply = Parcel.obtain();
3431 data.writeInterfaceToken(IActivityManager.descriptor);
3432 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3433 reply.readException();
3434 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3435 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3436 data.recycle();
3437 reply.recycle();
3438 return list;
3439 }
3440 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3441 throws RemoteException {
3442 Parcel data = Parcel.obtain();
3443 Parcel reply = Parcel.obtain();
3444 data.writeInterfaceToken(IActivityManager.descriptor);
3445 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3446 reply.readException();
3447 ArrayList<ActivityManager.RunningAppProcessInfo> list
3448 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3449 data.recycle();
3450 reply.recycle();
3451 return list;
3452 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003453 public List<ApplicationInfo> getRunningExternalApplications()
3454 throws RemoteException {
3455 Parcel data = Parcel.obtain();
3456 Parcel reply = Parcel.obtain();
3457 data.writeInterfaceToken(IActivityManager.descriptor);
3458 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3459 reply.readException();
3460 ArrayList<ApplicationInfo> list
3461 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3462 data.recycle();
3463 reply.recycle();
3464 return list;
3465 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003466 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003467 {
3468 Parcel data = Parcel.obtain();
3469 Parcel reply = Parcel.obtain();
3470 data.writeInterfaceToken(IActivityManager.descriptor);
3471 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003472 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003473 if (options != null) {
3474 data.writeInt(1);
3475 options.writeToParcel(data, 0);
3476 } else {
3477 data.writeInt(0);
3478 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003479 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3480 reply.readException();
3481 data.recycle();
3482 reply.recycle();
3483 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003484 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3485 throws RemoteException {
3486 Parcel data = Parcel.obtain();
3487 Parcel reply = Parcel.obtain();
3488 data.writeInterfaceToken(IActivityManager.descriptor);
3489 data.writeStrongBinder(token);
3490 data.writeInt(nonRoot ? 1 : 0);
3491 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3492 reply.readException();
3493 boolean res = reply.readInt() != 0;
3494 data.recycle();
3495 reply.recycle();
3496 return res;
3497 }
3498 public void moveTaskBackwards(int task) throws RemoteException
3499 {
3500 Parcel data = Parcel.obtain();
3501 Parcel reply = Parcel.obtain();
3502 data.writeInterfaceToken(IActivityManager.descriptor);
3503 data.writeInt(task);
3504 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3505 reply.readException();
3506 data.recycle();
3507 reply.recycle();
3508 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003509 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003510 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3511 {
3512 Parcel data = Parcel.obtain();
3513 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003514 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003515 data.writeInt(taskId);
3516 data.writeInt(stackId);
3517 data.writeInt(toTop ? 1 : 0);
3518 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3519 reply.readException();
3520 data.recycle();
3521 reply.recycle();
3522 }
3523 @Override
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003524 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop)
3525 throws RemoteException
3526 {
3527 Parcel data = Parcel.obtain();
3528 Parcel reply = Parcel.obtain();
3529 data.writeInterfaceToken(IActivityManager.descriptor);
3530 data.writeInt(taskId);
3531 data.writeInt(createMode);
3532 data.writeInt(toTop ? 1 : 0);
3533 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3534 reply.readException();
3535 data.recycle();
3536 reply.recycle();
3537 }
3538 @Override
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003539 public void resizeStack(int stackId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003540 {
3541 Parcel data = Parcel.obtain();
3542 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003543 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003544 data.writeInt(stackId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003545 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003546 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003547 reply.readException();
3548 data.recycle();
3549 reply.recycle();
3550 }
Craig Mautner967212c2013-04-13 21:10:58 -07003551 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003552 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3553 {
3554 Parcel data = Parcel.obtain();
3555 Parcel reply = Parcel.obtain();
3556 data.writeInterfaceToken(IActivityManager.descriptor);
3557 data.writeInt(taskId);
3558 data.writeInt(stackId);
3559 data.writeInt(position);
3560 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3561 reply.readException();
3562 data.recycle();
3563 reply.recycle();
3564 }
3565 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003566 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003567 {
3568 Parcel data = Parcel.obtain();
3569 Parcel reply = Parcel.obtain();
3570 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003571 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003572 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003573 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003574 data.recycle();
3575 reply.recycle();
3576 return list;
3577 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003578 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003579 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003580 {
3581 Parcel data = Parcel.obtain();
3582 Parcel reply = Parcel.obtain();
3583 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003584 data.writeInt(stackId);
3585 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003586 reply.readException();
3587 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003588 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003589 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003590 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003591 }
3592 data.recycle();
3593 reply.recycle();
3594 return info;
3595 }
3596 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003597 public boolean isInHomeStack(int taskId) throws RemoteException {
3598 Parcel data = Parcel.obtain();
3599 Parcel reply = Parcel.obtain();
3600 data.writeInterfaceToken(IActivityManager.descriptor);
3601 data.writeInt(taskId);
3602 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3603 reply.readException();
3604 boolean isInHomeStack = reply.readInt() > 0;
3605 data.recycle();
3606 reply.recycle();
3607 return isInHomeStack;
3608 }
3609 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003610 public void setFocusedStack(int stackId) throws RemoteException
3611 {
3612 Parcel data = Parcel.obtain();
3613 Parcel reply = Parcel.obtain();
3614 data.writeInterfaceToken(IActivityManager.descriptor);
3615 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003616 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003617 reply.readException();
3618 data.recycle();
3619 reply.recycle();
3620 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003621 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003622 public int getFocusedStackId() throws RemoteException {
3623 Parcel data = Parcel.obtain();
3624 Parcel reply = Parcel.obtain();
3625 data.writeInterfaceToken(IActivityManager.descriptor);
3626 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3627 reply.readException();
3628 int focusedStackId = reply.readInt();
3629 data.recycle();
3630 reply.recycle();
3631 return focusedStackId;
3632 }
3633 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003634 public void setFocusedTask(int taskId) throws RemoteException
3635 {
3636 Parcel data = Parcel.obtain();
3637 Parcel reply = Parcel.obtain();
3638 data.writeInterfaceToken(IActivityManager.descriptor);
3639 data.writeInt(taskId);
3640 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3641 reply.readException();
3642 data.recycle();
3643 reply.recycle();
3644 }
3645 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003646 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3647 {
3648 Parcel data = Parcel.obtain();
3649 Parcel reply = Parcel.obtain();
3650 data.writeInterfaceToken(IActivityManager.descriptor);
3651 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003652 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003653 reply.readException();
3654 data.recycle();
3655 reply.recycle();
3656 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003657 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3658 {
3659 Parcel data = Parcel.obtain();
3660 Parcel reply = Parcel.obtain();
3661 data.writeInterfaceToken(IActivityManager.descriptor);
3662 data.writeStrongBinder(token);
3663 data.writeInt(onlyRoot ? 1 : 0);
3664 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3665 reply.readException();
3666 int res = reply.readInt();
3667 data.recycle();
3668 reply.recycle();
3669 return res;
3670 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003671 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003672 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003673 Parcel data = Parcel.obtain();
3674 Parcel reply = Parcel.obtain();
3675 data.writeInterfaceToken(IActivityManager.descriptor);
3676 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3677 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003678 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003679 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003680 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3681 reply.readException();
3682 int res = reply.readInt();
3683 ContentProviderHolder cph = null;
3684 if (res != 0) {
3685 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3686 }
3687 data.recycle();
3688 reply.recycle();
3689 return cph;
3690 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003691 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3692 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003693 Parcel data = Parcel.obtain();
3694 Parcel reply = Parcel.obtain();
3695 data.writeInterfaceToken(IActivityManager.descriptor);
3696 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003697 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003698 data.writeStrongBinder(token);
3699 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3700 reply.readException();
3701 int res = reply.readInt();
3702 ContentProviderHolder cph = null;
3703 if (res != 0) {
3704 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3705 }
3706 data.recycle();
3707 reply.recycle();
3708 return cph;
3709 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003710 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003711 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003712 {
3713 Parcel data = Parcel.obtain();
3714 Parcel reply = Parcel.obtain();
3715 data.writeInterfaceToken(IActivityManager.descriptor);
3716 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3717 data.writeTypedList(providers);
3718 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3719 reply.readException();
3720 data.recycle();
3721 reply.recycle();
3722 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003723 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3724 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003725 Parcel data = Parcel.obtain();
3726 Parcel reply = Parcel.obtain();
3727 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003728 data.writeStrongBinder(connection);
3729 data.writeInt(stable);
3730 data.writeInt(unstable);
3731 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3732 reply.readException();
3733 boolean res = reply.readInt() != 0;
3734 data.recycle();
3735 reply.recycle();
3736 return res;
3737 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003738
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003739 public void unstableProviderDied(IBinder connection) throws RemoteException {
3740 Parcel data = Parcel.obtain();
3741 Parcel reply = Parcel.obtain();
3742 data.writeInterfaceToken(IActivityManager.descriptor);
3743 data.writeStrongBinder(connection);
3744 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3745 reply.readException();
3746 data.recycle();
3747 reply.recycle();
3748 }
3749
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003750 @Override
3751 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3752 Parcel data = Parcel.obtain();
3753 Parcel reply = Parcel.obtain();
3754 data.writeInterfaceToken(IActivityManager.descriptor);
3755 data.writeStrongBinder(connection);
3756 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3757 reply.readException();
3758 data.recycle();
3759 reply.recycle();
3760 }
3761
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003762 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3763 Parcel data = Parcel.obtain();
3764 Parcel reply = Parcel.obtain();
3765 data.writeInterfaceToken(IActivityManager.descriptor);
3766 data.writeStrongBinder(connection);
3767 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003768 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3769 reply.readException();
3770 data.recycle();
3771 reply.recycle();
3772 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003773
3774 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3775 Parcel data = Parcel.obtain();
3776 Parcel reply = Parcel.obtain();
3777 data.writeInterfaceToken(IActivityManager.descriptor);
3778 data.writeString(name);
3779 data.writeStrongBinder(token);
3780 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3781 reply.readException();
3782 data.recycle();
3783 reply.recycle();
3784 }
3785
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003786 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3787 throws RemoteException
3788 {
3789 Parcel data = Parcel.obtain();
3790 Parcel reply = Parcel.obtain();
3791 data.writeInterfaceToken(IActivityManager.descriptor);
3792 service.writeToParcel(data, 0);
3793 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3794 reply.readException();
3795 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3796 data.recycle();
3797 reply.recycle();
3798 return res;
3799 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003800
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003801 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003802 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003803 {
3804 Parcel data = Parcel.obtain();
3805 Parcel reply = Parcel.obtain();
3806 data.writeInterfaceToken(IActivityManager.descriptor);
3807 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3808 service.writeToParcel(data, 0);
3809 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003810 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003811 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003812 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3813 reply.readException();
3814 ComponentName res = ComponentName.readFromParcel(reply);
3815 data.recycle();
3816 reply.recycle();
3817 return res;
3818 }
3819 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003820 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003821 {
3822 Parcel data = Parcel.obtain();
3823 Parcel reply = Parcel.obtain();
3824 data.writeInterfaceToken(IActivityManager.descriptor);
3825 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3826 service.writeToParcel(data, 0);
3827 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003828 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003829 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3830 reply.readException();
3831 int res = reply.readInt();
3832 reply.recycle();
3833 data.recycle();
3834 return res;
3835 }
3836 public boolean stopServiceToken(ComponentName className, IBinder token,
3837 int startId) throws RemoteException {
3838 Parcel data = Parcel.obtain();
3839 Parcel reply = Parcel.obtain();
3840 data.writeInterfaceToken(IActivityManager.descriptor);
3841 ComponentName.writeToParcel(className, data);
3842 data.writeStrongBinder(token);
3843 data.writeInt(startId);
3844 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3845 reply.readException();
3846 boolean res = reply.readInt() != 0;
3847 data.recycle();
3848 reply.recycle();
3849 return res;
3850 }
3851 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003852 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003853 Parcel data = Parcel.obtain();
3854 Parcel reply = Parcel.obtain();
3855 data.writeInterfaceToken(IActivityManager.descriptor);
3856 ComponentName.writeToParcel(className, data);
3857 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003858 data.writeInt(id);
3859 if (notification != null) {
3860 data.writeInt(1);
3861 notification.writeToParcel(data, 0);
3862 } else {
3863 data.writeInt(0);
3864 }
3865 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003866 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3867 reply.readException();
3868 data.recycle();
3869 reply.recycle();
3870 }
3871 public int bindService(IApplicationThread caller, IBinder token,
3872 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07003873 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003874 Parcel data = Parcel.obtain();
3875 Parcel reply = Parcel.obtain();
3876 data.writeInterfaceToken(IActivityManager.descriptor);
3877 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3878 data.writeStrongBinder(token);
3879 service.writeToParcel(data, 0);
3880 data.writeString(resolvedType);
3881 data.writeStrongBinder(connection.asBinder());
3882 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07003883 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003884 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003885 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3886 reply.readException();
3887 int res = reply.readInt();
3888 data.recycle();
3889 reply.recycle();
3890 return res;
3891 }
3892 public boolean unbindService(IServiceConnection connection) throws RemoteException
3893 {
3894 Parcel data = Parcel.obtain();
3895 Parcel reply = Parcel.obtain();
3896 data.writeInterfaceToken(IActivityManager.descriptor);
3897 data.writeStrongBinder(connection.asBinder());
3898 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3899 reply.readException();
3900 boolean res = reply.readInt() != 0;
3901 data.recycle();
3902 reply.recycle();
3903 return res;
3904 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003905
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003906 public void publishService(IBinder token,
3907 Intent intent, IBinder service) throws RemoteException {
3908 Parcel data = Parcel.obtain();
3909 Parcel reply = Parcel.obtain();
3910 data.writeInterfaceToken(IActivityManager.descriptor);
3911 data.writeStrongBinder(token);
3912 intent.writeToParcel(data, 0);
3913 data.writeStrongBinder(service);
3914 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3915 reply.readException();
3916 data.recycle();
3917 reply.recycle();
3918 }
3919
3920 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3921 throws RemoteException {
3922 Parcel data = Parcel.obtain();
3923 Parcel reply = Parcel.obtain();
3924 data.writeInterfaceToken(IActivityManager.descriptor);
3925 data.writeStrongBinder(token);
3926 intent.writeToParcel(data, 0);
3927 data.writeInt(doRebind ? 1 : 0);
3928 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3929 reply.readException();
3930 data.recycle();
3931 reply.recycle();
3932 }
3933
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003934 public void serviceDoneExecuting(IBinder token, int type, int startId,
3935 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003936 Parcel data = Parcel.obtain();
3937 Parcel reply = Parcel.obtain();
3938 data.writeInterfaceToken(IActivityManager.descriptor);
3939 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003940 data.writeInt(type);
3941 data.writeInt(startId);
3942 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003943 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3944 reply.readException();
3945 data.recycle();
3946 reply.recycle();
3947 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003948
Svet Ganov99b60432015-06-27 13:15:22 -07003949 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
3950 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003951 Parcel data = Parcel.obtain();
3952 Parcel reply = Parcel.obtain();
3953 data.writeInterfaceToken(IActivityManager.descriptor);
3954 service.writeToParcel(data, 0);
3955 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003956 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003957 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3958 reply.readException();
3959 IBinder binder = reply.readStrongBinder();
3960 reply.recycle();
3961 data.recycle();
3962 return binder;
3963 }
3964
Christopher Tate181fafa2009-05-14 11:12:14 -07003965 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3966 throws RemoteException {
3967 Parcel data = Parcel.obtain();
3968 Parcel reply = Parcel.obtain();
3969 data.writeInterfaceToken(IActivityManager.descriptor);
3970 app.writeToParcel(data, 0);
3971 data.writeInt(backupRestoreMode);
3972 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3973 reply.readException();
3974 boolean success = reply.readInt() != 0;
3975 reply.recycle();
3976 data.recycle();
3977 return success;
3978 }
3979
Christopher Tate346acb12012-10-15 19:20:25 -07003980 public void clearPendingBackup() throws RemoteException {
3981 Parcel data = Parcel.obtain();
3982 Parcel reply = Parcel.obtain();
3983 data.writeInterfaceToken(IActivityManager.descriptor);
3984 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3985 reply.recycle();
3986 data.recycle();
3987 }
3988
Christopher Tate181fafa2009-05-14 11:12:14 -07003989 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3990 Parcel data = Parcel.obtain();
3991 Parcel reply = Parcel.obtain();
3992 data.writeInterfaceToken(IActivityManager.descriptor);
3993 data.writeString(packageName);
3994 data.writeStrongBinder(agent);
3995 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3996 reply.recycle();
3997 data.recycle();
3998 }
3999
4000 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4001 Parcel data = Parcel.obtain();
4002 Parcel reply = Parcel.obtain();
4003 data.writeInterfaceToken(IActivityManager.descriptor);
4004 app.writeToParcel(data, 0);
4005 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4006 reply.readException();
4007 reply.recycle();
4008 data.recycle();
4009 }
4010
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004011 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004012 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004013 IUiAutomationConnection connection, int userId, String instructionSet)
4014 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004015 Parcel data = Parcel.obtain();
4016 Parcel reply = Parcel.obtain();
4017 data.writeInterfaceToken(IActivityManager.descriptor);
4018 ComponentName.writeToParcel(className, data);
4019 data.writeString(profileFile);
4020 data.writeInt(flags);
4021 data.writeBundle(arguments);
4022 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004023 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004024 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004025 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004026 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4027 reply.readException();
4028 boolean res = reply.readInt() != 0;
4029 reply.recycle();
4030 data.recycle();
4031 return res;
4032 }
4033
4034 public void finishInstrumentation(IApplicationThread target,
4035 int resultCode, Bundle results) throws RemoteException {
4036 Parcel data = Parcel.obtain();
4037 Parcel reply = Parcel.obtain();
4038 data.writeInterfaceToken(IActivityManager.descriptor);
4039 data.writeStrongBinder(target != null ? target.asBinder() : null);
4040 data.writeInt(resultCode);
4041 data.writeBundle(results);
4042 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4043 reply.readException();
4044 data.recycle();
4045 reply.recycle();
4046 }
4047 public Configuration getConfiguration() throws RemoteException
4048 {
4049 Parcel data = Parcel.obtain();
4050 Parcel reply = Parcel.obtain();
4051 data.writeInterfaceToken(IActivityManager.descriptor);
4052 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4053 reply.readException();
4054 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4055 reply.recycle();
4056 data.recycle();
4057 return res;
4058 }
4059 public void updateConfiguration(Configuration values) throws RemoteException
4060 {
4061 Parcel data = Parcel.obtain();
4062 Parcel reply = Parcel.obtain();
4063 data.writeInterfaceToken(IActivityManager.descriptor);
4064 values.writeToParcel(data, 0);
4065 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4066 reply.readException();
4067 data.recycle();
4068 reply.recycle();
4069 }
4070 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4071 throws RemoteException {
4072 Parcel data = Parcel.obtain();
4073 Parcel reply = Parcel.obtain();
4074 data.writeInterfaceToken(IActivityManager.descriptor);
4075 data.writeStrongBinder(token);
4076 data.writeInt(requestedOrientation);
4077 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4078 reply.readException();
4079 data.recycle();
4080 reply.recycle();
4081 }
4082 public int getRequestedOrientation(IBinder token) throws RemoteException {
4083 Parcel data = Parcel.obtain();
4084 Parcel reply = Parcel.obtain();
4085 data.writeInterfaceToken(IActivityManager.descriptor);
4086 data.writeStrongBinder(token);
4087 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4088 reply.readException();
4089 int res = reply.readInt();
4090 data.recycle();
4091 reply.recycle();
4092 return res;
4093 }
4094 public ComponentName getActivityClassForToken(IBinder token)
4095 throws RemoteException {
4096 Parcel data = Parcel.obtain();
4097 Parcel reply = Parcel.obtain();
4098 data.writeInterfaceToken(IActivityManager.descriptor);
4099 data.writeStrongBinder(token);
4100 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4101 reply.readException();
4102 ComponentName res = ComponentName.readFromParcel(reply);
4103 data.recycle();
4104 reply.recycle();
4105 return res;
4106 }
4107 public String getPackageForToken(IBinder token) throws RemoteException
4108 {
4109 Parcel data = Parcel.obtain();
4110 Parcel reply = Parcel.obtain();
4111 data.writeInterfaceToken(IActivityManager.descriptor);
4112 data.writeStrongBinder(token);
4113 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4114 reply.readException();
4115 String res = reply.readString();
4116 data.recycle();
4117 reply.recycle();
4118 return res;
4119 }
4120 public IIntentSender getIntentSender(int type,
4121 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004122 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004123 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004124 Parcel data = Parcel.obtain();
4125 Parcel reply = Parcel.obtain();
4126 data.writeInterfaceToken(IActivityManager.descriptor);
4127 data.writeInt(type);
4128 data.writeString(packageName);
4129 data.writeStrongBinder(token);
4130 data.writeString(resultWho);
4131 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004132 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004133 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004134 data.writeTypedArray(intents, 0);
4135 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004136 } else {
4137 data.writeInt(0);
4138 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004139 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004140 if (options != null) {
4141 data.writeInt(1);
4142 options.writeToParcel(data, 0);
4143 } else {
4144 data.writeInt(0);
4145 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004146 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004147 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4148 reply.readException();
4149 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004150 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004151 data.recycle();
4152 reply.recycle();
4153 return res;
4154 }
4155 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4156 Parcel data = Parcel.obtain();
4157 Parcel reply = Parcel.obtain();
4158 data.writeInterfaceToken(IActivityManager.descriptor);
4159 data.writeStrongBinder(sender.asBinder());
4160 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4161 reply.readException();
4162 data.recycle();
4163 reply.recycle();
4164 }
4165 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4166 Parcel data = Parcel.obtain();
4167 Parcel reply = Parcel.obtain();
4168 data.writeInterfaceToken(IActivityManager.descriptor);
4169 data.writeStrongBinder(sender.asBinder());
4170 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4171 reply.readException();
4172 String res = reply.readString();
4173 data.recycle();
4174 reply.recycle();
4175 return res;
4176 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004177 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4178 Parcel data = Parcel.obtain();
4179 Parcel reply = Parcel.obtain();
4180 data.writeInterfaceToken(IActivityManager.descriptor);
4181 data.writeStrongBinder(sender.asBinder());
4182 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4183 reply.readException();
4184 int res = reply.readInt();
4185 data.recycle();
4186 reply.recycle();
4187 return res;
4188 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004189 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4190 boolean requireFull, String name, String callerPackage) throws RemoteException {
4191 Parcel data = Parcel.obtain();
4192 Parcel reply = Parcel.obtain();
4193 data.writeInterfaceToken(IActivityManager.descriptor);
4194 data.writeInt(callingPid);
4195 data.writeInt(callingUid);
4196 data.writeInt(userId);
4197 data.writeInt(allowAll ? 1 : 0);
4198 data.writeInt(requireFull ? 1 : 0);
4199 data.writeString(name);
4200 data.writeString(callerPackage);
4201 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4202 reply.readException();
4203 int res = reply.readInt();
4204 data.recycle();
4205 reply.recycle();
4206 return res;
4207 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004208 public void setProcessLimit(int max) throws RemoteException
4209 {
4210 Parcel data = Parcel.obtain();
4211 Parcel reply = Parcel.obtain();
4212 data.writeInterfaceToken(IActivityManager.descriptor);
4213 data.writeInt(max);
4214 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4215 reply.readException();
4216 data.recycle();
4217 reply.recycle();
4218 }
4219 public int getProcessLimit() throws RemoteException
4220 {
4221 Parcel data = Parcel.obtain();
4222 Parcel reply = Parcel.obtain();
4223 data.writeInterfaceToken(IActivityManager.descriptor);
4224 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4225 reply.readException();
4226 int res = reply.readInt();
4227 data.recycle();
4228 reply.recycle();
4229 return res;
4230 }
4231 public void setProcessForeground(IBinder token, int pid,
4232 boolean isForeground) throws RemoteException {
4233 Parcel data = Parcel.obtain();
4234 Parcel reply = Parcel.obtain();
4235 data.writeInterfaceToken(IActivityManager.descriptor);
4236 data.writeStrongBinder(token);
4237 data.writeInt(pid);
4238 data.writeInt(isForeground ? 1 : 0);
4239 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4240 reply.readException();
4241 data.recycle();
4242 reply.recycle();
4243 }
4244 public int checkPermission(String permission, int pid, int uid)
4245 throws RemoteException {
4246 Parcel data = Parcel.obtain();
4247 Parcel reply = Parcel.obtain();
4248 data.writeInterfaceToken(IActivityManager.descriptor);
4249 data.writeString(permission);
4250 data.writeInt(pid);
4251 data.writeInt(uid);
4252 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4253 reply.readException();
4254 int res = reply.readInt();
4255 data.recycle();
4256 reply.recycle();
4257 return res;
4258 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004259 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4260 throws RemoteException {
4261 Parcel data = Parcel.obtain();
4262 Parcel reply = Parcel.obtain();
4263 data.writeInterfaceToken(IActivityManager.descriptor);
4264 data.writeString(permission);
4265 data.writeInt(pid);
4266 data.writeInt(uid);
4267 data.writeStrongBinder(callerToken);
4268 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4269 reply.readException();
4270 int res = reply.readInt();
4271 data.recycle();
4272 reply.recycle();
4273 return res;
4274 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004275 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004276 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004277 Parcel data = Parcel.obtain();
4278 Parcel reply = Parcel.obtain();
4279 data.writeInterfaceToken(IActivityManager.descriptor);
4280 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004281 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004282 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004283 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4284 reply.readException();
4285 boolean res = reply.readInt() != 0;
4286 data.recycle();
4287 reply.recycle();
4288 return res;
4289 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004290 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4291 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004292 Parcel data = Parcel.obtain();
4293 Parcel reply = Parcel.obtain();
4294 data.writeInterfaceToken(IActivityManager.descriptor);
4295 uri.writeToParcel(data, 0);
4296 data.writeInt(pid);
4297 data.writeInt(uid);
4298 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004299 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004300 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004301 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4302 reply.readException();
4303 int res = reply.readInt();
4304 data.recycle();
4305 reply.recycle();
4306 return res;
4307 }
4308 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004309 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004310 Parcel data = Parcel.obtain();
4311 Parcel reply = Parcel.obtain();
4312 data.writeInterfaceToken(IActivityManager.descriptor);
4313 data.writeStrongBinder(caller.asBinder());
4314 data.writeString(targetPkg);
4315 uri.writeToParcel(data, 0);
4316 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004317 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004318 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4319 reply.readException();
4320 data.recycle();
4321 reply.recycle();
4322 }
4323 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004324 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004325 Parcel data = Parcel.obtain();
4326 Parcel reply = Parcel.obtain();
4327 data.writeInterfaceToken(IActivityManager.descriptor);
4328 data.writeStrongBinder(caller.asBinder());
4329 uri.writeToParcel(data, 0);
4330 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004331 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004332 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4333 reply.readException();
4334 data.recycle();
4335 reply.recycle();
4336 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004337
4338 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004339 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4340 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004341 Parcel data = Parcel.obtain();
4342 Parcel reply = Parcel.obtain();
4343 data.writeInterfaceToken(IActivityManager.descriptor);
4344 uri.writeToParcel(data, 0);
4345 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004346 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004347 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4348 reply.readException();
4349 data.recycle();
4350 reply.recycle();
4351 }
4352
4353 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004354 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4355 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004356 Parcel data = Parcel.obtain();
4357 Parcel reply = Parcel.obtain();
4358 data.writeInterfaceToken(IActivityManager.descriptor);
4359 uri.writeToParcel(data, 0);
4360 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004361 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004362 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4363 reply.readException();
4364 data.recycle();
4365 reply.recycle();
4366 }
4367
4368 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004369 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4370 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004371 Parcel data = Parcel.obtain();
4372 Parcel reply = Parcel.obtain();
4373 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004374 data.writeString(packageName);
4375 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004376 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4377 reply.readException();
4378 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4379 reply);
4380 data.recycle();
4381 reply.recycle();
4382 return perms;
4383 }
4384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004385 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4386 throws RemoteException {
4387 Parcel data = Parcel.obtain();
4388 Parcel reply = Parcel.obtain();
4389 data.writeInterfaceToken(IActivityManager.descriptor);
4390 data.writeStrongBinder(who.asBinder());
4391 data.writeInt(waiting ? 1 : 0);
4392 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4393 reply.readException();
4394 data.recycle();
4395 reply.recycle();
4396 }
4397 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4398 Parcel data = Parcel.obtain();
4399 Parcel reply = Parcel.obtain();
4400 data.writeInterfaceToken(IActivityManager.descriptor);
4401 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4402 reply.readException();
4403 outInfo.readFromParcel(reply);
4404 data.recycle();
4405 reply.recycle();
4406 }
4407 public void unhandledBack() throws RemoteException
4408 {
4409 Parcel data = Parcel.obtain();
4410 Parcel reply = Parcel.obtain();
4411 data.writeInterfaceToken(IActivityManager.descriptor);
4412 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4413 reply.readException();
4414 data.recycle();
4415 reply.recycle();
4416 }
4417 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4418 {
4419 Parcel data = Parcel.obtain();
4420 Parcel reply = Parcel.obtain();
4421 data.writeInterfaceToken(IActivityManager.descriptor);
4422 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4423 reply.readException();
4424 ParcelFileDescriptor pfd = null;
4425 if (reply.readInt() != 0) {
4426 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4427 }
4428 data.recycle();
4429 reply.recycle();
4430 return pfd;
4431 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004432 public void setLockScreenShown(boolean shown) throws RemoteException
4433 {
4434 Parcel data = Parcel.obtain();
4435 Parcel reply = Parcel.obtain();
4436 data.writeInterfaceToken(IActivityManager.descriptor);
4437 data.writeInt(shown ? 1 : 0);
4438 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4439 reply.readException();
4440 data.recycle();
4441 reply.recycle();
4442 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004443 public void setDebugApp(
4444 String packageName, boolean waitForDebugger, boolean persistent)
4445 throws RemoteException
4446 {
4447 Parcel data = Parcel.obtain();
4448 Parcel reply = Parcel.obtain();
4449 data.writeInterfaceToken(IActivityManager.descriptor);
4450 data.writeString(packageName);
4451 data.writeInt(waitForDebugger ? 1 : 0);
4452 data.writeInt(persistent ? 1 : 0);
4453 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4454 reply.readException();
4455 data.recycle();
4456 reply.recycle();
4457 }
4458 public void setAlwaysFinish(boolean enabled) throws RemoteException
4459 {
4460 Parcel data = Parcel.obtain();
4461 Parcel reply = Parcel.obtain();
4462 data.writeInterfaceToken(IActivityManager.descriptor);
4463 data.writeInt(enabled ? 1 : 0);
4464 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4465 reply.readException();
4466 data.recycle();
4467 reply.recycle();
4468 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004469 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004470 {
4471 Parcel data = Parcel.obtain();
4472 Parcel reply = Parcel.obtain();
4473 data.writeInterfaceToken(IActivityManager.descriptor);
4474 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004475 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004476 reply.readException();
4477 data.recycle();
4478 reply.recycle();
4479 }
4480 public void enterSafeMode() throws RemoteException {
4481 Parcel data = Parcel.obtain();
4482 data.writeInterfaceToken(IActivityManager.descriptor);
4483 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4484 data.recycle();
4485 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004486 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004487 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004488 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004489 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004490 data.writeStrongBinder(sender.asBinder());
4491 data.writeInt(sourceUid);
4492 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004493 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004494 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4495 data.recycle();
4496 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004497 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4498 throws RemoteException {
4499 Parcel data = Parcel.obtain();
4500 data.writeInterfaceToken(IActivityManager.descriptor);
4501 data.writeStrongBinder(sender.asBinder());
4502 data.writeInt(sourceUid);
4503 data.writeString(tag);
4504 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4505 data.recycle();
4506 }
4507 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4508 throws RemoteException {
4509 Parcel data = Parcel.obtain();
4510 data.writeInterfaceToken(IActivityManager.descriptor);
4511 data.writeStrongBinder(sender.asBinder());
4512 data.writeInt(sourceUid);
4513 data.writeString(tag);
4514 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4515 data.recycle();
4516 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004517 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004518 Parcel data = Parcel.obtain();
4519 Parcel reply = Parcel.obtain();
4520 data.writeInterfaceToken(IActivityManager.descriptor);
4521 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004522 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004523 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004524 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004525 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004526 boolean res = reply.readInt() != 0;
4527 data.recycle();
4528 reply.recycle();
4529 return res;
4530 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004531 @Override
4532 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4533 Parcel data = Parcel.obtain();
4534 Parcel reply = Parcel.obtain();
4535 data.writeInterfaceToken(IActivityManager.descriptor);
4536 data.writeString(reason);
4537 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4538 boolean res = reply.readInt() != 0;
4539 data.recycle();
4540 reply.recycle();
4541 return res;
4542 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004543 public boolean testIsSystemReady()
4544 {
4545 /* this base class version is never called */
4546 return true;
4547 }
Dan Egnor60d87622009-12-16 16:32:58 -08004548 public void handleApplicationCrash(IBinder app,
4549 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4550 {
4551 Parcel data = Parcel.obtain();
4552 Parcel reply = Parcel.obtain();
4553 data.writeInterfaceToken(IActivityManager.descriptor);
4554 data.writeStrongBinder(app);
4555 crashInfo.writeToParcel(data, 0);
4556 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4557 reply.readException();
4558 reply.recycle();
4559 data.recycle();
4560 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004561
Dianne Hackborn52322712014-08-26 22:47:26 -07004562 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004563 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004564 {
4565 Parcel data = Parcel.obtain();
4566 Parcel reply = Parcel.obtain();
4567 data.writeInterfaceToken(IActivityManager.descriptor);
4568 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004569 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004570 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004571 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004572 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004573 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004574 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004575 reply.recycle();
4576 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004577 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004578 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004579
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004580 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004581 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004582 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004583 {
4584 Parcel data = Parcel.obtain();
4585 Parcel reply = Parcel.obtain();
4586 data.writeInterfaceToken(IActivityManager.descriptor);
4587 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004588 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004589 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004590 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4591 reply.readException();
4592 reply.recycle();
4593 data.recycle();
4594 }
4595
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004596 public void signalPersistentProcesses(int sig) throws RemoteException {
4597 Parcel data = Parcel.obtain();
4598 Parcel reply = Parcel.obtain();
4599 data.writeInterfaceToken(IActivityManager.descriptor);
4600 data.writeInt(sig);
4601 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4602 reply.readException();
4603 data.recycle();
4604 reply.recycle();
4605 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004606
Dianne Hackborn1676c852012-09-10 14:52:30 -07004607 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004608 Parcel data = Parcel.obtain();
4609 Parcel reply = Parcel.obtain();
4610 data.writeInterfaceToken(IActivityManager.descriptor);
4611 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004612 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004613 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4614 reply.readException();
4615 data.recycle();
4616 reply.recycle();
4617 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004618
4619 public void killAllBackgroundProcesses() throws RemoteException {
4620 Parcel data = Parcel.obtain();
4621 Parcel reply = Parcel.obtain();
4622 data.writeInterfaceToken(IActivityManager.descriptor);
4623 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4624 reply.readException();
4625 data.recycle();
4626 reply.recycle();
4627 }
4628
Dianne Hackborn1676c852012-09-10 14:52:30 -07004629 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004630 Parcel data = Parcel.obtain();
4631 Parcel reply = Parcel.obtain();
4632 data.writeInterfaceToken(IActivityManager.descriptor);
4633 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004634 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004635 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004636 reply.readException();
4637 data.recycle();
4638 reply.recycle();
4639 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004640
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004641 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4642 throws RemoteException
4643 {
4644 Parcel data = Parcel.obtain();
4645 Parcel reply = Parcel.obtain();
4646 data.writeInterfaceToken(IActivityManager.descriptor);
4647 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4648 reply.readException();
4649 outInfo.readFromParcel(reply);
4650 reply.recycle();
4651 data.recycle();
4652 }
4653
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004654 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4655 {
4656 Parcel data = Parcel.obtain();
4657 Parcel reply = Parcel.obtain();
4658 data.writeInterfaceToken(IActivityManager.descriptor);
4659 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4660 reply.readException();
4661 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4662 reply.recycle();
4663 data.recycle();
4664 return res;
4665 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004666
Dianne Hackborn1676c852012-09-10 14:52:30 -07004667 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004668 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004669 {
4670 Parcel data = Parcel.obtain();
4671 Parcel reply = Parcel.obtain();
4672 data.writeInterfaceToken(IActivityManager.descriptor);
4673 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004674 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004675 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004676 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004677 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004678 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004679 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004680 } else {
4681 data.writeInt(0);
4682 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004683 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4684 reply.readException();
4685 boolean res = reply.readInt() != 0;
4686 reply.recycle();
4687 data.recycle();
4688 return res;
4689 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004690
Dianne Hackborn55280a92009-05-07 15:53:46 -07004691 public boolean shutdown(int timeout) throws RemoteException
4692 {
4693 Parcel data = Parcel.obtain();
4694 Parcel reply = Parcel.obtain();
4695 data.writeInterfaceToken(IActivityManager.descriptor);
4696 data.writeInt(timeout);
4697 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4698 reply.readException();
4699 boolean res = reply.readInt() != 0;
4700 reply.recycle();
4701 data.recycle();
4702 return res;
4703 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004704
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004705 public void stopAppSwitches() throws RemoteException {
4706 Parcel data = Parcel.obtain();
4707 Parcel reply = Parcel.obtain();
4708 data.writeInterfaceToken(IActivityManager.descriptor);
4709 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4710 reply.readException();
4711 reply.recycle();
4712 data.recycle();
4713 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004714
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004715 public void resumeAppSwitches() throws RemoteException {
4716 Parcel data = Parcel.obtain();
4717 Parcel reply = Parcel.obtain();
4718 data.writeInterfaceToken(IActivityManager.descriptor);
4719 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4720 reply.readException();
4721 reply.recycle();
4722 data.recycle();
4723 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004724
4725 public void addPackageDependency(String packageName) throws RemoteException {
4726 Parcel data = Parcel.obtain();
4727 Parcel reply = Parcel.obtain();
4728 data.writeInterfaceToken(IActivityManager.descriptor);
4729 data.writeString(packageName);
4730 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4731 reply.readException();
4732 data.recycle();
4733 reply.recycle();
4734 }
4735
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004736 public void killApplicationWithAppId(String pkg, int appid, String reason)
4737 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004738 Parcel data = Parcel.obtain();
4739 Parcel reply = Parcel.obtain();
4740 data.writeInterfaceToken(IActivityManager.descriptor);
4741 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004742 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004743 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004744 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004745 reply.readException();
4746 data.recycle();
4747 reply.recycle();
4748 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004749
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004750 public void closeSystemDialogs(String reason) throws RemoteException {
4751 Parcel data = Parcel.obtain();
4752 Parcel reply = Parcel.obtain();
4753 data.writeInterfaceToken(IActivityManager.descriptor);
4754 data.writeString(reason);
4755 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4756 reply.readException();
4757 data.recycle();
4758 reply.recycle();
4759 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004760
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004761 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004762 throws RemoteException {
4763 Parcel data = Parcel.obtain();
4764 Parcel reply = Parcel.obtain();
4765 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004766 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004767 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4768 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004769 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004770 data.recycle();
4771 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004772 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004773 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004774
4775 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4776 Parcel data = Parcel.obtain();
4777 Parcel reply = Parcel.obtain();
4778 data.writeInterfaceToken(IActivityManager.descriptor);
4779 data.writeString(processName);
4780 data.writeInt(uid);
4781 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4782 reply.readException();
4783 data.recycle();
4784 reply.recycle();
4785 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004786
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004787 public void overridePendingTransition(IBinder token, String packageName,
4788 int enterAnim, int exitAnim) throws RemoteException {
4789 Parcel data = Parcel.obtain();
4790 Parcel reply = Parcel.obtain();
4791 data.writeInterfaceToken(IActivityManager.descriptor);
4792 data.writeStrongBinder(token);
4793 data.writeString(packageName);
4794 data.writeInt(enterAnim);
4795 data.writeInt(exitAnim);
4796 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4797 reply.readException();
4798 data.recycle();
4799 reply.recycle();
4800 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004801
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004802 public boolean isUserAMonkey() throws RemoteException {
4803 Parcel data = Parcel.obtain();
4804 Parcel reply = Parcel.obtain();
4805 data.writeInterfaceToken(IActivityManager.descriptor);
4806 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4807 reply.readException();
4808 boolean res = reply.readInt() != 0;
4809 data.recycle();
4810 reply.recycle();
4811 return res;
4812 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004813
4814 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4815 Parcel data = Parcel.obtain();
4816 Parcel reply = Parcel.obtain();
4817 data.writeInterfaceToken(IActivityManager.descriptor);
4818 data.writeInt(monkey ? 1 : 0);
4819 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4820 reply.readException();
4821 data.recycle();
4822 reply.recycle();
4823 }
4824
Dianne Hackborn860755f2010-06-03 18:47:52 -07004825 public void finishHeavyWeightApp() throws RemoteException {
4826 Parcel data = Parcel.obtain();
4827 Parcel reply = Parcel.obtain();
4828 data.writeInterfaceToken(IActivityManager.descriptor);
4829 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4830 reply.readException();
4831 data.recycle();
4832 reply.recycle();
4833 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004834
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004835 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004836 throws RemoteException {
4837 Parcel data = Parcel.obtain();
4838 Parcel reply = Parcel.obtain();
4839 data.writeInterfaceToken(IActivityManager.descriptor);
4840 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004841 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4842 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004843 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004844 data.recycle();
4845 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004846 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004847 }
4848
Craig Mautner233ceee2014-05-09 17:05:11 -07004849 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004850 throws RemoteException {
4851 Parcel data = Parcel.obtain();
4852 Parcel reply = Parcel.obtain();
4853 data.writeInterfaceToken(IActivityManager.descriptor);
4854 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004855 if (options == null) {
4856 data.writeInt(0);
4857 } else {
4858 data.writeInt(1);
4859 data.writeBundle(options.toBundle());
4860 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004861 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004862 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004863 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004864 data.recycle();
4865 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004866 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004867 }
4868
Craig Mautner233ceee2014-05-09 17:05:11 -07004869 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4870 Parcel data = Parcel.obtain();
4871 Parcel reply = Parcel.obtain();
4872 data.writeInterfaceToken(IActivityManager.descriptor);
4873 data.writeStrongBinder(token);
4874 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4875 reply.readException();
4876 Bundle bundle = reply.readBundle();
4877 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4878 data.recycle();
4879 reply.recycle();
4880 return options;
4881 }
4882
Daniel Sandler69a48172010-06-23 16:29:36 -04004883 public void setImmersive(IBinder token, boolean immersive)
4884 throws RemoteException {
4885 Parcel data = Parcel.obtain();
4886 Parcel reply = Parcel.obtain();
4887 data.writeInterfaceToken(IActivityManager.descriptor);
4888 data.writeStrongBinder(token);
4889 data.writeInt(immersive ? 1 : 0);
4890 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4891 reply.readException();
4892 data.recycle();
4893 reply.recycle();
4894 }
4895
4896 public boolean isImmersive(IBinder token)
4897 throws RemoteException {
4898 Parcel data = Parcel.obtain();
4899 Parcel reply = Parcel.obtain();
4900 data.writeInterfaceToken(IActivityManager.descriptor);
4901 data.writeStrongBinder(token);
4902 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004903 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004904 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004905 data.recycle();
4906 reply.recycle();
4907 return res;
4908 }
4909
Craig Mautnerd61dc202014-07-07 11:09:11 -07004910 public boolean isTopOfTask(IBinder token) throws RemoteException {
4911 Parcel data = Parcel.obtain();
4912 Parcel reply = Parcel.obtain();
4913 data.writeInterfaceToken(IActivityManager.descriptor);
4914 data.writeStrongBinder(token);
4915 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4916 reply.readException();
4917 boolean res = reply.readInt() == 1;
4918 data.recycle();
4919 reply.recycle();
4920 return res;
4921 }
4922
Daniel Sandler69a48172010-06-23 16:29:36 -04004923 public boolean isTopActivityImmersive()
4924 throws RemoteException {
4925 Parcel data = Parcel.obtain();
4926 Parcel reply = Parcel.obtain();
4927 data.writeInterfaceToken(IActivityManager.descriptor);
4928 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004929 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004930 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004931 data.recycle();
4932 reply.recycle();
4933 return res;
4934 }
4935
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004936 public void crashApplication(int uid, int initialPid, String packageName,
4937 String message) throws RemoteException {
4938 Parcel data = Parcel.obtain();
4939 Parcel reply = Parcel.obtain();
4940 data.writeInterfaceToken(IActivityManager.descriptor);
4941 data.writeInt(uid);
4942 data.writeInt(initialPid);
4943 data.writeString(packageName);
4944 data.writeString(message);
4945 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4946 reply.readException();
4947 data.recycle();
4948 reply.recycle();
4949 }
Andy McFadden824c5102010-07-09 16:26:57 -07004950
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004951 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004952 Parcel data = Parcel.obtain();
4953 Parcel reply = Parcel.obtain();
4954 data.writeInterfaceToken(IActivityManager.descriptor);
4955 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004956 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004957 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4958 reply.readException();
4959 String res = reply.readString();
4960 data.recycle();
4961 reply.recycle();
4962 return res;
4963 }
4964
Dianne Hackborn7e269642010-08-25 19:50:20 -07004965 public IBinder newUriPermissionOwner(String name)
4966 throws RemoteException {
4967 Parcel data = Parcel.obtain();
4968 Parcel reply = Parcel.obtain();
4969 data.writeInterfaceToken(IActivityManager.descriptor);
4970 data.writeString(name);
4971 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4972 reply.readException();
4973 IBinder res = reply.readStrongBinder();
4974 data.recycle();
4975 reply.recycle();
4976 return res;
4977 }
4978
4979 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004980 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004981 Parcel data = Parcel.obtain();
4982 Parcel reply = Parcel.obtain();
4983 data.writeInterfaceToken(IActivityManager.descriptor);
4984 data.writeStrongBinder(owner);
4985 data.writeInt(fromUid);
4986 data.writeString(targetPkg);
4987 uri.writeToParcel(data, 0);
4988 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004989 data.writeInt(sourceUserId);
4990 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004991 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4992 reply.readException();
4993 data.recycle();
4994 reply.recycle();
4995 }
4996
4997 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004998 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004999 Parcel data = Parcel.obtain();
5000 Parcel reply = Parcel.obtain();
5001 data.writeInterfaceToken(IActivityManager.descriptor);
5002 data.writeStrongBinder(owner);
5003 if (uri != null) {
5004 data.writeInt(1);
5005 uri.writeToParcel(data, 0);
5006 } else {
5007 data.writeInt(0);
5008 }
5009 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005010 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005011 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5012 reply.readException();
5013 data.recycle();
5014 reply.recycle();
5015 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005016
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005017 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005018 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005019 Parcel data = Parcel.obtain();
5020 Parcel reply = Parcel.obtain();
5021 data.writeInterfaceToken(IActivityManager.descriptor);
5022 data.writeInt(callingUid);
5023 data.writeString(targetPkg);
5024 uri.writeToParcel(data, 0);
5025 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005026 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005027 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5028 reply.readException();
5029 int res = reply.readInt();
5030 data.recycle();
5031 reply.recycle();
5032 return res;
5033 }
5034
Dianne Hackborn1676c852012-09-10 14:52:30 -07005035 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005036 String path, ParcelFileDescriptor fd) throws RemoteException {
5037 Parcel data = Parcel.obtain();
5038 Parcel reply = Parcel.obtain();
5039 data.writeInterfaceToken(IActivityManager.descriptor);
5040 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005041 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005042 data.writeInt(managed ? 1 : 0);
5043 data.writeString(path);
5044 if (fd != null) {
5045 data.writeInt(1);
5046 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5047 } else {
5048 data.writeInt(0);
5049 }
5050 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5051 reply.readException();
5052 boolean res = reply.readInt() != 0;
5053 reply.recycle();
5054 data.recycle();
5055 return res;
5056 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005057
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005058 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005059 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005060 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005061 Parcel data = Parcel.obtain();
5062 Parcel reply = Parcel.obtain();
5063 data.writeInterfaceToken(IActivityManager.descriptor);
5064 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005065 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005066 data.writeTypedArray(intents, 0);
5067 data.writeStringArray(resolvedTypes);
5068 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005069 if (options != null) {
5070 data.writeInt(1);
5071 options.writeToParcel(data, 0);
5072 } else {
5073 data.writeInt(0);
5074 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005075 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005076 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5077 reply.readException();
5078 int result = reply.readInt();
5079 reply.recycle();
5080 data.recycle();
5081 return result;
5082 }
5083
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005084 public int getFrontActivityScreenCompatMode() throws RemoteException {
5085 Parcel data = Parcel.obtain();
5086 Parcel reply = Parcel.obtain();
5087 data.writeInterfaceToken(IActivityManager.descriptor);
5088 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5089 reply.readException();
5090 int mode = reply.readInt();
5091 reply.recycle();
5092 data.recycle();
5093 return mode;
5094 }
5095
5096 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5097 Parcel data = Parcel.obtain();
5098 Parcel reply = Parcel.obtain();
5099 data.writeInterfaceToken(IActivityManager.descriptor);
5100 data.writeInt(mode);
5101 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5102 reply.readException();
5103 reply.recycle();
5104 data.recycle();
5105 }
5106
5107 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5108 Parcel data = Parcel.obtain();
5109 Parcel reply = Parcel.obtain();
5110 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005111 data.writeString(packageName);
5112 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005113 reply.readException();
5114 int mode = reply.readInt();
5115 reply.recycle();
5116 data.recycle();
5117 return mode;
5118 }
5119
5120 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005121 throws RemoteException {
5122 Parcel data = Parcel.obtain();
5123 Parcel reply = Parcel.obtain();
5124 data.writeInterfaceToken(IActivityManager.descriptor);
5125 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005126 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005127 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5128 reply.readException();
5129 reply.recycle();
5130 data.recycle();
5131 }
5132
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005133 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5134 Parcel data = Parcel.obtain();
5135 Parcel reply = Parcel.obtain();
5136 data.writeInterfaceToken(IActivityManager.descriptor);
5137 data.writeString(packageName);
5138 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5139 reply.readException();
5140 boolean ask = reply.readInt() != 0;
5141 reply.recycle();
5142 data.recycle();
5143 return ask;
5144 }
5145
5146 public void setPackageAskScreenCompat(String packageName, boolean ask)
5147 throws RemoteException {
5148 Parcel data = Parcel.obtain();
5149 Parcel reply = Parcel.obtain();
5150 data.writeInterfaceToken(IActivityManager.descriptor);
5151 data.writeString(packageName);
5152 data.writeInt(ask ? 1 : 0);
5153 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5154 reply.readException();
5155 reply.recycle();
5156 data.recycle();
5157 }
5158
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005159 public boolean switchUser(int userid) throws RemoteException {
5160 Parcel data = Parcel.obtain();
5161 Parcel reply = Parcel.obtain();
5162 data.writeInterfaceToken(IActivityManager.descriptor);
5163 data.writeInt(userid);
5164 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5165 reply.readException();
5166 boolean result = reply.readInt() != 0;
5167 reply.recycle();
5168 data.recycle();
5169 return result;
5170 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005171
Kenny Guy08488bf2014-02-21 17:40:37 +00005172 public boolean startUserInBackground(int userid) throws RemoteException {
5173 Parcel data = Parcel.obtain();
5174 Parcel reply = Parcel.obtain();
5175 data.writeInterfaceToken(IActivityManager.descriptor);
5176 data.writeInt(userid);
5177 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5178 reply.readException();
5179 boolean result = reply.readInt() != 0;
5180 reply.recycle();
5181 data.recycle();
5182 return result;
5183 }
5184
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005185 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5186 Parcel data = Parcel.obtain();
5187 Parcel reply = Parcel.obtain();
5188 data.writeInterfaceToken(IActivityManager.descriptor);
5189 data.writeInt(userid);
5190 data.writeStrongInterface(callback);
5191 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5192 reply.readException();
5193 int result = reply.readInt();
5194 reply.recycle();
5195 data.recycle();
5196 return result;
5197 }
5198
Amith Yamasani52f1d752012-03-28 18:19:29 -07005199 public UserInfo getCurrentUser() throws RemoteException {
5200 Parcel data = Parcel.obtain();
5201 Parcel reply = Parcel.obtain();
5202 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005203 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005204 reply.readException();
5205 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5206 reply.recycle();
5207 data.recycle();
5208 return userInfo;
5209 }
5210
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005211 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005212 Parcel data = Parcel.obtain();
5213 Parcel reply = Parcel.obtain();
5214 data.writeInterfaceToken(IActivityManager.descriptor);
5215 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005216 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005217 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5218 reply.readException();
5219 boolean result = reply.readInt() != 0;
5220 reply.recycle();
5221 data.recycle();
5222 return result;
5223 }
5224
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005225 public int[] getRunningUserIds() throws RemoteException {
5226 Parcel data = Parcel.obtain();
5227 Parcel reply = Parcel.obtain();
5228 data.writeInterfaceToken(IActivityManager.descriptor);
5229 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5230 reply.readException();
5231 int[] result = reply.createIntArray();
5232 reply.recycle();
5233 data.recycle();
5234 return result;
5235 }
5236
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005237 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005238 Parcel data = Parcel.obtain();
5239 Parcel reply = Parcel.obtain();
5240 data.writeInterfaceToken(IActivityManager.descriptor);
5241 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005242 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5243 reply.readException();
5244 boolean result = reply.readInt() != 0;
5245 reply.recycle();
5246 data.recycle();
5247 return result;
5248 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005249
Jeff Sharkeya4620792011-05-20 15:29:23 -07005250 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5251 Parcel data = Parcel.obtain();
5252 Parcel reply = Parcel.obtain();
5253 data.writeInterfaceToken(IActivityManager.descriptor);
5254 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5255 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5256 reply.readException();
5257 data.recycle();
5258 reply.recycle();
5259 }
5260
5261 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5262 Parcel data = Parcel.obtain();
5263 Parcel reply = Parcel.obtain();
5264 data.writeInterfaceToken(IActivityManager.descriptor);
5265 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5266 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5267 reply.readException();
5268 data.recycle();
5269 reply.recycle();
5270 }
5271
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005272 public void registerUidObserver(IUidObserver observer) throws RemoteException {
5273 Parcel data = Parcel.obtain();
5274 Parcel reply = Parcel.obtain();
5275 data.writeInterfaceToken(IActivityManager.descriptor);
5276 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5277 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5278 reply.readException();
5279 data.recycle();
5280 reply.recycle();
5281 }
5282
5283 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5284 Parcel data = Parcel.obtain();
5285 Parcel reply = Parcel.obtain();
5286 data.writeInterfaceToken(IActivityManager.descriptor);
5287 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5288 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5289 reply.readException();
5290 data.recycle();
5291 reply.recycle();
5292 }
5293
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005294 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5295 Parcel data = Parcel.obtain();
5296 Parcel reply = Parcel.obtain();
5297 data.writeInterfaceToken(IActivityManager.descriptor);
5298 data.writeStrongBinder(sender.asBinder());
5299 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5300 reply.readException();
5301 boolean res = reply.readInt() != 0;
5302 data.recycle();
5303 reply.recycle();
5304 return res;
5305 }
5306
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005307 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5308 Parcel data = Parcel.obtain();
5309 Parcel reply = Parcel.obtain();
5310 data.writeInterfaceToken(IActivityManager.descriptor);
5311 data.writeStrongBinder(sender.asBinder());
5312 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5313 reply.readException();
5314 boolean res = reply.readInt() != 0;
5315 data.recycle();
5316 reply.recycle();
5317 return res;
5318 }
5319
Dianne Hackborn81038902012-11-26 17:04:09 -08005320 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5321 Parcel data = Parcel.obtain();
5322 Parcel reply = Parcel.obtain();
5323 data.writeInterfaceToken(IActivityManager.descriptor);
5324 data.writeStrongBinder(sender.asBinder());
5325 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5326 reply.readException();
5327 Intent res = reply.readInt() != 0
5328 ? Intent.CREATOR.createFromParcel(reply) : null;
5329 data.recycle();
5330 reply.recycle();
5331 return res;
5332 }
5333
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005334 public String getTagForIntentSender(IIntentSender sender, String prefix)
5335 throws RemoteException {
5336 Parcel data = Parcel.obtain();
5337 Parcel reply = Parcel.obtain();
5338 data.writeInterfaceToken(IActivityManager.descriptor);
5339 data.writeStrongBinder(sender.asBinder());
5340 data.writeString(prefix);
5341 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5342 reply.readException();
5343 String res = reply.readString();
5344 data.recycle();
5345 reply.recycle();
5346 return res;
5347 }
5348
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005349 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5350 {
5351 Parcel data = Parcel.obtain();
5352 Parcel reply = Parcel.obtain();
5353 data.writeInterfaceToken(IActivityManager.descriptor);
5354 values.writeToParcel(data, 0);
5355 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5356 reply.readException();
5357 data.recycle();
5358 reply.recycle();
5359 }
5360
Dianne Hackbornb437e092011-08-05 17:50:29 -07005361 public long[] getProcessPss(int[] pids) throws RemoteException {
5362 Parcel data = Parcel.obtain();
5363 Parcel reply = Parcel.obtain();
5364 data.writeInterfaceToken(IActivityManager.descriptor);
5365 data.writeIntArray(pids);
5366 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5367 reply.readException();
5368 long[] res = reply.createLongArray();
5369 data.recycle();
5370 reply.recycle();
5371 return res;
5372 }
5373
Dianne Hackborn661cd522011-08-22 00:26:20 -07005374 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5375 Parcel data = Parcel.obtain();
5376 Parcel reply = Parcel.obtain();
5377 data.writeInterfaceToken(IActivityManager.descriptor);
5378 TextUtils.writeToParcel(msg, data, 0);
5379 data.writeInt(always ? 1 : 0);
5380 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5381 reply.readException();
5382 data.recycle();
5383 reply.recycle();
5384 }
5385
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005386 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005387 Parcel data = Parcel.obtain();
5388 Parcel reply = Parcel.obtain();
5389 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005390 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005391 reply.readException();
5392 data.recycle();
5393 reply.recycle();
5394 }
5395
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005396 public void keyguardGoingAway(boolean disableWindowAnimations,
5397 boolean keyguardGoingToNotificationShade) throws RemoteException {
5398 Parcel data = Parcel.obtain();
5399 Parcel reply = Parcel.obtain();
5400 data.writeInterfaceToken(IActivityManager.descriptor);
5401 data.writeInt(disableWindowAnimations ? 1 : 0);
5402 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5403 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5404 reply.readException();
5405 data.recycle();
5406 reply.recycle();
5407 }
5408
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005409 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005410 throws RemoteException {
5411 Parcel data = Parcel.obtain();
5412 Parcel reply = Parcel.obtain();
5413 data.writeInterfaceToken(IActivityManager.descriptor);
5414 data.writeStrongBinder(token);
5415 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005416 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005417 reply.readException();
5418 boolean result = reply.readInt() != 0;
5419 data.recycle();
5420 reply.recycle();
5421 return result;
5422 }
5423
5424 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5425 throws RemoteException {
5426 Parcel data = Parcel.obtain();
5427 Parcel reply = Parcel.obtain();
5428 data.writeInterfaceToken(IActivityManager.descriptor);
5429 data.writeStrongBinder(token);
5430 target.writeToParcel(data, 0);
5431 data.writeInt(resultCode);
5432 if (resultData != null) {
5433 data.writeInt(1);
5434 resultData.writeToParcel(data, 0);
5435 } else {
5436 data.writeInt(0);
5437 }
5438 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5439 reply.readException();
5440 boolean result = reply.readInt() != 0;
5441 data.recycle();
5442 reply.recycle();
5443 return result;
5444 }
5445
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005446 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5447 Parcel data = Parcel.obtain();
5448 Parcel reply = Parcel.obtain();
5449 data.writeInterfaceToken(IActivityManager.descriptor);
5450 data.writeStrongBinder(activityToken);
5451 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5452 reply.readException();
5453 int result = reply.readInt();
5454 data.recycle();
5455 reply.recycle();
5456 return result;
5457 }
5458
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005459 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5460 Parcel data = Parcel.obtain();
5461 Parcel reply = Parcel.obtain();
5462 data.writeInterfaceToken(IActivityManager.descriptor);
5463 data.writeStrongBinder(activityToken);
5464 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5465 reply.readException();
5466 String result = reply.readString();
5467 data.recycle();
5468 reply.recycle();
5469 return result;
5470 }
5471
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005472 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5473 Parcel data = Parcel.obtain();
5474 Parcel reply = Parcel.obtain();
5475 data.writeInterfaceToken(IActivityManager.descriptor);
5476 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5477 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5478 reply.readException();
5479 data.recycle();
5480 reply.recycle();
5481 }
5482
5483 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5484 Parcel data = Parcel.obtain();
5485 Parcel reply = Parcel.obtain();
5486 data.writeInterfaceToken(IActivityManager.descriptor);
5487 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5488 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5489 reply.readException();
5490 data.recycle();
5491 reply.recycle();
5492 }
5493
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005494 public void requestBugReport() throws RemoteException {
5495 Parcel data = Parcel.obtain();
5496 Parcel reply = Parcel.obtain();
5497 data.writeInterfaceToken(IActivityManager.descriptor);
5498 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5499 reply.readException();
5500 data.recycle();
5501 reply.recycle();
5502 }
5503
Jeff Brownbd181bb2013-09-10 16:44:24 -07005504 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5505 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005506 Parcel data = Parcel.obtain();
5507 Parcel reply = Parcel.obtain();
5508 data.writeInterfaceToken(IActivityManager.descriptor);
5509 data.writeInt(pid);
5510 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005511 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005512 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5513 reply.readException();
5514 long res = reply.readInt();
5515 data.recycle();
5516 reply.recycle();
5517 return res;
5518 }
5519
Adam Skorydfc7fd72013-08-05 19:23:41 -07005520 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005521 Parcel data = Parcel.obtain();
5522 Parcel reply = Parcel.obtain();
5523 data.writeInterfaceToken(IActivityManager.descriptor);
5524 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005525 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005526 reply.readException();
5527 Bundle res = reply.readBundle();
5528 data.recycle();
5529 reply.recycle();
5530 return res;
5531 }
5532
Dianne Hackborn17f69352015-07-17 18:04:14 -07005533 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5534 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005535 Parcel data = Parcel.obtain();
5536 Parcel reply = Parcel.obtain();
5537 data.writeInterfaceToken(IActivityManager.descriptor);
5538 data.writeInt(requestType);
5539 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005540 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005541 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5542 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005543 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005544 data.recycle();
5545 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005546 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005547 }
5548
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005549 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005550 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005551 Parcel data = Parcel.obtain();
5552 Parcel reply = Parcel.obtain();
5553 data.writeInterfaceToken(IActivityManager.descriptor);
5554 data.writeStrongBinder(token);
5555 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005556 structure.writeToParcel(data, 0);
5557 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005558 if (referrer != null) {
5559 data.writeInt(1);
5560 referrer.writeToParcel(data, 0);
5561 } else {
5562 data.writeInt(0);
5563 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005564 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005565 reply.readException();
5566 data.recycle();
5567 reply.recycle();
5568 }
5569
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005570 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5571 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005572 Parcel data = Parcel.obtain();
5573 Parcel reply = Parcel.obtain();
5574 data.writeInterfaceToken(IActivityManager.descriptor);
5575 intent.writeToParcel(data, 0);
5576 data.writeInt(requestType);
5577 data.writeString(hint);
5578 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005579 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005580 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5581 reply.readException();
5582 boolean res = reply.readInt() != 0;
5583 data.recycle();
5584 reply.recycle();
5585 return res;
5586 }
5587
Dianne Hackborn17f69352015-07-17 18:04:14 -07005588 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005589 Parcel data = Parcel.obtain();
5590 Parcel reply = Parcel.obtain();
5591 data.writeInterfaceToken(IActivityManager.descriptor);
5592 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5593 reply.readException();
5594 boolean res = reply.readInt() != 0;
5595 data.recycle();
5596 reply.recycle();
5597 return res;
5598 }
5599
Dianne Hackborn17f69352015-07-17 18:04:14 -07005600 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5601 Parcel data = Parcel.obtain();
5602 Parcel reply = Parcel.obtain();
5603 data.writeInterfaceToken(IActivityManager.descriptor);
5604 data.writeStrongBinder(token);
5605 data.writeBundle(args);
5606 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5607 reply.readException();
5608 boolean res = reply.readInt() != 0;
5609 data.recycle();
5610 reply.recycle();
5611 return res;
5612 }
5613
Svetoslavaa41add2015-08-06 15:03:55 -07005614 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005615 Parcel data = Parcel.obtain();
5616 Parcel reply = Parcel.obtain();
5617 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07005618 data.writeInt(appId);
5619 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005620 data.writeString(reason);
5621 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5622 reply.readException();
5623 data.recycle();
5624 reply.recycle();
5625 }
5626
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005627 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5628 Parcel data = Parcel.obtain();
5629 Parcel reply = Parcel.obtain();
5630 data.writeInterfaceToken(IActivityManager.descriptor);
5631 data.writeStrongBinder(who);
5632 data.writeInt(allowRestart ? 1 : 0);
5633 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5634 reply.readException();
5635 data.recycle();
5636 reply.recycle();
5637 }
5638
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005639 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5640 Parcel data = Parcel.obtain();
5641 Parcel reply = Parcel.obtain();
5642 data.writeInterfaceToken(IActivityManager.descriptor);
5643 data.writeStrongBinder(token);
5644 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5645 reply.readException();
5646 data.recycle();
5647 reply.recycle();
5648 }
5649
Craig Mautner5eda9b32013-07-02 11:58:16 -07005650 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5651 Parcel data = Parcel.obtain();
5652 Parcel reply = Parcel.obtain();
5653 data.writeInterfaceToken(IActivityManager.descriptor);
5654 data.writeStrongBinder(token);
5655 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5656 reply.readException();
5657 data.recycle();
5658 reply.recycle();
5659 }
5660
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005661 public void restart() throws RemoteException {
5662 Parcel data = Parcel.obtain();
5663 Parcel reply = Parcel.obtain();
5664 data.writeInterfaceToken(IActivityManager.descriptor);
5665 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5666 reply.readException();
5667 data.recycle();
5668 reply.recycle();
5669 }
5670
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005671 public void performIdleMaintenance() throws RemoteException {
5672 Parcel data = Parcel.obtain();
5673 Parcel reply = Parcel.obtain();
5674 data.writeInterfaceToken(IActivityManager.descriptor);
5675 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5676 reply.readException();
5677 data.recycle();
5678 reply.recycle();
5679 }
5680
Todd Kennedyca4d8422015-01-15 15:19:22 -08005681 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005682 IActivityContainerCallback callback) throws RemoteException {
5683 Parcel data = Parcel.obtain();
5684 Parcel reply = Parcel.obtain();
5685 data.writeInterfaceToken(IActivityManager.descriptor);
5686 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005687 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005688 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005689 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005690 final int result = reply.readInt();
5691 final IActivityContainer res;
5692 if (result == 1) {
5693 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5694 } else {
5695 res = null;
5696 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005697 data.recycle();
5698 reply.recycle();
5699 return res;
5700 }
5701
Craig Mautner95da1082014-02-24 17:54:35 -08005702 public void deleteActivityContainer(IActivityContainer activityContainer)
5703 throws RemoteException {
5704 Parcel data = Parcel.obtain();
5705 Parcel reply = Parcel.obtain();
5706 data.writeInterfaceToken(IActivityManager.descriptor);
5707 data.writeStrongBinder(activityContainer.asBinder());
5708 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5709 reply.readException();
5710 data.recycle();
5711 reply.recycle();
5712 }
5713
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04005714 public boolean startBinderTracking() throws RemoteException {
5715 Parcel data = Parcel.obtain();
5716 Parcel reply = Parcel.obtain();
5717 data.writeInterfaceToken(IActivityManager.descriptor);
5718 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
5719 reply.readException();
5720 boolean res = reply.readInt() != 0;
5721 reply.recycle();
5722 data.recycle();
5723 return res;
5724 }
5725
5726 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
5727 Parcel data = Parcel.obtain();
5728 Parcel reply = Parcel.obtain();
5729 data.writeInterfaceToken(IActivityManager.descriptor);
5730 if (fd != null) {
5731 data.writeInt(1);
5732 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5733 } else {
5734 data.writeInt(0);
5735 }
5736 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
5737 reply.readException();
5738 boolean res = reply.readInt() != 0;
5739 reply.recycle();
5740 data.recycle();
5741 return res;
5742 }
5743
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005744 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005745 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5746 Parcel data = Parcel.obtain();
5747 Parcel reply = Parcel.obtain();
5748 data.writeInterfaceToken(IActivityManager.descriptor);
5749 data.writeInt(displayId);
5750 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5751 reply.readException();
5752 final int result = reply.readInt();
5753 final IActivityContainer res;
5754 if (result == 1) {
5755 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5756 } else {
5757 res = null;
5758 }
5759 data.recycle();
5760 reply.recycle();
5761 return res;
5762 }
5763
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005764 @Override
5765 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005766 throws RemoteException {
5767 Parcel data = Parcel.obtain();
5768 Parcel reply = Parcel.obtain();
5769 data.writeInterfaceToken(IActivityManager.descriptor);
5770 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005771 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005772 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005773 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005774 data.recycle();
5775 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005776 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005777 }
5778
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005779 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005780 public void startLockTaskMode(int taskId) throws RemoteException {
5781 Parcel data = Parcel.obtain();
5782 Parcel reply = Parcel.obtain();
5783 data.writeInterfaceToken(IActivityManager.descriptor);
5784 data.writeInt(taskId);
5785 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5786 reply.readException();
5787 data.recycle();
5788 reply.recycle();
5789 }
5790
5791 @Override
5792 public void startLockTaskMode(IBinder token) throws RemoteException {
5793 Parcel data = Parcel.obtain();
5794 Parcel reply = Parcel.obtain();
5795 data.writeInterfaceToken(IActivityManager.descriptor);
5796 data.writeStrongBinder(token);
5797 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5798 reply.readException();
5799 data.recycle();
5800 reply.recycle();
5801 }
5802
5803 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005804 public void startLockTaskModeOnCurrent() throws RemoteException {
5805 Parcel data = Parcel.obtain();
5806 Parcel reply = Parcel.obtain();
5807 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005808 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005809 reply.readException();
5810 data.recycle();
5811 reply.recycle();
5812 }
5813
5814 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005815 public void stopLockTaskMode() throws RemoteException {
5816 Parcel data = Parcel.obtain();
5817 Parcel reply = Parcel.obtain();
5818 data.writeInterfaceToken(IActivityManager.descriptor);
5819 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5820 reply.readException();
5821 data.recycle();
5822 reply.recycle();
5823 }
5824
5825 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005826 public void stopLockTaskModeOnCurrent() throws RemoteException {
5827 Parcel data = Parcel.obtain();
5828 Parcel reply = Parcel.obtain();
5829 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005830 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005831 reply.readException();
5832 data.recycle();
5833 reply.recycle();
5834 }
5835
5836 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005837 public boolean isInLockTaskMode() throws RemoteException {
5838 Parcel data = Parcel.obtain();
5839 Parcel reply = Parcel.obtain();
5840 data.writeInterfaceToken(IActivityManager.descriptor);
5841 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5842 reply.readException();
5843 boolean isInLockTaskMode = reply.readInt() == 1;
5844 data.recycle();
5845 reply.recycle();
5846 return isInLockTaskMode;
5847 }
5848
Craig Mautner688b5102014-03-27 16:55:03 -07005849 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005850 public int getLockTaskModeState() throws RemoteException {
5851 Parcel data = Parcel.obtain();
5852 Parcel reply = Parcel.obtain();
5853 data.writeInterfaceToken(IActivityManager.descriptor);
5854 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5855 reply.readException();
5856 int lockTaskModeState = reply.readInt();
5857 data.recycle();
5858 reply.recycle();
5859 return lockTaskModeState;
5860 }
5861
5862 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005863 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5864 Parcel data = Parcel.obtain();
5865 Parcel reply = Parcel.obtain();
5866 data.writeInterfaceToken(IActivityManager.descriptor);
5867 data.writeStrongBinder(token);
5868 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5869 IBinder.FLAG_ONEWAY);
5870 reply.readException();
5871 data.recycle();
5872 reply.recycle();
5873 }
5874
5875 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005876 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005877 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005878 Parcel data = Parcel.obtain();
5879 Parcel reply = Parcel.obtain();
5880 data.writeInterfaceToken(IActivityManager.descriptor);
5881 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005882 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005883 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005884 reply.readException();
5885 data.recycle();
5886 reply.recycle();
5887 }
5888
Craig Mautneree2e45a2014-06-27 12:10:03 -07005889 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005890 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5891 Parcel data = Parcel.obtain();
5892 Parcel reply = Parcel.obtain();
5893 data.writeInterfaceToken(IActivityManager.descriptor);
5894 data.writeInt(taskId);
5895 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005896 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005897 reply.readException();
5898 data.recycle();
5899 reply.recycle();
5900 }
5901
5902 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07005903 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005904 {
5905 Parcel data = Parcel.obtain();
5906 Parcel reply = Parcel.obtain();
5907 data.writeInterfaceToken(IActivityManager.descriptor);
5908 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07005909 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005910 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005911 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005912 reply.readException();
5913 data.recycle();
5914 reply.recycle();
5915 }
5916
5917 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07005918 public Rect getTaskBounds(int taskId) throws RemoteException
5919 {
5920 Parcel data = Parcel.obtain();
5921 Parcel reply = Parcel.obtain();
5922 data.writeInterfaceToken(IActivityManager.descriptor);
5923 data.writeInt(taskId);
5924 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
5925 reply.readException();
5926 Rect rect = Rect.CREATOR.createFromParcel(reply);
5927 data.recycle();
5928 reply.recycle();
5929 return rect;
5930 }
5931
5932 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005933 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5934 Parcel data = Parcel.obtain();
5935 Parcel reply = Parcel.obtain();
5936 data.writeInterfaceToken(IActivityManager.descriptor);
5937 data.writeString(filename);
5938 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5939 reply.readException();
5940 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5941 data.recycle();
5942 reply.recycle();
5943 return icon;
5944 }
5945
5946 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005947 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5948 throws RemoteException {
5949 Parcel data = Parcel.obtain();
5950 Parcel reply = Parcel.obtain();
5951 data.writeInterfaceToken(IActivityManager.descriptor);
5952 if (options == null) {
5953 data.writeInt(0);
5954 } else {
5955 data.writeInt(1);
5956 data.writeBundle(options.toBundle());
5957 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005958 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08005959 reply.readException();
5960 data.recycle();
5961 reply.recycle();
5962 }
5963
5964 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005965 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005966 Parcel data = Parcel.obtain();
5967 Parcel reply = Parcel.obtain();
5968 data.writeInterfaceToken(IActivityManager.descriptor);
5969 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005970 data.writeInt(visible ? 1 : 0);
5971 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005972 reply.readException();
5973 boolean success = reply.readInt() > 0;
5974 data.recycle();
5975 reply.recycle();
5976 return success;
5977 }
5978
5979 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005980 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005981 Parcel data = Parcel.obtain();
5982 Parcel reply = Parcel.obtain();
5983 data.writeInterfaceToken(IActivityManager.descriptor);
5984 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005985 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005986 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005987 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005988 data.recycle();
5989 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005990 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005991 }
5992
5993 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005994 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005995 Parcel data = Parcel.obtain();
5996 Parcel reply = Parcel.obtain();
5997 data.writeInterfaceToken(IActivityManager.descriptor);
5998 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005999 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006000 reply.readException();
6001 data.recycle();
6002 reply.recycle();
6003 }
6004
6005 @Override
6006 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6007 Parcel data = Parcel.obtain();
6008 Parcel reply = Parcel.obtain();
6009 data.writeInterfaceToken(IActivityManager.descriptor);
6010 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006011 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006012 reply.readException();
6013 data.recycle();
6014 reply.recycle();
6015 }
6016
Craig Mautner8746a472014-07-24 15:12:54 -07006017 @Override
6018 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6019 Parcel data = Parcel.obtain();
6020 Parcel reply = Parcel.obtain();
6021 data.writeInterfaceToken(IActivityManager.descriptor);
6022 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006023 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006024 reply.readException();
6025 data.recycle();
6026 reply.recycle();
6027 }
6028
Craig Mautner6e2f3952014-09-09 14:26:41 -07006029 @Override
6030 public void bootAnimationComplete() throws RemoteException {
6031 Parcel data = Parcel.obtain();
6032 Parcel reply = Parcel.obtain();
6033 data.writeInterfaceToken(IActivityManager.descriptor);
6034 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6035 reply.readException();
6036 data.recycle();
6037 reply.recycle();
6038 }
6039
Wale Ogunwale18795a22014-12-03 11:38:33 -08006040 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006041 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6042 Parcel data = Parcel.obtain();
6043 Parcel reply = Parcel.obtain();
6044 data.writeInterfaceToken(IActivityManager.descriptor);
6045 data.writeInt(uid);
6046 data.writeByteArray(firstPacket);
6047 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6048 reply.readException();
6049 data.recycle();
6050 reply.recycle();
6051 }
6052
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006053 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006054 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6055 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006056 Parcel data = Parcel.obtain();
6057 Parcel reply = Parcel.obtain();
6058 data.writeInterfaceToken(IActivityManager.descriptor);
6059 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006060 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006061 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006062 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006063 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6064 reply.readException();
6065 data.recycle();
6066 reply.recycle();
6067 }
6068
6069 @Override
6070 public void dumpHeapFinished(String path) throws RemoteException {
6071 Parcel data = Parcel.obtain();
6072 Parcel reply = Parcel.obtain();
6073 data.writeInterfaceToken(IActivityManager.descriptor);
6074 data.writeString(path);
6075 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6076 reply.readException();
6077 data.recycle();
6078 reply.recycle();
6079 }
6080
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006081 @Override
6082 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6083 throws RemoteException {
6084 Parcel data = Parcel.obtain();
6085 Parcel reply = Parcel.obtain();
6086 data.writeInterfaceToken(IActivityManager.descriptor);
6087 data.writeStrongBinder(session.asBinder());
6088 data.writeInt(keepAwake ? 1 : 0);
6089 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6090 reply.readException();
6091 data.recycle();
6092 reply.recycle();
6093 }
6094
Craig Mautnere5600772015-04-03 21:36:37 -07006095 @Override
6096 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6097 Parcel data = Parcel.obtain();
6098 Parcel reply = Parcel.obtain();
6099 data.writeInterfaceToken(IActivityManager.descriptor);
6100 data.writeInt(userId);
6101 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006102 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006103 reply.readException();
6104 data.recycle();
6105 reply.recycle();
6106 }
6107
Dianne Hackborn1e383822015-04-10 14:02:33 -07006108 @Override
Craig Mautner015c5e52015-04-23 10:39:39 -07006109 public void updateDeviceOwner(String packageName) throws RemoteException {
6110 Parcel data = Parcel.obtain();
6111 Parcel reply = Parcel.obtain();
6112 data.writeInterfaceToken(IActivityManager.descriptor);
6113 data.writeString(packageName);
6114 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6115 reply.readException();
6116 data.recycle();
6117 reply.recycle();
6118 }
6119
6120 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006121 public int getPackageProcessState(String packageName, String callingPackage)
6122 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006123 Parcel data = Parcel.obtain();
6124 Parcel reply = Parcel.obtain();
6125 data.writeInterfaceToken(IActivityManager.descriptor);
6126 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006127 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006128 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6129 reply.readException();
6130 int res = reply.readInt();
6131 data.recycle();
6132 reply.recycle();
6133 return res;
6134 }
6135
Stefan Kuhne16045c22015-06-05 07:18:06 -07006136 @Override
6137 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6138 throws RemoteException {
6139 Parcel data = Parcel.obtain();
6140 Parcel reply = Parcel.obtain();
6141 data.writeInterfaceToken(IActivityManager.descriptor);
6142 data.writeString(process);
6143 data.writeInt(userId);
6144 data.writeInt(level);
6145 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6146 reply.readException();
6147 int res = reply.readInt();
6148 data.recycle();
6149 reply.recycle();
6150 return res != 0;
6151 }
6152
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006153 @Override
6154 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6155 Parcel data = Parcel.obtain();
6156 Parcel reply = Parcel.obtain();
6157 data.writeInterfaceToken(IActivityManager.descriptor);
6158 data.writeStrongBinder(token);
6159 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6160 reply.readException();
6161 int res = reply.readInt();
6162 data.recycle();
6163 reply.recycle();
6164 return res != 0;
6165 }
6166
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006167 @Override
6168 public void moveActivityToStack(IBinder token, int stackId) throws RemoteException {
6169 Parcel data = Parcel.obtain();
6170 Parcel reply = Parcel.obtain();
6171 data.writeInterfaceToken(IActivityManager.descriptor);
6172 data.writeStrongBinder(token);
6173 data.writeInt(stackId);
6174 mRemote.transact(MOVE_ACTIVITY_TO_STACK_TRANSACTION, data, reply, 0);
6175 reply.readException();
6176 data.recycle();
6177 reply.recycle();
6178 }
6179
6180 @Override
6181 public int getActivityStackId(IBinder token) throws RemoteException {
6182 Parcel data = Parcel.obtain();
6183 Parcel reply = Parcel.obtain();
6184 data.writeInterfaceToken(IActivityManager.descriptor);
6185 data.writeStrongBinder(token);
6186 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6187 reply.readException();
6188 int stackId = reply.readInt();
6189 data.recycle();
6190 reply.recycle();
6191 return stackId;
6192 }
6193
Filip Gruszczynski23493322015-07-29 17:02:59 -07006194 @Override
6195 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
6196 int[] verticalSizeConfigurations) throws RemoteException {
6197 Parcel data = Parcel.obtain();
6198 Parcel reply = Parcel.obtain();
6199 data.writeInterfaceToken(IActivityManager.descriptor);
6200 data.writeStrongBinder(token);
6201 if (horizontalSizeConfiguration == null) {
6202 data.writeInt(0);
6203 } else {
6204 data.writeInt(horizontalSizeConfiguration.length);
6205 data.writeIntArray(horizontalSizeConfiguration);
6206 }
6207 if (verticalSizeConfigurations == null) {
6208 data.writeInt(0);
6209 } else {
6210 data.writeInt(verticalSizeConfigurations.length);
6211 data.writeIntArray(verticalSizeConfigurations);
6212 }
6213 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6214 reply.readException();
6215 data.recycle();
6216 reply.recycle();
6217 }
6218
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006219 private IBinder mRemote;
6220}