blob: ee2efcc5390a636bc83b3e61dce1fa0e91e2187a [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();
335 final int launchStackId = data.readInt();
336 final Bundle options =
337 data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
338 final int result = startActivityFromRecents(taskId, launchStackId, options);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700339 reply.writeNoException();
340 reply.writeInt(result);
341 return true;
342 }
343
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800344 case FINISH_ACTIVITY_TRANSACTION: {
345 data.enforceInterface(IActivityManager.descriptor);
346 IBinder token = data.readStrongBinder();
347 Intent resultData = null;
348 int resultCode = data.readInt();
349 if (data.readInt() != 0) {
350 resultData = Intent.CREATOR.createFromParcel(data);
351 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700352 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700353 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 reply.writeNoException();
355 reply.writeInt(res ? 1 : 0);
356 return true;
357 }
358
359 case FINISH_SUB_ACTIVITY_TRANSACTION: {
360 data.enforceInterface(IActivityManager.descriptor);
361 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700362 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 int requestCode = data.readInt();
364 finishSubActivity(token, resultWho, requestCode);
365 reply.writeNoException();
366 return true;
367 }
368
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700369 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
370 data.enforceInterface(IActivityManager.descriptor);
371 IBinder token = data.readStrongBinder();
372 boolean res = finishActivityAffinity(token);
373 reply.writeNoException();
374 reply.writeInt(res ? 1 : 0);
375 return true;
376 }
377
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700378 case FINISH_VOICE_TASK_TRANSACTION: {
379 data.enforceInterface(IActivityManager.descriptor);
380 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
381 data.readStrongBinder());
382 finishVoiceTask(session);
383 reply.writeNoException();
384 return true;
385 }
386
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700387 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
388 data.enforceInterface(IActivityManager.descriptor);
389 IBinder token = data.readStrongBinder();
390 boolean res = releaseActivityInstance(token);
391 reply.writeNoException();
392 reply.writeInt(res ? 1 : 0);
393 return true;
394 }
395
396 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
397 data.enforceInterface(IActivityManager.descriptor);
398 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
399 releaseSomeActivities(app);
400 reply.writeNoException();
401 return true;
402 }
403
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800404 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
405 data.enforceInterface(IActivityManager.descriptor);
406 IBinder token = data.readStrongBinder();
407 boolean res = willActivityBeVisible(token);
408 reply.writeNoException();
409 reply.writeInt(res ? 1 : 0);
410 return true;
411 }
412
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800413 case REGISTER_RECEIVER_TRANSACTION:
414 {
415 data.enforceInterface(IActivityManager.descriptor);
416 IBinder b = data.readStrongBinder();
417 IApplicationThread app =
418 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700419 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800420 b = data.readStrongBinder();
421 IIntentReceiver rec
422 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
423 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
424 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700425 int userId = data.readInt();
426 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 reply.writeNoException();
428 if (intent != null) {
429 reply.writeInt(1);
430 intent.writeToParcel(reply, 0);
431 } else {
432 reply.writeInt(0);
433 }
434 return true;
435 }
436
437 case UNREGISTER_RECEIVER_TRANSACTION:
438 {
439 data.enforceInterface(IActivityManager.descriptor);
440 IBinder b = data.readStrongBinder();
441 if (b == null) {
442 return true;
443 }
444 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
445 unregisterReceiver(rec);
446 reply.writeNoException();
447 return true;
448 }
449
450 case BROADCAST_INTENT_TRANSACTION:
451 {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder b = data.readStrongBinder();
454 IApplicationThread app =
455 b != null ? ApplicationThreadNative.asInterface(b) : null;
456 Intent intent = Intent.CREATOR.createFromParcel(data);
457 String resolvedType = data.readString();
458 b = data.readStrongBinder();
459 IIntentReceiver resultTo =
460 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
461 int resultCode = data.readInt();
462 String resultData = data.readString();
463 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700464 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800465 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700466 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 boolean serialized = data.readInt() != 0;
468 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700469 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700471 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700472 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800473 reply.writeNoException();
474 reply.writeInt(res);
475 return true;
476 }
477
478 case UNBROADCAST_INTENT_TRANSACTION:
479 {
480 data.enforceInterface(IActivityManager.descriptor);
481 IBinder b = data.readStrongBinder();
482 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
483 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700484 int userId = data.readInt();
485 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800486 reply.writeNoException();
487 return true;
488 }
489
490 case FINISH_RECEIVER_TRANSACTION: {
491 data.enforceInterface(IActivityManager.descriptor);
492 IBinder who = data.readStrongBinder();
493 int resultCode = data.readInt();
494 String resultData = data.readString();
495 Bundle resultExtras = data.readBundle();
496 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800497 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800498 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800499 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 }
501 reply.writeNoException();
502 return true;
503 }
504
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 case ATTACH_APPLICATION_TRANSACTION: {
506 data.enforceInterface(IActivityManager.descriptor);
507 IApplicationThread app = ApplicationThreadNative.asInterface(
508 data.readStrongBinder());
509 if (app != null) {
510 attachApplication(app);
511 }
512 reply.writeNoException();
513 return true;
514 }
515
516 case ACTIVITY_IDLE_TRANSACTION: {
517 data.enforceInterface(IActivityManager.descriptor);
518 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700519 Configuration config = null;
520 if (data.readInt() != 0) {
521 config = Configuration.CREATOR.createFromParcel(data);
522 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700523 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800524 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700525 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 }
527 reply.writeNoException();
528 return true;
529 }
530
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700531 case ACTIVITY_RESUMED_TRANSACTION: {
532 data.enforceInterface(IActivityManager.descriptor);
533 IBinder token = data.readStrongBinder();
534 activityResumed(token);
535 reply.writeNoException();
536 return true;
537 }
538
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800539 case ACTIVITY_PAUSED_TRANSACTION: {
540 data.enforceInterface(IActivityManager.descriptor);
541 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700542 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800543 reply.writeNoException();
544 return true;
545 }
546
547 case ACTIVITY_STOPPED_TRANSACTION: {
548 data.enforceInterface(IActivityManager.descriptor);
549 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800550 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700551 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800552 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700553 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554 reply.writeNoException();
555 return true;
556 }
557
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800558 case ACTIVITY_SLEPT_TRANSACTION: {
559 data.enforceInterface(IActivityManager.descriptor);
560 IBinder token = data.readStrongBinder();
561 activitySlept(token);
562 reply.writeNoException();
563 return true;
564 }
565
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800566 case ACTIVITY_DESTROYED_TRANSACTION: {
567 data.enforceInterface(IActivityManager.descriptor);
568 IBinder token = data.readStrongBinder();
569 activityDestroyed(token);
570 reply.writeNoException();
571 return true;
572 }
573
574 case GET_CALLING_PACKAGE_TRANSACTION: {
575 data.enforceInterface(IActivityManager.descriptor);
576 IBinder token = data.readStrongBinder();
577 String res = token != null ? getCallingPackage(token) : null;
578 reply.writeNoException();
579 reply.writeString(res);
580 return true;
581 }
582
583 case GET_CALLING_ACTIVITY_TRANSACTION: {
584 data.enforceInterface(IActivityManager.descriptor);
585 IBinder token = data.readStrongBinder();
586 ComponentName cn = getCallingActivity(token);
587 reply.writeNoException();
588 ComponentName.writeToParcel(cn, reply);
589 return true;
590 }
591
Winson Chung1147c402014-05-14 11:05:00 -0700592 case GET_APP_TASKS_TRANSACTION: {
593 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700594 String callingPackage = data.readString();
595 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700596 reply.writeNoException();
597 int N = list != null ? list.size() : -1;
598 reply.writeInt(N);
599 int i;
600 for (i=0; i<N; i++) {
601 IAppTask task = list.get(i);
602 reply.writeStrongBinder(task.asBinder());
603 }
604 return true;
605 }
606
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700607 case ADD_APP_TASK_TRANSACTION: {
608 data.enforceInterface(IActivityManager.descriptor);
609 IBinder activityToken = data.readStrongBinder();
610 Intent intent = Intent.CREATOR.createFromParcel(data);
611 ActivityManager.TaskDescription descr
612 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
613 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
614 int res = addAppTask(activityToken, intent, descr, thumbnail);
615 reply.writeNoException();
616 reply.writeInt(res);
617 return true;
618 }
619
620 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
621 data.enforceInterface(IActivityManager.descriptor);
622 Point size = getAppTaskThumbnailSize();
623 reply.writeNoException();
624 size.writeToParcel(reply, 0);
625 return true;
626 }
627
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800628 case GET_TASKS_TRANSACTION: {
629 data.enforceInterface(IActivityManager.descriptor);
630 int maxNum = data.readInt();
631 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700632 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800633 reply.writeNoException();
634 int N = list != null ? list.size() : -1;
635 reply.writeInt(N);
636 int i;
637 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700638 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800639 info.writeToParcel(reply, 0);
640 }
641 return true;
642 }
643
644 case GET_RECENT_TASKS_TRANSACTION: {
645 data.enforceInterface(IActivityManager.descriptor);
646 int maxNum = data.readInt();
647 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700648 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800649 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700650 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800651 reply.writeNoException();
652 reply.writeTypedList(list);
653 return true;
654 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700655
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700656 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800657 data.enforceInterface(IActivityManager.descriptor);
658 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700659 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800660 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700661 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800662 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700663 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700664 } else {
665 reply.writeInt(0);
666 }
667 return true;
668 }
669
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 case GET_SERVICES_TRANSACTION: {
671 data.enforceInterface(IActivityManager.descriptor);
672 int maxNum = data.readInt();
673 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700674 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800675 reply.writeNoException();
676 int N = list != null ? list.size() : -1;
677 reply.writeInt(N);
678 int i;
679 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700680 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800681 info.writeToParcel(reply, 0);
682 }
683 return true;
684 }
685
686 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
687 data.enforceInterface(IActivityManager.descriptor);
688 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
689 reply.writeNoException();
690 reply.writeTypedList(list);
691 return true;
692 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700693
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800694 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
695 data.enforceInterface(IActivityManager.descriptor);
696 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
697 reply.writeNoException();
698 reply.writeTypedList(list);
699 return true;
700 }
701
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700702 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
703 data.enforceInterface(IActivityManager.descriptor);
704 List<ApplicationInfo> list = getRunningExternalApplications();
705 reply.writeNoException();
706 reply.writeTypedList(list);
707 return true;
708 }
709
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 case MOVE_TASK_TO_FRONT_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800713 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700714 Bundle options = data.readInt() != 0
715 ? Bundle.CREATOR.createFromParcel(data) : null;
716 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800717 reply.writeNoException();
718 return true;
719 }
720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 IBinder token = data.readStrongBinder();
724 boolean nonRoot = data.readInt() != 0;
725 boolean res = moveActivityTaskToBack(token, nonRoot);
726 reply.writeNoException();
727 reply.writeInt(res ? 1 : 0);
728 return true;
729 }
730
731 case MOVE_TASK_BACKWARDS_TRANSACTION: {
732 data.enforceInterface(IActivityManager.descriptor);
733 int task = data.readInt();
734 moveTaskBackwards(task);
735 reply.writeNoException();
736 return true;
737 }
738
Craig Mautnerc00204b2013-03-05 15:02:14 -0800739 case MOVE_TASK_TO_STACK_TRANSACTION: {
740 data.enforceInterface(IActivityManager.descriptor);
741 int taskId = data.readInt();
742 int stackId = data.readInt();
743 boolean toTop = data.readInt() != 0;
744 moveTaskToStack(taskId, stackId, toTop);
745 reply.writeNoException();
746 return true;
747 }
748
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700749 case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: {
750 data.enforceInterface(IActivityManager.descriptor);
751 int taskId = data.readInt();
752 int createMode = data.readInt();
753 boolean toTop = data.readInt() != 0;
Jorim Jaggi030979c2015-11-20 15:14:43 -0800754 boolean animate = data.readInt() != 0;
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -0800755 Rect bounds = null;
756 boolean hasBounds = data.readInt() != 0;
757 if (hasBounds) {
758 bounds = Rect.CREATOR.createFromParcel(data);
759 }
760 moveTaskToDockedStack(taskId, createMode, toTop, animate, bounds);
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700761 reply.writeNoException();
762 return true;
763 }
764
Dianne Hackbornbef28fe2015-10-29 17:57:11 -0700765 case MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION: {
Wale Ogunwale079a0042015-10-24 11:44:07 -0700766 data.enforceInterface(IActivityManager.descriptor);
767 final int stackId = data.readInt();
768 final Rect r = Rect.CREATOR.createFromParcel(data);
769 final boolean res = moveTopActivityToPinnedStack(stackId, r);
770 reply.writeNoException();
771 reply.writeInt(res ? 1 : 0);
772 return true;
773 }
774
Craig Mautnerc00204b2013-03-05 15:02:14 -0800775 case RESIZE_STACK_TRANSACTION: {
776 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700777 final int stackId = data.readInt();
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100778 final boolean hasRect = data.readInt() != 0;
779 Rect r = null;
780 if (hasRect) {
781 r = Rect.CREATOR.createFromParcel(data);
782 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700783 final boolean allowResizeInDockedMode = data.readInt() == 1;
784 resizeStack(stackId, r, allowResizeInDockedMode);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800785 reply.writeNoException();
786 return true;
787 }
788
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700789 case POSITION_TASK_IN_STACK_TRANSACTION: {
790 data.enforceInterface(IActivityManager.descriptor);
791 int taskId = data.readInt();
792 int stackId = data.readInt();
793 int position = data.readInt();
794 positionTaskInStack(taskId, stackId, position);
795 reply.writeNoException();
796 return true;
797 }
798
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800799 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700800 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800801 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700802 reply.writeNoException();
803 reply.writeTypedList(list);
804 return true;
805 }
806
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800807 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700808 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800809 int stackId = data.readInt();
810 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700811 reply.writeNoException();
812 if (info != null) {
813 reply.writeInt(1);
814 info.writeToParcel(reply, 0);
815 } else {
816 reply.writeInt(0);
817 }
818 return true;
819 }
820
Winson Chung303e1ff2014-03-07 15:06:19 -0800821 case IS_IN_HOME_STACK_TRANSACTION: {
822 data.enforceInterface(IActivityManager.descriptor);
823 int taskId = data.readInt();
824 boolean isInHomeStack = isInHomeStack(taskId);
825 reply.writeNoException();
826 reply.writeInt(isInHomeStack ? 1 : 0);
827 return true;
828 }
829
Craig Mautnercf910b02013-04-23 11:23:27 -0700830 case SET_FOCUSED_STACK_TRANSACTION: {
831 data.enforceInterface(IActivityManager.descriptor);
832 int stackId = data.readInt();
833 setFocusedStack(stackId);
834 reply.writeNoException();
835 return true;
836 }
837
Winson Chungd16c5652015-01-26 16:11:07 -0800838 case GET_FOCUSED_STACK_ID_TRANSACTION: {
839 data.enforceInterface(IActivityManager.descriptor);
840 int focusedStackId = getFocusedStackId();
841 reply.writeNoException();
842 reply.writeInt(focusedStackId);
843 return true;
844 }
845
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700846 case SET_FOCUSED_TASK_TRANSACTION: {
847 data.enforceInterface(IActivityManager.descriptor);
848 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700849 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700850 reply.writeNoException();
851 return true;
852 }
853
Winson Chung740c3ac2014-11-12 16:14:38 -0800854 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
855 data.enforceInterface(IActivityManager.descriptor);
856 IBinder token = data.readStrongBinder();
857 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
858 reply.writeNoException();
859 return true;
860 }
861
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800862 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
863 data.enforceInterface(IActivityManager.descriptor);
864 IBinder token = data.readStrongBinder();
865 boolean onlyRoot = data.readInt() != 0;
866 int res = token != null
867 ? getTaskForActivity(token, onlyRoot) : -1;
868 reply.writeNoException();
869 reply.writeInt(res);
870 return true;
871 }
872
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 case GET_CONTENT_PROVIDER_TRANSACTION: {
874 data.enforceInterface(IActivityManager.descriptor);
875 IBinder b = data.readStrongBinder();
876 IApplicationThread app = ApplicationThreadNative.asInterface(b);
877 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700878 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700879 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700880 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800881 reply.writeNoException();
882 if (cph != null) {
883 reply.writeInt(1);
884 cph.writeToParcel(reply, 0);
885 } else {
886 reply.writeInt(0);
887 }
888 return true;
889 }
890
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800891 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
892 data.enforceInterface(IActivityManager.descriptor);
893 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700894 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800895 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700896 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800897 reply.writeNoException();
898 if (cph != null) {
899 reply.writeInt(1);
900 cph.writeToParcel(reply, 0);
901 } else {
902 reply.writeInt(0);
903 }
904 return true;
905 }
906
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800907 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
908 data.enforceInterface(IActivityManager.descriptor);
909 IBinder b = data.readStrongBinder();
910 IApplicationThread app = ApplicationThreadNative.asInterface(b);
911 ArrayList<ContentProviderHolder> providers =
912 data.createTypedArrayList(ContentProviderHolder.CREATOR);
913 publishContentProviders(app, providers);
914 reply.writeNoException();
915 return true;
916 }
917
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700918 case REF_CONTENT_PROVIDER_TRANSACTION: {
919 data.enforceInterface(IActivityManager.descriptor);
920 IBinder b = data.readStrongBinder();
921 int stable = data.readInt();
922 int unstable = data.readInt();
923 boolean res = refContentProvider(b, stable, unstable);
924 reply.writeNoException();
925 reply.writeInt(res ? 1 : 0);
926 return true;
927 }
928
929 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
930 data.enforceInterface(IActivityManager.descriptor);
931 IBinder b = data.readStrongBinder();
932 unstableProviderDied(b);
933 reply.writeNoException();
934 return true;
935 }
936
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700937 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
938 data.enforceInterface(IActivityManager.descriptor);
939 IBinder b = data.readStrongBinder();
940 appNotRespondingViaProvider(b);
941 reply.writeNoException();
942 return true;
943 }
944
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800945 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
946 data.enforceInterface(IActivityManager.descriptor);
947 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700948 boolean stable = data.readInt() != 0;
949 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800950 reply.writeNoException();
951 return true;
952 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800953
954 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
955 data.enforceInterface(IActivityManager.descriptor);
956 String name = data.readString();
957 IBinder token = data.readStrongBinder();
958 removeContentProviderExternal(name, token);
959 reply.writeNoException();
960 return true;
961 }
962
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700963 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
964 data.enforceInterface(IActivityManager.descriptor);
965 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
966 PendingIntent pi = getRunningServiceControlPanel(comp);
967 reply.writeNoException();
968 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
969 return true;
970 }
971
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800972 case START_SERVICE_TRANSACTION: {
973 data.enforceInterface(IActivityManager.descriptor);
974 IBinder b = data.readStrongBinder();
975 IApplicationThread app = ApplicationThreadNative.asInterface(b);
976 Intent service = Intent.CREATOR.createFromParcel(data);
977 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -0700978 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700979 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700980 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800981 reply.writeNoException();
982 ComponentName.writeToParcel(cn, reply);
983 return true;
984 }
985
986 case STOP_SERVICE_TRANSACTION: {
987 data.enforceInterface(IActivityManager.descriptor);
988 IBinder b = data.readStrongBinder();
989 IApplicationThread app = ApplicationThreadNative.asInterface(b);
990 Intent service = Intent.CREATOR.createFromParcel(data);
991 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700992 int userId = data.readInt();
993 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800994 reply.writeNoException();
995 reply.writeInt(res);
996 return true;
997 }
998
999 case STOP_SERVICE_TOKEN_TRANSACTION: {
1000 data.enforceInterface(IActivityManager.descriptor);
1001 ComponentName className = ComponentName.readFromParcel(data);
1002 IBinder token = data.readStrongBinder();
1003 int startId = data.readInt();
1004 boolean res = stopServiceToken(className, token, startId);
1005 reply.writeNoException();
1006 reply.writeInt(res ? 1 : 0);
1007 return true;
1008 }
1009
1010 case SET_SERVICE_FOREGROUND_TRANSACTION: {
1011 data.enforceInterface(IActivityManager.descriptor);
1012 ComponentName className = ComponentName.readFromParcel(data);
1013 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001014 int id = data.readInt();
1015 Notification notification = null;
1016 if (data.readInt() != 0) {
1017 notification = Notification.CREATOR.createFromParcel(data);
1018 }
1019 boolean removeNotification = data.readInt() != 0;
1020 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001021 reply.writeNoException();
1022 return true;
1023 }
1024
1025 case BIND_SERVICE_TRANSACTION: {
1026 data.enforceInterface(IActivityManager.descriptor);
1027 IBinder b = data.readStrongBinder();
1028 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1029 IBinder token = data.readStrongBinder();
1030 Intent service = Intent.CREATOR.createFromParcel(data);
1031 String resolvedType = data.readString();
1032 b = data.readStrongBinder();
1033 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001034 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001035 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001036 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001037 int res = bindService(app, token, service, resolvedType, conn, fl,
1038 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001039 reply.writeNoException();
1040 reply.writeInt(res);
1041 return true;
1042 }
1043
1044 case UNBIND_SERVICE_TRANSACTION: {
1045 data.enforceInterface(IActivityManager.descriptor);
1046 IBinder b = data.readStrongBinder();
1047 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1048 boolean res = unbindService(conn);
1049 reply.writeNoException();
1050 reply.writeInt(res ? 1 : 0);
1051 return true;
1052 }
1053
1054 case PUBLISH_SERVICE_TRANSACTION: {
1055 data.enforceInterface(IActivityManager.descriptor);
1056 IBinder token = data.readStrongBinder();
1057 Intent intent = Intent.CREATOR.createFromParcel(data);
1058 IBinder service = data.readStrongBinder();
1059 publishService(token, intent, service);
1060 reply.writeNoException();
1061 return true;
1062 }
1063
1064 case UNBIND_FINISHED_TRANSACTION: {
1065 data.enforceInterface(IActivityManager.descriptor);
1066 IBinder token = data.readStrongBinder();
1067 Intent intent = Intent.CREATOR.createFromParcel(data);
1068 boolean doRebind = data.readInt() != 0;
1069 unbindFinished(token, intent, doRebind);
1070 reply.writeNoException();
1071 return true;
1072 }
1073
1074 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1075 data.enforceInterface(IActivityManager.descriptor);
1076 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001077 int type = data.readInt();
1078 int startId = data.readInt();
1079 int res = data.readInt();
1080 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001081 reply.writeNoException();
1082 return true;
1083 }
1084
1085 case START_INSTRUMENTATION_TRANSACTION: {
1086 data.enforceInterface(IActivityManager.descriptor);
1087 ComponentName className = ComponentName.readFromParcel(data);
1088 String profileFile = data.readString();
1089 int fl = data.readInt();
1090 Bundle arguments = data.readBundle();
1091 IBinder b = data.readStrongBinder();
1092 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001093 b = data.readStrongBinder();
1094 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001095 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001096 String abiOverride = data.readString();
1097 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1098 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001099 reply.writeNoException();
1100 reply.writeInt(res ? 1 : 0);
1101 return true;
1102 }
1103
1104
1105 case FINISH_INSTRUMENTATION_TRANSACTION: {
1106 data.enforceInterface(IActivityManager.descriptor);
1107 IBinder b = data.readStrongBinder();
1108 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1109 int resultCode = data.readInt();
1110 Bundle results = data.readBundle();
1111 finishInstrumentation(app, resultCode, results);
1112 reply.writeNoException();
1113 return true;
1114 }
1115
1116 case GET_CONFIGURATION_TRANSACTION: {
1117 data.enforceInterface(IActivityManager.descriptor);
1118 Configuration config = getConfiguration();
1119 reply.writeNoException();
1120 config.writeToParcel(reply, 0);
1121 return true;
1122 }
1123
1124 case UPDATE_CONFIGURATION_TRANSACTION: {
1125 data.enforceInterface(IActivityManager.descriptor);
1126 Configuration config = Configuration.CREATOR.createFromParcel(data);
1127 updateConfiguration(config);
1128 reply.writeNoException();
1129 return true;
1130 }
1131
1132 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1133 data.enforceInterface(IActivityManager.descriptor);
1134 IBinder token = data.readStrongBinder();
1135 int requestedOrientation = data.readInt();
1136 setRequestedOrientation(token, requestedOrientation);
1137 reply.writeNoException();
1138 return true;
1139 }
1140
1141 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1142 data.enforceInterface(IActivityManager.descriptor);
1143 IBinder token = data.readStrongBinder();
1144 int req = getRequestedOrientation(token);
1145 reply.writeNoException();
1146 reply.writeInt(req);
1147 return true;
1148 }
1149
1150 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1151 data.enforceInterface(IActivityManager.descriptor);
1152 IBinder token = data.readStrongBinder();
1153 ComponentName cn = getActivityClassForToken(token);
1154 reply.writeNoException();
1155 ComponentName.writeToParcel(cn, reply);
1156 return true;
1157 }
1158
1159 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1160 data.enforceInterface(IActivityManager.descriptor);
1161 IBinder token = data.readStrongBinder();
1162 reply.writeNoException();
1163 reply.writeString(getPackageForToken(token));
1164 return true;
1165 }
1166
1167 case GET_INTENT_SENDER_TRANSACTION: {
1168 data.enforceInterface(IActivityManager.descriptor);
1169 int type = data.readInt();
1170 String packageName = data.readString();
1171 IBinder token = data.readStrongBinder();
1172 String resultWho = data.readString();
1173 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001174 Intent[] requestIntents;
1175 String[] requestResolvedTypes;
1176 if (data.readInt() != 0) {
1177 requestIntents = data.createTypedArray(Intent.CREATOR);
1178 requestResolvedTypes = data.createStringArray();
1179 } else {
1180 requestIntents = null;
1181 requestResolvedTypes = null;
1182 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001183 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001184 Bundle options = data.readInt() != 0
1185 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001186 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001187 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001188 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001189 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001190 reply.writeNoException();
1191 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1192 return true;
1193 }
1194
1195 case CANCEL_INTENT_SENDER_TRANSACTION: {
1196 data.enforceInterface(IActivityManager.descriptor);
1197 IIntentSender r = IIntentSender.Stub.asInterface(
1198 data.readStrongBinder());
1199 cancelIntentSender(r);
1200 reply.writeNoException();
1201 return true;
1202 }
1203
1204 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1205 data.enforceInterface(IActivityManager.descriptor);
1206 IIntentSender r = IIntentSender.Stub.asInterface(
1207 data.readStrongBinder());
1208 String res = getPackageForIntentSender(r);
1209 reply.writeNoException();
1210 reply.writeString(res);
1211 return true;
1212 }
1213
Christopher Tatec4a07d12012-04-06 14:19:13 -07001214 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1215 data.enforceInterface(IActivityManager.descriptor);
1216 IIntentSender r = IIntentSender.Stub.asInterface(
1217 data.readStrongBinder());
1218 int res = getUidForIntentSender(r);
1219 reply.writeNoException();
1220 reply.writeInt(res);
1221 return true;
1222 }
1223
Dianne Hackborn41203752012-08-31 14:05:51 -07001224 case HANDLE_INCOMING_USER_TRANSACTION: {
1225 data.enforceInterface(IActivityManager.descriptor);
1226 int callingPid = data.readInt();
1227 int callingUid = data.readInt();
1228 int userId = data.readInt();
1229 boolean allowAll = data.readInt() != 0 ;
1230 boolean requireFull = data.readInt() != 0;
1231 String name = data.readString();
1232 String callerPackage = data.readString();
1233 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1234 requireFull, name, callerPackage);
1235 reply.writeNoException();
1236 reply.writeInt(res);
1237 return true;
1238 }
1239
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001240 case SET_PROCESS_LIMIT_TRANSACTION: {
1241 data.enforceInterface(IActivityManager.descriptor);
1242 int max = data.readInt();
1243 setProcessLimit(max);
1244 reply.writeNoException();
1245 return true;
1246 }
1247
1248 case GET_PROCESS_LIMIT_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 int limit = getProcessLimit();
1251 reply.writeNoException();
1252 reply.writeInt(limit);
1253 return true;
1254 }
1255
1256 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1257 data.enforceInterface(IActivityManager.descriptor);
1258 IBinder token = data.readStrongBinder();
1259 int pid = data.readInt();
1260 boolean isForeground = data.readInt() != 0;
1261 setProcessForeground(token, pid, isForeground);
1262 reply.writeNoException();
1263 return true;
1264 }
1265
1266 case CHECK_PERMISSION_TRANSACTION: {
1267 data.enforceInterface(IActivityManager.descriptor);
1268 String perm = data.readString();
1269 int pid = data.readInt();
1270 int uid = data.readInt();
1271 int res = checkPermission(perm, pid, uid);
1272 reply.writeNoException();
1273 reply.writeInt(res);
1274 return true;
1275 }
1276
Dianne Hackbornff170242014-11-19 10:59:01 -08001277 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1278 data.enforceInterface(IActivityManager.descriptor);
1279 String perm = data.readString();
1280 int pid = data.readInt();
1281 int uid = data.readInt();
1282 IBinder token = data.readStrongBinder();
1283 int res = checkPermissionWithToken(perm, pid, uid, token);
1284 reply.writeNoException();
1285 reply.writeInt(res);
1286 return true;
1287 }
1288
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001289 case CHECK_URI_PERMISSION_TRANSACTION: {
1290 data.enforceInterface(IActivityManager.descriptor);
1291 Uri uri = Uri.CREATOR.createFromParcel(data);
1292 int pid = data.readInt();
1293 int uid = data.readInt();
1294 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001295 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001296 IBinder callerToken = data.readStrongBinder();
1297 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001298 reply.writeNoException();
1299 reply.writeInt(res);
1300 return true;
1301 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001302
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001303 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001304 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001305 String packageName = data.readString();
1306 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1307 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001308 int userId = data.readInt();
1309 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001310 reply.writeNoException();
1311 reply.writeInt(res ? 1 : 0);
1312 return true;
1313 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001314
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001315 case GRANT_URI_PERMISSION_TRANSACTION: {
1316 data.enforceInterface(IActivityManager.descriptor);
1317 IBinder b = data.readStrongBinder();
1318 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1319 String targetPkg = data.readString();
1320 Uri uri = Uri.CREATOR.createFromParcel(data);
1321 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001322 int userId = data.readInt();
1323 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001324 reply.writeNoException();
1325 return true;
1326 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001327
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001328 case REVOKE_URI_PERMISSION_TRANSACTION: {
1329 data.enforceInterface(IActivityManager.descriptor);
1330 IBinder b = data.readStrongBinder();
1331 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1332 Uri uri = Uri.CREATOR.createFromParcel(data);
1333 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001334 int userId = data.readInt();
1335 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001336 reply.writeNoException();
1337 return true;
1338 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001339
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001340 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1341 data.enforceInterface(IActivityManager.descriptor);
1342 Uri uri = Uri.CREATOR.createFromParcel(data);
1343 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001344 int userId = data.readInt();
1345 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001346 reply.writeNoException();
1347 return true;
1348 }
1349
1350 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1351 data.enforceInterface(IActivityManager.descriptor);
1352 Uri uri = Uri.CREATOR.createFromParcel(data);
1353 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001354 int userId = data.readInt();
1355 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001356 reply.writeNoException();
1357 return true;
1358 }
1359
1360 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1361 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001362 final String packageName = data.readString();
1363 final boolean incoming = data.readInt() != 0;
1364 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1365 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001366 reply.writeNoException();
1367 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1368 return true;
1369 }
1370
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001371 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1372 data.enforceInterface(IActivityManager.descriptor);
1373 IBinder b = data.readStrongBinder();
1374 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1375 boolean waiting = data.readInt() != 0;
1376 showWaitingForDebugger(app, waiting);
1377 reply.writeNoException();
1378 return true;
1379 }
1380
1381 case GET_MEMORY_INFO_TRANSACTION: {
1382 data.enforceInterface(IActivityManager.descriptor);
1383 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1384 getMemoryInfo(mi);
1385 reply.writeNoException();
1386 mi.writeToParcel(reply, 0);
1387 return true;
1388 }
1389
1390 case UNHANDLED_BACK_TRANSACTION: {
1391 data.enforceInterface(IActivityManager.descriptor);
1392 unhandledBack();
1393 reply.writeNoException();
1394 return true;
1395 }
1396
1397 case OPEN_CONTENT_URI_TRANSACTION: {
1398 data.enforceInterface(IActivityManager.descriptor);
1399 Uri uri = Uri.parse(data.readString());
1400 ParcelFileDescriptor pfd = openContentUri(uri);
1401 reply.writeNoException();
1402 if (pfd != null) {
1403 reply.writeInt(1);
1404 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1405 } else {
1406 reply.writeInt(0);
1407 }
1408 return true;
1409 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001410
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001411 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1412 data.enforceInterface(IActivityManager.descriptor);
1413 setLockScreenShown(data.readInt() != 0);
1414 reply.writeNoException();
1415 return true;
1416 }
1417
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001418 case SET_DEBUG_APP_TRANSACTION: {
1419 data.enforceInterface(IActivityManager.descriptor);
1420 String pn = data.readString();
1421 boolean wfd = data.readInt() != 0;
1422 boolean per = data.readInt() != 0;
1423 setDebugApp(pn, wfd, per);
1424 reply.writeNoException();
1425 return true;
1426 }
1427
1428 case SET_ALWAYS_FINISH_TRANSACTION: {
1429 data.enforceInterface(IActivityManager.descriptor);
1430 boolean enabled = data.readInt() != 0;
1431 setAlwaysFinish(enabled);
1432 reply.writeNoException();
1433 return true;
1434 }
1435
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001436 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001437 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001438 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001439 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001440 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001441 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001442 return true;
1443 }
1444
1445 case ENTER_SAFE_MODE_TRANSACTION: {
1446 data.enforceInterface(IActivityManager.descriptor);
1447 enterSafeMode();
1448 reply.writeNoException();
1449 return true;
1450 }
1451
1452 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1453 data.enforceInterface(IActivityManager.descriptor);
1454 IIntentSender is = IIntentSender.Stub.asInterface(
1455 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001456 int sourceUid = data.readInt();
1457 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001458 String tag = data.readString();
1459 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1460 reply.writeNoException();
1461 return true;
1462 }
1463
1464 case NOTE_ALARM_START_TRANSACTION: {
1465 data.enforceInterface(IActivityManager.descriptor);
1466 IIntentSender is = IIntentSender.Stub.asInterface(
1467 data.readStrongBinder());
1468 int sourceUid = data.readInt();
1469 String tag = data.readString();
1470 noteAlarmStart(is, sourceUid, tag);
1471 reply.writeNoException();
1472 return true;
1473 }
1474
1475 case NOTE_ALARM_FINISH_TRANSACTION: {
1476 data.enforceInterface(IActivityManager.descriptor);
1477 IIntentSender is = IIntentSender.Stub.asInterface(
1478 data.readStrongBinder());
1479 int sourceUid = data.readInt();
1480 String tag = data.readString();
1481 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001482 reply.writeNoException();
1483 return true;
1484 }
1485
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001486 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001487 data.enforceInterface(IActivityManager.descriptor);
1488 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001489 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001490 boolean secure = data.readInt() != 0;
1491 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001492 reply.writeNoException();
1493 reply.writeInt(res ? 1 : 0);
1494 return true;
1495 }
1496
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001497 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1498 data.enforceInterface(IActivityManager.descriptor);
1499 String reason = data.readString();
1500 boolean res = killProcessesBelowForeground(reason);
1501 reply.writeNoException();
1502 reply.writeInt(res ? 1 : 0);
1503 return true;
1504 }
1505
Dan Egnor60d87622009-12-16 16:32:58 -08001506 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1507 data.enforceInterface(IActivityManager.descriptor);
1508 IBinder app = data.readStrongBinder();
1509 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1510 handleApplicationCrash(app, ci);
1511 reply.writeNoException();
1512 return true;
1513 }
1514
1515 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001516 data.enforceInterface(IActivityManager.descriptor);
1517 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001518 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001519 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001520 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001521 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001522 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001523 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001524 return true;
1525 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001526
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001527 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1528 data.enforceInterface(IActivityManager.descriptor);
1529 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001530 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001531 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1532 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001533 reply.writeNoException();
1534 return true;
1535 }
1536
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001537 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1538 data.enforceInterface(IActivityManager.descriptor);
1539 int sig = data.readInt();
1540 signalPersistentProcesses(sig);
1541 reply.writeNoException();
1542 return true;
1543 }
1544
Dianne Hackborn03abb812010-01-04 18:43:19 -08001545 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1546 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001547 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001548 int userId = data.readInt();
1549 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001550 reply.writeNoException();
1551 return true;
1552 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001553
1554 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1555 data.enforceInterface(IActivityManager.descriptor);
1556 killAllBackgroundProcesses();
1557 reply.writeNoException();
1558 return true;
1559 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001560
Dianne Hackborn03abb812010-01-04 18:43:19 -08001561 case FORCE_STOP_PACKAGE_TRANSACTION: {
1562 data.enforceInterface(IActivityManager.descriptor);
1563 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001564 int userId = data.readInt();
1565 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001566 reply.writeNoException();
1567 return true;
1568 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001569
1570 case GET_MY_MEMORY_STATE_TRANSACTION: {
1571 data.enforceInterface(IActivityManager.descriptor);
1572 ActivityManager.RunningAppProcessInfo info =
1573 new ActivityManager.RunningAppProcessInfo();
1574 getMyMemoryState(info);
1575 reply.writeNoException();
1576 info.writeToParcel(reply, 0);
1577 return true;
1578 }
1579
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001580 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1581 data.enforceInterface(IActivityManager.descriptor);
1582 ConfigurationInfo config = getDeviceConfigurationInfo();
1583 reply.writeNoException();
1584 config.writeToParcel(reply, 0);
1585 return true;
1586 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001587
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001588 case PROFILE_CONTROL_TRANSACTION: {
1589 data.enforceInterface(IActivityManager.descriptor);
1590 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001591 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001592 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001593 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001594 ProfilerInfo profilerInfo = data.readInt() != 0
1595 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1596 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001597 reply.writeNoException();
1598 reply.writeInt(res ? 1 : 0);
1599 return true;
1600 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001601
Dianne Hackborn55280a92009-05-07 15:53:46 -07001602 case SHUTDOWN_TRANSACTION: {
1603 data.enforceInterface(IActivityManager.descriptor);
1604 boolean res = shutdown(data.readInt());
1605 reply.writeNoException();
1606 reply.writeInt(res ? 1 : 0);
1607 return true;
1608 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001609
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001610 case STOP_APP_SWITCHES_TRANSACTION: {
1611 data.enforceInterface(IActivityManager.descriptor);
1612 stopAppSwitches();
1613 reply.writeNoException();
1614 return true;
1615 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001616
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001617 case RESUME_APP_SWITCHES_TRANSACTION: {
1618 data.enforceInterface(IActivityManager.descriptor);
1619 resumeAppSwitches();
1620 reply.writeNoException();
1621 return true;
1622 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001623
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001624 case PEEK_SERVICE_TRANSACTION: {
1625 data.enforceInterface(IActivityManager.descriptor);
1626 Intent service = Intent.CREATOR.createFromParcel(data);
1627 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001628 String callingPackage = data.readString();
1629 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001630 reply.writeNoException();
1631 reply.writeStrongBinder(binder);
1632 return true;
1633 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001634
Christopher Tate181fafa2009-05-14 11:12:14 -07001635 case START_BACKUP_AGENT_TRANSACTION: {
1636 data.enforceInterface(IActivityManager.descriptor);
1637 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1638 int backupRestoreMode = data.readInt();
1639 boolean success = bindBackupAgent(info, backupRestoreMode);
1640 reply.writeNoException();
1641 reply.writeInt(success ? 1 : 0);
1642 return true;
1643 }
1644
1645 case BACKUP_AGENT_CREATED_TRANSACTION: {
1646 data.enforceInterface(IActivityManager.descriptor);
1647 String packageName = data.readString();
1648 IBinder agent = data.readStrongBinder();
1649 backupAgentCreated(packageName, agent);
1650 reply.writeNoException();
1651 return true;
1652 }
1653
1654 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1655 data.enforceInterface(IActivityManager.descriptor);
1656 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1657 unbindBackupAgent(info);
1658 reply.writeNoException();
1659 return true;
1660 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001661
1662 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1663 data.enforceInterface(IActivityManager.descriptor);
1664 String packageName = data.readString();
1665 addPackageDependency(packageName);
1666 reply.writeNoException();
1667 return true;
1668 }
1669
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001670 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001671 data.enforceInterface(IActivityManager.descriptor);
1672 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001673 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001674 String reason = data.readString();
1675 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001676 reply.writeNoException();
1677 return true;
1678 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001679
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001680 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1681 data.enforceInterface(IActivityManager.descriptor);
1682 String reason = data.readString();
1683 closeSystemDialogs(reason);
1684 reply.writeNoException();
1685 return true;
1686 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001687
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001688 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1689 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001690 int[] pids = data.createIntArray();
1691 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001692 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001693 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001694 return true;
1695 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001696
1697 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1698 data.enforceInterface(IActivityManager.descriptor);
1699 String processName = data.readString();
1700 int uid = data.readInt();
1701 killApplicationProcess(processName, uid);
1702 reply.writeNoException();
1703 return true;
1704 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001705
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001706 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1707 data.enforceInterface(IActivityManager.descriptor);
1708 IBinder token = data.readStrongBinder();
1709 String packageName = data.readString();
1710 int enterAnim = data.readInt();
1711 int exitAnim = data.readInt();
1712 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001713 reply.writeNoException();
1714 return true;
1715 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001716
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001717 case IS_USER_A_MONKEY_TRANSACTION: {
1718 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001719 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001720 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001721 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001722 return true;
1723 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001724
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001725 case SET_USER_IS_MONKEY_TRANSACTION: {
1726 data.enforceInterface(IActivityManager.descriptor);
1727 final boolean monkey = (data.readInt() == 1);
1728 setUserIsMonkey(monkey);
1729 reply.writeNoException();
1730 return true;
1731 }
1732
Dianne Hackborn860755f2010-06-03 18:47:52 -07001733 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1734 data.enforceInterface(IActivityManager.descriptor);
1735 finishHeavyWeightApp();
1736 reply.writeNoException();
1737 return true;
1738 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001739
1740 case IS_IMMERSIVE_TRANSACTION: {
1741 data.enforceInterface(IActivityManager.descriptor);
1742 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001743 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001744 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001745 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001746 return true;
1747 }
1748
Craig Mautnerd61dc202014-07-07 11:09:11 -07001749 case IS_TOP_OF_TASK_TRANSACTION: {
1750 data.enforceInterface(IActivityManager.descriptor);
1751 IBinder token = data.readStrongBinder();
1752 final boolean isTopOfTask = isTopOfTask(token);
1753 reply.writeNoException();
1754 reply.writeInt(isTopOfTask ? 1 : 0);
1755 return true;
1756 }
1757
Craig Mautner5eda9b32013-07-02 11:58:16 -07001758 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001759 data.enforceInterface(IActivityManager.descriptor);
1760 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001761 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001762 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001763 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001764 return true;
1765 }
1766
1767 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1768 data.enforceInterface(IActivityManager.descriptor);
1769 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001770 final Bundle bundle;
1771 if (data.readInt() == 0) {
1772 bundle = null;
1773 } else {
1774 bundle = data.readBundle();
1775 }
Chong Zhang280d3322015-11-03 17:27:26 -08001776 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Craig Mautner233ceee2014-05-09 17:05:11 -07001777 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001778 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001779 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001780 return true;
1781 }
1782
Craig Mautner233ceee2014-05-09 17:05:11 -07001783 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1784 data.enforceInterface(IActivityManager.descriptor);
1785 IBinder token = data.readStrongBinder();
1786 final ActivityOptions options = getActivityOptions(token);
1787 reply.writeNoException();
1788 reply.writeBundle(options == null ? null : options.toBundle());
1789 return true;
1790 }
1791
Daniel Sandler69a48172010-06-23 16:29:36 -04001792 case SET_IMMERSIVE_TRANSACTION: {
1793 data.enforceInterface(IActivityManager.descriptor);
1794 IBinder token = data.readStrongBinder();
1795 boolean imm = data.readInt() == 1;
1796 setImmersive(token, imm);
1797 reply.writeNoException();
1798 return true;
1799 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001800
Daniel Sandler69a48172010-06-23 16:29:36 -04001801 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1802 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001803 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001804 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001805 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001806 return true;
1807 }
1808
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001809 case CRASH_APPLICATION_TRANSACTION: {
1810 data.enforceInterface(IActivityManager.descriptor);
1811 int uid = data.readInt();
1812 int initialPid = data.readInt();
1813 String packageName = data.readString();
1814 String message = data.readString();
1815 crashApplication(uid, initialPid, packageName, message);
1816 reply.writeNoException();
1817 return true;
1818 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001819
1820 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001823 int userId = data.readInt();
1824 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001825 reply.writeNoException();
1826 reply.writeString(type);
1827 return true;
1828 }
1829
Dianne Hackborn7e269642010-08-25 19:50:20 -07001830 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1831 data.enforceInterface(IActivityManager.descriptor);
1832 String name = data.readString();
1833 IBinder perm = newUriPermissionOwner(name);
1834 reply.writeNoException();
1835 reply.writeStrongBinder(perm);
1836 return true;
1837 }
1838
1839 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1840 data.enforceInterface(IActivityManager.descriptor);
1841 IBinder owner = data.readStrongBinder();
1842 int fromUid = data.readInt();
1843 String targetPkg = data.readString();
1844 Uri uri = Uri.CREATOR.createFromParcel(data);
1845 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001846 int sourceUserId = data.readInt();
1847 int targetUserId = data.readInt();
1848 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1849 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001850 reply.writeNoException();
1851 return true;
1852 }
1853
1854 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1855 data.enforceInterface(IActivityManager.descriptor);
1856 IBinder owner = data.readStrongBinder();
1857 Uri uri = null;
1858 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001859 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001860 }
1861 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001862 int userId = data.readInt();
1863 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001864 reply.writeNoException();
1865 return true;
1866 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001867
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001868 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1869 data.enforceInterface(IActivityManager.descriptor);
1870 int callingUid = data.readInt();
1871 String targetPkg = data.readString();
1872 Uri uri = Uri.CREATOR.createFromParcel(data);
1873 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001874 int userId = data.readInt();
1875 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001876 reply.writeNoException();
1877 reply.writeInt(res);
1878 return true;
1879 }
1880
Andy McFadden824c5102010-07-09 16:26:57 -07001881 case DUMP_HEAP_TRANSACTION: {
1882 data.enforceInterface(IActivityManager.descriptor);
1883 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001884 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001885 boolean managed = data.readInt() != 0;
1886 String path = data.readString();
1887 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001888 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001889 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001890 reply.writeNoException();
1891 reply.writeInt(res ? 1 : 0);
1892 return true;
1893 }
1894
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001895 case START_ACTIVITIES_TRANSACTION:
1896 {
1897 data.enforceInterface(IActivityManager.descriptor);
1898 IBinder b = data.readStrongBinder();
1899 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001900 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001901 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1902 String[] resolvedTypes = data.createStringArray();
1903 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001904 Bundle options = data.readInt() != 0
1905 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001906 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001907 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001908 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001909 reply.writeNoException();
1910 reply.writeInt(result);
1911 return true;
1912 }
1913
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001914 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1915 {
1916 data.enforceInterface(IActivityManager.descriptor);
1917 int mode = getFrontActivityScreenCompatMode();
1918 reply.writeNoException();
1919 reply.writeInt(mode);
1920 return true;
1921 }
1922
1923 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1924 {
1925 data.enforceInterface(IActivityManager.descriptor);
1926 int mode = data.readInt();
1927 setFrontActivityScreenCompatMode(mode);
1928 reply.writeNoException();
1929 reply.writeInt(mode);
1930 return true;
1931 }
1932
1933 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1934 {
1935 data.enforceInterface(IActivityManager.descriptor);
1936 String pkg = data.readString();
1937 int mode = getPackageScreenCompatMode(pkg);
1938 reply.writeNoException();
1939 reply.writeInt(mode);
1940 return true;
1941 }
1942
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001943 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1944 {
1945 data.enforceInterface(IActivityManager.descriptor);
1946 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001947 int mode = data.readInt();
1948 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001949 reply.writeNoException();
1950 return true;
1951 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001952
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001953 case SWITCH_USER_TRANSACTION: {
1954 data.enforceInterface(IActivityManager.descriptor);
1955 int userid = data.readInt();
1956 boolean result = switchUser(userid);
1957 reply.writeNoException();
1958 reply.writeInt(result ? 1 : 0);
1959 return true;
1960 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001961
Kenny Guy08488bf2014-02-21 17:40:37 +00001962 case START_USER_IN_BACKGROUND_TRANSACTION: {
1963 data.enforceInterface(IActivityManager.descriptor);
1964 int userid = data.readInt();
1965 boolean result = startUserInBackground(userid);
1966 reply.writeNoException();
1967 reply.writeInt(result ? 1 : 0);
1968 return true;
1969 }
1970
Jeff Sharkeyba512352015-11-12 20:17:45 -08001971 case UNLOCK_USER_TRANSACTION: {
1972 data.enforceInterface(IActivityManager.descriptor);
1973 int userId = data.readInt();
1974 byte[] token = data.createByteArray();
1975 boolean result = unlockUser(userId, token);
1976 reply.writeNoException();
1977 reply.writeInt(result ? 1 : 0);
1978 return true;
1979 }
1980
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001981 case STOP_USER_TRANSACTION: {
1982 data.enforceInterface(IActivityManager.descriptor);
1983 int userid = data.readInt();
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07001984 boolean force = data.readInt() != 0;
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001985 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1986 data.readStrongBinder());
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07001987 int result = stopUser(userid, force, callback);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001988 reply.writeNoException();
1989 reply.writeInt(result);
1990 return true;
1991 }
1992
Amith Yamasani52f1d752012-03-28 18:19:29 -07001993 case GET_CURRENT_USER_TRANSACTION: {
1994 data.enforceInterface(IActivityManager.descriptor);
1995 UserInfo userInfo = getCurrentUser();
1996 reply.writeNoException();
1997 userInfo.writeToParcel(reply, 0);
1998 return true;
1999 }
2000
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002001 case IS_USER_RUNNING_TRANSACTION: {
2002 data.enforceInterface(IActivityManager.descriptor);
2003 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08002004 int _flags = data.readInt();
2005 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002006 reply.writeNoException();
2007 reply.writeInt(result ? 1 : 0);
2008 return true;
2009 }
2010
Dianne Hackbornc72fc672012-09-20 13:12:03 -07002011 case GET_RUNNING_USER_IDS_TRANSACTION: {
2012 data.enforceInterface(IActivityManager.descriptor);
2013 int[] result = getRunningUserIds();
2014 reply.writeNoException();
2015 reply.writeIntArray(result);
2016 return true;
2017 }
2018
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002019 case REMOVE_TASK_TRANSACTION:
2020 {
2021 data.enforceInterface(IActivityManager.descriptor);
2022 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002023 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002024 reply.writeNoException();
2025 reply.writeInt(result ? 1 : 0);
2026 return true;
2027 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002028
Jeff Sharkeya4620792011-05-20 15:29:23 -07002029 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2030 data.enforceInterface(IActivityManager.descriptor);
2031 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2032 data.readStrongBinder());
2033 registerProcessObserver(observer);
2034 return true;
2035 }
2036
2037 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2038 data.enforceInterface(IActivityManager.descriptor);
2039 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2040 data.readStrongBinder());
2041 unregisterProcessObserver(observer);
2042 return true;
2043 }
2044
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002045 case REGISTER_UID_OBSERVER_TRANSACTION: {
2046 data.enforceInterface(IActivityManager.descriptor);
2047 IUidObserver observer = IUidObserver.Stub.asInterface(
2048 data.readStrongBinder());
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002049 int which = data.readInt();
2050 registerUidObserver(observer, which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002051 return true;
2052 }
2053
2054 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2055 data.enforceInterface(IActivityManager.descriptor);
2056 IUidObserver observer = IUidObserver.Stub.asInterface(
2057 data.readStrongBinder());
2058 unregisterUidObserver(observer);
2059 return true;
2060 }
2061
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002062 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2063 {
2064 data.enforceInterface(IActivityManager.descriptor);
2065 String pkg = data.readString();
2066 boolean ask = getPackageAskScreenCompat(pkg);
2067 reply.writeNoException();
2068 reply.writeInt(ask ? 1 : 0);
2069 return true;
2070 }
2071
2072 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2073 {
2074 data.enforceInterface(IActivityManager.descriptor);
2075 String pkg = data.readString();
2076 boolean ask = data.readInt() != 0;
2077 setPackageAskScreenCompat(pkg, ask);
2078 reply.writeNoException();
2079 return true;
2080 }
2081
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002082 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2083 data.enforceInterface(IActivityManager.descriptor);
2084 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002085 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002086 boolean res = isIntentSenderTargetedToPackage(r);
2087 reply.writeNoException();
2088 reply.writeInt(res ? 1 : 0);
2089 return true;
2090 }
2091
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002092 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2093 data.enforceInterface(IActivityManager.descriptor);
2094 IIntentSender r = IIntentSender.Stub.asInterface(
2095 data.readStrongBinder());
2096 boolean res = isIntentSenderAnActivity(r);
2097 reply.writeNoException();
2098 reply.writeInt(res ? 1 : 0);
2099 return true;
2100 }
2101
Dianne Hackborn81038902012-11-26 17:04:09 -08002102 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2103 data.enforceInterface(IActivityManager.descriptor);
2104 IIntentSender r = IIntentSender.Stub.asInterface(
2105 data.readStrongBinder());
2106 Intent intent = getIntentForIntentSender(r);
2107 reply.writeNoException();
2108 if (intent != null) {
2109 reply.writeInt(1);
2110 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2111 } else {
2112 reply.writeInt(0);
2113 }
2114 return true;
2115 }
2116
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002117 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2118 data.enforceInterface(IActivityManager.descriptor);
2119 IIntentSender r = IIntentSender.Stub.asInterface(
2120 data.readStrongBinder());
2121 String prefix = data.readString();
2122 String tag = getTagForIntentSender(r, prefix);
2123 reply.writeNoException();
2124 reply.writeString(tag);
2125 return true;
2126 }
2127
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002128 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2129 data.enforceInterface(IActivityManager.descriptor);
2130 Configuration config = Configuration.CREATOR.createFromParcel(data);
2131 updatePersistentConfiguration(config);
2132 reply.writeNoException();
2133 return true;
2134 }
2135
Dianne Hackbornb437e092011-08-05 17:50:29 -07002136 case GET_PROCESS_PSS_TRANSACTION: {
2137 data.enforceInterface(IActivityManager.descriptor);
2138 int[] pids = data.createIntArray();
2139 long[] pss = getProcessPss(pids);
2140 reply.writeNoException();
2141 reply.writeLongArray(pss);
2142 return true;
2143 }
2144
Dianne Hackborn661cd522011-08-22 00:26:20 -07002145 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2146 data.enforceInterface(IActivityManager.descriptor);
2147 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2148 boolean always = data.readInt() != 0;
2149 showBootMessage(msg, always);
2150 reply.writeNoException();
2151 return true;
2152 }
2153
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002154 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002155 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002156 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002157 reply.writeNoException();
2158 return true;
2159 }
2160
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002161 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2162 data.enforceInterface(IActivityManager.descriptor);
2163 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2164 reply.writeNoException();
2165 return true;
2166 }
2167
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002168 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002169 data.enforceInterface(IActivityManager.descriptor);
2170 IBinder token = data.readStrongBinder();
2171 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002172 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002173 reply.writeNoException();
2174 reply.writeInt(res ? 1 : 0);
2175 return true;
2176 }
2177
2178 case NAVIGATE_UP_TO_TRANSACTION: {
2179 data.enforceInterface(IActivityManager.descriptor);
2180 IBinder token = data.readStrongBinder();
2181 Intent target = Intent.CREATOR.createFromParcel(data);
2182 int resultCode = data.readInt();
2183 Intent resultData = null;
2184 if (data.readInt() != 0) {
2185 resultData = Intent.CREATOR.createFromParcel(data);
2186 }
2187 boolean res = navigateUpTo(token, target, resultCode, resultData);
2188 reply.writeNoException();
2189 reply.writeInt(res ? 1 : 0);
2190 return true;
2191 }
2192
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002193 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2194 data.enforceInterface(IActivityManager.descriptor);
2195 IBinder token = data.readStrongBinder();
2196 int res = getLaunchedFromUid(token);
2197 reply.writeNoException();
2198 reply.writeInt(res);
2199 return true;
2200 }
2201
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002202 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2203 data.enforceInterface(IActivityManager.descriptor);
2204 IBinder token = data.readStrongBinder();
2205 String res = getLaunchedFromPackage(token);
2206 reply.writeNoException();
2207 reply.writeString(res);
2208 return true;
2209 }
2210
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002211 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2212 data.enforceInterface(IActivityManager.descriptor);
2213 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2214 data.readStrongBinder());
2215 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002216 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002217 return true;
2218 }
2219
2220 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2221 data.enforceInterface(IActivityManager.descriptor);
2222 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2223 data.readStrongBinder());
2224 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002225 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002226 return true;
2227 }
2228
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002229 case REQUEST_BUG_REPORT_TRANSACTION: {
2230 data.enforceInterface(IActivityManager.descriptor);
2231 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002232 reply.writeNoException();
2233 return true;
2234 }
2235
2236 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2237 data.enforceInterface(IActivityManager.descriptor);
2238 int pid = data.readInt();
2239 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002240 String reason = data.readString();
2241 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002242 reply.writeNoException();
2243 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002244 return true;
2245 }
2246
Adam Skorydfc7fd72013-08-05 19:23:41 -07002247 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002248 data.enforceInterface(IActivityManager.descriptor);
2249 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002250 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002251 reply.writeNoException();
2252 reply.writeBundle(res);
2253 return true;
2254 }
2255
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002256 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2257 data.enforceInterface(IActivityManager.descriptor);
2258 int requestType = data.readInt();
2259 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002260 IBinder activityToken = data.readStrongBinder();
2261 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002262 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002263 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002264 return true;
2265 }
2266
Adam Skorydfc7fd72013-08-05 19:23:41 -07002267 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002268 data.enforceInterface(IActivityManager.descriptor);
2269 IBinder token = data.readStrongBinder();
2270 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002271 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2272 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002273 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2274 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002275 reply.writeNoException();
2276 return true;
2277 }
2278
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002279 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2280 data.enforceInterface(IActivityManager.descriptor);
2281 Intent intent = Intent.CREATOR.createFromParcel(data);
2282 int requestType = data.readInt();
2283 String hint = data.readString();
2284 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002285 Bundle args = data.readBundle();
2286 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002287 reply.writeNoException();
2288 reply.writeInt(res ? 1 : 0);
2289 return true;
2290 }
2291
Benjamin Franzc200f442015-06-25 18:20:04 +01002292 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2293 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002294 boolean res = isAssistDataAllowedOnCurrentActivity();
2295 reply.writeNoException();
2296 reply.writeInt(res ? 1 : 0);
2297 return true;
2298 }
2299
2300 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2301 data.enforceInterface(IActivityManager.descriptor);
2302 IBinder token = data.readStrongBinder();
2303 Bundle args = data.readBundle();
2304 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002305 reply.writeNoException();
2306 reply.writeInt(res ? 1 : 0);
2307 return true;
2308 }
2309
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002310 case KILL_UID_TRANSACTION: {
2311 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002312 int appId = data.readInt();
2313 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002314 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002315 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002316 reply.writeNoException();
2317 return true;
2318 }
2319
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002320 case HANG_TRANSACTION: {
2321 data.enforceInterface(IActivityManager.descriptor);
2322 IBinder who = data.readStrongBinder();
2323 boolean allowRestart = data.readInt() != 0;
2324 hang(who, allowRestart);
2325 reply.writeNoException();
2326 return true;
2327 }
2328
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002329 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2330 data.enforceInterface(IActivityManager.descriptor);
2331 IBinder token = data.readStrongBinder();
2332 reportActivityFullyDrawn(token);
2333 reply.writeNoException();
2334 return true;
2335 }
2336
Craig Mautner5eda9b32013-07-02 11:58:16 -07002337 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2338 data.enforceInterface(IActivityManager.descriptor);
2339 IBinder token = data.readStrongBinder();
2340 notifyActivityDrawn(token);
2341 reply.writeNoException();
2342 return true;
2343 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002344
2345 case RESTART_TRANSACTION: {
2346 data.enforceInterface(IActivityManager.descriptor);
2347 restart();
2348 reply.writeNoException();
2349 return true;
2350 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002351
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002352 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2353 data.enforceInterface(IActivityManager.descriptor);
2354 performIdleMaintenance();
2355 reply.writeNoException();
2356 return true;
2357 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002358
Todd Kennedyca4d8422015-01-15 15:19:22 -08002359 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002360 data.enforceInterface(IActivityManager.descriptor);
2361 IBinder parentActivityToken = data.readStrongBinder();
2362 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002363 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002364 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002365 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002366 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002367 if (activityContainer != null) {
2368 reply.writeInt(1);
2369 reply.writeStrongBinder(activityContainer.asBinder());
2370 } else {
2371 reply.writeInt(0);
2372 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002373 return true;
2374 }
2375
Craig Mautner95da1082014-02-24 17:54:35 -08002376 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2377 data.enforceInterface(IActivityManager.descriptor);
2378 IActivityContainer activityContainer =
2379 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2380 deleteActivityContainer(activityContainer);
2381 reply.writeNoException();
2382 return true;
2383 }
2384
Todd Kennedy4900bf92015-01-16 16:05:14 -08002385 case CREATE_STACK_ON_DISPLAY: {
2386 data.enforceInterface(IActivityManager.descriptor);
2387 int displayId = data.readInt();
2388 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2389 reply.writeNoException();
2390 if (activityContainer != null) {
2391 reply.writeInt(1);
2392 reply.writeStrongBinder(activityContainer.asBinder());
2393 } else {
2394 reply.writeInt(0);
2395 }
2396 return true;
2397 }
2398
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002399 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002400 data.enforceInterface(IActivityManager.descriptor);
2401 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002402 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002403 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002404 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002405 return true;
2406 }
2407
Craig Mautneraea74a52014-03-08 14:23:10 -08002408 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2409 data.enforceInterface(IActivityManager.descriptor);
2410 final int taskId = data.readInt();
2411 startLockTaskMode(taskId);
2412 reply.writeNoException();
2413 return true;
2414 }
2415
2416 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2417 data.enforceInterface(IActivityManager.descriptor);
2418 IBinder token = data.readStrongBinder();
2419 startLockTaskMode(token);
2420 reply.writeNoException();
2421 return true;
2422 }
2423
Craig Mautnerd61dc202014-07-07 11:09:11 -07002424 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002425 data.enforceInterface(IActivityManager.descriptor);
2426 startLockTaskModeOnCurrent();
2427 reply.writeNoException();
2428 return true;
2429 }
2430
Craig Mautneraea74a52014-03-08 14:23:10 -08002431 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2432 data.enforceInterface(IActivityManager.descriptor);
2433 stopLockTaskMode();
2434 reply.writeNoException();
2435 return true;
2436 }
2437
Craig Mautnerd61dc202014-07-07 11:09:11 -07002438 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002439 data.enforceInterface(IActivityManager.descriptor);
2440 stopLockTaskModeOnCurrent();
2441 reply.writeNoException();
2442 return true;
2443 }
2444
Craig Mautneraea74a52014-03-08 14:23:10 -08002445 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2446 data.enforceInterface(IActivityManager.descriptor);
2447 final boolean isInLockTaskMode = isInLockTaskMode();
2448 reply.writeNoException();
2449 reply.writeInt(isInLockTaskMode ? 1 : 0);
2450 return true;
2451 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002452
Benjamin Franz43261142015-02-11 15:59:44 +00002453 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2454 data.enforceInterface(IActivityManager.descriptor);
2455 final int lockTaskModeState = getLockTaskModeState();
2456 reply.writeNoException();
2457 reply.writeInt(lockTaskModeState);
2458 return true;
2459 }
2460
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002461 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2462 data.enforceInterface(IActivityManager.descriptor);
2463 final IBinder token = data.readStrongBinder();
2464 showLockTaskEscapeMessage(token);
2465 reply.writeNoException();
2466 return true;
2467 }
2468
Winson Chunga449dc02014-05-16 11:15:04 -07002469 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002470 data.enforceInterface(IActivityManager.descriptor);
2471 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002472 ActivityManager.TaskDescription values =
2473 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2474 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002475 reply.writeNoException();
2476 return true;
2477 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002478
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002479 case SET_TASK_RESIZEABLE_TRANSACTION: {
2480 data.enforceInterface(IActivityManager.descriptor);
2481 int taskId = data.readInt();
2482 boolean resizeable = (data.readInt() == 1) ? true : false;
2483 setTaskResizeable(taskId, resizeable);
2484 reply.writeNoException();
2485 return true;
2486 }
2487
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002488 case RESIZE_TASK_TRANSACTION: {
2489 data.enforceInterface(IActivityManager.descriptor);
2490 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002491 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002492 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002493 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002494 reply.writeNoException();
2495 return true;
2496 }
2497
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002498 case GET_TASK_BOUNDS_TRANSACTION: {
2499 data.enforceInterface(IActivityManager.descriptor);
2500 int taskId = data.readInt();
2501 Rect r = getTaskBounds(taskId);
2502 reply.writeNoException();
2503 r.writeToParcel(reply, 0);
2504 return true;
2505 }
2506
Craig Mautner648f69b2014-09-18 14:16:26 -07002507 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2508 data.enforceInterface(IActivityManager.descriptor);
2509 String filename = data.readString();
Suprabh Shukla23593142015-11-03 17:31:15 -08002510 int userId = data.readInt();
2511 Bitmap icon = getTaskDescriptionIcon(filename, userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07002512 reply.writeNoException();
2513 if (icon == null) {
2514 reply.writeInt(0);
2515 } else {
2516 reply.writeInt(1);
2517 icon.writeToParcel(reply, 0);
2518 }
2519 return true;
2520 }
2521
Winson Chung044d5292014-11-06 11:05:19 -08002522 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2523 data.enforceInterface(IActivityManager.descriptor);
2524 final Bundle bundle;
2525 if (data.readInt() == 0) {
2526 bundle = null;
2527 } else {
2528 bundle = data.readBundle();
2529 }
Chong Zhang280d3322015-11-03 17:27:26 -08002530 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002531 startInPlaceAnimationOnFrontMostApplication(options);
2532 reply.writeNoException();
2533 return true;
2534 }
2535
Jose Lima4b6c6692014-08-12 17:41:12 -07002536 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002537 data.enforceInterface(IActivityManager.descriptor);
2538 IBinder token = data.readStrongBinder();
2539 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002540 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002541 reply.writeNoException();
2542 reply.writeInt(success ? 1 : 0);
2543 return true;
2544 }
2545
Jose Lima4b6c6692014-08-12 17:41:12 -07002546 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002547 data.enforceInterface(IActivityManager.descriptor);
2548 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002549 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002550 reply.writeNoException();
2551 reply.writeInt(enabled ? 1 : 0);
2552 return true;
2553 }
2554
Jose Lima4b6c6692014-08-12 17:41:12 -07002555 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002556 data.enforceInterface(IActivityManager.descriptor);
2557 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002558 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002559 reply.writeNoException();
2560 return true;
2561 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002562
2563 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2564 data.enforceInterface(IActivityManager.descriptor);
2565 IBinder token = data.readStrongBinder();
2566 notifyLaunchTaskBehindComplete(token);
2567 reply.writeNoException();
2568 return true;
2569 }
Craig Mautner8746a472014-07-24 15:12:54 -07002570
2571 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2572 data.enforceInterface(IActivityManager.descriptor);
2573 IBinder token = data.readStrongBinder();
2574 notifyEnterAnimationComplete(token);
2575 reply.writeNoException();
2576 return true;
2577 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002578
2579 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2580 data.enforceInterface(IActivityManager.descriptor);
2581 bootAnimationComplete();
2582 reply.writeNoException();
2583 return true;
2584 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002585
Jeff Sharkey605eb792014-11-04 13:34:06 -08002586 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2587 data.enforceInterface(IActivityManager.descriptor);
2588 final int uid = data.readInt();
2589 final byte[] firstPacket = data.createByteArray();
2590 notifyCleartextNetwork(uid, firstPacket);
2591 reply.writeNoException();
2592 return true;
2593 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002594
2595 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2596 data.enforceInterface(IActivityManager.descriptor);
2597 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002598 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002599 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002600 String reportPackage = data.readString();
2601 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002602 reply.writeNoException();
2603 return true;
2604 }
2605
2606 case DUMP_HEAP_FINISHED_TRANSACTION: {
2607 data.enforceInterface(IActivityManager.descriptor);
2608 String path = data.readString();
2609 dumpHeapFinished(path);
2610 reply.writeNoException();
2611 return true;
2612 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002613
2614 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2615 data.enforceInterface(IActivityManager.descriptor);
2616 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2617 data.readStrongBinder());
2618 boolean keepAwake = data.readInt() != 0;
2619 setVoiceKeepAwake(session, keepAwake);
2620 reply.writeNoException();
2621 return true;
2622 }
Craig Mautnere5600772015-04-03 21:36:37 -07002623
2624 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2625 data.enforceInterface(IActivityManager.descriptor);
2626 int userId = data.readInt();
2627 String[] packages = data.readStringArray();
2628 updateLockTaskPackages(userId, packages);
2629 reply.writeNoException();
2630 return true;
2631 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002632
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002633 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2634 data.enforceInterface(IActivityManager.descriptor);
2635 String packageName = data.readString();
2636 updateDeviceOwner(packageName);
2637 reply.writeNoException();
2638 return true;
2639 }
2640
Dianne Hackborn1e383822015-04-10 14:02:33 -07002641 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2642 data.enforceInterface(IActivityManager.descriptor);
2643 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002644 String callingPackage = data.readString();
2645 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002646 reply.writeNoException();
2647 reply.writeInt(res);
2648 return true;
2649 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002650
2651 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2652 data.enforceInterface(IActivityManager.descriptor);
2653 String process = data.readString();
2654 int userId = data.readInt();
2655 int level = data.readInt();
2656 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2657 reply.writeNoException();
2658 reply.writeInt(res ? 1 : 0);
2659 return true;
2660 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002661
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002662 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2663 data.enforceInterface(IActivityManager.descriptor);
2664 IBinder token = data.readStrongBinder();
2665 boolean res = isRootVoiceInteraction(token);
2666 reply.writeNoException();
2667 reply.writeInt(res ? 1 : 0);
2668 return true;
2669 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002670
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002671 case START_BINDER_TRACKING_TRANSACTION: {
2672 data.enforceInterface(IActivityManager.descriptor);
2673 boolean res = startBinderTracking();
2674 reply.writeNoException();
2675 reply.writeInt(res ? 1 : 0);
2676 return true;
2677 }
2678
2679 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2680 data.enforceInterface(IActivityManager.descriptor);
2681 ParcelFileDescriptor fd = data.readInt() != 0
2682 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2683 boolean res = stopBinderTrackingAndDump(fd);
2684 reply.writeNoException();
2685 reply.writeInt(res ? 1 : 0);
2686 return true;
2687 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002688 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2689 data.enforceInterface(IActivityManager.descriptor);
2690 IBinder token = data.readStrongBinder();
2691 int stackId = getActivityStackId(token);
2692 reply.writeNoException();
2693 reply.writeInt(stackId);
2694 return true;
2695 }
2696 case MOVE_ACTIVITY_TO_STACK_TRANSACTION: {
2697 data.enforceInterface(IActivityManager.descriptor);
2698 IBinder token = data.readStrongBinder();
2699 int stackId = data.readInt();
2700 moveActivityToStack(token, stackId);
2701 reply.writeNoException();
2702 return true;
2703 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002704 case REPORT_SIZE_CONFIGURATIONS: {
2705 data.enforceInterface(IActivityManager.descriptor);
2706 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002707 int[] horizontal = readIntArray(data);
2708 int[] vertical = readIntArray(data);
2709 int[] smallest = readIntArray(data);
2710 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002711 return true;
2712 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002713 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2714 data.enforceInterface(IActivityManager.descriptor);
2715 final boolean suppress = data.readInt() == 1;
2716 suppressResizeConfigChanges(suppress);
2717 reply.writeNoException();
2718 return true;
2719 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002720 case REMOVE_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002721 data.enforceInterface(IActivityManager.descriptor);
2722 final int stackId = data.readInt();
2723 removeStack(stackId);
2724 reply.writeNoException();
2725 return true;
2726 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002727 case GET_APP_START_MODE_TRANSACTION: {
2728 data.enforceInterface(IActivityManager.descriptor);
2729 final int uid = data.readInt();
2730 final String pkg = data.readString();
2731 int res = getAppStartMode(uid, pkg);
2732 reply.writeNoException();
2733 reply.writeInt(res);
2734 return true;
2735 }
Wale Ogunwale5f986092015-12-04 15:35:38 -08002736 case IN_MULTI_WINDOW_MODE_TRANSACTION: {
2737 data.enforceInterface(IActivityManager.descriptor);
2738 final IBinder token = data.readStrongBinder();
2739 final boolean multiWindowMode = inMultiWindowMode(token);
2740 reply.writeNoException();
2741 reply.writeInt(multiWindowMode ? 1 : 0);
2742 return true;
2743 }
2744 case IN_PICTURE_IN_PICTURE_MODE_TRANSACTION: {
2745 data.enforceInterface(IActivityManager.descriptor);
2746 final IBinder token = data.readStrongBinder();
2747 final boolean pipMode = inPictureInPictureMode(token);
2748 reply.writeNoException();
2749 reply.writeInt(pipMode ? 1 : 0);
2750 return true;
2751 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002752 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002753
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002754 return super.onTransact(code, data, reply, flags);
2755 }
2756
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002757 private int[] readIntArray(Parcel data) {
2758 int[] smallest = null;
2759 int smallestSize = data.readInt();
2760 if (smallestSize > 0) {
2761 smallest = new int[smallestSize];
2762 data.readIntArray(smallest);
2763 }
2764 return smallest;
2765 }
2766
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002767 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002768 return this;
2769 }
2770
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002771 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2772 protected IActivityManager create() {
2773 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002774 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002775 Log.v("ActivityManager", "default service binder = " + b);
2776 }
2777 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002778 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002779 Log.v("ActivityManager", "default service = " + am);
2780 }
2781 return am;
2782 }
2783 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002784}
2785
2786class ActivityManagerProxy implements IActivityManager
2787{
2788 public ActivityManagerProxy(IBinder remote)
2789 {
2790 mRemote = remote;
2791 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002792
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002793 public IBinder asBinder()
2794 {
2795 return mRemote;
2796 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002797
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002798 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002799 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002800 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002801 Parcel data = Parcel.obtain();
2802 Parcel reply = Parcel.obtain();
2803 data.writeInterfaceToken(IActivityManager.descriptor);
2804 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002805 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002806 intent.writeToParcel(data, 0);
2807 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002808 data.writeStrongBinder(resultTo);
2809 data.writeString(resultWho);
2810 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002811 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002812 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002813 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002814 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002815 } else {
2816 data.writeInt(0);
2817 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002818 if (options != null) {
2819 data.writeInt(1);
2820 options.writeToParcel(data, 0);
2821 } else {
2822 data.writeInt(0);
2823 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002824 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2825 reply.readException();
2826 int result = reply.readInt();
2827 reply.recycle();
2828 data.recycle();
2829 return result;
2830 }
Amith Yamasani82644082012-08-03 13:09:11 -07002831
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002832 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002833 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002834 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2835 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002836 Parcel data = Parcel.obtain();
2837 Parcel reply = Parcel.obtain();
2838 data.writeInterfaceToken(IActivityManager.descriptor);
2839 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002840 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002841 intent.writeToParcel(data, 0);
2842 data.writeString(resolvedType);
2843 data.writeStrongBinder(resultTo);
2844 data.writeString(resultWho);
2845 data.writeInt(requestCode);
2846 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002847 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002848 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002849 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002850 } else {
2851 data.writeInt(0);
2852 }
2853 if (options != null) {
2854 data.writeInt(1);
2855 options.writeToParcel(data, 0);
2856 } else {
2857 data.writeInt(0);
2858 }
2859 data.writeInt(userId);
2860 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2861 reply.readException();
2862 int result = reply.readInt();
2863 reply.recycle();
2864 data.recycle();
2865 return result;
2866 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002867 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2868 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002869 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2870 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002871 Parcel data = Parcel.obtain();
2872 Parcel reply = Parcel.obtain();
2873 data.writeInterfaceToken(IActivityManager.descriptor);
2874 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2875 data.writeString(callingPackage);
2876 intent.writeToParcel(data, 0);
2877 data.writeString(resolvedType);
2878 data.writeStrongBinder(resultTo);
2879 data.writeString(resultWho);
2880 data.writeInt(requestCode);
2881 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002882 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002883 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002884 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002885 } else {
2886 data.writeInt(0);
2887 }
2888 if (options != null) {
2889 data.writeInt(1);
2890 options.writeToParcel(data, 0);
2891 } else {
2892 data.writeInt(0);
2893 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002894 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002895 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002896 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2897 reply.readException();
2898 int result = reply.readInt();
2899 reply.recycle();
2900 data.recycle();
2901 return result;
2902 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002903 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2904 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002905 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2906 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002907 Parcel data = Parcel.obtain();
2908 Parcel reply = Parcel.obtain();
2909 data.writeInterfaceToken(IActivityManager.descriptor);
2910 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002911 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002912 intent.writeToParcel(data, 0);
2913 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002914 data.writeStrongBinder(resultTo);
2915 data.writeString(resultWho);
2916 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002917 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002918 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002919 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002920 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002921 } else {
2922 data.writeInt(0);
2923 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002924 if (options != null) {
2925 data.writeInt(1);
2926 options.writeToParcel(data, 0);
2927 } else {
2928 data.writeInt(0);
2929 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002930 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002931 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2932 reply.readException();
2933 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2934 reply.recycle();
2935 data.recycle();
2936 return result;
2937 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002938 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2939 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002940 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002941 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002942 Parcel data = Parcel.obtain();
2943 Parcel reply = Parcel.obtain();
2944 data.writeInterfaceToken(IActivityManager.descriptor);
2945 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002946 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002947 intent.writeToParcel(data, 0);
2948 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002949 data.writeStrongBinder(resultTo);
2950 data.writeString(resultWho);
2951 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002952 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002953 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002954 if (options != null) {
2955 data.writeInt(1);
2956 options.writeToParcel(data, 0);
2957 } else {
2958 data.writeInt(0);
2959 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002960 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002961 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2962 reply.readException();
2963 int result = reply.readInt();
2964 reply.recycle();
2965 data.recycle();
2966 return result;
2967 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002968 public int startActivityIntentSender(IApplicationThread caller,
2969 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002970 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002971 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002972 Parcel data = Parcel.obtain();
2973 Parcel reply = Parcel.obtain();
2974 data.writeInterfaceToken(IActivityManager.descriptor);
2975 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2976 intent.writeToParcel(data, 0);
2977 if (fillInIntent != null) {
2978 data.writeInt(1);
2979 fillInIntent.writeToParcel(data, 0);
2980 } else {
2981 data.writeInt(0);
2982 }
2983 data.writeString(resolvedType);
2984 data.writeStrongBinder(resultTo);
2985 data.writeString(resultWho);
2986 data.writeInt(requestCode);
2987 data.writeInt(flagsMask);
2988 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002989 if (options != null) {
2990 data.writeInt(1);
2991 options.writeToParcel(data, 0);
2992 } else {
2993 data.writeInt(0);
2994 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002995 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002996 reply.readException();
2997 int result = reply.readInt();
2998 reply.recycle();
2999 data.recycle();
3000 return result;
3001 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07003002 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
3003 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07003004 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
3005 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003006 Parcel data = Parcel.obtain();
3007 Parcel reply = Parcel.obtain();
3008 data.writeInterfaceToken(IActivityManager.descriptor);
3009 data.writeString(callingPackage);
3010 data.writeInt(callingPid);
3011 data.writeInt(callingUid);
3012 intent.writeToParcel(data, 0);
3013 data.writeString(resolvedType);
3014 data.writeStrongBinder(session.asBinder());
3015 data.writeStrongBinder(interactor.asBinder());
3016 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003017 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003018 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003019 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07003020 } else {
3021 data.writeInt(0);
3022 }
3023 if (options != null) {
3024 data.writeInt(1);
3025 options.writeToParcel(data, 0);
3026 } else {
3027 data.writeInt(0);
3028 }
3029 data.writeInt(userId);
3030 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3031 reply.readException();
3032 int result = reply.readInt();
3033 reply.recycle();
3034 data.recycle();
3035 return result;
3036 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003037 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003038 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003039 Parcel data = Parcel.obtain();
3040 Parcel reply = Parcel.obtain();
3041 data.writeInterfaceToken(IActivityManager.descriptor);
3042 data.writeStrongBinder(callingActivity);
3043 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003044 if (options != null) {
3045 data.writeInt(1);
3046 options.writeToParcel(data, 0);
3047 } else {
3048 data.writeInt(0);
3049 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003050 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3051 reply.readException();
3052 int result = reply.readInt();
3053 reply.recycle();
3054 data.recycle();
3055 return result != 0;
3056 }
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003057 public int startActivityFromRecents(int taskId, int launchStackId, Bundle options)
3058 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003059 Parcel data = Parcel.obtain();
3060 Parcel reply = Parcel.obtain();
3061 data.writeInterfaceToken(IActivityManager.descriptor);
3062 data.writeInt(taskId);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003063 data.writeInt(launchStackId);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003064 if (options == null) {
3065 data.writeInt(0);
3066 } else {
3067 data.writeInt(1);
3068 options.writeToParcel(data, 0);
3069 }
3070 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3071 reply.readException();
3072 int result = reply.readInt();
3073 reply.recycle();
3074 data.recycle();
3075 return result;
3076 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003077 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003078 throws RemoteException {
3079 Parcel data = Parcel.obtain();
3080 Parcel reply = Parcel.obtain();
3081 data.writeInterfaceToken(IActivityManager.descriptor);
3082 data.writeStrongBinder(token);
3083 data.writeInt(resultCode);
3084 if (resultData != null) {
3085 data.writeInt(1);
3086 resultData.writeToParcel(data, 0);
3087 } else {
3088 data.writeInt(0);
3089 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003090 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003091 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3092 reply.readException();
3093 boolean res = reply.readInt() != 0;
3094 data.recycle();
3095 reply.recycle();
3096 return res;
3097 }
3098 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3099 {
3100 Parcel data = Parcel.obtain();
3101 Parcel reply = Parcel.obtain();
3102 data.writeInterfaceToken(IActivityManager.descriptor);
3103 data.writeStrongBinder(token);
3104 data.writeString(resultWho);
3105 data.writeInt(requestCode);
3106 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3107 reply.readException();
3108 data.recycle();
3109 reply.recycle();
3110 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003111 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3112 Parcel data = Parcel.obtain();
3113 Parcel reply = Parcel.obtain();
3114 data.writeInterfaceToken(IActivityManager.descriptor);
3115 data.writeStrongBinder(token);
3116 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3117 reply.readException();
3118 boolean res = reply.readInt() != 0;
3119 data.recycle();
3120 reply.recycle();
3121 return res;
3122 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003123 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3124 Parcel data = Parcel.obtain();
3125 Parcel reply = Parcel.obtain();
3126 data.writeInterfaceToken(IActivityManager.descriptor);
3127 data.writeStrongBinder(session.asBinder());
3128 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3129 reply.readException();
3130 data.recycle();
3131 reply.recycle();
3132 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003133 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3134 Parcel data = Parcel.obtain();
3135 Parcel reply = Parcel.obtain();
3136 data.writeInterfaceToken(IActivityManager.descriptor);
3137 data.writeStrongBinder(token);
3138 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3139 reply.readException();
3140 boolean res = reply.readInt() != 0;
3141 data.recycle();
3142 reply.recycle();
3143 return res;
3144 }
3145 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3146 Parcel data = Parcel.obtain();
3147 Parcel reply = Parcel.obtain();
3148 data.writeInterfaceToken(IActivityManager.descriptor);
3149 data.writeStrongBinder(app.asBinder());
3150 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3151 reply.readException();
3152 data.recycle();
3153 reply.recycle();
3154 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003155 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3156 Parcel data = Parcel.obtain();
3157 Parcel reply = Parcel.obtain();
3158 data.writeInterfaceToken(IActivityManager.descriptor);
3159 data.writeStrongBinder(token);
3160 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3161 reply.readException();
3162 boolean res = reply.readInt() != 0;
3163 data.recycle();
3164 reply.recycle();
3165 return res;
3166 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003167 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003168 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003169 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003170 {
3171 Parcel data = Parcel.obtain();
3172 Parcel reply = Parcel.obtain();
3173 data.writeInterfaceToken(IActivityManager.descriptor);
3174 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003175 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003176 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3177 filter.writeToParcel(data, 0);
3178 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003179 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003180 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3181 reply.readException();
3182 Intent intent = null;
3183 int haveIntent = reply.readInt();
3184 if (haveIntent != 0) {
3185 intent = Intent.CREATOR.createFromParcel(reply);
3186 }
3187 reply.recycle();
3188 data.recycle();
3189 return intent;
3190 }
3191 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3192 {
3193 Parcel data = Parcel.obtain();
3194 Parcel reply = Parcel.obtain();
3195 data.writeInterfaceToken(IActivityManager.descriptor);
3196 data.writeStrongBinder(receiver.asBinder());
3197 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3198 reply.readException();
3199 data.recycle();
3200 reply.recycle();
3201 }
3202 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003203 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003204 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003205 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003206 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003207 {
3208 Parcel data = Parcel.obtain();
3209 Parcel reply = Parcel.obtain();
3210 data.writeInterfaceToken(IActivityManager.descriptor);
3211 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3212 intent.writeToParcel(data, 0);
3213 data.writeString(resolvedType);
3214 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3215 data.writeInt(resultCode);
3216 data.writeString(resultData);
3217 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003218 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003219 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003220 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003221 data.writeInt(serialized ? 1 : 0);
3222 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003223 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003224 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3225 reply.readException();
3226 int res = reply.readInt();
3227 reply.recycle();
3228 data.recycle();
3229 return res;
3230 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003231 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3232 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003233 {
3234 Parcel data = Parcel.obtain();
3235 Parcel reply = Parcel.obtain();
3236 data.writeInterfaceToken(IActivityManager.descriptor);
3237 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3238 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003239 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003240 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3241 reply.readException();
3242 data.recycle();
3243 reply.recycle();
3244 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003245 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3246 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003247 {
3248 Parcel data = Parcel.obtain();
3249 Parcel reply = Parcel.obtain();
3250 data.writeInterfaceToken(IActivityManager.descriptor);
3251 data.writeStrongBinder(who);
3252 data.writeInt(resultCode);
3253 data.writeString(resultData);
3254 data.writeBundle(map);
3255 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003256 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003257 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3258 reply.readException();
3259 data.recycle();
3260 reply.recycle();
3261 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003262 public void attachApplication(IApplicationThread app) throws RemoteException
3263 {
3264 Parcel data = Parcel.obtain();
3265 Parcel reply = Parcel.obtain();
3266 data.writeInterfaceToken(IActivityManager.descriptor);
3267 data.writeStrongBinder(app.asBinder());
3268 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3269 reply.readException();
3270 data.recycle();
3271 reply.recycle();
3272 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003273 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3274 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003275 {
3276 Parcel data = Parcel.obtain();
3277 Parcel reply = Parcel.obtain();
3278 data.writeInterfaceToken(IActivityManager.descriptor);
3279 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003280 if (config != null) {
3281 data.writeInt(1);
3282 config.writeToParcel(data, 0);
3283 } else {
3284 data.writeInt(0);
3285 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003286 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003287 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3288 reply.readException();
3289 data.recycle();
3290 reply.recycle();
3291 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003292 public void activityResumed(IBinder token) throws RemoteException
3293 {
3294 Parcel data = Parcel.obtain();
3295 Parcel reply = Parcel.obtain();
3296 data.writeInterfaceToken(IActivityManager.descriptor);
3297 data.writeStrongBinder(token);
3298 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3299 reply.readException();
3300 data.recycle();
3301 reply.recycle();
3302 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003303 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003304 {
3305 Parcel data = Parcel.obtain();
3306 Parcel reply = Parcel.obtain();
3307 data.writeInterfaceToken(IActivityManager.descriptor);
3308 data.writeStrongBinder(token);
3309 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3310 reply.readException();
3311 data.recycle();
3312 reply.recycle();
3313 }
3314 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003315 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003316 {
3317 Parcel data = Parcel.obtain();
3318 Parcel reply = Parcel.obtain();
3319 data.writeInterfaceToken(IActivityManager.descriptor);
3320 data.writeStrongBinder(token);
3321 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003322 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003323 TextUtils.writeToParcel(description, data, 0);
3324 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3325 reply.readException();
3326 data.recycle();
3327 reply.recycle();
3328 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003329 public void activitySlept(IBinder token) throws RemoteException
3330 {
3331 Parcel data = Parcel.obtain();
3332 Parcel reply = Parcel.obtain();
3333 data.writeInterfaceToken(IActivityManager.descriptor);
3334 data.writeStrongBinder(token);
3335 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3336 reply.readException();
3337 data.recycle();
3338 reply.recycle();
3339 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003340 public void activityDestroyed(IBinder token) throws RemoteException
3341 {
3342 Parcel data = Parcel.obtain();
3343 Parcel reply = Parcel.obtain();
3344 data.writeInterfaceToken(IActivityManager.descriptor);
3345 data.writeStrongBinder(token);
3346 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3347 reply.readException();
3348 data.recycle();
3349 reply.recycle();
3350 }
3351 public String getCallingPackage(IBinder token) throws RemoteException
3352 {
3353 Parcel data = Parcel.obtain();
3354 Parcel reply = Parcel.obtain();
3355 data.writeInterfaceToken(IActivityManager.descriptor);
3356 data.writeStrongBinder(token);
3357 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3358 reply.readException();
3359 String res = reply.readString();
3360 data.recycle();
3361 reply.recycle();
3362 return res;
3363 }
3364 public ComponentName getCallingActivity(IBinder token)
3365 throws RemoteException {
3366 Parcel data = Parcel.obtain();
3367 Parcel reply = Parcel.obtain();
3368 data.writeInterfaceToken(IActivityManager.descriptor);
3369 data.writeStrongBinder(token);
3370 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3371 reply.readException();
3372 ComponentName res = ComponentName.readFromParcel(reply);
3373 data.recycle();
3374 reply.recycle();
3375 return res;
3376 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003377 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003378 Parcel data = Parcel.obtain();
3379 Parcel reply = Parcel.obtain();
3380 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003381 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003382 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3383 reply.readException();
3384 ArrayList<IAppTask> list = null;
3385 int N = reply.readInt();
3386 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003387 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003388 while (N > 0) {
3389 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3390 list.add(task);
3391 N--;
3392 }
3393 }
3394 data.recycle();
3395 reply.recycle();
3396 return list;
3397 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003398 public int addAppTask(IBinder activityToken, Intent intent,
3399 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3400 Parcel data = Parcel.obtain();
3401 Parcel reply = Parcel.obtain();
3402 data.writeInterfaceToken(IActivityManager.descriptor);
3403 data.writeStrongBinder(activityToken);
3404 intent.writeToParcel(data, 0);
3405 description.writeToParcel(data, 0);
3406 thumbnail.writeToParcel(data, 0);
3407 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3408 reply.readException();
3409 int res = reply.readInt();
3410 data.recycle();
3411 reply.recycle();
3412 return res;
3413 }
3414 public Point getAppTaskThumbnailSize() throws RemoteException {
3415 Parcel data = Parcel.obtain();
3416 Parcel reply = Parcel.obtain();
3417 data.writeInterfaceToken(IActivityManager.descriptor);
3418 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3419 reply.readException();
3420 Point size = Point.CREATOR.createFromParcel(reply);
3421 data.recycle();
3422 reply.recycle();
3423 return size;
3424 }
Todd Kennedye635f662015-01-20 10:36:49 -08003425 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3426 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003427 Parcel data = Parcel.obtain();
3428 Parcel reply = Parcel.obtain();
3429 data.writeInterfaceToken(IActivityManager.descriptor);
3430 data.writeInt(maxNum);
3431 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003432 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3433 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003434 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003435 int N = reply.readInt();
3436 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003437 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003438 while (N > 0) {
3439 ActivityManager.RunningTaskInfo info =
3440 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003441 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003442 list.add(info);
3443 N--;
3444 }
3445 }
3446 data.recycle();
3447 reply.recycle();
3448 return list;
3449 }
3450 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003451 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003452 Parcel data = Parcel.obtain();
3453 Parcel reply = Parcel.obtain();
3454 data.writeInterfaceToken(IActivityManager.descriptor);
3455 data.writeInt(maxNum);
3456 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003457 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003458 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3459 reply.readException();
3460 ArrayList<ActivityManager.RecentTaskInfo> list
3461 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3462 data.recycle();
3463 reply.recycle();
3464 return list;
3465 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003466 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003467 Parcel data = Parcel.obtain();
3468 Parcel reply = Parcel.obtain();
3469 data.writeInterfaceToken(IActivityManager.descriptor);
3470 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003471 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003472 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003473 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003474 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003475 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003476 }
3477 data.recycle();
3478 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003479 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003480 }
Todd Kennedye635f662015-01-20 10:36:49 -08003481 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3482 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003483 Parcel data = Parcel.obtain();
3484 Parcel reply = Parcel.obtain();
3485 data.writeInterfaceToken(IActivityManager.descriptor);
3486 data.writeInt(maxNum);
3487 data.writeInt(flags);
3488 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3489 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003490 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003491 int N = reply.readInt();
3492 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003493 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003494 while (N > 0) {
3495 ActivityManager.RunningServiceInfo info =
3496 ActivityManager.RunningServiceInfo.CREATOR
3497 .createFromParcel(reply);
3498 list.add(info);
3499 N--;
3500 }
3501 }
3502 data.recycle();
3503 reply.recycle();
3504 return list;
3505 }
3506 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3507 throws RemoteException {
3508 Parcel data = Parcel.obtain();
3509 Parcel reply = Parcel.obtain();
3510 data.writeInterfaceToken(IActivityManager.descriptor);
3511 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3512 reply.readException();
3513 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3514 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3515 data.recycle();
3516 reply.recycle();
3517 return list;
3518 }
3519 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3520 throws RemoteException {
3521 Parcel data = Parcel.obtain();
3522 Parcel reply = Parcel.obtain();
3523 data.writeInterfaceToken(IActivityManager.descriptor);
3524 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3525 reply.readException();
3526 ArrayList<ActivityManager.RunningAppProcessInfo> list
3527 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3528 data.recycle();
3529 reply.recycle();
3530 return list;
3531 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003532 public List<ApplicationInfo> getRunningExternalApplications()
3533 throws RemoteException {
3534 Parcel data = Parcel.obtain();
3535 Parcel reply = Parcel.obtain();
3536 data.writeInterfaceToken(IActivityManager.descriptor);
3537 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3538 reply.readException();
3539 ArrayList<ApplicationInfo> list
3540 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3541 data.recycle();
3542 reply.recycle();
3543 return list;
3544 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003545 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003546 {
3547 Parcel data = Parcel.obtain();
3548 Parcel reply = Parcel.obtain();
3549 data.writeInterfaceToken(IActivityManager.descriptor);
3550 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003551 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003552 if (options != null) {
3553 data.writeInt(1);
3554 options.writeToParcel(data, 0);
3555 } else {
3556 data.writeInt(0);
3557 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003558 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3559 reply.readException();
3560 data.recycle();
3561 reply.recycle();
3562 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003563 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3564 throws RemoteException {
3565 Parcel data = Parcel.obtain();
3566 Parcel reply = Parcel.obtain();
3567 data.writeInterfaceToken(IActivityManager.descriptor);
3568 data.writeStrongBinder(token);
3569 data.writeInt(nonRoot ? 1 : 0);
3570 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3571 reply.readException();
3572 boolean res = reply.readInt() != 0;
3573 data.recycle();
3574 reply.recycle();
3575 return res;
3576 }
3577 public void moveTaskBackwards(int task) throws RemoteException
3578 {
3579 Parcel data = Parcel.obtain();
3580 Parcel reply = Parcel.obtain();
3581 data.writeInterfaceToken(IActivityManager.descriptor);
3582 data.writeInt(task);
3583 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3584 reply.readException();
3585 data.recycle();
3586 reply.recycle();
3587 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003588 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003589 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3590 {
3591 Parcel data = Parcel.obtain();
3592 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003593 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003594 data.writeInt(taskId);
3595 data.writeInt(stackId);
3596 data.writeInt(toTop ? 1 : 0);
3597 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3598 reply.readException();
3599 data.recycle();
3600 reply.recycle();
3601 }
3602 @Override
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003603 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
3604 Rect initialBounds) throws RemoteException
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003605 {
3606 Parcel data = Parcel.obtain();
3607 Parcel reply = Parcel.obtain();
3608 data.writeInterfaceToken(IActivityManager.descriptor);
3609 data.writeInt(taskId);
3610 data.writeInt(createMode);
3611 data.writeInt(toTop ? 1 : 0);
Jorim Jaggi030979c2015-11-20 15:14:43 -08003612 data.writeInt(animate ? 1 : 0);
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003613 if (initialBounds != null) {
3614 data.writeInt(1);
3615 initialBounds.writeToParcel(data, 0);
3616 } else {
3617 data.writeInt(0);
3618 }
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003619 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3620 reply.readException();
3621 data.recycle();
3622 reply.recycle();
3623 }
3624 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003625 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3626 throws RemoteException
3627 {
3628 Parcel data = Parcel.obtain();
3629 Parcel reply = Parcel.obtain();
3630 data.writeInterfaceToken(IActivityManager.descriptor);
3631 data.writeInt(stackId);
3632 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003633 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003634 reply.readException();
3635 final boolean res = reply.readInt() != 0;
3636 data.recycle();
3637 reply.recycle();
3638 return res;
3639 }
3640 @Override
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003641 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode)
3642 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003643 {
3644 Parcel data = Parcel.obtain();
3645 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003646 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003647 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003648 if (r != null) {
3649 data.writeInt(1);
3650 r.writeToParcel(data, 0);
3651 } else {
3652 data.writeInt(0);
3653 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003654 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003655 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003656 reply.readException();
3657 data.recycle();
3658 reply.recycle();
3659 }
Craig Mautner967212c2013-04-13 21:10:58 -07003660 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003661 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3662 {
3663 Parcel data = Parcel.obtain();
3664 Parcel reply = Parcel.obtain();
3665 data.writeInterfaceToken(IActivityManager.descriptor);
3666 data.writeInt(taskId);
3667 data.writeInt(stackId);
3668 data.writeInt(position);
3669 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3670 reply.readException();
3671 data.recycle();
3672 reply.recycle();
3673 }
3674 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003675 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003676 {
3677 Parcel data = Parcel.obtain();
3678 Parcel reply = Parcel.obtain();
3679 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003680 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003681 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003682 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003683 data.recycle();
3684 reply.recycle();
3685 return list;
3686 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003687 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003688 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003689 {
3690 Parcel data = Parcel.obtain();
3691 Parcel reply = Parcel.obtain();
3692 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003693 data.writeInt(stackId);
3694 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003695 reply.readException();
3696 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003697 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003698 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003699 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003700 }
3701 data.recycle();
3702 reply.recycle();
3703 return info;
3704 }
3705 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003706 public boolean isInHomeStack(int taskId) throws RemoteException {
3707 Parcel data = Parcel.obtain();
3708 Parcel reply = Parcel.obtain();
3709 data.writeInterfaceToken(IActivityManager.descriptor);
3710 data.writeInt(taskId);
3711 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3712 reply.readException();
3713 boolean isInHomeStack = reply.readInt() > 0;
3714 data.recycle();
3715 reply.recycle();
3716 return isInHomeStack;
3717 }
3718 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003719 public void setFocusedStack(int stackId) throws RemoteException
3720 {
3721 Parcel data = Parcel.obtain();
3722 Parcel reply = Parcel.obtain();
3723 data.writeInterfaceToken(IActivityManager.descriptor);
3724 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003725 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003726 reply.readException();
3727 data.recycle();
3728 reply.recycle();
3729 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003730 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003731 public int getFocusedStackId() throws RemoteException {
3732 Parcel data = Parcel.obtain();
3733 Parcel reply = Parcel.obtain();
3734 data.writeInterfaceToken(IActivityManager.descriptor);
3735 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3736 reply.readException();
3737 int focusedStackId = reply.readInt();
3738 data.recycle();
3739 reply.recycle();
3740 return focusedStackId;
3741 }
3742 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003743 public void setFocusedTask(int taskId) throws RemoteException
3744 {
3745 Parcel data = Parcel.obtain();
3746 Parcel reply = Parcel.obtain();
3747 data.writeInterfaceToken(IActivityManager.descriptor);
3748 data.writeInt(taskId);
3749 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3750 reply.readException();
3751 data.recycle();
3752 reply.recycle();
3753 }
3754 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003755 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3756 {
3757 Parcel data = Parcel.obtain();
3758 Parcel reply = Parcel.obtain();
3759 data.writeInterfaceToken(IActivityManager.descriptor);
3760 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003761 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003762 reply.readException();
3763 data.recycle();
3764 reply.recycle();
3765 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003766 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3767 {
3768 Parcel data = Parcel.obtain();
3769 Parcel reply = Parcel.obtain();
3770 data.writeInterfaceToken(IActivityManager.descriptor);
3771 data.writeStrongBinder(token);
3772 data.writeInt(onlyRoot ? 1 : 0);
3773 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3774 reply.readException();
3775 int res = reply.readInt();
3776 data.recycle();
3777 reply.recycle();
3778 return res;
3779 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003780 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003781 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003782 Parcel data = Parcel.obtain();
3783 Parcel reply = Parcel.obtain();
3784 data.writeInterfaceToken(IActivityManager.descriptor);
3785 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3786 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003787 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003788 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003789 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3790 reply.readException();
3791 int res = reply.readInt();
3792 ContentProviderHolder cph = null;
3793 if (res != 0) {
3794 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3795 }
3796 data.recycle();
3797 reply.recycle();
3798 return cph;
3799 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003800 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3801 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003802 Parcel data = Parcel.obtain();
3803 Parcel reply = Parcel.obtain();
3804 data.writeInterfaceToken(IActivityManager.descriptor);
3805 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003806 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003807 data.writeStrongBinder(token);
3808 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3809 reply.readException();
3810 int res = reply.readInt();
3811 ContentProviderHolder cph = null;
3812 if (res != 0) {
3813 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3814 }
3815 data.recycle();
3816 reply.recycle();
3817 return cph;
3818 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003819 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003820 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003821 {
3822 Parcel data = Parcel.obtain();
3823 Parcel reply = Parcel.obtain();
3824 data.writeInterfaceToken(IActivityManager.descriptor);
3825 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3826 data.writeTypedList(providers);
3827 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3828 reply.readException();
3829 data.recycle();
3830 reply.recycle();
3831 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003832 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3833 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003834 Parcel data = Parcel.obtain();
3835 Parcel reply = Parcel.obtain();
3836 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003837 data.writeStrongBinder(connection);
3838 data.writeInt(stable);
3839 data.writeInt(unstable);
3840 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3841 reply.readException();
3842 boolean res = reply.readInt() != 0;
3843 data.recycle();
3844 reply.recycle();
3845 return res;
3846 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003847
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003848 public void unstableProviderDied(IBinder connection) throws RemoteException {
3849 Parcel data = Parcel.obtain();
3850 Parcel reply = Parcel.obtain();
3851 data.writeInterfaceToken(IActivityManager.descriptor);
3852 data.writeStrongBinder(connection);
3853 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3854 reply.readException();
3855 data.recycle();
3856 reply.recycle();
3857 }
3858
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003859 @Override
3860 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3861 Parcel data = Parcel.obtain();
3862 Parcel reply = Parcel.obtain();
3863 data.writeInterfaceToken(IActivityManager.descriptor);
3864 data.writeStrongBinder(connection);
3865 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3866 reply.readException();
3867 data.recycle();
3868 reply.recycle();
3869 }
3870
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003871 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3872 Parcel data = Parcel.obtain();
3873 Parcel reply = Parcel.obtain();
3874 data.writeInterfaceToken(IActivityManager.descriptor);
3875 data.writeStrongBinder(connection);
3876 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003877 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3878 reply.readException();
3879 data.recycle();
3880 reply.recycle();
3881 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003882
3883 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3884 Parcel data = Parcel.obtain();
3885 Parcel reply = Parcel.obtain();
3886 data.writeInterfaceToken(IActivityManager.descriptor);
3887 data.writeString(name);
3888 data.writeStrongBinder(token);
3889 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3890 reply.readException();
3891 data.recycle();
3892 reply.recycle();
3893 }
3894
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003895 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3896 throws RemoteException
3897 {
3898 Parcel data = Parcel.obtain();
3899 Parcel reply = Parcel.obtain();
3900 data.writeInterfaceToken(IActivityManager.descriptor);
3901 service.writeToParcel(data, 0);
3902 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3903 reply.readException();
3904 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3905 data.recycle();
3906 reply.recycle();
3907 return res;
3908 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003909
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003910 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003911 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003912 {
3913 Parcel data = Parcel.obtain();
3914 Parcel reply = Parcel.obtain();
3915 data.writeInterfaceToken(IActivityManager.descriptor);
3916 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3917 service.writeToParcel(data, 0);
3918 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003919 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003920 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003921 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3922 reply.readException();
3923 ComponentName res = ComponentName.readFromParcel(reply);
3924 data.recycle();
3925 reply.recycle();
3926 return res;
3927 }
3928 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003929 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003930 {
3931 Parcel data = Parcel.obtain();
3932 Parcel reply = Parcel.obtain();
3933 data.writeInterfaceToken(IActivityManager.descriptor);
3934 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3935 service.writeToParcel(data, 0);
3936 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003937 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003938 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3939 reply.readException();
3940 int res = reply.readInt();
3941 reply.recycle();
3942 data.recycle();
3943 return res;
3944 }
3945 public boolean stopServiceToken(ComponentName className, IBinder token,
3946 int startId) throws RemoteException {
3947 Parcel data = Parcel.obtain();
3948 Parcel reply = Parcel.obtain();
3949 data.writeInterfaceToken(IActivityManager.descriptor);
3950 ComponentName.writeToParcel(className, data);
3951 data.writeStrongBinder(token);
3952 data.writeInt(startId);
3953 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3954 reply.readException();
3955 boolean res = reply.readInt() != 0;
3956 data.recycle();
3957 reply.recycle();
3958 return res;
3959 }
3960 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003961 int id, Notification notification, boolean removeNotification) 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);
3965 ComponentName.writeToParcel(className, data);
3966 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003967 data.writeInt(id);
3968 if (notification != null) {
3969 data.writeInt(1);
3970 notification.writeToParcel(data, 0);
3971 } else {
3972 data.writeInt(0);
3973 }
3974 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003975 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3976 reply.readException();
3977 data.recycle();
3978 reply.recycle();
3979 }
3980 public int bindService(IApplicationThread caller, IBinder token,
3981 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07003982 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003983 Parcel data = Parcel.obtain();
3984 Parcel reply = Parcel.obtain();
3985 data.writeInterfaceToken(IActivityManager.descriptor);
3986 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3987 data.writeStrongBinder(token);
3988 service.writeToParcel(data, 0);
3989 data.writeString(resolvedType);
3990 data.writeStrongBinder(connection.asBinder());
3991 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07003992 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003993 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003994 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3995 reply.readException();
3996 int res = reply.readInt();
3997 data.recycle();
3998 reply.recycle();
3999 return res;
4000 }
4001 public boolean unbindService(IServiceConnection connection) throws RemoteException
4002 {
4003 Parcel data = Parcel.obtain();
4004 Parcel reply = Parcel.obtain();
4005 data.writeInterfaceToken(IActivityManager.descriptor);
4006 data.writeStrongBinder(connection.asBinder());
4007 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
4008 reply.readException();
4009 boolean res = reply.readInt() != 0;
4010 data.recycle();
4011 reply.recycle();
4012 return res;
4013 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004014
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004015 public void publishService(IBinder token,
4016 Intent intent, IBinder service) throws RemoteException {
4017 Parcel data = Parcel.obtain();
4018 Parcel reply = Parcel.obtain();
4019 data.writeInterfaceToken(IActivityManager.descriptor);
4020 data.writeStrongBinder(token);
4021 intent.writeToParcel(data, 0);
4022 data.writeStrongBinder(service);
4023 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
4024 reply.readException();
4025 data.recycle();
4026 reply.recycle();
4027 }
4028
4029 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
4030 throws RemoteException {
4031 Parcel data = Parcel.obtain();
4032 Parcel reply = Parcel.obtain();
4033 data.writeInterfaceToken(IActivityManager.descriptor);
4034 data.writeStrongBinder(token);
4035 intent.writeToParcel(data, 0);
4036 data.writeInt(doRebind ? 1 : 0);
4037 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4038 reply.readException();
4039 data.recycle();
4040 reply.recycle();
4041 }
4042
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004043 public void serviceDoneExecuting(IBinder token, int type, int startId,
4044 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004045 Parcel data = Parcel.obtain();
4046 Parcel reply = Parcel.obtain();
4047 data.writeInterfaceToken(IActivityManager.descriptor);
4048 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004049 data.writeInt(type);
4050 data.writeInt(startId);
4051 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004052 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4053 reply.readException();
4054 data.recycle();
4055 reply.recycle();
4056 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004057
Svet Ganov99b60432015-06-27 13:15:22 -07004058 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4059 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004060 Parcel data = Parcel.obtain();
4061 Parcel reply = Parcel.obtain();
4062 data.writeInterfaceToken(IActivityManager.descriptor);
4063 service.writeToParcel(data, 0);
4064 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004065 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004066 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4067 reply.readException();
4068 IBinder binder = reply.readStrongBinder();
4069 reply.recycle();
4070 data.recycle();
4071 return binder;
4072 }
4073
Christopher Tate181fafa2009-05-14 11:12:14 -07004074 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4075 throws RemoteException {
4076 Parcel data = Parcel.obtain();
4077 Parcel reply = Parcel.obtain();
4078 data.writeInterfaceToken(IActivityManager.descriptor);
4079 app.writeToParcel(data, 0);
4080 data.writeInt(backupRestoreMode);
4081 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4082 reply.readException();
4083 boolean success = reply.readInt() != 0;
4084 reply.recycle();
4085 data.recycle();
4086 return success;
4087 }
4088
Christopher Tate346acb12012-10-15 19:20:25 -07004089 public void clearPendingBackup() throws RemoteException {
4090 Parcel data = Parcel.obtain();
4091 Parcel reply = Parcel.obtain();
4092 data.writeInterfaceToken(IActivityManager.descriptor);
4093 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4094 reply.recycle();
4095 data.recycle();
4096 }
4097
Christopher Tate181fafa2009-05-14 11:12:14 -07004098 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4099 Parcel data = Parcel.obtain();
4100 Parcel reply = Parcel.obtain();
4101 data.writeInterfaceToken(IActivityManager.descriptor);
4102 data.writeString(packageName);
4103 data.writeStrongBinder(agent);
4104 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4105 reply.recycle();
4106 data.recycle();
4107 }
4108
4109 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4110 Parcel data = Parcel.obtain();
4111 Parcel reply = Parcel.obtain();
4112 data.writeInterfaceToken(IActivityManager.descriptor);
4113 app.writeToParcel(data, 0);
4114 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4115 reply.readException();
4116 reply.recycle();
4117 data.recycle();
4118 }
4119
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004120 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004121 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004122 IUiAutomationConnection connection, int userId, String instructionSet)
4123 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004124 Parcel data = Parcel.obtain();
4125 Parcel reply = Parcel.obtain();
4126 data.writeInterfaceToken(IActivityManager.descriptor);
4127 ComponentName.writeToParcel(className, data);
4128 data.writeString(profileFile);
4129 data.writeInt(flags);
4130 data.writeBundle(arguments);
4131 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004132 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004133 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004134 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004135 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4136 reply.readException();
4137 boolean res = reply.readInt() != 0;
4138 reply.recycle();
4139 data.recycle();
4140 return res;
4141 }
4142
4143 public void finishInstrumentation(IApplicationThread target,
4144 int resultCode, Bundle results) throws RemoteException {
4145 Parcel data = Parcel.obtain();
4146 Parcel reply = Parcel.obtain();
4147 data.writeInterfaceToken(IActivityManager.descriptor);
4148 data.writeStrongBinder(target != null ? target.asBinder() : null);
4149 data.writeInt(resultCode);
4150 data.writeBundle(results);
4151 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4152 reply.readException();
4153 data.recycle();
4154 reply.recycle();
4155 }
4156 public Configuration getConfiguration() throws RemoteException
4157 {
4158 Parcel data = Parcel.obtain();
4159 Parcel reply = Parcel.obtain();
4160 data.writeInterfaceToken(IActivityManager.descriptor);
4161 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4162 reply.readException();
4163 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4164 reply.recycle();
4165 data.recycle();
4166 return res;
4167 }
4168 public void updateConfiguration(Configuration values) throws RemoteException
4169 {
4170 Parcel data = Parcel.obtain();
4171 Parcel reply = Parcel.obtain();
4172 data.writeInterfaceToken(IActivityManager.descriptor);
4173 values.writeToParcel(data, 0);
4174 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4175 reply.readException();
4176 data.recycle();
4177 reply.recycle();
4178 }
4179 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4180 throws RemoteException {
4181 Parcel data = Parcel.obtain();
4182 Parcel reply = Parcel.obtain();
4183 data.writeInterfaceToken(IActivityManager.descriptor);
4184 data.writeStrongBinder(token);
4185 data.writeInt(requestedOrientation);
4186 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4187 reply.readException();
4188 data.recycle();
4189 reply.recycle();
4190 }
4191 public int getRequestedOrientation(IBinder token) throws RemoteException {
4192 Parcel data = Parcel.obtain();
4193 Parcel reply = Parcel.obtain();
4194 data.writeInterfaceToken(IActivityManager.descriptor);
4195 data.writeStrongBinder(token);
4196 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4197 reply.readException();
4198 int res = reply.readInt();
4199 data.recycle();
4200 reply.recycle();
4201 return res;
4202 }
4203 public ComponentName getActivityClassForToken(IBinder token)
4204 throws RemoteException {
4205 Parcel data = Parcel.obtain();
4206 Parcel reply = Parcel.obtain();
4207 data.writeInterfaceToken(IActivityManager.descriptor);
4208 data.writeStrongBinder(token);
4209 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4210 reply.readException();
4211 ComponentName res = ComponentName.readFromParcel(reply);
4212 data.recycle();
4213 reply.recycle();
4214 return res;
4215 }
4216 public String getPackageForToken(IBinder token) throws RemoteException
4217 {
4218 Parcel data = Parcel.obtain();
4219 Parcel reply = Parcel.obtain();
4220 data.writeInterfaceToken(IActivityManager.descriptor);
4221 data.writeStrongBinder(token);
4222 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4223 reply.readException();
4224 String res = reply.readString();
4225 data.recycle();
4226 reply.recycle();
4227 return res;
4228 }
4229 public IIntentSender getIntentSender(int type,
4230 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004231 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004232 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004233 Parcel data = Parcel.obtain();
4234 Parcel reply = Parcel.obtain();
4235 data.writeInterfaceToken(IActivityManager.descriptor);
4236 data.writeInt(type);
4237 data.writeString(packageName);
4238 data.writeStrongBinder(token);
4239 data.writeString(resultWho);
4240 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004241 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004242 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004243 data.writeTypedArray(intents, 0);
4244 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004245 } else {
4246 data.writeInt(0);
4247 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004248 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004249 if (options != null) {
4250 data.writeInt(1);
4251 options.writeToParcel(data, 0);
4252 } else {
4253 data.writeInt(0);
4254 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004255 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004256 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4257 reply.readException();
4258 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004259 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004260 data.recycle();
4261 reply.recycle();
4262 return res;
4263 }
4264 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4265 Parcel data = Parcel.obtain();
4266 Parcel reply = Parcel.obtain();
4267 data.writeInterfaceToken(IActivityManager.descriptor);
4268 data.writeStrongBinder(sender.asBinder());
4269 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4270 reply.readException();
4271 data.recycle();
4272 reply.recycle();
4273 }
4274 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4275 Parcel data = Parcel.obtain();
4276 Parcel reply = Parcel.obtain();
4277 data.writeInterfaceToken(IActivityManager.descriptor);
4278 data.writeStrongBinder(sender.asBinder());
4279 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4280 reply.readException();
4281 String res = reply.readString();
4282 data.recycle();
4283 reply.recycle();
4284 return res;
4285 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004286 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4287 Parcel data = Parcel.obtain();
4288 Parcel reply = Parcel.obtain();
4289 data.writeInterfaceToken(IActivityManager.descriptor);
4290 data.writeStrongBinder(sender.asBinder());
4291 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4292 reply.readException();
4293 int res = reply.readInt();
4294 data.recycle();
4295 reply.recycle();
4296 return res;
4297 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004298 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4299 boolean requireFull, String name, String callerPackage) throws RemoteException {
4300 Parcel data = Parcel.obtain();
4301 Parcel reply = Parcel.obtain();
4302 data.writeInterfaceToken(IActivityManager.descriptor);
4303 data.writeInt(callingPid);
4304 data.writeInt(callingUid);
4305 data.writeInt(userId);
4306 data.writeInt(allowAll ? 1 : 0);
4307 data.writeInt(requireFull ? 1 : 0);
4308 data.writeString(name);
4309 data.writeString(callerPackage);
4310 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4311 reply.readException();
4312 int res = reply.readInt();
4313 data.recycle();
4314 reply.recycle();
4315 return res;
4316 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004317 public void setProcessLimit(int max) throws RemoteException
4318 {
4319 Parcel data = Parcel.obtain();
4320 Parcel reply = Parcel.obtain();
4321 data.writeInterfaceToken(IActivityManager.descriptor);
4322 data.writeInt(max);
4323 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4324 reply.readException();
4325 data.recycle();
4326 reply.recycle();
4327 }
4328 public int getProcessLimit() throws RemoteException
4329 {
4330 Parcel data = Parcel.obtain();
4331 Parcel reply = Parcel.obtain();
4332 data.writeInterfaceToken(IActivityManager.descriptor);
4333 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4334 reply.readException();
4335 int res = reply.readInt();
4336 data.recycle();
4337 reply.recycle();
4338 return res;
4339 }
4340 public void setProcessForeground(IBinder token, int pid,
4341 boolean isForeground) throws RemoteException {
4342 Parcel data = Parcel.obtain();
4343 Parcel reply = Parcel.obtain();
4344 data.writeInterfaceToken(IActivityManager.descriptor);
4345 data.writeStrongBinder(token);
4346 data.writeInt(pid);
4347 data.writeInt(isForeground ? 1 : 0);
4348 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4349 reply.readException();
4350 data.recycle();
4351 reply.recycle();
4352 }
4353 public int checkPermission(String permission, int pid, int uid)
4354 throws RemoteException {
4355 Parcel data = Parcel.obtain();
4356 Parcel reply = Parcel.obtain();
4357 data.writeInterfaceToken(IActivityManager.descriptor);
4358 data.writeString(permission);
4359 data.writeInt(pid);
4360 data.writeInt(uid);
4361 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4362 reply.readException();
4363 int res = reply.readInt();
4364 data.recycle();
4365 reply.recycle();
4366 return res;
4367 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004368 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4369 throws RemoteException {
4370 Parcel data = Parcel.obtain();
4371 Parcel reply = Parcel.obtain();
4372 data.writeInterfaceToken(IActivityManager.descriptor);
4373 data.writeString(permission);
4374 data.writeInt(pid);
4375 data.writeInt(uid);
4376 data.writeStrongBinder(callerToken);
4377 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4378 reply.readException();
4379 int res = reply.readInt();
4380 data.recycle();
4381 reply.recycle();
4382 return res;
4383 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004384 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004385 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004386 Parcel data = Parcel.obtain();
4387 Parcel reply = Parcel.obtain();
4388 data.writeInterfaceToken(IActivityManager.descriptor);
4389 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004390 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004391 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004392 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4393 reply.readException();
4394 boolean res = reply.readInt() != 0;
4395 data.recycle();
4396 reply.recycle();
4397 return res;
4398 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004399 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4400 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004401 Parcel data = Parcel.obtain();
4402 Parcel reply = Parcel.obtain();
4403 data.writeInterfaceToken(IActivityManager.descriptor);
4404 uri.writeToParcel(data, 0);
4405 data.writeInt(pid);
4406 data.writeInt(uid);
4407 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004408 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004409 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004410 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4411 reply.readException();
4412 int res = reply.readInt();
4413 data.recycle();
4414 reply.recycle();
4415 return res;
4416 }
4417 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004418 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004419 Parcel data = Parcel.obtain();
4420 Parcel reply = Parcel.obtain();
4421 data.writeInterfaceToken(IActivityManager.descriptor);
4422 data.writeStrongBinder(caller.asBinder());
4423 data.writeString(targetPkg);
4424 uri.writeToParcel(data, 0);
4425 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004426 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004427 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4428 reply.readException();
4429 data.recycle();
4430 reply.recycle();
4431 }
4432 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004433 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004434 Parcel data = Parcel.obtain();
4435 Parcel reply = Parcel.obtain();
4436 data.writeInterfaceToken(IActivityManager.descriptor);
4437 data.writeStrongBinder(caller.asBinder());
4438 uri.writeToParcel(data, 0);
4439 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004440 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004441 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4442 reply.readException();
4443 data.recycle();
4444 reply.recycle();
4445 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004446
4447 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004448 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4449 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004450 Parcel data = Parcel.obtain();
4451 Parcel reply = Parcel.obtain();
4452 data.writeInterfaceToken(IActivityManager.descriptor);
4453 uri.writeToParcel(data, 0);
4454 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004455 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004456 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4457 reply.readException();
4458 data.recycle();
4459 reply.recycle();
4460 }
4461
4462 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004463 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4464 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004465 Parcel data = Parcel.obtain();
4466 Parcel reply = Parcel.obtain();
4467 data.writeInterfaceToken(IActivityManager.descriptor);
4468 uri.writeToParcel(data, 0);
4469 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004470 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004471 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4472 reply.readException();
4473 data.recycle();
4474 reply.recycle();
4475 }
4476
4477 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004478 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4479 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004480 Parcel data = Parcel.obtain();
4481 Parcel reply = Parcel.obtain();
4482 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004483 data.writeString(packageName);
4484 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004485 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4486 reply.readException();
4487 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4488 reply);
4489 data.recycle();
4490 reply.recycle();
4491 return perms;
4492 }
4493
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004494 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4495 throws RemoteException {
4496 Parcel data = Parcel.obtain();
4497 Parcel reply = Parcel.obtain();
4498 data.writeInterfaceToken(IActivityManager.descriptor);
4499 data.writeStrongBinder(who.asBinder());
4500 data.writeInt(waiting ? 1 : 0);
4501 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4502 reply.readException();
4503 data.recycle();
4504 reply.recycle();
4505 }
4506 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4507 Parcel data = Parcel.obtain();
4508 Parcel reply = Parcel.obtain();
4509 data.writeInterfaceToken(IActivityManager.descriptor);
4510 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4511 reply.readException();
4512 outInfo.readFromParcel(reply);
4513 data.recycle();
4514 reply.recycle();
4515 }
4516 public void unhandledBack() throws RemoteException
4517 {
4518 Parcel data = Parcel.obtain();
4519 Parcel reply = Parcel.obtain();
4520 data.writeInterfaceToken(IActivityManager.descriptor);
4521 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4522 reply.readException();
4523 data.recycle();
4524 reply.recycle();
4525 }
4526 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4527 {
4528 Parcel data = Parcel.obtain();
4529 Parcel reply = Parcel.obtain();
4530 data.writeInterfaceToken(IActivityManager.descriptor);
4531 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4532 reply.readException();
4533 ParcelFileDescriptor pfd = null;
4534 if (reply.readInt() != 0) {
4535 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4536 }
4537 data.recycle();
4538 reply.recycle();
4539 return pfd;
4540 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004541 public void setLockScreenShown(boolean shown) throws RemoteException
4542 {
4543 Parcel data = Parcel.obtain();
4544 Parcel reply = Parcel.obtain();
4545 data.writeInterfaceToken(IActivityManager.descriptor);
4546 data.writeInt(shown ? 1 : 0);
4547 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4548 reply.readException();
4549 data.recycle();
4550 reply.recycle();
4551 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004552 public void setDebugApp(
4553 String packageName, boolean waitForDebugger, boolean persistent)
4554 throws RemoteException
4555 {
4556 Parcel data = Parcel.obtain();
4557 Parcel reply = Parcel.obtain();
4558 data.writeInterfaceToken(IActivityManager.descriptor);
4559 data.writeString(packageName);
4560 data.writeInt(waitForDebugger ? 1 : 0);
4561 data.writeInt(persistent ? 1 : 0);
4562 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4563 reply.readException();
4564 data.recycle();
4565 reply.recycle();
4566 }
4567 public void setAlwaysFinish(boolean enabled) throws RemoteException
4568 {
4569 Parcel data = Parcel.obtain();
4570 Parcel reply = Parcel.obtain();
4571 data.writeInterfaceToken(IActivityManager.descriptor);
4572 data.writeInt(enabled ? 1 : 0);
4573 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4574 reply.readException();
4575 data.recycle();
4576 reply.recycle();
4577 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004578 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004579 {
4580 Parcel data = Parcel.obtain();
4581 Parcel reply = Parcel.obtain();
4582 data.writeInterfaceToken(IActivityManager.descriptor);
4583 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004584 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004585 reply.readException();
4586 data.recycle();
4587 reply.recycle();
4588 }
4589 public void enterSafeMode() throws RemoteException {
4590 Parcel data = Parcel.obtain();
4591 data.writeInterfaceToken(IActivityManager.descriptor);
4592 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4593 data.recycle();
4594 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004595 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004596 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004597 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004598 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004599 data.writeStrongBinder(sender.asBinder());
4600 data.writeInt(sourceUid);
4601 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004602 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004603 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4604 data.recycle();
4605 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004606 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4607 throws RemoteException {
4608 Parcel data = Parcel.obtain();
4609 data.writeInterfaceToken(IActivityManager.descriptor);
4610 data.writeStrongBinder(sender.asBinder());
4611 data.writeInt(sourceUid);
4612 data.writeString(tag);
4613 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4614 data.recycle();
4615 }
4616 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4617 throws RemoteException {
4618 Parcel data = Parcel.obtain();
4619 data.writeInterfaceToken(IActivityManager.descriptor);
4620 data.writeStrongBinder(sender.asBinder());
4621 data.writeInt(sourceUid);
4622 data.writeString(tag);
4623 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4624 data.recycle();
4625 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004626 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004627 Parcel data = Parcel.obtain();
4628 Parcel reply = Parcel.obtain();
4629 data.writeInterfaceToken(IActivityManager.descriptor);
4630 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004631 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004632 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004633 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004634 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004635 boolean res = reply.readInt() != 0;
4636 data.recycle();
4637 reply.recycle();
4638 return res;
4639 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004640 @Override
4641 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4642 Parcel data = Parcel.obtain();
4643 Parcel reply = Parcel.obtain();
4644 data.writeInterfaceToken(IActivityManager.descriptor);
4645 data.writeString(reason);
4646 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4647 boolean res = reply.readInt() != 0;
4648 data.recycle();
4649 reply.recycle();
4650 return res;
4651 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004652 public boolean testIsSystemReady()
4653 {
4654 /* this base class version is never called */
4655 return true;
4656 }
Dan Egnor60d87622009-12-16 16:32:58 -08004657 public void handleApplicationCrash(IBinder app,
4658 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4659 {
4660 Parcel data = Parcel.obtain();
4661 Parcel reply = Parcel.obtain();
4662 data.writeInterfaceToken(IActivityManager.descriptor);
4663 data.writeStrongBinder(app);
4664 crashInfo.writeToParcel(data, 0);
4665 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4666 reply.readException();
4667 reply.recycle();
4668 data.recycle();
4669 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004670
Dianne Hackborn52322712014-08-26 22:47:26 -07004671 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004672 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004673 {
4674 Parcel data = Parcel.obtain();
4675 Parcel reply = Parcel.obtain();
4676 data.writeInterfaceToken(IActivityManager.descriptor);
4677 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004678 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004679 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004680 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004681 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004682 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004683 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004684 reply.recycle();
4685 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004686 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004687 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004688
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004689 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004690 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004691 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004692 {
4693 Parcel data = Parcel.obtain();
4694 Parcel reply = Parcel.obtain();
4695 data.writeInterfaceToken(IActivityManager.descriptor);
4696 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004697 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004698 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004699 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4700 reply.readException();
4701 reply.recycle();
4702 data.recycle();
4703 }
4704
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004705 public void signalPersistentProcesses(int sig) throws RemoteException {
4706 Parcel data = Parcel.obtain();
4707 Parcel reply = Parcel.obtain();
4708 data.writeInterfaceToken(IActivityManager.descriptor);
4709 data.writeInt(sig);
4710 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4711 reply.readException();
4712 data.recycle();
4713 reply.recycle();
4714 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004715
Dianne Hackborn1676c852012-09-10 14:52:30 -07004716 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004717 Parcel data = Parcel.obtain();
4718 Parcel reply = Parcel.obtain();
4719 data.writeInterfaceToken(IActivityManager.descriptor);
4720 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004721 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004722 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4723 reply.readException();
4724 data.recycle();
4725 reply.recycle();
4726 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004727
4728 public void killAllBackgroundProcesses() throws RemoteException {
4729 Parcel data = Parcel.obtain();
4730 Parcel reply = Parcel.obtain();
4731 data.writeInterfaceToken(IActivityManager.descriptor);
4732 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4733 reply.readException();
4734 data.recycle();
4735 reply.recycle();
4736 }
4737
Dianne Hackborn1676c852012-09-10 14:52:30 -07004738 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004739 Parcel data = Parcel.obtain();
4740 Parcel reply = Parcel.obtain();
4741 data.writeInterfaceToken(IActivityManager.descriptor);
4742 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004743 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004744 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004745 reply.readException();
4746 data.recycle();
4747 reply.recycle();
4748 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004749
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004750 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4751 throws RemoteException
4752 {
4753 Parcel data = Parcel.obtain();
4754 Parcel reply = Parcel.obtain();
4755 data.writeInterfaceToken(IActivityManager.descriptor);
4756 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4757 reply.readException();
4758 outInfo.readFromParcel(reply);
4759 reply.recycle();
4760 data.recycle();
4761 }
4762
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004763 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4764 {
4765 Parcel data = Parcel.obtain();
4766 Parcel reply = Parcel.obtain();
4767 data.writeInterfaceToken(IActivityManager.descriptor);
4768 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4769 reply.readException();
4770 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4771 reply.recycle();
4772 data.recycle();
4773 return res;
4774 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004775
Dianne Hackborn1676c852012-09-10 14:52:30 -07004776 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004777 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004778 {
4779 Parcel data = Parcel.obtain();
4780 Parcel reply = Parcel.obtain();
4781 data.writeInterfaceToken(IActivityManager.descriptor);
4782 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004783 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004784 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004785 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004786 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004787 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004788 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004789 } else {
4790 data.writeInt(0);
4791 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004792 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4793 reply.readException();
4794 boolean res = reply.readInt() != 0;
4795 reply.recycle();
4796 data.recycle();
4797 return res;
4798 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004799
Dianne Hackborn55280a92009-05-07 15:53:46 -07004800 public boolean shutdown(int timeout) throws RemoteException
4801 {
4802 Parcel data = Parcel.obtain();
4803 Parcel reply = Parcel.obtain();
4804 data.writeInterfaceToken(IActivityManager.descriptor);
4805 data.writeInt(timeout);
4806 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4807 reply.readException();
4808 boolean res = reply.readInt() != 0;
4809 reply.recycle();
4810 data.recycle();
4811 return res;
4812 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004813
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004814 public void stopAppSwitches() throws RemoteException {
4815 Parcel data = Parcel.obtain();
4816 Parcel reply = Parcel.obtain();
4817 data.writeInterfaceToken(IActivityManager.descriptor);
4818 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4819 reply.readException();
4820 reply.recycle();
4821 data.recycle();
4822 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004823
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004824 public void resumeAppSwitches() throws RemoteException {
4825 Parcel data = Parcel.obtain();
4826 Parcel reply = Parcel.obtain();
4827 data.writeInterfaceToken(IActivityManager.descriptor);
4828 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4829 reply.readException();
4830 reply.recycle();
4831 data.recycle();
4832 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004833
4834 public void addPackageDependency(String packageName) throws RemoteException {
4835 Parcel data = Parcel.obtain();
4836 Parcel reply = Parcel.obtain();
4837 data.writeInterfaceToken(IActivityManager.descriptor);
4838 data.writeString(packageName);
4839 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4840 reply.readException();
4841 data.recycle();
4842 reply.recycle();
4843 }
4844
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004845 public void killApplicationWithAppId(String pkg, int appid, String reason)
4846 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004847 Parcel data = Parcel.obtain();
4848 Parcel reply = Parcel.obtain();
4849 data.writeInterfaceToken(IActivityManager.descriptor);
4850 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004851 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004852 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004853 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004854 reply.readException();
4855 data.recycle();
4856 reply.recycle();
4857 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004858
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004859 public void closeSystemDialogs(String reason) throws RemoteException {
4860 Parcel data = Parcel.obtain();
4861 Parcel reply = Parcel.obtain();
4862 data.writeInterfaceToken(IActivityManager.descriptor);
4863 data.writeString(reason);
4864 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4865 reply.readException();
4866 data.recycle();
4867 reply.recycle();
4868 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004869
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004870 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004871 throws RemoteException {
4872 Parcel data = Parcel.obtain();
4873 Parcel reply = Parcel.obtain();
4874 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004875 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004876 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4877 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004878 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004879 data.recycle();
4880 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004881 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004882 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004883
4884 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4885 Parcel data = Parcel.obtain();
4886 Parcel reply = Parcel.obtain();
4887 data.writeInterfaceToken(IActivityManager.descriptor);
4888 data.writeString(processName);
4889 data.writeInt(uid);
4890 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4891 reply.readException();
4892 data.recycle();
4893 reply.recycle();
4894 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004895
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004896 public void overridePendingTransition(IBinder token, String packageName,
4897 int enterAnim, int exitAnim) throws RemoteException {
4898 Parcel data = Parcel.obtain();
4899 Parcel reply = Parcel.obtain();
4900 data.writeInterfaceToken(IActivityManager.descriptor);
4901 data.writeStrongBinder(token);
4902 data.writeString(packageName);
4903 data.writeInt(enterAnim);
4904 data.writeInt(exitAnim);
4905 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4906 reply.readException();
4907 data.recycle();
4908 reply.recycle();
4909 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004910
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004911 public boolean isUserAMonkey() throws RemoteException {
4912 Parcel data = Parcel.obtain();
4913 Parcel reply = Parcel.obtain();
4914 data.writeInterfaceToken(IActivityManager.descriptor);
4915 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4916 reply.readException();
4917 boolean res = reply.readInt() != 0;
4918 data.recycle();
4919 reply.recycle();
4920 return res;
4921 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004922
4923 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4924 Parcel data = Parcel.obtain();
4925 Parcel reply = Parcel.obtain();
4926 data.writeInterfaceToken(IActivityManager.descriptor);
4927 data.writeInt(monkey ? 1 : 0);
4928 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4929 reply.readException();
4930 data.recycle();
4931 reply.recycle();
4932 }
4933
Dianne Hackborn860755f2010-06-03 18:47:52 -07004934 public void finishHeavyWeightApp() throws RemoteException {
4935 Parcel data = Parcel.obtain();
4936 Parcel reply = Parcel.obtain();
4937 data.writeInterfaceToken(IActivityManager.descriptor);
4938 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4939 reply.readException();
4940 data.recycle();
4941 reply.recycle();
4942 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004943
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004944 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004945 throws RemoteException {
4946 Parcel data = Parcel.obtain();
4947 Parcel reply = Parcel.obtain();
4948 data.writeInterfaceToken(IActivityManager.descriptor);
4949 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004950 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4951 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004952 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004953 data.recycle();
4954 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004955 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004956 }
4957
Craig Mautner233ceee2014-05-09 17:05:11 -07004958 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004959 throws RemoteException {
4960 Parcel data = Parcel.obtain();
4961 Parcel reply = Parcel.obtain();
4962 data.writeInterfaceToken(IActivityManager.descriptor);
4963 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004964 if (options == null) {
4965 data.writeInt(0);
4966 } else {
4967 data.writeInt(1);
4968 data.writeBundle(options.toBundle());
4969 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004970 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004971 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004972 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004973 data.recycle();
4974 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004975 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004976 }
4977
Craig Mautner233ceee2014-05-09 17:05:11 -07004978 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4979 Parcel data = Parcel.obtain();
4980 Parcel reply = Parcel.obtain();
4981 data.writeInterfaceToken(IActivityManager.descriptor);
4982 data.writeStrongBinder(token);
4983 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4984 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08004985 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07004986 data.recycle();
4987 reply.recycle();
4988 return options;
4989 }
4990
Daniel Sandler69a48172010-06-23 16:29:36 -04004991 public void setImmersive(IBinder token, boolean immersive)
4992 throws RemoteException {
4993 Parcel data = Parcel.obtain();
4994 Parcel reply = Parcel.obtain();
4995 data.writeInterfaceToken(IActivityManager.descriptor);
4996 data.writeStrongBinder(token);
4997 data.writeInt(immersive ? 1 : 0);
4998 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4999 reply.readException();
5000 data.recycle();
5001 reply.recycle();
5002 }
5003
5004 public boolean isImmersive(IBinder token)
5005 throws RemoteException {
5006 Parcel data = Parcel.obtain();
5007 Parcel reply = Parcel.obtain();
5008 data.writeInterfaceToken(IActivityManager.descriptor);
5009 data.writeStrongBinder(token);
5010 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005011 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005012 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005013 data.recycle();
5014 reply.recycle();
5015 return res;
5016 }
5017
Craig Mautnerd61dc202014-07-07 11:09:11 -07005018 public boolean isTopOfTask(IBinder token) throws RemoteException {
5019 Parcel data = Parcel.obtain();
5020 Parcel reply = Parcel.obtain();
5021 data.writeInterfaceToken(IActivityManager.descriptor);
5022 data.writeStrongBinder(token);
5023 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
5024 reply.readException();
5025 boolean res = reply.readInt() == 1;
5026 data.recycle();
5027 reply.recycle();
5028 return res;
5029 }
5030
Daniel Sandler69a48172010-06-23 16:29:36 -04005031 public boolean isTopActivityImmersive()
5032 throws RemoteException {
5033 Parcel data = Parcel.obtain();
5034 Parcel reply = Parcel.obtain();
5035 data.writeInterfaceToken(IActivityManager.descriptor);
5036 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005037 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005038 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005039 data.recycle();
5040 reply.recycle();
5041 return res;
5042 }
5043
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005044 public void crashApplication(int uid, int initialPid, String packageName,
5045 String message) throws RemoteException {
5046 Parcel data = Parcel.obtain();
5047 Parcel reply = Parcel.obtain();
5048 data.writeInterfaceToken(IActivityManager.descriptor);
5049 data.writeInt(uid);
5050 data.writeInt(initialPid);
5051 data.writeString(packageName);
5052 data.writeString(message);
5053 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5054 reply.readException();
5055 data.recycle();
5056 reply.recycle();
5057 }
Andy McFadden824c5102010-07-09 16:26:57 -07005058
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005059 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005060 Parcel data = Parcel.obtain();
5061 Parcel reply = Parcel.obtain();
5062 data.writeInterfaceToken(IActivityManager.descriptor);
5063 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005064 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005065 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5066 reply.readException();
5067 String res = reply.readString();
5068 data.recycle();
5069 reply.recycle();
5070 return res;
5071 }
5072
Dianne Hackborn7e269642010-08-25 19:50:20 -07005073 public IBinder newUriPermissionOwner(String name)
5074 throws RemoteException {
5075 Parcel data = Parcel.obtain();
5076 Parcel reply = Parcel.obtain();
5077 data.writeInterfaceToken(IActivityManager.descriptor);
5078 data.writeString(name);
5079 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5080 reply.readException();
5081 IBinder res = reply.readStrongBinder();
5082 data.recycle();
5083 reply.recycle();
5084 return res;
5085 }
5086
5087 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005088 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005089 Parcel data = Parcel.obtain();
5090 Parcel reply = Parcel.obtain();
5091 data.writeInterfaceToken(IActivityManager.descriptor);
5092 data.writeStrongBinder(owner);
5093 data.writeInt(fromUid);
5094 data.writeString(targetPkg);
5095 uri.writeToParcel(data, 0);
5096 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005097 data.writeInt(sourceUserId);
5098 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005099 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5100 reply.readException();
5101 data.recycle();
5102 reply.recycle();
5103 }
5104
5105 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005106 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005107 Parcel data = Parcel.obtain();
5108 Parcel reply = Parcel.obtain();
5109 data.writeInterfaceToken(IActivityManager.descriptor);
5110 data.writeStrongBinder(owner);
5111 if (uri != null) {
5112 data.writeInt(1);
5113 uri.writeToParcel(data, 0);
5114 } else {
5115 data.writeInt(0);
5116 }
5117 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005118 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005119 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5120 reply.readException();
5121 data.recycle();
5122 reply.recycle();
5123 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005124
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005125 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005126 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005127 Parcel data = Parcel.obtain();
5128 Parcel reply = Parcel.obtain();
5129 data.writeInterfaceToken(IActivityManager.descriptor);
5130 data.writeInt(callingUid);
5131 data.writeString(targetPkg);
5132 uri.writeToParcel(data, 0);
5133 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005134 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005135 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5136 reply.readException();
5137 int res = reply.readInt();
5138 data.recycle();
5139 reply.recycle();
5140 return res;
5141 }
5142
Dianne Hackborn1676c852012-09-10 14:52:30 -07005143 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005144 String path, ParcelFileDescriptor fd) throws RemoteException {
5145 Parcel data = Parcel.obtain();
5146 Parcel reply = Parcel.obtain();
5147 data.writeInterfaceToken(IActivityManager.descriptor);
5148 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005149 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005150 data.writeInt(managed ? 1 : 0);
5151 data.writeString(path);
5152 if (fd != null) {
5153 data.writeInt(1);
5154 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5155 } else {
5156 data.writeInt(0);
5157 }
5158 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5159 reply.readException();
5160 boolean res = reply.readInt() != 0;
5161 reply.recycle();
5162 data.recycle();
5163 return res;
5164 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005165
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005166 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005167 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005168 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005169 Parcel data = Parcel.obtain();
5170 Parcel reply = Parcel.obtain();
5171 data.writeInterfaceToken(IActivityManager.descriptor);
5172 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005173 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005174 data.writeTypedArray(intents, 0);
5175 data.writeStringArray(resolvedTypes);
5176 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005177 if (options != null) {
5178 data.writeInt(1);
5179 options.writeToParcel(data, 0);
5180 } else {
5181 data.writeInt(0);
5182 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005183 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005184 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5185 reply.readException();
5186 int result = reply.readInt();
5187 reply.recycle();
5188 data.recycle();
5189 return result;
5190 }
5191
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005192 public int getFrontActivityScreenCompatMode() throws RemoteException {
5193 Parcel data = Parcel.obtain();
5194 Parcel reply = Parcel.obtain();
5195 data.writeInterfaceToken(IActivityManager.descriptor);
5196 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5197 reply.readException();
5198 int mode = reply.readInt();
5199 reply.recycle();
5200 data.recycle();
5201 return mode;
5202 }
5203
5204 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5205 Parcel data = Parcel.obtain();
5206 Parcel reply = Parcel.obtain();
5207 data.writeInterfaceToken(IActivityManager.descriptor);
5208 data.writeInt(mode);
5209 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5210 reply.readException();
5211 reply.recycle();
5212 data.recycle();
5213 }
5214
5215 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5216 Parcel data = Parcel.obtain();
5217 Parcel reply = Parcel.obtain();
5218 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005219 data.writeString(packageName);
5220 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005221 reply.readException();
5222 int mode = reply.readInt();
5223 reply.recycle();
5224 data.recycle();
5225 return mode;
5226 }
5227
5228 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005229 throws RemoteException {
5230 Parcel data = Parcel.obtain();
5231 Parcel reply = Parcel.obtain();
5232 data.writeInterfaceToken(IActivityManager.descriptor);
5233 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005234 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005235 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5236 reply.readException();
5237 reply.recycle();
5238 data.recycle();
5239 }
5240
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005241 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5242 Parcel data = Parcel.obtain();
5243 Parcel reply = Parcel.obtain();
5244 data.writeInterfaceToken(IActivityManager.descriptor);
5245 data.writeString(packageName);
5246 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5247 reply.readException();
5248 boolean ask = reply.readInt() != 0;
5249 reply.recycle();
5250 data.recycle();
5251 return ask;
5252 }
5253
5254 public void setPackageAskScreenCompat(String packageName, boolean ask)
5255 throws RemoteException {
5256 Parcel data = Parcel.obtain();
5257 Parcel reply = Parcel.obtain();
5258 data.writeInterfaceToken(IActivityManager.descriptor);
5259 data.writeString(packageName);
5260 data.writeInt(ask ? 1 : 0);
5261 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5262 reply.readException();
5263 reply.recycle();
5264 data.recycle();
5265 }
5266
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005267 public boolean switchUser(int userid) throws RemoteException {
5268 Parcel data = Parcel.obtain();
5269 Parcel reply = Parcel.obtain();
5270 data.writeInterfaceToken(IActivityManager.descriptor);
5271 data.writeInt(userid);
5272 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5273 reply.readException();
5274 boolean result = reply.readInt() != 0;
5275 reply.recycle();
5276 data.recycle();
5277 return result;
5278 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005279
Kenny Guy08488bf2014-02-21 17:40:37 +00005280 public boolean startUserInBackground(int userid) throws RemoteException {
5281 Parcel data = Parcel.obtain();
5282 Parcel reply = Parcel.obtain();
5283 data.writeInterfaceToken(IActivityManager.descriptor);
5284 data.writeInt(userid);
5285 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5286 reply.readException();
5287 boolean result = reply.readInt() != 0;
5288 reply.recycle();
5289 data.recycle();
5290 return result;
5291 }
5292
Jeff Sharkeyba512352015-11-12 20:17:45 -08005293 public boolean unlockUser(int userId, byte[] token) throws RemoteException {
5294 Parcel data = Parcel.obtain();
5295 Parcel reply = Parcel.obtain();
5296 data.writeInterfaceToken(IActivityManager.descriptor);
5297 data.writeInt(userId);
5298 data.writeByteArray(token);
5299 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5300 reply.readException();
5301 boolean result = reply.readInt() != 0;
5302 reply.recycle();
5303 data.recycle();
5304 return result;
5305 }
5306
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005307 public int stopUser(int userid, boolean force, IStopUserCallback callback)
5308 throws RemoteException {
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005309 Parcel data = Parcel.obtain();
5310 Parcel reply = Parcel.obtain();
5311 data.writeInterfaceToken(IActivityManager.descriptor);
5312 data.writeInt(userid);
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005313 data.writeInt(force ? 1 : 0);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005314 data.writeStrongInterface(callback);
5315 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5316 reply.readException();
5317 int result = reply.readInt();
5318 reply.recycle();
5319 data.recycle();
5320 return result;
5321 }
5322
Amith Yamasani52f1d752012-03-28 18:19:29 -07005323 public UserInfo getCurrentUser() throws RemoteException {
5324 Parcel data = Parcel.obtain();
5325 Parcel reply = Parcel.obtain();
5326 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005327 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005328 reply.readException();
5329 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5330 reply.recycle();
5331 data.recycle();
5332 return userInfo;
5333 }
5334
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005335 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005336 Parcel data = Parcel.obtain();
5337 Parcel reply = Parcel.obtain();
5338 data.writeInterfaceToken(IActivityManager.descriptor);
5339 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005340 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005341 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5342 reply.readException();
5343 boolean result = reply.readInt() != 0;
5344 reply.recycle();
5345 data.recycle();
5346 return result;
5347 }
5348
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005349 public int[] getRunningUserIds() throws RemoteException {
5350 Parcel data = Parcel.obtain();
5351 Parcel reply = Parcel.obtain();
5352 data.writeInterfaceToken(IActivityManager.descriptor);
5353 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5354 reply.readException();
5355 int[] result = reply.createIntArray();
5356 reply.recycle();
5357 data.recycle();
5358 return result;
5359 }
5360
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005361 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005362 Parcel data = Parcel.obtain();
5363 Parcel reply = Parcel.obtain();
5364 data.writeInterfaceToken(IActivityManager.descriptor);
5365 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005366 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5367 reply.readException();
5368 boolean result = reply.readInt() != 0;
5369 reply.recycle();
5370 data.recycle();
5371 return result;
5372 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005373
Jeff Sharkeya4620792011-05-20 15:29:23 -07005374 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5375 Parcel data = Parcel.obtain();
5376 Parcel reply = Parcel.obtain();
5377 data.writeInterfaceToken(IActivityManager.descriptor);
5378 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5379 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5380 reply.readException();
5381 data.recycle();
5382 reply.recycle();
5383 }
5384
5385 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5386 Parcel data = Parcel.obtain();
5387 Parcel reply = Parcel.obtain();
5388 data.writeInterfaceToken(IActivityManager.descriptor);
5389 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5390 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5391 reply.readException();
5392 data.recycle();
5393 reply.recycle();
5394 }
5395
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005396 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005397 Parcel data = Parcel.obtain();
5398 Parcel reply = Parcel.obtain();
5399 data.writeInterfaceToken(IActivityManager.descriptor);
5400 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005401 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005402 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5403 reply.readException();
5404 data.recycle();
5405 reply.recycle();
5406 }
5407
5408 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5409 Parcel data = Parcel.obtain();
5410 Parcel reply = Parcel.obtain();
5411 data.writeInterfaceToken(IActivityManager.descriptor);
5412 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5413 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5414 reply.readException();
5415 data.recycle();
5416 reply.recycle();
5417 }
5418
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005419 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5420 Parcel data = Parcel.obtain();
5421 Parcel reply = Parcel.obtain();
5422 data.writeInterfaceToken(IActivityManager.descriptor);
5423 data.writeStrongBinder(sender.asBinder());
5424 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5425 reply.readException();
5426 boolean res = reply.readInt() != 0;
5427 data.recycle();
5428 reply.recycle();
5429 return res;
5430 }
5431
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005432 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5433 Parcel data = Parcel.obtain();
5434 Parcel reply = Parcel.obtain();
5435 data.writeInterfaceToken(IActivityManager.descriptor);
5436 data.writeStrongBinder(sender.asBinder());
5437 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5438 reply.readException();
5439 boolean res = reply.readInt() != 0;
5440 data.recycle();
5441 reply.recycle();
5442 return res;
5443 }
5444
Dianne Hackborn81038902012-11-26 17:04:09 -08005445 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5446 Parcel data = Parcel.obtain();
5447 Parcel reply = Parcel.obtain();
5448 data.writeInterfaceToken(IActivityManager.descriptor);
5449 data.writeStrongBinder(sender.asBinder());
5450 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5451 reply.readException();
5452 Intent res = reply.readInt() != 0
5453 ? Intent.CREATOR.createFromParcel(reply) : null;
5454 data.recycle();
5455 reply.recycle();
5456 return res;
5457 }
5458
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005459 public String getTagForIntentSender(IIntentSender sender, String prefix)
5460 throws RemoteException {
5461 Parcel data = Parcel.obtain();
5462 Parcel reply = Parcel.obtain();
5463 data.writeInterfaceToken(IActivityManager.descriptor);
5464 data.writeStrongBinder(sender.asBinder());
5465 data.writeString(prefix);
5466 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5467 reply.readException();
5468 String res = reply.readString();
5469 data.recycle();
5470 reply.recycle();
5471 return res;
5472 }
5473
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005474 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5475 {
5476 Parcel data = Parcel.obtain();
5477 Parcel reply = Parcel.obtain();
5478 data.writeInterfaceToken(IActivityManager.descriptor);
5479 values.writeToParcel(data, 0);
5480 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5481 reply.readException();
5482 data.recycle();
5483 reply.recycle();
5484 }
5485
Dianne Hackbornb437e092011-08-05 17:50:29 -07005486 public long[] getProcessPss(int[] pids) throws RemoteException {
5487 Parcel data = Parcel.obtain();
5488 Parcel reply = Parcel.obtain();
5489 data.writeInterfaceToken(IActivityManager.descriptor);
5490 data.writeIntArray(pids);
5491 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5492 reply.readException();
5493 long[] res = reply.createLongArray();
5494 data.recycle();
5495 reply.recycle();
5496 return res;
5497 }
5498
Dianne Hackborn661cd522011-08-22 00:26:20 -07005499 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5500 Parcel data = Parcel.obtain();
5501 Parcel reply = Parcel.obtain();
5502 data.writeInterfaceToken(IActivityManager.descriptor);
5503 TextUtils.writeToParcel(msg, data, 0);
5504 data.writeInt(always ? 1 : 0);
5505 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5506 reply.readException();
5507 data.recycle();
5508 reply.recycle();
5509 }
5510
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005511 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005512 Parcel data = Parcel.obtain();
5513 Parcel reply = Parcel.obtain();
5514 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005515 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005516 reply.readException();
5517 data.recycle();
5518 reply.recycle();
5519 }
5520
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005521 public void keyguardGoingAway(boolean disableWindowAnimations,
5522 boolean keyguardGoingToNotificationShade) throws RemoteException {
5523 Parcel data = Parcel.obtain();
5524 Parcel reply = Parcel.obtain();
5525 data.writeInterfaceToken(IActivityManager.descriptor);
5526 data.writeInt(disableWindowAnimations ? 1 : 0);
5527 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5528 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5529 reply.readException();
5530 data.recycle();
5531 reply.recycle();
5532 }
5533
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005534 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005535 throws RemoteException {
5536 Parcel data = Parcel.obtain();
5537 Parcel reply = Parcel.obtain();
5538 data.writeInterfaceToken(IActivityManager.descriptor);
5539 data.writeStrongBinder(token);
5540 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005541 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005542 reply.readException();
5543 boolean result = reply.readInt() != 0;
5544 data.recycle();
5545 reply.recycle();
5546 return result;
5547 }
5548
5549 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5550 throws RemoteException {
5551 Parcel data = Parcel.obtain();
5552 Parcel reply = Parcel.obtain();
5553 data.writeInterfaceToken(IActivityManager.descriptor);
5554 data.writeStrongBinder(token);
5555 target.writeToParcel(data, 0);
5556 data.writeInt(resultCode);
5557 if (resultData != null) {
5558 data.writeInt(1);
5559 resultData.writeToParcel(data, 0);
5560 } else {
5561 data.writeInt(0);
5562 }
5563 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5564 reply.readException();
5565 boolean result = reply.readInt() != 0;
5566 data.recycle();
5567 reply.recycle();
5568 return result;
5569 }
5570
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005571 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5572 Parcel data = Parcel.obtain();
5573 Parcel reply = Parcel.obtain();
5574 data.writeInterfaceToken(IActivityManager.descriptor);
5575 data.writeStrongBinder(activityToken);
5576 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5577 reply.readException();
5578 int result = reply.readInt();
5579 data.recycle();
5580 reply.recycle();
5581 return result;
5582 }
5583
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005584 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5585 Parcel data = Parcel.obtain();
5586 Parcel reply = Parcel.obtain();
5587 data.writeInterfaceToken(IActivityManager.descriptor);
5588 data.writeStrongBinder(activityToken);
5589 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5590 reply.readException();
5591 String result = reply.readString();
5592 data.recycle();
5593 reply.recycle();
5594 return result;
5595 }
5596
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005597 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5598 Parcel data = Parcel.obtain();
5599 Parcel reply = Parcel.obtain();
5600 data.writeInterfaceToken(IActivityManager.descriptor);
5601 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5602 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5603 reply.readException();
5604 data.recycle();
5605 reply.recycle();
5606 }
5607
5608 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5609 Parcel data = Parcel.obtain();
5610 Parcel reply = Parcel.obtain();
5611 data.writeInterfaceToken(IActivityManager.descriptor);
5612 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5613 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5614 reply.readException();
5615 data.recycle();
5616 reply.recycle();
5617 }
5618
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005619 public void requestBugReport() throws RemoteException {
5620 Parcel data = Parcel.obtain();
5621 Parcel reply = Parcel.obtain();
5622 data.writeInterfaceToken(IActivityManager.descriptor);
5623 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5624 reply.readException();
5625 data.recycle();
5626 reply.recycle();
5627 }
5628
Jeff Brownbd181bb2013-09-10 16:44:24 -07005629 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5630 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005631 Parcel data = Parcel.obtain();
5632 Parcel reply = Parcel.obtain();
5633 data.writeInterfaceToken(IActivityManager.descriptor);
5634 data.writeInt(pid);
5635 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005636 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005637 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5638 reply.readException();
5639 long res = reply.readInt();
5640 data.recycle();
5641 reply.recycle();
5642 return res;
5643 }
5644
Adam Skorydfc7fd72013-08-05 19:23:41 -07005645 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005646 Parcel data = Parcel.obtain();
5647 Parcel reply = Parcel.obtain();
5648 data.writeInterfaceToken(IActivityManager.descriptor);
5649 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005650 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005651 reply.readException();
5652 Bundle res = reply.readBundle();
5653 data.recycle();
5654 reply.recycle();
5655 return res;
5656 }
5657
Dianne Hackborn17f69352015-07-17 18:04:14 -07005658 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5659 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005660 Parcel data = Parcel.obtain();
5661 Parcel reply = Parcel.obtain();
5662 data.writeInterfaceToken(IActivityManager.descriptor);
5663 data.writeInt(requestType);
5664 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005665 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005666 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5667 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005668 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005669 data.recycle();
5670 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005671 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005672 }
5673
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005674 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005675 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005676 Parcel data = Parcel.obtain();
5677 Parcel reply = Parcel.obtain();
5678 data.writeInterfaceToken(IActivityManager.descriptor);
5679 data.writeStrongBinder(token);
5680 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005681 structure.writeToParcel(data, 0);
5682 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005683 if (referrer != null) {
5684 data.writeInt(1);
5685 referrer.writeToParcel(data, 0);
5686 } else {
5687 data.writeInt(0);
5688 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005689 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005690 reply.readException();
5691 data.recycle();
5692 reply.recycle();
5693 }
5694
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005695 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5696 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005697 Parcel data = Parcel.obtain();
5698 Parcel reply = Parcel.obtain();
5699 data.writeInterfaceToken(IActivityManager.descriptor);
5700 intent.writeToParcel(data, 0);
5701 data.writeInt(requestType);
5702 data.writeString(hint);
5703 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005704 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005705 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5706 reply.readException();
5707 boolean res = reply.readInt() != 0;
5708 data.recycle();
5709 reply.recycle();
5710 return res;
5711 }
5712
Dianne Hackborn17f69352015-07-17 18:04:14 -07005713 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005714 Parcel data = Parcel.obtain();
5715 Parcel reply = Parcel.obtain();
5716 data.writeInterfaceToken(IActivityManager.descriptor);
5717 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5718 reply.readException();
5719 boolean res = reply.readInt() != 0;
5720 data.recycle();
5721 reply.recycle();
5722 return res;
5723 }
5724
Dianne Hackborn17f69352015-07-17 18:04:14 -07005725 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5726 Parcel data = Parcel.obtain();
5727 Parcel reply = Parcel.obtain();
5728 data.writeInterfaceToken(IActivityManager.descriptor);
5729 data.writeStrongBinder(token);
5730 data.writeBundle(args);
5731 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5732 reply.readException();
5733 boolean res = reply.readInt() != 0;
5734 data.recycle();
5735 reply.recycle();
5736 return res;
5737 }
5738
Svetoslavaa41add2015-08-06 15:03:55 -07005739 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005740 Parcel data = Parcel.obtain();
5741 Parcel reply = Parcel.obtain();
5742 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07005743 data.writeInt(appId);
5744 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005745 data.writeString(reason);
5746 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5747 reply.readException();
5748 data.recycle();
5749 reply.recycle();
5750 }
5751
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005752 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5753 Parcel data = Parcel.obtain();
5754 Parcel reply = Parcel.obtain();
5755 data.writeInterfaceToken(IActivityManager.descriptor);
5756 data.writeStrongBinder(who);
5757 data.writeInt(allowRestart ? 1 : 0);
5758 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5759 reply.readException();
5760 data.recycle();
5761 reply.recycle();
5762 }
5763
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005764 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5765 Parcel data = Parcel.obtain();
5766 Parcel reply = Parcel.obtain();
5767 data.writeInterfaceToken(IActivityManager.descriptor);
5768 data.writeStrongBinder(token);
5769 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5770 reply.readException();
5771 data.recycle();
5772 reply.recycle();
5773 }
5774
Craig Mautner5eda9b32013-07-02 11:58:16 -07005775 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5776 Parcel data = Parcel.obtain();
5777 Parcel reply = Parcel.obtain();
5778 data.writeInterfaceToken(IActivityManager.descriptor);
5779 data.writeStrongBinder(token);
5780 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5781 reply.readException();
5782 data.recycle();
5783 reply.recycle();
5784 }
5785
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005786 public void restart() throws RemoteException {
5787 Parcel data = Parcel.obtain();
5788 Parcel reply = Parcel.obtain();
5789 data.writeInterfaceToken(IActivityManager.descriptor);
5790 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5791 reply.readException();
5792 data.recycle();
5793 reply.recycle();
5794 }
5795
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005796 public void performIdleMaintenance() throws RemoteException {
5797 Parcel data = Parcel.obtain();
5798 Parcel reply = Parcel.obtain();
5799 data.writeInterfaceToken(IActivityManager.descriptor);
5800 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5801 reply.readException();
5802 data.recycle();
5803 reply.recycle();
5804 }
5805
Todd Kennedyca4d8422015-01-15 15:19:22 -08005806 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005807 IActivityContainerCallback callback) throws RemoteException {
5808 Parcel data = Parcel.obtain();
5809 Parcel reply = Parcel.obtain();
5810 data.writeInterfaceToken(IActivityManager.descriptor);
5811 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005812 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005813 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005814 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005815 final int result = reply.readInt();
5816 final IActivityContainer res;
5817 if (result == 1) {
5818 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5819 } else {
5820 res = null;
5821 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005822 data.recycle();
5823 reply.recycle();
5824 return res;
5825 }
5826
Craig Mautner95da1082014-02-24 17:54:35 -08005827 public void deleteActivityContainer(IActivityContainer activityContainer)
5828 throws RemoteException {
5829 Parcel data = Parcel.obtain();
5830 Parcel reply = Parcel.obtain();
5831 data.writeInterfaceToken(IActivityManager.descriptor);
5832 data.writeStrongBinder(activityContainer.asBinder());
5833 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5834 reply.readException();
5835 data.recycle();
5836 reply.recycle();
5837 }
5838
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04005839 public boolean startBinderTracking() throws RemoteException {
5840 Parcel data = Parcel.obtain();
5841 Parcel reply = Parcel.obtain();
5842 data.writeInterfaceToken(IActivityManager.descriptor);
5843 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
5844 reply.readException();
5845 boolean res = reply.readInt() != 0;
5846 reply.recycle();
5847 data.recycle();
5848 return res;
5849 }
5850
5851 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
5852 Parcel data = Parcel.obtain();
5853 Parcel reply = Parcel.obtain();
5854 data.writeInterfaceToken(IActivityManager.descriptor);
5855 if (fd != null) {
5856 data.writeInt(1);
5857 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5858 } else {
5859 data.writeInt(0);
5860 }
5861 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
5862 reply.readException();
5863 boolean res = reply.readInt() != 0;
5864 reply.recycle();
5865 data.recycle();
5866 return res;
5867 }
5868
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005869 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005870 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5871 Parcel data = Parcel.obtain();
5872 Parcel reply = Parcel.obtain();
5873 data.writeInterfaceToken(IActivityManager.descriptor);
5874 data.writeInt(displayId);
5875 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5876 reply.readException();
5877 final int result = reply.readInt();
5878 final IActivityContainer res;
5879 if (result == 1) {
5880 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5881 } else {
5882 res = null;
5883 }
5884 data.recycle();
5885 reply.recycle();
5886 return res;
5887 }
5888
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005889 @Override
5890 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005891 throws RemoteException {
5892 Parcel data = Parcel.obtain();
5893 Parcel reply = Parcel.obtain();
5894 data.writeInterfaceToken(IActivityManager.descriptor);
5895 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005896 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005897 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005898 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005899 data.recycle();
5900 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005901 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005902 }
5903
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005904 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005905 public void startLockTaskMode(int taskId) throws RemoteException {
5906 Parcel data = Parcel.obtain();
5907 Parcel reply = Parcel.obtain();
5908 data.writeInterfaceToken(IActivityManager.descriptor);
5909 data.writeInt(taskId);
5910 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5911 reply.readException();
5912 data.recycle();
5913 reply.recycle();
5914 }
5915
5916 @Override
5917 public void startLockTaskMode(IBinder token) throws RemoteException {
5918 Parcel data = Parcel.obtain();
5919 Parcel reply = Parcel.obtain();
5920 data.writeInterfaceToken(IActivityManager.descriptor);
5921 data.writeStrongBinder(token);
5922 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5923 reply.readException();
5924 data.recycle();
5925 reply.recycle();
5926 }
5927
5928 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005929 public void startLockTaskModeOnCurrent() throws RemoteException {
5930 Parcel data = Parcel.obtain();
5931 Parcel reply = Parcel.obtain();
5932 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005933 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005934 reply.readException();
5935 data.recycle();
5936 reply.recycle();
5937 }
5938
5939 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005940 public void stopLockTaskMode() throws RemoteException {
5941 Parcel data = Parcel.obtain();
5942 Parcel reply = Parcel.obtain();
5943 data.writeInterfaceToken(IActivityManager.descriptor);
5944 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5945 reply.readException();
5946 data.recycle();
5947 reply.recycle();
5948 }
5949
5950 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005951 public void stopLockTaskModeOnCurrent() throws RemoteException {
5952 Parcel data = Parcel.obtain();
5953 Parcel reply = Parcel.obtain();
5954 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005955 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005956 reply.readException();
5957 data.recycle();
5958 reply.recycle();
5959 }
5960
5961 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005962 public boolean isInLockTaskMode() throws RemoteException {
5963 Parcel data = Parcel.obtain();
5964 Parcel reply = Parcel.obtain();
5965 data.writeInterfaceToken(IActivityManager.descriptor);
5966 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5967 reply.readException();
5968 boolean isInLockTaskMode = reply.readInt() == 1;
5969 data.recycle();
5970 reply.recycle();
5971 return isInLockTaskMode;
5972 }
5973
Craig Mautner688b5102014-03-27 16:55:03 -07005974 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005975 public int getLockTaskModeState() throws RemoteException {
5976 Parcel data = Parcel.obtain();
5977 Parcel reply = Parcel.obtain();
5978 data.writeInterfaceToken(IActivityManager.descriptor);
5979 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5980 reply.readException();
5981 int lockTaskModeState = reply.readInt();
5982 data.recycle();
5983 reply.recycle();
5984 return lockTaskModeState;
5985 }
5986
5987 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005988 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5989 Parcel data = Parcel.obtain();
5990 Parcel reply = Parcel.obtain();
5991 data.writeInterfaceToken(IActivityManager.descriptor);
5992 data.writeStrongBinder(token);
5993 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5994 IBinder.FLAG_ONEWAY);
5995 reply.readException();
5996 data.recycle();
5997 reply.recycle();
5998 }
5999
6000 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07006001 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07006002 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07006003 Parcel data = Parcel.obtain();
6004 Parcel reply = Parcel.obtain();
6005 data.writeInterfaceToken(IActivityManager.descriptor);
6006 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07006007 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006008 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07006009 reply.readException();
6010 data.recycle();
6011 reply.recycle();
6012 }
6013
Craig Mautneree2e45a2014-06-27 12:10:03 -07006014 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006015 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
6016 Parcel data = Parcel.obtain();
6017 Parcel reply = Parcel.obtain();
6018 data.writeInterfaceToken(IActivityManager.descriptor);
6019 data.writeInt(taskId);
6020 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006021 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006022 reply.readException();
6023 data.recycle();
6024 reply.recycle();
6025 }
6026
6027 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07006028 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006029 {
6030 Parcel data = Parcel.obtain();
6031 Parcel reply = Parcel.obtain();
6032 data.writeInterfaceToken(IActivityManager.descriptor);
6033 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006034 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006035 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006036 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006037 reply.readException();
6038 data.recycle();
6039 reply.recycle();
6040 }
6041
6042 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006043 public Rect getTaskBounds(int taskId) throws RemoteException
6044 {
6045 Parcel data = Parcel.obtain();
6046 Parcel reply = Parcel.obtain();
6047 data.writeInterfaceToken(IActivityManager.descriptor);
6048 data.writeInt(taskId);
6049 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6050 reply.readException();
6051 Rect rect = Rect.CREATOR.createFromParcel(reply);
6052 data.recycle();
6053 reply.recycle();
6054 return rect;
6055 }
6056
6057 @Override
Suprabh Shukla23593142015-11-03 17:31:15 -08006058 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException {
Craig Mautner648f69b2014-09-18 14:16:26 -07006059 Parcel data = Parcel.obtain();
6060 Parcel reply = Parcel.obtain();
6061 data.writeInterfaceToken(IActivityManager.descriptor);
6062 data.writeString(filename);
Suprabh Shukla23593142015-11-03 17:31:15 -08006063 data.writeInt(userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07006064 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6065 reply.readException();
6066 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6067 data.recycle();
6068 reply.recycle();
6069 return icon;
6070 }
6071
6072 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006073 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6074 throws RemoteException {
6075 Parcel data = Parcel.obtain();
6076 Parcel reply = Parcel.obtain();
6077 data.writeInterfaceToken(IActivityManager.descriptor);
6078 if (options == null) {
6079 data.writeInt(0);
6080 } else {
6081 data.writeInt(1);
6082 data.writeBundle(options.toBundle());
6083 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006084 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006085 reply.readException();
6086 data.recycle();
6087 reply.recycle();
6088 }
6089
6090 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006091 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006092 Parcel data = Parcel.obtain();
6093 Parcel reply = Parcel.obtain();
6094 data.writeInterfaceToken(IActivityManager.descriptor);
6095 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006096 data.writeInt(visible ? 1 : 0);
6097 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006098 reply.readException();
6099 boolean success = reply.readInt() > 0;
6100 data.recycle();
6101 reply.recycle();
6102 return success;
6103 }
6104
6105 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006106 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006107 Parcel data = Parcel.obtain();
6108 Parcel reply = Parcel.obtain();
6109 data.writeInterfaceToken(IActivityManager.descriptor);
6110 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006111 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006112 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006113 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006114 data.recycle();
6115 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006116 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006117 }
6118
6119 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006120 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006121 Parcel data = Parcel.obtain();
6122 Parcel reply = Parcel.obtain();
6123 data.writeInterfaceToken(IActivityManager.descriptor);
6124 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006125 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006126 reply.readException();
6127 data.recycle();
6128 reply.recycle();
6129 }
6130
6131 @Override
6132 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6133 Parcel data = Parcel.obtain();
6134 Parcel reply = Parcel.obtain();
6135 data.writeInterfaceToken(IActivityManager.descriptor);
6136 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006137 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006138 reply.readException();
6139 data.recycle();
6140 reply.recycle();
6141 }
6142
Craig Mautner8746a472014-07-24 15:12:54 -07006143 @Override
6144 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6145 Parcel data = Parcel.obtain();
6146 Parcel reply = Parcel.obtain();
6147 data.writeInterfaceToken(IActivityManager.descriptor);
6148 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006149 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006150 reply.readException();
6151 data.recycle();
6152 reply.recycle();
6153 }
6154
Craig Mautner6e2f3952014-09-09 14:26:41 -07006155 @Override
6156 public void bootAnimationComplete() throws RemoteException {
6157 Parcel data = Parcel.obtain();
6158 Parcel reply = Parcel.obtain();
6159 data.writeInterfaceToken(IActivityManager.descriptor);
6160 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6161 reply.readException();
6162 data.recycle();
6163 reply.recycle();
6164 }
6165
Wale Ogunwale18795a22014-12-03 11:38:33 -08006166 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006167 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6168 Parcel data = Parcel.obtain();
6169 Parcel reply = Parcel.obtain();
6170 data.writeInterfaceToken(IActivityManager.descriptor);
6171 data.writeInt(uid);
6172 data.writeByteArray(firstPacket);
6173 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6174 reply.readException();
6175 data.recycle();
6176 reply.recycle();
6177 }
6178
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006179 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006180 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6181 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006182 Parcel data = Parcel.obtain();
6183 Parcel reply = Parcel.obtain();
6184 data.writeInterfaceToken(IActivityManager.descriptor);
6185 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006186 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006187 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006188 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006189 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6190 reply.readException();
6191 data.recycle();
6192 reply.recycle();
6193 }
6194
6195 @Override
6196 public void dumpHeapFinished(String path) throws RemoteException {
6197 Parcel data = Parcel.obtain();
6198 Parcel reply = Parcel.obtain();
6199 data.writeInterfaceToken(IActivityManager.descriptor);
6200 data.writeString(path);
6201 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6202 reply.readException();
6203 data.recycle();
6204 reply.recycle();
6205 }
6206
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006207 @Override
6208 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6209 throws RemoteException {
6210 Parcel data = Parcel.obtain();
6211 Parcel reply = Parcel.obtain();
6212 data.writeInterfaceToken(IActivityManager.descriptor);
6213 data.writeStrongBinder(session.asBinder());
6214 data.writeInt(keepAwake ? 1 : 0);
6215 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6216 reply.readException();
6217 data.recycle();
6218 reply.recycle();
6219 }
6220
Craig Mautnere5600772015-04-03 21:36:37 -07006221 @Override
6222 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6223 Parcel data = Parcel.obtain();
6224 Parcel reply = Parcel.obtain();
6225 data.writeInterfaceToken(IActivityManager.descriptor);
6226 data.writeInt(userId);
6227 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006228 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006229 reply.readException();
6230 data.recycle();
6231 reply.recycle();
6232 }
6233
Dianne Hackborn1e383822015-04-10 14:02:33 -07006234 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006235 public void updateDeviceOwner(String packageName) throws RemoteException {
6236 Parcel data = Parcel.obtain();
6237 Parcel reply = Parcel.obtain();
6238 data.writeInterfaceToken(IActivityManager.descriptor);
6239 data.writeString(packageName);
6240 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6241 reply.readException();
6242 data.recycle();
6243 reply.recycle();
6244 }
6245
6246 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006247 public int getPackageProcessState(String packageName, String callingPackage)
6248 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006249 Parcel data = Parcel.obtain();
6250 Parcel reply = Parcel.obtain();
6251 data.writeInterfaceToken(IActivityManager.descriptor);
6252 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006253 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006254 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6255 reply.readException();
6256 int res = reply.readInt();
6257 data.recycle();
6258 reply.recycle();
6259 return res;
6260 }
6261
Stefan Kuhne16045c22015-06-05 07:18:06 -07006262 @Override
6263 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6264 throws RemoteException {
6265 Parcel data = Parcel.obtain();
6266 Parcel reply = Parcel.obtain();
6267 data.writeInterfaceToken(IActivityManager.descriptor);
6268 data.writeString(process);
6269 data.writeInt(userId);
6270 data.writeInt(level);
6271 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6272 reply.readException();
6273 int res = reply.readInt();
6274 data.recycle();
6275 reply.recycle();
6276 return res != 0;
6277 }
6278
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006279 @Override
6280 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6281 Parcel data = Parcel.obtain();
6282 Parcel reply = Parcel.obtain();
6283 data.writeInterfaceToken(IActivityManager.descriptor);
6284 data.writeStrongBinder(token);
6285 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6286 reply.readException();
6287 int res = reply.readInt();
6288 data.recycle();
6289 reply.recycle();
6290 return res != 0;
6291 }
6292
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006293 @Override
6294 public void moveActivityToStack(IBinder token, int stackId) throws RemoteException {
6295 Parcel data = Parcel.obtain();
6296 Parcel reply = Parcel.obtain();
6297 data.writeInterfaceToken(IActivityManager.descriptor);
6298 data.writeStrongBinder(token);
6299 data.writeInt(stackId);
6300 mRemote.transact(MOVE_ACTIVITY_TO_STACK_TRANSACTION, data, reply, 0);
6301 reply.readException();
6302 data.recycle();
6303 reply.recycle();
6304 }
6305
6306 @Override
6307 public int getActivityStackId(IBinder token) throws RemoteException {
6308 Parcel data = Parcel.obtain();
6309 Parcel reply = Parcel.obtain();
6310 data.writeInterfaceToken(IActivityManager.descriptor);
6311 data.writeStrongBinder(token);
6312 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6313 reply.readException();
6314 int stackId = reply.readInt();
6315 data.recycle();
6316 reply.recycle();
6317 return stackId;
6318 }
6319
Filip Gruszczynski23493322015-07-29 17:02:59 -07006320 @Override
6321 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006322 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6323 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006324 Parcel data = Parcel.obtain();
6325 Parcel reply = Parcel.obtain();
6326 data.writeInterfaceToken(IActivityManager.descriptor);
6327 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006328 writeIntArray(horizontalSizeConfiguration, data);
6329 writeIntArray(verticalSizeConfigurations, data);
6330 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006331 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6332 reply.readException();
6333 data.recycle();
6334 reply.recycle();
6335 }
6336
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006337 private static void writeIntArray(int[] array, Parcel data) {
6338 if (array == null) {
6339 data.writeInt(0);
6340 } else {
6341 data.writeInt(array.length);
6342 data.writeIntArray(array);
6343 }
6344 }
6345
Wale Ogunwale83301a92015-09-24 15:54:08 -07006346 @Override
6347 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6348 Parcel data = Parcel.obtain();
6349 Parcel reply = Parcel.obtain();
6350 data.writeInterfaceToken(IActivityManager.descriptor);
6351 data.writeInt(suppress ? 1 : 0);
6352 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6353 reply.readException();
6354 data.recycle();
6355 reply.recycle();
6356 }
6357
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006358 @Override
6359 public void removeStack(int stackId) throws RemoteException {
6360 Parcel data = Parcel.obtain();
6361 Parcel reply = Parcel.obtain();
6362 data.writeInterfaceToken(IActivityManager.descriptor);
6363 data.writeInt(stackId);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006364 mRemote.transact(REMOVE_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006365 reply.readException();
6366 data.recycle();
6367 reply.recycle();
6368 }
6369
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006370 @Override
6371 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6372 Parcel data = Parcel.obtain();
6373 Parcel reply = Parcel.obtain();
6374 data.writeInterfaceToken(IActivityManager.descriptor);
6375 data.writeInt(uid);
6376 data.writeString(packageName);
6377 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6378 reply.readException();
6379 int res = reply.readInt();
6380 data.recycle();
6381 reply.recycle();
6382 return res;
6383 }
6384
Wale Ogunwale5f986092015-12-04 15:35:38 -08006385 @Override
6386 public boolean inMultiWindowMode(IBinder token) throws RemoteException {
6387 Parcel data = Parcel.obtain();
6388 Parcel reply = Parcel.obtain();
6389 data.writeInterfaceToken(IActivityManager.descriptor);
6390 data.writeStrongBinder(token);
6391 mRemote.transact(IN_MULTI_WINDOW_MODE_TRANSACTION, data, reply, 0);
6392 reply.readException();
6393 final boolean multiWindowMode = reply.readInt() == 1 ? true : false;
6394 data.recycle();
6395 reply.recycle();
6396 return multiWindowMode;
6397 }
6398
6399 @Override
6400 public boolean inPictureInPictureMode(IBinder token) throws RemoteException {
6401 Parcel data = Parcel.obtain();
6402 Parcel reply = Parcel.obtain();
6403 data.writeInterfaceToken(IActivityManager.descriptor);
6404 data.writeStrongBinder(token);
6405 mRemote.transact(IN_PICTURE_IN_PICTURE_MODE_TRANSACTION, data, reply, 0);
6406 reply.readException();
6407 final boolean pipMode = reply.readInt() == 1 ? true : false;
6408 data.recycle();
6409 reply.recycle();
6410 return pipMode;
6411 }
6412
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006413 private IBinder mRemote;
6414}