blob: da21099eda2befaf516afeb0376a8f71d989d61a [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 {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700119 getDefault().noteWakeupAlarm((ps != null) ? ps.getTarget() : null,
120 sourceUid, sourcePkg, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700121 } catch (RemoteException ex) {
122 }
123 }
124
125 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
126 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700127 getDefault().noteAlarmStart((ps != null) ? ps.getTarget() : null, sourceUid, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700128 } catch (RemoteException ex) {
129 }
130 }
131
132 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
133 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700134 getDefault().noteAlarmFinish((ps != null) ? ps.getTarget() : null, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135 } catch (RemoteException ex) {
136 }
137 }
138
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800139 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800140 attachInterface(this, descriptor);
141 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700142
143 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
145 throws RemoteException {
146 switch (code) {
147 case START_ACTIVITY_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800155 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800156 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700158 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700159 ProfilerInfo profilerInfo = data.readInt() != 0
160 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800163 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700164 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165 reply.writeNoException();
166 reply.writeInt(result);
167 return true;
168 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700169
Amith Yamasani82644082012-08-03 13:09:11 -0700170 case START_ACTIVITY_AS_USER_TRANSACTION:
171 {
172 data.enforceInterface(IActivityManager.descriptor);
173 IBinder b = data.readStrongBinder();
174 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800175 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700176 Intent intent = Intent.CREATOR.createFromParcel(data);
177 String resolvedType = data.readString();
178 IBinder resultTo = data.readStrongBinder();
179 String resultWho = data.readString();
180 int requestCode = data.readInt();
181 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700182 ProfilerInfo profilerInfo = data.readInt() != 0
183 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700184 Bundle options = data.readInt() != 0
185 ? Bundle.CREATOR.createFromParcel(data) : null;
186 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800187 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700188 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700189 reply.writeNoException();
190 reply.writeInt(result);
191 return true;
192 }
193
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700194 case START_ACTIVITY_AS_CALLER_TRANSACTION:
195 {
196 data.enforceInterface(IActivityManager.descriptor);
197 IBinder b = data.readStrongBinder();
198 IApplicationThread app = ApplicationThreadNative.asInterface(b);
199 String callingPackage = data.readString();
200 Intent intent = Intent.CREATOR.createFromParcel(data);
201 String resolvedType = data.readString();
202 IBinder resultTo = data.readStrongBinder();
203 String resultWho = data.readString();
204 int requestCode = data.readInt();
205 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700206 ProfilerInfo profilerInfo = data.readInt() != 0
207 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700208 Bundle options = data.readInt() != 0
209 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700210 boolean ignoreTargetSecurity = data.readInt() != 0;
Jeff Sharkey97978802014-10-14 10:48:18 -0700211 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700212 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700213 resultTo, resultWho, requestCode, startFlags, profilerInfo, options,
214 ignoreTargetSecurity, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700215 reply.writeNoException();
216 reply.writeInt(result);
217 return true;
218 }
219
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800220 case START_ACTIVITY_AND_WAIT_TRANSACTION:
221 {
222 data.enforceInterface(IActivityManager.descriptor);
223 IBinder b = data.readStrongBinder();
224 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800225 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800226 Intent intent = Intent.CREATOR.createFromParcel(data);
227 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800228 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800229 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800230 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700232 ProfilerInfo profilerInfo = data.readInt() != 0
233 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700234 Bundle options = data.readInt() != 0
235 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700236 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800237 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700238 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800239 reply.writeNoException();
240 result.writeToParcel(reply, 0);
241 return true;
242 }
243
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700244 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
245 {
246 data.enforceInterface(IActivityManager.descriptor);
247 IBinder b = data.readStrongBinder();
248 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800249 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700250 Intent intent = Intent.CREATOR.createFromParcel(data);
251 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700252 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700253 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700254 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700255 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700256 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700257 Bundle options = data.readInt() != 0
258 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700259 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800260 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700261 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700262 reply.writeNoException();
263 reply.writeInt(result);
264 return true;
265 }
266
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700267 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700268 {
269 data.enforceInterface(IActivityManager.descriptor);
270 IBinder b = data.readStrongBinder();
271 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700272 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700273 Intent fillInIntent = null;
274 if (data.readInt() != 0) {
275 fillInIntent = Intent.CREATOR.createFromParcel(data);
276 }
277 String resolvedType = data.readString();
278 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700279 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700280 int requestCode = data.readInt();
281 int flagsMask = data.readInt();
282 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700283 Bundle options = data.readInt() != 0
284 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700285 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700286 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700287 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700288 reply.writeNoException();
289 reply.writeInt(result);
290 return true;
291 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700292
Dianne Hackborn91097de2014-04-04 18:02:06 -0700293 case START_VOICE_ACTIVITY_TRANSACTION:
294 {
295 data.enforceInterface(IActivityManager.descriptor);
296 String callingPackage = data.readString();
297 int callingPid = data.readInt();
298 int callingUid = data.readInt();
299 Intent intent = Intent.CREATOR.createFromParcel(data);
300 String resolvedType = data.readString();
301 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
302 data.readStrongBinder());
303 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
304 data.readStrongBinder());
305 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700306 ProfilerInfo profilerInfo = data.readInt() != 0
307 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700308 Bundle options = data.readInt() != 0
309 ? Bundle.CREATOR.createFromParcel(data) : null;
310 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700311 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
312 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700313 reply.writeNoException();
314 reply.writeInt(result);
315 return true;
316 }
317
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800318 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
319 {
320 data.enforceInterface(IActivityManager.descriptor);
321 IBinder callingActivity = data.readStrongBinder();
322 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700323 Bundle options = data.readInt() != 0
324 ? Bundle.CREATOR.createFromParcel(data) : null;
325 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 reply.writeNoException();
327 reply.writeInt(result ? 1 : 0);
328 return true;
329 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700330
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700331 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
332 {
333 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700334 final int taskId = data.readInt();
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700335 final Bundle options =
336 data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
Wale Ogunwale854809c2015-12-27 16:18:19 -0800337 final int result = startActivityFromRecents(taskId, options);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700338 reply.writeNoException();
339 reply.writeInt(result);
340 return true;
341 }
342
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800343 case FINISH_ACTIVITY_TRANSACTION: {
344 data.enforceInterface(IActivityManager.descriptor);
345 IBinder token = data.readStrongBinder();
346 Intent resultData = null;
347 int resultCode = data.readInt();
348 if (data.readInt() != 0) {
349 resultData = Intent.CREATOR.createFromParcel(data);
350 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700351 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700352 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800353 reply.writeNoException();
354 reply.writeInt(res ? 1 : 0);
355 return true;
356 }
357
358 case FINISH_SUB_ACTIVITY_TRANSACTION: {
359 data.enforceInterface(IActivityManager.descriptor);
360 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700361 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800362 int requestCode = data.readInt();
363 finishSubActivity(token, resultWho, requestCode);
364 reply.writeNoException();
365 return true;
366 }
367
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700368 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
369 data.enforceInterface(IActivityManager.descriptor);
370 IBinder token = data.readStrongBinder();
371 boolean res = finishActivityAffinity(token);
372 reply.writeNoException();
373 reply.writeInt(res ? 1 : 0);
374 return true;
375 }
376
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700377 case FINISH_VOICE_TASK_TRANSACTION: {
378 data.enforceInterface(IActivityManager.descriptor);
379 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
380 data.readStrongBinder());
381 finishVoiceTask(session);
382 reply.writeNoException();
383 return true;
384 }
385
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700386 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
387 data.enforceInterface(IActivityManager.descriptor);
388 IBinder token = data.readStrongBinder();
389 boolean res = releaseActivityInstance(token);
390 reply.writeNoException();
391 reply.writeInt(res ? 1 : 0);
392 return true;
393 }
394
395 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
396 data.enforceInterface(IActivityManager.descriptor);
397 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
398 releaseSomeActivities(app);
399 reply.writeNoException();
400 return true;
401 }
402
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800403 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
404 data.enforceInterface(IActivityManager.descriptor);
405 IBinder token = data.readStrongBinder();
406 boolean res = willActivityBeVisible(token);
407 reply.writeNoException();
408 reply.writeInt(res ? 1 : 0);
409 return true;
410 }
411
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800412 case REGISTER_RECEIVER_TRANSACTION:
413 {
414 data.enforceInterface(IActivityManager.descriptor);
415 IBinder b = data.readStrongBinder();
416 IApplicationThread app =
417 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700418 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800419 b = data.readStrongBinder();
420 IIntentReceiver rec
421 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
422 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
423 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700424 int userId = data.readInt();
425 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800426 reply.writeNoException();
427 if (intent != null) {
428 reply.writeInt(1);
429 intent.writeToParcel(reply, 0);
430 } else {
431 reply.writeInt(0);
432 }
433 return true;
434 }
435
436 case UNREGISTER_RECEIVER_TRANSACTION:
437 {
438 data.enforceInterface(IActivityManager.descriptor);
439 IBinder b = data.readStrongBinder();
440 if (b == null) {
441 return true;
442 }
443 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
444 unregisterReceiver(rec);
445 reply.writeNoException();
446 return true;
447 }
448
449 case BROADCAST_INTENT_TRANSACTION:
450 {
451 data.enforceInterface(IActivityManager.descriptor);
452 IBinder b = data.readStrongBinder();
453 IApplicationThread app =
454 b != null ? ApplicationThreadNative.asInterface(b) : null;
455 Intent intent = Intent.CREATOR.createFromParcel(data);
456 String resolvedType = data.readString();
457 b = data.readStrongBinder();
458 IIntentReceiver resultTo =
459 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
460 int resultCode = data.readInt();
461 String resultData = data.readString();
462 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700463 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800464 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700465 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800466 boolean serialized = data.readInt() != 0;
467 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700468 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800469 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700470 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700471 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800472 reply.writeNoException();
473 reply.writeInt(res);
474 return true;
475 }
476
477 case UNBROADCAST_INTENT_TRANSACTION:
478 {
479 data.enforceInterface(IActivityManager.descriptor);
480 IBinder b = data.readStrongBinder();
481 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
482 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700483 int userId = data.readInt();
484 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800485 reply.writeNoException();
486 return true;
487 }
488
489 case FINISH_RECEIVER_TRANSACTION: {
490 data.enforceInterface(IActivityManager.descriptor);
491 IBinder who = data.readStrongBinder();
492 int resultCode = data.readInt();
493 String resultData = data.readString();
494 Bundle resultExtras = data.readBundle();
495 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800496 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800498 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 }
500 reply.writeNoException();
501 return true;
502 }
503
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800504 case ATTACH_APPLICATION_TRANSACTION: {
505 data.enforceInterface(IActivityManager.descriptor);
506 IApplicationThread app = ApplicationThreadNative.asInterface(
507 data.readStrongBinder());
508 if (app != null) {
509 attachApplication(app);
510 }
511 reply.writeNoException();
512 return true;
513 }
514
515 case ACTIVITY_IDLE_TRANSACTION: {
516 data.enforceInterface(IActivityManager.descriptor);
517 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700518 Configuration config = null;
519 if (data.readInt() != 0) {
520 config = Configuration.CREATOR.createFromParcel(data);
521 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700522 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800523 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700524 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800525 }
526 reply.writeNoException();
527 return true;
528 }
529
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700530 case ACTIVITY_RESUMED_TRANSACTION: {
531 data.enforceInterface(IActivityManager.descriptor);
532 IBinder token = data.readStrongBinder();
533 activityResumed(token);
534 reply.writeNoException();
535 return true;
536 }
537
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800538 case ACTIVITY_PAUSED_TRANSACTION: {
539 data.enforceInterface(IActivityManager.descriptor);
540 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700541 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800542 reply.writeNoException();
543 return true;
544 }
545
546 case ACTIVITY_STOPPED_TRANSACTION: {
547 data.enforceInterface(IActivityManager.descriptor);
548 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800549 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700550 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800551 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700552 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800553 reply.writeNoException();
554 return true;
555 }
556
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800557 case ACTIVITY_SLEPT_TRANSACTION: {
558 data.enforceInterface(IActivityManager.descriptor);
559 IBinder token = data.readStrongBinder();
560 activitySlept(token);
561 reply.writeNoException();
562 return true;
563 }
564
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800565 case ACTIVITY_DESTROYED_TRANSACTION: {
566 data.enforceInterface(IActivityManager.descriptor);
567 IBinder token = data.readStrongBinder();
568 activityDestroyed(token);
569 reply.writeNoException();
570 return true;
571 }
572
Jorim Jaggife89d122015-12-22 16:28:44 +0100573 case ACTIVITY_RELAUNCHED_TRANSACTION: {
574 data.enforceInterface(IActivityManager.descriptor);
575 IBinder token = data.readStrongBinder();
576 activityRelaunched(token);
577 reply.writeNoException();
578 return true;
579 }
580
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800581 case GET_CALLING_PACKAGE_TRANSACTION: {
582 data.enforceInterface(IActivityManager.descriptor);
583 IBinder token = data.readStrongBinder();
584 String res = token != null ? getCallingPackage(token) : null;
585 reply.writeNoException();
586 reply.writeString(res);
587 return true;
588 }
589
590 case GET_CALLING_ACTIVITY_TRANSACTION: {
591 data.enforceInterface(IActivityManager.descriptor);
592 IBinder token = data.readStrongBinder();
593 ComponentName cn = getCallingActivity(token);
594 reply.writeNoException();
595 ComponentName.writeToParcel(cn, reply);
596 return true;
597 }
598
Winson Chung1147c402014-05-14 11:05:00 -0700599 case GET_APP_TASKS_TRANSACTION: {
600 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700601 String callingPackage = data.readString();
602 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700603 reply.writeNoException();
604 int N = list != null ? list.size() : -1;
605 reply.writeInt(N);
606 int i;
607 for (i=0; i<N; i++) {
608 IAppTask task = list.get(i);
609 reply.writeStrongBinder(task.asBinder());
610 }
611 return true;
612 }
613
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700614 case ADD_APP_TASK_TRANSACTION: {
615 data.enforceInterface(IActivityManager.descriptor);
616 IBinder activityToken = data.readStrongBinder();
617 Intent intent = Intent.CREATOR.createFromParcel(data);
618 ActivityManager.TaskDescription descr
619 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
620 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
621 int res = addAppTask(activityToken, intent, descr, thumbnail);
622 reply.writeNoException();
623 reply.writeInt(res);
624 return true;
625 }
626
627 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
628 data.enforceInterface(IActivityManager.descriptor);
629 Point size = getAppTaskThumbnailSize();
630 reply.writeNoException();
631 size.writeToParcel(reply, 0);
632 return true;
633 }
634
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800635 case GET_TASKS_TRANSACTION: {
636 data.enforceInterface(IActivityManager.descriptor);
637 int maxNum = data.readInt();
638 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700639 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 reply.writeNoException();
641 int N = list != null ? list.size() : -1;
642 reply.writeInt(N);
643 int i;
644 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700645 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800646 info.writeToParcel(reply, 0);
647 }
648 return true;
649 }
650
651 case GET_RECENT_TASKS_TRANSACTION: {
652 data.enforceInterface(IActivityManager.descriptor);
653 int maxNum = data.readInt();
654 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700655 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800656 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700657 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800658 reply.writeNoException();
659 reply.writeTypedList(list);
660 return true;
661 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700662
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700663 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800664 data.enforceInterface(IActivityManager.descriptor);
665 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700666 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800667 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700668 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800669 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700670 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700671 } else {
672 reply.writeInt(0);
673 }
674 return true;
675 }
676
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800677 case GET_SERVICES_TRANSACTION: {
678 data.enforceInterface(IActivityManager.descriptor);
679 int maxNum = data.readInt();
680 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700681 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800682 reply.writeNoException();
683 int N = list != null ? list.size() : -1;
684 reply.writeInt(N);
685 int i;
686 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700687 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800688 info.writeToParcel(reply, 0);
689 }
690 return true;
691 }
692
693 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
694 data.enforceInterface(IActivityManager.descriptor);
695 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
696 reply.writeNoException();
697 reply.writeTypedList(list);
698 return true;
699 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700700
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
702 data.enforceInterface(IActivityManager.descriptor);
703 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
704 reply.writeNoException();
705 reply.writeTypedList(list);
706 return true;
707 }
708
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700709 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
710 data.enforceInterface(IActivityManager.descriptor);
711 List<ApplicationInfo> list = getRunningExternalApplications();
712 reply.writeNoException();
713 reply.writeTypedList(list);
714 return true;
715 }
716
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800717 case MOVE_TASK_TO_FRONT_TRANSACTION: {
718 data.enforceInterface(IActivityManager.descriptor);
719 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800720 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700721 Bundle options = data.readInt() != 0
722 ? Bundle.CREATOR.createFromParcel(data) : null;
723 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800724 reply.writeNoException();
725 return true;
726 }
727
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800728 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
729 data.enforceInterface(IActivityManager.descriptor);
730 IBinder token = data.readStrongBinder();
731 boolean nonRoot = data.readInt() != 0;
732 boolean res = moveActivityTaskToBack(token, nonRoot);
733 reply.writeNoException();
734 reply.writeInt(res ? 1 : 0);
735 return true;
736 }
737
738 case MOVE_TASK_BACKWARDS_TRANSACTION: {
739 data.enforceInterface(IActivityManager.descriptor);
740 int task = data.readInt();
741 moveTaskBackwards(task);
742 reply.writeNoException();
743 return true;
744 }
745
Craig Mautnerc00204b2013-03-05 15:02:14 -0800746 case MOVE_TASK_TO_STACK_TRANSACTION: {
747 data.enforceInterface(IActivityManager.descriptor);
748 int taskId = data.readInt();
749 int stackId = data.readInt();
750 boolean toTop = data.readInt() != 0;
751 moveTaskToStack(taskId, stackId, toTop);
752 reply.writeNoException();
753 return true;
754 }
755
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700756 case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: {
757 data.enforceInterface(IActivityManager.descriptor);
758 int taskId = data.readInt();
759 int createMode = data.readInt();
760 boolean toTop = data.readInt() != 0;
Jorim Jaggi030979c2015-11-20 15:14:43 -0800761 boolean animate = data.readInt() != 0;
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -0800762 Rect bounds = null;
763 boolean hasBounds = data.readInt() != 0;
764 if (hasBounds) {
765 bounds = Rect.CREATOR.createFromParcel(data);
766 }
767 moveTaskToDockedStack(taskId, createMode, toTop, animate, bounds);
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700768 reply.writeNoException();
769 return true;
770 }
771
Dianne Hackbornbef28fe2015-10-29 17:57:11 -0700772 case MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION: {
Wale Ogunwale079a0042015-10-24 11:44:07 -0700773 data.enforceInterface(IActivityManager.descriptor);
774 final int stackId = data.readInt();
775 final Rect r = Rect.CREATOR.createFromParcel(data);
776 final boolean res = moveTopActivityToPinnedStack(stackId, r);
777 reply.writeNoException();
778 reply.writeInt(res ? 1 : 0);
779 return true;
780 }
781
Craig Mautnerc00204b2013-03-05 15:02:14 -0800782 case RESIZE_STACK_TRANSACTION: {
783 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700784 final int stackId = data.readInt();
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100785 final boolean hasRect = data.readInt() != 0;
786 Rect r = null;
787 if (hasRect) {
788 r = Rect.CREATOR.createFromParcel(data);
789 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700790 final boolean allowResizeInDockedMode = data.readInt() == 1;
791 resizeStack(stackId, r, allowResizeInDockedMode);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800792 reply.writeNoException();
793 return true;
794 }
795
Jorim Jaggidc249c42015-12-15 14:57:31 -0800796 case RESIZE_DOCKED_STACK_TRANSACTION: {
797 data.enforceInterface(IActivityManager.descriptor);
798 final boolean hasBounds = data.readInt() != 0;
799 Rect bounds = null;
800 if (hasBounds) {
801 bounds = Rect.CREATOR.createFromParcel(data);
802 }
803 final boolean hasTempDockedTaskBounds = data.readInt() != 0;
804 Rect tempDockedTaskBounds = null;
805 if (hasTempDockedTaskBounds) {
806 tempDockedTaskBounds = Rect.CREATOR.createFromParcel(data);
807 }
808 final boolean hasTempDockedTaskInsetBounds = data.readInt() != 0;
809 Rect tempDockedTaskInsetBounds = null;
810 if (hasTempDockedTaskInsetBounds) {
811 tempDockedTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
812 }
813 final boolean hasTempOtherTaskBounds = data.readInt() != 0;
814 Rect tempOtherTaskBounds = null;
815 if (hasTempOtherTaskBounds) {
816 tempOtherTaskBounds = Rect.CREATOR.createFromParcel(data);
817 }
818 final boolean hasTempOtherTaskInsetBounds = data.readInt() != 0;
819 Rect tempOtherTaskInsetBounds = null;
820 if (hasTempOtherTaskInsetBounds) {
821 tempOtherTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
822 }
823 resizeDockedStack(bounds, tempDockedTaskBounds, tempDockedTaskInsetBounds,
824 tempOtherTaskBounds, tempOtherTaskInsetBounds);
825 reply.writeNoException();
826 return true;
827 }
828
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700829 case POSITION_TASK_IN_STACK_TRANSACTION: {
830 data.enforceInterface(IActivityManager.descriptor);
831 int taskId = data.readInt();
832 int stackId = data.readInt();
833 int position = data.readInt();
834 positionTaskInStack(taskId, stackId, position);
835 reply.writeNoException();
836 return true;
837 }
838
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800839 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700840 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800841 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700842 reply.writeNoException();
843 reply.writeTypedList(list);
844 return true;
845 }
846
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800847 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700848 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800849 int stackId = data.readInt();
850 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700851 reply.writeNoException();
852 if (info != null) {
853 reply.writeInt(1);
854 info.writeToParcel(reply, 0);
855 } else {
856 reply.writeInt(0);
857 }
858 return true;
859 }
860
Winson Chung303e1ff2014-03-07 15:06:19 -0800861 case IS_IN_HOME_STACK_TRANSACTION: {
862 data.enforceInterface(IActivityManager.descriptor);
863 int taskId = data.readInt();
864 boolean isInHomeStack = isInHomeStack(taskId);
865 reply.writeNoException();
866 reply.writeInt(isInHomeStack ? 1 : 0);
867 return true;
868 }
869
Craig Mautnercf910b02013-04-23 11:23:27 -0700870 case SET_FOCUSED_STACK_TRANSACTION: {
871 data.enforceInterface(IActivityManager.descriptor);
872 int stackId = data.readInt();
873 setFocusedStack(stackId);
874 reply.writeNoException();
875 return true;
876 }
877
Winson Chungd16c5652015-01-26 16:11:07 -0800878 case GET_FOCUSED_STACK_ID_TRANSACTION: {
879 data.enforceInterface(IActivityManager.descriptor);
880 int focusedStackId = getFocusedStackId();
881 reply.writeNoException();
882 reply.writeInt(focusedStackId);
883 return true;
884 }
885
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700886 case SET_FOCUSED_TASK_TRANSACTION: {
887 data.enforceInterface(IActivityManager.descriptor);
888 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700889 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700890 reply.writeNoException();
891 return true;
892 }
893
Winson Chung740c3ac2014-11-12 16:14:38 -0800894 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
895 data.enforceInterface(IActivityManager.descriptor);
896 IBinder token = data.readStrongBinder();
897 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
898 reply.writeNoException();
899 return true;
900 }
901
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800902 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
903 data.enforceInterface(IActivityManager.descriptor);
904 IBinder token = data.readStrongBinder();
905 boolean onlyRoot = data.readInt() != 0;
906 int res = token != null
907 ? getTaskForActivity(token, onlyRoot) : -1;
908 reply.writeNoException();
909 reply.writeInt(res);
910 return true;
911 }
912
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800913 case GET_CONTENT_PROVIDER_TRANSACTION: {
914 data.enforceInterface(IActivityManager.descriptor);
915 IBinder b = data.readStrongBinder();
916 IApplicationThread app = ApplicationThreadNative.asInterface(b);
917 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700918 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700919 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700920 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800921 reply.writeNoException();
922 if (cph != null) {
923 reply.writeInt(1);
924 cph.writeToParcel(reply, 0);
925 } else {
926 reply.writeInt(0);
927 }
928 return true;
929 }
930
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800931 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
932 data.enforceInterface(IActivityManager.descriptor);
933 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700934 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800935 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700936 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800937 reply.writeNoException();
938 if (cph != null) {
939 reply.writeInt(1);
940 cph.writeToParcel(reply, 0);
941 } else {
942 reply.writeInt(0);
943 }
944 return true;
945 }
946
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800947 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
948 data.enforceInterface(IActivityManager.descriptor);
949 IBinder b = data.readStrongBinder();
950 IApplicationThread app = ApplicationThreadNative.asInterface(b);
951 ArrayList<ContentProviderHolder> providers =
952 data.createTypedArrayList(ContentProviderHolder.CREATOR);
953 publishContentProviders(app, providers);
954 reply.writeNoException();
955 return true;
956 }
957
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700958 case REF_CONTENT_PROVIDER_TRANSACTION: {
959 data.enforceInterface(IActivityManager.descriptor);
960 IBinder b = data.readStrongBinder();
961 int stable = data.readInt();
962 int unstable = data.readInt();
963 boolean res = refContentProvider(b, stable, unstable);
964 reply.writeNoException();
965 reply.writeInt(res ? 1 : 0);
966 return true;
967 }
968
969 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
970 data.enforceInterface(IActivityManager.descriptor);
971 IBinder b = data.readStrongBinder();
972 unstableProviderDied(b);
973 reply.writeNoException();
974 return true;
975 }
976
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700977 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 IBinder b = data.readStrongBinder();
980 appNotRespondingViaProvider(b);
981 reply.writeNoException();
982 return true;
983 }
984
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800985 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
986 data.enforceInterface(IActivityManager.descriptor);
987 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700988 boolean stable = data.readInt() != 0;
989 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800990 reply.writeNoException();
991 return true;
992 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800993
994 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
995 data.enforceInterface(IActivityManager.descriptor);
996 String name = data.readString();
997 IBinder token = data.readStrongBinder();
998 removeContentProviderExternal(name, token);
999 reply.writeNoException();
1000 return true;
1001 }
1002
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07001003 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
1004 data.enforceInterface(IActivityManager.descriptor);
1005 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
1006 PendingIntent pi = getRunningServiceControlPanel(comp);
1007 reply.writeNoException();
1008 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
1009 return true;
1010 }
1011
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001012 case START_SERVICE_TRANSACTION: {
1013 data.enforceInterface(IActivityManager.descriptor);
1014 IBinder b = data.readStrongBinder();
1015 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1016 Intent service = Intent.CREATOR.createFromParcel(data);
1017 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001018 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001019 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001020 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001021 reply.writeNoException();
1022 ComponentName.writeToParcel(cn, reply);
1023 return true;
1024 }
1025
1026 case STOP_SERVICE_TRANSACTION: {
1027 data.enforceInterface(IActivityManager.descriptor);
1028 IBinder b = data.readStrongBinder();
1029 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1030 Intent service = Intent.CREATOR.createFromParcel(data);
1031 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001032 int userId = data.readInt();
1033 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001034 reply.writeNoException();
1035 reply.writeInt(res);
1036 return true;
1037 }
1038
1039 case STOP_SERVICE_TOKEN_TRANSACTION: {
1040 data.enforceInterface(IActivityManager.descriptor);
1041 ComponentName className = ComponentName.readFromParcel(data);
1042 IBinder token = data.readStrongBinder();
1043 int startId = data.readInt();
1044 boolean res = stopServiceToken(className, token, startId);
1045 reply.writeNoException();
1046 reply.writeInt(res ? 1 : 0);
1047 return true;
1048 }
1049
1050 case SET_SERVICE_FOREGROUND_TRANSACTION: {
1051 data.enforceInterface(IActivityManager.descriptor);
1052 ComponentName className = ComponentName.readFromParcel(data);
1053 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001054 int id = data.readInt();
1055 Notification notification = null;
1056 if (data.readInt() != 0) {
1057 notification = Notification.CREATOR.createFromParcel(data);
1058 }
1059 boolean removeNotification = data.readInt() != 0;
1060 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001061 reply.writeNoException();
1062 return true;
1063 }
1064
1065 case BIND_SERVICE_TRANSACTION: {
1066 data.enforceInterface(IActivityManager.descriptor);
1067 IBinder b = data.readStrongBinder();
1068 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1069 IBinder token = data.readStrongBinder();
1070 Intent service = Intent.CREATOR.createFromParcel(data);
1071 String resolvedType = data.readString();
1072 b = data.readStrongBinder();
1073 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001074 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001075 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001076 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001077 int res = bindService(app, token, service, resolvedType, conn, fl,
1078 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001079 reply.writeNoException();
1080 reply.writeInt(res);
1081 return true;
1082 }
1083
1084 case UNBIND_SERVICE_TRANSACTION: {
1085 data.enforceInterface(IActivityManager.descriptor);
1086 IBinder b = data.readStrongBinder();
1087 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1088 boolean res = unbindService(conn);
1089 reply.writeNoException();
1090 reply.writeInt(res ? 1 : 0);
1091 return true;
1092 }
1093
1094 case PUBLISH_SERVICE_TRANSACTION: {
1095 data.enforceInterface(IActivityManager.descriptor);
1096 IBinder token = data.readStrongBinder();
1097 Intent intent = Intent.CREATOR.createFromParcel(data);
1098 IBinder service = data.readStrongBinder();
1099 publishService(token, intent, service);
1100 reply.writeNoException();
1101 return true;
1102 }
1103
1104 case UNBIND_FINISHED_TRANSACTION: {
1105 data.enforceInterface(IActivityManager.descriptor);
1106 IBinder token = data.readStrongBinder();
1107 Intent intent = Intent.CREATOR.createFromParcel(data);
1108 boolean doRebind = data.readInt() != 0;
1109 unbindFinished(token, intent, doRebind);
1110 reply.writeNoException();
1111 return true;
1112 }
1113
1114 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1115 data.enforceInterface(IActivityManager.descriptor);
1116 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001117 int type = data.readInt();
1118 int startId = data.readInt();
1119 int res = data.readInt();
1120 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001121 reply.writeNoException();
1122 return true;
1123 }
1124
1125 case START_INSTRUMENTATION_TRANSACTION: {
1126 data.enforceInterface(IActivityManager.descriptor);
1127 ComponentName className = ComponentName.readFromParcel(data);
1128 String profileFile = data.readString();
1129 int fl = data.readInt();
1130 Bundle arguments = data.readBundle();
1131 IBinder b = data.readStrongBinder();
1132 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001133 b = data.readStrongBinder();
1134 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001135 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001136 String abiOverride = data.readString();
1137 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1138 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001139 reply.writeNoException();
1140 reply.writeInt(res ? 1 : 0);
1141 return true;
1142 }
1143
1144
1145 case FINISH_INSTRUMENTATION_TRANSACTION: {
1146 data.enforceInterface(IActivityManager.descriptor);
1147 IBinder b = data.readStrongBinder();
1148 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1149 int resultCode = data.readInt();
1150 Bundle results = data.readBundle();
1151 finishInstrumentation(app, resultCode, results);
1152 reply.writeNoException();
1153 return true;
1154 }
1155
1156 case GET_CONFIGURATION_TRANSACTION: {
1157 data.enforceInterface(IActivityManager.descriptor);
1158 Configuration config = getConfiguration();
1159 reply.writeNoException();
1160 config.writeToParcel(reply, 0);
1161 return true;
1162 }
1163
1164 case UPDATE_CONFIGURATION_TRANSACTION: {
1165 data.enforceInterface(IActivityManager.descriptor);
1166 Configuration config = Configuration.CREATOR.createFromParcel(data);
1167 updateConfiguration(config);
1168 reply.writeNoException();
1169 return true;
1170 }
1171
1172 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1173 data.enforceInterface(IActivityManager.descriptor);
1174 IBinder token = data.readStrongBinder();
1175 int requestedOrientation = data.readInt();
1176 setRequestedOrientation(token, requestedOrientation);
1177 reply.writeNoException();
1178 return true;
1179 }
1180
1181 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1182 data.enforceInterface(IActivityManager.descriptor);
1183 IBinder token = data.readStrongBinder();
1184 int req = getRequestedOrientation(token);
1185 reply.writeNoException();
1186 reply.writeInt(req);
1187 return true;
1188 }
1189
1190 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1191 data.enforceInterface(IActivityManager.descriptor);
1192 IBinder token = data.readStrongBinder();
1193 ComponentName cn = getActivityClassForToken(token);
1194 reply.writeNoException();
1195 ComponentName.writeToParcel(cn, reply);
1196 return true;
1197 }
1198
1199 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1200 data.enforceInterface(IActivityManager.descriptor);
1201 IBinder token = data.readStrongBinder();
1202 reply.writeNoException();
1203 reply.writeString(getPackageForToken(token));
1204 return true;
1205 }
1206
1207 case GET_INTENT_SENDER_TRANSACTION: {
1208 data.enforceInterface(IActivityManager.descriptor);
1209 int type = data.readInt();
1210 String packageName = data.readString();
1211 IBinder token = data.readStrongBinder();
1212 String resultWho = data.readString();
1213 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001214 Intent[] requestIntents;
1215 String[] requestResolvedTypes;
1216 if (data.readInt() != 0) {
1217 requestIntents = data.createTypedArray(Intent.CREATOR);
1218 requestResolvedTypes = data.createStringArray();
1219 } else {
1220 requestIntents = null;
1221 requestResolvedTypes = null;
1222 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001224 Bundle options = data.readInt() != 0
1225 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001226 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001227 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001228 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001229 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001230 reply.writeNoException();
1231 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1232 return true;
1233 }
1234
1235 case CANCEL_INTENT_SENDER_TRANSACTION: {
1236 data.enforceInterface(IActivityManager.descriptor);
1237 IIntentSender r = IIntentSender.Stub.asInterface(
1238 data.readStrongBinder());
1239 cancelIntentSender(r);
1240 reply.writeNoException();
1241 return true;
1242 }
1243
1244 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1245 data.enforceInterface(IActivityManager.descriptor);
1246 IIntentSender r = IIntentSender.Stub.asInterface(
1247 data.readStrongBinder());
1248 String res = getPackageForIntentSender(r);
1249 reply.writeNoException();
1250 reply.writeString(res);
1251 return true;
1252 }
1253
Christopher Tatec4a07d12012-04-06 14:19:13 -07001254 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1255 data.enforceInterface(IActivityManager.descriptor);
1256 IIntentSender r = IIntentSender.Stub.asInterface(
1257 data.readStrongBinder());
1258 int res = getUidForIntentSender(r);
1259 reply.writeNoException();
1260 reply.writeInt(res);
1261 return true;
1262 }
1263
Dianne Hackborn41203752012-08-31 14:05:51 -07001264 case HANDLE_INCOMING_USER_TRANSACTION: {
1265 data.enforceInterface(IActivityManager.descriptor);
1266 int callingPid = data.readInt();
1267 int callingUid = data.readInt();
1268 int userId = data.readInt();
1269 boolean allowAll = data.readInt() != 0 ;
1270 boolean requireFull = data.readInt() != 0;
1271 String name = data.readString();
1272 String callerPackage = data.readString();
1273 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1274 requireFull, name, callerPackage);
1275 reply.writeNoException();
1276 reply.writeInt(res);
1277 return true;
1278 }
1279
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001280 case SET_PROCESS_LIMIT_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
1282 int max = data.readInt();
1283 setProcessLimit(max);
1284 reply.writeNoException();
1285 return true;
1286 }
1287
1288 case GET_PROCESS_LIMIT_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 int limit = getProcessLimit();
1291 reply.writeNoException();
1292 reply.writeInt(limit);
1293 return true;
1294 }
1295
1296 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1297 data.enforceInterface(IActivityManager.descriptor);
1298 IBinder token = data.readStrongBinder();
1299 int pid = data.readInt();
1300 boolean isForeground = data.readInt() != 0;
1301 setProcessForeground(token, pid, isForeground);
1302 reply.writeNoException();
1303 return true;
1304 }
1305
1306 case CHECK_PERMISSION_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
1308 String perm = data.readString();
1309 int pid = data.readInt();
1310 int uid = data.readInt();
1311 int res = checkPermission(perm, pid, uid);
1312 reply.writeNoException();
1313 reply.writeInt(res);
1314 return true;
1315 }
1316
Dianne Hackbornff170242014-11-19 10:59:01 -08001317 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1318 data.enforceInterface(IActivityManager.descriptor);
1319 String perm = data.readString();
1320 int pid = data.readInt();
1321 int uid = data.readInt();
1322 IBinder token = data.readStrongBinder();
1323 int res = checkPermissionWithToken(perm, pid, uid, token);
1324 reply.writeNoException();
1325 reply.writeInt(res);
1326 return true;
1327 }
1328
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001329 case CHECK_URI_PERMISSION_TRANSACTION: {
1330 data.enforceInterface(IActivityManager.descriptor);
1331 Uri uri = Uri.CREATOR.createFromParcel(data);
1332 int pid = data.readInt();
1333 int uid = data.readInt();
1334 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001335 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001336 IBinder callerToken = data.readStrongBinder();
1337 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001338 reply.writeNoException();
1339 reply.writeInt(res);
1340 return true;
1341 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001342
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001343 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001344 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001345 String packageName = data.readString();
1346 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1347 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001348 int userId = data.readInt();
1349 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001350 reply.writeNoException();
1351 reply.writeInt(res ? 1 : 0);
1352 return true;
1353 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001354
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001355 case GRANT_URI_PERMISSION_TRANSACTION: {
1356 data.enforceInterface(IActivityManager.descriptor);
1357 IBinder b = data.readStrongBinder();
1358 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1359 String targetPkg = data.readString();
1360 Uri uri = Uri.CREATOR.createFromParcel(data);
1361 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001362 int userId = data.readInt();
1363 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001364 reply.writeNoException();
1365 return true;
1366 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001367
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001368 case REVOKE_URI_PERMISSION_TRANSACTION: {
1369 data.enforceInterface(IActivityManager.descriptor);
1370 IBinder b = data.readStrongBinder();
1371 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1372 Uri uri = Uri.CREATOR.createFromParcel(data);
1373 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001374 int userId = data.readInt();
1375 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001376 reply.writeNoException();
1377 return true;
1378 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001379
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001380 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1381 data.enforceInterface(IActivityManager.descriptor);
1382 Uri uri = Uri.CREATOR.createFromParcel(data);
1383 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001384 int userId = data.readInt();
1385 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001386 reply.writeNoException();
1387 return true;
1388 }
1389
1390 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1391 data.enforceInterface(IActivityManager.descriptor);
1392 Uri uri = Uri.CREATOR.createFromParcel(data);
1393 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001394 int userId = data.readInt();
1395 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001396 reply.writeNoException();
1397 return true;
1398 }
1399
1400 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1401 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001402 final String packageName = data.readString();
1403 final boolean incoming = data.readInt() != 0;
1404 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1405 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001406 reply.writeNoException();
1407 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1408 return true;
1409 }
1410
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001411 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1412 data.enforceInterface(IActivityManager.descriptor);
1413 IBinder b = data.readStrongBinder();
1414 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1415 boolean waiting = data.readInt() != 0;
1416 showWaitingForDebugger(app, waiting);
1417 reply.writeNoException();
1418 return true;
1419 }
1420
1421 case GET_MEMORY_INFO_TRANSACTION: {
1422 data.enforceInterface(IActivityManager.descriptor);
1423 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1424 getMemoryInfo(mi);
1425 reply.writeNoException();
1426 mi.writeToParcel(reply, 0);
1427 return true;
1428 }
1429
1430 case UNHANDLED_BACK_TRANSACTION: {
1431 data.enforceInterface(IActivityManager.descriptor);
1432 unhandledBack();
1433 reply.writeNoException();
1434 return true;
1435 }
1436
1437 case OPEN_CONTENT_URI_TRANSACTION: {
1438 data.enforceInterface(IActivityManager.descriptor);
1439 Uri uri = Uri.parse(data.readString());
1440 ParcelFileDescriptor pfd = openContentUri(uri);
1441 reply.writeNoException();
1442 if (pfd != null) {
1443 reply.writeInt(1);
1444 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1445 } else {
1446 reply.writeInt(0);
1447 }
1448 return true;
1449 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001450
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001451 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1452 data.enforceInterface(IActivityManager.descriptor);
1453 setLockScreenShown(data.readInt() != 0);
1454 reply.writeNoException();
1455 return true;
1456 }
1457
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001458 case SET_DEBUG_APP_TRANSACTION: {
1459 data.enforceInterface(IActivityManager.descriptor);
1460 String pn = data.readString();
1461 boolean wfd = data.readInt() != 0;
1462 boolean per = data.readInt() != 0;
1463 setDebugApp(pn, wfd, per);
1464 reply.writeNoException();
1465 return true;
1466 }
1467
1468 case SET_ALWAYS_FINISH_TRANSACTION: {
1469 data.enforceInterface(IActivityManager.descriptor);
1470 boolean enabled = data.readInt() != 0;
1471 setAlwaysFinish(enabled);
1472 reply.writeNoException();
1473 return true;
1474 }
1475
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001476 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001477 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001478 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001479 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001480 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001481 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001482 return true;
1483 }
1484
1485 case ENTER_SAFE_MODE_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 enterSafeMode();
1488 reply.writeNoException();
1489 return true;
1490 }
1491
1492 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1493 data.enforceInterface(IActivityManager.descriptor);
1494 IIntentSender is = IIntentSender.Stub.asInterface(
1495 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001496 int sourceUid = data.readInt();
1497 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001498 String tag = data.readString();
1499 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1500 reply.writeNoException();
1501 return true;
1502 }
1503
1504 case NOTE_ALARM_START_TRANSACTION: {
1505 data.enforceInterface(IActivityManager.descriptor);
1506 IIntentSender is = IIntentSender.Stub.asInterface(
1507 data.readStrongBinder());
1508 int sourceUid = data.readInt();
1509 String tag = data.readString();
1510 noteAlarmStart(is, sourceUid, tag);
1511 reply.writeNoException();
1512 return true;
1513 }
1514
1515 case NOTE_ALARM_FINISH_TRANSACTION: {
1516 data.enforceInterface(IActivityManager.descriptor);
1517 IIntentSender is = IIntentSender.Stub.asInterface(
1518 data.readStrongBinder());
1519 int sourceUid = data.readInt();
1520 String tag = data.readString();
1521 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001522 reply.writeNoException();
1523 return true;
1524 }
1525
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001526 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001527 data.enforceInterface(IActivityManager.descriptor);
1528 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001529 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001530 boolean secure = data.readInt() != 0;
1531 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001532 reply.writeNoException();
1533 reply.writeInt(res ? 1 : 0);
1534 return true;
1535 }
1536
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001537 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1538 data.enforceInterface(IActivityManager.descriptor);
1539 String reason = data.readString();
1540 boolean res = killProcessesBelowForeground(reason);
1541 reply.writeNoException();
1542 reply.writeInt(res ? 1 : 0);
1543 return true;
1544 }
1545
Dan Egnor60d87622009-12-16 16:32:58 -08001546 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1547 data.enforceInterface(IActivityManager.descriptor);
1548 IBinder app = data.readStrongBinder();
1549 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1550 handleApplicationCrash(app, ci);
1551 reply.writeNoException();
1552 return true;
1553 }
1554
1555 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001556 data.enforceInterface(IActivityManager.descriptor);
1557 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001558 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001559 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001560 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001561 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001562 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001563 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001564 return true;
1565 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001566
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001567 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1568 data.enforceInterface(IActivityManager.descriptor);
1569 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001570 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001571 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1572 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001573 reply.writeNoException();
1574 return true;
1575 }
1576
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001577 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 int sig = data.readInt();
1580 signalPersistentProcesses(sig);
1581 reply.writeNoException();
1582 return true;
1583 }
1584
Dianne Hackborn03abb812010-01-04 18:43:19 -08001585 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1586 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001587 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001588 int userId = data.readInt();
1589 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001590 reply.writeNoException();
1591 return true;
1592 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001593
1594 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1595 data.enforceInterface(IActivityManager.descriptor);
1596 killAllBackgroundProcesses();
1597 reply.writeNoException();
1598 return true;
1599 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001600
Gustav Sennton6258dcd2015-10-30 19:25:37 +00001601 case KILL_PACKAGE_DEPENDENTS_TRANSACTION: {
1602 data.enforceInterface(IActivityManager.descriptor);
1603 String packageName = data.readString();
1604 int userId = data.readInt();
1605 killPackageDependents(packageName, userId);
1606 reply.writeNoException();
1607 return true;
1608 }
1609
Dianne Hackborn03abb812010-01-04 18:43:19 -08001610 case FORCE_STOP_PACKAGE_TRANSACTION: {
1611 data.enforceInterface(IActivityManager.descriptor);
1612 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001613 int userId = data.readInt();
1614 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001615 reply.writeNoException();
1616 return true;
1617 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001618
1619 case GET_MY_MEMORY_STATE_TRANSACTION: {
1620 data.enforceInterface(IActivityManager.descriptor);
1621 ActivityManager.RunningAppProcessInfo info =
1622 new ActivityManager.RunningAppProcessInfo();
1623 getMyMemoryState(info);
1624 reply.writeNoException();
1625 info.writeToParcel(reply, 0);
1626 return true;
1627 }
1628
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001629 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1630 data.enforceInterface(IActivityManager.descriptor);
1631 ConfigurationInfo config = getDeviceConfigurationInfo();
1632 reply.writeNoException();
1633 config.writeToParcel(reply, 0);
1634 return true;
1635 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001636
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001637 case PROFILE_CONTROL_TRANSACTION: {
1638 data.enforceInterface(IActivityManager.descriptor);
1639 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001640 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001641 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001642 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001643 ProfilerInfo profilerInfo = data.readInt() != 0
1644 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1645 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001646 reply.writeNoException();
1647 reply.writeInt(res ? 1 : 0);
1648 return true;
1649 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001650
Dianne Hackborn55280a92009-05-07 15:53:46 -07001651 case SHUTDOWN_TRANSACTION: {
1652 data.enforceInterface(IActivityManager.descriptor);
1653 boolean res = shutdown(data.readInt());
1654 reply.writeNoException();
1655 reply.writeInt(res ? 1 : 0);
1656 return true;
1657 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001658
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001659 case STOP_APP_SWITCHES_TRANSACTION: {
1660 data.enforceInterface(IActivityManager.descriptor);
1661 stopAppSwitches();
1662 reply.writeNoException();
1663 return true;
1664 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001665
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001666 case RESUME_APP_SWITCHES_TRANSACTION: {
1667 data.enforceInterface(IActivityManager.descriptor);
1668 resumeAppSwitches();
1669 reply.writeNoException();
1670 return true;
1671 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001672
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001673 case PEEK_SERVICE_TRANSACTION: {
1674 data.enforceInterface(IActivityManager.descriptor);
1675 Intent service = Intent.CREATOR.createFromParcel(data);
1676 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001677 String callingPackage = data.readString();
1678 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001679 reply.writeNoException();
1680 reply.writeStrongBinder(binder);
1681 return true;
1682 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001683
Christopher Tate181fafa2009-05-14 11:12:14 -07001684 case START_BACKUP_AGENT_TRANSACTION: {
1685 data.enforceInterface(IActivityManager.descriptor);
1686 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1687 int backupRestoreMode = data.readInt();
1688 boolean success = bindBackupAgent(info, backupRestoreMode);
1689 reply.writeNoException();
1690 reply.writeInt(success ? 1 : 0);
1691 return true;
1692 }
1693
1694 case BACKUP_AGENT_CREATED_TRANSACTION: {
1695 data.enforceInterface(IActivityManager.descriptor);
1696 String packageName = data.readString();
1697 IBinder agent = data.readStrongBinder();
1698 backupAgentCreated(packageName, agent);
1699 reply.writeNoException();
1700 return true;
1701 }
1702
1703 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1704 data.enforceInterface(IActivityManager.descriptor);
1705 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1706 unbindBackupAgent(info);
1707 reply.writeNoException();
1708 return true;
1709 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001710
1711 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1712 data.enforceInterface(IActivityManager.descriptor);
1713 String packageName = data.readString();
1714 addPackageDependency(packageName);
1715 reply.writeNoException();
1716 return true;
1717 }
1718
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001719 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001720 data.enforceInterface(IActivityManager.descriptor);
1721 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001722 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001723 String reason = data.readString();
1724 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001725 reply.writeNoException();
1726 return true;
1727 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001728
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001729 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1730 data.enforceInterface(IActivityManager.descriptor);
1731 String reason = data.readString();
1732 closeSystemDialogs(reason);
1733 reply.writeNoException();
1734 return true;
1735 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001736
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001737 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1738 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001739 int[] pids = data.createIntArray();
1740 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001741 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001742 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001743 return true;
1744 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001745
1746 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1747 data.enforceInterface(IActivityManager.descriptor);
1748 String processName = data.readString();
1749 int uid = data.readInt();
1750 killApplicationProcess(processName, uid);
1751 reply.writeNoException();
1752 return true;
1753 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001754
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001755 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1756 data.enforceInterface(IActivityManager.descriptor);
1757 IBinder token = data.readStrongBinder();
1758 String packageName = data.readString();
1759 int enterAnim = data.readInt();
1760 int exitAnim = data.readInt();
1761 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001762 reply.writeNoException();
1763 return true;
1764 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001765
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001766 case IS_USER_A_MONKEY_TRANSACTION: {
1767 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001768 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001769 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001770 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001771 return true;
1772 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001773
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001774 case SET_USER_IS_MONKEY_TRANSACTION: {
1775 data.enforceInterface(IActivityManager.descriptor);
1776 final boolean monkey = (data.readInt() == 1);
1777 setUserIsMonkey(monkey);
1778 reply.writeNoException();
1779 return true;
1780 }
1781
Dianne Hackborn860755f2010-06-03 18:47:52 -07001782 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1783 data.enforceInterface(IActivityManager.descriptor);
1784 finishHeavyWeightApp();
1785 reply.writeNoException();
1786 return true;
1787 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001788
1789 case IS_IMMERSIVE_TRANSACTION: {
1790 data.enforceInterface(IActivityManager.descriptor);
1791 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001792 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001793 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001794 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001795 return true;
1796 }
1797
Craig Mautnerd61dc202014-07-07 11:09:11 -07001798 case IS_TOP_OF_TASK_TRANSACTION: {
1799 data.enforceInterface(IActivityManager.descriptor);
1800 IBinder token = data.readStrongBinder();
1801 final boolean isTopOfTask = isTopOfTask(token);
1802 reply.writeNoException();
1803 reply.writeInt(isTopOfTask ? 1 : 0);
1804 return true;
1805 }
1806
Craig Mautner5eda9b32013-07-02 11:58:16 -07001807 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001808 data.enforceInterface(IActivityManager.descriptor);
1809 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001810 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001811 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001812 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001813 return true;
1814 }
1815
1816 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1817 data.enforceInterface(IActivityManager.descriptor);
1818 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001819 final Bundle bundle;
1820 if (data.readInt() == 0) {
1821 bundle = null;
1822 } else {
1823 bundle = data.readBundle();
1824 }
Chong Zhang280d3322015-11-03 17:27:26 -08001825 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Craig Mautner233ceee2014-05-09 17:05:11 -07001826 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001827 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001828 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001829 return true;
1830 }
1831
Craig Mautner233ceee2014-05-09 17:05:11 -07001832 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1833 data.enforceInterface(IActivityManager.descriptor);
1834 IBinder token = data.readStrongBinder();
1835 final ActivityOptions options = getActivityOptions(token);
1836 reply.writeNoException();
1837 reply.writeBundle(options == null ? null : options.toBundle());
1838 return true;
1839 }
1840
Daniel Sandler69a48172010-06-23 16:29:36 -04001841 case SET_IMMERSIVE_TRANSACTION: {
1842 data.enforceInterface(IActivityManager.descriptor);
1843 IBinder token = data.readStrongBinder();
1844 boolean imm = data.readInt() == 1;
1845 setImmersive(token, imm);
1846 reply.writeNoException();
1847 return true;
1848 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001849
Daniel Sandler69a48172010-06-23 16:29:36 -04001850 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1851 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001852 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001853 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001854 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001855 return true;
1856 }
1857
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001858 case CRASH_APPLICATION_TRANSACTION: {
1859 data.enforceInterface(IActivityManager.descriptor);
1860 int uid = data.readInt();
1861 int initialPid = data.readInt();
1862 String packageName = data.readString();
1863 String message = data.readString();
1864 crashApplication(uid, initialPid, packageName, message);
1865 reply.writeNoException();
1866 return true;
1867 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001868
1869 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1870 data.enforceInterface(IActivityManager.descriptor);
1871 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001872 int userId = data.readInt();
1873 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001874 reply.writeNoException();
1875 reply.writeString(type);
1876 return true;
1877 }
1878
Dianne Hackborn7e269642010-08-25 19:50:20 -07001879 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1880 data.enforceInterface(IActivityManager.descriptor);
1881 String name = data.readString();
1882 IBinder perm = newUriPermissionOwner(name);
1883 reply.writeNoException();
1884 reply.writeStrongBinder(perm);
1885 return true;
1886 }
1887
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08001888 case GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION: {
1889 data.enforceInterface(IActivityManager.descriptor);
1890 IBinder activityToken = data.readStrongBinder();
1891 IBinder perm = getUriPermissionOwnerForActivity(activityToken);
1892 reply.writeNoException();
1893 reply.writeStrongBinder(perm);
1894 return true;
1895 }
1896
Dianne Hackborn7e269642010-08-25 19:50:20 -07001897 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1898 data.enforceInterface(IActivityManager.descriptor);
1899 IBinder owner = data.readStrongBinder();
1900 int fromUid = data.readInt();
1901 String targetPkg = data.readString();
1902 Uri uri = Uri.CREATOR.createFromParcel(data);
1903 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001904 int sourceUserId = data.readInt();
1905 int targetUserId = data.readInt();
1906 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1907 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001908 reply.writeNoException();
1909 return true;
1910 }
1911
1912 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1913 data.enforceInterface(IActivityManager.descriptor);
1914 IBinder owner = data.readStrongBinder();
1915 Uri uri = null;
1916 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001917 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001918 }
1919 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001920 int userId = data.readInt();
1921 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001922 reply.writeNoException();
1923 return true;
1924 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001925
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001926 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1927 data.enforceInterface(IActivityManager.descriptor);
1928 int callingUid = data.readInt();
1929 String targetPkg = data.readString();
1930 Uri uri = Uri.CREATOR.createFromParcel(data);
1931 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001932 int userId = data.readInt();
1933 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001934 reply.writeNoException();
1935 reply.writeInt(res);
1936 return true;
1937 }
1938
Andy McFadden824c5102010-07-09 16:26:57 -07001939 case DUMP_HEAP_TRANSACTION: {
1940 data.enforceInterface(IActivityManager.descriptor);
1941 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001942 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001943 boolean managed = data.readInt() != 0;
1944 String path = data.readString();
1945 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001946 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001947 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001948 reply.writeNoException();
1949 reply.writeInt(res ? 1 : 0);
1950 return true;
1951 }
1952
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001953 case START_ACTIVITIES_TRANSACTION:
1954 {
1955 data.enforceInterface(IActivityManager.descriptor);
1956 IBinder b = data.readStrongBinder();
1957 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001958 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001959 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1960 String[] resolvedTypes = data.createStringArray();
1961 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001962 Bundle options = data.readInt() != 0
1963 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001964 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001965 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001966 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001967 reply.writeNoException();
1968 reply.writeInt(result);
1969 return true;
1970 }
1971
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001972 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1973 {
1974 data.enforceInterface(IActivityManager.descriptor);
1975 int mode = getFrontActivityScreenCompatMode();
1976 reply.writeNoException();
1977 reply.writeInt(mode);
1978 return true;
1979 }
1980
1981 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1982 {
1983 data.enforceInterface(IActivityManager.descriptor);
1984 int mode = data.readInt();
1985 setFrontActivityScreenCompatMode(mode);
1986 reply.writeNoException();
1987 reply.writeInt(mode);
1988 return true;
1989 }
1990
1991 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1992 {
1993 data.enforceInterface(IActivityManager.descriptor);
1994 String pkg = data.readString();
1995 int mode = getPackageScreenCompatMode(pkg);
1996 reply.writeNoException();
1997 reply.writeInt(mode);
1998 return true;
1999 }
2000
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002001 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
2002 {
2003 data.enforceInterface(IActivityManager.descriptor);
2004 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07002005 int mode = data.readInt();
2006 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002007 reply.writeNoException();
2008 return true;
2009 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002010
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002011 case SWITCH_USER_TRANSACTION: {
2012 data.enforceInterface(IActivityManager.descriptor);
2013 int userid = data.readInt();
2014 boolean result = switchUser(userid);
2015 reply.writeNoException();
2016 reply.writeInt(result ? 1 : 0);
2017 return true;
2018 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07002019
Kenny Guy08488bf2014-02-21 17:40:37 +00002020 case START_USER_IN_BACKGROUND_TRANSACTION: {
2021 data.enforceInterface(IActivityManager.descriptor);
2022 int userid = data.readInt();
2023 boolean result = startUserInBackground(userid);
2024 reply.writeNoException();
2025 reply.writeInt(result ? 1 : 0);
2026 return true;
2027 }
2028
Jeff Sharkeyba512352015-11-12 20:17:45 -08002029 case UNLOCK_USER_TRANSACTION: {
2030 data.enforceInterface(IActivityManager.descriptor);
2031 int userId = data.readInt();
2032 byte[] token = data.createByteArray();
2033 boolean result = unlockUser(userId, token);
2034 reply.writeNoException();
2035 reply.writeInt(result ? 1 : 0);
2036 return true;
2037 }
2038
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002039 case STOP_USER_TRANSACTION: {
2040 data.enforceInterface(IActivityManager.descriptor);
2041 int userid = data.readInt();
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002042 boolean force = data.readInt() != 0;
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002043 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
2044 data.readStrongBinder());
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002045 int result = stopUser(userid, force, callback);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002046 reply.writeNoException();
2047 reply.writeInt(result);
2048 return true;
2049 }
2050
Amith Yamasani52f1d752012-03-28 18:19:29 -07002051 case GET_CURRENT_USER_TRANSACTION: {
2052 data.enforceInterface(IActivityManager.descriptor);
2053 UserInfo userInfo = getCurrentUser();
2054 reply.writeNoException();
2055 userInfo.writeToParcel(reply, 0);
2056 return true;
2057 }
2058
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002059 case IS_USER_RUNNING_TRANSACTION: {
2060 data.enforceInterface(IActivityManager.descriptor);
2061 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08002062 int _flags = data.readInt();
2063 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002064 reply.writeNoException();
2065 reply.writeInt(result ? 1 : 0);
2066 return true;
2067 }
2068
Dianne Hackbornc72fc672012-09-20 13:12:03 -07002069 case GET_RUNNING_USER_IDS_TRANSACTION: {
2070 data.enforceInterface(IActivityManager.descriptor);
2071 int[] result = getRunningUserIds();
2072 reply.writeNoException();
2073 reply.writeIntArray(result);
2074 return true;
2075 }
2076
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002077 case REMOVE_TASK_TRANSACTION:
2078 {
2079 data.enforceInterface(IActivityManager.descriptor);
2080 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002081 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002082 reply.writeNoException();
2083 reply.writeInt(result ? 1 : 0);
2084 return true;
2085 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002086
Jeff Sharkeya4620792011-05-20 15:29:23 -07002087 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2088 data.enforceInterface(IActivityManager.descriptor);
2089 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2090 data.readStrongBinder());
2091 registerProcessObserver(observer);
2092 return true;
2093 }
2094
2095 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2096 data.enforceInterface(IActivityManager.descriptor);
2097 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2098 data.readStrongBinder());
2099 unregisterProcessObserver(observer);
2100 return true;
2101 }
2102
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002103 case REGISTER_UID_OBSERVER_TRANSACTION: {
2104 data.enforceInterface(IActivityManager.descriptor);
2105 IUidObserver observer = IUidObserver.Stub.asInterface(
2106 data.readStrongBinder());
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002107 int which = data.readInt();
2108 registerUidObserver(observer, which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002109 return true;
2110 }
2111
2112 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2113 data.enforceInterface(IActivityManager.descriptor);
2114 IUidObserver observer = IUidObserver.Stub.asInterface(
2115 data.readStrongBinder());
2116 unregisterUidObserver(observer);
2117 return true;
2118 }
2119
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002120 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2121 {
2122 data.enforceInterface(IActivityManager.descriptor);
2123 String pkg = data.readString();
2124 boolean ask = getPackageAskScreenCompat(pkg);
2125 reply.writeNoException();
2126 reply.writeInt(ask ? 1 : 0);
2127 return true;
2128 }
2129
2130 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2131 {
2132 data.enforceInterface(IActivityManager.descriptor);
2133 String pkg = data.readString();
2134 boolean ask = data.readInt() != 0;
2135 setPackageAskScreenCompat(pkg, ask);
2136 reply.writeNoException();
2137 return true;
2138 }
2139
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002140 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2141 data.enforceInterface(IActivityManager.descriptor);
2142 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002143 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002144 boolean res = isIntentSenderTargetedToPackage(r);
2145 reply.writeNoException();
2146 reply.writeInt(res ? 1 : 0);
2147 return true;
2148 }
2149
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002150 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2151 data.enforceInterface(IActivityManager.descriptor);
2152 IIntentSender r = IIntentSender.Stub.asInterface(
2153 data.readStrongBinder());
2154 boolean res = isIntentSenderAnActivity(r);
2155 reply.writeNoException();
2156 reply.writeInt(res ? 1 : 0);
2157 return true;
2158 }
2159
Dianne Hackborn81038902012-11-26 17:04:09 -08002160 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2161 data.enforceInterface(IActivityManager.descriptor);
2162 IIntentSender r = IIntentSender.Stub.asInterface(
2163 data.readStrongBinder());
2164 Intent intent = getIntentForIntentSender(r);
2165 reply.writeNoException();
2166 if (intent != null) {
2167 reply.writeInt(1);
2168 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2169 } else {
2170 reply.writeInt(0);
2171 }
2172 return true;
2173 }
2174
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002175 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2176 data.enforceInterface(IActivityManager.descriptor);
2177 IIntentSender r = IIntentSender.Stub.asInterface(
2178 data.readStrongBinder());
2179 String prefix = data.readString();
2180 String tag = getTagForIntentSender(r, prefix);
2181 reply.writeNoException();
2182 reply.writeString(tag);
2183 return true;
2184 }
2185
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002186 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2187 data.enforceInterface(IActivityManager.descriptor);
2188 Configuration config = Configuration.CREATOR.createFromParcel(data);
2189 updatePersistentConfiguration(config);
2190 reply.writeNoException();
2191 return true;
2192 }
2193
Dianne Hackbornb437e092011-08-05 17:50:29 -07002194 case GET_PROCESS_PSS_TRANSACTION: {
2195 data.enforceInterface(IActivityManager.descriptor);
2196 int[] pids = data.createIntArray();
2197 long[] pss = getProcessPss(pids);
2198 reply.writeNoException();
2199 reply.writeLongArray(pss);
2200 return true;
2201 }
2202
Dianne Hackborn661cd522011-08-22 00:26:20 -07002203 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2204 data.enforceInterface(IActivityManager.descriptor);
2205 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2206 boolean always = data.readInt() != 0;
2207 showBootMessage(msg, always);
2208 reply.writeNoException();
2209 return true;
2210 }
2211
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002212 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002213 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002214 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002215 reply.writeNoException();
2216 return true;
2217 }
2218
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002219 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2220 data.enforceInterface(IActivityManager.descriptor);
2221 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2222 reply.writeNoException();
2223 return true;
2224 }
2225
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002226 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002227 data.enforceInterface(IActivityManager.descriptor);
2228 IBinder token = data.readStrongBinder();
2229 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002230 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002231 reply.writeNoException();
2232 reply.writeInt(res ? 1 : 0);
2233 return true;
2234 }
2235
2236 case NAVIGATE_UP_TO_TRANSACTION: {
2237 data.enforceInterface(IActivityManager.descriptor);
2238 IBinder token = data.readStrongBinder();
2239 Intent target = Intent.CREATOR.createFromParcel(data);
2240 int resultCode = data.readInt();
2241 Intent resultData = null;
2242 if (data.readInt() != 0) {
2243 resultData = Intent.CREATOR.createFromParcel(data);
2244 }
2245 boolean res = navigateUpTo(token, target, resultCode, resultData);
2246 reply.writeNoException();
2247 reply.writeInt(res ? 1 : 0);
2248 return true;
2249 }
2250
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002251 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2252 data.enforceInterface(IActivityManager.descriptor);
2253 IBinder token = data.readStrongBinder();
2254 int res = getLaunchedFromUid(token);
2255 reply.writeNoException();
2256 reply.writeInt(res);
2257 return true;
2258 }
2259
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002260 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2261 data.enforceInterface(IActivityManager.descriptor);
2262 IBinder token = data.readStrongBinder();
2263 String res = getLaunchedFromPackage(token);
2264 reply.writeNoException();
2265 reply.writeString(res);
2266 return true;
2267 }
2268
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002269 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2270 data.enforceInterface(IActivityManager.descriptor);
2271 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2272 data.readStrongBinder());
2273 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002274 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002275 return true;
2276 }
2277
2278 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2279 data.enforceInterface(IActivityManager.descriptor);
2280 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2281 data.readStrongBinder());
2282 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002283 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002284 return true;
2285 }
2286
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002287 case REQUEST_BUG_REPORT_TRANSACTION: {
2288 data.enforceInterface(IActivityManager.descriptor);
Felipe Leme4cc86332015-12-04 16:37:28 -08002289 boolean progress = data.readInt() != 0;
2290 requestBugReport(progress);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002291 reply.writeNoException();
2292 return true;
2293 }
2294
2295 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2296 data.enforceInterface(IActivityManager.descriptor);
2297 int pid = data.readInt();
2298 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002299 String reason = data.readString();
2300 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002301 reply.writeNoException();
2302 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002303 return true;
2304 }
2305
Adam Skorydfc7fd72013-08-05 19:23:41 -07002306 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002307 data.enforceInterface(IActivityManager.descriptor);
2308 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002309 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002310 reply.writeNoException();
2311 reply.writeBundle(res);
2312 return true;
2313 }
2314
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002315 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2316 data.enforceInterface(IActivityManager.descriptor);
2317 int requestType = data.readInt();
2318 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002319 IBinder activityToken = data.readStrongBinder();
2320 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002321 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002322 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002323 return true;
2324 }
2325
Adam Skorydfc7fd72013-08-05 19:23:41 -07002326 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002327 data.enforceInterface(IActivityManager.descriptor);
2328 IBinder token = data.readStrongBinder();
2329 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002330 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2331 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002332 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2333 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002334 reply.writeNoException();
2335 return true;
2336 }
2337
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002338 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2339 data.enforceInterface(IActivityManager.descriptor);
2340 Intent intent = Intent.CREATOR.createFromParcel(data);
2341 int requestType = data.readInt();
2342 String hint = data.readString();
2343 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002344 Bundle args = data.readBundle();
2345 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002346 reply.writeNoException();
2347 reply.writeInt(res ? 1 : 0);
2348 return true;
2349 }
2350
Benjamin Franzc200f442015-06-25 18:20:04 +01002351 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2352 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002353 boolean res = isAssistDataAllowedOnCurrentActivity();
2354 reply.writeNoException();
2355 reply.writeInt(res ? 1 : 0);
2356 return true;
2357 }
2358
2359 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2360 data.enforceInterface(IActivityManager.descriptor);
2361 IBinder token = data.readStrongBinder();
2362 Bundle args = data.readBundle();
2363 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002364 reply.writeNoException();
2365 reply.writeInt(res ? 1 : 0);
2366 return true;
2367 }
2368
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002369 case KILL_UID_TRANSACTION: {
2370 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002371 int appId = data.readInt();
2372 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002373 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002374 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002375 reply.writeNoException();
2376 return true;
2377 }
2378
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002379 case HANG_TRANSACTION: {
2380 data.enforceInterface(IActivityManager.descriptor);
2381 IBinder who = data.readStrongBinder();
2382 boolean allowRestart = data.readInt() != 0;
2383 hang(who, allowRestart);
2384 reply.writeNoException();
2385 return true;
2386 }
2387
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002388 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2389 data.enforceInterface(IActivityManager.descriptor);
2390 IBinder token = data.readStrongBinder();
2391 reportActivityFullyDrawn(token);
2392 reply.writeNoException();
2393 return true;
2394 }
2395
Craig Mautner5eda9b32013-07-02 11:58:16 -07002396 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2397 data.enforceInterface(IActivityManager.descriptor);
2398 IBinder token = data.readStrongBinder();
2399 notifyActivityDrawn(token);
2400 reply.writeNoException();
2401 return true;
2402 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002403
2404 case RESTART_TRANSACTION: {
2405 data.enforceInterface(IActivityManager.descriptor);
2406 restart();
2407 reply.writeNoException();
2408 return true;
2409 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002410
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002411 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2412 data.enforceInterface(IActivityManager.descriptor);
2413 performIdleMaintenance();
2414 reply.writeNoException();
2415 return true;
2416 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002417
Todd Kennedyca4d8422015-01-15 15:19:22 -08002418 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002419 data.enforceInterface(IActivityManager.descriptor);
2420 IBinder parentActivityToken = data.readStrongBinder();
2421 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002422 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002423 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002424 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002425 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002426 if (activityContainer != null) {
2427 reply.writeInt(1);
2428 reply.writeStrongBinder(activityContainer.asBinder());
2429 } else {
2430 reply.writeInt(0);
2431 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002432 return true;
2433 }
2434
Craig Mautner95da1082014-02-24 17:54:35 -08002435 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2436 data.enforceInterface(IActivityManager.descriptor);
2437 IActivityContainer activityContainer =
2438 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2439 deleteActivityContainer(activityContainer);
2440 reply.writeNoException();
2441 return true;
2442 }
2443
Todd Kennedy4900bf92015-01-16 16:05:14 -08002444 case CREATE_STACK_ON_DISPLAY: {
2445 data.enforceInterface(IActivityManager.descriptor);
2446 int displayId = data.readInt();
2447 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2448 reply.writeNoException();
2449 if (activityContainer != null) {
2450 reply.writeInt(1);
2451 reply.writeStrongBinder(activityContainer.asBinder());
2452 } else {
2453 reply.writeInt(0);
2454 }
2455 return true;
2456 }
2457
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002458 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002459 data.enforceInterface(IActivityManager.descriptor);
2460 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002461 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002462 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002463 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002464 return true;
2465 }
2466
Craig Mautneraea74a52014-03-08 14:23:10 -08002467 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2468 data.enforceInterface(IActivityManager.descriptor);
2469 final int taskId = data.readInt();
2470 startLockTaskMode(taskId);
2471 reply.writeNoException();
2472 return true;
2473 }
2474
2475 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2476 data.enforceInterface(IActivityManager.descriptor);
2477 IBinder token = data.readStrongBinder();
2478 startLockTaskMode(token);
2479 reply.writeNoException();
2480 return true;
2481 }
2482
Craig Mautnerd61dc202014-07-07 11:09:11 -07002483 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002484 data.enforceInterface(IActivityManager.descriptor);
2485 startLockTaskModeOnCurrent();
2486 reply.writeNoException();
2487 return true;
2488 }
2489
Craig Mautneraea74a52014-03-08 14:23:10 -08002490 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2491 data.enforceInterface(IActivityManager.descriptor);
2492 stopLockTaskMode();
2493 reply.writeNoException();
2494 return true;
2495 }
2496
Craig Mautnerd61dc202014-07-07 11:09:11 -07002497 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002498 data.enforceInterface(IActivityManager.descriptor);
2499 stopLockTaskModeOnCurrent();
2500 reply.writeNoException();
2501 return true;
2502 }
2503
Craig Mautneraea74a52014-03-08 14:23:10 -08002504 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2505 data.enforceInterface(IActivityManager.descriptor);
2506 final boolean isInLockTaskMode = isInLockTaskMode();
2507 reply.writeNoException();
2508 reply.writeInt(isInLockTaskMode ? 1 : 0);
2509 return true;
2510 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002511
Benjamin Franz43261142015-02-11 15:59:44 +00002512 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2513 data.enforceInterface(IActivityManager.descriptor);
2514 final int lockTaskModeState = getLockTaskModeState();
2515 reply.writeNoException();
2516 reply.writeInt(lockTaskModeState);
2517 return true;
2518 }
2519
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002520 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2521 data.enforceInterface(IActivityManager.descriptor);
2522 final IBinder token = data.readStrongBinder();
2523 showLockTaskEscapeMessage(token);
2524 reply.writeNoException();
2525 return true;
2526 }
2527
Winson Chunga449dc02014-05-16 11:15:04 -07002528 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002529 data.enforceInterface(IActivityManager.descriptor);
2530 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002531 ActivityManager.TaskDescription values =
2532 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2533 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002534 reply.writeNoException();
2535 return true;
2536 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002537
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002538 case SET_TASK_RESIZEABLE_TRANSACTION: {
2539 data.enforceInterface(IActivityManager.descriptor);
2540 int taskId = data.readInt();
2541 boolean resizeable = (data.readInt() == 1) ? true : false;
2542 setTaskResizeable(taskId, resizeable);
2543 reply.writeNoException();
2544 return true;
2545 }
2546
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002547 case RESIZE_TASK_TRANSACTION: {
2548 data.enforceInterface(IActivityManager.descriptor);
2549 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002550 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002551 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002552 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002553 reply.writeNoException();
2554 return true;
2555 }
2556
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002557 case GET_TASK_BOUNDS_TRANSACTION: {
2558 data.enforceInterface(IActivityManager.descriptor);
2559 int taskId = data.readInt();
2560 Rect r = getTaskBounds(taskId);
2561 reply.writeNoException();
2562 r.writeToParcel(reply, 0);
2563 return true;
2564 }
2565
Craig Mautner648f69b2014-09-18 14:16:26 -07002566 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2567 data.enforceInterface(IActivityManager.descriptor);
2568 String filename = data.readString();
Suprabh Shukla23593142015-11-03 17:31:15 -08002569 int userId = data.readInt();
2570 Bitmap icon = getTaskDescriptionIcon(filename, userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07002571 reply.writeNoException();
2572 if (icon == null) {
2573 reply.writeInt(0);
2574 } else {
2575 reply.writeInt(1);
2576 icon.writeToParcel(reply, 0);
2577 }
2578 return true;
2579 }
2580
Winson Chung044d5292014-11-06 11:05:19 -08002581 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2582 data.enforceInterface(IActivityManager.descriptor);
2583 final Bundle bundle;
2584 if (data.readInt() == 0) {
2585 bundle = null;
2586 } else {
2587 bundle = data.readBundle();
2588 }
Chong Zhang280d3322015-11-03 17:27:26 -08002589 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002590 startInPlaceAnimationOnFrontMostApplication(options);
2591 reply.writeNoException();
2592 return true;
2593 }
2594
Jose Lima4b6c6692014-08-12 17:41:12 -07002595 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002596 data.enforceInterface(IActivityManager.descriptor);
2597 IBinder token = data.readStrongBinder();
2598 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002599 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002600 reply.writeNoException();
2601 reply.writeInt(success ? 1 : 0);
2602 return true;
2603 }
2604
Jose Lima4b6c6692014-08-12 17:41:12 -07002605 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002606 data.enforceInterface(IActivityManager.descriptor);
2607 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002608 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002609 reply.writeNoException();
2610 reply.writeInt(enabled ? 1 : 0);
2611 return true;
2612 }
2613
Jose Lima4b6c6692014-08-12 17:41:12 -07002614 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002615 data.enforceInterface(IActivityManager.descriptor);
2616 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002617 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002618 reply.writeNoException();
2619 return true;
2620 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002621
2622 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2623 data.enforceInterface(IActivityManager.descriptor);
2624 IBinder token = data.readStrongBinder();
2625 notifyLaunchTaskBehindComplete(token);
2626 reply.writeNoException();
2627 return true;
2628 }
Craig Mautner8746a472014-07-24 15:12:54 -07002629
2630 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2631 data.enforceInterface(IActivityManager.descriptor);
2632 IBinder token = data.readStrongBinder();
2633 notifyEnterAnimationComplete(token);
2634 reply.writeNoException();
2635 return true;
2636 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002637
2638 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2639 data.enforceInterface(IActivityManager.descriptor);
2640 bootAnimationComplete();
2641 reply.writeNoException();
2642 return true;
2643 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002644
Jeff Sharkey605eb792014-11-04 13:34:06 -08002645 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2646 data.enforceInterface(IActivityManager.descriptor);
2647 final int uid = data.readInt();
2648 final byte[] firstPacket = data.createByteArray();
2649 notifyCleartextNetwork(uid, firstPacket);
2650 reply.writeNoException();
2651 return true;
2652 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002653
2654 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2655 data.enforceInterface(IActivityManager.descriptor);
2656 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002657 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002658 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002659 String reportPackage = data.readString();
2660 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002661 reply.writeNoException();
2662 return true;
2663 }
2664
2665 case DUMP_HEAP_FINISHED_TRANSACTION: {
2666 data.enforceInterface(IActivityManager.descriptor);
2667 String path = data.readString();
2668 dumpHeapFinished(path);
2669 reply.writeNoException();
2670 return true;
2671 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002672
2673 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2674 data.enforceInterface(IActivityManager.descriptor);
2675 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2676 data.readStrongBinder());
2677 boolean keepAwake = data.readInt() != 0;
2678 setVoiceKeepAwake(session, keepAwake);
2679 reply.writeNoException();
2680 return true;
2681 }
Craig Mautnere5600772015-04-03 21:36:37 -07002682
2683 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2684 data.enforceInterface(IActivityManager.descriptor);
2685 int userId = data.readInt();
2686 String[] packages = data.readStringArray();
2687 updateLockTaskPackages(userId, packages);
2688 reply.writeNoException();
2689 return true;
2690 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002691
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002692 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2693 data.enforceInterface(IActivityManager.descriptor);
2694 String packageName = data.readString();
2695 updateDeviceOwner(packageName);
2696 reply.writeNoException();
2697 return true;
2698 }
2699
Dianne Hackborn1e383822015-04-10 14:02:33 -07002700 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2701 data.enforceInterface(IActivityManager.descriptor);
2702 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002703 String callingPackage = data.readString();
2704 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002705 reply.writeNoException();
2706 reply.writeInt(res);
2707 return true;
2708 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002709
2710 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2711 data.enforceInterface(IActivityManager.descriptor);
2712 String process = data.readString();
2713 int userId = data.readInt();
2714 int level = data.readInt();
2715 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2716 reply.writeNoException();
2717 reply.writeInt(res ? 1 : 0);
2718 return true;
2719 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002720
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002721 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2722 data.enforceInterface(IActivityManager.descriptor);
2723 IBinder token = data.readStrongBinder();
2724 boolean res = isRootVoiceInteraction(token);
2725 reply.writeNoException();
2726 reply.writeInt(res ? 1 : 0);
2727 return true;
2728 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002729
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002730 case START_BINDER_TRACKING_TRANSACTION: {
2731 data.enforceInterface(IActivityManager.descriptor);
2732 boolean res = startBinderTracking();
2733 reply.writeNoException();
2734 reply.writeInt(res ? 1 : 0);
2735 return true;
2736 }
2737
2738 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2739 data.enforceInterface(IActivityManager.descriptor);
2740 ParcelFileDescriptor fd = data.readInt() != 0
2741 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2742 boolean res = stopBinderTrackingAndDump(fd);
2743 reply.writeNoException();
2744 reply.writeInt(res ? 1 : 0);
2745 return true;
2746 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002747 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2748 data.enforceInterface(IActivityManager.descriptor);
2749 IBinder token = data.readStrongBinder();
2750 int stackId = getActivityStackId(token);
2751 reply.writeNoException();
2752 reply.writeInt(stackId);
2753 return true;
2754 }
2755 case MOVE_ACTIVITY_TO_STACK_TRANSACTION: {
2756 data.enforceInterface(IActivityManager.descriptor);
2757 IBinder token = data.readStrongBinder();
2758 int stackId = data.readInt();
2759 moveActivityToStack(token, stackId);
2760 reply.writeNoException();
2761 return true;
2762 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002763 case REPORT_SIZE_CONFIGURATIONS: {
2764 data.enforceInterface(IActivityManager.descriptor);
2765 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002766 int[] horizontal = readIntArray(data);
2767 int[] vertical = readIntArray(data);
2768 int[] smallest = readIntArray(data);
2769 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002770 return true;
2771 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002772 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2773 data.enforceInterface(IActivityManager.descriptor);
2774 final boolean suppress = data.readInt() == 1;
2775 suppressResizeConfigChanges(suppress);
2776 reply.writeNoException();
2777 return true;
2778 }
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08002779 case MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002780 data.enforceInterface(IActivityManager.descriptor);
2781 final int stackId = data.readInt();
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08002782 moveTasksToFullscreenStack(stackId);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002783 reply.writeNoException();
2784 return true;
2785 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002786 case GET_APP_START_MODE_TRANSACTION: {
2787 data.enforceInterface(IActivityManager.descriptor);
2788 final int uid = data.readInt();
2789 final String pkg = data.readString();
2790 int res = getAppStartMode(uid, pkg);
2791 reply.writeNoException();
2792 reply.writeInt(res);
2793 return true;
2794 }
Wale Ogunwale5f986092015-12-04 15:35:38 -08002795 case IN_MULTI_WINDOW_MODE_TRANSACTION: {
2796 data.enforceInterface(IActivityManager.descriptor);
2797 final IBinder token = data.readStrongBinder();
2798 final boolean multiWindowMode = inMultiWindowMode(token);
2799 reply.writeNoException();
2800 reply.writeInt(multiWindowMode ? 1 : 0);
2801 return true;
2802 }
2803 case IN_PICTURE_IN_PICTURE_MODE_TRANSACTION: {
2804 data.enforceInterface(IActivityManager.descriptor);
2805 final IBinder token = data.readStrongBinder();
2806 final boolean pipMode = inPictureInPictureMode(token);
2807 reply.writeNoException();
2808 reply.writeInt(pipMode ? 1 : 0);
2809 return true;
2810 }
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002811 case ENTER_PICTURE_IN_PICTURE_MODE_TRANSACTION: {
2812 data.enforceInterface(IActivityManager.descriptor);
2813 final IBinder token = data.readStrongBinder();
2814 enterPictureInPictureMode(token);
2815 reply.writeNoException();
2816 return true;
2817 }
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002818 case SET_VR_MODE_TRANSACTION: {
2819 data.enforceInterface(IActivityManager.descriptor);
2820 final IBinder token = data.readStrongBinder();
2821 final boolean enable = data.readInt() == 1;
2822 setVrMode(token, enable);
2823 reply.writeNoException();
2824 return true;
2825 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002826 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002827
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002828 return super.onTransact(code, data, reply, flags);
2829 }
2830
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002831 private int[] readIntArray(Parcel data) {
2832 int[] smallest = null;
2833 int smallestSize = data.readInt();
2834 if (smallestSize > 0) {
2835 smallest = new int[smallestSize];
2836 data.readIntArray(smallest);
2837 }
2838 return smallest;
2839 }
2840
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002841 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002842 return this;
2843 }
2844
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002845 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2846 protected IActivityManager create() {
2847 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002848 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002849 Log.v("ActivityManager", "default service binder = " + b);
2850 }
2851 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002852 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002853 Log.v("ActivityManager", "default service = " + am);
2854 }
2855 return am;
2856 }
2857 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002858}
2859
2860class ActivityManagerProxy implements IActivityManager
2861{
2862 public ActivityManagerProxy(IBinder remote)
2863 {
2864 mRemote = remote;
2865 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002866
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002867 public IBinder asBinder()
2868 {
2869 return mRemote;
2870 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002871
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002872 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002873 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002874 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002875 Parcel data = Parcel.obtain();
2876 Parcel reply = Parcel.obtain();
2877 data.writeInterfaceToken(IActivityManager.descriptor);
2878 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002879 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002880 intent.writeToParcel(data, 0);
2881 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002882 data.writeStrongBinder(resultTo);
2883 data.writeString(resultWho);
2884 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002885 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002886 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002887 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002888 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002889 } else {
2890 data.writeInt(0);
2891 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002892 if (options != null) {
2893 data.writeInt(1);
2894 options.writeToParcel(data, 0);
2895 } else {
2896 data.writeInt(0);
2897 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002898 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2899 reply.readException();
2900 int result = reply.readInt();
2901 reply.recycle();
2902 data.recycle();
2903 return result;
2904 }
Amith Yamasani82644082012-08-03 13:09:11 -07002905
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002906 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002907 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002908 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2909 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002910 Parcel data = Parcel.obtain();
2911 Parcel reply = Parcel.obtain();
2912 data.writeInterfaceToken(IActivityManager.descriptor);
2913 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002914 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002915 intent.writeToParcel(data, 0);
2916 data.writeString(resolvedType);
2917 data.writeStrongBinder(resultTo);
2918 data.writeString(resultWho);
2919 data.writeInt(requestCode);
2920 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002921 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002922 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002923 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002924 } else {
2925 data.writeInt(0);
2926 }
2927 if (options != null) {
2928 data.writeInt(1);
2929 options.writeToParcel(data, 0);
2930 } else {
2931 data.writeInt(0);
2932 }
2933 data.writeInt(userId);
2934 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2935 reply.readException();
2936 int result = reply.readInt();
2937 reply.recycle();
2938 data.recycle();
2939 return result;
2940 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002941 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2942 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002943 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2944 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002945 Parcel data = Parcel.obtain();
2946 Parcel reply = Parcel.obtain();
2947 data.writeInterfaceToken(IActivityManager.descriptor);
2948 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2949 data.writeString(callingPackage);
2950 intent.writeToParcel(data, 0);
2951 data.writeString(resolvedType);
2952 data.writeStrongBinder(resultTo);
2953 data.writeString(resultWho);
2954 data.writeInt(requestCode);
2955 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002956 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002957 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002958 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002959 } else {
2960 data.writeInt(0);
2961 }
2962 if (options != null) {
2963 data.writeInt(1);
2964 options.writeToParcel(data, 0);
2965 } else {
2966 data.writeInt(0);
2967 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002968 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002969 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002970 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2971 reply.readException();
2972 int result = reply.readInt();
2973 reply.recycle();
2974 data.recycle();
2975 return result;
2976 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002977 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2978 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002979 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2980 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002981 Parcel data = Parcel.obtain();
2982 Parcel reply = Parcel.obtain();
2983 data.writeInterfaceToken(IActivityManager.descriptor);
2984 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002985 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002986 intent.writeToParcel(data, 0);
2987 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002988 data.writeStrongBinder(resultTo);
2989 data.writeString(resultWho);
2990 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002991 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002992 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002993 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002994 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002995 } else {
2996 data.writeInt(0);
2997 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002998 if (options != null) {
2999 data.writeInt(1);
3000 options.writeToParcel(data, 0);
3001 } else {
3002 data.writeInt(0);
3003 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003004 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003005 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
3006 reply.readException();
3007 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
3008 reply.recycle();
3009 data.recycle();
3010 return result;
3011 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003012 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
3013 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003014 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07003015 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003016 Parcel data = Parcel.obtain();
3017 Parcel reply = Parcel.obtain();
3018 data.writeInterfaceToken(IActivityManager.descriptor);
3019 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003020 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003021 intent.writeToParcel(data, 0);
3022 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003023 data.writeStrongBinder(resultTo);
3024 data.writeString(resultWho);
3025 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003026 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003027 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003028 if (options != null) {
3029 data.writeInt(1);
3030 options.writeToParcel(data, 0);
3031 } else {
3032 data.writeInt(0);
3033 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003034 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003035 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
3036 reply.readException();
3037 int result = reply.readInt();
3038 reply.recycle();
3039 data.recycle();
3040 return result;
3041 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003042 public int startActivityIntentSender(IApplicationThread caller,
3043 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003044 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003045 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003046 Parcel data = Parcel.obtain();
3047 Parcel reply = Parcel.obtain();
3048 data.writeInterfaceToken(IActivityManager.descriptor);
3049 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3050 intent.writeToParcel(data, 0);
3051 if (fillInIntent != null) {
3052 data.writeInt(1);
3053 fillInIntent.writeToParcel(data, 0);
3054 } else {
3055 data.writeInt(0);
3056 }
3057 data.writeString(resolvedType);
3058 data.writeStrongBinder(resultTo);
3059 data.writeString(resultWho);
3060 data.writeInt(requestCode);
3061 data.writeInt(flagsMask);
3062 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003063 if (options != null) {
3064 data.writeInt(1);
3065 options.writeToParcel(data, 0);
3066 } else {
3067 data.writeInt(0);
3068 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003069 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003070 reply.readException();
3071 int result = reply.readInt();
3072 reply.recycle();
3073 data.recycle();
3074 return result;
3075 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07003076 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
3077 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07003078 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
3079 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003080 Parcel data = Parcel.obtain();
3081 Parcel reply = Parcel.obtain();
3082 data.writeInterfaceToken(IActivityManager.descriptor);
3083 data.writeString(callingPackage);
3084 data.writeInt(callingPid);
3085 data.writeInt(callingUid);
3086 intent.writeToParcel(data, 0);
3087 data.writeString(resolvedType);
3088 data.writeStrongBinder(session.asBinder());
3089 data.writeStrongBinder(interactor.asBinder());
3090 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003091 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003092 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003093 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07003094 } else {
3095 data.writeInt(0);
3096 }
3097 if (options != null) {
3098 data.writeInt(1);
3099 options.writeToParcel(data, 0);
3100 } else {
3101 data.writeInt(0);
3102 }
3103 data.writeInt(userId);
3104 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3105 reply.readException();
3106 int result = reply.readInt();
3107 reply.recycle();
3108 data.recycle();
3109 return result;
3110 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003111 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003112 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003113 Parcel data = Parcel.obtain();
3114 Parcel reply = Parcel.obtain();
3115 data.writeInterfaceToken(IActivityManager.descriptor);
3116 data.writeStrongBinder(callingActivity);
3117 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003118 if (options != null) {
3119 data.writeInt(1);
3120 options.writeToParcel(data, 0);
3121 } else {
3122 data.writeInt(0);
3123 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003124 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3125 reply.readException();
3126 int result = reply.readInt();
3127 reply.recycle();
3128 data.recycle();
3129 return result != 0;
3130 }
Wale Ogunwale854809c2015-12-27 16:18:19 -08003131 public int startActivityFromRecents(int taskId, Bundle options)
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003132 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003133 Parcel data = Parcel.obtain();
3134 Parcel reply = Parcel.obtain();
3135 data.writeInterfaceToken(IActivityManager.descriptor);
3136 data.writeInt(taskId);
3137 if (options == null) {
3138 data.writeInt(0);
3139 } else {
3140 data.writeInt(1);
3141 options.writeToParcel(data, 0);
3142 }
3143 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3144 reply.readException();
3145 int result = reply.readInt();
3146 reply.recycle();
3147 data.recycle();
3148 return result;
3149 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003150 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003151 throws RemoteException {
3152 Parcel data = Parcel.obtain();
3153 Parcel reply = Parcel.obtain();
3154 data.writeInterfaceToken(IActivityManager.descriptor);
3155 data.writeStrongBinder(token);
3156 data.writeInt(resultCode);
3157 if (resultData != null) {
3158 data.writeInt(1);
3159 resultData.writeToParcel(data, 0);
3160 } else {
3161 data.writeInt(0);
3162 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003163 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003164 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3165 reply.readException();
3166 boolean res = reply.readInt() != 0;
3167 data.recycle();
3168 reply.recycle();
3169 return res;
3170 }
3171 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3172 {
3173 Parcel data = Parcel.obtain();
3174 Parcel reply = Parcel.obtain();
3175 data.writeInterfaceToken(IActivityManager.descriptor);
3176 data.writeStrongBinder(token);
3177 data.writeString(resultWho);
3178 data.writeInt(requestCode);
3179 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3180 reply.readException();
3181 data.recycle();
3182 reply.recycle();
3183 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003184 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3185 Parcel data = Parcel.obtain();
3186 Parcel reply = Parcel.obtain();
3187 data.writeInterfaceToken(IActivityManager.descriptor);
3188 data.writeStrongBinder(token);
3189 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3190 reply.readException();
3191 boolean res = reply.readInt() != 0;
3192 data.recycle();
3193 reply.recycle();
3194 return res;
3195 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003196 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3197 Parcel data = Parcel.obtain();
3198 Parcel reply = Parcel.obtain();
3199 data.writeInterfaceToken(IActivityManager.descriptor);
3200 data.writeStrongBinder(session.asBinder());
3201 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3202 reply.readException();
3203 data.recycle();
3204 reply.recycle();
3205 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003206 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3207 Parcel data = Parcel.obtain();
3208 Parcel reply = Parcel.obtain();
3209 data.writeInterfaceToken(IActivityManager.descriptor);
3210 data.writeStrongBinder(token);
3211 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3212 reply.readException();
3213 boolean res = reply.readInt() != 0;
3214 data.recycle();
3215 reply.recycle();
3216 return res;
3217 }
3218 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3219 Parcel data = Parcel.obtain();
3220 Parcel reply = Parcel.obtain();
3221 data.writeInterfaceToken(IActivityManager.descriptor);
3222 data.writeStrongBinder(app.asBinder());
3223 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3224 reply.readException();
3225 data.recycle();
3226 reply.recycle();
3227 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003228 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3229 Parcel data = Parcel.obtain();
3230 Parcel reply = Parcel.obtain();
3231 data.writeInterfaceToken(IActivityManager.descriptor);
3232 data.writeStrongBinder(token);
3233 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3234 reply.readException();
3235 boolean res = reply.readInt() != 0;
3236 data.recycle();
3237 reply.recycle();
3238 return res;
3239 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003240 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003241 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003242 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003243 {
3244 Parcel data = Parcel.obtain();
3245 Parcel reply = Parcel.obtain();
3246 data.writeInterfaceToken(IActivityManager.descriptor);
3247 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003248 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003249 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3250 filter.writeToParcel(data, 0);
3251 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003252 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003253 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3254 reply.readException();
3255 Intent intent = null;
3256 int haveIntent = reply.readInt();
3257 if (haveIntent != 0) {
3258 intent = Intent.CREATOR.createFromParcel(reply);
3259 }
3260 reply.recycle();
3261 data.recycle();
3262 return intent;
3263 }
3264 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3265 {
3266 Parcel data = Parcel.obtain();
3267 Parcel reply = Parcel.obtain();
3268 data.writeInterfaceToken(IActivityManager.descriptor);
3269 data.writeStrongBinder(receiver.asBinder());
3270 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3271 reply.readException();
3272 data.recycle();
3273 reply.recycle();
3274 }
3275 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003276 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003277 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003278 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003279 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003280 {
3281 Parcel data = Parcel.obtain();
3282 Parcel reply = Parcel.obtain();
3283 data.writeInterfaceToken(IActivityManager.descriptor);
3284 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3285 intent.writeToParcel(data, 0);
3286 data.writeString(resolvedType);
3287 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3288 data.writeInt(resultCode);
3289 data.writeString(resultData);
3290 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003291 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003292 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003293 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003294 data.writeInt(serialized ? 1 : 0);
3295 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003296 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003297 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3298 reply.readException();
3299 int res = reply.readInt();
3300 reply.recycle();
3301 data.recycle();
3302 return res;
3303 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003304 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3305 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003306 {
3307 Parcel data = Parcel.obtain();
3308 Parcel reply = Parcel.obtain();
3309 data.writeInterfaceToken(IActivityManager.descriptor);
3310 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3311 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003312 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003313 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3314 reply.readException();
3315 data.recycle();
3316 reply.recycle();
3317 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003318 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3319 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003320 {
3321 Parcel data = Parcel.obtain();
3322 Parcel reply = Parcel.obtain();
3323 data.writeInterfaceToken(IActivityManager.descriptor);
3324 data.writeStrongBinder(who);
3325 data.writeInt(resultCode);
3326 data.writeString(resultData);
3327 data.writeBundle(map);
3328 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003329 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003330 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3331 reply.readException();
3332 data.recycle();
3333 reply.recycle();
3334 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003335 public void attachApplication(IApplicationThread app) throws RemoteException
3336 {
3337 Parcel data = Parcel.obtain();
3338 Parcel reply = Parcel.obtain();
3339 data.writeInterfaceToken(IActivityManager.descriptor);
3340 data.writeStrongBinder(app.asBinder());
3341 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3342 reply.readException();
3343 data.recycle();
3344 reply.recycle();
3345 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003346 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3347 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003348 {
3349 Parcel data = Parcel.obtain();
3350 Parcel reply = Parcel.obtain();
3351 data.writeInterfaceToken(IActivityManager.descriptor);
3352 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003353 if (config != null) {
3354 data.writeInt(1);
3355 config.writeToParcel(data, 0);
3356 } else {
3357 data.writeInt(0);
3358 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003359 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003360 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3361 reply.readException();
3362 data.recycle();
3363 reply.recycle();
3364 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003365 public void activityResumed(IBinder token) throws RemoteException
3366 {
3367 Parcel data = Parcel.obtain();
3368 Parcel reply = Parcel.obtain();
3369 data.writeInterfaceToken(IActivityManager.descriptor);
3370 data.writeStrongBinder(token);
3371 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3372 reply.readException();
3373 data.recycle();
3374 reply.recycle();
3375 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003376 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003377 {
3378 Parcel data = Parcel.obtain();
3379 Parcel reply = Parcel.obtain();
3380 data.writeInterfaceToken(IActivityManager.descriptor);
3381 data.writeStrongBinder(token);
3382 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3383 reply.readException();
3384 data.recycle();
3385 reply.recycle();
3386 }
3387 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003388 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003389 {
3390 Parcel data = Parcel.obtain();
3391 Parcel reply = Parcel.obtain();
3392 data.writeInterfaceToken(IActivityManager.descriptor);
3393 data.writeStrongBinder(token);
3394 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003395 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003396 TextUtils.writeToParcel(description, data, 0);
3397 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3398 reply.readException();
3399 data.recycle();
3400 reply.recycle();
3401 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003402 public void activitySlept(IBinder token) throws RemoteException
3403 {
3404 Parcel data = Parcel.obtain();
3405 Parcel reply = Parcel.obtain();
3406 data.writeInterfaceToken(IActivityManager.descriptor);
3407 data.writeStrongBinder(token);
3408 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3409 reply.readException();
3410 data.recycle();
3411 reply.recycle();
3412 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003413 public void activityDestroyed(IBinder token) throws RemoteException
3414 {
3415 Parcel data = Parcel.obtain();
3416 Parcel reply = Parcel.obtain();
3417 data.writeInterfaceToken(IActivityManager.descriptor);
3418 data.writeStrongBinder(token);
3419 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3420 reply.readException();
3421 data.recycle();
3422 reply.recycle();
3423 }
Jorim Jaggife89d122015-12-22 16:28:44 +01003424 public void activityRelaunched(IBinder token) throws RemoteException
3425 {
3426 Parcel data = Parcel.obtain();
3427 Parcel reply = Parcel.obtain();
3428 data.writeInterfaceToken(IActivityManager.descriptor);
3429 data.writeStrongBinder(token);
3430 mRemote.transact(ACTIVITY_RELAUNCHED_TRANSACTION, data, reply, 0);
3431 reply.readException();
3432 data.recycle();
3433 reply.recycle();
3434 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003435 public String getCallingPackage(IBinder token) throws RemoteException
3436 {
3437 Parcel data = Parcel.obtain();
3438 Parcel reply = Parcel.obtain();
3439 data.writeInterfaceToken(IActivityManager.descriptor);
3440 data.writeStrongBinder(token);
3441 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3442 reply.readException();
3443 String res = reply.readString();
3444 data.recycle();
3445 reply.recycle();
3446 return res;
3447 }
3448 public ComponentName getCallingActivity(IBinder token)
3449 throws RemoteException {
3450 Parcel data = Parcel.obtain();
3451 Parcel reply = Parcel.obtain();
3452 data.writeInterfaceToken(IActivityManager.descriptor);
3453 data.writeStrongBinder(token);
3454 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3455 reply.readException();
3456 ComponentName res = ComponentName.readFromParcel(reply);
3457 data.recycle();
3458 reply.recycle();
3459 return res;
3460 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003461 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003462 Parcel data = Parcel.obtain();
3463 Parcel reply = Parcel.obtain();
3464 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003465 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003466 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3467 reply.readException();
3468 ArrayList<IAppTask> list = null;
3469 int N = reply.readInt();
3470 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003471 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003472 while (N > 0) {
3473 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3474 list.add(task);
3475 N--;
3476 }
3477 }
3478 data.recycle();
3479 reply.recycle();
3480 return list;
3481 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003482 public int addAppTask(IBinder activityToken, Intent intent,
3483 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3484 Parcel data = Parcel.obtain();
3485 Parcel reply = Parcel.obtain();
3486 data.writeInterfaceToken(IActivityManager.descriptor);
3487 data.writeStrongBinder(activityToken);
3488 intent.writeToParcel(data, 0);
3489 description.writeToParcel(data, 0);
3490 thumbnail.writeToParcel(data, 0);
3491 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3492 reply.readException();
3493 int res = reply.readInt();
3494 data.recycle();
3495 reply.recycle();
3496 return res;
3497 }
3498 public Point getAppTaskThumbnailSize() throws RemoteException {
3499 Parcel data = Parcel.obtain();
3500 Parcel reply = Parcel.obtain();
3501 data.writeInterfaceToken(IActivityManager.descriptor);
3502 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3503 reply.readException();
3504 Point size = Point.CREATOR.createFromParcel(reply);
3505 data.recycle();
3506 reply.recycle();
3507 return size;
3508 }
Todd Kennedye635f662015-01-20 10:36:49 -08003509 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3510 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003511 Parcel data = Parcel.obtain();
3512 Parcel reply = Parcel.obtain();
3513 data.writeInterfaceToken(IActivityManager.descriptor);
3514 data.writeInt(maxNum);
3515 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003516 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3517 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003518 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003519 int N = reply.readInt();
3520 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003521 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003522 while (N > 0) {
3523 ActivityManager.RunningTaskInfo info =
3524 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003525 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003526 list.add(info);
3527 N--;
3528 }
3529 }
3530 data.recycle();
3531 reply.recycle();
3532 return list;
3533 }
3534 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003535 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003536 Parcel data = Parcel.obtain();
3537 Parcel reply = Parcel.obtain();
3538 data.writeInterfaceToken(IActivityManager.descriptor);
3539 data.writeInt(maxNum);
3540 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003541 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003542 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3543 reply.readException();
3544 ArrayList<ActivityManager.RecentTaskInfo> list
3545 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3546 data.recycle();
3547 reply.recycle();
3548 return list;
3549 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003550 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003551 Parcel data = Parcel.obtain();
3552 Parcel reply = Parcel.obtain();
3553 data.writeInterfaceToken(IActivityManager.descriptor);
3554 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003555 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003556 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003557 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003558 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003559 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003560 }
3561 data.recycle();
3562 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003563 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003564 }
Todd Kennedye635f662015-01-20 10:36:49 -08003565 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3566 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003567 Parcel data = Parcel.obtain();
3568 Parcel reply = Parcel.obtain();
3569 data.writeInterfaceToken(IActivityManager.descriptor);
3570 data.writeInt(maxNum);
3571 data.writeInt(flags);
3572 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3573 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003574 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003575 int N = reply.readInt();
3576 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003577 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003578 while (N > 0) {
3579 ActivityManager.RunningServiceInfo info =
3580 ActivityManager.RunningServiceInfo.CREATOR
3581 .createFromParcel(reply);
3582 list.add(info);
3583 N--;
3584 }
3585 }
3586 data.recycle();
3587 reply.recycle();
3588 return list;
3589 }
3590 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3591 throws RemoteException {
3592 Parcel data = Parcel.obtain();
3593 Parcel reply = Parcel.obtain();
3594 data.writeInterfaceToken(IActivityManager.descriptor);
3595 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3596 reply.readException();
3597 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3598 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3599 data.recycle();
3600 reply.recycle();
3601 return list;
3602 }
3603 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3604 throws RemoteException {
3605 Parcel data = Parcel.obtain();
3606 Parcel reply = Parcel.obtain();
3607 data.writeInterfaceToken(IActivityManager.descriptor);
3608 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3609 reply.readException();
3610 ArrayList<ActivityManager.RunningAppProcessInfo> list
3611 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3612 data.recycle();
3613 reply.recycle();
3614 return list;
3615 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003616 public List<ApplicationInfo> getRunningExternalApplications()
3617 throws RemoteException {
3618 Parcel data = Parcel.obtain();
3619 Parcel reply = Parcel.obtain();
3620 data.writeInterfaceToken(IActivityManager.descriptor);
3621 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3622 reply.readException();
3623 ArrayList<ApplicationInfo> list
3624 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3625 data.recycle();
3626 reply.recycle();
3627 return list;
3628 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003629 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003630 {
3631 Parcel data = Parcel.obtain();
3632 Parcel reply = Parcel.obtain();
3633 data.writeInterfaceToken(IActivityManager.descriptor);
3634 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003635 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003636 if (options != null) {
3637 data.writeInt(1);
3638 options.writeToParcel(data, 0);
3639 } else {
3640 data.writeInt(0);
3641 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003642 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3643 reply.readException();
3644 data.recycle();
3645 reply.recycle();
3646 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003647 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3648 throws RemoteException {
3649 Parcel data = Parcel.obtain();
3650 Parcel reply = Parcel.obtain();
3651 data.writeInterfaceToken(IActivityManager.descriptor);
3652 data.writeStrongBinder(token);
3653 data.writeInt(nonRoot ? 1 : 0);
3654 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3655 reply.readException();
3656 boolean res = reply.readInt() != 0;
3657 data.recycle();
3658 reply.recycle();
3659 return res;
3660 }
3661 public void moveTaskBackwards(int task) throws RemoteException
3662 {
3663 Parcel data = Parcel.obtain();
3664 Parcel reply = Parcel.obtain();
3665 data.writeInterfaceToken(IActivityManager.descriptor);
3666 data.writeInt(task);
3667 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3668 reply.readException();
3669 data.recycle();
3670 reply.recycle();
3671 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003672 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003673 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3674 {
3675 Parcel data = Parcel.obtain();
3676 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003677 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003678 data.writeInt(taskId);
3679 data.writeInt(stackId);
3680 data.writeInt(toTop ? 1 : 0);
3681 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3682 reply.readException();
3683 data.recycle();
3684 reply.recycle();
3685 }
3686 @Override
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003687 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
3688 Rect initialBounds) throws RemoteException
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003689 {
3690 Parcel data = Parcel.obtain();
3691 Parcel reply = Parcel.obtain();
3692 data.writeInterfaceToken(IActivityManager.descriptor);
3693 data.writeInt(taskId);
3694 data.writeInt(createMode);
3695 data.writeInt(toTop ? 1 : 0);
Jorim Jaggi030979c2015-11-20 15:14:43 -08003696 data.writeInt(animate ? 1 : 0);
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003697 if (initialBounds != null) {
3698 data.writeInt(1);
3699 initialBounds.writeToParcel(data, 0);
3700 } else {
3701 data.writeInt(0);
3702 }
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003703 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3704 reply.readException();
3705 data.recycle();
3706 reply.recycle();
3707 }
3708 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003709 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3710 throws RemoteException
3711 {
3712 Parcel data = Parcel.obtain();
3713 Parcel reply = Parcel.obtain();
3714 data.writeInterfaceToken(IActivityManager.descriptor);
3715 data.writeInt(stackId);
3716 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003717 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003718 reply.readException();
3719 final boolean res = reply.readInt() != 0;
3720 data.recycle();
3721 reply.recycle();
3722 return res;
3723 }
3724 @Override
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003725 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode)
3726 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003727 {
3728 Parcel data = Parcel.obtain();
3729 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003730 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003731 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003732 if (r != null) {
3733 data.writeInt(1);
3734 r.writeToParcel(data, 0);
3735 } else {
3736 data.writeInt(0);
3737 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003738 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003739 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003740 reply.readException();
3741 data.recycle();
3742 reply.recycle();
3743 }
Craig Mautner967212c2013-04-13 21:10:58 -07003744 @Override
Jorim Jaggidc249c42015-12-15 14:57:31 -08003745 public void resizeDockedStack(Rect dockedBounds, Rect tempDockedTaskBounds,
3746 Rect tempDockedTaskInsetBounds,
3747 Rect tempOtherTaskBounds, Rect tempOtherTaskInsetBounds)
3748 throws RemoteException
3749 {
3750 Parcel data = Parcel.obtain();
3751 Parcel reply = Parcel.obtain();
3752 data.writeInterfaceToken(IActivityManager.descriptor);
3753 if (dockedBounds != null) {
3754 data.writeInt(1);
3755 dockedBounds.writeToParcel(data, 0);
3756 } else {
3757 data.writeInt(0);
3758 }
3759 if (tempDockedTaskBounds != null) {
3760 data.writeInt(1);
3761 tempDockedTaskBounds.writeToParcel(data, 0);
3762 } else {
3763 data.writeInt(0);
3764 }
3765 if (tempDockedTaskInsetBounds != null) {
3766 data.writeInt(1);
3767 tempDockedTaskInsetBounds.writeToParcel(data, 0);
3768 } else {
3769 data.writeInt(0);
3770 }
3771 if (tempOtherTaskBounds != null) {
3772 data.writeInt(1);
3773 tempOtherTaskBounds.writeToParcel(data, 0);
3774 } else {
3775 data.writeInt(0);
3776 }
3777 if (tempOtherTaskInsetBounds != null) {
3778 data.writeInt(1);
3779 tempOtherTaskInsetBounds.writeToParcel(data, 0);
3780 } else {
3781 data.writeInt(0);
3782 }
3783 mRemote.transact(RESIZE_DOCKED_STACK_TRANSACTION, data, reply, 0);
3784 reply.readException();
3785 data.recycle();
3786 reply.recycle();
3787 }
3788 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003789 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3790 {
3791 Parcel data = Parcel.obtain();
3792 Parcel reply = Parcel.obtain();
3793 data.writeInterfaceToken(IActivityManager.descriptor);
3794 data.writeInt(taskId);
3795 data.writeInt(stackId);
3796 data.writeInt(position);
3797 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3798 reply.readException();
3799 data.recycle();
3800 reply.recycle();
3801 }
3802 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003803 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003804 {
3805 Parcel data = Parcel.obtain();
3806 Parcel reply = Parcel.obtain();
3807 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003808 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003809 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003810 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003811 data.recycle();
3812 reply.recycle();
3813 return list;
3814 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003815 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003816 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003817 {
3818 Parcel data = Parcel.obtain();
3819 Parcel reply = Parcel.obtain();
3820 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003821 data.writeInt(stackId);
3822 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003823 reply.readException();
3824 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003825 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003826 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003827 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003828 }
3829 data.recycle();
3830 reply.recycle();
3831 return info;
3832 }
3833 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003834 public boolean isInHomeStack(int taskId) throws RemoteException {
3835 Parcel data = Parcel.obtain();
3836 Parcel reply = Parcel.obtain();
3837 data.writeInterfaceToken(IActivityManager.descriptor);
3838 data.writeInt(taskId);
3839 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3840 reply.readException();
3841 boolean isInHomeStack = reply.readInt() > 0;
3842 data.recycle();
3843 reply.recycle();
3844 return isInHomeStack;
3845 }
3846 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003847 public void setFocusedStack(int stackId) throws RemoteException
3848 {
3849 Parcel data = Parcel.obtain();
3850 Parcel reply = Parcel.obtain();
3851 data.writeInterfaceToken(IActivityManager.descriptor);
3852 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003853 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003854 reply.readException();
3855 data.recycle();
3856 reply.recycle();
3857 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003858 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003859 public int getFocusedStackId() throws RemoteException {
3860 Parcel data = Parcel.obtain();
3861 Parcel reply = Parcel.obtain();
3862 data.writeInterfaceToken(IActivityManager.descriptor);
3863 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3864 reply.readException();
3865 int focusedStackId = reply.readInt();
3866 data.recycle();
3867 reply.recycle();
3868 return focusedStackId;
3869 }
3870 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003871 public void setFocusedTask(int taskId) throws RemoteException
3872 {
3873 Parcel data = Parcel.obtain();
3874 Parcel reply = Parcel.obtain();
3875 data.writeInterfaceToken(IActivityManager.descriptor);
3876 data.writeInt(taskId);
3877 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3878 reply.readException();
3879 data.recycle();
3880 reply.recycle();
3881 }
3882 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003883 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3884 {
3885 Parcel data = Parcel.obtain();
3886 Parcel reply = Parcel.obtain();
3887 data.writeInterfaceToken(IActivityManager.descriptor);
3888 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003889 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003890 reply.readException();
3891 data.recycle();
3892 reply.recycle();
3893 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003894 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3895 {
3896 Parcel data = Parcel.obtain();
3897 Parcel reply = Parcel.obtain();
3898 data.writeInterfaceToken(IActivityManager.descriptor);
3899 data.writeStrongBinder(token);
3900 data.writeInt(onlyRoot ? 1 : 0);
3901 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3902 reply.readException();
3903 int res = reply.readInt();
3904 data.recycle();
3905 reply.recycle();
3906 return res;
3907 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003908 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003909 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003910 Parcel data = Parcel.obtain();
3911 Parcel reply = Parcel.obtain();
3912 data.writeInterfaceToken(IActivityManager.descriptor);
3913 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3914 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003915 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003916 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003917 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3918 reply.readException();
3919 int res = reply.readInt();
3920 ContentProviderHolder cph = null;
3921 if (res != 0) {
3922 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3923 }
3924 data.recycle();
3925 reply.recycle();
3926 return cph;
3927 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003928 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3929 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003930 Parcel data = Parcel.obtain();
3931 Parcel reply = Parcel.obtain();
3932 data.writeInterfaceToken(IActivityManager.descriptor);
3933 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003934 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003935 data.writeStrongBinder(token);
3936 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3937 reply.readException();
3938 int res = reply.readInt();
3939 ContentProviderHolder cph = null;
3940 if (res != 0) {
3941 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3942 }
3943 data.recycle();
3944 reply.recycle();
3945 return cph;
3946 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003947 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003948 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003949 {
3950 Parcel data = Parcel.obtain();
3951 Parcel reply = Parcel.obtain();
3952 data.writeInterfaceToken(IActivityManager.descriptor);
3953 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3954 data.writeTypedList(providers);
3955 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3956 reply.readException();
3957 data.recycle();
3958 reply.recycle();
3959 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003960 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3961 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003962 Parcel data = Parcel.obtain();
3963 Parcel reply = Parcel.obtain();
3964 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003965 data.writeStrongBinder(connection);
3966 data.writeInt(stable);
3967 data.writeInt(unstable);
3968 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3969 reply.readException();
3970 boolean res = reply.readInt() != 0;
3971 data.recycle();
3972 reply.recycle();
3973 return res;
3974 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003975
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003976 public void unstableProviderDied(IBinder connection) throws RemoteException {
3977 Parcel data = Parcel.obtain();
3978 Parcel reply = Parcel.obtain();
3979 data.writeInterfaceToken(IActivityManager.descriptor);
3980 data.writeStrongBinder(connection);
3981 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3982 reply.readException();
3983 data.recycle();
3984 reply.recycle();
3985 }
3986
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003987 @Override
3988 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3989 Parcel data = Parcel.obtain();
3990 Parcel reply = Parcel.obtain();
3991 data.writeInterfaceToken(IActivityManager.descriptor);
3992 data.writeStrongBinder(connection);
3993 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3994 reply.readException();
3995 data.recycle();
3996 reply.recycle();
3997 }
3998
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003999 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
4000 Parcel data = Parcel.obtain();
4001 Parcel reply = Parcel.obtain();
4002 data.writeInterfaceToken(IActivityManager.descriptor);
4003 data.writeStrongBinder(connection);
4004 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004005 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4006 reply.readException();
4007 data.recycle();
4008 reply.recycle();
4009 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004010
4011 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
4012 Parcel data = Parcel.obtain();
4013 Parcel reply = Parcel.obtain();
4014 data.writeInterfaceToken(IActivityManager.descriptor);
4015 data.writeString(name);
4016 data.writeStrongBinder(token);
4017 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4018 reply.readException();
4019 data.recycle();
4020 reply.recycle();
4021 }
4022
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07004023 public PendingIntent getRunningServiceControlPanel(ComponentName service)
4024 throws RemoteException
4025 {
4026 Parcel data = Parcel.obtain();
4027 Parcel reply = Parcel.obtain();
4028 data.writeInterfaceToken(IActivityManager.descriptor);
4029 service.writeToParcel(data, 0);
4030 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
4031 reply.readException();
4032 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
4033 data.recycle();
4034 reply.recycle();
4035 return res;
4036 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004037
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004038 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07004039 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004040 {
4041 Parcel data = Parcel.obtain();
4042 Parcel reply = Parcel.obtain();
4043 data.writeInterfaceToken(IActivityManager.descriptor);
4044 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4045 service.writeToParcel(data, 0);
4046 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004047 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004048 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004049 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
4050 reply.readException();
4051 ComponentName res = ComponentName.readFromParcel(reply);
4052 data.recycle();
4053 reply.recycle();
4054 return res;
4055 }
4056 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004057 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004058 {
4059 Parcel data = Parcel.obtain();
4060 Parcel reply = Parcel.obtain();
4061 data.writeInterfaceToken(IActivityManager.descriptor);
4062 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4063 service.writeToParcel(data, 0);
4064 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004065 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004066 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
4067 reply.readException();
4068 int res = reply.readInt();
4069 reply.recycle();
4070 data.recycle();
4071 return res;
4072 }
4073 public boolean stopServiceToken(ComponentName className, IBinder token,
4074 int startId) throws RemoteException {
4075 Parcel data = Parcel.obtain();
4076 Parcel reply = Parcel.obtain();
4077 data.writeInterfaceToken(IActivityManager.descriptor);
4078 ComponentName.writeToParcel(className, data);
4079 data.writeStrongBinder(token);
4080 data.writeInt(startId);
4081 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
4082 reply.readException();
4083 boolean res = reply.readInt() != 0;
4084 data.recycle();
4085 reply.recycle();
4086 return res;
4087 }
4088 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004089 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004090 Parcel data = Parcel.obtain();
4091 Parcel reply = Parcel.obtain();
4092 data.writeInterfaceToken(IActivityManager.descriptor);
4093 ComponentName.writeToParcel(className, data);
4094 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004095 data.writeInt(id);
4096 if (notification != null) {
4097 data.writeInt(1);
4098 notification.writeToParcel(data, 0);
4099 } else {
4100 data.writeInt(0);
4101 }
4102 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004103 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
4104 reply.readException();
4105 data.recycle();
4106 reply.recycle();
4107 }
4108 public int bindService(IApplicationThread caller, IBinder token,
4109 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07004110 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004111 Parcel data = Parcel.obtain();
4112 Parcel reply = Parcel.obtain();
4113 data.writeInterfaceToken(IActivityManager.descriptor);
4114 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4115 data.writeStrongBinder(token);
4116 service.writeToParcel(data, 0);
4117 data.writeString(resolvedType);
4118 data.writeStrongBinder(connection.asBinder());
4119 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07004120 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08004121 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004122 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
4123 reply.readException();
4124 int res = reply.readInt();
4125 data.recycle();
4126 reply.recycle();
4127 return res;
4128 }
4129 public boolean unbindService(IServiceConnection connection) throws RemoteException
4130 {
4131 Parcel data = Parcel.obtain();
4132 Parcel reply = Parcel.obtain();
4133 data.writeInterfaceToken(IActivityManager.descriptor);
4134 data.writeStrongBinder(connection.asBinder());
4135 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
4136 reply.readException();
4137 boolean res = reply.readInt() != 0;
4138 data.recycle();
4139 reply.recycle();
4140 return res;
4141 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004142
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004143 public void publishService(IBinder token,
4144 Intent intent, IBinder service) throws RemoteException {
4145 Parcel data = Parcel.obtain();
4146 Parcel reply = Parcel.obtain();
4147 data.writeInterfaceToken(IActivityManager.descriptor);
4148 data.writeStrongBinder(token);
4149 intent.writeToParcel(data, 0);
4150 data.writeStrongBinder(service);
4151 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
4152 reply.readException();
4153 data.recycle();
4154 reply.recycle();
4155 }
4156
4157 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
4158 throws RemoteException {
4159 Parcel data = Parcel.obtain();
4160 Parcel reply = Parcel.obtain();
4161 data.writeInterfaceToken(IActivityManager.descriptor);
4162 data.writeStrongBinder(token);
4163 intent.writeToParcel(data, 0);
4164 data.writeInt(doRebind ? 1 : 0);
4165 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4166 reply.readException();
4167 data.recycle();
4168 reply.recycle();
4169 }
4170
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004171 public void serviceDoneExecuting(IBinder token, int type, int startId,
4172 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004173 Parcel data = Parcel.obtain();
4174 Parcel reply = Parcel.obtain();
4175 data.writeInterfaceToken(IActivityManager.descriptor);
4176 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004177 data.writeInt(type);
4178 data.writeInt(startId);
4179 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004180 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4181 reply.readException();
4182 data.recycle();
4183 reply.recycle();
4184 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004185
Svet Ganov99b60432015-06-27 13:15:22 -07004186 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4187 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004188 Parcel data = Parcel.obtain();
4189 Parcel reply = Parcel.obtain();
4190 data.writeInterfaceToken(IActivityManager.descriptor);
4191 service.writeToParcel(data, 0);
4192 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004193 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004194 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4195 reply.readException();
4196 IBinder binder = reply.readStrongBinder();
4197 reply.recycle();
4198 data.recycle();
4199 return binder;
4200 }
4201
Christopher Tate181fafa2009-05-14 11:12:14 -07004202 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4203 throws RemoteException {
4204 Parcel data = Parcel.obtain();
4205 Parcel reply = Parcel.obtain();
4206 data.writeInterfaceToken(IActivityManager.descriptor);
4207 app.writeToParcel(data, 0);
4208 data.writeInt(backupRestoreMode);
4209 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4210 reply.readException();
4211 boolean success = reply.readInt() != 0;
4212 reply.recycle();
4213 data.recycle();
4214 return success;
4215 }
4216
Christopher Tate346acb12012-10-15 19:20:25 -07004217 public void clearPendingBackup() throws RemoteException {
4218 Parcel data = Parcel.obtain();
4219 Parcel reply = Parcel.obtain();
4220 data.writeInterfaceToken(IActivityManager.descriptor);
4221 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4222 reply.recycle();
4223 data.recycle();
4224 }
4225
Christopher Tate181fafa2009-05-14 11:12:14 -07004226 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4227 Parcel data = Parcel.obtain();
4228 Parcel reply = Parcel.obtain();
4229 data.writeInterfaceToken(IActivityManager.descriptor);
4230 data.writeString(packageName);
4231 data.writeStrongBinder(agent);
4232 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4233 reply.recycle();
4234 data.recycle();
4235 }
4236
4237 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4238 Parcel data = Parcel.obtain();
4239 Parcel reply = Parcel.obtain();
4240 data.writeInterfaceToken(IActivityManager.descriptor);
4241 app.writeToParcel(data, 0);
4242 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4243 reply.readException();
4244 reply.recycle();
4245 data.recycle();
4246 }
4247
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004248 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004249 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004250 IUiAutomationConnection connection, int userId, String instructionSet)
4251 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004252 Parcel data = Parcel.obtain();
4253 Parcel reply = Parcel.obtain();
4254 data.writeInterfaceToken(IActivityManager.descriptor);
4255 ComponentName.writeToParcel(className, data);
4256 data.writeString(profileFile);
4257 data.writeInt(flags);
4258 data.writeBundle(arguments);
4259 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004260 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004261 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004262 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004263 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4264 reply.readException();
4265 boolean res = reply.readInt() != 0;
4266 reply.recycle();
4267 data.recycle();
4268 return res;
4269 }
4270
4271 public void finishInstrumentation(IApplicationThread target,
4272 int resultCode, Bundle results) throws RemoteException {
4273 Parcel data = Parcel.obtain();
4274 Parcel reply = Parcel.obtain();
4275 data.writeInterfaceToken(IActivityManager.descriptor);
4276 data.writeStrongBinder(target != null ? target.asBinder() : null);
4277 data.writeInt(resultCode);
4278 data.writeBundle(results);
4279 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4280 reply.readException();
4281 data.recycle();
4282 reply.recycle();
4283 }
4284 public Configuration getConfiguration() throws RemoteException
4285 {
4286 Parcel data = Parcel.obtain();
4287 Parcel reply = Parcel.obtain();
4288 data.writeInterfaceToken(IActivityManager.descriptor);
4289 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4290 reply.readException();
4291 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4292 reply.recycle();
4293 data.recycle();
4294 return res;
4295 }
4296 public void updateConfiguration(Configuration values) throws RemoteException
4297 {
4298 Parcel data = Parcel.obtain();
4299 Parcel reply = Parcel.obtain();
4300 data.writeInterfaceToken(IActivityManager.descriptor);
4301 values.writeToParcel(data, 0);
4302 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4303 reply.readException();
4304 data.recycle();
4305 reply.recycle();
4306 }
4307 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4308 throws RemoteException {
4309 Parcel data = Parcel.obtain();
4310 Parcel reply = Parcel.obtain();
4311 data.writeInterfaceToken(IActivityManager.descriptor);
4312 data.writeStrongBinder(token);
4313 data.writeInt(requestedOrientation);
4314 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4315 reply.readException();
4316 data.recycle();
4317 reply.recycle();
4318 }
4319 public int getRequestedOrientation(IBinder token) throws RemoteException {
4320 Parcel data = Parcel.obtain();
4321 Parcel reply = Parcel.obtain();
4322 data.writeInterfaceToken(IActivityManager.descriptor);
4323 data.writeStrongBinder(token);
4324 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4325 reply.readException();
4326 int res = reply.readInt();
4327 data.recycle();
4328 reply.recycle();
4329 return res;
4330 }
4331 public ComponentName getActivityClassForToken(IBinder token)
4332 throws RemoteException {
4333 Parcel data = Parcel.obtain();
4334 Parcel reply = Parcel.obtain();
4335 data.writeInterfaceToken(IActivityManager.descriptor);
4336 data.writeStrongBinder(token);
4337 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4338 reply.readException();
4339 ComponentName res = ComponentName.readFromParcel(reply);
4340 data.recycle();
4341 reply.recycle();
4342 return res;
4343 }
4344 public String getPackageForToken(IBinder token) throws RemoteException
4345 {
4346 Parcel data = Parcel.obtain();
4347 Parcel reply = Parcel.obtain();
4348 data.writeInterfaceToken(IActivityManager.descriptor);
4349 data.writeStrongBinder(token);
4350 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4351 reply.readException();
4352 String res = reply.readString();
4353 data.recycle();
4354 reply.recycle();
4355 return res;
4356 }
4357 public IIntentSender getIntentSender(int type,
4358 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004359 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004360 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004361 Parcel data = Parcel.obtain();
4362 Parcel reply = Parcel.obtain();
4363 data.writeInterfaceToken(IActivityManager.descriptor);
4364 data.writeInt(type);
4365 data.writeString(packageName);
4366 data.writeStrongBinder(token);
4367 data.writeString(resultWho);
4368 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004369 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004370 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004371 data.writeTypedArray(intents, 0);
4372 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004373 } else {
4374 data.writeInt(0);
4375 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004376 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004377 if (options != null) {
4378 data.writeInt(1);
4379 options.writeToParcel(data, 0);
4380 } else {
4381 data.writeInt(0);
4382 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004383 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004384 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4385 reply.readException();
4386 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004387 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004388 data.recycle();
4389 reply.recycle();
4390 return res;
4391 }
4392 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4393 Parcel data = Parcel.obtain();
4394 Parcel reply = Parcel.obtain();
4395 data.writeInterfaceToken(IActivityManager.descriptor);
4396 data.writeStrongBinder(sender.asBinder());
4397 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4398 reply.readException();
4399 data.recycle();
4400 reply.recycle();
4401 }
4402 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4403 Parcel data = Parcel.obtain();
4404 Parcel reply = Parcel.obtain();
4405 data.writeInterfaceToken(IActivityManager.descriptor);
4406 data.writeStrongBinder(sender.asBinder());
4407 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4408 reply.readException();
4409 String res = reply.readString();
4410 data.recycle();
4411 reply.recycle();
4412 return res;
4413 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004414 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4415 Parcel data = Parcel.obtain();
4416 Parcel reply = Parcel.obtain();
4417 data.writeInterfaceToken(IActivityManager.descriptor);
4418 data.writeStrongBinder(sender.asBinder());
4419 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4420 reply.readException();
4421 int res = reply.readInt();
4422 data.recycle();
4423 reply.recycle();
4424 return res;
4425 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004426 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4427 boolean requireFull, String name, String callerPackage) throws RemoteException {
4428 Parcel data = Parcel.obtain();
4429 Parcel reply = Parcel.obtain();
4430 data.writeInterfaceToken(IActivityManager.descriptor);
4431 data.writeInt(callingPid);
4432 data.writeInt(callingUid);
4433 data.writeInt(userId);
4434 data.writeInt(allowAll ? 1 : 0);
4435 data.writeInt(requireFull ? 1 : 0);
4436 data.writeString(name);
4437 data.writeString(callerPackage);
4438 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4439 reply.readException();
4440 int res = reply.readInt();
4441 data.recycle();
4442 reply.recycle();
4443 return res;
4444 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004445 public void setProcessLimit(int max) throws RemoteException
4446 {
4447 Parcel data = Parcel.obtain();
4448 Parcel reply = Parcel.obtain();
4449 data.writeInterfaceToken(IActivityManager.descriptor);
4450 data.writeInt(max);
4451 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4452 reply.readException();
4453 data.recycle();
4454 reply.recycle();
4455 }
4456 public int getProcessLimit() throws RemoteException
4457 {
4458 Parcel data = Parcel.obtain();
4459 Parcel reply = Parcel.obtain();
4460 data.writeInterfaceToken(IActivityManager.descriptor);
4461 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4462 reply.readException();
4463 int res = reply.readInt();
4464 data.recycle();
4465 reply.recycle();
4466 return res;
4467 }
4468 public void setProcessForeground(IBinder token, int pid,
4469 boolean isForeground) throws RemoteException {
4470 Parcel data = Parcel.obtain();
4471 Parcel reply = Parcel.obtain();
4472 data.writeInterfaceToken(IActivityManager.descriptor);
4473 data.writeStrongBinder(token);
4474 data.writeInt(pid);
4475 data.writeInt(isForeground ? 1 : 0);
4476 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4477 reply.readException();
4478 data.recycle();
4479 reply.recycle();
4480 }
4481 public int checkPermission(String permission, int pid, int uid)
4482 throws RemoteException {
4483 Parcel data = Parcel.obtain();
4484 Parcel reply = Parcel.obtain();
4485 data.writeInterfaceToken(IActivityManager.descriptor);
4486 data.writeString(permission);
4487 data.writeInt(pid);
4488 data.writeInt(uid);
4489 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4490 reply.readException();
4491 int res = reply.readInt();
4492 data.recycle();
4493 reply.recycle();
4494 return res;
4495 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004496 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4497 throws RemoteException {
4498 Parcel data = Parcel.obtain();
4499 Parcel reply = Parcel.obtain();
4500 data.writeInterfaceToken(IActivityManager.descriptor);
4501 data.writeString(permission);
4502 data.writeInt(pid);
4503 data.writeInt(uid);
4504 data.writeStrongBinder(callerToken);
4505 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4506 reply.readException();
4507 int res = reply.readInt();
4508 data.recycle();
4509 reply.recycle();
4510 return res;
4511 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004512 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004513 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004514 Parcel data = Parcel.obtain();
4515 Parcel reply = Parcel.obtain();
4516 data.writeInterfaceToken(IActivityManager.descriptor);
4517 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004518 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004519 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004520 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4521 reply.readException();
4522 boolean res = reply.readInt() != 0;
4523 data.recycle();
4524 reply.recycle();
4525 return res;
4526 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004527 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4528 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004529 Parcel data = Parcel.obtain();
4530 Parcel reply = Parcel.obtain();
4531 data.writeInterfaceToken(IActivityManager.descriptor);
4532 uri.writeToParcel(data, 0);
4533 data.writeInt(pid);
4534 data.writeInt(uid);
4535 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004536 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004537 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004538 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4539 reply.readException();
4540 int res = reply.readInt();
4541 data.recycle();
4542 reply.recycle();
4543 return res;
4544 }
4545 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004546 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004547 Parcel data = Parcel.obtain();
4548 Parcel reply = Parcel.obtain();
4549 data.writeInterfaceToken(IActivityManager.descriptor);
4550 data.writeStrongBinder(caller.asBinder());
4551 data.writeString(targetPkg);
4552 uri.writeToParcel(data, 0);
4553 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004554 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004555 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4556 reply.readException();
4557 data.recycle();
4558 reply.recycle();
4559 }
4560 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004561 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004562 Parcel data = Parcel.obtain();
4563 Parcel reply = Parcel.obtain();
4564 data.writeInterfaceToken(IActivityManager.descriptor);
4565 data.writeStrongBinder(caller.asBinder());
4566 uri.writeToParcel(data, 0);
4567 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004568 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004569 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4570 reply.readException();
4571 data.recycle();
4572 reply.recycle();
4573 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004574
4575 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004576 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4577 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004578 Parcel data = Parcel.obtain();
4579 Parcel reply = Parcel.obtain();
4580 data.writeInterfaceToken(IActivityManager.descriptor);
4581 uri.writeToParcel(data, 0);
4582 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004583 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004584 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4585 reply.readException();
4586 data.recycle();
4587 reply.recycle();
4588 }
4589
4590 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004591 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4592 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004593 Parcel data = Parcel.obtain();
4594 Parcel reply = Parcel.obtain();
4595 data.writeInterfaceToken(IActivityManager.descriptor);
4596 uri.writeToParcel(data, 0);
4597 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004598 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004599 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4600 reply.readException();
4601 data.recycle();
4602 reply.recycle();
4603 }
4604
4605 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004606 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4607 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004608 Parcel data = Parcel.obtain();
4609 Parcel reply = Parcel.obtain();
4610 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004611 data.writeString(packageName);
4612 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004613 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4614 reply.readException();
4615 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4616 reply);
4617 data.recycle();
4618 reply.recycle();
4619 return perms;
4620 }
4621
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004622 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4623 throws RemoteException {
4624 Parcel data = Parcel.obtain();
4625 Parcel reply = Parcel.obtain();
4626 data.writeInterfaceToken(IActivityManager.descriptor);
4627 data.writeStrongBinder(who.asBinder());
4628 data.writeInt(waiting ? 1 : 0);
4629 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4630 reply.readException();
4631 data.recycle();
4632 reply.recycle();
4633 }
4634 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4635 Parcel data = Parcel.obtain();
4636 Parcel reply = Parcel.obtain();
4637 data.writeInterfaceToken(IActivityManager.descriptor);
4638 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4639 reply.readException();
4640 outInfo.readFromParcel(reply);
4641 data.recycle();
4642 reply.recycle();
4643 }
4644 public void unhandledBack() throws RemoteException
4645 {
4646 Parcel data = Parcel.obtain();
4647 Parcel reply = Parcel.obtain();
4648 data.writeInterfaceToken(IActivityManager.descriptor);
4649 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4650 reply.readException();
4651 data.recycle();
4652 reply.recycle();
4653 }
4654 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4655 {
4656 Parcel data = Parcel.obtain();
4657 Parcel reply = Parcel.obtain();
4658 data.writeInterfaceToken(IActivityManager.descriptor);
4659 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4660 reply.readException();
4661 ParcelFileDescriptor pfd = null;
4662 if (reply.readInt() != 0) {
4663 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4664 }
4665 data.recycle();
4666 reply.recycle();
4667 return pfd;
4668 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004669 public void setLockScreenShown(boolean shown) throws RemoteException
4670 {
4671 Parcel data = Parcel.obtain();
4672 Parcel reply = Parcel.obtain();
4673 data.writeInterfaceToken(IActivityManager.descriptor);
4674 data.writeInt(shown ? 1 : 0);
4675 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4676 reply.readException();
4677 data.recycle();
4678 reply.recycle();
4679 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004680 public void setDebugApp(
4681 String packageName, boolean waitForDebugger, boolean persistent)
4682 throws RemoteException
4683 {
4684 Parcel data = Parcel.obtain();
4685 Parcel reply = Parcel.obtain();
4686 data.writeInterfaceToken(IActivityManager.descriptor);
4687 data.writeString(packageName);
4688 data.writeInt(waitForDebugger ? 1 : 0);
4689 data.writeInt(persistent ? 1 : 0);
4690 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4691 reply.readException();
4692 data.recycle();
4693 reply.recycle();
4694 }
4695 public void setAlwaysFinish(boolean enabled) throws RemoteException
4696 {
4697 Parcel data = Parcel.obtain();
4698 Parcel reply = Parcel.obtain();
4699 data.writeInterfaceToken(IActivityManager.descriptor);
4700 data.writeInt(enabled ? 1 : 0);
4701 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4702 reply.readException();
4703 data.recycle();
4704 reply.recycle();
4705 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004706 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004707 {
4708 Parcel data = Parcel.obtain();
4709 Parcel reply = Parcel.obtain();
4710 data.writeInterfaceToken(IActivityManager.descriptor);
4711 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004712 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004713 reply.readException();
4714 data.recycle();
4715 reply.recycle();
4716 }
4717 public void enterSafeMode() throws RemoteException {
4718 Parcel data = Parcel.obtain();
4719 data.writeInterfaceToken(IActivityManager.descriptor);
4720 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4721 data.recycle();
4722 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004723 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004724 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004725 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004726 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004727 data.writeStrongBinder(sender.asBinder());
4728 data.writeInt(sourceUid);
4729 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004730 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004731 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4732 data.recycle();
4733 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004734 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4735 throws RemoteException {
4736 Parcel data = Parcel.obtain();
4737 data.writeInterfaceToken(IActivityManager.descriptor);
4738 data.writeStrongBinder(sender.asBinder());
4739 data.writeInt(sourceUid);
4740 data.writeString(tag);
4741 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4742 data.recycle();
4743 }
4744 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4745 throws RemoteException {
4746 Parcel data = Parcel.obtain();
4747 data.writeInterfaceToken(IActivityManager.descriptor);
4748 data.writeStrongBinder(sender.asBinder());
4749 data.writeInt(sourceUid);
4750 data.writeString(tag);
4751 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4752 data.recycle();
4753 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004754 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004755 Parcel data = Parcel.obtain();
4756 Parcel reply = Parcel.obtain();
4757 data.writeInterfaceToken(IActivityManager.descriptor);
4758 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004759 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004760 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004761 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004762 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004763 boolean res = reply.readInt() != 0;
4764 data.recycle();
4765 reply.recycle();
4766 return res;
4767 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004768 @Override
4769 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4770 Parcel data = Parcel.obtain();
4771 Parcel reply = Parcel.obtain();
4772 data.writeInterfaceToken(IActivityManager.descriptor);
4773 data.writeString(reason);
4774 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4775 boolean res = reply.readInt() != 0;
4776 data.recycle();
4777 reply.recycle();
4778 return res;
4779 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004780 public boolean testIsSystemReady()
4781 {
4782 /* this base class version is never called */
4783 return true;
4784 }
Dan Egnor60d87622009-12-16 16:32:58 -08004785 public void handleApplicationCrash(IBinder app,
4786 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4787 {
4788 Parcel data = Parcel.obtain();
4789 Parcel reply = Parcel.obtain();
4790 data.writeInterfaceToken(IActivityManager.descriptor);
4791 data.writeStrongBinder(app);
4792 crashInfo.writeToParcel(data, 0);
4793 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4794 reply.readException();
4795 reply.recycle();
4796 data.recycle();
4797 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004798
Dianne Hackborn52322712014-08-26 22:47:26 -07004799 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004800 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004801 {
4802 Parcel data = Parcel.obtain();
4803 Parcel reply = Parcel.obtain();
4804 data.writeInterfaceToken(IActivityManager.descriptor);
4805 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004806 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004807 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004808 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004809 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004810 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004811 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004812 reply.recycle();
4813 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004814 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004815 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004816
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004817 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004818 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004819 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004820 {
4821 Parcel data = Parcel.obtain();
4822 Parcel reply = Parcel.obtain();
4823 data.writeInterfaceToken(IActivityManager.descriptor);
4824 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004825 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004826 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004827 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4828 reply.readException();
4829 reply.recycle();
4830 data.recycle();
4831 }
4832
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004833 public void signalPersistentProcesses(int sig) throws RemoteException {
4834 Parcel data = Parcel.obtain();
4835 Parcel reply = Parcel.obtain();
4836 data.writeInterfaceToken(IActivityManager.descriptor);
4837 data.writeInt(sig);
4838 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4839 reply.readException();
4840 data.recycle();
4841 reply.recycle();
4842 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004843
Dianne Hackborn1676c852012-09-10 14:52:30 -07004844 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004845 Parcel data = Parcel.obtain();
4846 Parcel reply = Parcel.obtain();
4847 data.writeInterfaceToken(IActivityManager.descriptor);
4848 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004849 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004850 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4851 reply.readException();
4852 data.recycle();
4853 reply.recycle();
4854 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004855
4856 public void killAllBackgroundProcesses() throws RemoteException {
4857 Parcel data = Parcel.obtain();
4858 Parcel reply = Parcel.obtain();
4859 data.writeInterfaceToken(IActivityManager.descriptor);
4860 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4861 reply.readException();
4862 data.recycle();
4863 reply.recycle();
4864 }
4865
Gustav Sennton6258dcd2015-10-30 19:25:37 +00004866 public void killPackageDependents(String packageName, int userId) throws RemoteException {
4867 Parcel data = Parcel.obtain();
4868 Parcel reply = Parcel.obtain();
4869 data.writeInterfaceToken(IActivityManager.descriptor);
4870 data.writeString(packageName);
4871 data.writeInt(userId);
4872 mRemote.transact(KILL_PACKAGE_DEPENDENTS_TRANSACTION, data, reply, 0);
4873 reply.readException();
4874 data.recycle();
4875 reply.recycle();
4876 }
4877
Dianne Hackborn1676c852012-09-10 14:52:30 -07004878 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004879 Parcel data = Parcel.obtain();
4880 Parcel reply = Parcel.obtain();
4881 data.writeInterfaceToken(IActivityManager.descriptor);
4882 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004883 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004884 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004885 reply.readException();
4886 data.recycle();
4887 reply.recycle();
4888 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004889
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004890 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4891 throws RemoteException
4892 {
4893 Parcel data = Parcel.obtain();
4894 Parcel reply = Parcel.obtain();
4895 data.writeInterfaceToken(IActivityManager.descriptor);
4896 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4897 reply.readException();
4898 outInfo.readFromParcel(reply);
4899 reply.recycle();
4900 data.recycle();
4901 }
4902
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004903 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4904 {
4905 Parcel data = Parcel.obtain();
4906 Parcel reply = Parcel.obtain();
4907 data.writeInterfaceToken(IActivityManager.descriptor);
4908 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4909 reply.readException();
4910 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4911 reply.recycle();
4912 data.recycle();
4913 return res;
4914 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004915
Dianne Hackborn1676c852012-09-10 14:52:30 -07004916 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004917 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004918 {
4919 Parcel data = Parcel.obtain();
4920 Parcel reply = Parcel.obtain();
4921 data.writeInterfaceToken(IActivityManager.descriptor);
4922 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004923 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004924 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004925 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004926 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004927 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004928 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004929 } else {
4930 data.writeInt(0);
4931 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004932 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4933 reply.readException();
4934 boolean res = reply.readInt() != 0;
4935 reply.recycle();
4936 data.recycle();
4937 return res;
4938 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004939
Dianne Hackborn55280a92009-05-07 15:53:46 -07004940 public boolean shutdown(int timeout) throws RemoteException
4941 {
4942 Parcel data = Parcel.obtain();
4943 Parcel reply = Parcel.obtain();
4944 data.writeInterfaceToken(IActivityManager.descriptor);
4945 data.writeInt(timeout);
4946 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4947 reply.readException();
4948 boolean res = reply.readInt() != 0;
4949 reply.recycle();
4950 data.recycle();
4951 return res;
4952 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004953
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004954 public void stopAppSwitches() throws RemoteException {
4955 Parcel data = Parcel.obtain();
4956 Parcel reply = Parcel.obtain();
4957 data.writeInterfaceToken(IActivityManager.descriptor);
4958 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4959 reply.readException();
4960 reply.recycle();
4961 data.recycle();
4962 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004963
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004964 public void resumeAppSwitches() throws RemoteException {
4965 Parcel data = Parcel.obtain();
4966 Parcel reply = Parcel.obtain();
4967 data.writeInterfaceToken(IActivityManager.descriptor);
4968 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4969 reply.readException();
4970 reply.recycle();
4971 data.recycle();
4972 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004973
4974 public void addPackageDependency(String packageName) throws RemoteException {
4975 Parcel data = Parcel.obtain();
4976 Parcel reply = Parcel.obtain();
4977 data.writeInterfaceToken(IActivityManager.descriptor);
4978 data.writeString(packageName);
4979 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4980 reply.readException();
4981 data.recycle();
4982 reply.recycle();
4983 }
4984
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004985 public void killApplicationWithAppId(String pkg, int appid, String reason)
4986 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004987 Parcel data = Parcel.obtain();
4988 Parcel reply = Parcel.obtain();
4989 data.writeInterfaceToken(IActivityManager.descriptor);
4990 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004991 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004992 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004993 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004994 reply.readException();
4995 data.recycle();
4996 reply.recycle();
4997 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004998
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004999 public void closeSystemDialogs(String reason) throws RemoteException {
5000 Parcel data = Parcel.obtain();
5001 Parcel reply = Parcel.obtain();
5002 data.writeInterfaceToken(IActivityManager.descriptor);
5003 data.writeString(reason);
5004 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
5005 reply.readException();
5006 data.recycle();
5007 reply.recycle();
5008 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005009
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005010 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005011 throws RemoteException {
5012 Parcel data = Parcel.obtain();
5013 Parcel reply = Parcel.obtain();
5014 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005015 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005016 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
5017 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005018 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005019 data.recycle();
5020 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005021 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005022 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07005023
5024 public void killApplicationProcess(String processName, int uid) throws RemoteException {
5025 Parcel data = Parcel.obtain();
5026 Parcel reply = Parcel.obtain();
5027 data.writeInterfaceToken(IActivityManager.descriptor);
5028 data.writeString(processName);
5029 data.writeInt(uid);
5030 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
5031 reply.readException();
5032 data.recycle();
5033 reply.recycle();
5034 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005035
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07005036 public void overridePendingTransition(IBinder token, String packageName,
5037 int enterAnim, int exitAnim) throws RemoteException {
5038 Parcel data = Parcel.obtain();
5039 Parcel reply = Parcel.obtain();
5040 data.writeInterfaceToken(IActivityManager.descriptor);
5041 data.writeStrongBinder(token);
5042 data.writeString(packageName);
5043 data.writeInt(enterAnim);
5044 data.writeInt(exitAnim);
5045 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
5046 reply.readException();
5047 data.recycle();
5048 reply.recycle();
5049 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005050
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08005051 public boolean isUserAMonkey() throws RemoteException {
5052 Parcel data = Parcel.obtain();
5053 Parcel reply = Parcel.obtain();
5054 data.writeInterfaceToken(IActivityManager.descriptor);
5055 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
5056 reply.readException();
5057 boolean res = reply.readInt() != 0;
5058 data.recycle();
5059 reply.recycle();
5060 return res;
5061 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07005062
5063 public void setUserIsMonkey(boolean monkey) throws RemoteException {
5064 Parcel data = Parcel.obtain();
5065 Parcel reply = Parcel.obtain();
5066 data.writeInterfaceToken(IActivityManager.descriptor);
5067 data.writeInt(monkey ? 1 : 0);
5068 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
5069 reply.readException();
5070 data.recycle();
5071 reply.recycle();
5072 }
5073
Dianne Hackborn860755f2010-06-03 18:47:52 -07005074 public void finishHeavyWeightApp() throws RemoteException {
5075 Parcel data = Parcel.obtain();
5076 Parcel reply = Parcel.obtain();
5077 data.writeInterfaceToken(IActivityManager.descriptor);
5078 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
5079 reply.readException();
5080 data.recycle();
5081 reply.recycle();
5082 }
Craig Mautner4addfc52013-06-25 08:05:45 -07005083
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005084 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07005085 throws RemoteException {
5086 Parcel data = Parcel.obtain();
5087 Parcel reply = Parcel.obtain();
5088 data.writeInterfaceToken(IActivityManager.descriptor);
5089 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07005090 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
5091 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005092 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005093 data.recycle();
5094 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005095 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005096 }
5097
Craig Mautner233ceee2014-05-09 17:05:11 -07005098 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07005099 throws RemoteException {
5100 Parcel data = Parcel.obtain();
5101 Parcel reply = Parcel.obtain();
5102 data.writeInterfaceToken(IActivityManager.descriptor);
5103 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07005104 if (options == null) {
5105 data.writeInt(0);
5106 } else {
5107 data.writeInt(1);
5108 data.writeBundle(options.toBundle());
5109 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07005110 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07005111 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005112 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07005113 data.recycle();
5114 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005115 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07005116 }
5117
Craig Mautner233ceee2014-05-09 17:05:11 -07005118 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
5119 Parcel data = Parcel.obtain();
5120 Parcel reply = Parcel.obtain();
5121 data.writeInterfaceToken(IActivityManager.descriptor);
5122 data.writeStrongBinder(token);
5123 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
5124 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08005125 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07005126 data.recycle();
5127 reply.recycle();
5128 return options;
5129 }
5130
Daniel Sandler69a48172010-06-23 16:29:36 -04005131 public void setImmersive(IBinder token, boolean immersive)
5132 throws RemoteException {
5133 Parcel data = Parcel.obtain();
5134 Parcel reply = Parcel.obtain();
5135 data.writeInterfaceToken(IActivityManager.descriptor);
5136 data.writeStrongBinder(token);
5137 data.writeInt(immersive ? 1 : 0);
5138 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
5139 reply.readException();
5140 data.recycle();
5141 reply.recycle();
5142 }
5143
5144 public boolean isImmersive(IBinder token)
5145 throws RemoteException {
5146 Parcel data = Parcel.obtain();
5147 Parcel reply = Parcel.obtain();
5148 data.writeInterfaceToken(IActivityManager.descriptor);
5149 data.writeStrongBinder(token);
5150 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005151 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005152 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005153 data.recycle();
5154 reply.recycle();
5155 return res;
5156 }
5157
Craig Mautnerd61dc202014-07-07 11:09:11 -07005158 public boolean isTopOfTask(IBinder token) throws RemoteException {
5159 Parcel data = Parcel.obtain();
5160 Parcel reply = Parcel.obtain();
5161 data.writeInterfaceToken(IActivityManager.descriptor);
5162 data.writeStrongBinder(token);
5163 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
5164 reply.readException();
5165 boolean res = reply.readInt() == 1;
5166 data.recycle();
5167 reply.recycle();
5168 return res;
5169 }
5170
Daniel Sandler69a48172010-06-23 16:29:36 -04005171 public boolean isTopActivityImmersive()
5172 throws RemoteException {
5173 Parcel data = Parcel.obtain();
5174 Parcel reply = Parcel.obtain();
5175 data.writeInterfaceToken(IActivityManager.descriptor);
5176 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005177 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005178 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005179 data.recycle();
5180 reply.recycle();
5181 return res;
5182 }
5183
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005184 public void crashApplication(int uid, int initialPid, String packageName,
5185 String message) throws RemoteException {
5186 Parcel data = Parcel.obtain();
5187 Parcel reply = Parcel.obtain();
5188 data.writeInterfaceToken(IActivityManager.descriptor);
5189 data.writeInt(uid);
5190 data.writeInt(initialPid);
5191 data.writeString(packageName);
5192 data.writeString(message);
5193 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5194 reply.readException();
5195 data.recycle();
5196 reply.recycle();
5197 }
Andy McFadden824c5102010-07-09 16:26:57 -07005198
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005199 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005200 Parcel data = Parcel.obtain();
5201 Parcel reply = Parcel.obtain();
5202 data.writeInterfaceToken(IActivityManager.descriptor);
5203 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005204 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005205 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5206 reply.readException();
5207 String res = reply.readString();
5208 data.recycle();
5209 reply.recycle();
5210 return res;
5211 }
5212
Dianne Hackborn7e269642010-08-25 19:50:20 -07005213 public IBinder newUriPermissionOwner(String name)
5214 throws RemoteException {
5215 Parcel data = Parcel.obtain();
5216 Parcel reply = Parcel.obtain();
5217 data.writeInterfaceToken(IActivityManager.descriptor);
5218 data.writeString(name);
5219 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5220 reply.readException();
5221 IBinder res = reply.readStrongBinder();
5222 data.recycle();
5223 reply.recycle();
5224 return res;
5225 }
5226
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08005227 public IBinder getUriPermissionOwnerForActivity(IBinder activityToken) throws RemoteException {
5228 Parcel data = Parcel.obtain();
5229 Parcel reply = Parcel.obtain();
5230 data.writeInterfaceToken(IActivityManager.descriptor);
5231 data.writeStrongBinder(activityToken);
5232 mRemote.transact(GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
5233 reply.readException();
5234 IBinder res = reply.readStrongBinder();
5235 data.recycle();
5236 reply.recycle();
5237 return res;
5238 }
5239
Dianne Hackborn7e269642010-08-25 19:50:20 -07005240 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005241 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005242 Parcel data = Parcel.obtain();
5243 Parcel reply = Parcel.obtain();
5244 data.writeInterfaceToken(IActivityManager.descriptor);
5245 data.writeStrongBinder(owner);
5246 data.writeInt(fromUid);
5247 data.writeString(targetPkg);
5248 uri.writeToParcel(data, 0);
5249 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005250 data.writeInt(sourceUserId);
5251 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005252 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5253 reply.readException();
5254 data.recycle();
5255 reply.recycle();
5256 }
5257
5258 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005259 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005260 Parcel data = Parcel.obtain();
5261 Parcel reply = Parcel.obtain();
5262 data.writeInterfaceToken(IActivityManager.descriptor);
5263 data.writeStrongBinder(owner);
5264 if (uri != null) {
5265 data.writeInt(1);
5266 uri.writeToParcel(data, 0);
5267 } else {
5268 data.writeInt(0);
5269 }
5270 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005271 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005272 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5273 reply.readException();
5274 data.recycle();
5275 reply.recycle();
5276 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005277
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005278 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005279 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005280 Parcel data = Parcel.obtain();
5281 Parcel reply = Parcel.obtain();
5282 data.writeInterfaceToken(IActivityManager.descriptor);
5283 data.writeInt(callingUid);
5284 data.writeString(targetPkg);
5285 uri.writeToParcel(data, 0);
5286 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005287 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005288 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5289 reply.readException();
5290 int res = reply.readInt();
5291 data.recycle();
5292 reply.recycle();
5293 return res;
5294 }
5295
Dianne Hackborn1676c852012-09-10 14:52:30 -07005296 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005297 String path, ParcelFileDescriptor fd) throws RemoteException {
5298 Parcel data = Parcel.obtain();
5299 Parcel reply = Parcel.obtain();
5300 data.writeInterfaceToken(IActivityManager.descriptor);
5301 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005302 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005303 data.writeInt(managed ? 1 : 0);
5304 data.writeString(path);
5305 if (fd != null) {
5306 data.writeInt(1);
5307 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5308 } else {
5309 data.writeInt(0);
5310 }
5311 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5312 reply.readException();
5313 boolean res = reply.readInt() != 0;
5314 reply.recycle();
5315 data.recycle();
5316 return res;
5317 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005318
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005319 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005320 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005321 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005322 Parcel data = Parcel.obtain();
5323 Parcel reply = Parcel.obtain();
5324 data.writeInterfaceToken(IActivityManager.descriptor);
5325 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005326 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005327 data.writeTypedArray(intents, 0);
5328 data.writeStringArray(resolvedTypes);
5329 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005330 if (options != null) {
5331 data.writeInt(1);
5332 options.writeToParcel(data, 0);
5333 } else {
5334 data.writeInt(0);
5335 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005336 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005337 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5338 reply.readException();
5339 int result = reply.readInt();
5340 reply.recycle();
5341 data.recycle();
5342 return result;
5343 }
5344
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005345 public int getFrontActivityScreenCompatMode() throws RemoteException {
5346 Parcel data = Parcel.obtain();
5347 Parcel reply = Parcel.obtain();
5348 data.writeInterfaceToken(IActivityManager.descriptor);
5349 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5350 reply.readException();
5351 int mode = reply.readInt();
5352 reply.recycle();
5353 data.recycle();
5354 return mode;
5355 }
5356
5357 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5358 Parcel data = Parcel.obtain();
5359 Parcel reply = Parcel.obtain();
5360 data.writeInterfaceToken(IActivityManager.descriptor);
5361 data.writeInt(mode);
5362 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5363 reply.readException();
5364 reply.recycle();
5365 data.recycle();
5366 }
5367
5368 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5369 Parcel data = Parcel.obtain();
5370 Parcel reply = Parcel.obtain();
5371 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005372 data.writeString(packageName);
5373 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005374 reply.readException();
5375 int mode = reply.readInt();
5376 reply.recycle();
5377 data.recycle();
5378 return mode;
5379 }
5380
5381 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005382 throws RemoteException {
5383 Parcel data = Parcel.obtain();
5384 Parcel reply = Parcel.obtain();
5385 data.writeInterfaceToken(IActivityManager.descriptor);
5386 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005387 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005388 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5389 reply.readException();
5390 reply.recycle();
5391 data.recycle();
5392 }
5393
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005394 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5395 Parcel data = Parcel.obtain();
5396 Parcel reply = Parcel.obtain();
5397 data.writeInterfaceToken(IActivityManager.descriptor);
5398 data.writeString(packageName);
5399 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5400 reply.readException();
5401 boolean ask = reply.readInt() != 0;
5402 reply.recycle();
5403 data.recycle();
5404 return ask;
5405 }
5406
5407 public void setPackageAskScreenCompat(String packageName, boolean ask)
5408 throws RemoteException {
5409 Parcel data = Parcel.obtain();
5410 Parcel reply = Parcel.obtain();
5411 data.writeInterfaceToken(IActivityManager.descriptor);
5412 data.writeString(packageName);
5413 data.writeInt(ask ? 1 : 0);
5414 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5415 reply.readException();
5416 reply.recycle();
5417 data.recycle();
5418 }
5419
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005420 public boolean switchUser(int userid) throws RemoteException {
5421 Parcel data = Parcel.obtain();
5422 Parcel reply = Parcel.obtain();
5423 data.writeInterfaceToken(IActivityManager.descriptor);
5424 data.writeInt(userid);
5425 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5426 reply.readException();
5427 boolean result = reply.readInt() != 0;
5428 reply.recycle();
5429 data.recycle();
5430 return result;
5431 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005432
Kenny Guy08488bf2014-02-21 17:40:37 +00005433 public boolean startUserInBackground(int userid) throws RemoteException {
5434 Parcel data = Parcel.obtain();
5435 Parcel reply = Parcel.obtain();
5436 data.writeInterfaceToken(IActivityManager.descriptor);
5437 data.writeInt(userid);
5438 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5439 reply.readException();
5440 boolean result = reply.readInt() != 0;
5441 reply.recycle();
5442 data.recycle();
5443 return result;
5444 }
5445
Jeff Sharkeyba512352015-11-12 20:17:45 -08005446 public boolean unlockUser(int userId, byte[] token) throws RemoteException {
5447 Parcel data = Parcel.obtain();
5448 Parcel reply = Parcel.obtain();
5449 data.writeInterfaceToken(IActivityManager.descriptor);
5450 data.writeInt(userId);
5451 data.writeByteArray(token);
5452 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5453 reply.readException();
5454 boolean result = reply.readInt() != 0;
5455 reply.recycle();
5456 data.recycle();
5457 return result;
5458 }
5459
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005460 public int stopUser(int userid, boolean force, IStopUserCallback callback)
5461 throws RemoteException {
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005462 Parcel data = Parcel.obtain();
5463 Parcel reply = Parcel.obtain();
5464 data.writeInterfaceToken(IActivityManager.descriptor);
5465 data.writeInt(userid);
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005466 data.writeInt(force ? 1 : 0);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005467 data.writeStrongInterface(callback);
5468 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5469 reply.readException();
5470 int result = reply.readInt();
5471 reply.recycle();
5472 data.recycle();
5473 return result;
5474 }
5475
Amith Yamasani52f1d752012-03-28 18:19:29 -07005476 public UserInfo getCurrentUser() throws RemoteException {
5477 Parcel data = Parcel.obtain();
5478 Parcel reply = Parcel.obtain();
5479 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005480 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005481 reply.readException();
5482 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5483 reply.recycle();
5484 data.recycle();
5485 return userInfo;
5486 }
5487
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005488 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005489 Parcel data = Parcel.obtain();
5490 Parcel reply = Parcel.obtain();
5491 data.writeInterfaceToken(IActivityManager.descriptor);
5492 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005493 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005494 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5495 reply.readException();
5496 boolean result = reply.readInt() != 0;
5497 reply.recycle();
5498 data.recycle();
5499 return result;
5500 }
5501
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005502 public int[] getRunningUserIds() throws RemoteException {
5503 Parcel data = Parcel.obtain();
5504 Parcel reply = Parcel.obtain();
5505 data.writeInterfaceToken(IActivityManager.descriptor);
5506 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5507 reply.readException();
5508 int[] result = reply.createIntArray();
5509 reply.recycle();
5510 data.recycle();
5511 return result;
5512 }
5513
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005514 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005515 Parcel data = Parcel.obtain();
5516 Parcel reply = Parcel.obtain();
5517 data.writeInterfaceToken(IActivityManager.descriptor);
5518 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005519 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5520 reply.readException();
5521 boolean result = reply.readInt() != 0;
5522 reply.recycle();
5523 data.recycle();
5524 return result;
5525 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005526
Jeff Sharkeya4620792011-05-20 15:29:23 -07005527 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5528 Parcel data = Parcel.obtain();
5529 Parcel reply = Parcel.obtain();
5530 data.writeInterfaceToken(IActivityManager.descriptor);
5531 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5532 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5533 reply.readException();
5534 data.recycle();
5535 reply.recycle();
5536 }
5537
5538 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5539 Parcel data = Parcel.obtain();
5540 Parcel reply = Parcel.obtain();
5541 data.writeInterfaceToken(IActivityManager.descriptor);
5542 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5543 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5544 reply.readException();
5545 data.recycle();
5546 reply.recycle();
5547 }
5548
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005549 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005550 Parcel data = Parcel.obtain();
5551 Parcel reply = Parcel.obtain();
5552 data.writeInterfaceToken(IActivityManager.descriptor);
5553 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005554 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005555 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5556 reply.readException();
5557 data.recycle();
5558 reply.recycle();
5559 }
5560
5561 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5562 Parcel data = Parcel.obtain();
5563 Parcel reply = Parcel.obtain();
5564 data.writeInterfaceToken(IActivityManager.descriptor);
5565 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5566 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5567 reply.readException();
5568 data.recycle();
5569 reply.recycle();
5570 }
5571
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005572 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5573 Parcel data = Parcel.obtain();
5574 Parcel reply = Parcel.obtain();
5575 data.writeInterfaceToken(IActivityManager.descriptor);
5576 data.writeStrongBinder(sender.asBinder());
5577 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5578 reply.readException();
5579 boolean res = reply.readInt() != 0;
5580 data.recycle();
5581 reply.recycle();
5582 return res;
5583 }
5584
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005585 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5586 Parcel data = Parcel.obtain();
5587 Parcel reply = Parcel.obtain();
5588 data.writeInterfaceToken(IActivityManager.descriptor);
5589 data.writeStrongBinder(sender.asBinder());
5590 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5591 reply.readException();
5592 boolean res = reply.readInt() != 0;
5593 data.recycle();
5594 reply.recycle();
5595 return res;
5596 }
5597
Dianne Hackborn81038902012-11-26 17:04:09 -08005598 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5599 Parcel data = Parcel.obtain();
5600 Parcel reply = Parcel.obtain();
5601 data.writeInterfaceToken(IActivityManager.descriptor);
5602 data.writeStrongBinder(sender.asBinder());
5603 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5604 reply.readException();
5605 Intent res = reply.readInt() != 0
5606 ? Intent.CREATOR.createFromParcel(reply) : null;
5607 data.recycle();
5608 reply.recycle();
5609 return res;
5610 }
5611
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005612 public String getTagForIntentSender(IIntentSender sender, String prefix)
5613 throws RemoteException {
5614 Parcel data = Parcel.obtain();
5615 Parcel reply = Parcel.obtain();
5616 data.writeInterfaceToken(IActivityManager.descriptor);
5617 data.writeStrongBinder(sender.asBinder());
5618 data.writeString(prefix);
5619 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5620 reply.readException();
5621 String res = reply.readString();
5622 data.recycle();
5623 reply.recycle();
5624 return res;
5625 }
5626
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005627 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5628 {
5629 Parcel data = Parcel.obtain();
5630 Parcel reply = Parcel.obtain();
5631 data.writeInterfaceToken(IActivityManager.descriptor);
5632 values.writeToParcel(data, 0);
5633 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5634 reply.readException();
5635 data.recycle();
5636 reply.recycle();
5637 }
5638
Dianne Hackbornb437e092011-08-05 17:50:29 -07005639 public long[] getProcessPss(int[] pids) throws RemoteException {
5640 Parcel data = Parcel.obtain();
5641 Parcel reply = Parcel.obtain();
5642 data.writeInterfaceToken(IActivityManager.descriptor);
5643 data.writeIntArray(pids);
5644 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5645 reply.readException();
5646 long[] res = reply.createLongArray();
5647 data.recycle();
5648 reply.recycle();
5649 return res;
5650 }
5651
Dianne Hackborn661cd522011-08-22 00:26:20 -07005652 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5653 Parcel data = Parcel.obtain();
5654 Parcel reply = Parcel.obtain();
5655 data.writeInterfaceToken(IActivityManager.descriptor);
5656 TextUtils.writeToParcel(msg, data, 0);
5657 data.writeInt(always ? 1 : 0);
5658 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5659 reply.readException();
5660 data.recycle();
5661 reply.recycle();
5662 }
5663
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005664 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005665 Parcel data = Parcel.obtain();
5666 Parcel reply = Parcel.obtain();
5667 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005668 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005669 reply.readException();
5670 data.recycle();
5671 reply.recycle();
5672 }
5673
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005674 public void keyguardGoingAway(boolean disableWindowAnimations,
5675 boolean keyguardGoingToNotificationShade) throws RemoteException {
5676 Parcel data = Parcel.obtain();
5677 Parcel reply = Parcel.obtain();
5678 data.writeInterfaceToken(IActivityManager.descriptor);
5679 data.writeInt(disableWindowAnimations ? 1 : 0);
5680 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5681 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5682 reply.readException();
5683 data.recycle();
5684 reply.recycle();
5685 }
5686
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005687 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005688 throws RemoteException {
5689 Parcel data = Parcel.obtain();
5690 Parcel reply = Parcel.obtain();
5691 data.writeInterfaceToken(IActivityManager.descriptor);
5692 data.writeStrongBinder(token);
5693 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005694 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005695 reply.readException();
5696 boolean result = reply.readInt() != 0;
5697 data.recycle();
5698 reply.recycle();
5699 return result;
5700 }
5701
5702 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5703 throws RemoteException {
5704 Parcel data = Parcel.obtain();
5705 Parcel reply = Parcel.obtain();
5706 data.writeInterfaceToken(IActivityManager.descriptor);
5707 data.writeStrongBinder(token);
5708 target.writeToParcel(data, 0);
5709 data.writeInt(resultCode);
5710 if (resultData != null) {
5711 data.writeInt(1);
5712 resultData.writeToParcel(data, 0);
5713 } else {
5714 data.writeInt(0);
5715 }
5716 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5717 reply.readException();
5718 boolean result = reply.readInt() != 0;
5719 data.recycle();
5720 reply.recycle();
5721 return result;
5722 }
5723
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005724 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5725 Parcel data = Parcel.obtain();
5726 Parcel reply = Parcel.obtain();
5727 data.writeInterfaceToken(IActivityManager.descriptor);
5728 data.writeStrongBinder(activityToken);
5729 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5730 reply.readException();
5731 int result = reply.readInt();
5732 data.recycle();
5733 reply.recycle();
5734 return result;
5735 }
5736
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005737 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5738 Parcel data = Parcel.obtain();
5739 Parcel reply = Parcel.obtain();
5740 data.writeInterfaceToken(IActivityManager.descriptor);
5741 data.writeStrongBinder(activityToken);
5742 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5743 reply.readException();
5744 String result = reply.readString();
5745 data.recycle();
5746 reply.recycle();
5747 return result;
5748 }
5749
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005750 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5751 Parcel data = Parcel.obtain();
5752 Parcel reply = Parcel.obtain();
5753 data.writeInterfaceToken(IActivityManager.descriptor);
5754 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5755 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5756 reply.readException();
5757 data.recycle();
5758 reply.recycle();
5759 }
5760
5761 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5762 Parcel data = Parcel.obtain();
5763 Parcel reply = Parcel.obtain();
5764 data.writeInterfaceToken(IActivityManager.descriptor);
5765 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5766 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5767 reply.readException();
5768 data.recycle();
5769 reply.recycle();
5770 }
5771
Felipe Leme4cc86332015-12-04 16:37:28 -08005772 public void requestBugReport(boolean progress) throws RemoteException {
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005773 Parcel data = Parcel.obtain();
5774 Parcel reply = Parcel.obtain();
5775 data.writeInterfaceToken(IActivityManager.descriptor);
Felipe Leme4cc86332015-12-04 16:37:28 -08005776 data.writeInt(progress ? 1 : 0);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005777 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5778 reply.readException();
5779 data.recycle();
5780 reply.recycle();
5781 }
5782
Jeff Brownbd181bb2013-09-10 16:44:24 -07005783 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5784 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005785 Parcel data = Parcel.obtain();
5786 Parcel reply = Parcel.obtain();
5787 data.writeInterfaceToken(IActivityManager.descriptor);
5788 data.writeInt(pid);
5789 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005790 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005791 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5792 reply.readException();
5793 long res = reply.readInt();
5794 data.recycle();
5795 reply.recycle();
5796 return res;
5797 }
5798
Adam Skorydfc7fd72013-08-05 19:23:41 -07005799 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005800 Parcel data = Parcel.obtain();
5801 Parcel reply = Parcel.obtain();
5802 data.writeInterfaceToken(IActivityManager.descriptor);
5803 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005804 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005805 reply.readException();
5806 Bundle res = reply.readBundle();
5807 data.recycle();
5808 reply.recycle();
5809 return res;
5810 }
5811
Dianne Hackborn17f69352015-07-17 18:04:14 -07005812 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5813 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005814 Parcel data = Parcel.obtain();
5815 Parcel reply = Parcel.obtain();
5816 data.writeInterfaceToken(IActivityManager.descriptor);
5817 data.writeInt(requestType);
5818 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005819 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005820 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5821 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005822 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005823 data.recycle();
5824 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005825 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005826 }
5827
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005828 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005829 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005830 Parcel data = Parcel.obtain();
5831 Parcel reply = Parcel.obtain();
5832 data.writeInterfaceToken(IActivityManager.descriptor);
5833 data.writeStrongBinder(token);
5834 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005835 structure.writeToParcel(data, 0);
5836 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005837 if (referrer != null) {
5838 data.writeInt(1);
5839 referrer.writeToParcel(data, 0);
5840 } else {
5841 data.writeInt(0);
5842 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005843 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005844 reply.readException();
5845 data.recycle();
5846 reply.recycle();
5847 }
5848
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005849 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5850 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005851 Parcel data = Parcel.obtain();
5852 Parcel reply = Parcel.obtain();
5853 data.writeInterfaceToken(IActivityManager.descriptor);
5854 intent.writeToParcel(data, 0);
5855 data.writeInt(requestType);
5856 data.writeString(hint);
5857 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005858 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005859 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5860 reply.readException();
5861 boolean res = reply.readInt() != 0;
5862 data.recycle();
5863 reply.recycle();
5864 return res;
5865 }
5866
Dianne Hackborn17f69352015-07-17 18:04:14 -07005867 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005868 Parcel data = Parcel.obtain();
5869 Parcel reply = Parcel.obtain();
5870 data.writeInterfaceToken(IActivityManager.descriptor);
5871 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5872 reply.readException();
5873 boolean res = reply.readInt() != 0;
5874 data.recycle();
5875 reply.recycle();
5876 return res;
5877 }
5878
Dianne Hackborn17f69352015-07-17 18:04:14 -07005879 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5880 Parcel data = Parcel.obtain();
5881 Parcel reply = Parcel.obtain();
5882 data.writeInterfaceToken(IActivityManager.descriptor);
5883 data.writeStrongBinder(token);
5884 data.writeBundle(args);
5885 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5886 reply.readException();
5887 boolean res = reply.readInt() != 0;
5888 data.recycle();
5889 reply.recycle();
5890 return res;
5891 }
5892
Svetoslavaa41add2015-08-06 15:03:55 -07005893 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005894 Parcel data = Parcel.obtain();
5895 Parcel reply = Parcel.obtain();
5896 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07005897 data.writeInt(appId);
5898 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005899 data.writeString(reason);
5900 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5901 reply.readException();
5902 data.recycle();
5903 reply.recycle();
5904 }
5905
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005906 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5907 Parcel data = Parcel.obtain();
5908 Parcel reply = Parcel.obtain();
5909 data.writeInterfaceToken(IActivityManager.descriptor);
5910 data.writeStrongBinder(who);
5911 data.writeInt(allowRestart ? 1 : 0);
5912 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5913 reply.readException();
5914 data.recycle();
5915 reply.recycle();
5916 }
5917
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005918 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5919 Parcel data = Parcel.obtain();
5920 Parcel reply = Parcel.obtain();
5921 data.writeInterfaceToken(IActivityManager.descriptor);
5922 data.writeStrongBinder(token);
5923 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5924 reply.readException();
5925 data.recycle();
5926 reply.recycle();
5927 }
5928
Craig Mautner5eda9b32013-07-02 11:58:16 -07005929 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5930 Parcel data = Parcel.obtain();
5931 Parcel reply = Parcel.obtain();
5932 data.writeInterfaceToken(IActivityManager.descriptor);
5933 data.writeStrongBinder(token);
5934 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5935 reply.readException();
5936 data.recycle();
5937 reply.recycle();
5938 }
5939
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005940 public void restart() throws RemoteException {
5941 Parcel data = Parcel.obtain();
5942 Parcel reply = Parcel.obtain();
5943 data.writeInterfaceToken(IActivityManager.descriptor);
5944 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5945 reply.readException();
5946 data.recycle();
5947 reply.recycle();
5948 }
5949
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005950 public void performIdleMaintenance() throws RemoteException {
5951 Parcel data = Parcel.obtain();
5952 Parcel reply = Parcel.obtain();
5953 data.writeInterfaceToken(IActivityManager.descriptor);
5954 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5955 reply.readException();
5956 data.recycle();
5957 reply.recycle();
5958 }
5959
Todd Kennedyca4d8422015-01-15 15:19:22 -08005960 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005961 IActivityContainerCallback callback) throws RemoteException {
5962 Parcel data = Parcel.obtain();
5963 Parcel reply = Parcel.obtain();
5964 data.writeInterfaceToken(IActivityManager.descriptor);
5965 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005966 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005967 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005968 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005969 final int result = reply.readInt();
5970 final IActivityContainer res;
5971 if (result == 1) {
5972 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5973 } else {
5974 res = null;
5975 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005976 data.recycle();
5977 reply.recycle();
5978 return res;
5979 }
5980
Craig Mautner95da1082014-02-24 17:54:35 -08005981 public void deleteActivityContainer(IActivityContainer activityContainer)
5982 throws RemoteException {
5983 Parcel data = Parcel.obtain();
5984 Parcel reply = Parcel.obtain();
5985 data.writeInterfaceToken(IActivityManager.descriptor);
5986 data.writeStrongBinder(activityContainer.asBinder());
5987 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5988 reply.readException();
5989 data.recycle();
5990 reply.recycle();
5991 }
5992
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04005993 public boolean startBinderTracking() throws RemoteException {
5994 Parcel data = Parcel.obtain();
5995 Parcel reply = Parcel.obtain();
5996 data.writeInterfaceToken(IActivityManager.descriptor);
5997 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
5998 reply.readException();
5999 boolean res = reply.readInt() != 0;
6000 reply.recycle();
6001 data.recycle();
6002 return res;
6003 }
6004
6005 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
6006 Parcel data = Parcel.obtain();
6007 Parcel reply = Parcel.obtain();
6008 data.writeInterfaceToken(IActivityManager.descriptor);
6009 if (fd != null) {
6010 data.writeInt(1);
6011 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
6012 } else {
6013 data.writeInt(0);
6014 }
6015 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
6016 reply.readException();
6017 boolean res = reply.readInt() != 0;
6018 reply.recycle();
6019 data.recycle();
6020 return res;
6021 }
6022
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006023 public void setVrMode(IBinder token, boolean enabled) throws RemoteException {
6024 Parcel data = Parcel.obtain();
6025 Parcel reply = Parcel.obtain();
6026 data.writeInterfaceToken(IActivityManager.descriptor);
6027 data.writeStrongBinder(token);
6028 data.writeInt(enabled ? 1 : 0);
6029 mRemote.transact(SET_VR_MODE_TRANSACTION, data, reply, 0);
6030 reply.readException();
6031 data.recycle();
6032 reply.recycle();
6033 }
6034
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006035 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08006036 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
6037 Parcel data = Parcel.obtain();
6038 Parcel reply = Parcel.obtain();
6039 data.writeInterfaceToken(IActivityManager.descriptor);
6040 data.writeInt(displayId);
6041 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
6042 reply.readException();
6043 final int result = reply.readInt();
6044 final IActivityContainer res;
6045 if (result == 1) {
6046 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6047 } else {
6048 res = null;
6049 }
6050 data.recycle();
6051 reply.recycle();
6052 return res;
6053 }
6054
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006055 @Override
6056 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08006057 throws RemoteException {
6058 Parcel data = Parcel.obtain();
6059 Parcel reply = Parcel.obtain();
6060 data.writeInterfaceToken(IActivityManager.descriptor);
6061 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006062 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08006063 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006064 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08006065 data.recycle();
6066 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006067 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08006068 }
6069
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006070 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006071 public void startLockTaskMode(int taskId) throws RemoteException {
6072 Parcel data = Parcel.obtain();
6073 Parcel reply = Parcel.obtain();
6074 data.writeInterfaceToken(IActivityManager.descriptor);
6075 data.writeInt(taskId);
6076 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
6077 reply.readException();
6078 data.recycle();
6079 reply.recycle();
6080 }
6081
6082 @Override
6083 public void startLockTaskMode(IBinder token) throws RemoteException {
6084 Parcel data = Parcel.obtain();
6085 Parcel reply = Parcel.obtain();
6086 data.writeInterfaceToken(IActivityManager.descriptor);
6087 data.writeStrongBinder(token);
6088 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
6089 reply.readException();
6090 data.recycle();
6091 reply.recycle();
6092 }
6093
6094 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006095 public void startLockTaskModeOnCurrent() throws RemoteException {
6096 Parcel data = Parcel.obtain();
6097 Parcel reply = Parcel.obtain();
6098 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006099 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006100 reply.readException();
6101 data.recycle();
6102 reply.recycle();
6103 }
6104
6105 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006106 public void stopLockTaskMode() throws RemoteException {
6107 Parcel data = Parcel.obtain();
6108 Parcel reply = Parcel.obtain();
6109 data.writeInterfaceToken(IActivityManager.descriptor);
6110 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6111 reply.readException();
6112 data.recycle();
6113 reply.recycle();
6114 }
6115
6116 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006117 public void stopLockTaskModeOnCurrent() throws RemoteException {
6118 Parcel data = Parcel.obtain();
6119 Parcel reply = Parcel.obtain();
6120 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006121 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006122 reply.readException();
6123 data.recycle();
6124 reply.recycle();
6125 }
6126
6127 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006128 public boolean isInLockTaskMode() throws RemoteException {
6129 Parcel data = Parcel.obtain();
6130 Parcel reply = Parcel.obtain();
6131 data.writeInterfaceToken(IActivityManager.descriptor);
6132 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6133 reply.readException();
6134 boolean isInLockTaskMode = reply.readInt() == 1;
6135 data.recycle();
6136 reply.recycle();
6137 return isInLockTaskMode;
6138 }
6139
Craig Mautner688b5102014-03-27 16:55:03 -07006140 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00006141 public int getLockTaskModeState() throws RemoteException {
6142 Parcel data = Parcel.obtain();
6143 Parcel reply = Parcel.obtain();
6144 data.writeInterfaceToken(IActivityManager.descriptor);
6145 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
6146 reply.readException();
6147 int lockTaskModeState = reply.readInt();
6148 data.recycle();
6149 reply.recycle();
6150 return lockTaskModeState;
6151 }
6152
6153 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07006154 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
6155 Parcel data = Parcel.obtain();
6156 Parcel reply = Parcel.obtain();
6157 data.writeInterfaceToken(IActivityManager.descriptor);
6158 data.writeStrongBinder(token);
6159 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
6160 IBinder.FLAG_ONEWAY);
6161 reply.readException();
6162 data.recycle();
6163 reply.recycle();
6164 }
6165
6166 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07006167 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07006168 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07006169 Parcel data = Parcel.obtain();
6170 Parcel reply = Parcel.obtain();
6171 data.writeInterfaceToken(IActivityManager.descriptor);
6172 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07006173 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006174 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07006175 reply.readException();
6176 data.recycle();
6177 reply.recycle();
6178 }
6179
Craig Mautneree2e45a2014-06-27 12:10:03 -07006180 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006181 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
6182 Parcel data = Parcel.obtain();
6183 Parcel reply = Parcel.obtain();
6184 data.writeInterfaceToken(IActivityManager.descriptor);
6185 data.writeInt(taskId);
6186 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006187 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006188 reply.readException();
6189 data.recycle();
6190 reply.recycle();
6191 }
6192
6193 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07006194 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006195 {
6196 Parcel data = Parcel.obtain();
6197 Parcel reply = Parcel.obtain();
6198 data.writeInterfaceToken(IActivityManager.descriptor);
6199 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006200 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006201 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006202 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006203 reply.readException();
6204 data.recycle();
6205 reply.recycle();
6206 }
6207
6208 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006209 public Rect getTaskBounds(int taskId) throws RemoteException
6210 {
6211 Parcel data = Parcel.obtain();
6212 Parcel reply = Parcel.obtain();
6213 data.writeInterfaceToken(IActivityManager.descriptor);
6214 data.writeInt(taskId);
6215 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6216 reply.readException();
6217 Rect rect = Rect.CREATOR.createFromParcel(reply);
6218 data.recycle();
6219 reply.recycle();
6220 return rect;
6221 }
6222
6223 @Override
Suprabh Shukla23593142015-11-03 17:31:15 -08006224 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException {
Craig Mautner648f69b2014-09-18 14:16:26 -07006225 Parcel data = Parcel.obtain();
6226 Parcel reply = Parcel.obtain();
6227 data.writeInterfaceToken(IActivityManager.descriptor);
6228 data.writeString(filename);
Suprabh Shukla23593142015-11-03 17:31:15 -08006229 data.writeInt(userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07006230 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6231 reply.readException();
6232 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6233 data.recycle();
6234 reply.recycle();
6235 return icon;
6236 }
6237
6238 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006239 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6240 throws RemoteException {
6241 Parcel data = Parcel.obtain();
6242 Parcel reply = Parcel.obtain();
6243 data.writeInterfaceToken(IActivityManager.descriptor);
6244 if (options == null) {
6245 data.writeInt(0);
6246 } else {
6247 data.writeInt(1);
6248 data.writeBundle(options.toBundle());
6249 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006250 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006251 reply.readException();
6252 data.recycle();
6253 reply.recycle();
6254 }
6255
6256 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006257 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006258 Parcel data = Parcel.obtain();
6259 Parcel reply = Parcel.obtain();
6260 data.writeInterfaceToken(IActivityManager.descriptor);
6261 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006262 data.writeInt(visible ? 1 : 0);
6263 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006264 reply.readException();
6265 boolean success = reply.readInt() > 0;
6266 data.recycle();
6267 reply.recycle();
6268 return success;
6269 }
6270
6271 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006272 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006273 Parcel data = Parcel.obtain();
6274 Parcel reply = Parcel.obtain();
6275 data.writeInterfaceToken(IActivityManager.descriptor);
6276 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006277 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006278 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006279 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006280 data.recycle();
6281 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006282 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006283 }
6284
6285 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006286 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006287 Parcel data = Parcel.obtain();
6288 Parcel reply = Parcel.obtain();
6289 data.writeInterfaceToken(IActivityManager.descriptor);
6290 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006291 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006292 reply.readException();
6293 data.recycle();
6294 reply.recycle();
6295 }
6296
6297 @Override
6298 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6299 Parcel data = Parcel.obtain();
6300 Parcel reply = Parcel.obtain();
6301 data.writeInterfaceToken(IActivityManager.descriptor);
6302 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006303 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006304 reply.readException();
6305 data.recycle();
6306 reply.recycle();
6307 }
6308
Craig Mautner8746a472014-07-24 15:12:54 -07006309 @Override
6310 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6311 Parcel data = Parcel.obtain();
6312 Parcel reply = Parcel.obtain();
6313 data.writeInterfaceToken(IActivityManager.descriptor);
6314 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006315 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006316 reply.readException();
6317 data.recycle();
6318 reply.recycle();
6319 }
6320
Craig Mautner6e2f3952014-09-09 14:26:41 -07006321 @Override
6322 public void bootAnimationComplete() throws RemoteException {
6323 Parcel data = Parcel.obtain();
6324 Parcel reply = Parcel.obtain();
6325 data.writeInterfaceToken(IActivityManager.descriptor);
6326 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6327 reply.readException();
6328 data.recycle();
6329 reply.recycle();
6330 }
6331
Wale Ogunwale18795a22014-12-03 11:38:33 -08006332 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006333 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6334 Parcel data = Parcel.obtain();
6335 Parcel reply = Parcel.obtain();
6336 data.writeInterfaceToken(IActivityManager.descriptor);
6337 data.writeInt(uid);
6338 data.writeByteArray(firstPacket);
6339 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6340 reply.readException();
6341 data.recycle();
6342 reply.recycle();
6343 }
6344
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006345 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006346 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6347 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006348 Parcel data = Parcel.obtain();
6349 Parcel reply = Parcel.obtain();
6350 data.writeInterfaceToken(IActivityManager.descriptor);
6351 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006352 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006353 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006354 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006355 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6356 reply.readException();
6357 data.recycle();
6358 reply.recycle();
6359 }
6360
6361 @Override
6362 public void dumpHeapFinished(String path) throws RemoteException {
6363 Parcel data = Parcel.obtain();
6364 Parcel reply = Parcel.obtain();
6365 data.writeInterfaceToken(IActivityManager.descriptor);
6366 data.writeString(path);
6367 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6368 reply.readException();
6369 data.recycle();
6370 reply.recycle();
6371 }
6372
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006373 @Override
6374 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6375 throws RemoteException {
6376 Parcel data = Parcel.obtain();
6377 Parcel reply = Parcel.obtain();
6378 data.writeInterfaceToken(IActivityManager.descriptor);
6379 data.writeStrongBinder(session.asBinder());
6380 data.writeInt(keepAwake ? 1 : 0);
6381 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6382 reply.readException();
6383 data.recycle();
6384 reply.recycle();
6385 }
6386
Craig Mautnere5600772015-04-03 21:36:37 -07006387 @Override
6388 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6389 Parcel data = Parcel.obtain();
6390 Parcel reply = Parcel.obtain();
6391 data.writeInterfaceToken(IActivityManager.descriptor);
6392 data.writeInt(userId);
6393 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006394 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006395 reply.readException();
6396 data.recycle();
6397 reply.recycle();
6398 }
6399
Dianne Hackborn1e383822015-04-10 14:02:33 -07006400 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006401 public void updateDeviceOwner(String packageName) throws RemoteException {
6402 Parcel data = Parcel.obtain();
6403 Parcel reply = Parcel.obtain();
6404 data.writeInterfaceToken(IActivityManager.descriptor);
6405 data.writeString(packageName);
6406 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6407 reply.readException();
6408 data.recycle();
6409 reply.recycle();
6410 }
6411
6412 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006413 public int getPackageProcessState(String packageName, String callingPackage)
6414 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006415 Parcel data = Parcel.obtain();
6416 Parcel reply = Parcel.obtain();
6417 data.writeInterfaceToken(IActivityManager.descriptor);
6418 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006419 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006420 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6421 reply.readException();
6422 int res = reply.readInt();
6423 data.recycle();
6424 reply.recycle();
6425 return res;
6426 }
6427
Stefan Kuhne16045c22015-06-05 07:18:06 -07006428 @Override
6429 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6430 throws RemoteException {
6431 Parcel data = Parcel.obtain();
6432 Parcel reply = Parcel.obtain();
6433 data.writeInterfaceToken(IActivityManager.descriptor);
6434 data.writeString(process);
6435 data.writeInt(userId);
6436 data.writeInt(level);
6437 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6438 reply.readException();
6439 int res = reply.readInt();
6440 data.recycle();
6441 reply.recycle();
6442 return res != 0;
6443 }
6444
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006445 @Override
6446 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6447 Parcel data = Parcel.obtain();
6448 Parcel reply = Parcel.obtain();
6449 data.writeInterfaceToken(IActivityManager.descriptor);
6450 data.writeStrongBinder(token);
6451 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6452 reply.readException();
6453 int res = reply.readInt();
6454 data.recycle();
6455 reply.recycle();
6456 return res != 0;
6457 }
6458
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006459 @Override
6460 public void moveActivityToStack(IBinder token, int stackId) throws RemoteException {
6461 Parcel data = Parcel.obtain();
6462 Parcel reply = Parcel.obtain();
6463 data.writeInterfaceToken(IActivityManager.descriptor);
6464 data.writeStrongBinder(token);
6465 data.writeInt(stackId);
6466 mRemote.transact(MOVE_ACTIVITY_TO_STACK_TRANSACTION, data, reply, 0);
6467 reply.readException();
6468 data.recycle();
6469 reply.recycle();
6470 }
6471
6472 @Override
6473 public int getActivityStackId(IBinder token) throws RemoteException {
6474 Parcel data = Parcel.obtain();
6475 Parcel reply = Parcel.obtain();
6476 data.writeInterfaceToken(IActivityManager.descriptor);
6477 data.writeStrongBinder(token);
6478 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6479 reply.readException();
6480 int stackId = reply.readInt();
6481 data.recycle();
6482 reply.recycle();
6483 return stackId;
6484 }
6485
Filip Gruszczynski23493322015-07-29 17:02:59 -07006486 @Override
6487 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006488 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6489 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006490 Parcel data = Parcel.obtain();
6491 Parcel reply = Parcel.obtain();
6492 data.writeInterfaceToken(IActivityManager.descriptor);
6493 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006494 writeIntArray(horizontalSizeConfiguration, data);
6495 writeIntArray(verticalSizeConfigurations, data);
6496 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006497 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6498 reply.readException();
6499 data.recycle();
6500 reply.recycle();
6501 }
6502
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006503 private static void writeIntArray(int[] array, Parcel data) {
6504 if (array == null) {
6505 data.writeInt(0);
6506 } else {
6507 data.writeInt(array.length);
6508 data.writeIntArray(array);
6509 }
6510 }
6511
Wale Ogunwale83301a92015-09-24 15:54:08 -07006512 @Override
6513 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6514 Parcel data = Parcel.obtain();
6515 Parcel reply = Parcel.obtain();
6516 data.writeInterfaceToken(IActivityManager.descriptor);
6517 data.writeInt(suppress ? 1 : 0);
6518 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6519 reply.readException();
6520 data.recycle();
6521 reply.recycle();
6522 }
6523
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006524 @Override
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006525 public void moveTasksToFullscreenStack(int fromStackId) throws RemoteException {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006526 Parcel data = Parcel.obtain();
6527 Parcel reply = Parcel.obtain();
6528 data.writeInterfaceToken(IActivityManager.descriptor);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006529 data.writeInt(fromStackId);
6530 mRemote.transact(MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006531 reply.readException();
6532 data.recycle();
6533 reply.recycle();
6534 }
6535
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006536 @Override
6537 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6538 Parcel data = Parcel.obtain();
6539 Parcel reply = Parcel.obtain();
6540 data.writeInterfaceToken(IActivityManager.descriptor);
6541 data.writeInt(uid);
6542 data.writeString(packageName);
6543 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6544 reply.readException();
6545 int res = reply.readInt();
6546 data.recycle();
6547 reply.recycle();
6548 return res;
6549 }
6550
Wale Ogunwale5f986092015-12-04 15:35:38 -08006551 @Override
6552 public boolean inMultiWindowMode(IBinder token) throws RemoteException {
6553 Parcel data = Parcel.obtain();
6554 Parcel reply = Parcel.obtain();
6555 data.writeInterfaceToken(IActivityManager.descriptor);
6556 data.writeStrongBinder(token);
6557 mRemote.transact(IN_MULTI_WINDOW_MODE_TRANSACTION, data, reply, 0);
6558 reply.readException();
6559 final boolean multiWindowMode = reply.readInt() == 1 ? true : false;
6560 data.recycle();
6561 reply.recycle();
6562 return multiWindowMode;
6563 }
6564
6565 @Override
6566 public boolean inPictureInPictureMode(IBinder token) throws RemoteException {
6567 Parcel data = Parcel.obtain();
6568 Parcel reply = Parcel.obtain();
6569 data.writeInterfaceToken(IActivityManager.descriptor);
6570 data.writeStrongBinder(token);
6571 mRemote.transact(IN_PICTURE_IN_PICTURE_MODE_TRANSACTION, data, reply, 0);
6572 reply.readException();
6573 final boolean pipMode = reply.readInt() == 1 ? true : false;
6574 data.recycle();
6575 reply.recycle();
6576 return pipMode;
6577 }
6578
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006579 @Override
6580 public void enterPictureInPictureMode(IBinder token) throws RemoteException {
6581 Parcel data = Parcel.obtain();
6582 Parcel reply = Parcel.obtain();
6583 data.writeInterfaceToken(IActivityManager.descriptor);
6584 data.writeStrongBinder(token);
6585 mRemote.transact(ENTER_PICTURE_IN_PICTURE_MODE_TRANSACTION, data, reply, 0);
6586 reply.readException();
6587 data.recycle();
6588 reply.recycle();
6589 }
6590
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006591 private IBinder mRemote;
6592}