blob: 4cb261927ef8f11f4da11810a18050bc72f4e8e2 [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);
Felipe Leme4cc86332015-12-04 16:37:28 -08002231 boolean progress = data.readInt() != 0;
2232 requestBugReport(progress);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002233 reply.writeNoException();
2234 return true;
2235 }
2236
2237 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2238 data.enforceInterface(IActivityManager.descriptor);
2239 int pid = data.readInt();
2240 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002241 String reason = data.readString();
2242 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002243 reply.writeNoException();
2244 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002245 return true;
2246 }
2247
Adam Skorydfc7fd72013-08-05 19:23:41 -07002248 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002249 data.enforceInterface(IActivityManager.descriptor);
2250 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002251 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002252 reply.writeNoException();
2253 reply.writeBundle(res);
2254 return true;
2255 }
2256
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002257 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2258 data.enforceInterface(IActivityManager.descriptor);
2259 int requestType = data.readInt();
2260 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002261 IBinder activityToken = data.readStrongBinder();
2262 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002263 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002264 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002265 return true;
2266 }
2267
Adam Skorydfc7fd72013-08-05 19:23:41 -07002268 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002269 data.enforceInterface(IActivityManager.descriptor);
2270 IBinder token = data.readStrongBinder();
2271 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002272 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2273 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002274 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2275 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002276 reply.writeNoException();
2277 return true;
2278 }
2279
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002280 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2281 data.enforceInterface(IActivityManager.descriptor);
2282 Intent intent = Intent.CREATOR.createFromParcel(data);
2283 int requestType = data.readInt();
2284 String hint = data.readString();
2285 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002286 Bundle args = data.readBundle();
2287 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002288 reply.writeNoException();
2289 reply.writeInt(res ? 1 : 0);
2290 return true;
2291 }
2292
Benjamin Franzc200f442015-06-25 18:20:04 +01002293 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2294 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002295 boolean res = isAssistDataAllowedOnCurrentActivity();
2296 reply.writeNoException();
2297 reply.writeInt(res ? 1 : 0);
2298 return true;
2299 }
2300
2301 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2302 data.enforceInterface(IActivityManager.descriptor);
2303 IBinder token = data.readStrongBinder();
2304 Bundle args = data.readBundle();
2305 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002306 reply.writeNoException();
2307 reply.writeInt(res ? 1 : 0);
2308 return true;
2309 }
2310
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002311 case KILL_UID_TRANSACTION: {
2312 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002313 int appId = data.readInt();
2314 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002315 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002316 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002317 reply.writeNoException();
2318 return true;
2319 }
2320
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002321 case HANG_TRANSACTION: {
2322 data.enforceInterface(IActivityManager.descriptor);
2323 IBinder who = data.readStrongBinder();
2324 boolean allowRestart = data.readInt() != 0;
2325 hang(who, allowRestart);
2326 reply.writeNoException();
2327 return true;
2328 }
2329
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002330 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2331 data.enforceInterface(IActivityManager.descriptor);
2332 IBinder token = data.readStrongBinder();
2333 reportActivityFullyDrawn(token);
2334 reply.writeNoException();
2335 return true;
2336 }
2337
Craig Mautner5eda9b32013-07-02 11:58:16 -07002338 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2339 data.enforceInterface(IActivityManager.descriptor);
2340 IBinder token = data.readStrongBinder();
2341 notifyActivityDrawn(token);
2342 reply.writeNoException();
2343 return true;
2344 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002345
2346 case RESTART_TRANSACTION: {
2347 data.enforceInterface(IActivityManager.descriptor);
2348 restart();
2349 reply.writeNoException();
2350 return true;
2351 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002352
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002353 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2354 data.enforceInterface(IActivityManager.descriptor);
2355 performIdleMaintenance();
2356 reply.writeNoException();
2357 return true;
2358 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002359
Todd Kennedyca4d8422015-01-15 15:19:22 -08002360 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002361 data.enforceInterface(IActivityManager.descriptor);
2362 IBinder parentActivityToken = data.readStrongBinder();
2363 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002364 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002365 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002366 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002367 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002368 if (activityContainer != null) {
2369 reply.writeInt(1);
2370 reply.writeStrongBinder(activityContainer.asBinder());
2371 } else {
2372 reply.writeInt(0);
2373 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002374 return true;
2375 }
2376
Craig Mautner95da1082014-02-24 17:54:35 -08002377 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2378 data.enforceInterface(IActivityManager.descriptor);
2379 IActivityContainer activityContainer =
2380 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2381 deleteActivityContainer(activityContainer);
2382 reply.writeNoException();
2383 return true;
2384 }
2385
Todd Kennedy4900bf92015-01-16 16:05:14 -08002386 case CREATE_STACK_ON_DISPLAY: {
2387 data.enforceInterface(IActivityManager.descriptor);
2388 int displayId = data.readInt();
2389 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2390 reply.writeNoException();
2391 if (activityContainer != null) {
2392 reply.writeInt(1);
2393 reply.writeStrongBinder(activityContainer.asBinder());
2394 } else {
2395 reply.writeInt(0);
2396 }
2397 return true;
2398 }
2399
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002400 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002401 data.enforceInterface(IActivityManager.descriptor);
2402 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002403 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002404 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002405 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002406 return true;
2407 }
2408
Craig Mautneraea74a52014-03-08 14:23:10 -08002409 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2410 data.enforceInterface(IActivityManager.descriptor);
2411 final int taskId = data.readInt();
2412 startLockTaskMode(taskId);
2413 reply.writeNoException();
2414 return true;
2415 }
2416
2417 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2418 data.enforceInterface(IActivityManager.descriptor);
2419 IBinder token = data.readStrongBinder();
2420 startLockTaskMode(token);
2421 reply.writeNoException();
2422 return true;
2423 }
2424
Craig Mautnerd61dc202014-07-07 11:09:11 -07002425 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002426 data.enforceInterface(IActivityManager.descriptor);
2427 startLockTaskModeOnCurrent();
2428 reply.writeNoException();
2429 return true;
2430 }
2431
Craig Mautneraea74a52014-03-08 14:23:10 -08002432 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2433 data.enforceInterface(IActivityManager.descriptor);
2434 stopLockTaskMode();
2435 reply.writeNoException();
2436 return true;
2437 }
2438
Craig Mautnerd61dc202014-07-07 11:09:11 -07002439 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002440 data.enforceInterface(IActivityManager.descriptor);
2441 stopLockTaskModeOnCurrent();
2442 reply.writeNoException();
2443 return true;
2444 }
2445
Craig Mautneraea74a52014-03-08 14:23:10 -08002446 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2447 data.enforceInterface(IActivityManager.descriptor);
2448 final boolean isInLockTaskMode = isInLockTaskMode();
2449 reply.writeNoException();
2450 reply.writeInt(isInLockTaskMode ? 1 : 0);
2451 return true;
2452 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002453
Benjamin Franz43261142015-02-11 15:59:44 +00002454 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2455 data.enforceInterface(IActivityManager.descriptor);
2456 final int lockTaskModeState = getLockTaskModeState();
2457 reply.writeNoException();
2458 reply.writeInt(lockTaskModeState);
2459 return true;
2460 }
2461
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002462 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2463 data.enforceInterface(IActivityManager.descriptor);
2464 final IBinder token = data.readStrongBinder();
2465 showLockTaskEscapeMessage(token);
2466 reply.writeNoException();
2467 return true;
2468 }
2469
Winson Chunga449dc02014-05-16 11:15:04 -07002470 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002471 data.enforceInterface(IActivityManager.descriptor);
2472 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002473 ActivityManager.TaskDescription values =
2474 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2475 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002476 reply.writeNoException();
2477 return true;
2478 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002479
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002480 case SET_TASK_RESIZEABLE_TRANSACTION: {
2481 data.enforceInterface(IActivityManager.descriptor);
2482 int taskId = data.readInt();
2483 boolean resizeable = (data.readInt() == 1) ? true : false;
2484 setTaskResizeable(taskId, resizeable);
2485 reply.writeNoException();
2486 return true;
2487 }
2488
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002489 case RESIZE_TASK_TRANSACTION: {
2490 data.enforceInterface(IActivityManager.descriptor);
2491 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002492 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002493 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002494 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002495 reply.writeNoException();
2496 return true;
2497 }
2498
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002499 case GET_TASK_BOUNDS_TRANSACTION: {
2500 data.enforceInterface(IActivityManager.descriptor);
2501 int taskId = data.readInt();
2502 Rect r = getTaskBounds(taskId);
2503 reply.writeNoException();
2504 r.writeToParcel(reply, 0);
2505 return true;
2506 }
2507
Craig Mautner648f69b2014-09-18 14:16:26 -07002508 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2509 data.enforceInterface(IActivityManager.descriptor);
2510 String filename = data.readString();
Suprabh Shukla23593142015-11-03 17:31:15 -08002511 int userId = data.readInt();
2512 Bitmap icon = getTaskDescriptionIcon(filename, userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07002513 reply.writeNoException();
2514 if (icon == null) {
2515 reply.writeInt(0);
2516 } else {
2517 reply.writeInt(1);
2518 icon.writeToParcel(reply, 0);
2519 }
2520 return true;
2521 }
2522
Winson Chung044d5292014-11-06 11:05:19 -08002523 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2524 data.enforceInterface(IActivityManager.descriptor);
2525 final Bundle bundle;
2526 if (data.readInt() == 0) {
2527 bundle = null;
2528 } else {
2529 bundle = data.readBundle();
2530 }
Chong Zhang280d3322015-11-03 17:27:26 -08002531 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002532 startInPlaceAnimationOnFrontMostApplication(options);
2533 reply.writeNoException();
2534 return true;
2535 }
2536
Jose Lima4b6c6692014-08-12 17:41:12 -07002537 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002538 data.enforceInterface(IActivityManager.descriptor);
2539 IBinder token = data.readStrongBinder();
2540 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002541 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002542 reply.writeNoException();
2543 reply.writeInt(success ? 1 : 0);
2544 return true;
2545 }
2546
Jose Lima4b6c6692014-08-12 17:41:12 -07002547 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002548 data.enforceInterface(IActivityManager.descriptor);
2549 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002550 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002551 reply.writeNoException();
2552 reply.writeInt(enabled ? 1 : 0);
2553 return true;
2554 }
2555
Jose Lima4b6c6692014-08-12 17:41:12 -07002556 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002557 data.enforceInterface(IActivityManager.descriptor);
2558 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002559 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002560 reply.writeNoException();
2561 return true;
2562 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002563
2564 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2565 data.enforceInterface(IActivityManager.descriptor);
2566 IBinder token = data.readStrongBinder();
2567 notifyLaunchTaskBehindComplete(token);
2568 reply.writeNoException();
2569 return true;
2570 }
Craig Mautner8746a472014-07-24 15:12:54 -07002571
2572 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2573 data.enforceInterface(IActivityManager.descriptor);
2574 IBinder token = data.readStrongBinder();
2575 notifyEnterAnimationComplete(token);
2576 reply.writeNoException();
2577 return true;
2578 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002579
2580 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2581 data.enforceInterface(IActivityManager.descriptor);
2582 bootAnimationComplete();
2583 reply.writeNoException();
2584 return true;
2585 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002586
Jeff Sharkey605eb792014-11-04 13:34:06 -08002587 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2588 data.enforceInterface(IActivityManager.descriptor);
2589 final int uid = data.readInt();
2590 final byte[] firstPacket = data.createByteArray();
2591 notifyCleartextNetwork(uid, firstPacket);
2592 reply.writeNoException();
2593 return true;
2594 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002595
2596 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2597 data.enforceInterface(IActivityManager.descriptor);
2598 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002599 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002600 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002601 String reportPackage = data.readString();
2602 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002603 reply.writeNoException();
2604 return true;
2605 }
2606
2607 case DUMP_HEAP_FINISHED_TRANSACTION: {
2608 data.enforceInterface(IActivityManager.descriptor);
2609 String path = data.readString();
2610 dumpHeapFinished(path);
2611 reply.writeNoException();
2612 return true;
2613 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002614
2615 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2616 data.enforceInterface(IActivityManager.descriptor);
2617 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2618 data.readStrongBinder());
2619 boolean keepAwake = data.readInt() != 0;
2620 setVoiceKeepAwake(session, keepAwake);
2621 reply.writeNoException();
2622 return true;
2623 }
Craig Mautnere5600772015-04-03 21:36:37 -07002624
2625 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2626 data.enforceInterface(IActivityManager.descriptor);
2627 int userId = data.readInt();
2628 String[] packages = data.readStringArray();
2629 updateLockTaskPackages(userId, packages);
2630 reply.writeNoException();
2631 return true;
2632 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002633
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002634 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2635 data.enforceInterface(IActivityManager.descriptor);
2636 String packageName = data.readString();
2637 updateDeviceOwner(packageName);
2638 reply.writeNoException();
2639 return true;
2640 }
2641
Dianne Hackborn1e383822015-04-10 14:02:33 -07002642 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2643 data.enforceInterface(IActivityManager.descriptor);
2644 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002645 String callingPackage = data.readString();
2646 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002647 reply.writeNoException();
2648 reply.writeInt(res);
2649 return true;
2650 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002651
2652 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2653 data.enforceInterface(IActivityManager.descriptor);
2654 String process = data.readString();
2655 int userId = data.readInt();
2656 int level = data.readInt();
2657 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2658 reply.writeNoException();
2659 reply.writeInt(res ? 1 : 0);
2660 return true;
2661 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002662
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002663 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2664 data.enforceInterface(IActivityManager.descriptor);
2665 IBinder token = data.readStrongBinder();
2666 boolean res = isRootVoiceInteraction(token);
2667 reply.writeNoException();
2668 reply.writeInt(res ? 1 : 0);
2669 return true;
2670 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002671
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002672 case START_BINDER_TRACKING_TRANSACTION: {
2673 data.enforceInterface(IActivityManager.descriptor);
2674 boolean res = startBinderTracking();
2675 reply.writeNoException();
2676 reply.writeInt(res ? 1 : 0);
2677 return true;
2678 }
2679
2680 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2681 data.enforceInterface(IActivityManager.descriptor);
2682 ParcelFileDescriptor fd = data.readInt() != 0
2683 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2684 boolean res = stopBinderTrackingAndDump(fd);
2685 reply.writeNoException();
2686 reply.writeInt(res ? 1 : 0);
2687 return true;
2688 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002689 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2690 data.enforceInterface(IActivityManager.descriptor);
2691 IBinder token = data.readStrongBinder();
2692 int stackId = getActivityStackId(token);
2693 reply.writeNoException();
2694 reply.writeInt(stackId);
2695 return true;
2696 }
2697 case MOVE_ACTIVITY_TO_STACK_TRANSACTION: {
2698 data.enforceInterface(IActivityManager.descriptor);
2699 IBinder token = data.readStrongBinder();
2700 int stackId = data.readInt();
2701 moveActivityToStack(token, stackId);
2702 reply.writeNoException();
2703 return true;
2704 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002705 case REPORT_SIZE_CONFIGURATIONS: {
2706 data.enforceInterface(IActivityManager.descriptor);
2707 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002708 int[] horizontal = readIntArray(data);
2709 int[] vertical = readIntArray(data);
2710 int[] smallest = readIntArray(data);
2711 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002712 return true;
2713 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002714 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2715 data.enforceInterface(IActivityManager.descriptor);
2716 final boolean suppress = data.readInt() == 1;
2717 suppressResizeConfigChanges(suppress);
2718 reply.writeNoException();
2719 return true;
2720 }
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08002721 case MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002722 data.enforceInterface(IActivityManager.descriptor);
2723 final int stackId = data.readInt();
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08002724 moveTasksToFullscreenStack(stackId);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002725 reply.writeNoException();
2726 return true;
2727 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002728 case GET_APP_START_MODE_TRANSACTION: {
2729 data.enforceInterface(IActivityManager.descriptor);
2730 final int uid = data.readInt();
2731 final String pkg = data.readString();
2732 int res = getAppStartMode(uid, pkg);
2733 reply.writeNoException();
2734 reply.writeInt(res);
2735 return true;
2736 }
Wale Ogunwale5f986092015-12-04 15:35:38 -08002737 case IN_MULTI_WINDOW_MODE_TRANSACTION: {
2738 data.enforceInterface(IActivityManager.descriptor);
2739 final IBinder token = data.readStrongBinder();
2740 final boolean multiWindowMode = inMultiWindowMode(token);
2741 reply.writeNoException();
2742 reply.writeInt(multiWindowMode ? 1 : 0);
2743 return true;
2744 }
2745 case IN_PICTURE_IN_PICTURE_MODE_TRANSACTION: {
2746 data.enforceInterface(IActivityManager.descriptor);
2747 final IBinder token = data.readStrongBinder();
2748 final boolean pipMode = inPictureInPictureMode(token);
2749 reply.writeNoException();
2750 reply.writeInt(pipMode ? 1 : 0);
2751 return true;
2752 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002753 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002754
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002755 return super.onTransact(code, data, reply, flags);
2756 }
2757
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002758 private int[] readIntArray(Parcel data) {
2759 int[] smallest = null;
2760 int smallestSize = data.readInt();
2761 if (smallestSize > 0) {
2762 smallest = new int[smallestSize];
2763 data.readIntArray(smallest);
2764 }
2765 return smallest;
2766 }
2767
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002768 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002769 return this;
2770 }
2771
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002772 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2773 protected IActivityManager create() {
2774 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002775 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002776 Log.v("ActivityManager", "default service binder = " + b);
2777 }
2778 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002779 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002780 Log.v("ActivityManager", "default service = " + am);
2781 }
2782 return am;
2783 }
2784 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002785}
2786
2787class ActivityManagerProxy implements IActivityManager
2788{
2789 public ActivityManagerProxy(IBinder remote)
2790 {
2791 mRemote = remote;
2792 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002793
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002794 public IBinder asBinder()
2795 {
2796 return mRemote;
2797 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002798
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002799 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002800 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002801 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002802 Parcel data = Parcel.obtain();
2803 Parcel reply = Parcel.obtain();
2804 data.writeInterfaceToken(IActivityManager.descriptor);
2805 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002806 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002807 intent.writeToParcel(data, 0);
2808 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002809 data.writeStrongBinder(resultTo);
2810 data.writeString(resultWho);
2811 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002812 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002813 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002814 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002815 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002816 } else {
2817 data.writeInt(0);
2818 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002819 if (options != null) {
2820 data.writeInt(1);
2821 options.writeToParcel(data, 0);
2822 } else {
2823 data.writeInt(0);
2824 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002825 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2826 reply.readException();
2827 int result = reply.readInt();
2828 reply.recycle();
2829 data.recycle();
2830 return result;
2831 }
Amith Yamasani82644082012-08-03 13:09:11 -07002832
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002833 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002834 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002835 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2836 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002837 Parcel data = Parcel.obtain();
2838 Parcel reply = Parcel.obtain();
2839 data.writeInterfaceToken(IActivityManager.descriptor);
2840 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002841 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002842 intent.writeToParcel(data, 0);
2843 data.writeString(resolvedType);
2844 data.writeStrongBinder(resultTo);
2845 data.writeString(resultWho);
2846 data.writeInt(requestCode);
2847 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002848 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002849 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002850 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002851 } else {
2852 data.writeInt(0);
2853 }
2854 if (options != null) {
2855 data.writeInt(1);
2856 options.writeToParcel(data, 0);
2857 } else {
2858 data.writeInt(0);
2859 }
2860 data.writeInt(userId);
2861 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2862 reply.readException();
2863 int result = reply.readInt();
2864 reply.recycle();
2865 data.recycle();
2866 return result;
2867 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002868 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2869 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002870 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2871 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002872 Parcel data = Parcel.obtain();
2873 Parcel reply = Parcel.obtain();
2874 data.writeInterfaceToken(IActivityManager.descriptor);
2875 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2876 data.writeString(callingPackage);
2877 intent.writeToParcel(data, 0);
2878 data.writeString(resolvedType);
2879 data.writeStrongBinder(resultTo);
2880 data.writeString(resultWho);
2881 data.writeInt(requestCode);
2882 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002883 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002884 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002885 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002886 } else {
2887 data.writeInt(0);
2888 }
2889 if (options != null) {
2890 data.writeInt(1);
2891 options.writeToParcel(data, 0);
2892 } else {
2893 data.writeInt(0);
2894 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002895 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002896 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002897 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2898 reply.readException();
2899 int result = reply.readInt();
2900 reply.recycle();
2901 data.recycle();
2902 return result;
2903 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002904 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2905 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002906 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2907 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002908 Parcel data = Parcel.obtain();
2909 Parcel reply = Parcel.obtain();
2910 data.writeInterfaceToken(IActivityManager.descriptor);
2911 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002912 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002913 intent.writeToParcel(data, 0);
2914 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002915 data.writeStrongBinder(resultTo);
2916 data.writeString(resultWho);
2917 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002918 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002919 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002920 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002921 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002922 } else {
2923 data.writeInt(0);
2924 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002925 if (options != null) {
2926 data.writeInt(1);
2927 options.writeToParcel(data, 0);
2928 } else {
2929 data.writeInt(0);
2930 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002931 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002932 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2933 reply.readException();
2934 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2935 reply.recycle();
2936 data.recycle();
2937 return result;
2938 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002939 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2940 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002941 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002942 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002943 Parcel data = Parcel.obtain();
2944 Parcel reply = Parcel.obtain();
2945 data.writeInterfaceToken(IActivityManager.descriptor);
2946 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002947 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002948 intent.writeToParcel(data, 0);
2949 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002950 data.writeStrongBinder(resultTo);
2951 data.writeString(resultWho);
2952 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002953 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002954 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002955 if (options != null) {
2956 data.writeInt(1);
2957 options.writeToParcel(data, 0);
2958 } else {
2959 data.writeInt(0);
2960 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002961 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002962 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2963 reply.readException();
2964 int result = reply.readInt();
2965 reply.recycle();
2966 data.recycle();
2967 return result;
2968 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002969 public int startActivityIntentSender(IApplicationThread caller,
2970 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002971 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002972 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002973 Parcel data = Parcel.obtain();
2974 Parcel reply = Parcel.obtain();
2975 data.writeInterfaceToken(IActivityManager.descriptor);
2976 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2977 intent.writeToParcel(data, 0);
2978 if (fillInIntent != null) {
2979 data.writeInt(1);
2980 fillInIntent.writeToParcel(data, 0);
2981 } else {
2982 data.writeInt(0);
2983 }
2984 data.writeString(resolvedType);
2985 data.writeStrongBinder(resultTo);
2986 data.writeString(resultWho);
2987 data.writeInt(requestCode);
2988 data.writeInt(flagsMask);
2989 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002990 if (options != null) {
2991 data.writeInt(1);
2992 options.writeToParcel(data, 0);
2993 } else {
2994 data.writeInt(0);
2995 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002996 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002997 reply.readException();
2998 int result = reply.readInt();
2999 reply.recycle();
3000 data.recycle();
3001 return result;
3002 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07003003 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
3004 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07003005 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
3006 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003007 Parcel data = Parcel.obtain();
3008 Parcel reply = Parcel.obtain();
3009 data.writeInterfaceToken(IActivityManager.descriptor);
3010 data.writeString(callingPackage);
3011 data.writeInt(callingPid);
3012 data.writeInt(callingUid);
3013 intent.writeToParcel(data, 0);
3014 data.writeString(resolvedType);
3015 data.writeStrongBinder(session.asBinder());
3016 data.writeStrongBinder(interactor.asBinder());
3017 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003018 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003019 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003020 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07003021 } else {
3022 data.writeInt(0);
3023 }
3024 if (options != null) {
3025 data.writeInt(1);
3026 options.writeToParcel(data, 0);
3027 } else {
3028 data.writeInt(0);
3029 }
3030 data.writeInt(userId);
3031 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3032 reply.readException();
3033 int result = reply.readInt();
3034 reply.recycle();
3035 data.recycle();
3036 return result;
3037 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003038 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003039 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003040 Parcel data = Parcel.obtain();
3041 Parcel reply = Parcel.obtain();
3042 data.writeInterfaceToken(IActivityManager.descriptor);
3043 data.writeStrongBinder(callingActivity);
3044 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003045 if (options != null) {
3046 data.writeInt(1);
3047 options.writeToParcel(data, 0);
3048 } else {
3049 data.writeInt(0);
3050 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003051 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3052 reply.readException();
3053 int result = reply.readInt();
3054 reply.recycle();
3055 data.recycle();
3056 return result != 0;
3057 }
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003058 public int startActivityFromRecents(int taskId, int launchStackId, Bundle options)
3059 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003060 Parcel data = Parcel.obtain();
3061 Parcel reply = Parcel.obtain();
3062 data.writeInterfaceToken(IActivityManager.descriptor);
3063 data.writeInt(taskId);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003064 data.writeInt(launchStackId);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003065 if (options == null) {
3066 data.writeInt(0);
3067 } else {
3068 data.writeInt(1);
3069 options.writeToParcel(data, 0);
3070 }
3071 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3072 reply.readException();
3073 int result = reply.readInt();
3074 reply.recycle();
3075 data.recycle();
3076 return result;
3077 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003078 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003079 throws RemoteException {
3080 Parcel data = Parcel.obtain();
3081 Parcel reply = Parcel.obtain();
3082 data.writeInterfaceToken(IActivityManager.descriptor);
3083 data.writeStrongBinder(token);
3084 data.writeInt(resultCode);
3085 if (resultData != null) {
3086 data.writeInt(1);
3087 resultData.writeToParcel(data, 0);
3088 } else {
3089 data.writeInt(0);
3090 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003091 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003092 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3093 reply.readException();
3094 boolean res = reply.readInt() != 0;
3095 data.recycle();
3096 reply.recycle();
3097 return res;
3098 }
3099 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3100 {
3101 Parcel data = Parcel.obtain();
3102 Parcel reply = Parcel.obtain();
3103 data.writeInterfaceToken(IActivityManager.descriptor);
3104 data.writeStrongBinder(token);
3105 data.writeString(resultWho);
3106 data.writeInt(requestCode);
3107 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3108 reply.readException();
3109 data.recycle();
3110 reply.recycle();
3111 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003112 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3113 Parcel data = Parcel.obtain();
3114 Parcel reply = Parcel.obtain();
3115 data.writeInterfaceToken(IActivityManager.descriptor);
3116 data.writeStrongBinder(token);
3117 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3118 reply.readException();
3119 boolean res = reply.readInt() != 0;
3120 data.recycle();
3121 reply.recycle();
3122 return res;
3123 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003124 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3125 Parcel data = Parcel.obtain();
3126 Parcel reply = Parcel.obtain();
3127 data.writeInterfaceToken(IActivityManager.descriptor);
3128 data.writeStrongBinder(session.asBinder());
3129 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3130 reply.readException();
3131 data.recycle();
3132 reply.recycle();
3133 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003134 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3135 Parcel data = Parcel.obtain();
3136 Parcel reply = Parcel.obtain();
3137 data.writeInterfaceToken(IActivityManager.descriptor);
3138 data.writeStrongBinder(token);
3139 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3140 reply.readException();
3141 boolean res = reply.readInt() != 0;
3142 data.recycle();
3143 reply.recycle();
3144 return res;
3145 }
3146 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3147 Parcel data = Parcel.obtain();
3148 Parcel reply = Parcel.obtain();
3149 data.writeInterfaceToken(IActivityManager.descriptor);
3150 data.writeStrongBinder(app.asBinder());
3151 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3152 reply.readException();
3153 data.recycle();
3154 reply.recycle();
3155 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003156 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3157 Parcel data = Parcel.obtain();
3158 Parcel reply = Parcel.obtain();
3159 data.writeInterfaceToken(IActivityManager.descriptor);
3160 data.writeStrongBinder(token);
3161 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3162 reply.readException();
3163 boolean res = reply.readInt() != 0;
3164 data.recycle();
3165 reply.recycle();
3166 return res;
3167 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003168 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003169 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003170 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003171 {
3172 Parcel data = Parcel.obtain();
3173 Parcel reply = Parcel.obtain();
3174 data.writeInterfaceToken(IActivityManager.descriptor);
3175 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003176 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003177 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3178 filter.writeToParcel(data, 0);
3179 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003180 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003181 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3182 reply.readException();
3183 Intent intent = null;
3184 int haveIntent = reply.readInt();
3185 if (haveIntent != 0) {
3186 intent = Intent.CREATOR.createFromParcel(reply);
3187 }
3188 reply.recycle();
3189 data.recycle();
3190 return intent;
3191 }
3192 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3193 {
3194 Parcel data = Parcel.obtain();
3195 Parcel reply = Parcel.obtain();
3196 data.writeInterfaceToken(IActivityManager.descriptor);
3197 data.writeStrongBinder(receiver.asBinder());
3198 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3199 reply.readException();
3200 data.recycle();
3201 reply.recycle();
3202 }
3203 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003204 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003205 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003206 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003207 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003208 {
3209 Parcel data = Parcel.obtain();
3210 Parcel reply = Parcel.obtain();
3211 data.writeInterfaceToken(IActivityManager.descriptor);
3212 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3213 intent.writeToParcel(data, 0);
3214 data.writeString(resolvedType);
3215 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3216 data.writeInt(resultCode);
3217 data.writeString(resultData);
3218 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003219 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003220 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003221 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003222 data.writeInt(serialized ? 1 : 0);
3223 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003224 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003225 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3226 reply.readException();
3227 int res = reply.readInt();
3228 reply.recycle();
3229 data.recycle();
3230 return res;
3231 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003232 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3233 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003234 {
3235 Parcel data = Parcel.obtain();
3236 Parcel reply = Parcel.obtain();
3237 data.writeInterfaceToken(IActivityManager.descriptor);
3238 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3239 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003240 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003241 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3242 reply.readException();
3243 data.recycle();
3244 reply.recycle();
3245 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003246 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3247 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003248 {
3249 Parcel data = Parcel.obtain();
3250 Parcel reply = Parcel.obtain();
3251 data.writeInterfaceToken(IActivityManager.descriptor);
3252 data.writeStrongBinder(who);
3253 data.writeInt(resultCode);
3254 data.writeString(resultData);
3255 data.writeBundle(map);
3256 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003257 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003258 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3259 reply.readException();
3260 data.recycle();
3261 reply.recycle();
3262 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003263 public void attachApplication(IApplicationThread app) throws RemoteException
3264 {
3265 Parcel data = Parcel.obtain();
3266 Parcel reply = Parcel.obtain();
3267 data.writeInterfaceToken(IActivityManager.descriptor);
3268 data.writeStrongBinder(app.asBinder());
3269 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3270 reply.readException();
3271 data.recycle();
3272 reply.recycle();
3273 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003274 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3275 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003276 {
3277 Parcel data = Parcel.obtain();
3278 Parcel reply = Parcel.obtain();
3279 data.writeInterfaceToken(IActivityManager.descriptor);
3280 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003281 if (config != null) {
3282 data.writeInt(1);
3283 config.writeToParcel(data, 0);
3284 } else {
3285 data.writeInt(0);
3286 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003287 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003288 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3289 reply.readException();
3290 data.recycle();
3291 reply.recycle();
3292 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003293 public void activityResumed(IBinder token) throws RemoteException
3294 {
3295 Parcel data = Parcel.obtain();
3296 Parcel reply = Parcel.obtain();
3297 data.writeInterfaceToken(IActivityManager.descriptor);
3298 data.writeStrongBinder(token);
3299 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3300 reply.readException();
3301 data.recycle();
3302 reply.recycle();
3303 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003304 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003305 {
3306 Parcel data = Parcel.obtain();
3307 Parcel reply = Parcel.obtain();
3308 data.writeInterfaceToken(IActivityManager.descriptor);
3309 data.writeStrongBinder(token);
3310 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3311 reply.readException();
3312 data.recycle();
3313 reply.recycle();
3314 }
3315 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003316 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003317 {
3318 Parcel data = Parcel.obtain();
3319 Parcel reply = Parcel.obtain();
3320 data.writeInterfaceToken(IActivityManager.descriptor);
3321 data.writeStrongBinder(token);
3322 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003323 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003324 TextUtils.writeToParcel(description, data, 0);
3325 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3326 reply.readException();
3327 data.recycle();
3328 reply.recycle();
3329 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003330 public void activitySlept(IBinder token) throws RemoteException
3331 {
3332 Parcel data = Parcel.obtain();
3333 Parcel reply = Parcel.obtain();
3334 data.writeInterfaceToken(IActivityManager.descriptor);
3335 data.writeStrongBinder(token);
3336 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3337 reply.readException();
3338 data.recycle();
3339 reply.recycle();
3340 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003341 public void activityDestroyed(IBinder token) throws RemoteException
3342 {
3343 Parcel data = Parcel.obtain();
3344 Parcel reply = Parcel.obtain();
3345 data.writeInterfaceToken(IActivityManager.descriptor);
3346 data.writeStrongBinder(token);
3347 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3348 reply.readException();
3349 data.recycle();
3350 reply.recycle();
3351 }
3352 public String getCallingPackage(IBinder token) throws RemoteException
3353 {
3354 Parcel data = Parcel.obtain();
3355 Parcel reply = Parcel.obtain();
3356 data.writeInterfaceToken(IActivityManager.descriptor);
3357 data.writeStrongBinder(token);
3358 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3359 reply.readException();
3360 String res = reply.readString();
3361 data.recycle();
3362 reply.recycle();
3363 return res;
3364 }
3365 public ComponentName getCallingActivity(IBinder token)
3366 throws RemoteException {
3367 Parcel data = Parcel.obtain();
3368 Parcel reply = Parcel.obtain();
3369 data.writeInterfaceToken(IActivityManager.descriptor);
3370 data.writeStrongBinder(token);
3371 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3372 reply.readException();
3373 ComponentName res = ComponentName.readFromParcel(reply);
3374 data.recycle();
3375 reply.recycle();
3376 return res;
3377 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003378 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003379 Parcel data = Parcel.obtain();
3380 Parcel reply = Parcel.obtain();
3381 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003382 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003383 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3384 reply.readException();
3385 ArrayList<IAppTask> list = null;
3386 int N = reply.readInt();
3387 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003388 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003389 while (N > 0) {
3390 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3391 list.add(task);
3392 N--;
3393 }
3394 }
3395 data.recycle();
3396 reply.recycle();
3397 return list;
3398 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003399 public int addAppTask(IBinder activityToken, Intent intent,
3400 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3401 Parcel data = Parcel.obtain();
3402 Parcel reply = Parcel.obtain();
3403 data.writeInterfaceToken(IActivityManager.descriptor);
3404 data.writeStrongBinder(activityToken);
3405 intent.writeToParcel(data, 0);
3406 description.writeToParcel(data, 0);
3407 thumbnail.writeToParcel(data, 0);
3408 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3409 reply.readException();
3410 int res = reply.readInt();
3411 data.recycle();
3412 reply.recycle();
3413 return res;
3414 }
3415 public Point getAppTaskThumbnailSize() throws RemoteException {
3416 Parcel data = Parcel.obtain();
3417 Parcel reply = Parcel.obtain();
3418 data.writeInterfaceToken(IActivityManager.descriptor);
3419 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3420 reply.readException();
3421 Point size = Point.CREATOR.createFromParcel(reply);
3422 data.recycle();
3423 reply.recycle();
3424 return size;
3425 }
Todd Kennedye635f662015-01-20 10:36:49 -08003426 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3427 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003428 Parcel data = Parcel.obtain();
3429 Parcel reply = Parcel.obtain();
3430 data.writeInterfaceToken(IActivityManager.descriptor);
3431 data.writeInt(maxNum);
3432 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003433 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3434 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003435 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003436 int N = reply.readInt();
3437 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003438 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003439 while (N > 0) {
3440 ActivityManager.RunningTaskInfo info =
3441 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003442 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003443 list.add(info);
3444 N--;
3445 }
3446 }
3447 data.recycle();
3448 reply.recycle();
3449 return list;
3450 }
3451 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003452 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003453 Parcel data = Parcel.obtain();
3454 Parcel reply = Parcel.obtain();
3455 data.writeInterfaceToken(IActivityManager.descriptor);
3456 data.writeInt(maxNum);
3457 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003458 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003459 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3460 reply.readException();
3461 ArrayList<ActivityManager.RecentTaskInfo> list
3462 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3463 data.recycle();
3464 reply.recycle();
3465 return list;
3466 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003467 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003468 Parcel data = Parcel.obtain();
3469 Parcel reply = Parcel.obtain();
3470 data.writeInterfaceToken(IActivityManager.descriptor);
3471 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003472 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003473 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003474 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003475 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003476 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003477 }
3478 data.recycle();
3479 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003480 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003481 }
Todd Kennedye635f662015-01-20 10:36:49 -08003482 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3483 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003484 Parcel data = Parcel.obtain();
3485 Parcel reply = Parcel.obtain();
3486 data.writeInterfaceToken(IActivityManager.descriptor);
3487 data.writeInt(maxNum);
3488 data.writeInt(flags);
3489 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3490 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003491 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003492 int N = reply.readInt();
3493 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003494 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003495 while (N > 0) {
3496 ActivityManager.RunningServiceInfo info =
3497 ActivityManager.RunningServiceInfo.CREATOR
3498 .createFromParcel(reply);
3499 list.add(info);
3500 N--;
3501 }
3502 }
3503 data.recycle();
3504 reply.recycle();
3505 return list;
3506 }
3507 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3508 throws RemoteException {
3509 Parcel data = Parcel.obtain();
3510 Parcel reply = Parcel.obtain();
3511 data.writeInterfaceToken(IActivityManager.descriptor);
3512 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3513 reply.readException();
3514 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3515 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3516 data.recycle();
3517 reply.recycle();
3518 return list;
3519 }
3520 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3521 throws RemoteException {
3522 Parcel data = Parcel.obtain();
3523 Parcel reply = Parcel.obtain();
3524 data.writeInterfaceToken(IActivityManager.descriptor);
3525 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3526 reply.readException();
3527 ArrayList<ActivityManager.RunningAppProcessInfo> list
3528 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3529 data.recycle();
3530 reply.recycle();
3531 return list;
3532 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003533 public List<ApplicationInfo> getRunningExternalApplications()
3534 throws RemoteException {
3535 Parcel data = Parcel.obtain();
3536 Parcel reply = Parcel.obtain();
3537 data.writeInterfaceToken(IActivityManager.descriptor);
3538 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3539 reply.readException();
3540 ArrayList<ApplicationInfo> list
3541 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3542 data.recycle();
3543 reply.recycle();
3544 return list;
3545 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003546 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003547 {
3548 Parcel data = Parcel.obtain();
3549 Parcel reply = Parcel.obtain();
3550 data.writeInterfaceToken(IActivityManager.descriptor);
3551 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003552 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003553 if (options != null) {
3554 data.writeInt(1);
3555 options.writeToParcel(data, 0);
3556 } else {
3557 data.writeInt(0);
3558 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003559 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3560 reply.readException();
3561 data.recycle();
3562 reply.recycle();
3563 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003564 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3565 throws RemoteException {
3566 Parcel data = Parcel.obtain();
3567 Parcel reply = Parcel.obtain();
3568 data.writeInterfaceToken(IActivityManager.descriptor);
3569 data.writeStrongBinder(token);
3570 data.writeInt(nonRoot ? 1 : 0);
3571 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3572 reply.readException();
3573 boolean res = reply.readInt() != 0;
3574 data.recycle();
3575 reply.recycle();
3576 return res;
3577 }
3578 public void moveTaskBackwards(int task) throws RemoteException
3579 {
3580 Parcel data = Parcel.obtain();
3581 Parcel reply = Parcel.obtain();
3582 data.writeInterfaceToken(IActivityManager.descriptor);
3583 data.writeInt(task);
3584 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3585 reply.readException();
3586 data.recycle();
3587 reply.recycle();
3588 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003589 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003590 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3591 {
3592 Parcel data = Parcel.obtain();
3593 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003594 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003595 data.writeInt(taskId);
3596 data.writeInt(stackId);
3597 data.writeInt(toTop ? 1 : 0);
3598 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3599 reply.readException();
3600 data.recycle();
3601 reply.recycle();
3602 }
3603 @Override
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003604 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
3605 Rect initialBounds) throws RemoteException
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003606 {
3607 Parcel data = Parcel.obtain();
3608 Parcel reply = Parcel.obtain();
3609 data.writeInterfaceToken(IActivityManager.descriptor);
3610 data.writeInt(taskId);
3611 data.writeInt(createMode);
3612 data.writeInt(toTop ? 1 : 0);
Jorim Jaggi030979c2015-11-20 15:14:43 -08003613 data.writeInt(animate ? 1 : 0);
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003614 if (initialBounds != null) {
3615 data.writeInt(1);
3616 initialBounds.writeToParcel(data, 0);
3617 } else {
3618 data.writeInt(0);
3619 }
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003620 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3621 reply.readException();
3622 data.recycle();
3623 reply.recycle();
3624 }
3625 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003626 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3627 throws RemoteException
3628 {
3629 Parcel data = Parcel.obtain();
3630 Parcel reply = Parcel.obtain();
3631 data.writeInterfaceToken(IActivityManager.descriptor);
3632 data.writeInt(stackId);
3633 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003634 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003635 reply.readException();
3636 final boolean res = reply.readInt() != 0;
3637 data.recycle();
3638 reply.recycle();
3639 return res;
3640 }
3641 @Override
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003642 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode)
3643 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003644 {
3645 Parcel data = Parcel.obtain();
3646 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003647 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003648 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003649 if (r != null) {
3650 data.writeInt(1);
3651 r.writeToParcel(data, 0);
3652 } else {
3653 data.writeInt(0);
3654 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003655 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003656 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003657 reply.readException();
3658 data.recycle();
3659 reply.recycle();
3660 }
Craig Mautner967212c2013-04-13 21:10:58 -07003661 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003662 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3663 {
3664 Parcel data = Parcel.obtain();
3665 Parcel reply = Parcel.obtain();
3666 data.writeInterfaceToken(IActivityManager.descriptor);
3667 data.writeInt(taskId);
3668 data.writeInt(stackId);
3669 data.writeInt(position);
3670 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3671 reply.readException();
3672 data.recycle();
3673 reply.recycle();
3674 }
3675 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003676 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003677 {
3678 Parcel data = Parcel.obtain();
3679 Parcel reply = Parcel.obtain();
3680 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003681 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003682 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003683 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003684 data.recycle();
3685 reply.recycle();
3686 return list;
3687 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003688 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003689 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003690 {
3691 Parcel data = Parcel.obtain();
3692 Parcel reply = Parcel.obtain();
3693 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003694 data.writeInt(stackId);
3695 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003696 reply.readException();
3697 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003698 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003699 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003700 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003701 }
3702 data.recycle();
3703 reply.recycle();
3704 return info;
3705 }
3706 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003707 public boolean isInHomeStack(int taskId) throws RemoteException {
3708 Parcel data = Parcel.obtain();
3709 Parcel reply = Parcel.obtain();
3710 data.writeInterfaceToken(IActivityManager.descriptor);
3711 data.writeInt(taskId);
3712 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3713 reply.readException();
3714 boolean isInHomeStack = reply.readInt() > 0;
3715 data.recycle();
3716 reply.recycle();
3717 return isInHomeStack;
3718 }
3719 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003720 public void setFocusedStack(int stackId) throws RemoteException
3721 {
3722 Parcel data = Parcel.obtain();
3723 Parcel reply = Parcel.obtain();
3724 data.writeInterfaceToken(IActivityManager.descriptor);
3725 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003726 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003727 reply.readException();
3728 data.recycle();
3729 reply.recycle();
3730 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003731 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003732 public int getFocusedStackId() throws RemoteException {
3733 Parcel data = Parcel.obtain();
3734 Parcel reply = Parcel.obtain();
3735 data.writeInterfaceToken(IActivityManager.descriptor);
3736 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3737 reply.readException();
3738 int focusedStackId = reply.readInt();
3739 data.recycle();
3740 reply.recycle();
3741 return focusedStackId;
3742 }
3743 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003744 public void setFocusedTask(int taskId) throws RemoteException
3745 {
3746 Parcel data = Parcel.obtain();
3747 Parcel reply = Parcel.obtain();
3748 data.writeInterfaceToken(IActivityManager.descriptor);
3749 data.writeInt(taskId);
3750 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3751 reply.readException();
3752 data.recycle();
3753 reply.recycle();
3754 }
3755 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003756 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3757 {
3758 Parcel data = Parcel.obtain();
3759 Parcel reply = Parcel.obtain();
3760 data.writeInterfaceToken(IActivityManager.descriptor);
3761 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003762 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003763 reply.readException();
3764 data.recycle();
3765 reply.recycle();
3766 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003767 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3768 {
3769 Parcel data = Parcel.obtain();
3770 Parcel reply = Parcel.obtain();
3771 data.writeInterfaceToken(IActivityManager.descriptor);
3772 data.writeStrongBinder(token);
3773 data.writeInt(onlyRoot ? 1 : 0);
3774 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3775 reply.readException();
3776 int res = reply.readInt();
3777 data.recycle();
3778 reply.recycle();
3779 return res;
3780 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003781 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003782 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003783 Parcel data = Parcel.obtain();
3784 Parcel reply = Parcel.obtain();
3785 data.writeInterfaceToken(IActivityManager.descriptor);
3786 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3787 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003788 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003789 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003790 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3791 reply.readException();
3792 int res = reply.readInt();
3793 ContentProviderHolder cph = null;
3794 if (res != 0) {
3795 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3796 }
3797 data.recycle();
3798 reply.recycle();
3799 return cph;
3800 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003801 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3802 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003803 Parcel data = Parcel.obtain();
3804 Parcel reply = Parcel.obtain();
3805 data.writeInterfaceToken(IActivityManager.descriptor);
3806 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003807 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003808 data.writeStrongBinder(token);
3809 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3810 reply.readException();
3811 int res = reply.readInt();
3812 ContentProviderHolder cph = null;
3813 if (res != 0) {
3814 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3815 }
3816 data.recycle();
3817 reply.recycle();
3818 return cph;
3819 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003820 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003821 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003822 {
3823 Parcel data = Parcel.obtain();
3824 Parcel reply = Parcel.obtain();
3825 data.writeInterfaceToken(IActivityManager.descriptor);
3826 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3827 data.writeTypedList(providers);
3828 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3829 reply.readException();
3830 data.recycle();
3831 reply.recycle();
3832 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003833 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3834 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003835 Parcel data = Parcel.obtain();
3836 Parcel reply = Parcel.obtain();
3837 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003838 data.writeStrongBinder(connection);
3839 data.writeInt(stable);
3840 data.writeInt(unstable);
3841 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3842 reply.readException();
3843 boolean res = reply.readInt() != 0;
3844 data.recycle();
3845 reply.recycle();
3846 return res;
3847 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003848
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003849 public void unstableProviderDied(IBinder connection) throws RemoteException {
3850 Parcel data = Parcel.obtain();
3851 Parcel reply = Parcel.obtain();
3852 data.writeInterfaceToken(IActivityManager.descriptor);
3853 data.writeStrongBinder(connection);
3854 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3855 reply.readException();
3856 data.recycle();
3857 reply.recycle();
3858 }
3859
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003860 @Override
3861 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3862 Parcel data = Parcel.obtain();
3863 Parcel reply = Parcel.obtain();
3864 data.writeInterfaceToken(IActivityManager.descriptor);
3865 data.writeStrongBinder(connection);
3866 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3867 reply.readException();
3868 data.recycle();
3869 reply.recycle();
3870 }
3871
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003872 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3873 Parcel data = Parcel.obtain();
3874 Parcel reply = Parcel.obtain();
3875 data.writeInterfaceToken(IActivityManager.descriptor);
3876 data.writeStrongBinder(connection);
3877 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003878 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3879 reply.readException();
3880 data.recycle();
3881 reply.recycle();
3882 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003883
3884 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3885 Parcel data = Parcel.obtain();
3886 Parcel reply = Parcel.obtain();
3887 data.writeInterfaceToken(IActivityManager.descriptor);
3888 data.writeString(name);
3889 data.writeStrongBinder(token);
3890 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3891 reply.readException();
3892 data.recycle();
3893 reply.recycle();
3894 }
3895
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003896 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3897 throws RemoteException
3898 {
3899 Parcel data = Parcel.obtain();
3900 Parcel reply = Parcel.obtain();
3901 data.writeInterfaceToken(IActivityManager.descriptor);
3902 service.writeToParcel(data, 0);
3903 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3904 reply.readException();
3905 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3906 data.recycle();
3907 reply.recycle();
3908 return res;
3909 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003910
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003911 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003912 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003913 {
3914 Parcel data = Parcel.obtain();
3915 Parcel reply = Parcel.obtain();
3916 data.writeInterfaceToken(IActivityManager.descriptor);
3917 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3918 service.writeToParcel(data, 0);
3919 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003920 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003921 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003922 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3923 reply.readException();
3924 ComponentName res = ComponentName.readFromParcel(reply);
3925 data.recycle();
3926 reply.recycle();
3927 return res;
3928 }
3929 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003930 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003931 {
3932 Parcel data = Parcel.obtain();
3933 Parcel reply = Parcel.obtain();
3934 data.writeInterfaceToken(IActivityManager.descriptor);
3935 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3936 service.writeToParcel(data, 0);
3937 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003938 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003939 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3940 reply.readException();
3941 int res = reply.readInt();
3942 reply.recycle();
3943 data.recycle();
3944 return res;
3945 }
3946 public boolean stopServiceToken(ComponentName className, IBinder token,
3947 int startId) throws RemoteException {
3948 Parcel data = Parcel.obtain();
3949 Parcel reply = Parcel.obtain();
3950 data.writeInterfaceToken(IActivityManager.descriptor);
3951 ComponentName.writeToParcel(className, data);
3952 data.writeStrongBinder(token);
3953 data.writeInt(startId);
3954 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3955 reply.readException();
3956 boolean res = reply.readInt() != 0;
3957 data.recycle();
3958 reply.recycle();
3959 return res;
3960 }
3961 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003962 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003963 Parcel data = Parcel.obtain();
3964 Parcel reply = Parcel.obtain();
3965 data.writeInterfaceToken(IActivityManager.descriptor);
3966 ComponentName.writeToParcel(className, data);
3967 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003968 data.writeInt(id);
3969 if (notification != null) {
3970 data.writeInt(1);
3971 notification.writeToParcel(data, 0);
3972 } else {
3973 data.writeInt(0);
3974 }
3975 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003976 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3977 reply.readException();
3978 data.recycle();
3979 reply.recycle();
3980 }
3981 public int bindService(IApplicationThread caller, IBinder token,
3982 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07003983 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003984 Parcel data = Parcel.obtain();
3985 Parcel reply = Parcel.obtain();
3986 data.writeInterfaceToken(IActivityManager.descriptor);
3987 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3988 data.writeStrongBinder(token);
3989 service.writeToParcel(data, 0);
3990 data.writeString(resolvedType);
3991 data.writeStrongBinder(connection.asBinder());
3992 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07003993 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003994 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003995 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3996 reply.readException();
3997 int res = reply.readInt();
3998 data.recycle();
3999 reply.recycle();
4000 return res;
4001 }
4002 public boolean unbindService(IServiceConnection connection) throws RemoteException
4003 {
4004 Parcel data = Parcel.obtain();
4005 Parcel reply = Parcel.obtain();
4006 data.writeInterfaceToken(IActivityManager.descriptor);
4007 data.writeStrongBinder(connection.asBinder());
4008 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
4009 reply.readException();
4010 boolean res = reply.readInt() != 0;
4011 data.recycle();
4012 reply.recycle();
4013 return res;
4014 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004015
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004016 public void publishService(IBinder token,
4017 Intent intent, IBinder service) throws RemoteException {
4018 Parcel data = Parcel.obtain();
4019 Parcel reply = Parcel.obtain();
4020 data.writeInterfaceToken(IActivityManager.descriptor);
4021 data.writeStrongBinder(token);
4022 intent.writeToParcel(data, 0);
4023 data.writeStrongBinder(service);
4024 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
4025 reply.readException();
4026 data.recycle();
4027 reply.recycle();
4028 }
4029
4030 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
4031 throws RemoteException {
4032 Parcel data = Parcel.obtain();
4033 Parcel reply = Parcel.obtain();
4034 data.writeInterfaceToken(IActivityManager.descriptor);
4035 data.writeStrongBinder(token);
4036 intent.writeToParcel(data, 0);
4037 data.writeInt(doRebind ? 1 : 0);
4038 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4039 reply.readException();
4040 data.recycle();
4041 reply.recycle();
4042 }
4043
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004044 public void serviceDoneExecuting(IBinder token, int type, int startId,
4045 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004046 Parcel data = Parcel.obtain();
4047 Parcel reply = Parcel.obtain();
4048 data.writeInterfaceToken(IActivityManager.descriptor);
4049 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004050 data.writeInt(type);
4051 data.writeInt(startId);
4052 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004053 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4054 reply.readException();
4055 data.recycle();
4056 reply.recycle();
4057 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004058
Svet Ganov99b60432015-06-27 13:15:22 -07004059 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4060 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004061 Parcel data = Parcel.obtain();
4062 Parcel reply = Parcel.obtain();
4063 data.writeInterfaceToken(IActivityManager.descriptor);
4064 service.writeToParcel(data, 0);
4065 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004066 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004067 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4068 reply.readException();
4069 IBinder binder = reply.readStrongBinder();
4070 reply.recycle();
4071 data.recycle();
4072 return binder;
4073 }
4074
Christopher Tate181fafa2009-05-14 11:12:14 -07004075 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4076 throws RemoteException {
4077 Parcel data = Parcel.obtain();
4078 Parcel reply = Parcel.obtain();
4079 data.writeInterfaceToken(IActivityManager.descriptor);
4080 app.writeToParcel(data, 0);
4081 data.writeInt(backupRestoreMode);
4082 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4083 reply.readException();
4084 boolean success = reply.readInt() != 0;
4085 reply.recycle();
4086 data.recycle();
4087 return success;
4088 }
4089
Christopher Tate346acb12012-10-15 19:20:25 -07004090 public void clearPendingBackup() throws RemoteException {
4091 Parcel data = Parcel.obtain();
4092 Parcel reply = Parcel.obtain();
4093 data.writeInterfaceToken(IActivityManager.descriptor);
4094 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4095 reply.recycle();
4096 data.recycle();
4097 }
4098
Christopher Tate181fafa2009-05-14 11:12:14 -07004099 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4100 Parcel data = Parcel.obtain();
4101 Parcel reply = Parcel.obtain();
4102 data.writeInterfaceToken(IActivityManager.descriptor);
4103 data.writeString(packageName);
4104 data.writeStrongBinder(agent);
4105 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4106 reply.recycle();
4107 data.recycle();
4108 }
4109
4110 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4111 Parcel data = Parcel.obtain();
4112 Parcel reply = Parcel.obtain();
4113 data.writeInterfaceToken(IActivityManager.descriptor);
4114 app.writeToParcel(data, 0);
4115 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4116 reply.readException();
4117 reply.recycle();
4118 data.recycle();
4119 }
4120
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004121 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004122 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004123 IUiAutomationConnection connection, int userId, String instructionSet)
4124 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004125 Parcel data = Parcel.obtain();
4126 Parcel reply = Parcel.obtain();
4127 data.writeInterfaceToken(IActivityManager.descriptor);
4128 ComponentName.writeToParcel(className, data);
4129 data.writeString(profileFile);
4130 data.writeInt(flags);
4131 data.writeBundle(arguments);
4132 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004133 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004134 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004135 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004136 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4137 reply.readException();
4138 boolean res = reply.readInt() != 0;
4139 reply.recycle();
4140 data.recycle();
4141 return res;
4142 }
4143
4144 public void finishInstrumentation(IApplicationThread target,
4145 int resultCode, Bundle results) throws RemoteException {
4146 Parcel data = Parcel.obtain();
4147 Parcel reply = Parcel.obtain();
4148 data.writeInterfaceToken(IActivityManager.descriptor);
4149 data.writeStrongBinder(target != null ? target.asBinder() : null);
4150 data.writeInt(resultCode);
4151 data.writeBundle(results);
4152 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4153 reply.readException();
4154 data.recycle();
4155 reply.recycle();
4156 }
4157 public Configuration getConfiguration() throws RemoteException
4158 {
4159 Parcel data = Parcel.obtain();
4160 Parcel reply = Parcel.obtain();
4161 data.writeInterfaceToken(IActivityManager.descriptor);
4162 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4163 reply.readException();
4164 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4165 reply.recycle();
4166 data.recycle();
4167 return res;
4168 }
4169 public void updateConfiguration(Configuration values) throws RemoteException
4170 {
4171 Parcel data = Parcel.obtain();
4172 Parcel reply = Parcel.obtain();
4173 data.writeInterfaceToken(IActivityManager.descriptor);
4174 values.writeToParcel(data, 0);
4175 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4176 reply.readException();
4177 data.recycle();
4178 reply.recycle();
4179 }
4180 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4181 throws RemoteException {
4182 Parcel data = Parcel.obtain();
4183 Parcel reply = Parcel.obtain();
4184 data.writeInterfaceToken(IActivityManager.descriptor);
4185 data.writeStrongBinder(token);
4186 data.writeInt(requestedOrientation);
4187 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4188 reply.readException();
4189 data.recycle();
4190 reply.recycle();
4191 }
4192 public int getRequestedOrientation(IBinder token) throws RemoteException {
4193 Parcel data = Parcel.obtain();
4194 Parcel reply = Parcel.obtain();
4195 data.writeInterfaceToken(IActivityManager.descriptor);
4196 data.writeStrongBinder(token);
4197 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4198 reply.readException();
4199 int res = reply.readInt();
4200 data.recycle();
4201 reply.recycle();
4202 return res;
4203 }
4204 public ComponentName getActivityClassForToken(IBinder token)
4205 throws RemoteException {
4206 Parcel data = Parcel.obtain();
4207 Parcel reply = Parcel.obtain();
4208 data.writeInterfaceToken(IActivityManager.descriptor);
4209 data.writeStrongBinder(token);
4210 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4211 reply.readException();
4212 ComponentName res = ComponentName.readFromParcel(reply);
4213 data.recycle();
4214 reply.recycle();
4215 return res;
4216 }
4217 public String getPackageForToken(IBinder token) throws RemoteException
4218 {
4219 Parcel data = Parcel.obtain();
4220 Parcel reply = Parcel.obtain();
4221 data.writeInterfaceToken(IActivityManager.descriptor);
4222 data.writeStrongBinder(token);
4223 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4224 reply.readException();
4225 String res = reply.readString();
4226 data.recycle();
4227 reply.recycle();
4228 return res;
4229 }
4230 public IIntentSender getIntentSender(int type,
4231 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004232 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004233 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004234 Parcel data = Parcel.obtain();
4235 Parcel reply = Parcel.obtain();
4236 data.writeInterfaceToken(IActivityManager.descriptor);
4237 data.writeInt(type);
4238 data.writeString(packageName);
4239 data.writeStrongBinder(token);
4240 data.writeString(resultWho);
4241 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004242 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004243 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004244 data.writeTypedArray(intents, 0);
4245 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004246 } else {
4247 data.writeInt(0);
4248 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004249 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004250 if (options != null) {
4251 data.writeInt(1);
4252 options.writeToParcel(data, 0);
4253 } else {
4254 data.writeInt(0);
4255 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004256 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004257 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4258 reply.readException();
4259 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004260 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004261 data.recycle();
4262 reply.recycle();
4263 return res;
4264 }
4265 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4266 Parcel data = Parcel.obtain();
4267 Parcel reply = Parcel.obtain();
4268 data.writeInterfaceToken(IActivityManager.descriptor);
4269 data.writeStrongBinder(sender.asBinder());
4270 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4271 reply.readException();
4272 data.recycle();
4273 reply.recycle();
4274 }
4275 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4276 Parcel data = Parcel.obtain();
4277 Parcel reply = Parcel.obtain();
4278 data.writeInterfaceToken(IActivityManager.descriptor);
4279 data.writeStrongBinder(sender.asBinder());
4280 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4281 reply.readException();
4282 String res = reply.readString();
4283 data.recycle();
4284 reply.recycle();
4285 return res;
4286 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004287 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4288 Parcel data = Parcel.obtain();
4289 Parcel reply = Parcel.obtain();
4290 data.writeInterfaceToken(IActivityManager.descriptor);
4291 data.writeStrongBinder(sender.asBinder());
4292 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4293 reply.readException();
4294 int res = reply.readInt();
4295 data.recycle();
4296 reply.recycle();
4297 return res;
4298 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004299 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4300 boolean requireFull, String name, String callerPackage) throws RemoteException {
4301 Parcel data = Parcel.obtain();
4302 Parcel reply = Parcel.obtain();
4303 data.writeInterfaceToken(IActivityManager.descriptor);
4304 data.writeInt(callingPid);
4305 data.writeInt(callingUid);
4306 data.writeInt(userId);
4307 data.writeInt(allowAll ? 1 : 0);
4308 data.writeInt(requireFull ? 1 : 0);
4309 data.writeString(name);
4310 data.writeString(callerPackage);
4311 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4312 reply.readException();
4313 int res = reply.readInt();
4314 data.recycle();
4315 reply.recycle();
4316 return res;
4317 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004318 public void setProcessLimit(int max) throws RemoteException
4319 {
4320 Parcel data = Parcel.obtain();
4321 Parcel reply = Parcel.obtain();
4322 data.writeInterfaceToken(IActivityManager.descriptor);
4323 data.writeInt(max);
4324 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4325 reply.readException();
4326 data.recycle();
4327 reply.recycle();
4328 }
4329 public int getProcessLimit() throws RemoteException
4330 {
4331 Parcel data = Parcel.obtain();
4332 Parcel reply = Parcel.obtain();
4333 data.writeInterfaceToken(IActivityManager.descriptor);
4334 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4335 reply.readException();
4336 int res = reply.readInt();
4337 data.recycle();
4338 reply.recycle();
4339 return res;
4340 }
4341 public void setProcessForeground(IBinder token, int pid,
4342 boolean isForeground) throws RemoteException {
4343 Parcel data = Parcel.obtain();
4344 Parcel reply = Parcel.obtain();
4345 data.writeInterfaceToken(IActivityManager.descriptor);
4346 data.writeStrongBinder(token);
4347 data.writeInt(pid);
4348 data.writeInt(isForeground ? 1 : 0);
4349 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4350 reply.readException();
4351 data.recycle();
4352 reply.recycle();
4353 }
4354 public int checkPermission(String permission, int pid, int uid)
4355 throws RemoteException {
4356 Parcel data = Parcel.obtain();
4357 Parcel reply = Parcel.obtain();
4358 data.writeInterfaceToken(IActivityManager.descriptor);
4359 data.writeString(permission);
4360 data.writeInt(pid);
4361 data.writeInt(uid);
4362 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4363 reply.readException();
4364 int res = reply.readInt();
4365 data.recycle();
4366 reply.recycle();
4367 return res;
4368 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004369 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4370 throws RemoteException {
4371 Parcel data = Parcel.obtain();
4372 Parcel reply = Parcel.obtain();
4373 data.writeInterfaceToken(IActivityManager.descriptor);
4374 data.writeString(permission);
4375 data.writeInt(pid);
4376 data.writeInt(uid);
4377 data.writeStrongBinder(callerToken);
4378 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4379 reply.readException();
4380 int res = reply.readInt();
4381 data.recycle();
4382 reply.recycle();
4383 return res;
4384 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004385 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004386 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004387 Parcel data = Parcel.obtain();
4388 Parcel reply = Parcel.obtain();
4389 data.writeInterfaceToken(IActivityManager.descriptor);
4390 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004391 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004392 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004393 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4394 reply.readException();
4395 boolean res = reply.readInt() != 0;
4396 data.recycle();
4397 reply.recycle();
4398 return res;
4399 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004400 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4401 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004402 Parcel data = Parcel.obtain();
4403 Parcel reply = Parcel.obtain();
4404 data.writeInterfaceToken(IActivityManager.descriptor);
4405 uri.writeToParcel(data, 0);
4406 data.writeInt(pid);
4407 data.writeInt(uid);
4408 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004409 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004410 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004411 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4412 reply.readException();
4413 int res = reply.readInt();
4414 data.recycle();
4415 reply.recycle();
4416 return res;
4417 }
4418 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004419 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004420 Parcel data = Parcel.obtain();
4421 Parcel reply = Parcel.obtain();
4422 data.writeInterfaceToken(IActivityManager.descriptor);
4423 data.writeStrongBinder(caller.asBinder());
4424 data.writeString(targetPkg);
4425 uri.writeToParcel(data, 0);
4426 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004427 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004428 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4429 reply.readException();
4430 data.recycle();
4431 reply.recycle();
4432 }
4433 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004434 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004435 Parcel data = Parcel.obtain();
4436 Parcel reply = Parcel.obtain();
4437 data.writeInterfaceToken(IActivityManager.descriptor);
4438 data.writeStrongBinder(caller.asBinder());
4439 uri.writeToParcel(data, 0);
4440 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004441 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004442 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4443 reply.readException();
4444 data.recycle();
4445 reply.recycle();
4446 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004447
4448 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004449 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4450 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004451 Parcel data = Parcel.obtain();
4452 Parcel reply = Parcel.obtain();
4453 data.writeInterfaceToken(IActivityManager.descriptor);
4454 uri.writeToParcel(data, 0);
4455 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004456 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004457 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4458 reply.readException();
4459 data.recycle();
4460 reply.recycle();
4461 }
4462
4463 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004464 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4465 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004466 Parcel data = Parcel.obtain();
4467 Parcel reply = Parcel.obtain();
4468 data.writeInterfaceToken(IActivityManager.descriptor);
4469 uri.writeToParcel(data, 0);
4470 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004471 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004472 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4473 reply.readException();
4474 data.recycle();
4475 reply.recycle();
4476 }
4477
4478 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004479 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4480 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004481 Parcel data = Parcel.obtain();
4482 Parcel reply = Parcel.obtain();
4483 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004484 data.writeString(packageName);
4485 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004486 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4487 reply.readException();
4488 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4489 reply);
4490 data.recycle();
4491 reply.recycle();
4492 return perms;
4493 }
4494
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004495 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4496 throws RemoteException {
4497 Parcel data = Parcel.obtain();
4498 Parcel reply = Parcel.obtain();
4499 data.writeInterfaceToken(IActivityManager.descriptor);
4500 data.writeStrongBinder(who.asBinder());
4501 data.writeInt(waiting ? 1 : 0);
4502 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4503 reply.readException();
4504 data.recycle();
4505 reply.recycle();
4506 }
4507 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4508 Parcel data = Parcel.obtain();
4509 Parcel reply = Parcel.obtain();
4510 data.writeInterfaceToken(IActivityManager.descriptor);
4511 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4512 reply.readException();
4513 outInfo.readFromParcel(reply);
4514 data.recycle();
4515 reply.recycle();
4516 }
4517 public void unhandledBack() throws RemoteException
4518 {
4519 Parcel data = Parcel.obtain();
4520 Parcel reply = Parcel.obtain();
4521 data.writeInterfaceToken(IActivityManager.descriptor);
4522 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4523 reply.readException();
4524 data.recycle();
4525 reply.recycle();
4526 }
4527 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4528 {
4529 Parcel data = Parcel.obtain();
4530 Parcel reply = Parcel.obtain();
4531 data.writeInterfaceToken(IActivityManager.descriptor);
4532 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4533 reply.readException();
4534 ParcelFileDescriptor pfd = null;
4535 if (reply.readInt() != 0) {
4536 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4537 }
4538 data.recycle();
4539 reply.recycle();
4540 return pfd;
4541 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004542 public void setLockScreenShown(boolean shown) throws RemoteException
4543 {
4544 Parcel data = Parcel.obtain();
4545 Parcel reply = Parcel.obtain();
4546 data.writeInterfaceToken(IActivityManager.descriptor);
4547 data.writeInt(shown ? 1 : 0);
4548 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4549 reply.readException();
4550 data.recycle();
4551 reply.recycle();
4552 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004553 public void setDebugApp(
4554 String packageName, boolean waitForDebugger, boolean persistent)
4555 throws RemoteException
4556 {
4557 Parcel data = Parcel.obtain();
4558 Parcel reply = Parcel.obtain();
4559 data.writeInterfaceToken(IActivityManager.descriptor);
4560 data.writeString(packageName);
4561 data.writeInt(waitForDebugger ? 1 : 0);
4562 data.writeInt(persistent ? 1 : 0);
4563 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4564 reply.readException();
4565 data.recycle();
4566 reply.recycle();
4567 }
4568 public void setAlwaysFinish(boolean enabled) throws RemoteException
4569 {
4570 Parcel data = Parcel.obtain();
4571 Parcel reply = Parcel.obtain();
4572 data.writeInterfaceToken(IActivityManager.descriptor);
4573 data.writeInt(enabled ? 1 : 0);
4574 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4575 reply.readException();
4576 data.recycle();
4577 reply.recycle();
4578 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004579 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004580 {
4581 Parcel data = Parcel.obtain();
4582 Parcel reply = Parcel.obtain();
4583 data.writeInterfaceToken(IActivityManager.descriptor);
4584 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004585 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004586 reply.readException();
4587 data.recycle();
4588 reply.recycle();
4589 }
4590 public void enterSafeMode() throws RemoteException {
4591 Parcel data = Parcel.obtain();
4592 data.writeInterfaceToken(IActivityManager.descriptor);
4593 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4594 data.recycle();
4595 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004596 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004597 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004598 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004599 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004600 data.writeStrongBinder(sender.asBinder());
4601 data.writeInt(sourceUid);
4602 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004603 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004604 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4605 data.recycle();
4606 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004607 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4608 throws RemoteException {
4609 Parcel data = Parcel.obtain();
4610 data.writeInterfaceToken(IActivityManager.descriptor);
4611 data.writeStrongBinder(sender.asBinder());
4612 data.writeInt(sourceUid);
4613 data.writeString(tag);
4614 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4615 data.recycle();
4616 }
4617 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4618 throws RemoteException {
4619 Parcel data = Parcel.obtain();
4620 data.writeInterfaceToken(IActivityManager.descriptor);
4621 data.writeStrongBinder(sender.asBinder());
4622 data.writeInt(sourceUid);
4623 data.writeString(tag);
4624 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4625 data.recycle();
4626 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004627 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004628 Parcel data = Parcel.obtain();
4629 Parcel reply = Parcel.obtain();
4630 data.writeInterfaceToken(IActivityManager.descriptor);
4631 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004632 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004633 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004634 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004635 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004636 boolean res = reply.readInt() != 0;
4637 data.recycle();
4638 reply.recycle();
4639 return res;
4640 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004641 @Override
4642 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4643 Parcel data = Parcel.obtain();
4644 Parcel reply = Parcel.obtain();
4645 data.writeInterfaceToken(IActivityManager.descriptor);
4646 data.writeString(reason);
4647 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4648 boolean res = reply.readInt() != 0;
4649 data.recycle();
4650 reply.recycle();
4651 return res;
4652 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004653 public boolean testIsSystemReady()
4654 {
4655 /* this base class version is never called */
4656 return true;
4657 }
Dan Egnor60d87622009-12-16 16:32:58 -08004658 public void handleApplicationCrash(IBinder app,
4659 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4660 {
4661 Parcel data = Parcel.obtain();
4662 Parcel reply = Parcel.obtain();
4663 data.writeInterfaceToken(IActivityManager.descriptor);
4664 data.writeStrongBinder(app);
4665 crashInfo.writeToParcel(data, 0);
4666 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4667 reply.readException();
4668 reply.recycle();
4669 data.recycle();
4670 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004671
Dianne Hackborn52322712014-08-26 22:47:26 -07004672 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004673 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004674 {
4675 Parcel data = Parcel.obtain();
4676 Parcel reply = Parcel.obtain();
4677 data.writeInterfaceToken(IActivityManager.descriptor);
4678 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004679 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004680 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004681 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004682 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004683 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004684 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004685 reply.recycle();
4686 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004687 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004688 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004689
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004690 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004691 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004692 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004693 {
4694 Parcel data = Parcel.obtain();
4695 Parcel reply = Parcel.obtain();
4696 data.writeInterfaceToken(IActivityManager.descriptor);
4697 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004698 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004699 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004700 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4701 reply.readException();
4702 reply.recycle();
4703 data.recycle();
4704 }
4705
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004706 public void signalPersistentProcesses(int sig) throws RemoteException {
4707 Parcel data = Parcel.obtain();
4708 Parcel reply = Parcel.obtain();
4709 data.writeInterfaceToken(IActivityManager.descriptor);
4710 data.writeInt(sig);
4711 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4712 reply.readException();
4713 data.recycle();
4714 reply.recycle();
4715 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004716
Dianne Hackborn1676c852012-09-10 14:52:30 -07004717 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004718 Parcel data = Parcel.obtain();
4719 Parcel reply = Parcel.obtain();
4720 data.writeInterfaceToken(IActivityManager.descriptor);
4721 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004722 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004723 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4724 reply.readException();
4725 data.recycle();
4726 reply.recycle();
4727 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004728
4729 public void killAllBackgroundProcesses() throws RemoteException {
4730 Parcel data = Parcel.obtain();
4731 Parcel reply = Parcel.obtain();
4732 data.writeInterfaceToken(IActivityManager.descriptor);
4733 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4734 reply.readException();
4735 data.recycle();
4736 reply.recycle();
4737 }
4738
Dianne Hackborn1676c852012-09-10 14:52:30 -07004739 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004740 Parcel data = Parcel.obtain();
4741 Parcel reply = Parcel.obtain();
4742 data.writeInterfaceToken(IActivityManager.descriptor);
4743 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004744 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004745 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004746 reply.readException();
4747 data.recycle();
4748 reply.recycle();
4749 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004750
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004751 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4752 throws RemoteException
4753 {
4754 Parcel data = Parcel.obtain();
4755 Parcel reply = Parcel.obtain();
4756 data.writeInterfaceToken(IActivityManager.descriptor);
4757 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4758 reply.readException();
4759 outInfo.readFromParcel(reply);
4760 reply.recycle();
4761 data.recycle();
4762 }
4763
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004764 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4765 {
4766 Parcel data = Parcel.obtain();
4767 Parcel reply = Parcel.obtain();
4768 data.writeInterfaceToken(IActivityManager.descriptor);
4769 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4770 reply.readException();
4771 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4772 reply.recycle();
4773 data.recycle();
4774 return res;
4775 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004776
Dianne Hackborn1676c852012-09-10 14:52:30 -07004777 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004778 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004779 {
4780 Parcel data = Parcel.obtain();
4781 Parcel reply = Parcel.obtain();
4782 data.writeInterfaceToken(IActivityManager.descriptor);
4783 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004784 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004785 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004786 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004787 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004788 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004789 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004790 } else {
4791 data.writeInt(0);
4792 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004793 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4794 reply.readException();
4795 boolean res = reply.readInt() != 0;
4796 reply.recycle();
4797 data.recycle();
4798 return res;
4799 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004800
Dianne Hackborn55280a92009-05-07 15:53:46 -07004801 public boolean shutdown(int timeout) throws RemoteException
4802 {
4803 Parcel data = Parcel.obtain();
4804 Parcel reply = Parcel.obtain();
4805 data.writeInterfaceToken(IActivityManager.descriptor);
4806 data.writeInt(timeout);
4807 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4808 reply.readException();
4809 boolean res = reply.readInt() != 0;
4810 reply.recycle();
4811 data.recycle();
4812 return res;
4813 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004814
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004815 public void stopAppSwitches() throws RemoteException {
4816 Parcel data = Parcel.obtain();
4817 Parcel reply = Parcel.obtain();
4818 data.writeInterfaceToken(IActivityManager.descriptor);
4819 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4820 reply.readException();
4821 reply.recycle();
4822 data.recycle();
4823 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004824
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004825 public void resumeAppSwitches() throws RemoteException {
4826 Parcel data = Parcel.obtain();
4827 Parcel reply = Parcel.obtain();
4828 data.writeInterfaceToken(IActivityManager.descriptor);
4829 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4830 reply.readException();
4831 reply.recycle();
4832 data.recycle();
4833 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004834
4835 public void addPackageDependency(String packageName) throws RemoteException {
4836 Parcel data = Parcel.obtain();
4837 Parcel reply = Parcel.obtain();
4838 data.writeInterfaceToken(IActivityManager.descriptor);
4839 data.writeString(packageName);
4840 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4841 reply.readException();
4842 data.recycle();
4843 reply.recycle();
4844 }
4845
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004846 public void killApplicationWithAppId(String pkg, int appid, String reason)
4847 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004848 Parcel data = Parcel.obtain();
4849 Parcel reply = Parcel.obtain();
4850 data.writeInterfaceToken(IActivityManager.descriptor);
4851 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004852 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004853 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004854 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004855 reply.readException();
4856 data.recycle();
4857 reply.recycle();
4858 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004859
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004860 public void closeSystemDialogs(String reason) throws RemoteException {
4861 Parcel data = Parcel.obtain();
4862 Parcel reply = Parcel.obtain();
4863 data.writeInterfaceToken(IActivityManager.descriptor);
4864 data.writeString(reason);
4865 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4866 reply.readException();
4867 data.recycle();
4868 reply.recycle();
4869 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004870
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004871 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004872 throws RemoteException {
4873 Parcel data = Parcel.obtain();
4874 Parcel reply = Parcel.obtain();
4875 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004876 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004877 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4878 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004879 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004880 data.recycle();
4881 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004882 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004883 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004884
4885 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4886 Parcel data = Parcel.obtain();
4887 Parcel reply = Parcel.obtain();
4888 data.writeInterfaceToken(IActivityManager.descriptor);
4889 data.writeString(processName);
4890 data.writeInt(uid);
4891 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4892 reply.readException();
4893 data.recycle();
4894 reply.recycle();
4895 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004896
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004897 public void overridePendingTransition(IBinder token, String packageName,
4898 int enterAnim, int exitAnim) throws RemoteException {
4899 Parcel data = Parcel.obtain();
4900 Parcel reply = Parcel.obtain();
4901 data.writeInterfaceToken(IActivityManager.descriptor);
4902 data.writeStrongBinder(token);
4903 data.writeString(packageName);
4904 data.writeInt(enterAnim);
4905 data.writeInt(exitAnim);
4906 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4907 reply.readException();
4908 data.recycle();
4909 reply.recycle();
4910 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004911
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004912 public boolean isUserAMonkey() throws RemoteException {
4913 Parcel data = Parcel.obtain();
4914 Parcel reply = Parcel.obtain();
4915 data.writeInterfaceToken(IActivityManager.descriptor);
4916 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4917 reply.readException();
4918 boolean res = reply.readInt() != 0;
4919 data.recycle();
4920 reply.recycle();
4921 return res;
4922 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004923
4924 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4925 Parcel data = Parcel.obtain();
4926 Parcel reply = Parcel.obtain();
4927 data.writeInterfaceToken(IActivityManager.descriptor);
4928 data.writeInt(monkey ? 1 : 0);
4929 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4930 reply.readException();
4931 data.recycle();
4932 reply.recycle();
4933 }
4934
Dianne Hackborn860755f2010-06-03 18:47:52 -07004935 public void finishHeavyWeightApp() throws RemoteException {
4936 Parcel data = Parcel.obtain();
4937 Parcel reply = Parcel.obtain();
4938 data.writeInterfaceToken(IActivityManager.descriptor);
4939 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4940 reply.readException();
4941 data.recycle();
4942 reply.recycle();
4943 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004944
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004945 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004946 throws RemoteException {
4947 Parcel data = Parcel.obtain();
4948 Parcel reply = Parcel.obtain();
4949 data.writeInterfaceToken(IActivityManager.descriptor);
4950 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004951 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4952 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004953 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004954 data.recycle();
4955 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004956 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004957 }
4958
Craig Mautner233ceee2014-05-09 17:05:11 -07004959 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004960 throws RemoteException {
4961 Parcel data = Parcel.obtain();
4962 Parcel reply = Parcel.obtain();
4963 data.writeInterfaceToken(IActivityManager.descriptor);
4964 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004965 if (options == null) {
4966 data.writeInt(0);
4967 } else {
4968 data.writeInt(1);
4969 data.writeBundle(options.toBundle());
4970 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004971 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004972 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004973 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004974 data.recycle();
4975 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004976 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004977 }
4978
Craig Mautner233ceee2014-05-09 17:05:11 -07004979 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4980 Parcel data = Parcel.obtain();
4981 Parcel reply = Parcel.obtain();
4982 data.writeInterfaceToken(IActivityManager.descriptor);
4983 data.writeStrongBinder(token);
4984 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4985 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08004986 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07004987 data.recycle();
4988 reply.recycle();
4989 return options;
4990 }
4991
Daniel Sandler69a48172010-06-23 16:29:36 -04004992 public void setImmersive(IBinder token, boolean immersive)
4993 throws RemoteException {
4994 Parcel data = Parcel.obtain();
4995 Parcel reply = Parcel.obtain();
4996 data.writeInterfaceToken(IActivityManager.descriptor);
4997 data.writeStrongBinder(token);
4998 data.writeInt(immersive ? 1 : 0);
4999 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
5000 reply.readException();
5001 data.recycle();
5002 reply.recycle();
5003 }
5004
5005 public boolean isImmersive(IBinder token)
5006 throws RemoteException {
5007 Parcel data = Parcel.obtain();
5008 Parcel reply = Parcel.obtain();
5009 data.writeInterfaceToken(IActivityManager.descriptor);
5010 data.writeStrongBinder(token);
5011 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005012 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005013 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005014 data.recycle();
5015 reply.recycle();
5016 return res;
5017 }
5018
Craig Mautnerd61dc202014-07-07 11:09:11 -07005019 public boolean isTopOfTask(IBinder token) throws RemoteException {
5020 Parcel data = Parcel.obtain();
5021 Parcel reply = Parcel.obtain();
5022 data.writeInterfaceToken(IActivityManager.descriptor);
5023 data.writeStrongBinder(token);
5024 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
5025 reply.readException();
5026 boolean res = reply.readInt() == 1;
5027 data.recycle();
5028 reply.recycle();
5029 return res;
5030 }
5031
Daniel Sandler69a48172010-06-23 16:29:36 -04005032 public boolean isTopActivityImmersive()
5033 throws RemoteException {
5034 Parcel data = Parcel.obtain();
5035 Parcel reply = Parcel.obtain();
5036 data.writeInterfaceToken(IActivityManager.descriptor);
5037 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005038 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005039 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005040 data.recycle();
5041 reply.recycle();
5042 return res;
5043 }
5044
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005045 public void crashApplication(int uid, int initialPid, String packageName,
5046 String message) throws RemoteException {
5047 Parcel data = Parcel.obtain();
5048 Parcel reply = Parcel.obtain();
5049 data.writeInterfaceToken(IActivityManager.descriptor);
5050 data.writeInt(uid);
5051 data.writeInt(initialPid);
5052 data.writeString(packageName);
5053 data.writeString(message);
5054 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5055 reply.readException();
5056 data.recycle();
5057 reply.recycle();
5058 }
Andy McFadden824c5102010-07-09 16:26:57 -07005059
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005060 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005061 Parcel data = Parcel.obtain();
5062 Parcel reply = Parcel.obtain();
5063 data.writeInterfaceToken(IActivityManager.descriptor);
5064 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005065 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005066 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5067 reply.readException();
5068 String res = reply.readString();
5069 data.recycle();
5070 reply.recycle();
5071 return res;
5072 }
5073
Dianne Hackborn7e269642010-08-25 19:50:20 -07005074 public IBinder newUriPermissionOwner(String name)
5075 throws RemoteException {
5076 Parcel data = Parcel.obtain();
5077 Parcel reply = Parcel.obtain();
5078 data.writeInterfaceToken(IActivityManager.descriptor);
5079 data.writeString(name);
5080 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5081 reply.readException();
5082 IBinder res = reply.readStrongBinder();
5083 data.recycle();
5084 reply.recycle();
5085 return res;
5086 }
5087
5088 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005089 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005090 Parcel data = Parcel.obtain();
5091 Parcel reply = Parcel.obtain();
5092 data.writeInterfaceToken(IActivityManager.descriptor);
5093 data.writeStrongBinder(owner);
5094 data.writeInt(fromUid);
5095 data.writeString(targetPkg);
5096 uri.writeToParcel(data, 0);
5097 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005098 data.writeInt(sourceUserId);
5099 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005100 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5101 reply.readException();
5102 data.recycle();
5103 reply.recycle();
5104 }
5105
5106 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005107 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005108 Parcel data = Parcel.obtain();
5109 Parcel reply = Parcel.obtain();
5110 data.writeInterfaceToken(IActivityManager.descriptor);
5111 data.writeStrongBinder(owner);
5112 if (uri != null) {
5113 data.writeInt(1);
5114 uri.writeToParcel(data, 0);
5115 } else {
5116 data.writeInt(0);
5117 }
5118 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005119 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005120 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5121 reply.readException();
5122 data.recycle();
5123 reply.recycle();
5124 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005125
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005126 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005127 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005128 Parcel data = Parcel.obtain();
5129 Parcel reply = Parcel.obtain();
5130 data.writeInterfaceToken(IActivityManager.descriptor);
5131 data.writeInt(callingUid);
5132 data.writeString(targetPkg);
5133 uri.writeToParcel(data, 0);
5134 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005135 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005136 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5137 reply.readException();
5138 int res = reply.readInt();
5139 data.recycle();
5140 reply.recycle();
5141 return res;
5142 }
5143
Dianne Hackborn1676c852012-09-10 14:52:30 -07005144 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005145 String path, ParcelFileDescriptor fd) throws RemoteException {
5146 Parcel data = Parcel.obtain();
5147 Parcel reply = Parcel.obtain();
5148 data.writeInterfaceToken(IActivityManager.descriptor);
5149 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005150 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005151 data.writeInt(managed ? 1 : 0);
5152 data.writeString(path);
5153 if (fd != null) {
5154 data.writeInt(1);
5155 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5156 } else {
5157 data.writeInt(0);
5158 }
5159 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5160 reply.readException();
5161 boolean res = reply.readInt() != 0;
5162 reply.recycle();
5163 data.recycle();
5164 return res;
5165 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005166
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005167 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005168 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005169 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005170 Parcel data = Parcel.obtain();
5171 Parcel reply = Parcel.obtain();
5172 data.writeInterfaceToken(IActivityManager.descriptor);
5173 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005174 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005175 data.writeTypedArray(intents, 0);
5176 data.writeStringArray(resolvedTypes);
5177 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005178 if (options != null) {
5179 data.writeInt(1);
5180 options.writeToParcel(data, 0);
5181 } else {
5182 data.writeInt(0);
5183 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005184 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005185 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5186 reply.readException();
5187 int result = reply.readInt();
5188 reply.recycle();
5189 data.recycle();
5190 return result;
5191 }
5192
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005193 public int getFrontActivityScreenCompatMode() throws RemoteException {
5194 Parcel data = Parcel.obtain();
5195 Parcel reply = Parcel.obtain();
5196 data.writeInterfaceToken(IActivityManager.descriptor);
5197 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5198 reply.readException();
5199 int mode = reply.readInt();
5200 reply.recycle();
5201 data.recycle();
5202 return mode;
5203 }
5204
5205 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5206 Parcel data = Parcel.obtain();
5207 Parcel reply = Parcel.obtain();
5208 data.writeInterfaceToken(IActivityManager.descriptor);
5209 data.writeInt(mode);
5210 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5211 reply.readException();
5212 reply.recycle();
5213 data.recycle();
5214 }
5215
5216 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5217 Parcel data = Parcel.obtain();
5218 Parcel reply = Parcel.obtain();
5219 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005220 data.writeString(packageName);
5221 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005222 reply.readException();
5223 int mode = reply.readInt();
5224 reply.recycle();
5225 data.recycle();
5226 return mode;
5227 }
5228
5229 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005230 throws RemoteException {
5231 Parcel data = Parcel.obtain();
5232 Parcel reply = Parcel.obtain();
5233 data.writeInterfaceToken(IActivityManager.descriptor);
5234 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005235 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005236 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5237 reply.readException();
5238 reply.recycle();
5239 data.recycle();
5240 }
5241
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005242 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5243 Parcel data = Parcel.obtain();
5244 Parcel reply = Parcel.obtain();
5245 data.writeInterfaceToken(IActivityManager.descriptor);
5246 data.writeString(packageName);
5247 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5248 reply.readException();
5249 boolean ask = reply.readInt() != 0;
5250 reply.recycle();
5251 data.recycle();
5252 return ask;
5253 }
5254
5255 public void setPackageAskScreenCompat(String packageName, boolean ask)
5256 throws RemoteException {
5257 Parcel data = Parcel.obtain();
5258 Parcel reply = Parcel.obtain();
5259 data.writeInterfaceToken(IActivityManager.descriptor);
5260 data.writeString(packageName);
5261 data.writeInt(ask ? 1 : 0);
5262 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5263 reply.readException();
5264 reply.recycle();
5265 data.recycle();
5266 }
5267
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005268 public boolean switchUser(int userid) throws RemoteException {
5269 Parcel data = Parcel.obtain();
5270 Parcel reply = Parcel.obtain();
5271 data.writeInterfaceToken(IActivityManager.descriptor);
5272 data.writeInt(userid);
5273 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5274 reply.readException();
5275 boolean result = reply.readInt() != 0;
5276 reply.recycle();
5277 data.recycle();
5278 return result;
5279 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005280
Kenny Guy08488bf2014-02-21 17:40:37 +00005281 public boolean startUserInBackground(int userid) throws RemoteException {
5282 Parcel data = Parcel.obtain();
5283 Parcel reply = Parcel.obtain();
5284 data.writeInterfaceToken(IActivityManager.descriptor);
5285 data.writeInt(userid);
5286 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5287 reply.readException();
5288 boolean result = reply.readInt() != 0;
5289 reply.recycle();
5290 data.recycle();
5291 return result;
5292 }
5293
Jeff Sharkeyba512352015-11-12 20:17:45 -08005294 public boolean unlockUser(int userId, byte[] token) throws RemoteException {
5295 Parcel data = Parcel.obtain();
5296 Parcel reply = Parcel.obtain();
5297 data.writeInterfaceToken(IActivityManager.descriptor);
5298 data.writeInt(userId);
5299 data.writeByteArray(token);
5300 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5301 reply.readException();
5302 boolean result = reply.readInt() != 0;
5303 reply.recycle();
5304 data.recycle();
5305 return result;
5306 }
5307
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005308 public int stopUser(int userid, boolean force, IStopUserCallback callback)
5309 throws RemoteException {
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005310 Parcel data = Parcel.obtain();
5311 Parcel reply = Parcel.obtain();
5312 data.writeInterfaceToken(IActivityManager.descriptor);
5313 data.writeInt(userid);
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005314 data.writeInt(force ? 1 : 0);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005315 data.writeStrongInterface(callback);
5316 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5317 reply.readException();
5318 int result = reply.readInt();
5319 reply.recycle();
5320 data.recycle();
5321 return result;
5322 }
5323
Amith Yamasani52f1d752012-03-28 18:19:29 -07005324 public UserInfo getCurrentUser() throws RemoteException {
5325 Parcel data = Parcel.obtain();
5326 Parcel reply = Parcel.obtain();
5327 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005328 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005329 reply.readException();
5330 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5331 reply.recycle();
5332 data.recycle();
5333 return userInfo;
5334 }
5335
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005336 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005337 Parcel data = Parcel.obtain();
5338 Parcel reply = Parcel.obtain();
5339 data.writeInterfaceToken(IActivityManager.descriptor);
5340 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005341 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005342 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5343 reply.readException();
5344 boolean result = reply.readInt() != 0;
5345 reply.recycle();
5346 data.recycle();
5347 return result;
5348 }
5349
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005350 public int[] getRunningUserIds() throws RemoteException {
5351 Parcel data = Parcel.obtain();
5352 Parcel reply = Parcel.obtain();
5353 data.writeInterfaceToken(IActivityManager.descriptor);
5354 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5355 reply.readException();
5356 int[] result = reply.createIntArray();
5357 reply.recycle();
5358 data.recycle();
5359 return result;
5360 }
5361
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005362 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005363 Parcel data = Parcel.obtain();
5364 Parcel reply = Parcel.obtain();
5365 data.writeInterfaceToken(IActivityManager.descriptor);
5366 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005367 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5368 reply.readException();
5369 boolean result = reply.readInt() != 0;
5370 reply.recycle();
5371 data.recycle();
5372 return result;
5373 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005374
Jeff Sharkeya4620792011-05-20 15:29:23 -07005375 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5376 Parcel data = Parcel.obtain();
5377 Parcel reply = Parcel.obtain();
5378 data.writeInterfaceToken(IActivityManager.descriptor);
5379 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5380 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5381 reply.readException();
5382 data.recycle();
5383 reply.recycle();
5384 }
5385
5386 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5387 Parcel data = Parcel.obtain();
5388 Parcel reply = Parcel.obtain();
5389 data.writeInterfaceToken(IActivityManager.descriptor);
5390 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5391 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5392 reply.readException();
5393 data.recycle();
5394 reply.recycle();
5395 }
5396
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005397 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005398 Parcel data = Parcel.obtain();
5399 Parcel reply = Parcel.obtain();
5400 data.writeInterfaceToken(IActivityManager.descriptor);
5401 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005402 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005403 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5404 reply.readException();
5405 data.recycle();
5406 reply.recycle();
5407 }
5408
5409 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5410 Parcel data = Parcel.obtain();
5411 Parcel reply = Parcel.obtain();
5412 data.writeInterfaceToken(IActivityManager.descriptor);
5413 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5414 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5415 reply.readException();
5416 data.recycle();
5417 reply.recycle();
5418 }
5419
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005420 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5421 Parcel data = Parcel.obtain();
5422 Parcel reply = Parcel.obtain();
5423 data.writeInterfaceToken(IActivityManager.descriptor);
5424 data.writeStrongBinder(sender.asBinder());
5425 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5426 reply.readException();
5427 boolean res = reply.readInt() != 0;
5428 data.recycle();
5429 reply.recycle();
5430 return res;
5431 }
5432
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005433 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5434 Parcel data = Parcel.obtain();
5435 Parcel reply = Parcel.obtain();
5436 data.writeInterfaceToken(IActivityManager.descriptor);
5437 data.writeStrongBinder(sender.asBinder());
5438 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5439 reply.readException();
5440 boolean res = reply.readInt() != 0;
5441 data.recycle();
5442 reply.recycle();
5443 return res;
5444 }
5445
Dianne Hackborn81038902012-11-26 17:04:09 -08005446 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5447 Parcel data = Parcel.obtain();
5448 Parcel reply = Parcel.obtain();
5449 data.writeInterfaceToken(IActivityManager.descriptor);
5450 data.writeStrongBinder(sender.asBinder());
5451 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5452 reply.readException();
5453 Intent res = reply.readInt() != 0
5454 ? Intent.CREATOR.createFromParcel(reply) : null;
5455 data.recycle();
5456 reply.recycle();
5457 return res;
5458 }
5459
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005460 public String getTagForIntentSender(IIntentSender sender, String prefix)
5461 throws RemoteException {
5462 Parcel data = Parcel.obtain();
5463 Parcel reply = Parcel.obtain();
5464 data.writeInterfaceToken(IActivityManager.descriptor);
5465 data.writeStrongBinder(sender.asBinder());
5466 data.writeString(prefix);
5467 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5468 reply.readException();
5469 String res = reply.readString();
5470 data.recycle();
5471 reply.recycle();
5472 return res;
5473 }
5474
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005475 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5476 {
5477 Parcel data = Parcel.obtain();
5478 Parcel reply = Parcel.obtain();
5479 data.writeInterfaceToken(IActivityManager.descriptor);
5480 values.writeToParcel(data, 0);
5481 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5482 reply.readException();
5483 data.recycle();
5484 reply.recycle();
5485 }
5486
Dianne Hackbornb437e092011-08-05 17:50:29 -07005487 public long[] getProcessPss(int[] pids) throws RemoteException {
5488 Parcel data = Parcel.obtain();
5489 Parcel reply = Parcel.obtain();
5490 data.writeInterfaceToken(IActivityManager.descriptor);
5491 data.writeIntArray(pids);
5492 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5493 reply.readException();
5494 long[] res = reply.createLongArray();
5495 data.recycle();
5496 reply.recycle();
5497 return res;
5498 }
5499
Dianne Hackborn661cd522011-08-22 00:26:20 -07005500 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5501 Parcel data = Parcel.obtain();
5502 Parcel reply = Parcel.obtain();
5503 data.writeInterfaceToken(IActivityManager.descriptor);
5504 TextUtils.writeToParcel(msg, data, 0);
5505 data.writeInt(always ? 1 : 0);
5506 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5507 reply.readException();
5508 data.recycle();
5509 reply.recycle();
5510 }
5511
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005512 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005513 Parcel data = Parcel.obtain();
5514 Parcel reply = Parcel.obtain();
5515 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005516 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005517 reply.readException();
5518 data.recycle();
5519 reply.recycle();
5520 }
5521
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005522 public void keyguardGoingAway(boolean disableWindowAnimations,
5523 boolean keyguardGoingToNotificationShade) throws RemoteException {
5524 Parcel data = Parcel.obtain();
5525 Parcel reply = Parcel.obtain();
5526 data.writeInterfaceToken(IActivityManager.descriptor);
5527 data.writeInt(disableWindowAnimations ? 1 : 0);
5528 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5529 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5530 reply.readException();
5531 data.recycle();
5532 reply.recycle();
5533 }
5534
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005535 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005536 throws RemoteException {
5537 Parcel data = Parcel.obtain();
5538 Parcel reply = Parcel.obtain();
5539 data.writeInterfaceToken(IActivityManager.descriptor);
5540 data.writeStrongBinder(token);
5541 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005542 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005543 reply.readException();
5544 boolean result = reply.readInt() != 0;
5545 data.recycle();
5546 reply.recycle();
5547 return result;
5548 }
5549
5550 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5551 throws RemoteException {
5552 Parcel data = Parcel.obtain();
5553 Parcel reply = Parcel.obtain();
5554 data.writeInterfaceToken(IActivityManager.descriptor);
5555 data.writeStrongBinder(token);
5556 target.writeToParcel(data, 0);
5557 data.writeInt(resultCode);
5558 if (resultData != null) {
5559 data.writeInt(1);
5560 resultData.writeToParcel(data, 0);
5561 } else {
5562 data.writeInt(0);
5563 }
5564 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5565 reply.readException();
5566 boolean result = reply.readInt() != 0;
5567 data.recycle();
5568 reply.recycle();
5569 return result;
5570 }
5571
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005572 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5573 Parcel data = Parcel.obtain();
5574 Parcel reply = Parcel.obtain();
5575 data.writeInterfaceToken(IActivityManager.descriptor);
5576 data.writeStrongBinder(activityToken);
5577 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5578 reply.readException();
5579 int result = reply.readInt();
5580 data.recycle();
5581 reply.recycle();
5582 return result;
5583 }
5584
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005585 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5586 Parcel data = Parcel.obtain();
5587 Parcel reply = Parcel.obtain();
5588 data.writeInterfaceToken(IActivityManager.descriptor);
5589 data.writeStrongBinder(activityToken);
5590 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5591 reply.readException();
5592 String result = reply.readString();
5593 data.recycle();
5594 reply.recycle();
5595 return result;
5596 }
5597
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005598 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5599 Parcel data = Parcel.obtain();
5600 Parcel reply = Parcel.obtain();
5601 data.writeInterfaceToken(IActivityManager.descriptor);
5602 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5603 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5604 reply.readException();
5605 data.recycle();
5606 reply.recycle();
5607 }
5608
5609 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5610 Parcel data = Parcel.obtain();
5611 Parcel reply = Parcel.obtain();
5612 data.writeInterfaceToken(IActivityManager.descriptor);
5613 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5614 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5615 reply.readException();
5616 data.recycle();
5617 reply.recycle();
5618 }
5619
Felipe Leme4cc86332015-12-04 16:37:28 -08005620 public void requestBugReport(boolean progress) throws RemoteException {
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005621 Parcel data = Parcel.obtain();
5622 Parcel reply = Parcel.obtain();
5623 data.writeInterfaceToken(IActivityManager.descriptor);
Felipe Leme4cc86332015-12-04 16:37:28 -08005624 data.writeInt(progress ? 1 : 0);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005625 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5626 reply.readException();
5627 data.recycle();
5628 reply.recycle();
5629 }
5630
Jeff Brownbd181bb2013-09-10 16:44:24 -07005631 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5632 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005633 Parcel data = Parcel.obtain();
5634 Parcel reply = Parcel.obtain();
5635 data.writeInterfaceToken(IActivityManager.descriptor);
5636 data.writeInt(pid);
5637 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005638 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005639 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5640 reply.readException();
5641 long res = reply.readInt();
5642 data.recycle();
5643 reply.recycle();
5644 return res;
5645 }
5646
Adam Skorydfc7fd72013-08-05 19:23:41 -07005647 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005648 Parcel data = Parcel.obtain();
5649 Parcel reply = Parcel.obtain();
5650 data.writeInterfaceToken(IActivityManager.descriptor);
5651 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005652 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005653 reply.readException();
5654 Bundle res = reply.readBundle();
5655 data.recycle();
5656 reply.recycle();
5657 return res;
5658 }
5659
Dianne Hackborn17f69352015-07-17 18:04:14 -07005660 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5661 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005662 Parcel data = Parcel.obtain();
5663 Parcel reply = Parcel.obtain();
5664 data.writeInterfaceToken(IActivityManager.descriptor);
5665 data.writeInt(requestType);
5666 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005667 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005668 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5669 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005670 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005671 data.recycle();
5672 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005673 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005674 }
5675
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005676 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005677 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005678 Parcel data = Parcel.obtain();
5679 Parcel reply = Parcel.obtain();
5680 data.writeInterfaceToken(IActivityManager.descriptor);
5681 data.writeStrongBinder(token);
5682 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005683 structure.writeToParcel(data, 0);
5684 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005685 if (referrer != null) {
5686 data.writeInt(1);
5687 referrer.writeToParcel(data, 0);
5688 } else {
5689 data.writeInt(0);
5690 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005691 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005692 reply.readException();
5693 data.recycle();
5694 reply.recycle();
5695 }
5696
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005697 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5698 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005699 Parcel data = Parcel.obtain();
5700 Parcel reply = Parcel.obtain();
5701 data.writeInterfaceToken(IActivityManager.descriptor);
5702 intent.writeToParcel(data, 0);
5703 data.writeInt(requestType);
5704 data.writeString(hint);
5705 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005706 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005707 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5708 reply.readException();
5709 boolean res = reply.readInt() != 0;
5710 data.recycle();
5711 reply.recycle();
5712 return res;
5713 }
5714
Dianne Hackborn17f69352015-07-17 18:04:14 -07005715 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005716 Parcel data = Parcel.obtain();
5717 Parcel reply = Parcel.obtain();
5718 data.writeInterfaceToken(IActivityManager.descriptor);
5719 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5720 reply.readException();
5721 boolean res = reply.readInt() != 0;
5722 data.recycle();
5723 reply.recycle();
5724 return res;
5725 }
5726
Dianne Hackborn17f69352015-07-17 18:04:14 -07005727 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5728 Parcel data = Parcel.obtain();
5729 Parcel reply = Parcel.obtain();
5730 data.writeInterfaceToken(IActivityManager.descriptor);
5731 data.writeStrongBinder(token);
5732 data.writeBundle(args);
5733 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5734 reply.readException();
5735 boolean res = reply.readInt() != 0;
5736 data.recycle();
5737 reply.recycle();
5738 return res;
5739 }
5740
Svetoslavaa41add2015-08-06 15:03:55 -07005741 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005742 Parcel data = Parcel.obtain();
5743 Parcel reply = Parcel.obtain();
5744 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07005745 data.writeInt(appId);
5746 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005747 data.writeString(reason);
5748 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5749 reply.readException();
5750 data.recycle();
5751 reply.recycle();
5752 }
5753
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005754 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5755 Parcel data = Parcel.obtain();
5756 Parcel reply = Parcel.obtain();
5757 data.writeInterfaceToken(IActivityManager.descriptor);
5758 data.writeStrongBinder(who);
5759 data.writeInt(allowRestart ? 1 : 0);
5760 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5761 reply.readException();
5762 data.recycle();
5763 reply.recycle();
5764 }
5765
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005766 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5767 Parcel data = Parcel.obtain();
5768 Parcel reply = Parcel.obtain();
5769 data.writeInterfaceToken(IActivityManager.descriptor);
5770 data.writeStrongBinder(token);
5771 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5772 reply.readException();
5773 data.recycle();
5774 reply.recycle();
5775 }
5776
Craig Mautner5eda9b32013-07-02 11:58:16 -07005777 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5778 Parcel data = Parcel.obtain();
5779 Parcel reply = Parcel.obtain();
5780 data.writeInterfaceToken(IActivityManager.descriptor);
5781 data.writeStrongBinder(token);
5782 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5783 reply.readException();
5784 data.recycle();
5785 reply.recycle();
5786 }
5787
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005788 public void restart() throws RemoteException {
5789 Parcel data = Parcel.obtain();
5790 Parcel reply = Parcel.obtain();
5791 data.writeInterfaceToken(IActivityManager.descriptor);
5792 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5793 reply.readException();
5794 data.recycle();
5795 reply.recycle();
5796 }
5797
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005798 public void performIdleMaintenance() throws RemoteException {
5799 Parcel data = Parcel.obtain();
5800 Parcel reply = Parcel.obtain();
5801 data.writeInterfaceToken(IActivityManager.descriptor);
5802 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5803 reply.readException();
5804 data.recycle();
5805 reply.recycle();
5806 }
5807
Todd Kennedyca4d8422015-01-15 15:19:22 -08005808 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005809 IActivityContainerCallback callback) throws RemoteException {
5810 Parcel data = Parcel.obtain();
5811 Parcel reply = Parcel.obtain();
5812 data.writeInterfaceToken(IActivityManager.descriptor);
5813 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005814 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005815 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005816 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005817 final int result = reply.readInt();
5818 final IActivityContainer res;
5819 if (result == 1) {
5820 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5821 } else {
5822 res = null;
5823 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005824 data.recycle();
5825 reply.recycle();
5826 return res;
5827 }
5828
Craig Mautner95da1082014-02-24 17:54:35 -08005829 public void deleteActivityContainer(IActivityContainer activityContainer)
5830 throws RemoteException {
5831 Parcel data = Parcel.obtain();
5832 Parcel reply = Parcel.obtain();
5833 data.writeInterfaceToken(IActivityManager.descriptor);
5834 data.writeStrongBinder(activityContainer.asBinder());
5835 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5836 reply.readException();
5837 data.recycle();
5838 reply.recycle();
5839 }
5840
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04005841 public boolean startBinderTracking() throws RemoteException {
5842 Parcel data = Parcel.obtain();
5843 Parcel reply = Parcel.obtain();
5844 data.writeInterfaceToken(IActivityManager.descriptor);
5845 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
5846 reply.readException();
5847 boolean res = reply.readInt() != 0;
5848 reply.recycle();
5849 data.recycle();
5850 return res;
5851 }
5852
5853 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
5854 Parcel data = Parcel.obtain();
5855 Parcel reply = Parcel.obtain();
5856 data.writeInterfaceToken(IActivityManager.descriptor);
5857 if (fd != null) {
5858 data.writeInt(1);
5859 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5860 } else {
5861 data.writeInt(0);
5862 }
5863 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
5864 reply.readException();
5865 boolean res = reply.readInt() != 0;
5866 reply.recycle();
5867 data.recycle();
5868 return res;
5869 }
5870
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005871 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005872 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5873 Parcel data = Parcel.obtain();
5874 Parcel reply = Parcel.obtain();
5875 data.writeInterfaceToken(IActivityManager.descriptor);
5876 data.writeInt(displayId);
5877 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5878 reply.readException();
5879 final int result = reply.readInt();
5880 final IActivityContainer res;
5881 if (result == 1) {
5882 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5883 } else {
5884 res = null;
5885 }
5886 data.recycle();
5887 reply.recycle();
5888 return res;
5889 }
5890
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005891 @Override
5892 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005893 throws RemoteException {
5894 Parcel data = Parcel.obtain();
5895 Parcel reply = Parcel.obtain();
5896 data.writeInterfaceToken(IActivityManager.descriptor);
5897 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005898 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005899 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005900 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005901 data.recycle();
5902 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005903 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005904 }
5905
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005906 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005907 public void startLockTaskMode(int taskId) throws RemoteException {
5908 Parcel data = Parcel.obtain();
5909 Parcel reply = Parcel.obtain();
5910 data.writeInterfaceToken(IActivityManager.descriptor);
5911 data.writeInt(taskId);
5912 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5913 reply.readException();
5914 data.recycle();
5915 reply.recycle();
5916 }
5917
5918 @Override
5919 public void startLockTaskMode(IBinder token) throws RemoteException {
5920 Parcel data = Parcel.obtain();
5921 Parcel reply = Parcel.obtain();
5922 data.writeInterfaceToken(IActivityManager.descriptor);
5923 data.writeStrongBinder(token);
5924 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5925 reply.readException();
5926 data.recycle();
5927 reply.recycle();
5928 }
5929
5930 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005931 public void startLockTaskModeOnCurrent() throws RemoteException {
5932 Parcel data = Parcel.obtain();
5933 Parcel reply = Parcel.obtain();
5934 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005935 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005936 reply.readException();
5937 data.recycle();
5938 reply.recycle();
5939 }
5940
5941 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005942 public void stopLockTaskMode() throws RemoteException {
5943 Parcel data = Parcel.obtain();
5944 Parcel reply = Parcel.obtain();
5945 data.writeInterfaceToken(IActivityManager.descriptor);
5946 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5947 reply.readException();
5948 data.recycle();
5949 reply.recycle();
5950 }
5951
5952 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005953 public void stopLockTaskModeOnCurrent() throws RemoteException {
5954 Parcel data = Parcel.obtain();
5955 Parcel reply = Parcel.obtain();
5956 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005957 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005958 reply.readException();
5959 data.recycle();
5960 reply.recycle();
5961 }
5962
5963 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005964 public boolean isInLockTaskMode() throws RemoteException {
5965 Parcel data = Parcel.obtain();
5966 Parcel reply = Parcel.obtain();
5967 data.writeInterfaceToken(IActivityManager.descriptor);
5968 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5969 reply.readException();
5970 boolean isInLockTaskMode = reply.readInt() == 1;
5971 data.recycle();
5972 reply.recycle();
5973 return isInLockTaskMode;
5974 }
5975
Craig Mautner688b5102014-03-27 16:55:03 -07005976 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005977 public int getLockTaskModeState() throws RemoteException {
5978 Parcel data = Parcel.obtain();
5979 Parcel reply = Parcel.obtain();
5980 data.writeInterfaceToken(IActivityManager.descriptor);
5981 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5982 reply.readException();
5983 int lockTaskModeState = reply.readInt();
5984 data.recycle();
5985 reply.recycle();
5986 return lockTaskModeState;
5987 }
5988
5989 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005990 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5991 Parcel data = Parcel.obtain();
5992 Parcel reply = Parcel.obtain();
5993 data.writeInterfaceToken(IActivityManager.descriptor);
5994 data.writeStrongBinder(token);
5995 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5996 IBinder.FLAG_ONEWAY);
5997 reply.readException();
5998 data.recycle();
5999 reply.recycle();
6000 }
6001
6002 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07006003 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07006004 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07006005 Parcel data = Parcel.obtain();
6006 Parcel reply = Parcel.obtain();
6007 data.writeInterfaceToken(IActivityManager.descriptor);
6008 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07006009 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006010 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07006011 reply.readException();
6012 data.recycle();
6013 reply.recycle();
6014 }
6015
Craig Mautneree2e45a2014-06-27 12:10:03 -07006016 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006017 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
6018 Parcel data = Parcel.obtain();
6019 Parcel reply = Parcel.obtain();
6020 data.writeInterfaceToken(IActivityManager.descriptor);
6021 data.writeInt(taskId);
6022 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006023 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006024 reply.readException();
6025 data.recycle();
6026 reply.recycle();
6027 }
6028
6029 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07006030 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006031 {
6032 Parcel data = Parcel.obtain();
6033 Parcel reply = Parcel.obtain();
6034 data.writeInterfaceToken(IActivityManager.descriptor);
6035 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006036 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006037 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006038 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006039 reply.readException();
6040 data.recycle();
6041 reply.recycle();
6042 }
6043
6044 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006045 public Rect getTaskBounds(int taskId) throws RemoteException
6046 {
6047 Parcel data = Parcel.obtain();
6048 Parcel reply = Parcel.obtain();
6049 data.writeInterfaceToken(IActivityManager.descriptor);
6050 data.writeInt(taskId);
6051 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6052 reply.readException();
6053 Rect rect = Rect.CREATOR.createFromParcel(reply);
6054 data.recycle();
6055 reply.recycle();
6056 return rect;
6057 }
6058
6059 @Override
Suprabh Shukla23593142015-11-03 17:31:15 -08006060 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException {
Craig Mautner648f69b2014-09-18 14:16:26 -07006061 Parcel data = Parcel.obtain();
6062 Parcel reply = Parcel.obtain();
6063 data.writeInterfaceToken(IActivityManager.descriptor);
6064 data.writeString(filename);
Suprabh Shukla23593142015-11-03 17:31:15 -08006065 data.writeInt(userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07006066 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6067 reply.readException();
6068 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6069 data.recycle();
6070 reply.recycle();
6071 return icon;
6072 }
6073
6074 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006075 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6076 throws RemoteException {
6077 Parcel data = Parcel.obtain();
6078 Parcel reply = Parcel.obtain();
6079 data.writeInterfaceToken(IActivityManager.descriptor);
6080 if (options == null) {
6081 data.writeInt(0);
6082 } else {
6083 data.writeInt(1);
6084 data.writeBundle(options.toBundle());
6085 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006086 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006087 reply.readException();
6088 data.recycle();
6089 reply.recycle();
6090 }
6091
6092 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006093 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006094 Parcel data = Parcel.obtain();
6095 Parcel reply = Parcel.obtain();
6096 data.writeInterfaceToken(IActivityManager.descriptor);
6097 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006098 data.writeInt(visible ? 1 : 0);
6099 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006100 reply.readException();
6101 boolean success = reply.readInt() > 0;
6102 data.recycle();
6103 reply.recycle();
6104 return success;
6105 }
6106
6107 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006108 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006109 Parcel data = Parcel.obtain();
6110 Parcel reply = Parcel.obtain();
6111 data.writeInterfaceToken(IActivityManager.descriptor);
6112 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006113 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006114 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006115 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006116 data.recycle();
6117 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006118 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006119 }
6120
6121 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006122 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006123 Parcel data = Parcel.obtain();
6124 Parcel reply = Parcel.obtain();
6125 data.writeInterfaceToken(IActivityManager.descriptor);
6126 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006127 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006128 reply.readException();
6129 data.recycle();
6130 reply.recycle();
6131 }
6132
6133 @Override
6134 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6135 Parcel data = Parcel.obtain();
6136 Parcel reply = Parcel.obtain();
6137 data.writeInterfaceToken(IActivityManager.descriptor);
6138 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006139 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006140 reply.readException();
6141 data.recycle();
6142 reply.recycle();
6143 }
6144
Craig Mautner8746a472014-07-24 15:12:54 -07006145 @Override
6146 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6147 Parcel data = Parcel.obtain();
6148 Parcel reply = Parcel.obtain();
6149 data.writeInterfaceToken(IActivityManager.descriptor);
6150 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006151 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006152 reply.readException();
6153 data.recycle();
6154 reply.recycle();
6155 }
6156
Craig Mautner6e2f3952014-09-09 14:26:41 -07006157 @Override
6158 public void bootAnimationComplete() throws RemoteException {
6159 Parcel data = Parcel.obtain();
6160 Parcel reply = Parcel.obtain();
6161 data.writeInterfaceToken(IActivityManager.descriptor);
6162 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6163 reply.readException();
6164 data.recycle();
6165 reply.recycle();
6166 }
6167
Wale Ogunwale18795a22014-12-03 11:38:33 -08006168 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006169 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6170 Parcel data = Parcel.obtain();
6171 Parcel reply = Parcel.obtain();
6172 data.writeInterfaceToken(IActivityManager.descriptor);
6173 data.writeInt(uid);
6174 data.writeByteArray(firstPacket);
6175 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6176 reply.readException();
6177 data.recycle();
6178 reply.recycle();
6179 }
6180
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006181 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006182 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6183 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006184 Parcel data = Parcel.obtain();
6185 Parcel reply = Parcel.obtain();
6186 data.writeInterfaceToken(IActivityManager.descriptor);
6187 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006188 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006189 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006190 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006191 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6192 reply.readException();
6193 data.recycle();
6194 reply.recycle();
6195 }
6196
6197 @Override
6198 public void dumpHeapFinished(String path) throws RemoteException {
6199 Parcel data = Parcel.obtain();
6200 Parcel reply = Parcel.obtain();
6201 data.writeInterfaceToken(IActivityManager.descriptor);
6202 data.writeString(path);
6203 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6204 reply.readException();
6205 data.recycle();
6206 reply.recycle();
6207 }
6208
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006209 @Override
6210 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6211 throws RemoteException {
6212 Parcel data = Parcel.obtain();
6213 Parcel reply = Parcel.obtain();
6214 data.writeInterfaceToken(IActivityManager.descriptor);
6215 data.writeStrongBinder(session.asBinder());
6216 data.writeInt(keepAwake ? 1 : 0);
6217 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6218 reply.readException();
6219 data.recycle();
6220 reply.recycle();
6221 }
6222
Craig Mautnere5600772015-04-03 21:36:37 -07006223 @Override
6224 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6225 Parcel data = Parcel.obtain();
6226 Parcel reply = Parcel.obtain();
6227 data.writeInterfaceToken(IActivityManager.descriptor);
6228 data.writeInt(userId);
6229 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006230 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006231 reply.readException();
6232 data.recycle();
6233 reply.recycle();
6234 }
6235
Dianne Hackborn1e383822015-04-10 14:02:33 -07006236 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006237 public void updateDeviceOwner(String packageName) throws RemoteException {
6238 Parcel data = Parcel.obtain();
6239 Parcel reply = Parcel.obtain();
6240 data.writeInterfaceToken(IActivityManager.descriptor);
6241 data.writeString(packageName);
6242 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6243 reply.readException();
6244 data.recycle();
6245 reply.recycle();
6246 }
6247
6248 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006249 public int getPackageProcessState(String packageName, String callingPackage)
6250 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006251 Parcel data = Parcel.obtain();
6252 Parcel reply = Parcel.obtain();
6253 data.writeInterfaceToken(IActivityManager.descriptor);
6254 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006255 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006256 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6257 reply.readException();
6258 int res = reply.readInt();
6259 data.recycle();
6260 reply.recycle();
6261 return res;
6262 }
6263
Stefan Kuhne16045c22015-06-05 07:18:06 -07006264 @Override
6265 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6266 throws RemoteException {
6267 Parcel data = Parcel.obtain();
6268 Parcel reply = Parcel.obtain();
6269 data.writeInterfaceToken(IActivityManager.descriptor);
6270 data.writeString(process);
6271 data.writeInt(userId);
6272 data.writeInt(level);
6273 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6274 reply.readException();
6275 int res = reply.readInt();
6276 data.recycle();
6277 reply.recycle();
6278 return res != 0;
6279 }
6280
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006281 @Override
6282 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6283 Parcel data = Parcel.obtain();
6284 Parcel reply = Parcel.obtain();
6285 data.writeInterfaceToken(IActivityManager.descriptor);
6286 data.writeStrongBinder(token);
6287 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6288 reply.readException();
6289 int res = reply.readInt();
6290 data.recycle();
6291 reply.recycle();
6292 return res != 0;
6293 }
6294
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006295 @Override
6296 public void moveActivityToStack(IBinder token, int stackId) throws RemoteException {
6297 Parcel data = Parcel.obtain();
6298 Parcel reply = Parcel.obtain();
6299 data.writeInterfaceToken(IActivityManager.descriptor);
6300 data.writeStrongBinder(token);
6301 data.writeInt(stackId);
6302 mRemote.transact(MOVE_ACTIVITY_TO_STACK_TRANSACTION, data, reply, 0);
6303 reply.readException();
6304 data.recycle();
6305 reply.recycle();
6306 }
6307
6308 @Override
6309 public int getActivityStackId(IBinder token) throws RemoteException {
6310 Parcel data = Parcel.obtain();
6311 Parcel reply = Parcel.obtain();
6312 data.writeInterfaceToken(IActivityManager.descriptor);
6313 data.writeStrongBinder(token);
6314 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6315 reply.readException();
6316 int stackId = reply.readInt();
6317 data.recycle();
6318 reply.recycle();
6319 return stackId;
6320 }
6321
Filip Gruszczynski23493322015-07-29 17:02:59 -07006322 @Override
6323 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006324 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6325 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006326 Parcel data = Parcel.obtain();
6327 Parcel reply = Parcel.obtain();
6328 data.writeInterfaceToken(IActivityManager.descriptor);
6329 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006330 writeIntArray(horizontalSizeConfiguration, data);
6331 writeIntArray(verticalSizeConfigurations, data);
6332 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006333 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6334 reply.readException();
6335 data.recycle();
6336 reply.recycle();
6337 }
6338
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006339 private static void writeIntArray(int[] array, Parcel data) {
6340 if (array == null) {
6341 data.writeInt(0);
6342 } else {
6343 data.writeInt(array.length);
6344 data.writeIntArray(array);
6345 }
6346 }
6347
Wale Ogunwale83301a92015-09-24 15:54:08 -07006348 @Override
6349 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6350 Parcel data = Parcel.obtain();
6351 Parcel reply = Parcel.obtain();
6352 data.writeInterfaceToken(IActivityManager.descriptor);
6353 data.writeInt(suppress ? 1 : 0);
6354 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6355 reply.readException();
6356 data.recycle();
6357 reply.recycle();
6358 }
6359
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006360 @Override
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006361 public void moveTasksToFullscreenStack(int fromStackId) throws RemoteException {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006362 Parcel data = Parcel.obtain();
6363 Parcel reply = Parcel.obtain();
6364 data.writeInterfaceToken(IActivityManager.descriptor);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006365 data.writeInt(fromStackId);
6366 mRemote.transact(MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006367 reply.readException();
6368 data.recycle();
6369 reply.recycle();
6370 }
6371
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006372 @Override
6373 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6374 Parcel data = Parcel.obtain();
6375 Parcel reply = Parcel.obtain();
6376 data.writeInterfaceToken(IActivityManager.descriptor);
6377 data.writeInt(uid);
6378 data.writeString(packageName);
6379 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6380 reply.readException();
6381 int res = reply.readInt();
6382 data.recycle();
6383 reply.recycle();
6384 return res;
6385 }
6386
Wale Ogunwale5f986092015-12-04 15:35:38 -08006387 @Override
6388 public boolean inMultiWindowMode(IBinder token) throws RemoteException {
6389 Parcel data = Parcel.obtain();
6390 Parcel reply = Parcel.obtain();
6391 data.writeInterfaceToken(IActivityManager.descriptor);
6392 data.writeStrongBinder(token);
6393 mRemote.transact(IN_MULTI_WINDOW_MODE_TRANSACTION, data, reply, 0);
6394 reply.readException();
6395 final boolean multiWindowMode = reply.readInt() == 1 ? true : false;
6396 data.recycle();
6397 reply.recycle();
6398 return multiWindowMode;
6399 }
6400
6401 @Override
6402 public boolean inPictureInPictureMode(IBinder token) throws RemoteException {
6403 Parcel data = Parcel.obtain();
6404 Parcel reply = Parcel.obtain();
6405 data.writeInterfaceToken(IActivityManager.descriptor);
6406 data.writeStrongBinder(token);
6407 mRemote.transact(IN_PICTURE_IN_PICTURE_MODE_TRANSACTION, data, reply, 0);
6408 reply.readException();
6409 final boolean pipMode = reply.readInt() == 1 ? true : false;
6410 data.recycle();
6411 reply.recycle();
6412 return pipMode;
6413 }
6414
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006415 private IBinder mRemote;
6416}