blob: cb1a89fd660101c43da79b2e77d6a14dd8740d71 [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 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002685 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2686 data.enforceInterface(IActivityManager.descriptor);
2687 final boolean suppress = data.readInt() == 1;
2688 suppressResizeConfigChanges(suppress);
2689 reply.writeNoException();
2690 return true;
2691 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002692 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002693
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002694 return super.onTransact(code, data, reply, flags);
2695 }
2696
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002697 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002698 return this;
2699 }
2700
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002701 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2702 protected IActivityManager create() {
2703 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002704 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002705 Log.v("ActivityManager", "default service binder = " + b);
2706 }
2707 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002708 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002709 Log.v("ActivityManager", "default service = " + am);
2710 }
2711 return am;
2712 }
2713 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002714}
2715
2716class ActivityManagerProxy implements IActivityManager
2717{
2718 public ActivityManagerProxy(IBinder remote)
2719 {
2720 mRemote = remote;
2721 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002722
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002723 public IBinder asBinder()
2724 {
2725 return mRemote;
2726 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002727
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002728 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002729 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002730 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002731 Parcel data = Parcel.obtain();
2732 Parcel reply = Parcel.obtain();
2733 data.writeInterfaceToken(IActivityManager.descriptor);
2734 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002735 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002736 intent.writeToParcel(data, 0);
2737 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002738 data.writeStrongBinder(resultTo);
2739 data.writeString(resultWho);
2740 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002741 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002742 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002743 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002744 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002745 } else {
2746 data.writeInt(0);
2747 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002748 if (options != null) {
2749 data.writeInt(1);
2750 options.writeToParcel(data, 0);
2751 } else {
2752 data.writeInt(0);
2753 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002754 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2755 reply.readException();
2756 int result = reply.readInt();
2757 reply.recycle();
2758 data.recycle();
2759 return result;
2760 }
Amith Yamasani82644082012-08-03 13:09:11 -07002761
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002762 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002763 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002764 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2765 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002766 Parcel data = Parcel.obtain();
2767 Parcel reply = Parcel.obtain();
2768 data.writeInterfaceToken(IActivityManager.descriptor);
2769 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002770 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002771 intent.writeToParcel(data, 0);
2772 data.writeString(resolvedType);
2773 data.writeStrongBinder(resultTo);
2774 data.writeString(resultWho);
2775 data.writeInt(requestCode);
2776 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002777 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002778 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002779 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002780 } else {
2781 data.writeInt(0);
2782 }
2783 if (options != null) {
2784 data.writeInt(1);
2785 options.writeToParcel(data, 0);
2786 } else {
2787 data.writeInt(0);
2788 }
2789 data.writeInt(userId);
2790 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2791 reply.readException();
2792 int result = reply.readInt();
2793 reply.recycle();
2794 data.recycle();
2795 return result;
2796 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002797 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2798 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002799 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2800 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002801 Parcel data = Parcel.obtain();
2802 Parcel reply = Parcel.obtain();
2803 data.writeInterfaceToken(IActivityManager.descriptor);
2804 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2805 data.writeString(callingPackage);
2806 intent.writeToParcel(data, 0);
2807 data.writeString(resolvedType);
2808 data.writeStrongBinder(resultTo);
2809 data.writeString(resultWho);
2810 data.writeInt(requestCode);
2811 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002812 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002813 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002814 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002815 } else {
2816 data.writeInt(0);
2817 }
2818 if (options != null) {
2819 data.writeInt(1);
2820 options.writeToParcel(data, 0);
2821 } else {
2822 data.writeInt(0);
2823 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002824 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002825 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002826 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2827 reply.readException();
2828 int result = reply.readInt();
2829 reply.recycle();
2830 data.recycle();
2831 return result;
2832 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002833 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2834 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002835 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2836 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002837 Parcel data = Parcel.obtain();
2838 Parcel reply = Parcel.obtain();
2839 data.writeInterfaceToken(IActivityManager.descriptor);
2840 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002841 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002842 intent.writeToParcel(data, 0);
2843 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002844 data.writeStrongBinder(resultTo);
2845 data.writeString(resultWho);
2846 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002847 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002848 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002849 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002850 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002851 } else {
2852 data.writeInt(0);
2853 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002854 if (options != null) {
2855 data.writeInt(1);
2856 options.writeToParcel(data, 0);
2857 } else {
2858 data.writeInt(0);
2859 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002860 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002861 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2862 reply.readException();
2863 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2864 reply.recycle();
2865 data.recycle();
2866 return result;
2867 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002868 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2869 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002870 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002871 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002872 Parcel data = Parcel.obtain();
2873 Parcel reply = Parcel.obtain();
2874 data.writeInterfaceToken(IActivityManager.descriptor);
2875 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002876 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002877 intent.writeToParcel(data, 0);
2878 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002879 data.writeStrongBinder(resultTo);
2880 data.writeString(resultWho);
2881 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002882 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002883 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002884 if (options != null) {
2885 data.writeInt(1);
2886 options.writeToParcel(data, 0);
2887 } else {
2888 data.writeInt(0);
2889 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002890 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002891 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2892 reply.readException();
2893 int result = reply.readInt();
2894 reply.recycle();
2895 data.recycle();
2896 return result;
2897 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002898 public int startActivityIntentSender(IApplicationThread caller,
2899 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002900 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002901 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002902 Parcel data = Parcel.obtain();
2903 Parcel reply = Parcel.obtain();
2904 data.writeInterfaceToken(IActivityManager.descriptor);
2905 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2906 intent.writeToParcel(data, 0);
2907 if (fillInIntent != null) {
2908 data.writeInt(1);
2909 fillInIntent.writeToParcel(data, 0);
2910 } else {
2911 data.writeInt(0);
2912 }
2913 data.writeString(resolvedType);
2914 data.writeStrongBinder(resultTo);
2915 data.writeString(resultWho);
2916 data.writeInt(requestCode);
2917 data.writeInt(flagsMask);
2918 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002919 if (options != null) {
2920 data.writeInt(1);
2921 options.writeToParcel(data, 0);
2922 } else {
2923 data.writeInt(0);
2924 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002925 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002926 reply.readException();
2927 int result = reply.readInt();
2928 reply.recycle();
2929 data.recycle();
2930 return result;
2931 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002932 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2933 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002934 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2935 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002936 Parcel data = Parcel.obtain();
2937 Parcel reply = Parcel.obtain();
2938 data.writeInterfaceToken(IActivityManager.descriptor);
2939 data.writeString(callingPackage);
2940 data.writeInt(callingPid);
2941 data.writeInt(callingUid);
2942 intent.writeToParcel(data, 0);
2943 data.writeString(resolvedType);
2944 data.writeStrongBinder(session.asBinder());
2945 data.writeStrongBinder(interactor.asBinder());
2946 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002947 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002948 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002949 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002950 } else {
2951 data.writeInt(0);
2952 }
2953 if (options != null) {
2954 data.writeInt(1);
2955 options.writeToParcel(data, 0);
2956 } else {
2957 data.writeInt(0);
2958 }
2959 data.writeInt(userId);
2960 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2961 reply.readException();
2962 int result = reply.readInt();
2963 reply.recycle();
2964 data.recycle();
2965 return result;
2966 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002967 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002968 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002969 Parcel data = Parcel.obtain();
2970 Parcel reply = Parcel.obtain();
2971 data.writeInterfaceToken(IActivityManager.descriptor);
2972 data.writeStrongBinder(callingActivity);
2973 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002974 if (options != null) {
2975 data.writeInt(1);
2976 options.writeToParcel(data, 0);
2977 } else {
2978 data.writeInt(0);
2979 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002980 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2981 reply.readException();
2982 int result = reply.readInt();
2983 reply.recycle();
2984 data.recycle();
2985 return result != 0;
2986 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002987 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2988 Parcel data = Parcel.obtain();
2989 Parcel reply = Parcel.obtain();
2990 data.writeInterfaceToken(IActivityManager.descriptor);
2991 data.writeInt(taskId);
2992 if (options == null) {
2993 data.writeInt(0);
2994 } else {
2995 data.writeInt(1);
2996 options.writeToParcel(data, 0);
2997 }
2998 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2999 reply.readException();
3000 int result = reply.readInt();
3001 reply.recycle();
3002 data.recycle();
3003 return result;
3004 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003005 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003006 throws RemoteException {
3007 Parcel data = Parcel.obtain();
3008 Parcel reply = Parcel.obtain();
3009 data.writeInterfaceToken(IActivityManager.descriptor);
3010 data.writeStrongBinder(token);
3011 data.writeInt(resultCode);
3012 if (resultData != null) {
3013 data.writeInt(1);
3014 resultData.writeToParcel(data, 0);
3015 } else {
3016 data.writeInt(0);
3017 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003018 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003019 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3020 reply.readException();
3021 boolean res = reply.readInt() != 0;
3022 data.recycle();
3023 reply.recycle();
3024 return res;
3025 }
3026 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3027 {
3028 Parcel data = Parcel.obtain();
3029 Parcel reply = Parcel.obtain();
3030 data.writeInterfaceToken(IActivityManager.descriptor);
3031 data.writeStrongBinder(token);
3032 data.writeString(resultWho);
3033 data.writeInt(requestCode);
3034 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3035 reply.readException();
3036 data.recycle();
3037 reply.recycle();
3038 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003039 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3040 Parcel data = Parcel.obtain();
3041 Parcel reply = Parcel.obtain();
3042 data.writeInterfaceToken(IActivityManager.descriptor);
3043 data.writeStrongBinder(token);
3044 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3045 reply.readException();
3046 boolean res = reply.readInt() != 0;
3047 data.recycle();
3048 reply.recycle();
3049 return res;
3050 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003051 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3052 Parcel data = Parcel.obtain();
3053 Parcel reply = Parcel.obtain();
3054 data.writeInterfaceToken(IActivityManager.descriptor);
3055 data.writeStrongBinder(session.asBinder());
3056 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3057 reply.readException();
3058 data.recycle();
3059 reply.recycle();
3060 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003061 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3062 Parcel data = Parcel.obtain();
3063 Parcel reply = Parcel.obtain();
3064 data.writeInterfaceToken(IActivityManager.descriptor);
3065 data.writeStrongBinder(token);
3066 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3067 reply.readException();
3068 boolean res = reply.readInt() != 0;
3069 data.recycle();
3070 reply.recycle();
3071 return res;
3072 }
3073 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3074 Parcel data = Parcel.obtain();
3075 Parcel reply = Parcel.obtain();
3076 data.writeInterfaceToken(IActivityManager.descriptor);
3077 data.writeStrongBinder(app.asBinder());
3078 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3079 reply.readException();
3080 data.recycle();
3081 reply.recycle();
3082 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003083 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3084 Parcel data = Parcel.obtain();
3085 Parcel reply = Parcel.obtain();
3086 data.writeInterfaceToken(IActivityManager.descriptor);
3087 data.writeStrongBinder(token);
3088 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3089 reply.readException();
3090 boolean res = reply.readInt() != 0;
3091 data.recycle();
3092 reply.recycle();
3093 return res;
3094 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003095 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003096 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003097 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003098 {
3099 Parcel data = Parcel.obtain();
3100 Parcel reply = Parcel.obtain();
3101 data.writeInterfaceToken(IActivityManager.descriptor);
3102 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003103 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003104 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3105 filter.writeToParcel(data, 0);
3106 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003107 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003108 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3109 reply.readException();
3110 Intent intent = null;
3111 int haveIntent = reply.readInt();
3112 if (haveIntent != 0) {
3113 intent = Intent.CREATOR.createFromParcel(reply);
3114 }
3115 reply.recycle();
3116 data.recycle();
3117 return intent;
3118 }
3119 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3120 {
3121 Parcel data = Parcel.obtain();
3122 Parcel reply = Parcel.obtain();
3123 data.writeInterfaceToken(IActivityManager.descriptor);
3124 data.writeStrongBinder(receiver.asBinder());
3125 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3126 reply.readException();
3127 data.recycle();
3128 reply.recycle();
3129 }
3130 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003131 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003132 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003133 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003134 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003135 {
3136 Parcel data = Parcel.obtain();
3137 Parcel reply = Parcel.obtain();
3138 data.writeInterfaceToken(IActivityManager.descriptor);
3139 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3140 intent.writeToParcel(data, 0);
3141 data.writeString(resolvedType);
3142 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3143 data.writeInt(resultCode);
3144 data.writeString(resultData);
3145 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003146 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003147 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003148 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003149 data.writeInt(serialized ? 1 : 0);
3150 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003151 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003152 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3153 reply.readException();
3154 int res = reply.readInt();
3155 reply.recycle();
3156 data.recycle();
3157 return res;
3158 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003159 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3160 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003161 {
3162 Parcel data = Parcel.obtain();
3163 Parcel reply = Parcel.obtain();
3164 data.writeInterfaceToken(IActivityManager.descriptor);
3165 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3166 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003167 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003168 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3169 reply.readException();
3170 data.recycle();
3171 reply.recycle();
3172 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003173 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3174 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003175 {
3176 Parcel data = Parcel.obtain();
3177 Parcel reply = Parcel.obtain();
3178 data.writeInterfaceToken(IActivityManager.descriptor);
3179 data.writeStrongBinder(who);
3180 data.writeInt(resultCode);
3181 data.writeString(resultData);
3182 data.writeBundle(map);
3183 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003184 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003185 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3186 reply.readException();
3187 data.recycle();
3188 reply.recycle();
3189 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003190 public void attachApplication(IApplicationThread app) throws RemoteException
3191 {
3192 Parcel data = Parcel.obtain();
3193 Parcel reply = Parcel.obtain();
3194 data.writeInterfaceToken(IActivityManager.descriptor);
3195 data.writeStrongBinder(app.asBinder());
3196 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3197 reply.readException();
3198 data.recycle();
3199 reply.recycle();
3200 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003201 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3202 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003203 {
3204 Parcel data = Parcel.obtain();
3205 Parcel reply = Parcel.obtain();
3206 data.writeInterfaceToken(IActivityManager.descriptor);
3207 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003208 if (config != null) {
3209 data.writeInt(1);
3210 config.writeToParcel(data, 0);
3211 } else {
3212 data.writeInt(0);
3213 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003214 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003215 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3216 reply.readException();
3217 data.recycle();
3218 reply.recycle();
3219 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003220 public void activityResumed(IBinder token) throws RemoteException
3221 {
3222 Parcel data = Parcel.obtain();
3223 Parcel reply = Parcel.obtain();
3224 data.writeInterfaceToken(IActivityManager.descriptor);
3225 data.writeStrongBinder(token);
3226 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3227 reply.readException();
3228 data.recycle();
3229 reply.recycle();
3230 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003231 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003232 {
3233 Parcel data = Parcel.obtain();
3234 Parcel reply = Parcel.obtain();
3235 data.writeInterfaceToken(IActivityManager.descriptor);
3236 data.writeStrongBinder(token);
3237 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3238 reply.readException();
3239 data.recycle();
3240 reply.recycle();
3241 }
3242 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003243 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003244 {
3245 Parcel data = Parcel.obtain();
3246 Parcel reply = Parcel.obtain();
3247 data.writeInterfaceToken(IActivityManager.descriptor);
3248 data.writeStrongBinder(token);
3249 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003250 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003251 TextUtils.writeToParcel(description, data, 0);
3252 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3253 reply.readException();
3254 data.recycle();
3255 reply.recycle();
3256 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003257 public void activitySlept(IBinder token) throws RemoteException
3258 {
3259 Parcel data = Parcel.obtain();
3260 Parcel reply = Parcel.obtain();
3261 data.writeInterfaceToken(IActivityManager.descriptor);
3262 data.writeStrongBinder(token);
3263 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3264 reply.readException();
3265 data.recycle();
3266 reply.recycle();
3267 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003268 public void activityDestroyed(IBinder token) throws RemoteException
3269 {
3270 Parcel data = Parcel.obtain();
3271 Parcel reply = Parcel.obtain();
3272 data.writeInterfaceToken(IActivityManager.descriptor);
3273 data.writeStrongBinder(token);
3274 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3275 reply.readException();
3276 data.recycle();
3277 reply.recycle();
3278 }
3279 public String getCallingPackage(IBinder token) throws RemoteException
3280 {
3281 Parcel data = Parcel.obtain();
3282 Parcel reply = Parcel.obtain();
3283 data.writeInterfaceToken(IActivityManager.descriptor);
3284 data.writeStrongBinder(token);
3285 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3286 reply.readException();
3287 String res = reply.readString();
3288 data.recycle();
3289 reply.recycle();
3290 return res;
3291 }
3292 public ComponentName getCallingActivity(IBinder token)
3293 throws RemoteException {
3294 Parcel data = Parcel.obtain();
3295 Parcel reply = Parcel.obtain();
3296 data.writeInterfaceToken(IActivityManager.descriptor);
3297 data.writeStrongBinder(token);
3298 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3299 reply.readException();
3300 ComponentName res = ComponentName.readFromParcel(reply);
3301 data.recycle();
3302 reply.recycle();
3303 return res;
3304 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003305 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003306 Parcel data = Parcel.obtain();
3307 Parcel reply = Parcel.obtain();
3308 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003309 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003310 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3311 reply.readException();
3312 ArrayList<IAppTask> list = null;
3313 int N = reply.readInt();
3314 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003315 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003316 while (N > 0) {
3317 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3318 list.add(task);
3319 N--;
3320 }
3321 }
3322 data.recycle();
3323 reply.recycle();
3324 return list;
3325 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003326 public int addAppTask(IBinder activityToken, Intent intent,
3327 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3328 Parcel data = Parcel.obtain();
3329 Parcel reply = Parcel.obtain();
3330 data.writeInterfaceToken(IActivityManager.descriptor);
3331 data.writeStrongBinder(activityToken);
3332 intent.writeToParcel(data, 0);
3333 description.writeToParcel(data, 0);
3334 thumbnail.writeToParcel(data, 0);
3335 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3336 reply.readException();
3337 int res = reply.readInt();
3338 data.recycle();
3339 reply.recycle();
3340 return res;
3341 }
3342 public Point getAppTaskThumbnailSize() throws RemoteException {
3343 Parcel data = Parcel.obtain();
3344 Parcel reply = Parcel.obtain();
3345 data.writeInterfaceToken(IActivityManager.descriptor);
3346 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3347 reply.readException();
3348 Point size = Point.CREATOR.createFromParcel(reply);
3349 data.recycle();
3350 reply.recycle();
3351 return size;
3352 }
Todd Kennedye635f662015-01-20 10:36:49 -08003353 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3354 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003355 Parcel data = Parcel.obtain();
3356 Parcel reply = Parcel.obtain();
3357 data.writeInterfaceToken(IActivityManager.descriptor);
3358 data.writeInt(maxNum);
3359 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003360 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3361 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003362 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003363 int N = reply.readInt();
3364 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003365 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003366 while (N > 0) {
3367 ActivityManager.RunningTaskInfo info =
3368 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003369 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003370 list.add(info);
3371 N--;
3372 }
3373 }
3374 data.recycle();
3375 reply.recycle();
3376 return list;
3377 }
3378 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003379 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003380 Parcel data = Parcel.obtain();
3381 Parcel reply = Parcel.obtain();
3382 data.writeInterfaceToken(IActivityManager.descriptor);
3383 data.writeInt(maxNum);
3384 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003385 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003386 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3387 reply.readException();
3388 ArrayList<ActivityManager.RecentTaskInfo> list
3389 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3390 data.recycle();
3391 reply.recycle();
3392 return list;
3393 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003394 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003395 Parcel data = Parcel.obtain();
3396 Parcel reply = Parcel.obtain();
3397 data.writeInterfaceToken(IActivityManager.descriptor);
3398 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003399 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003400 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003401 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003402 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003403 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003404 }
3405 data.recycle();
3406 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003407 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003408 }
Todd Kennedye635f662015-01-20 10:36:49 -08003409 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3410 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003411 Parcel data = Parcel.obtain();
3412 Parcel reply = Parcel.obtain();
3413 data.writeInterfaceToken(IActivityManager.descriptor);
3414 data.writeInt(maxNum);
3415 data.writeInt(flags);
3416 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3417 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003418 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003419 int N = reply.readInt();
3420 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003421 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003422 while (N > 0) {
3423 ActivityManager.RunningServiceInfo info =
3424 ActivityManager.RunningServiceInfo.CREATOR
3425 .createFromParcel(reply);
3426 list.add(info);
3427 N--;
3428 }
3429 }
3430 data.recycle();
3431 reply.recycle();
3432 return list;
3433 }
3434 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3435 throws RemoteException {
3436 Parcel data = Parcel.obtain();
3437 Parcel reply = Parcel.obtain();
3438 data.writeInterfaceToken(IActivityManager.descriptor);
3439 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3440 reply.readException();
3441 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3442 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3443 data.recycle();
3444 reply.recycle();
3445 return list;
3446 }
3447 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3448 throws RemoteException {
3449 Parcel data = Parcel.obtain();
3450 Parcel reply = Parcel.obtain();
3451 data.writeInterfaceToken(IActivityManager.descriptor);
3452 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3453 reply.readException();
3454 ArrayList<ActivityManager.RunningAppProcessInfo> list
3455 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3456 data.recycle();
3457 reply.recycle();
3458 return list;
3459 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003460 public List<ApplicationInfo> getRunningExternalApplications()
3461 throws RemoteException {
3462 Parcel data = Parcel.obtain();
3463 Parcel reply = Parcel.obtain();
3464 data.writeInterfaceToken(IActivityManager.descriptor);
3465 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3466 reply.readException();
3467 ArrayList<ApplicationInfo> list
3468 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3469 data.recycle();
3470 reply.recycle();
3471 return list;
3472 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003473 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003474 {
3475 Parcel data = Parcel.obtain();
3476 Parcel reply = Parcel.obtain();
3477 data.writeInterfaceToken(IActivityManager.descriptor);
3478 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003479 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003480 if (options != null) {
3481 data.writeInt(1);
3482 options.writeToParcel(data, 0);
3483 } else {
3484 data.writeInt(0);
3485 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003486 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3487 reply.readException();
3488 data.recycle();
3489 reply.recycle();
3490 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003491 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3492 throws RemoteException {
3493 Parcel data = Parcel.obtain();
3494 Parcel reply = Parcel.obtain();
3495 data.writeInterfaceToken(IActivityManager.descriptor);
3496 data.writeStrongBinder(token);
3497 data.writeInt(nonRoot ? 1 : 0);
3498 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3499 reply.readException();
3500 boolean res = reply.readInt() != 0;
3501 data.recycle();
3502 reply.recycle();
3503 return res;
3504 }
3505 public void moveTaskBackwards(int task) throws RemoteException
3506 {
3507 Parcel data = Parcel.obtain();
3508 Parcel reply = Parcel.obtain();
3509 data.writeInterfaceToken(IActivityManager.descriptor);
3510 data.writeInt(task);
3511 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3512 reply.readException();
3513 data.recycle();
3514 reply.recycle();
3515 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003516 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003517 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3518 {
3519 Parcel data = Parcel.obtain();
3520 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003521 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003522 data.writeInt(taskId);
3523 data.writeInt(stackId);
3524 data.writeInt(toTop ? 1 : 0);
3525 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3526 reply.readException();
3527 data.recycle();
3528 reply.recycle();
3529 }
3530 @Override
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003531 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop)
3532 throws RemoteException
3533 {
3534 Parcel data = Parcel.obtain();
3535 Parcel reply = Parcel.obtain();
3536 data.writeInterfaceToken(IActivityManager.descriptor);
3537 data.writeInt(taskId);
3538 data.writeInt(createMode);
3539 data.writeInt(toTop ? 1 : 0);
3540 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3541 reply.readException();
3542 data.recycle();
3543 reply.recycle();
3544 }
3545 @Override
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003546 public void resizeStack(int stackId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003547 {
3548 Parcel data = Parcel.obtain();
3549 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003550 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003551 data.writeInt(stackId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003552 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003553 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003554 reply.readException();
3555 data.recycle();
3556 reply.recycle();
3557 }
Craig Mautner967212c2013-04-13 21:10:58 -07003558 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003559 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3560 {
3561 Parcel data = Parcel.obtain();
3562 Parcel reply = Parcel.obtain();
3563 data.writeInterfaceToken(IActivityManager.descriptor);
3564 data.writeInt(taskId);
3565 data.writeInt(stackId);
3566 data.writeInt(position);
3567 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3568 reply.readException();
3569 data.recycle();
3570 reply.recycle();
3571 }
3572 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003573 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003574 {
3575 Parcel data = Parcel.obtain();
3576 Parcel reply = Parcel.obtain();
3577 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003578 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003579 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003580 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003581 data.recycle();
3582 reply.recycle();
3583 return list;
3584 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003585 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003586 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003587 {
3588 Parcel data = Parcel.obtain();
3589 Parcel reply = Parcel.obtain();
3590 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003591 data.writeInt(stackId);
3592 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003593 reply.readException();
3594 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003595 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003596 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003597 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003598 }
3599 data.recycle();
3600 reply.recycle();
3601 return info;
3602 }
3603 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003604 public boolean isInHomeStack(int taskId) throws RemoteException {
3605 Parcel data = Parcel.obtain();
3606 Parcel reply = Parcel.obtain();
3607 data.writeInterfaceToken(IActivityManager.descriptor);
3608 data.writeInt(taskId);
3609 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3610 reply.readException();
3611 boolean isInHomeStack = reply.readInt() > 0;
3612 data.recycle();
3613 reply.recycle();
3614 return isInHomeStack;
3615 }
3616 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003617 public void setFocusedStack(int stackId) throws RemoteException
3618 {
3619 Parcel data = Parcel.obtain();
3620 Parcel reply = Parcel.obtain();
3621 data.writeInterfaceToken(IActivityManager.descriptor);
3622 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003623 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003624 reply.readException();
3625 data.recycle();
3626 reply.recycle();
3627 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003628 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003629 public int getFocusedStackId() throws RemoteException {
3630 Parcel data = Parcel.obtain();
3631 Parcel reply = Parcel.obtain();
3632 data.writeInterfaceToken(IActivityManager.descriptor);
3633 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3634 reply.readException();
3635 int focusedStackId = reply.readInt();
3636 data.recycle();
3637 reply.recycle();
3638 return focusedStackId;
3639 }
3640 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003641 public void setFocusedTask(int taskId) throws RemoteException
3642 {
3643 Parcel data = Parcel.obtain();
3644 Parcel reply = Parcel.obtain();
3645 data.writeInterfaceToken(IActivityManager.descriptor);
3646 data.writeInt(taskId);
3647 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3648 reply.readException();
3649 data.recycle();
3650 reply.recycle();
3651 }
3652 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003653 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3654 {
3655 Parcel data = Parcel.obtain();
3656 Parcel reply = Parcel.obtain();
3657 data.writeInterfaceToken(IActivityManager.descriptor);
3658 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003659 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003660 reply.readException();
3661 data.recycle();
3662 reply.recycle();
3663 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003664 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3665 {
3666 Parcel data = Parcel.obtain();
3667 Parcel reply = Parcel.obtain();
3668 data.writeInterfaceToken(IActivityManager.descriptor);
3669 data.writeStrongBinder(token);
3670 data.writeInt(onlyRoot ? 1 : 0);
3671 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3672 reply.readException();
3673 int res = reply.readInt();
3674 data.recycle();
3675 reply.recycle();
3676 return res;
3677 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003678 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003679 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003680 Parcel data = Parcel.obtain();
3681 Parcel reply = Parcel.obtain();
3682 data.writeInterfaceToken(IActivityManager.descriptor);
3683 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3684 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003685 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003686 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003687 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3688 reply.readException();
3689 int res = reply.readInt();
3690 ContentProviderHolder cph = null;
3691 if (res != 0) {
3692 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3693 }
3694 data.recycle();
3695 reply.recycle();
3696 return cph;
3697 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003698 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3699 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003700 Parcel data = Parcel.obtain();
3701 Parcel reply = Parcel.obtain();
3702 data.writeInterfaceToken(IActivityManager.descriptor);
3703 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003704 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003705 data.writeStrongBinder(token);
3706 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3707 reply.readException();
3708 int res = reply.readInt();
3709 ContentProviderHolder cph = null;
3710 if (res != 0) {
3711 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3712 }
3713 data.recycle();
3714 reply.recycle();
3715 return cph;
3716 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003717 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003718 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003719 {
3720 Parcel data = Parcel.obtain();
3721 Parcel reply = Parcel.obtain();
3722 data.writeInterfaceToken(IActivityManager.descriptor);
3723 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3724 data.writeTypedList(providers);
3725 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3726 reply.readException();
3727 data.recycle();
3728 reply.recycle();
3729 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003730 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3731 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003732 Parcel data = Parcel.obtain();
3733 Parcel reply = Parcel.obtain();
3734 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003735 data.writeStrongBinder(connection);
3736 data.writeInt(stable);
3737 data.writeInt(unstable);
3738 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3739 reply.readException();
3740 boolean res = reply.readInt() != 0;
3741 data.recycle();
3742 reply.recycle();
3743 return res;
3744 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003745
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003746 public void unstableProviderDied(IBinder connection) throws RemoteException {
3747 Parcel data = Parcel.obtain();
3748 Parcel reply = Parcel.obtain();
3749 data.writeInterfaceToken(IActivityManager.descriptor);
3750 data.writeStrongBinder(connection);
3751 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3752 reply.readException();
3753 data.recycle();
3754 reply.recycle();
3755 }
3756
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003757 @Override
3758 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3759 Parcel data = Parcel.obtain();
3760 Parcel reply = Parcel.obtain();
3761 data.writeInterfaceToken(IActivityManager.descriptor);
3762 data.writeStrongBinder(connection);
3763 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3764 reply.readException();
3765 data.recycle();
3766 reply.recycle();
3767 }
3768
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003769 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3770 Parcel data = Parcel.obtain();
3771 Parcel reply = Parcel.obtain();
3772 data.writeInterfaceToken(IActivityManager.descriptor);
3773 data.writeStrongBinder(connection);
3774 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003775 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3776 reply.readException();
3777 data.recycle();
3778 reply.recycle();
3779 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003780
3781 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3782 Parcel data = Parcel.obtain();
3783 Parcel reply = Parcel.obtain();
3784 data.writeInterfaceToken(IActivityManager.descriptor);
3785 data.writeString(name);
3786 data.writeStrongBinder(token);
3787 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3788 reply.readException();
3789 data.recycle();
3790 reply.recycle();
3791 }
3792
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003793 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3794 throws RemoteException
3795 {
3796 Parcel data = Parcel.obtain();
3797 Parcel reply = Parcel.obtain();
3798 data.writeInterfaceToken(IActivityManager.descriptor);
3799 service.writeToParcel(data, 0);
3800 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3801 reply.readException();
3802 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3803 data.recycle();
3804 reply.recycle();
3805 return res;
3806 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003807
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003808 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003809 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003810 {
3811 Parcel data = Parcel.obtain();
3812 Parcel reply = Parcel.obtain();
3813 data.writeInterfaceToken(IActivityManager.descriptor);
3814 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3815 service.writeToParcel(data, 0);
3816 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003817 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003818 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003819 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3820 reply.readException();
3821 ComponentName res = ComponentName.readFromParcel(reply);
3822 data.recycle();
3823 reply.recycle();
3824 return res;
3825 }
3826 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003827 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003828 {
3829 Parcel data = Parcel.obtain();
3830 Parcel reply = Parcel.obtain();
3831 data.writeInterfaceToken(IActivityManager.descriptor);
3832 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3833 service.writeToParcel(data, 0);
3834 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003835 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003836 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3837 reply.readException();
3838 int res = reply.readInt();
3839 reply.recycle();
3840 data.recycle();
3841 return res;
3842 }
3843 public boolean stopServiceToken(ComponentName className, IBinder token,
3844 int startId) throws RemoteException {
3845 Parcel data = Parcel.obtain();
3846 Parcel reply = Parcel.obtain();
3847 data.writeInterfaceToken(IActivityManager.descriptor);
3848 ComponentName.writeToParcel(className, data);
3849 data.writeStrongBinder(token);
3850 data.writeInt(startId);
3851 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3852 reply.readException();
3853 boolean res = reply.readInt() != 0;
3854 data.recycle();
3855 reply.recycle();
3856 return res;
3857 }
3858 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003859 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003860 Parcel data = Parcel.obtain();
3861 Parcel reply = Parcel.obtain();
3862 data.writeInterfaceToken(IActivityManager.descriptor);
3863 ComponentName.writeToParcel(className, data);
3864 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003865 data.writeInt(id);
3866 if (notification != null) {
3867 data.writeInt(1);
3868 notification.writeToParcel(data, 0);
3869 } else {
3870 data.writeInt(0);
3871 }
3872 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003873 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3874 reply.readException();
3875 data.recycle();
3876 reply.recycle();
3877 }
3878 public int bindService(IApplicationThread caller, IBinder token,
3879 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07003880 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003881 Parcel data = Parcel.obtain();
3882 Parcel reply = Parcel.obtain();
3883 data.writeInterfaceToken(IActivityManager.descriptor);
3884 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3885 data.writeStrongBinder(token);
3886 service.writeToParcel(data, 0);
3887 data.writeString(resolvedType);
3888 data.writeStrongBinder(connection.asBinder());
3889 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07003890 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003891 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003892 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3893 reply.readException();
3894 int res = reply.readInt();
3895 data.recycle();
3896 reply.recycle();
3897 return res;
3898 }
3899 public boolean unbindService(IServiceConnection connection) throws RemoteException
3900 {
3901 Parcel data = Parcel.obtain();
3902 Parcel reply = Parcel.obtain();
3903 data.writeInterfaceToken(IActivityManager.descriptor);
3904 data.writeStrongBinder(connection.asBinder());
3905 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3906 reply.readException();
3907 boolean res = reply.readInt() != 0;
3908 data.recycle();
3909 reply.recycle();
3910 return res;
3911 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003912
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003913 public void publishService(IBinder token,
3914 Intent intent, IBinder service) throws RemoteException {
3915 Parcel data = Parcel.obtain();
3916 Parcel reply = Parcel.obtain();
3917 data.writeInterfaceToken(IActivityManager.descriptor);
3918 data.writeStrongBinder(token);
3919 intent.writeToParcel(data, 0);
3920 data.writeStrongBinder(service);
3921 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3922 reply.readException();
3923 data.recycle();
3924 reply.recycle();
3925 }
3926
3927 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3928 throws RemoteException {
3929 Parcel data = Parcel.obtain();
3930 Parcel reply = Parcel.obtain();
3931 data.writeInterfaceToken(IActivityManager.descriptor);
3932 data.writeStrongBinder(token);
3933 intent.writeToParcel(data, 0);
3934 data.writeInt(doRebind ? 1 : 0);
3935 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3936 reply.readException();
3937 data.recycle();
3938 reply.recycle();
3939 }
3940
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003941 public void serviceDoneExecuting(IBinder token, int type, int startId,
3942 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003943 Parcel data = Parcel.obtain();
3944 Parcel reply = Parcel.obtain();
3945 data.writeInterfaceToken(IActivityManager.descriptor);
3946 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003947 data.writeInt(type);
3948 data.writeInt(startId);
3949 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003950 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3951 reply.readException();
3952 data.recycle();
3953 reply.recycle();
3954 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003955
Svet Ganov99b60432015-06-27 13:15:22 -07003956 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
3957 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003958 Parcel data = Parcel.obtain();
3959 Parcel reply = Parcel.obtain();
3960 data.writeInterfaceToken(IActivityManager.descriptor);
3961 service.writeToParcel(data, 0);
3962 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003963 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003964 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3965 reply.readException();
3966 IBinder binder = reply.readStrongBinder();
3967 reply.recycle();
3968 data.recycle();
3969 return binder;
3970 }
3971
Christopher Tate181fafa2009-05-14 11:12:14 -07003972 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3973 throws RemoteException {
3974 Parcel data = Parcel.obtain();
3975 Parcel reply = Parcel.obtain();
3976 data.writeInterfaceToken(IActivityManager.descriptor);
3977 app.writeToParcel(data, 0);
3978 data.writeInt(backupRestoreMode);
3979 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3980 reply.readException();
3981 boolean success = reply.readInt() != 0;
3982 reply.recycle();
3983 data.recycle();
3984 return success;
3985 }
3986
Christopher Tate346acb12012-10-15 19:20:25 -07003987 public void clearPendingBackup() throws RemoteException {
3988 Parcel data = Parcel.obtain();
3989 Parcel reply = Parcel.obtain();
3990 data.writeInterfaceToken(IActivityManager.descriptor);
3991 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3992 reply.recycle();
3993 data.recycle();
3994 }
3995
Christopher Tate181fafa2009-05-14 11:12:14 -07003996 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3997 Parcel data = Parcel.obtain();
3998 Parcel reply = Parcel.obtain();
3999 data.writeInterfaceToken(IActivityManager.descriptor);
4000 data.writeString(packageName);
4001 data.writeStrongBinder(agent);
4002 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4003 reply.recycle();
4004 data.recycle();
4005 }
4006
4007 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4008 Parcel data = Parcel.obtain();
4009 Parcel reply = Parcel.obtain();
4010 data.writeInterfaceToken(IActivityManager.descriptor);
4011 app.writeToParcel(data, 0);
4012 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4013 reply.readException();
4014 reply.recycle();
4015 data.recycle();
4016 }
4017
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004018 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004019 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004020 IUiAutomationConnection connection, int userId, String instructionSet)
4021 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004022 Parcel data = Parcel.obtain();
4023 Parcel reply = Parcel.obtain();
4024 data.writeInterfaceToken(IActivityManager.descriptor);
4025 ComponentName.writeToParcel(className, data);
4026 data.writeString(profileFile);
4027 data.writeInt(flags);
4028 data.writeBundle(arguments);
4029 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004030 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004031 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004032 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004033 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4034 reply.readException();
4035 boolean res = reply.readInt() != 0;
4036 reply.recycle();
4037 data.recycle();
4038 return res;
4039 }
4040
4041 public void finishInstrumentation(IApplicationThread target,
4042 int resultCode, Bundle results) throws RemoteException {
4043 Parcel data = Parcel.obtain();
4044 Parcel reply = Parcel.obtain();
4045 data.writeInterfaceToken(IActivityManager.descriptor);
4046 data.writeStrongBinder(target != null ? target.asBinder() : null);
4047 data.writeInt(resultCode);
4048 data.writeBundle(results);
4049 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4050 reply.readException();
4051 data.recycle();
4052 reply.recycle();
4053 }
4054 public Configuration getConfiguration() throws RemoteException
4055 {
4056 Parcel data = Parcel.obtain();
4057 Parcel reply = Parcel.obtain();
4058 data.writeInterfaceToken(IActivityManager.descriptor);
4059 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4060 reply.readException();
4061 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4062 reply.recycle();
4063 data.recycle();
4064 return res;
4065 }
4066 public void updateConfiguration(Configuration values) throws RemoteException
4067 {
4068 Parcel data = Parcel.obtain();
4069 Parcel reply = Parcel.obtain();
4070 data.writeInterfaceToken(IActivityManager.descriptor);
4071 values.writeToParcel(data, 0);
4072 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4073 reply.readException();
4074 data.recycle();
4075 reply.recycle();
4076 }
4077 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4078 throws RemoteException {
4079 Parcel data = Parcel.obtain();
4080 Parcel reply = Parcel.obtain();
4081 data.writeInterfaceToken(IActivityManager.descriptor);
4082 data.writeStrongBinder(token);
4083 data.writeInt(requestedOrientation);
4084 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4085 reply.readException();
4086 data.recycle();
4087 reply.recycle();
4088 }
4089 public int getRequestedOrientation(IBinder token) throws RemoteException {
4090 Parcel data = Parcel.obtain();
4091 Parcel reply = Parcel.obtain();
4092 data.writeInterfaceToken(IActivityManager.descriptor);
4093 data.writeStrongBinder(token);
4094 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4095 reply.readException();
4096 int res = reply.readInt();
4097 data.recycle();
4098 reply.recycle();
4099 return res;
4100 }
4101 public ComponentName getActivityClassForToken(IBinder token)
4102 throws RemoteException {
4103 Parcel data = Parcel.obtain();
4104 Parcel reply = Parcel.obtain();
4105 data.writeInterfaceToken(IActivityManager.descriptor);
4106 data.writeStrongBinder(token);
4107 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4108 reply.readException();
4109 ComponentName res = ComponentName.readFromParcel(reply);
4110 data.recycle();
4111 reply.recycle();
4112 return res;
4113 }
4114 public String getPackageForToken(IBinder token) throws RemoteException
4115 {
4116 Parcel data = Parcel.obtain();
4117 Parcel reply = Parcel.obtain();
4118 data.writeInterfaceToken(IActivityManager.descriptor);
4119 data.writeStrongBinder(token);
4120 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4121 reply.readException();
4122 String res = reply.readString();
4123 data.recycle();
4124 reply.recycle();
4125 return res;
4126 }
4127 public IIntentSender getIntentSender(int type,
4128 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004129 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004130 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004131 Parcel data = Parcel.obtain();
4132 Parcel reply = Parcel.obtain();
4133 data.writeInterfaceToken(IActivityManager.descriptor);
4134 data.writeInt(type);
4135 data.writeString(packageName);
4136 data.writeStrongBinder(token);
4137 data.writeString(resultWho);
4138 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004139 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004140 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004141 data.writeTypedArray(intents, 0);
4142 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004143 } else {
4144 data.writeInt(0);
4145 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004146 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004147 if (options != null) {
4148 data.writeInt(1);
4149 options.writeToParcel(data, 0);
4150 } else {
4151 data.writeInt(0);
4152 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004153 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004154 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4155 reply.readException();
4156 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004157 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004158 data.recycle();
4159 reply.recycle();
4160 return res;
4161 }
4162 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4163 Parcel data = Parcel.obtain();
4164 Parcel reply = Parcel.obtain();
4165 data.writeInterfaceToken(IActivityManager.descriptor);
4166 data.writeStrongBinder(sender.asBinder());
4167 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4168 reply.readException();
4169 data.recycle();
4170 reply.recycle();
4171 }
4172 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4173 Parcel data = Parcel.obtain();
4174 Parcel reply = Parcel.obtain();
4175 data.writeInterfaceToken(IActivityManager.descriptor);
4176 data.writeStrongBinder(sender.asBinder());
4177 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4178 reply.readException();
4179 String res = reply.readString();
4180 data.recycle();
4181 reply.recycle();
4182 return res;
4183 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004184 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4185 Parcel data = Parcel.obtain();
4186 Parcel reply = Parcel.obtain();
4187 data.writeInterfaceToken(IActivityManager.descriptor);
4188 data.writeStrongBinder(sender.asBinder());
4189 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4190 reply.readException();
4191 int res = reply.readInt();
4192 data.recycle();
4193 reply.recycle();
4194 return res;
4195 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004196 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4197 boolean requireFull, String name, String callerPackage) throws RemoteException {
4198 Parcel data = Parcel.obtain();
4199 Parcel reply = Parcel.obtain();
4200 data.writeInterfaceToken(IActivityManager.descriptor);
4201 data.writeInt(callingPid);
4202 data.writeInt(callingUid);
4203 data.writeInt(userId);
4204 data.writeInt(allowAll ? 1 : 0);
4205 data.writeInt(requireFull ? 1 : 0);
4206 data.writeString(name);
4207 data.writeString(callerPackage);
4208 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4209 reply.readException();
4210 int res = reply.readInt();
4211 data.recycle();
4212 reply.recycle();
4213 return res;
4214 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004215 public void setProcessLimit(int max) throws RemoteException
4216 {
4217 Parcel data = Parcel.obtain();
4218 Parcel reply = Parcel.obtain();
4219 data.writeInterfaceToken(IActivityManager.descriptor);
4220 data.writeInt(max);
4221 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4222 reply.readException();
4223 data.recycle();
4224 reply.recycle();
4225 }
4226 public int getProcessLimit() throws RemoteException
4227 {
4228 Parcel data = Parcel.obtain();
4229 Parcel reply = Parcel.obtain();
4230 data.writeInterfaceToken(IActivityManager.descriptor);
4231 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4232 reply.readException();
4233 int res = reply.readInt();
4234 data.recycle();
4235 reply.recycle();
4236 return res;
4237 }
4238 public void setProcessForeground(IBinder token, int pid,
4239 boolean isForeground) throws RemoteException {
4240 Parcel data = Parcel.obtain();
4241 Parcel reply = Parcel.obtain();
4242 data.writeInterfaceToken(IActivityManager.descriptor);
4243 data.writeStrongBinder(token);
4244 data.writeInt(pid);
4245 data.writeInt(isForeground ? 1 : 0);
4246 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4247 reply.readException();
4248 data.recycle();
4249 reply.recycle();
4250 }
4251 public int checkPermission(String permission, int pid, int uid)
4252 throws RemoteException {
4253 Parcel data = Parcel.obtain();
4254 Parcel reply = Parcel.obtain();
4255 data.writeInterfaceToken(IActivityManager.descriptor);
4256 data.writeString(permission);
4257 data.writeInt(pid);
4258 data.writeInt(uid);
4259 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4260 reply.readException();
4261 int res = reply.readInt();
4262 data.recycle();
4263 reply.recycle();
4264 return res;
4265 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004266 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4267 throws RemoteException {
4268 Parcel data = Parcel.obtain();
4269 Parcel reply = Parcel.obtain();
4270 data.writeInterfaceToken(IActivityManager.descriptor);
4271 data.writeString(permission);
4272 data.writeInt(pid);
4273 data.writeInt(uid);
4274 data.writeStrongBinder(callerToken);
4275 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4276 reply.readException();
4277 int res = reply.readInt();
4278 data.recycle();
4279 reply.recycle();
4280 return res;
4281 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004282 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004283 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004284 Parcel data = Parcel.obtain();
4285 Parcel reply = Parcel.obtain();
4286 data.writeInterfaceToken(IActivityManager.descriptor);
4287 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004288 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004289 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004290 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4291 reply.readException();
4292 boolean res = reply.readInt() != 0;
4293 data.recycle();
4294 reply.recycle();
4295 return res;
4296 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004297 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4298 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004299 Parcel data = Parcel.obtain();
4300 Parcel reply = Parcel.obtain();
4301 data.writeInterfaceToken(IActivityManager.descriptor);
4302 uri.writeToParcel(data, 0);
4303 data.writeInt(pid);
4304 data.writeInt(uid);
4305 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004306 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004307 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004308 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4309 reply.readException();
4310 int res = reply.readInt();
4311 data.recycle();
4312 reply.recycle();
4313 return res;
4314 }
4315 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004316 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004317 Parcel data = Parcel.obtain();
4318 Parcel reply = Parcel.obtain();
4319 data.writeInterfaceToken(IActivityManager.descriptor);
4320 data.writeStrongBinder(caller.asBinder());
4321 data.writeString(targetPkg);
4322 uri.writeToParcel(data, 0);
4323 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004324 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004325 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4326 reply.readException();
4327 data.recycle();
4328 reply.recycle();
4329 }
4330 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004331 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004332 Parcel data = Parcel.obtain();
4333 Parcel reply = Parcel.obtain();
4334 data.writeInterfaceToken(IActivityManager.descriptor);
4335 data.writeStrongBinder(caller.asBinder());
4336 uri.writeToParcel(data, 0);
4337 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004338 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004339 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4340 reply.readException();
4341 data.recycle();
4342 reply.recycle();
4343 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004344
4345 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004346 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4347 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004348 Parcel data = Parcel.obtain();
4349 Parcel reply = Parcel.obtain();
4350 data.writeInterfaceToken(IActivityManager.descriptor);
4351 uri.writeToParcel(data, 0);
4352 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004353 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004354 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4355 reply.readException();
4356 data.recycle();
4357 reply.recycle();
4358 }
4359
4360 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004361 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4362 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004363 Parcel data = Parcel.obtain();
4364 Parcel reply = Parcel.obtain();
4365 data.writeInterfaceToken(IActivityManager.descriptor);
4366 uri.writeToParcel(data, 0);
4367 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004368 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004369 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4370 reply.readException();
4371 data.recycle();
4372 reply.recycle();
4373 }
4374
4375 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004376 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4377 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004378 Parcel data = Parcel.obtain();
4379 Parcel reply = Parcel.obtain();
4380 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004381 data.writeString(packageName);
4382 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004383 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4384 reply.readException();
4385 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4386 reply);
4387 data.recycle();
4388 reply.recycle();
4389 return perms;
4390 }
4391
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004392 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4393 throws RemoteException {
4394 Parcel data = Parcel.obtain();
4395 Parcel reply = Parcel.obtain();
4396 data.writeInterfaceToken(IActivityManager.descriptor);
4397 data.writeStrongBinder(who.asBinder());
4398 data.writeInt(waiting ? 1 : 0);
4399 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4400 reply.readException();
4401 data.recycle();
4402 reply.recycle();
4403 }
4404 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4405 Parcel data = Parcel.obtain();
4406 Parcel reply = Parcel.obtain();
4407 data.writeInterfaceToken(IActivityManager.descriptor);
4408 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4409 reply.readException();
4410 outInfo.readFromParcel(reply);
4411 data.recycle();
4412 reply.recycle();
4413 }
4414 public void unhandledBack() throws RemoteException
4415 {
4416 Parcel data = Parcel.obtain();
4417 Parcel reply = Parcel.obtain();
4418 data.writeInterfaceToken(IActivityManager.descriptor);
4419 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4420 reply.readException();
4421 data.recycle();
4422 reply.recycle();
4423 }
4424 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4425 {
4426 Parcel data = Parcel.obtain();
4427 Parcel reply = Parcel.obtain();
4428 data.writeInterfaceToken(IActivityManager.descriptor);
4429 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4430 reply.readException();
4431 ParcelFileDescriptor pfd = null;
4432 if (reply.readInt() != 0) {
4433 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4434 }
4435 data.recycle();
4436 reply.recycle();
4437 return pfd;
4438 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004439 public void setLockScreenShown(boolean shown) throws RemoteException
4440 {
4441 Parcel data = Parcel.obtain();
4442 Parcel reply = Parcel.obtain();
4443 data.writeInterfaceToken(IActivityManager.descriptor);
4444 data.writeInt(shown ? 1 : 0);
4445 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4446 reply.readException();
4447 data.recycle();
4448 reply.recycle();
4449 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004450 public void setDebugApp(
4451 String packageName, boolean waitForDebugger, boolean persistent)
4452 throws RemoteException
4453 {
4454 Parcel data = Parcel.obtain();
4455 Parcel reply = Parcel.obtain();
4456 data.writeInterfaceToken(IActivityManager.descriptor);
4457 data.writeString(packageName);
4458 data.writeInt(waitForDebugger ? 1 : 0);
4459 data.writeInt(persistent ? 1 : 0);
4460 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4461 reply.readException();
4462 data.recycle();
4463 reply.recycle();
4464 }
4465 public void setAlwaysFinish(boolean enabled) throws RemoteException
4466 {
4467 Parcel data = Parcel.obtain();
4468 Parcel reply = Parcel.obtain();
4469 data.writeInterfaceToken(IActivityManager.descriptor);
4470 data.writeInt(enabled ? 1 : 0);
4471 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4472 reply.readException();
4473 data.recycle();
4474 reply.recycle();
4475 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004476 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004477 {
4478 Parcel data = Parcel.obtain();
4479 Parcel reply = Parcel.obtain();
4480 data.writeInterfaceToken(IActivityManager.descriptor);
4481 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004482 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004483 reply.readException();
4484 data.recycle();
4485 reply.recycle();
4486 }
4487 public void enterSafeMode() throws RemoteException {
4488 Parcel data = Parcel.obtain();
4489 data.writeInterfaceToken(IActivityManager.descriptor);
4490 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4491 data.recycle();
4492 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004493 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004494 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004495 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004496 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004497 data.writeStrongBinder(sender.asBinder());
4498 data.writeInt(sourceUid);
4499 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004500 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004501 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4502 data.recycle();
4503 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004504 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4505 throws RemoteException {
4506 Parcel data = Parcel.obtain();
4507 data.writeInterfaceToken(IActivityManager.descriptor);
4508 data.writeStrongBinder(sender.asBinder());
4509 data.writeInt(sourceUid);
4510 data.writeString(tag);
4511 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4512 data.recycle();
4513 }
4514 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4515 throws RemoteException {
4516 Parcel data = Parcel.obtain();
4517 data.writeInterfaceToken(IActivityManager.descriptor);
4518 data.writeStrongBinder(sender.asBinder());
4519 data.writeInt(sourceUid);
4520 data.writeString(tag);
4521 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4522 data.recycle();
4523 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004524 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004525 Parcel data = Parcel.obtain();
4526 Parcel reply = Parcel.obtain();
4527 data.writeInterfaceToken(IActivityManager.descriptor);
4528 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004529 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004530 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004531 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004532 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004533 boolean res = reply.readInt() != 0;
4534 data.recycle();
4535 reply.recycle();
4536 return res;
4537 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004538 @Override
4539 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4540 Parcel data = Parcel.obtain();
4541 Parcel reply = Parcel.obtain();
4542 data.writeInterfaceToken(IActivityManager.descriptor);
4543 data.writeString(reason);
4544 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4545 boolean res = reply.readInt() != 0;
4546 data.recycle();
4547 reply.recycle();
4548 return res;
4549 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004550 public boolean testIsSystemReady()
4551 {
4552 /* this base class version is never called */
4553 return true;
4554 }
Dan Egnor60d87622009-12-16 16:32:58 -08004555 public void handleApplicationCrash(IBinder app,
4556 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4557 {
4558 Parcel data = Parcel.obtain();
4559 Parcel reply = Parcel.obtain();
4560 data.writeInterfaceToken(IActivityManager.descriptor);
4561 data.writeStrongBinder(app);
4562 crashInfo.writeToParcel(data, 0);
4563 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4564 reply.readException();
4565 reply.recycle();
4566 data.recycle();
4567 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004568
Dianne Hackborn52322712014-08-26 22:47:26 -07004569 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004570 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004571 {
4572 Parcel data = Parcel.obtain();
4573 Parcel reply = Parcel.obtain();
4574 data.writeInterfaceToken(IActivityManager.descriptor);
4575 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004576 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004577 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004578 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004579 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004580 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004581 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004582 reply.recycle();
4583 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004584 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004585 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004586
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004587 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004588 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004589 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004590 {
4591 Parcel data = Parcel.obtain();
4592 Parcel reply = Parcel.obtain();
4593 data.writeInterfaceToken(IActivityManager.descriptor);
4594 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004595 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004596 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004597 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4598 reply.readException();
4599 reply.recycle();
4600 data.recycle();
4601 }
4602
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004603 public void signalPersistentProcesses(int sig) throws RemoteException {
4604 Parcel data = Parcel.obtain();
4605 Parcel reply = Parcel.obtain();
4606 data.writeInterfaceToken(IActivityManager.descriptor);
4607 data.writeInt(sig);
4608 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4609 reply.readException();
4610 data.recycle();
4611 reply.recycle();
4612 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004613
Dianne Hackborn1676c852012-09-10 14:52:30 -07004614 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004615 Parcel data = Parcel.obtain();
4616 Parcel reply = Parcel.obtain();
4617 data.writeInterfaceToken(IActivityManager.descriptor);
4618 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004619 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004620 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4621 reply.readException();
4622 data.recycle();
4623 reply.recycle();
4624 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004625
4626 public void killAllBackgroundProcesses() throws RemoteException {
4627 Parcel data = Parcel.obtain();
4628 Parcel reply = Parcel.obtain();
4629 data.writeInterfaceToken(IActivityManager.descriptor);
4630 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4631 reply.readException();
4632 data.recycle();
4633 reply.recycle();
4634 }
4635
Dianne Hackborn1676c852012-09-10 14:52:30 -07004636 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004637 Parcel data = Parcel.obtain();
4638 Parcel reply = Parcel.obtain();
4639 data.writeInterfaceToken(IActivityManager.descriptor);
4640 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004641 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004642 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004643 reply.readException();
4644 data.recycle();
4645 reply.recycle();
4646 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004647
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004648 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4649 throws RemoteException
4650 {
4651 Parcel data = Parcel.obtain();
4652 Parcel reply = Parcel.obtain();
4653 data.writeInterfaceToken(IActivityManager.descriptor);
4654 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4655 reply.readException();
4656 outInfo.readFromParcel(reply);
4657 reply.recycle();
4658 data.recycle();
4659 }
4660
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004661 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4662 {
4663 Parcel data = Parcel.obtain();
4664 Parcel reply = Parcel.obtain();
4665 data.writeInterfaceToken(IActivityManager.descriptor);
4666 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4667 reply.readException();
4668 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4669 reply.recycle();
4670 data.recycle();
4671 return res;
4672 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004673
Dianne Hackborn1676c852012-09-10 14:52:30 -07004674 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004675 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004676 {
4677 Parcel data = Parcel.obtain();
4678 Parcel reply = Parcel.obtain();
4679 data.writeInterfaceToken(IActivityManager.descriptor);
4680 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004681 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004682 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004683 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004684 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004685 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004686 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004687 } else {
4688 data.writeInt(0);
4689 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004690 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4691 reply.readException();
4692 boolean res = reply.readInt() != 0;
4693 reply.recycle();
4694 data.recycle();
4695 return res;
4696 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004697
Dianne Hackborn55280a92009-05-07 15:53:46 -07004698 public boolean shutdown(int timeout) throws RemoteException
4699 {
4700 Parcel data = Parcel.obtain();
4701 Parcel reply = Parcel.obtain();
4702 data.writeInterfaceToken(IActivityManager.descriptor);
4703 data.writeInt(timeout);
4704 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4705 reply.readException();
4706 boolean res = reply.readInt() != 0;
4707 reply.recycle();
4708 data.recycle();
4709 return res;
4710 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004711
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004712 public void stopAppSwitches() throws RemoteException {
4713 Parcel data = Parcel.obtain();
4714 Parcel reply = Parcel.obtain();
4715 data.writeInterfaceToken(IActivityManager.descriptor);
4716 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4717 reply.readException();
4718 reply.recycle();
4719 data.recycle();
4720 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004721
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004722 public void resumeAppSwitches() throws RemoteException {
4723 Parcel data = Parcel.obtain();
4724 Parcel reply = Parcel.obtain();
4725 data.writeInterfaceToken(IActivityManager.descriptor);
4726 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4727 reply.readException();
4728 reply.recycle();
4729 data.recycle();
4730 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004731
4732 public void addPackageDependency(String packageName) throws RemoteException {
4733 Parcel data = Parcel.obtain();
4734 Parcel reply = Parcel.obtain();
4735 data.writeInterfaceToken(IActivityManager.descriptor);
4736 data.writeString(packageName);
4737 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4738 reply.readException();
4739 data.recycle();
4740 reply.recycle();
4741 }
4742
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004743 public void killApplicationWithAppId(String pkg, int appid, String reason)
4744 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004745 Parcel data = Parcel.obtain();
4746 Parcel reply = Parcel.obtain();
4747 data.writeInterfaceToken(IActivityManager.descriptor);
4748 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004749 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004750 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004751 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004752 reply.readException();
4753 data.recycle();
4754 reply.recycle();
4755 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004756
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004757 public void closeSystemDialogs(String reason) throws RemoteException {
4758 Parcel data = Parcel.obtain();
4759 Parcel reply = Parcel.obtain();
4760 data.writeInterfaceToken(IActivityManager.descriptor);
4761 data.writeString(reason);
4762 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4763 reply.readException();
4764 data.recycle();
4765 reply.recycle();
4766 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004767
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004768 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004769 throws RemoteException {
4770 Parcel data = Parcel.obtain();
4771 Parcel reply = Parcel.obtain();
4772 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004773 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004774 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4775 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004776 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004777 data.recycle();
4778 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004779 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004780 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004781
4782 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4783 Parcel data = Parcel.obtain();
4784 Parcel reply = Parcel.obtain();
4785 data.writeInterfaceToken(IActivityManager.descriptor);
4786 data.writeString(processName);
4787 data.writeInt(uid);
4788 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4789 reply.readException();
4790 data.recycle();
4791 reply.recycle();
4792 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004793
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004794 public void overridePendingTransition(IBinder token, String packageName,
4795 int enterAnim, int exitAnim) throws RemoteException {
4796 Parcel data = Parcel.obtain();
4797 Parcel reply = Parcel.obtain();
4798 data.writeInterfaceToken(IActivityManager.descriptor);
4799 data.writeStrongBinder(token);
4800 data.writeString(packageName);
4801 data.writeInt(enterAnim);
4802 data.writeInt(exitAnim);
4803 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4804 reply.readException();
4805 data.recycle();
4806 reply.recycle();
4807 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004808
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004809 public boolean isUserAMonkey() throws RemoteException {
4810 Parcel data = Parcel.obtain();
4811 Parcel reply = Parcel.obtain();
4812 data.writeInterfaceToken(IActivityManager.descriptor);
4813 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4814 reply.readException();
4815 boolean res = reply.readInt() != 0;
4816 data.recycle();
4817 reply.recycle();
4818 return res;
4819 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004820
4821 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4822 Parcel data = Parcel.obtain();
4823 Parcel reply = Parcel.obtain();
4824 data.writeInterfaceToken(IActivityManager.descriptor);
4825 data.writeInt(monkey ? 1 : 0);
4826 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4827 reply.readException();
4828 data.recycle();
4829 reply.recycle();
4830 }
4831
Dianne Hackborn860755f2010-06-03 18:47:52 -07004832 public void finishHeavyWeightApp() throws RemoteException {
4833 Parcel data = Parcel.obtain();
4834 Parcel reply = Parcel.obtain();
4835 data.writeInterfaceToken(IActivityManager.descriptor);
4836 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4837 reply.readException();
4838 data.recycle();
4839 reply.recycle();
4840 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004841
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004842 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004843 throws RemoteException {
4844 Parcel data = Parcel.obtain();
4845 Parcel reply = Parcel.obtain();
4846 data.writeInterfaceToken(IActivityManager.descriptor);
4847 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004848 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4849 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004850 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004851 data.recycle();
4852 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004853 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004854 }
4855
Craig Mautner233ceee2014-05-09 17:05:11 -07004856 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004857 throws RemoteException {
4858 Parcel data = Parcel.obtain();
4859 Parcel reply = Parcel.obtain();
4860 data.writeInterfaceToken(IActivityManager.descriptor);
4861 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004862 if (options == null) {
4863 data.writeInt(0);
4864 } else {
4865 data.writeInt(1);
4866 data.writeBundle(options.toBundle());
4867 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004868 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004869 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004870 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004871 data.recycle();
4872 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004873 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004874 }
4875
Craig Mautner233ceee2014-05-09 17:05:11 -07004876 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4877 Parcel data = Parcel.obtain();
4878 Parcel reply = Parcel.obtain();
4879 data.writeInterfaceToken(IActivityManager.descriptor);
4880 data.writeStrongBinder(token);
4881 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4882 reply.readException();
4883 Bundle bundle = reply.readBundle();
4884 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4885 data.recycle();
4886 reply.recycle();
4887 return options;
4888 }
4889
Daniel Sandler69a48172010-06-23 16:29:36 -04004890 public void setImmersive(IBinder token, boolean immersive)
4891 throws RemoteException {
4892 Parcel data = Parcel.obtain();
4893 Parcel reply = Parcel.obtain();
4894 data.writeInterfaceToken(IActivityManager.descriptor);
4895 data.writeStrongBinder(token);
4896 data.writeInt(immersive ? 1 : 0);
4897 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4898 reply.readException();
4899 data.recycle();
4900 reply.recycle();
4901 }
4902
4903 public boolean isImmersive(IBinder token)
4904 throws RemoteException {
4905 Parcel data = Parcel.obtain();
4906 Parcel reply = Parcel.obtain();
4907 data.writeInterfaceToken(IActivityManager.descriptor);
4908 data.writeStrongBinder(token);
4909 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004910 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004911 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004912 data.recycle();
4913 reply.recycle();
4914 return res;
4915 }
4916
Craig Mautnerd61dc202014-07-07 11:09:11 -07004917 public boolean isTopOfTask(IBinder token) throws RemoteException {
4918 Parcel data = Parcel.obtain();
4919 Parcel reply = Parcel.obtain();
4920 data.writeInterfaceToken(IActivityManager.descriptor);
4921 data.writeStrongBinder(token);
4922 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4923 reply.readException();
4924 boolean res = reply.readInt() == 1;
4925 data.recycle();
4926 reply.recycle();
4927 return res;
4928 }
4929
Daniel Sandler69a48172010-06-23 16:29:36 -04004930 public boolean isTopActivityImmersive()
4931 throws RemoteException {
4932 Parcel data = Parcel.obtain();
4933 Parcel reply = Parcel.obtain();
4934 data.writeInterfaceToken(IActivityManager.descriptor);
4935 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004936 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004937 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004938 data.recycle();
4939 reply.recycle();
4940 return res;
4941 }
4942
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004943 public void crashApplication(int uid, int initialPid, String packageName,
4944 String message) throws RemoteException {
4945 Parcel data = Parcel.obtain();
4946 Parcel reply = Parcel.obtain();
4947 data.writeInterfaceToken(IActivityManager.descriptor);
4948 data.writeInt(uid);
4949 data.writeInt(initialPid);
4950 data.writeString(packageName);
4951 data.writeString(message);
4952 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4953 reply.readException();
4954 data.recycle();
4955 reply.recycle();
4956 }
Andy McFadden824c5102010-07-09 16:26:57 -07004957
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004958 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004959 Parcel data = Parcel.obtain();
4960 Parcel reply = Parcel.obtain();
4961 data.writeInterfaceToken(IActivityManager.descriptor);
4962 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004963 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004964 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4965 reply.readException();
4966 String res = reply.readString();
4967 data.recycle();
4968 reply.recycle();
4969 return res;
4970 }
4971
Dianne Hackborn7e269642010-08-25 19:50:20 -07004972 public IBinder newUriPermissionOwner(String name)
4973 throws RemoteException {
4974 Parcel data = Parcel.obtain();
4975 Parcel reply = Parcel.obtain();
4976 data.writeInterfaceToken(IActivityManager.descriptor);
4977 data.writeString(name);
4978 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4979 reply.readException();
4980 IBinder res = reply.readStrongBinder();
4981 data.recycle();
4982 reply.recycle();
4983 return res;
4984 }
4985
4986 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004987 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004988 Parcel data = Parcel.obtain();
4989 Parcel reply = Parcel.obtain();
4990 data.writeInterfaceToken(IActivityManager.descriptor);
4991 data.writeStrongBinder(owner);
4992 data.writeInt(fromUid);
4993 data.writeString(targetPkg);
4994 uri.writeToParcel(data, 0);
4995 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004996 data.writeInt(sourceUserId);
4997 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004998 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4999 reply.readException();
5000 data.recycle();
5001 reply.recycle();
5002 }
5003
5004 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005005 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005006 Parcel data = Parcel.obtain();
5007 Parcel reply = Parcel.obtain();
5008 data.writeInterfaceToken(IActivityManager.descriptor);
5009 data.writeStrongBinder(owner);
5010 if (uri != null) {
5011 data.writeInt(1);
5012 uri.writeToParcel(data, 0);
5013 } else {
5014 data.writeInt(0);
5015 }
5016 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005017 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005018 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5019 reply.readException();
5020 data.recycle();
5021 reply.recycle();
5022 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005023
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005024 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005025 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005026 Parcel data = Parcel.obtain();
5027 Parcel reply = Parcel.obtain();
5028 data.writeInterfaceToken(IActivityManager.descriptor);
5029 data.writeInt(callingUid);
5030 data.writeString(targetPkg);
5031 uri.writeToParcel(data, 0);
5032 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005033 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005034 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5035 reply.readException();
5036 int res = reply.readInt();
5037 data.recycle();
5038 reply.recycle();
5039 return res;
5040 }
5041
Dianne Hackborn1676c852012-09-10 14:52:30 -07005042 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005043 String path, ParcelFileDescriptor fd) throws RemoteException {
5044 Parcel data = Parcel.obtain();
5045 Parcel reply = Parcel.obtain();
5046 data.writeInterfaceToken(IActivityManager.descriptor);
5047 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005048 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005049 data.writeInt(managed ? 1 : 0);
5050 data.writeString(path);
5051 if (fd != null) {
5052 data.writeInt(1);
5053 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5054 } else {
5055 data.writeInt(0);
5056 }
5057 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5058 reply.readException();
5059 boolean res = reply.readInt() != 0;
5060 reply.recycle();
5061 data.recycle();
5062 return res;
5063 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005064
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005065 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005066 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005067 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005068 Parcel data = Parcel.obtain();
5069 Parcel reply = Parcel.obtain();
5070 data.writeInterfaceToken(IActivityManager.descriptor);
5071 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005072 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005073 data.writeTypedArray(intents, 0);
5074 data.writeStringArray(resolvedTypes);
5075 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005076 if (options != null) {
5077 data.writeInt(1);
5078 options.writeToParcel(data, 0);
5079 } else {
5080 data.writeInt(0);
5081 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005082 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005083 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5084 reply.readException();
5085 int result = reply.readInt();
5086 reply.recycle();
5087 data.recycle();
5088 return result;
5089 }
5090
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005091 public int getFrontActivityScreenCompatMode() throws RemoteException {
5092 Parcel data = Parcel.obtain();
5093 Parcel reply = Parcel.obtain();
5094 data.writeInterfaceToken(IActivityManager.descriptor);
5095 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5096 reply.readException();
5097 int mode = reply.readInt();
5098 reply.recycle();
5099 data.recycle();
5100 return mode;
5101 }
5102
5103 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5104 Parcel data = Parcel.obtain();
5105 Parcel reply = Parcel.obtain();
5106 data.writeInterfaceToken(IActivityManager.descriptor);
5107 data.writeInt(mode);
5108 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5109 reply.readException();
5110 reply.recycle();
5111 data.recycle();
5112 }
5113
5114 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5115 Parcel data = Parcel.obtain();
5116 Parcel reply = Parcel.obtain();
5117 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005118 data.writeString(packageName);
5119 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005120 reply.readException();
5121 int mode = reply.readInt();
5122 reply.recycle();
5123 data.recycle();
5124 return mode;
5125 }
5126
5127 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005128 throws RemoteException {
5129 Parcel data = Parcel.obtain();
5130 Parcel reply = Parcel.obtain();
5131 data.writeInterfaceToken(IActivityManager.descriptor);
5132 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005133 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005134 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5135 reply.readException();
5136 reply.recycle();
5137 data.recycle();
5138 }
5139
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005140 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5141 Parcel data = Parcel.obtain();
5142 Parcel reply = Parcel.obtain();
5143 data.writeInterfaceToken(IActivityManager.descriptor);
5144 data.writeString(packageName);
5145 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5146 reply.readException();
5147 boolean ask = reply.readInt() != 0;
5148 reply.recycle();
5149 data.recycle();
5150 return ask;
5151 }
5152
5153 public void setPackageAskScreenCompat(String packageName, boolean ask)
5154 throws RemoteException {
5155 Parcel data = Parcel.obtain();
5156 Parcel reply = Parcel.obtain();
5157 data.writeInterfaceToken(IActivityManager.descriptor);
5158 data.writeString(packageName);
5159 data.writeInt(ask ? 1 : 0);
5160 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5161 reply.readException();
5162 reply.recycle();
5163 data.recycle();
5164 }
5165
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005166 public boolean switchUser(int userid) throws RemoteException {
5167 Parcel data = Parcel.obtain();
5168 Parcel reply = Parcel.obtain();
5169 data.writeInterfaceToken(IActivityManager.descriptor);
5170 data.writeInt(userid);
5171 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5172 reply.readException();
5173 boolean result = reply.readInt() != 0;
5174 reply.recycle();
5175 data.recycle();
5176 return result;
5177 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005178
Kenny Guy08488bf2014-02-21 17:40:37 +00005179 public boolean startUserInBackground(int userid) throws RemoteException {
5180 Parcel data = Parcel.obtain();
5181 Parcel reply = Parcel.obtain();
5182 data.writeInterfaceToken(IActivityManager.descriptor);
5183 data.writeInt(userid);
5184 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5185 reply.readException();
5186 boolean result = reply.readInt() != 0;
5187 reply.recycle();
5188 data.recycle();
5189 return result;
5190 }
5191
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005192 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5193 Parcel data = Parcel.obtain();
5194 Parcel reply = Parcel.obtain();
5195 data.writeInterfaceToken(IActivityManager.descriptor);
5196 data.writeInt(userid);
5197 data.writeStrongInterface(callback);
5198 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5199 reply.readException();
5200 int result = reply.readInt();
5201 reply.recycle();
5202 data.recycle();
5203 return result;
5204 }
5205
Amith Yamasani52f1d752012-03-28 18:19:29 -07005206 public UserInfo getCurrentUser() throws RemoteException {
5207 Parcel data = Parcel.obtain();
5208 Parcel reply = Parcel.obtain();
5209 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005210 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005211 reply.readException();
5212 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5213 reply.recycle();
5214 data.recycle();
5215 return userInfo;
5216 }
5217
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005218 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005219 Parcel data = Parcel.obtain();
5220 Parcel reply = Parcel.obtain();
5221 data.writeInterfaceToken(IActivityManager.descriptor);
5222 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005223 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005224 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5225 reply.readException();
5226 boolean result = reply.readInt() != 0;
5227 reply.recycle();
5228 data.recycle();
5229 return result;
5230 }
5231
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005232 public int[] getRunningUserIds() throws RemoteException {
5233 Parcel data = Parcel.obtain();
5234 Parcel reply = Parcel.obtain();
5235 data.writeInterfaceToken(IActivityManager.descriptor);
5236 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5237 reply.readException();
5238 int[] result = reply.createIntArray();
5239 reply.recycle();
5240 data.recycle();
5241 return result;
5242 }
5243
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005244 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005245 Parcel data = Parcel.obtain();
5246 Parcel reply = Parcel.obtain();
5247 data.writeInterfaceToken(IActivityManager.descriptor);
5248 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005249 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5250 reply.readException();
5251 boolean result = reply.readInt() != 0;
5252 reply.recycle();
5253 data.recycle();
5254 return result;
5255 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005256
Jeff Sharkeya4620792011-05-20 15:29:23 -07005257 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5258 Parcel data = Parcel.obtain();
5259 Parcel reply = Parcel.obtain();
5260 data.writeInterfaceToken(IActivityManager.descriptor);
5261 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5262 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5263 reply.readException();
5264 data.recycle();
5265 reply.recycle();
5266 }
5267
5268 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5269 Parcel data = Parcel.obtain();
5270 Parcel reply = Parcel.obtain();
5271 data.writeInterfaceToken(IActivityManager.descriptor);
5272 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5273 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5274 reply.readException();
5275 data.recycle();
5276 reply.recycle();
5277 }
5278
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005279 public void registerUidObserver(IUidObserver observer) throws RemoteException {
5280 Parcel data = Parcel.obtain();
5281 Parcel reply = Parcel.obtain();
5282 data.writeInterfaceToken(IActivityManager.descriptor);
5283 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5284 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5285 reply.readException();
5286 data.recycle();
5287 reply.recycle();
5288 }
5289
5290 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5291 Parcel data = Parcel.obtain();
5292 Parcel reply = Parcel.obtain();
5293 data.writeInterfaceToken(IActivityManager.descriptor);
5294 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5295 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5296 reply.readException();
5297 data.recycle();
5298 reply.recycle();
5299 }
5300
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005301 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5302 Parcel data = Parcel.obtain();
5303 Parcel reply = Parcel.obtain();
5304 data.writeInterfaceToken(IActivityManager.descriptor);
5305 data.writeStrongBinder(sender.asBinder());
5306 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5307 reply.readException();
5308 boolean res = reply.readInt() != 0;
5309 data.recycle();
5310 reply.recycle();
5311 return res;
5312 }
5313
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005314 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5315 Parcel data = Parcel.obtain();
5316 Parcel reply = Parcel.obtain();
5317 data.writeInterfaceToken(IActivityManager.descriptor);
5318 data.writeStrongBinder(sender.asBinder());
5319 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5320 reply.readException();
5321 boolean res = reply.readInt() != 0;
5322 data.recycle();
5323 reply.recycle();
5324 return res;
5325 }
5326
Dianne Hackborn81038902012-11-26 17:04:09 -08005327 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5328 Parcel data = Parcel.obtain();
5329 Parcel reply = Parcel.obtain();
5330 data.writeInterfaceToken(IActivityManager.descriptor);
5331 data.writeStrongBinder(sender.asBinder());
5332 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5333 reply.readException();
5334 Intent res = reply.readInt() != 0
5335 ? Intent.CREATOR.createFromParcel(reply) : null;
5336 data.recycle();
5337 reply.recycle();
5338 return res;
5339 }
5340
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005341 public String getTagForIntentSender(IIntentSender sender, String prefix)
5342 throws RemoteException {
5343 Parcel data = Parcel.obtain();
5344 Parcel reply = Parcel.obtain();
5345 data.writeInterfaceToken(IActivityManager.descriptor);
5346 data.writeStrongBinder(sender.asBinder());
5347 data.writeString(prefix);
5348 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5349 reply.readException();
5350 String res = reply.readString();
5351 data.recycle();
5352 reply.recycle();
5353 return res;
5354 }
5355
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005356 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5357 {
5358 Parcel data = Parcel.obtain();
5359 Parcel reply = Parcel.obtain();
5360 data.writeInterfaceToken(IActivityManager.descriptor);
5361 values.writeToParcel(data, 0);
5362 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5363 reply.readException();
5364 data.recycle();
5365 reply.recycle();
5366 }
5367
Dianne Hackbornb437e092011-08-05 17:50:29 -07005368 public long[] getProcessPss(int[] pids) throws RemoteException {
5369 Parcel data = Parcel.obtain();
5370 Parcel reply = Parcel.obtain();
5371 data.writeInterfaceToken(IActivityManager.descriptor);
5372 data.writeIntArray(pids);
5373 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5374 reply.readException();
5375 long[] res = reply.createLongArray();
5376 data.recycle();
5377 reply.recycle();
5378 return res;
5379 }
5380
Dianne Hackborn661cd522011-08-22 00:26:20 -07005381 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5382 Parcel data = Parcel.obtain();
5383 Parcel reply = Parcel.obtain();
5384 data.writeInterfaceToken(IActivityManager.descriptor);
5385 TextUtils.writeToParcel(msg, data, 0);
5386 data.writeInt(always ? 1 : 0);
5387 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5388 reply.readException();
5389 data.recycle();
5390 reply.recycle();
5391 }
5392
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005393 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005394 Parcel data = Parcel.obtain();
5395 Parcel reply = Parcel.obtain();
5396 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005397 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005398 reply.readException();
5399 data.recycle();
5400 reply.recycle();
5401 }
5402
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005403 public void keyguardGoingAway(boolean disableWindowAnimations,
5404 boolean keyguardGoingToNotificationShade) throws RemoteException {
5405 Parcel data = Parcel.obtain();
5406 Parcel reply = Parcel.obtain();
5407 data.writeInterfaceToken(IActivityManager.descriptor);
5408 data.writeInt(disableWindowAnimations ? 1 : 0);
5409 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5410 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5411 reply.readException();
5412 data.recycle();
5413 reply.recycle();
5414 }
5415
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005416 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005417 throws RemoteException {
5418 Parcel data = Parcel.obtain();
5419 Parcel reply = Parcel.obtain();
5420 data.writeInterfaceToken(IActivityManager.descriptor);
5421 data.writeStrongBinder(token);
5422 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005423 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005424 reply.readException();
5425 boolean result = reply.readInt() != 0;
5426 data.recycle();
5427 reply.recycle();
5428 return result;
5429 }
5430
5431 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5432 throws RemoteException {
5433 Parcel data = Parcel.obtain();
5434 Parcel reply = Parcel.obtain();
5435 data.writeInterfaceToken(IActivityManager.descriptor);
5436 data.writeStrongBinder(token);
5437 target.writeToParcel(data, 0);
5438 data.writeInt(resultCode);
5439 if (resultData != null) {
5440 data.writeInt(1);
5441 resultData.writeToParcel(data, 0);
5442 } else {
5443 data.writeInt(0);
5444 }
5445 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5446 reply.readException();
5447 boolean result = reply.readInt() != 0;
5448 data.recycle();
5449 reply.recycle();
5450 return result;
5451 }
5452
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005453 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5454 Parcel data = Parcel.obtain();
5455 Parcel reply = Parcel.obtain();
5456 data.writeInterfaceToken(IActivityManager.descriptor);
5457 data.writeStrongBinder(activityToken);
5458 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5459 reply.readException();
5460 int result = reply.readInt();
5461 data.recycle();
5462 reply.recycle();
5463 return result;
5464 }
5465
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005466 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5467 Parcel data = Parcel.obtain();
5468 Parcel reply = Parcel.obtain();
5469 data.writeInterfaceToken(IActivityManager.descriptor);
5470 data.writeStrongBinder(activityToken);
5471 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5472 reply.readException();
5473 String result = reply.readString();
5474 data.recycle();
5475 reply.recycle();
5476 return result;
5477 }
5478
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005479 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5480 Parcel data = Parcel.obtain();
5481 Parcel reply = Parcel.obtain();
5482 data.writeInterfaceToken(IActivityManager.descriptor);
5483 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5484 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5485 reply.readException();
5486 data.recycle();
5487 reply.recycle();
5488 }
5489
5490 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5491 Parcel data = Parcel.obtain();
5492 Parcel reply = Parcel.obtain();
5493 data.writeInterfaceToken(IActivityManager.descriptor);
5494 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5495 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5496 reply.readException();
5497 data.recycle();
5498 reply.recycle();
5499 }
5500
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005501 public void requestBugReport() throws RemoteException {
5502 Parcel data = Parcel.obtain();
5503 Parcel reply = Parcel.obtain();
5504 data.writeInterfaceToken(IActivityManager.descriptor);
5505 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5506 reply.readException();
5507 data.recycle();
5508 reply.recycle();
5509 }
5510
Jeff Brownbd181bb2013-09-10 16:44:24 -07005511 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5512 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005513 Parcel data = Parcel.obtain();
5514 Parcel reply = Parcel.obtain();
5515 data.writeInterfaceToken(IActivityManager.descriptor);
5516 data.writeInt(pid);
5517 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005518 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005519 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5520 reply.readException();
5521 long res = reply.readInt();
5522 data.recycle();
5523 reply.recycle();
5524 return res;
5525 }
5526
Adam Skorydfc7fd72013-08-05 19:23:41 -07005527 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005528 Parcel data = Parcel.obtain();
5529 Parcel reply = Parcel.obtain();
5530 data.writeInterfaceToken(IActivityManager.descriptor);
5531 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005532 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005533 reply.readException();
5534 Bundle res = reply.readBundle();
5535 data.recycle();
5536 reply.recycle();
5537 return res;
5538 }
5539
Dianne Hackborn17f69352015-07-17 18:04:14 -07005540 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5541 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005542 Parcel data = Parcel.obtain();
5543 Parcel reply = Parcel.obtain();
5544 data.writeInterfaceToken(IActivityManager.descriptor);
5545 data.writeInt(requestType);
5546 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005547 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005548 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5549 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005550 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005551 data.recycle();
5552 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005553 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005554 }
5555
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005556 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005557 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005558 Parcel data = Parcel.obtain();
5559 Parcel reply = Parcel.obtain();
5560 data.writeInterfaceToken(IActivityManager.descriptor);
5561 data.writeStrongBinder(token);
5562 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005563 structure.writeToParcel(data, 0);
5564 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005565 if (referrer != null) {
5566 data.writeInt(1);
5567 referrer.writeToParcel(data, 0);
5568 } else {
5569 data.writeInt(0);
5570 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005571 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005572 reply.readException();
5573 data.recycle();
5574 reply.recycle();
5575 }
5576
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005577 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5578 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005579 Parcel data = Parcel.obtain();
5580 Parcel reply = Parcel.obtain();
5581 data.writeInterfaceToken(IActivityManager.descriptor);
5582 intent.writeToParcel(data, 0);
5583 data.writeInt(requestType);
5584 data.writeString(hint);
5585 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005586 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005587 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5588 reply.readException();
5589 boolean res = reply.readInt() != 0;
5590 data.recycle();
5591 reply.recycle();
5592 return res;
5593 }
5594
Dianne Hackborn17f69352015-07-17 18:04:14 -07005595 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005596 Parcel data = Parcel.obtain();
5597 Parcel reply = Parcel.obtain();
5598 data.writeInterfaceToken(IActivityManager.descriptor);
5599 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5600 reply.readException();
5601 boolean res = reply.readInt() != 0;
5602 data.recycle();
5603 reply.recycle();
5604 return res;
5605 }
5606
Dianne Hackborn17f69352015-07-17 18:04:14 -07005607 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5608 Parcel data = Parcel.obtain();
5609 Parcel reply = Parcel.obtain();
5610 data.writeInterfaceToken(IActivityManager.descriptor);
5611 data.writeStrongBinder(token);
5612 data.writeBundle(args);
5613 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5614 reply.readException();
5615 boolean res = reply.readInt() != 0;
5616 data.recycle();
5617 reply.recycle();
5618 return res;
5619 }
5620
Svetoslavaa41add2015-08-06 15:03:55 -07005621 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005622 Parcel data = Parcel.obtain();
5623 Parcel reply = Parcel.obtain();
5624 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07005625 data.writeInt(appId);
5626 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005627 data.writeString(reason);
5628 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5629 reply.readException();
5630 data.recycle();
5631 reply.recycle();
5632 }
5633
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005634 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5635 Parcel data = Parcel.obtain();
5636 Parcel reply = Parcel.obtain();
5637 data.writeInterfaceToken(IActivityManager.descriptor);
5638 data.writeStrongBinder(who);
5639 data.writeInt(allowRestart ? 1 : 0);
5640 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5641 reply.readException();
5642 data.recycle();
5643 reply.recycle();
5644 }
5645
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005646 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5647 Parcel data = Parcel.obtain();
5648 Parcel reply = Parcel.obtain();
5649 data.writeInterfaceToken(IActivityManager.descriptor);
5650 data.writeStrongBinder(token);
5651 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5652 reply.readException();
5653 data.recycle();
5654 reply.recycle();
5655 }
5656
Craig Mautner5eda9b32013-07-02 11:58:16 -07005657 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5658 Parcel data = Parcel.obtain();
5659 Parcel reply = Parcel.obtain();
5660 data.writeInterfaceToken(IActivityManager.descriptor);
5661 data.writeStrongBinder(token);
5662 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5663 reply.readException();
5664 data.recycle();
5665 reply.recycle();
5666 }
5667
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005668 public void restart() throws RemoteException {
5669 Parcel data = Parcel.obtain();
5670 Parcel reply = Parcel.obtain();
5671 data.writeInterfaceToken(IActivityManager.descriptor);
5672 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5673 reply.readException();
5674 data.recycle();
5675 reply.recycle();
5676 }
5677
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005678 public void performIdleMaintenance() throws RemoteException {
5679 Parcel data = Parcel.obtain();
5680 Parcel reply = Parcel.obtain();
5681 data.writeInterfaceToken(IActivityManager.descriptor);
5682 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5683 reply.readException();
5684 data.recycle();
5685 reply.recycle();
5686 }
5687
Todd Kennedyca4d8422015-01-15 15:19:22 -08005688 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005689 IActivityContainerCallback callback) throws RemoteException {
5690 Parcel data = Parcel.obtain();
5691 Parcel reply = Parcel.obtain();
5692 data.writeInterfaceToken(IActivityManager.descriptor);
5693 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005694 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005695 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005696 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005697 final int result = reply.readInt();
5698 final IActivityContainer res;
5699 if (result == 1) {
5700 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5701 } else {
5702 res = null;
5703 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005704 data.recycle();
5705 reply.recycle();
5706 return res;
5707 }
5708
Craig Mautner95da1082014-02-24 17:54:35 -08005709 public void deleteActivityContainer(IActivityContainer activityContainer)
5710 throws RemoteException {
5711 Parcel data = Parcel.obtain();
5712 Parcel reply = Parcel.obtain();
5713 data.writeInterfaceToken(IActivityManager.descriptor);
5714 data.writeStrongBinder(activityContainer.asBinder());
5715 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5716 reply.readException();
5717 data.recycle();
5718 reply.recycle();
5719 }
5720
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04005721 public boolean startBinderTracking() throws RemoteException {
5722 Parcel data = Parcel.obtain();
5723 Parcel reply = Parcel.obtain();
5724 data.writeInterfaceToken(IActivityManager.descriptor);
5725 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
5726 reply.readException();
5727 boolean res = reply.readInt() != 0;
5728 reply.recycle();
5729 data.recycle();
5730 return res;
5731 }
5732
5733 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
5734 Parcel data = Parcel.obtain();
5735 Parcel reply = Parcel.obtain();
5736 data.writeInterfaceToken(IActivityManager.descriptor);
5737 if (fd != null) {
5738 data.writeInt(1);
5739 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5740 } else {
5741 data.writeInt(0);
5742 }
5743 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
5744 reply.readException();
5745 boolean res = reply.readInt() != 0;
5746 reply.recycle();
5747 data.recycle();
5748 return res;
5749 }
5750
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005751 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005752 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5753 Parcel data = Parcel.obtain();
5754 Parcel reply = Parcel.obtain();
5755 data.writeInterfaceToken(IActivityManager.descriptor);
5756 data.writeInt(displayId);
5757 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5758 reply.readException();
5759 final int result = reply.readInt();
5760 final IActivityContainer res;
5761 if (result == 1) {
5762 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5763 } else {
5764 res = null;
5765 }
5766 data.recycle();
5767 reply.recycle();
5768 return res;
5769 }
5770
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005771 @Override
5772 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005773 throws RemoteException {
5774 Parcel data = Parcel.obtain();
5775 Parcel reply = Parcel.obtain();
5776 data.writeInterfaceToken(IActivityManager.descriptor);
5777 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005778 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005779 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005780 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005781 data.recycle();
5782 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005783 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005784 }
5785
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005786 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005787 public void startLockTaskMode(int taskId) throws RemoteException {
5788 Parcel data = Parcel.obtain();
5789 Parcel reply = Parcel.obtain();
5790 data.writeInterfaceToken(IActivityManager.descriptor);
5791 data.writeInt(taskId);
5792 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5793 reply.readException();
5794 data.recycle();
5795 reply.recycle();
5796 }
5797
5798 @Override
5799 public void startLockTaskMode(IBinder token) throws RemoteException {
5800 Parcel data = Parcel.obtain();
5801 Parcel reply = Parcel.obtain();
5802 data.writeInterfaceToken(IActivityManager.descriptor);
5803 data.writeStrongBinder(token);
5804 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5805 reply.readException();
5806 data.recycle();
5807 reply.recycle();
5808 }
5809
5810 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005811 public void startLockTaskModeOnCurrent() throws RemoteException {
5812 Parcel data = Parcel.obtain();
5813 Parcel reply = Parcel.obtain();
5814 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005815 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005816 reply.readException();
5817 data.recycle();
5818 reply.recycle();
5819 }
5820
5821 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005822 public void stopLockTaskMode() throws RemoteException {
5823 Parcel data = Parcel.obtain();
5824 Parcel reply = Parcel.obtain();
5825 data.writeInterfaceToken(IActivityManager.descriptor);
5826 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5827 reply.readException();
5828 data.recycle();
5829 reply.recycle();
5830 }
5831
5832 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005833 public void stopLockTaskModeOnCurrent() throws RemoteException {
5834 Parcel data = Parcel.obtain();
5835 Parcel reply = Parcel.obtain();
5836 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005837 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005838 reply.readException();
5839 data.recycle();
5840 reply.recycle();
5841 }
5842
5843 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005844 public boolean isInLockTaskMode() throws RemoteException {
5845 Parcel data = Parcel.obtain();
5846 Parcel reply = Parcel.obtain();
5847 data.writeInterfaceToken(IActivityManager.descriptor);
5848 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5849 reply.readException();
5850 boolean isInLockTaskMode = reply.readInt() == 1;
5851 data.recycle();
5852 reply.recycle();
5853 return isInLockTaskMode;
5854 }
5855
Craig Mautner688b5102014-03-27 16:55:03 -07005856 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005857 public int getLockTaskModeState() throws RemoteException {
5858 Parcel data = Parcel.obtain();
5859 Parcel reply = Parcel.obtain();
5860 data.writeInterfaceToken(IActivityManager.descriptor);
5861 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5862 reply.readException();
5863 int lockTaskModeState = reply.readInt();
5864 data.recycle();
5865 reply.recycle();
5866 return lockTaskModeState;
5867 }
5868
5869 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005870 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5871 Parcel data = Parcel.obtain();
5872 Parcel reply = Parcel.obtain();
5873 data.writeInterfaceToken(IActivityManager.descriptor);
5874 data.writeStrongBinder(token);
5875 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5876 IBinder.FLAG_ONEWAY);
5877 reply.readException();
5878 data.recycle();
5879 reply.recycle();
5880 }
5881
5882 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005883 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005884 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005885 Parcel data = Parcel.obtain();
5886 Parcel reply = Parcel.obtain();
5887 data.writeInterfaceToken(IActivityManager.descriptor);
5888 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005889 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005890 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005891 reply.readException();
5892 data.recycle();
5893 reply.recycle();
5894 }
5895
Craig Mautneree2e45a2014-06-27 12:10:03 -07005896 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005897 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5898 Parcel data = Parcel.obtain();
5899 Parcel reply = Parcel.obtain();
5900 data.writeInterfaceToken(IActivityManager.descriptor);
5901 data.writeInt(taskId);
5902 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005903 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005904 reply.readException();
5905 data.recycle();
5906 reply.recycle();
5907 }
5908
5909 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07005910 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005911 {
5912 Parcel data = Parcel.obtain();
5913 Parcel reply = Parcel.obtain();
5914 data.writeInterfaceToken(IActivityManager.descriptor);
5915 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07005916 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005917 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005918 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005919 reply.readException();
5920 data.recycle();
5921 reply.recycle();
5922 }
5923
5924 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07005925 public Rect getTaskBounds(int taskId) throws RemoteException
5926 {
5927 Parcel data = Parcel.obtain();
5928 Parcel reply = Parcel.obtain();
5929 data.writeInterfaceToken(IActivityManager.descriptor);
5930 data.writeInt(taskId);
5931 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
5932 reply.readException();
5933 Rect rect = Rect.CREATOR.createFromParcel(reply);
5934 data.recycle();
5935 reply.recycle();
5936 return rect;
5937 }
5938
5939 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005940 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5941 Parcel data = Parcel.obtain();
5942 Parcel reply = Parcel.obtain();
5943 data.writeInterfaceToken(IActivityManager.descriptor);
5944 data.writeString(filename);
5945 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5946 reply.readException();
5947 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5948 data.recycle();
5949 reply.recycle();
5950 return icon;
5951 }
5952
5953 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005954 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5955 throws RemoteException {
5956 Parcel data = Parcel.obtain();
5957 Parcel reply = Parcel.obtain();
5958 data.writeInterfaceToken(IActivityManager.descriptor);
5959 if (options == null) {
5960 data.writeInt(0);
5961 } else {
5962 data.writeInt(1);
5963 data.writeBundle(options.toBundle());
5964 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005965 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08005966 reply.readException();
5967 data.recycle();
5968 reply.recycle();
5969 }
5970
5971 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005972 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005973 Parcel data = Parcel.obtain();
5974 Parcel reply = Parcel.obtain();
5975 data.writeInterfaceToken(IActivityManager.descriptor);
5976 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005977 data.writeInt(visible ? 1 : 0);
5978 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005979 reply.readException();
5980 boolean success = reply.readInt() > 0;
5981 data.recycle();
5982 reply.recycle();
5983 return success;
5984 }
5985
5986 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005987 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005988 Parcel data = Parcel.obtain();
5989 Parcel reply = Parcel.obtain();
5990 data.writeInterfaceToken(IActivityManager.descriptor);
5991 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005992 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005993 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005994 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005995 data.recycle();
5996 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005997 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005998 }
5999
6000 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006001 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006002 Parcel data = Parcel.obtain();
6003 Parcel reply = Parcel.obtain();
6004 data.writeInterfaceToken(IActivityManager.descriptor);
6005 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006006 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006007 reply.readException();
6008 data.recycle();
6009 reply.recycle();
6010 }
6011
6012 @Override
6013 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6014 Parcel data = Parcel.obtain();
6015 Parcel reply = Parcel.obtain();
6016 data.writeInterfaceToken(IActivityManager.descriptor);
6017 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006018 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006019 reply.readException();
6020 data.recycle();
6021 reply.recycle();
6022 }
6023
Craig Mautner8746a472014-07-24 15:12:54 -07006024 @Override
6025 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6026 Parcel data = Parcel.obtain();
6027 Parcel reply = Parcel.obtain();
6028 data.writeInterfaceToken(IActivityManager.descriptor);
6029 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006030 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006031 reply.readException();
6032 data.recycle();
6033 reply.recycle();
6034 }
6035
Craig Mautner6e2f3952014-09-09 14:26:41 -07006036 @Override
6037 public void bootAnimationComplete() throws RemoteException {
6038 Parcel data = Parcel.obtain();
6039 Parcel reply = Parcel.obtain();
6040 data.writeInterfaceToken(IActivityManager.descriptor);
6041 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6042 reply.readException();
6043 data.recycle();
6044 reply.recycle();
6045 }
6046
Wale Ogunwale18795a22014-12-03 11:38:33 -08006047 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006048 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6049 Parcel data = Parcel.obtain();
6050 Parcel reply = Parcel.obtain();
6051 data.writeInterfaceToken(IActivityManager.descriptor);
6052 data.writeInt(uid);
6053 data.writeByteArray(firstPacket);
6054 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6055 reply.readException();
6056 data.recycle();
6057 reply.recycle();
6058 }
6059
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006060 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006061 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6062 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006063 Parcel data = Parcel.obtain();
6064 Parcel reply = Parcel.obtain();
6065 data.writeInterfaceToken(IActivityManager.descriptor);
6066 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006067 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006068 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006069 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006070 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6071 reply.readException();
6072 data.recycle();
6073 reply.recycle();
6074 }
6075
6076 @Override
6077 public void dumpHeapFinished(String path) throws RemoteException {
6078 Parcel data = Parcel.obtain();
6079 Parcel reply = Parcel.obtain();
6080 data.writeInterfaceToken(IActivityManager.descriptor);
6081 data.writeString(path);
6082 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6083 reply.readException();
6084 data.recycle();
6085 reply.recycle();
6086 }
6087
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006088 @Override
6089 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6090 throws RemoteException {
6091 Parcel data = Parcel.obtain();
6092 Parcel reply = Parcel.obtain();
6093 data.writeInterfaceToken(IActivityManager.descriptor);
6094 data.writeStrongBinder(session.asBinder());
6095 data.writeInt(keepAwake ? 1 : 0);
6096 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6097 reply.readException();
6098 data.recycle();
6099 reply.recycle();
6100 }
6101
Craig Mautnere5600772015-04-03 21:36:37 -07006102 @Override
6103 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6104 Parcel data = Parcel.obtain();
6105 Parcel reply = Parcel.obtain();
6106 data.writeInterfaceToken(IActivityManager.descriptor);
6107 data.writeInt(userId);
6108 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006109 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006110 reply.readException();
6111 data.recycle();
6112 reply.recycle();
6113 }
6114
Dianne Hackborn1e383822015-04-10 14:02:33 -07006115 @Override
Craig Mautner015c5e52015-04-23 10:39:39 -07006116 public void updateDeviceOwner(String packageName) throws RemoteException {
6117 Parcel data = Parcel.obtain();
6118 Parcel reply = Parcel.obtain();
6119 data.writeInterfaceToken(IActivityManager.descriptor);
6120 data.writeString(packageName);
6121 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6122 reply.readException();
6123 data.recycle();
6124 reply.recycle();
6125 }
6126
6127 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006128 public int getPackageProcessState(String packageName, String callingPackage)
6129 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006130 Parcel data = Parcel.obtain();
6131 Parcel reply = Parcel.obtain();
6132 data.writeInterfaceToken(IActivityManager.descriptor);
6133 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006134 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006135 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6136 reply.readException();
6137 int res = reply.readInt();
6138 data.recycle();
6139 reply.recycle();
6140 return res;
6141 }
6142
Stefan Kuhne16045c22015-06-05 07:18:06 -07006143 @Override
6144 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6145 throws RemoteException {
6146 Parcel data = Parcel.obtain();
6147 Parcel reply = Parcel.obtain();
6148 data.writeInterfaceToken(IActivityManager.descriptor);
6149 data.writeString(process);
6150 data.writeInt(userId);
6151 data.writeInt(level);
6152 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6153 reply.readException();
6154 int res = reply.readInt();
6155 data.recycle();
6156 reply.recycle();
6157 return res != 0;
6158 }
6159
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006160 @Override
6161 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6162 Parcel data = Parcel.obtain();
6163 Parcel reply = Parcel.obtain();
6164 data.writeInterfaceToken(IActivityManager.descriptor);
6165 data.writeStrongBinder(token);
6166 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6167 reply.readException();
6168 int res = reply.readInt();
6169 data.recycle();
6170 reply.recycle();
6171 return res != 0;
6172 }
6173
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006174 @Override
6175 public void moveActivityToStack(IBinder token, int stackId) throws RemoteException {
6176 Parcel data = Parcel.obtain();
6177 Parcel reply = Parcel.obtain();
6178 data.writeInterfaceToken(IActivityManager.descriptor);
6179 data.writeStrongBinder(token);
6180 data.writeInt(stackId);
6181 mRemote.transact(MOVE_ACTIVITY_TO_STACK_TRANSACTION, data, reply, 0);
6182 reply.readException();
6183 data.recycle();
6184 reply.recycle();
6185 }
6186
6187 @Override
6188 public int getActivityStackId(IBinder token) throws RemoteException {
6189 Parcel data = Parcel.obtain();
6190 Parcel reply = Parcel.obtain();
6191 data.writeInterfaceToken(IActivityManager.descriptor);
6192 data.writeStrongBinder(token);
6193 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6194 reply.readException();
6195 int stackId = reply.readInt();
6196 data.recycle();
6197 reply.recycle();
6198 return stackId;
6199 }
6200
Filip Gruszczynski23493322015-07-29 17:02:59 -07006201 @Override
6202 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
6203 int[] verticalSizeConfigurations) throws RemoteException {
6204 Parcel data = Parcel.obtain();
6205 Parcel reply = Parcel.obtain();
6206 data.writeInterfaceToken(IActivityManager.descriptor);
6207 data.writeStrongBinder(token);
6208 if (horizontalSizeConfiguration == null) {
6209 data.writeInt(0);
6210 } else {
6211 data.writeInt(horizontalSizeConfiguration.length);
6212 data.writeIntArray(horizontalSizeConfiguration);
6213 }
6214 if (verticalSizeConfigurations == null) {
6215 data.writeInt(0);
6216 } else {
6217 data.writeInt(verticalSizeConfigurations.length);
6218 data.writeIntArray(verticalSizeConfigurations);
6219 }
6220 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6221 reply.readException();
6222 data.recycle();
6223 reply.recycle();
6224 }
6225
Wale Ogunwale83301a92015-09-24 15:54:08 -07006226 @Override
6227 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6228 Parcel data = Parcel.obtain();
6229 Parcel reply = Parcel.obtain();
6230 data.writeInterfaceToken(IActivityManager.descriptor);
6231 data.writeInt(suppress ? 1 : 0);
6232 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6233 reply.readException();
6234 data.recycle();
6235 reply.recycle();
6236 }
6237
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006238 private IBinder mRemote;
6239}