blob: 08f37f5bd51bf85d6c484ff439f95a4eb2d50d83 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
Dianne Hackborn69c6adc2015-06-02 10:52:59 -070020import android.app.assist.AssistContent;
21import android.app.assist.AssistStructure;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070023import android.content.IIntentReceiver;
24import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.content.Intent;
26import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070027import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070028import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070029import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.pm.ConfigurationInfo;
31import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070032import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070033import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070035import android.graphics.Bitmap;
36import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080037import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.net.Uri;
39import android.os.Binder;
40import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070041import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.os.IBinder;
43import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.ParcelFileDescriptor;
45import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070046import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070047import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070049import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070050import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080053import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070054import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080055import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057import java.util.ArrayList;
58import java.util.List;
59
60/** {@hide} */
61public abstract class ActivityManagerNative extends Binder implements IActivityManager
62{
63 /**
64 * Cast a Binder object into an activity manager interface, generating
65 * a proxy if needed.
66 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080067 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 if (obj == null) {
69 return null;
70 }
71 IActivityManager in =
72 (IActivityManager)obj.queryLocalInterface(descriptor);
73 if (in != null) {
74 return in;
75 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 return new ActivityManagerProxy(obj);
78 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 /**
81 * Retrieve the system's default/global activity manager.
82 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080083 static public IActivityManager getDefault() {
84 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 }
86
87 /**
88 * Convenience for checking whether the system is ready. For internal use only.
89 */
90 static public boolean isSystemReady() {
91 if (!sSystemReady) {
92 sSystemReady = getDefault().testIsSystemReady();
93 }
94 return sSystemReady;
95 }
96 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080097
Svet Ganov16a16892015-04-16 10:32:04 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
99 broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId);
100 }
101
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 /**
103 * Convenience for sending a sticky broadcast. For internal use only.
104 * If you don't care about permission, use null.
105 */
Svet Ganov16a16892015-04-16 10:32:04 -0700106 static public void broadcastStickyIntent(Intent intent, String permission, int appOp,
107 int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
109 getDefault().broadcastIntent(
Filip Gruszczynski23493322015-07-29 17:02:59 -0700110 null, intent, null, null, Activity.RESULT_OK, null, null,
111 null /*permission*/, appOp, null, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Dianne Hackborn1e383822015-04-10 14:02:33 -0700116 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
117 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700119 getDefault().noteWakeupAlarm((ps != null) ? ps.getTarget() : null,
120 sourceUid, sourcePkg, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700121 } catch (RemoteException ex) {
122 }
123 }
124
125 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
126 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700127 getDefault().noteAlarmStart((ps != null) ? ps.getTarget() : null, sourceUid, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700128 } catch (RemoteException ex) {
129 }
130 }
131
132 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
133 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700134 getDefault().noteAlarmFinish((ps != null) ? ps.getTarget() : null, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135 } catch (RemoteException ex) {
136 }
137 }
138
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800139 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800140 attachInterface(this, descriptor);
141 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700142
143 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
145 throws RemoteException {
146 switch (code) {
147 case START_ACTIVITY_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800155 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800156 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700158 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700159 ProfilerInfo profilerInfo = data.readInt() != 0
160 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800163 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700164 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165 reply.writeNoException();
166 reply.writeInt(result);
167 return true;
168 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700169
Amith Yamasani82644082012-08-03 13:09:11 -0700170 case START_ACTIVITY_AS_USER_TRANSACTION:
171 {
172 data.enforceInterface(IActivityManager.descriptor);
173 IBinder b = data.readStrongBinder();
174 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800175 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700176 Intent intent = Intent.CREATOR.createFromParcel(data);
177 String resolvedType = data.readString();
178 IBinder resultTo = data.readStrongBinder();
179 String resultWho = data.readString();
180 int requestCode = data.readInt();
181 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700182 ProfilerInfo profilerInfo = data.readInt() != 0
183 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700184 Bundle options = data.readInt() != 0
185 ? Bundle.CREATOR.createFromParcel(data) : null;
186 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800187 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700188 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700189 reply.writeNoException();
190 reply.writeInt(result);
191 return true;
192 }
193
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700194 case START_ACTIVITY_AS_CALLER_TRANSACTION:
195 {
196 data.enforceInterface(IActivityManager.descriptor);
197 IBinder b = data.readStrongBinder();
198 IApplicationThread app = ApplicationThreadNative.asInterface(b);
199 String callingPackage = data.readString();
200 Intent intent = Intent.CREATOR.createFromParcel(data);
201 String resolvedType = data.readString();
202 IBinder resultTo = data.readStrongBinder();
203 String resultWho = data.readString();
204 int requestCode = data.readInt();
205 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700206 ProfilerInfo profilerInfo = data.readInt() != 0
207 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700208 Bundle options = data.readInt() != 0
209 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700210 boolean ignoreTargetSecurity = data.readInt() != 0;
Jeff Sharkey97978802014-10-14 10:48:18 -0700211 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700212 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700213 resultTo, resultWho, requestCode, startFlags, profilerInfo, options,
214 ignoreTargetSecurity, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700215 reply.writeNoException();
216 reply.writeInt(result);
217 return true;
218 }
219
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800220 case START_ACTIVITY_AND_WAIT_TRANSACTION:
221 {
222 data.enforceInterface(IActivityManager.descriptor);
223 IBinder b = data.readStrongBinder();
224 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800225 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800226 Intent intent = Intent.CREATOR.createFromParcel(data);
227 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800228 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800229 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800230 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700232 ProfilerInfo profilerInfo = data.readInt() != 0
233 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700234 Bundle options = data.readInt() != 0
235 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700236 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800237 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700238 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800239 reply.writeNoException();
240 result.writeToParcel(reply, 0);
241 return true;
242 }
243
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700244 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
245 {
246 data.enforceInterface(IActivityManager.descriptor);
247 IBinder b = data.readStrongBinder();
248 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800249 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700250 Intent intent = Intent.CREATOR.createFromParcel(data);
251 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700252 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700253 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700254 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700255 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700256 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700257 Bundle options = data.readInt() != 0
258 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700259 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800260 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700261 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700262 reply.writeNoException();
263 reply.writeInt(result);
264 return true;
265 }
266
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700267 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700268 {
269 data.enforceInterface(IActivityManager.descriptor);
270 IBinder b = data.readStrongBinder();
271 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700272 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700273 Intent fillInIntent = null;
274 if (data.readInt() != 0) {
275 fillInIntent = Intent.CREATOR.createFromParcel(data);
276 }
277 String resolvedType = data.readString();
278 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700279 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700280 int requestCode = data.readInt();
281 int flagsMask = data.readInt();
282 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700283 Bundle options = data.readInt() != 0
284 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700285 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700286 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700287 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700288 reply.writeNoException();
289 reply.writeInt(result);
290 return true;
291 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700292
Dianne Hackborn91097de2014-04-04 18:02:06 -0700293 case START_VOICE_ACTIVITY_TRANSACTION:
294 {
295 data.enforceInterface(IActivityManager.descriptor);
296 String callingPackage = data.readString();
297 int callingPid = data.readInt();
298 int callingUid = data.readInt();
299 Intent intent = Intent.CREATOR.createFromParcel(data);
300 String resolvedType = data.readString();
301 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
302 data.readStrongBinder());
303 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
304 data.readStrongBinder());
305 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700306 ProfilerInfo profilerInfo = data.readInt() != 0
307 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700308 Bundle options = data.readInt() != 0
309 ? Bundle.CREATOR.createFromParcel(data) : null;
310 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700311 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
312 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700313 reply.writeNoException();
314 reply.writeInt(result);
315 return true;
316 }
317
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800318 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
319 {
320 data.enforceInterface(IActivityManager.descriptor);
321 IBinder callingActivity = data.readStrongBinder();
322 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700323 Bundle options = data.readInt() != 0
324 ? Bundle.CREATOR.createFromParcel(data) : null;
325 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 reply.writeNoException();
327 reply.writeInt(result ? 1 : 0);
328 return true;
329 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700330
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700331 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
332 {
333 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700334 final int taskId = data.readInt();
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700335 final Bundle options =
336 data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
Wale Ogunwale854809c2015-12-27 16:18:19 -0800337 final int result = startActivityFromRecents(taskId, options);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700338 reply.writeNoException();
339 reply.writeInt(result);
340 return true;
341 }
342
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800343 case FINISH_ACTIVITY_TRANSACTION: {
344 data.enforceInterface(IActivityManager.descriptor);
345 IBinder token = data.readStrongBinder();
346 Intent resultData = null;
347 int resultCode = data.readInt();
348 if (data.readInt() != 0) {
349 resultData = Intent.CREATOR.createFromParcel(data);
350 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700351 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700352 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800353 reply.writeNoException();
354 reply.writeInt(res ? 1 : 0);
355 return true;
356 }
357
358 case FINISH_SUB_ACTIVITY_TRANSACTION: {
359 data.enforceInterface(IActivityManager.descriptor);
360 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700361 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800362 int requestCode = data.readInt();
363 finishSubActivity(token, resultWho, requestCode);
364 reply.writeNoException();
365 return true;
366 }
367
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700368 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
369 data.enforceInterface(IActivityManager.descriptor);
370 IBinder token = data.readStrongBinder();
371 boolean res = finishActivityAffinity(token);
372 reply.writeNoException();
373 reply.writeInt(res ? 1 : 0);
374 return true;
375 }
376
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700377 case FINISH_VOICE_TASK_TRANSACTION: {
378 data.enforceInterface(IActivityManager.descriptor);
379 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
380 data.readStrongBinder());
381 finishVoiceTask(session);
382 reply.writeNoException();
383 return true;
384 }
385
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700386 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
387 data.enforceInterface(IActivityManager.descriptor);
388 IBinder token = data.readStrongBinder();
389 boolean res = releaseActivityInstance(token);
390 reply.writeNoException();
391 reply.writeInt(res ? 1 : 0);
392 return true;
393 }
394
395 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
396 data.enforceInterface(IActivityManager.descriptor);
397 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
398 releaseSomeActivities(app);
399 reply.writeNoException();
400 return true;
401 }
402
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800403 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
404 data.enforceInterface(IActivityManager.descriptor);
405 IBinder token = data.readStrongBinder();
406 boolean res = willActivityBeVisible(token);
407 reply.writeNoException();
408 reply.writeInt(res ? 1 : 0);
409 return true;
410 }
411
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800412 case REGISTER_RECEIVER_TRANSACTION:
413 {
414 data.enforceInterface(IActivityManager.descriptor);
415 IBinder b = data.readStrongBinder();
416 IApplicationThread app =
417 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700418 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800419 b = data.readStrongBinder();
420 IIntentReceiver rec
421 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
422 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
423 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700424 int userId = data.readInt();
425 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800426 reply.writeNoException();
427 if (intent != null) {
428 reply.writeInt(1);
429 intent.writeToParcel(reply, 0);
430 } else {
431 reply.writeInt(0);
432 }
433 return true;
434 }
435
436 case UNREGISTER_RECEIVER_TRANSACTION:
437 {
438 data.enforceInterface(IActivityManager.descriptor);
439 IBinder b = data.readStrongBinder();
440 if (b == null) {
441 return true;
442 }
443 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
444 unregisterReceiver(rec);
445 reply.writeNoException();
446 return true;
447 }
448
449 case BROADCAST_INTENT_TRANSACTION:
450 {
451 data.enforceInterface(IActivityManager.descriptor);
452 IBinder b = data.readStrongBinder();
453 IApplicationThread app =
454 b != null ? ApplicationThreadNative.asInterface(b) : null;
455 Intent intent = Intent.CREATOR.createFromParcel(data);
456 String resolvedType = data.readString();
457 b = data.readStrongBinder();
458 IIntentReceiver resultTo =
459 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
460 int resultCode = data.readInt();
461 String resultData = data.readString();
462 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700463 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800464 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700465 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800466 boolean serialized = data.readInt() != 0;
467 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700468 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800469 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700470 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700471 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800472 reply.writeNoException();
473 reply.writeInt(res);
474 return true;
475 }
476
477 case UNBROADCAST_INTENT_TRANSACTION:
478 {
479 data.enforceInterface(IActivityManager.descriptor);
480 IBinder b = data.readStrongBinder();
481 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
482 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700483 int userId = data.readInt();
484 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800485 reply.writeNoException();
486 return true;
487 }
488
489 case FINISH_RECEIVER_TRANSACTION: {
490 data.enforceInterface(IActivityManager.descriptor);
491 IBinder who = data.readStrongBinder();
492 int resultCode = data.readInt();
493 String resultData = data.readString();
494 Bundle resultExtras = data.readBundle();
495 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800496 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800498 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 }
500 reply.writeNoException();
501 return true;
502 }
503
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800504 case ATTACH_APPLICATION_TRANSACTION: {
505 data.enforceInterface(IActivityManager.descriptor);
506 IApplicationThread app = ApplicationThreadNative.asInterface(
507 data.readStrongBinder());
508 if (app != null) {
509 attachApplication(app);
510 }
511 reply.writeNoException();
512 return true;
513 }
514
515 case ACTIVITY_IDLE_TRANSACTION: {
516 data.enforceInterface(IActivityManager.descriptor);
517 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700518 Configuration config = null;
519 if (data.readInt() != 0) {
520 config = Configuration.CREATOR.createFromParcel(data);
521 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700522 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800523 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700524 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800525 }
526 reply.writeNoException();
527 return true;
528 }
529
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700530 case ACTIVITY_RESUMED_TRANSACTION: {
531 data.enforceInterface(IActivityManager.descriptor);
532 IBinder token = data.readStrongBinder();
533 activityResumed(token);
534 reply.writeNoException();
535 return true;
536 }
537
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800538 case ACTIVITY_PAUSED_TRANSACTION: {
539 data.enforceInterface(IActivityManager.descriptor);
540 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700541 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800542 reply.writeNoException();
543 return true;
544 }
545
546 case ACTIVITY_STOPPED_TRANSACTION: {
547 data.enforceInterface(IActivityManager.descriptor);
548 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800549 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700550 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800551 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700552 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800553 reply.writeNoException();
554 return true;
555 }
556
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800557 case ACTIVITY_SLEPT_TRANSACTION: {
558 data.enforceInterface(IActivityManager.descriptor);
559 IBinder token = data.readStrongBinder();
560 activitySlept(token);
561 reply.writeNoException();
562 return true;
563 }
564
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800565 case ACTIVITY_DESTROYED_TRANSACTION: {
566 data.enforceInterface(IActivityManager.descriptor);
567 IBinder token = data.readStrongBinder();
568 activityDestroyed(token);
569 reply.writeNoException();
570 return true;
571 }
572
Jorim Jaggife89d122015-12-22 16:28:44 +0100573 case ACTIVITY_RELAUNCHED_TRANSACTION: {
574 data.enforceInterface(IActivityManager.descriptor);
575 IBinder token = data.readStrongBinder();
576 activityRelaunched(token);
577 reply.writeNoException();
578 return true;
579 }
580
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800581 case GET_CALLING_PACKAGE_TRANSACTION: {
582 data.enforceInterface(IActivityManager.descriptor);
583 IBinder token = data.readStrongBinder();
584 String res = token != null ? getCallingPackage(token) : null;
585 reply.writeNoException();
586 reply.writeString(res);
587 return true;
588 }
589
590 case GET_CALLING_ACTIVITY_TRANSACTION: {
591 data.enforceInterface(IActivityManager.descriptor);
592 IBinder token = data.readStrongBinder();
593 ComponentName cn = getCallingActivity(token);
594 reply.writeNoException();
595 ComponentName.writeToParcel(cn, reply);
596 return true;
597 }
598
Winson Chung1147c402014-05-14 11:05:00 -0700599 case GET_APP_TASKS_TRANSACTION: {
600 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700601 String callingPackage = data.readString();
602 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700603 reply.writeNoException();
604 int N = list != null ? list.size() : -1;
605 reply.writeInt(N);
606 int i;
607 for (i=0; i<N; i++) {
608 IAppTask task = list.get(i);
609 reply.writeStrongBinder(task.asBinder());
610 }
611 return true;
612 }
613
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700614 case ADD_APP_TASK_TRANSACTION: {
615 data.enforceInterface(IActivityManager.descriptor);
616 IBinder activityToken = data.readStrongBinder();
617 Intent intent = Intent.CREATOR.createFromParcel(data);
618 ActivityManager.TaskDescription descr
619 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
620 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
621 int res = addAppTask(activityToken, intent, descr, thumbnail);
622 reply.writeNoException();
623 reply.writeInt(res);
624 return true;
625 }
626
627 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
628 data.enforceInterface(IActivityManager.descriptor);
629 Point size = getAppTaskThumbnailSize();
630 reply.writeNoException();
631 size.writeToParcel(reply, 0);
632 return true;
633 }
634
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800635 case GET_TASKS_TRANSACTION: {
636 data.enforceInterface(IActivityManager.descriptor);
637 int maxNum = data.readInt();
638 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700639 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 reply.writeNoException();
641 int N = list != null ? list.size() : -1;
642 reply.writeInt(N);
643 int i;
644 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700645 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800646 info.writeToParcel(reply, 0);
647 }
648 return true;
649 }
650
651 case GET_RECENT_TASKS_TRANSACTION: {
652 data.enforceInterface(IActivityManager.descriptor);
653 int maxNum = data.readInt();
654 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700655 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800656 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700657 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800658 reply.writeNoException();
659 reply.writeTypedList(list);
660 return true;
661 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700662
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700663 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800664 data.enforceInterface(IActivityManager.descriptor);
665 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700666 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800667 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700668 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800669 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700670 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700671 } else {
672 reply.writeInt(0);
673 }
674 return true;
675 }
676
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800677 case GET_SERVICES_TRANSACTION: {
678 data.enforceInterface(IActivityManager.descriptor);
679 int maxNum = data.readInt();
680 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700681 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800682 reply.writeNoException();
683 int N = list != null ? list.size() : -1;
684 reply.writeInt(N);
685 int i;
686 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700687 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800688 info.writeToParcel(reply, 0);
689 }
690 return true;
691 }
692
693 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
694 data.enforceInterface(IActivityManager.descriptor);
695 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
696 reply.writeNoException();
697 reply.writeTypedList(list);
698 return true;
699 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700700
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
702 data.enforceInterface(IActivityManager.descriptor);
703 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
704 reply.writeNoException();
705 reply.writeTypedList(list);
706 return true;
707 }
708
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700709 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
710 data.enforceInterface(IActivityManager.descriptor);
711 List<ApplicationInfo> list = getRunningExternalApplications();
712 reply.writeNoException();
713 reply.writeTypedList(list);
714 return true;
715 }
716
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800717 case MOVE_TASK_TO_FRONT_TRANSACTION: {
718 data.enforceInterface(IActivityManager.descriptor);
719 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800720 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700721 Bundle options = data.readInt() != 0
722 ? Bundle.CREATOR.createFromParcel(data) : null;
723 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800724 reply.writeNoException();
725 return true;
726 }
727
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800728 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
729 data.enforceInterface(IActivityManager.descriptor);
730 IBinder token = data.readStrongBinder();
731 boolean nonRoot = data.readInt() != 0;
732 boolean res = moveActivityTaskToBack(token, nonRoot);
733 reply.writeNoException();
734 reply.writeInt(res ? 1 : 0);
735 return true;
736 }
737
738 case MOVE_TASK_BACKWARDS_TRANSACTION: {
739 data.enforceInterface(IActivityManager.descriptor);
740 int task = data.readInt();
741 moveTaskBackwards(task);
742 reply.writeNoException();
743 return true;
744 }
745
Craig Mautnerc00204b2013-03-05 15:02:14 -0800746 case MOVE_TASK_TO_STACK_TRANSACTION: {
747 data.enforceInterface(IActivityManager.descriptor);
748 int taskId = data.readInt();
749 int stackId = data.readInt();
750 boolean toTop = data.readInt() != 0;
751 moveTaskToStack(taskId, stackId, toTop);
752 reply.writeNoException();
753 return true;
754 }
755
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700756 case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: {
757 data.enforceInterface(IActivityManager.descriptor);
758 int taskId = data.readInt();
759 int createMode = data.readInt();
760 boolean toTop = data.readInt() != 0;
Jorim Jaggi030979c2015-11-20 15:14:43 -0800761 boolean animate = data.readInt() != 0;
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -0800762 Rect bounds = null;
763 boolean hasBounds = data.readInt() != 0;
764 if (hasBounds) {
765 bounds = Rect.CREATOR.createFromParcel(data);
766 }
767 moveTaskToDockedStack(taskId, createMode, toTop, animate, bounds);
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700768 reply.writeNoException();
769 return true;
770 }
771
Dianne Hackbornbef28fe2015-10-29 17:57:11 -0700772 case MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION: {
Wale Ogunwale079a0042015-10-24 11:44:07 -0700773 data.enforceInterface(IActivityManager.descriptor);
774 final int stackId = data.readInt();
775 final Rect r = Rect.CREATOR.createFromParcel(data);
776 final boolean res = moveTopActivityToPinnedStack(stackId, r);
777 reply.writeNoException();
778 reply.writeInt(res ? 1 : 0);
779 return true;
780 }
781
Craig Mautnerc00204b2013-03-05 15:02:14 -0800782 case RESIZE_STACK_TRANSACTION: {
783 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700784 final int stackId = data.readInt();
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100785 final boolean hasRect = data.readInt() != 0;
786 Rect r = null;
787 if (hasRect) {
788 r = Rect.CREATOR.createFromParcel(data);
789 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700790 final boolean allowResizeInDockedMode = data.readInt() == 1;
791 resizeStack(stackId, r, allowResizeInDockedMode);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800792 reply.writeNoException();
793 return true;
794 }
795
Jorim Jaggidc249c42015-12-15 14:57:31 -0800796 case RESIZE_DOCKED_STACK_TRANSACTION: {
797 data.enforceInterface(IActivityManager.descriptor);
798 final boolean hasBounds = data.readInt() != 0;
799 Rect bounds = null;
800 if (hasBounds) {
801 bounds = Rect.CREATOR.createFromParcel(data);
802 }
803 final boolean hasTempDockedTaskBounds = data.readInt() != 0;
804 Rect tempDockedTaskBounds = null;
805 if (hasTempDockedTaskBounds) {
806 tempDockedTaskBounds = Rect.CREATOR.createFromParcel(data);
807 }
808 final boolean hasTempDockedTaskInsetBounds = data.readInt() != 0;
809 Rect tempDockedTaskInsetBounds = null;
810 if (hasTempDockedTaskInsetBounds) {
811 tempDockedTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
812 }
813 final boolean hasTempOtherTaskBounds = data.readInt() != 0;
814 Rect tempOtherTaskBounds = null;
815 if (hasTempOtherTaskBounds) {
816 tempOtherTaskBounds = Rect.CREATOR.createFromParcel(data);
817 }
818 final boolean hasTempOtherTaskInsetBounds = data.readInt() != 0;
819 Rect tempOtherTaskInsetBounds = null;
820 if (hasTempOtherTaskInsetBounds) {
821 tempOtherTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
822 }
823 resizeDockedStack(bounds, tempDockedTaskBounds, tempDockedTaskInsetBounds,
824 tempOtherTaskBounds, tempOtherTaskInsetBounds);
825 reply.writeNoException();
826 return true;
827 }
828
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700829 case POSITION_TASK_IN_STACK_TRANSACTION: {
830 data.enforceInterface(IActivityManager.descriptor);
831 int taskId = data.readInt();
832 int stackId = data.readInt();
833 int position = data.readInt();
834 positionTaskInStack(taskId, stackId, position);
835 reply.writeNoException();
836 return true;
837 }
838
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800839 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700840 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800841 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700842 reply.writeNoException();
843 reply.writeTypedList(list);
844 return true;
845 }
846
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800847 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700848 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800849 int stackId = data.readInt();
850 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700851 reply.writeNoException();
852 if (info != null) {
853 reply.writeInt(1);
854 info.writeToParcel(reply, 0);
855 } else {
856 reply.writeInt(0);
857 }
858 return true;
859 }
860
Winson Chung303e1ff2014-03-07 15:06:19 -0800861 case IS_IN_HOME_STACK_TRANSACTION: {
862 data.enforceInterface(IActivityManager.descriptor);
863 int taskId = data.readInt();
864 boolean isInHomeStack = isInHomeStack(taskId);
865 reply.writeNoException();
866 reply.writeInt(isInHomeStack ? 1 : 0);
867 return true;
868 }
869
Craig Mautnercf910b02013-04-23 11:23:27 -0700870 case SET_FOCUSED_STACK_TRANSACTION: {
871 data.enforceInterface(IActivityManager.descriptor);
872 int stackId = data.readInt();
873 setFocusedStack(stackId);
874 reply.writeNoException();
875 return true;
876 }
877
Winson Chungd16c5652015-01-26 16:11:07 -0800878 case GET_FOCUSED_STACK_ID_TRANSACTION: {
879 data.enforceInterface(IActivityManager.descriptor);
880 int focusedStackId = getFocusedStackId();
881 reply.writeNoException();
882 reply.writeInt(focusedStackId);
883 return true;
884 }
885
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700886 case SET_FOCUSED_TASK_TRANSACTION: {
887 data.enforceInterface(IActivityManager.descriptor);
888 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700889 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700890 reply.writeNoException();
891 return true;
892 }
893
Winson Chung740c3ac2014-11-12 16:14:38 -0800894 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
895 data.enforceInterface(IActivityManager.descriptor);
896 IBinder token = data.readStrongBinder();
897 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
898 reply.writeNoException();
899 return true;
900 }
901
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800902 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
903 data.enforceInterface(IActivityManager.descriptor);
904 IBinder token = data.readStrongBinder();
905 boolean onlyRoot = data.readInt() != 0;
906 int res = token != null
907 ? getTaskForActivity(token, onlyRoot) : -1;
908 reply.writeNoException();
909 reply.writeInt(res);
910 return true;
911 }
912
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800913 case GET_CONTENT_PROVIDER_TRANSACTION: {
914 data.enforceInterface(IActivityManager.descriptor);
915 IBinder b = data.readStrongBinder();
916 IApplicationThread app = ApplicationThreadNative.asInterface(b);
917 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700918 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700919 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700920 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800921 reply.writeNoException();
922 if (cph != null) {
923 reply.writeInt(1);
924 cph.writeToParcel(reply, 0);
925 } else {
926 reply.writeInt(0);
927 }
928 return true;
929 }
930
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800931 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
932 data.enforceInterface(IActivityManager.descriptor);
933 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700934 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800935 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700936 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800937 reply.writeNoException();
938 if (cph != null) {
939 reply.writeInt(1);
940 cph.writeToParcel(reply, 0);
941 } else {
942 reply.writeInt(0);
943 }
944 return true;
945 }
946
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800947 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
948 data.enforceInterface(IActivityManager.descriptor);
949 IBinder b = data.readStrongBinder();
950 IApplicationThread app = ApplicationThreadNative.asInterface(b);
951 ArrayList<ContentProviderHolder> providers =
952 data.createTypedArrayList(ContentProviderHolder.CREATOR);
953 publishContentProviders(app, providers);
954 reply.writeNoException();
955 return true;
956 }
957
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700958 case REF_CONTENT_PROVIDER_TRANSACTION: {
959 data.enforceInterface(IActivityManager.descriptor);
960 IBinder b = data.readStrongBinder();
961 int stable = data.readInt();
962 int unstable = data.readInt();
963 boolean res = refContentProvider(b, stable, unstable);
964 reply.writeNoException();
965 reply.writeInt(res ? 1 : 0);
966 return true;
967 }
968
969 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
970 data.enforceInterface(IActivityManager.descriptor);
971 IBinder b = data.readStrongBinder();
972 unstableProviderDied(b);
973 reply.writeNoException();
974 return true;
975 }
976
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700977 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 IBinder b = data.readStrongBinder();
980 appNotRespondingViaProvider(b);
981 reply.writeNoException();
982 return true;
983 }
984
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800985 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
986 data.enforceInterface(IActivityManager.descriptor);
987 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700988 boolean stable = data.readInt() != 0;
989 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800990 reply.writeNoException();
991 return true;
992 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800993
994 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
995 data.enforceInterface(IActivityManager.descriptor);
996 String name = data.readString();
997 IBinder token = data.readStrongBinder();
998 removeContentProviderExternal(name, token);
999 reply.writeNoException();
1000 return true;
1001 }
1002
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07001003 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
1004 data.enforceInterface(IActivityManager.descriptor);
1005 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
1006 PendingIntent pi = getRunningServiceControlPanel(comp);
1007 reply.writeNoException();
1008 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
1009 return true;
1010 }
1011
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001012 case START_SERVICE_TRANSACTION: {
1013 data.enforceInterface(IActivityManager.descriptor);
1014 IBinder b = data.readStrongBinder();
1015 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1016 Intent service = Intent.CREATOR.createFromParcel(data);
1017 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001018 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001019 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001020 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001021 reply.writeNoException();
1022 ComponentName.writeToParcel(cn, reply);
1023 return true;
1024 }
1025
1026 case STOP_SERVICE_TRANSACTION: {
1027 data.enforceInterface(IActivityManager.descriptor);
1028 IBinder b = data.readStrongBinder();
1029 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1030 Intent service = Intent.CREATOR.createFromParcel(data);
1031 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001032 int userId = data.readInt();
1033 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001034 reply.writeNoException();
1035 reply.writeInt(res);
1036 return true;
1037 }
1038
1039 case STOP_SERVICE_TOKEN_TRANSACTION: {
1040 data.enforceInterface(IActivityManager.descriptor);
1041 ComponentName className = ComponentName.readFromParcel(data);
1042 IBinder token = data.readStrongBinder();
1043 int startId = data.readInt();
1044 boolean res = stopServiceToken(className, token, startId);
1045 reply.writeNoException();
1046 reply.writeInt(res ? 1 : 0);
1047 return true;
1048 }
1049
1050 case SET_SERVICE_FOREGROUND_TRANSACTION: {
1051 data.enforceInterface(IActivityManager.descriptor);
1052 ComponentName className = ComponentName.readFromParcel(data);
1053 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001054 int id = data.readInt();
1055 Notification notification = null;
1056 if (data.readInt() != 0) {
1057 notification = Notification.CREATOR.createFromParcel(data);
1058 }
1059 boolean removeNotification = data.readInt() != 0;
1060 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001061 reply.writeNoException();
1062 return true;
1063 }
1064
1065 case BIND_SERVICE_TRANSACTION: {
1066 data.enforceInterface(IActivityManager.descriptor);
1067 IBinder b = data.readStrongBinder();
1068 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1069 IBinder token = data.readStrongBinder();
1070 Intent service = Intent.CREATOR.createFromParcel(data);
1071 String resolvedType = data.readString();
1072 b = data.readStrongBinder();
1073 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001074 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001075 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001076 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001077 int res = bindService(app, token, service, resolvedType, conn, fl,
1078 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001079 reply.writeNoException();
1080 reply.writeInt(res);
1081 return true;
1082 }
1083
1084 case UNBIND_SERVICE_TRANSACTION: {
1085 data.enforceInterface(IActivityManager.descriptor);
1086 IBinder b = data.readStrongBinder();
1087 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1088 boolean res = unbindService(conn);
1089 reply.writeNoException();
1090 reply.writeInt(res ? 1 : 0);
1091 return true;
1092 }
1093
1094 case PUBLISH_SERVICE_TRANSACTION: {
1095 data.enforceInterface(IActivityManager.descriptor);
1096 IBinder token = data.readStrongBinder();
1097 Intent intent = Intent.CREATOR.createFromParcel(data);
1098 IBinder service = data.readStrongBinder();
1099 publishService(token, intent, service);
1100 reply.writeNoException();
1101 return true;
1102 }
1103
1104 case UNBIND_FINISHED_TRANSACTION: {
1105 data.enforceInterface(IActivityManager.descriptor);
1106 IBinder token = data.readStrongBinder();
1107 Intent intent = Intent.CREATOR.createFromParcel(data);
1108 boolean doRebind = data.readInt() != 0;
1109 unbindFinished(token, intent, doRebind);
1110 reply.writeNoException();
1111 return true;
1112 }
1113
1114 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1115 data.enforceInterface(IActivityManager.descriptor);
1116 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001117 int type = data.readInt();
1118 int startId = data.readInt();
1119 int res = data.readInt();
1120 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001121 reply.writeNoException();
1122 return true;
1123 }
1124
1125 case START_INSTRUMENTATION_TRANSACTION: {
1126 data.enforceInterface(IActivityManager.descriptor);
1127 ComponentName className = ComponentName.readFromParcel(data);
1128 String profileFile = data.readString();
1129 int fl = data.readInt();
1130 Bundle arguments = data.readBundle();
1131 IBinder b = data.readStrongBinder();
1132 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001133 b = data.readStrongBinder();
1134 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001135 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001136 String abiOverride = data.readString();
1137 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1138 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001139 reply.writeNoException();
1140 reply.writeInt(res ? 1 : 0);
1141 return true;
1142 }
1143
1144
1145 case FINISH_INSTRUMENTATION_TRANSACTION: {
1146 data.enforceInterface(IActivityManager.descriptor);
1147 IBinder b = data.readStrongBinder();
1148 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1149 int resultCode = data.readInt();
1150 Bundle results = data.readBundle();
1151 finishInstrumentation(app, resultCode, results);
1152 reply.writeNoException();
1153 return true;
1154 }
1155
1156 case GET_CONFIGURATION_TRANSACTION: {
1157 data.enforceInterface(IActivityManager.descriptor);
1158 Configuration config = getConfiguration();
1159 reply.writeNoException();
1160 config.writeToParcel(reply, 0);
1161 return true;
1162 }
1163
1164 case UPDATE_CONFIGURATION_TRANSACTION: {
1165 data.enforceInterface(IActivityManager.descriptor);
1166 Configuration config = Configuration.CREATOR.createFromParcel(data);
1167 updateConfiguration(config);
1168 reply.writeNoException();
1169 return true;
1170 }
1171
1172 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1173 data.enforceInterface(IActivityManager.descriptor);
1174 IBinder token = data.readStrongBinder();
1175 int requestedOrientation = data.readInt();
1176 setRequestedOrientation(token, requestedOrientation);
1177 reply.writeNoException();
1178 return true;
1179 }
1180
1181 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1182 data.enforceInterface(IActivityManager.descriptor);
1183 IBinder token = data.readStrongBinder();
1184 int req = getRequestedOrientation(token);
1185 reply.writeNoException();
1186 reply.writeInt(req);
1187 return true;
1188 }
1189
1190 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1191 data.enforceInterface(IActivityManager.descriptor);
1192 IBinder token = data.readStrongBinder();
1193 ComponentName cn = getActivityClassForToken(token);
1194 reply.writeNoException();
1195 ComponentName.writeToParcel(cn, reply);
1196 return true;
1197 }
1198
1199 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1200 data.enforceInterface(IActivityManager.descriptor);
1201 IBinder token = data.readStrongBinder();
1202 reply.writeNoException();
1203 reply.writeString(getPackageForToken(token));
1204 return true;
1205 }
1206
1207 case GET_INTENT_SENDER_TRANSACTION: {
1208 data.enforceInterface(IActivityManager.descriptor);
1209 int type = data.readInt();
1210 String packageName = data.readString();
1211 IBinder token = data.readStrongBinder();
1212 String resultWho = data.readString();
1213 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001214 Intent[] requestIntents;
1215 String[] requestResolvedTypes;
1216 if (data.readInt() != 0) {
1217 requestIntents = data.createTypedArray(Intent.CREATOR);
1218 requestResolvedTypes = data.createStringArray();
1219 } else {
1220 requestIntents = null;
1221 requestResolvedTypes = null;
1222 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001224 Bundle options = data.readInt() != 0
1225 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001226 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001227 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001228 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001229 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001230 reply.writeNoException();
1231 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1232 return true;
1233 }
1234
1235 case CANCEL_INTENT_SENDER_TRANSACTION: {
1236 data.enforceInterface(IActivityManager.descriptor);
1237 IIntentSender r = IIntentSender.Stub.asInterface(
1238 data.readStrongBinder());
1239 cancelIntentSender(r);
1240 reply.writeNoException();
1241 return true;
1242 }
1243
1244 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1245 data.enforceInterface(IActivityManager.descriptor);
1246 IIntentSender r = IIntentSender.Stub.asInterface(
1247 data.readStrongBinder());
1248 String res = getPackageForIntentSender(r);
1249 reply.writeNoException();
1250 reply.writeString(res);
1251 return true;
1252 }
1253
Christopher Tatec4a07d12012-04-06 14:19:13 -07001254 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1255 data.enforceInterface(IActivityManager.descriptor);
1256 IIntentSender r = IIntentSender.Stub.asInterface(
1257 data.readStrongBinder());
1258 int res = getUidForIntentSender(r);
1259 reply.writeNoException();
1260 reply.writeInt(res);
1261 return true;
1262 }
1263
Dianne Hackborn41203752012-08-31 14:05:51 -07001264 case HANDLE_INCOMING_USER_TRANSACTION: {
1265 data.enforceInterface(IActivityManager.descriptor);
1266 int callingPid = data.readInt();
1267 int callingUid = data.readInt();
1268 int userId = data.readInt();
1269 boolean allowAll = data.readInt() != 0 ;
1270 boolean requireFull = data.readInt() != 0;
1271 String name = data.readString();
1272 String callerPackage = data.readString();
1273 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1274 requireFull, name, callerPackage);
1275 reply.writeNoException();
1276 reply.writeInt(res);
1277 return true;
1278 }
1279
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001280 case SET_PROCESS_LIMIT_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
1282 int max = data.readInt();
1283 setProcessLimit(max);
1284 reply.writeNoException();
1285 return true;
1286 }
1287
1288 case GET_PROCESS_LIMIT_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 int limit = getProcessLimit();
1291 reply.writeNoException();
1292 reply.writeInt(limit);
1293 return true;
1294 }
1295
1296 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1297 data.enforceInterface(IActivityManager.descriptor);
1298 IBinder token = data.readStrongBinder();
1299 int pid = data.readInt();
1300 boolean isForeground = data.readInt() != 0;
1301 setProcessForeground(token, pid, isForeground);
1302 reply.writeNoException();
1303 return true;
1304 }
1305
1306 case CHECK_PERMISSION_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
1308 String perm = data.readString();
1309 int pid = data.readInt();
1310 int uid = data.readInt();
1311 int res = checkPermission(perm, pid, uid);
1312 reply.writeNoException();
1313 reply.writeInt(res);
1314 return true;
1315 }
1316
Dianne Hackbornff170242014-11-19 10:59:01 -08001317 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1318 data.enforceInterface(IActivityManager.descriptor);
1319 String perm = data.readString();
1320 int pid = data.readInt();
1321 int uid = data.readInt();
1322 IBinder token = data.readStrongBinder();
1323 int res = checkPermissionWithToken(perm, pid, uid, token);
1324 reply.writeNoException();
1325 reply.writeInt(res);
1326 return true;
1327 }
1328
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001329 case CHECK_URI_PERMISSION_TRANSACTION: {
1330 data.enforceInterface(IActivityManager.descriptor);
1331 Uri uri = Uri.CREATOR.createFromParcel(data);
1332 int pid = data.readInt();
1333 int uid = data.readInt();
1334 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001335 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001336 IBinder callerToken = data.readStrongBinder();
1337 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001338 reply.writeNoException();
1339 reply.writeInt(res);
1340 return true;
1341 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001342
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001343 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001344 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001345 String packageName = data.readString();
1346 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1347 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001348 int userId = data.readInt();
1349 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001350 reply.writeNoException();
1351 reply.writeInt(res ? 1 : 0);
1352 return true;
1353 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001354
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001355 case GRANT_URI_PERMISSION_TRANSACTION: {
1356 data.enforceInterface(IActivityManager.descriptor);
1357 IBinder b = data.readStrongBinder();
1358 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1359 String targetPkg = data.readString();
1360 Uri uri = Uri.CREATOR.createFromParcel(data);
1361 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001362 int userId = data.readInt();
1363 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001364 reply.writeNoException();
1365 return true;
1366 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001367
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001368 case REVOKE_URI_PERMISSION_TRANSACTION: {
1369 data.enforceInterface(IActivityManager.descriptor);
1370 IBinder b = data.readStrongBinder();
1371 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1372 Uri uri = Uri.CREATOR.createFromParcel(data);
1373 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001374 int userId = data.readInt();
1375 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001376 reply.writeNoException();
1377 return true;
1378 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001379
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001380 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1381 data.enforceInterface(IActivityManager.descriptor);
1382 Uri uri = Uri.CREATOR.createFromParcel(data);
1383 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001384 int userId = data.readInt();
1385 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001386 reply.writeNoException();
1387 return true;
1388 }
1389
1390 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1391 data.enforceInterface(IActivityManager.descriptor);
1392 Uri uri = Uri.CREATOR.createFromParcel(data);
1393 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001394 int userId = data.readInt();
1395 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001396 reply.writeNoException();
1397 return true;
1398 }
1399
1400 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1401 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001402 final String packageName = data.readString();
1403 final boolean incoming = data.readInt() != 0;
1404 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1405 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001406 reply.writeNoException();
1407 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1408 return true;
1409 }
1410
Felipe Lemef3fa0f82016-01-07 12:08:19 -08001411 case GET_GRANTED_URI_PERMISSIONS_TRANSACTION: {
1412 data.enforceInterface(IActivityManager.descriptor);
1413 final String packageName = data.readString();
1414 final int userId = data.readInt();
1415 final ParceledListSlice<UriPermission> perms = getGrantedUriPermissions(packageName,
1416 userId);
1417 reply.writeNoException();
1418 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1419 return true;
1420 }
1421
1422 case CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION: {
1423 data.enforceInterface(IActivityManager.descriptor);
1424 final String packageName = data.readString();
1425 final int userId = data.readInt();
1426 clearGrantedUriPermissions(packageName, userId);
1427 reply.writeNoException();
1428 return true;
1429 }
1430
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001431 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1432 data.enforceInterface(IActivityManager.descriptor);
1433 IBinder b = data.readStrongBinder();
1434 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1435 boolean waiting = data.readInt() != 0;
1436 showWaitingForDebugger(app, waiting);
1437 reply.writeNoException();
1438 return true;
1439 }
1440
1441 case GET_MEMORY_INFO_TRANSACTION: {
1442 data.enforceInterface(IActivityManager.descriptor);
1443 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1444 getMemoryInfo(mi);
1445 reply.writeNoException();
1446 mi.writeToParcel(reply, 0);
1447 return true;
1448 }
1449
1450 case UNHANDLED_BACK_TRANSACTION: {
1451 data.enforceInterface(IActivityManager.descriptor);
1452 unhandledBack();
1453 reply.writeNoException();
1454 return true;
1455 }
1456
1457 case OPEN_CONTENT_URI_TRANSACTION: {
1458 data.enforceInterface(IActivityManager.descriptor);
1459 Uri uri = Uri.parse(data.readString());
1460 ParcelFileDescriptor pfd = openContentUri(uri);
1461 reply.writeNoException();
1462 if (pfd != null) {
1463 reply.writeInt(1);
1464 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1465 } else {
1466 reply.writeInt(0);
1467 }
1468 return true;
1469 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001470
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001471 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1472 data.enforceInterface(IActivityManager.descriptor);
1473 setLockScreenShown(data.readInt() != 0);
1474 reply.writeNoException();
1475 return true;
1476 }
1477
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001478 case SET_DEBUG_APP_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 String pn = data.readString();
1481 boolean wfd = data.readInt() != 0;
1482 boolean per = data.readInt() != 0;
1483 setDebugApp(pn, wfd, per);
1484 reply.writeNoException();
1485 return true;
1486 }
1487
1488 case SET_ALWAYS_FINISH_TRANSACTION: {
1489 data.enforceInterface(IActivityManager.descriptor);
1490 boolean enabled = data.readInt() != 0;
1491 setAlwaysFinish(enabled);
1492 reply.writeNoException();
1493 return true;
1494 }
1495
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001496 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001497 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001498 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001499 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001500 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001501 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001502 return true;
1503 }
1504
1505 case ENTER_SAFE_MODE_TRANSACTION: {
1506 data.enforceInterface(IActivityManager.descriptor);
1507 enterSafeMode();
1508 reply.writeNoException();
1509 return true;
1510 }
1511
1512 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1513 data.enforceInterface(IActivityManager.descriptor);
1514 IIntentSender is = IIntentSender.Stub.asInterface(
1515 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001516 int sourceUid = data.readInt();
1517 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001518 String tag = data.readString();
1519 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1520 reply.writeNoException();
1521 return true;
1522 }
1523
1524 case NOTE_ALARM_START_TRANSACTION: {
1525 data.enforceInterface(IActivityManager.descriptor);
1526 IIntentSender is = IIntentSender.Stub.asInterface(
1527 data.readStrongBinder());
1528 int sourceUid = data.readInt();
1529 String tag = data.readString();
1530 noteAlarmStart(is, sourceUid, tag);
1531 reply.writeNoException();
1532 return true;
1533 }
1534
1535 case NOTE_ALARM_FINISH_TRANSACTION: {
1536 data.enforceInterface(IActivityManager.descriptor);
1537 IIntentSender is = IIntentSender.Stub.asInterface(
1538 data.readStrongBinder());
1539 int sourceUid = data.readInt();
1540 String tag = data.readString();
1541 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001542 reply.writeNoException();
1543 return true;
1544 }
1545
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001546 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001547 data.enforceInterface(IActivityManager.descriptor);
1548 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001549 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001550 boolean secure = data.readInt() != 0;
1551 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001552 reply.writeNoException();
1553 reply.writeInt(res ? 1 : 0);
1554 return true;
1555 }
1556
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001557 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1558 data.enforceInterface(IActivityManager.descriptor);
1559 String reason = data.readString();
1560 boolean res = killProcessesBelowForeground(reason);
1561 reply.writeNoException();
1562 reply.writeInt(res ? 1 : 0);
1563 return true;
1564 }
1565
Dan Egnor60d87622009-12-16 16:32:58 -08001566 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1567 data.enforceInterface(IActivityManager.descriptor);
1568 IBinder app = data.readStrongBinder();
1569 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1570 handleApplicationCrash(app, ci);
1571 reply.writeNoException();
1572 return true;
1573 }
1574
1575 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001576 data.enforceInterface(IActivityManager.descriptor);
1577 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001578 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001579 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001580 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001581 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001582 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001583 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001584 return true;
1585 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001586
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001587 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1588 data.enforceInterface(IActivityManager.descriptor);
1589 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001590 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001591 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1592 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001593 reply.writeNoException();
1594 return true;
1595 }
1596
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001597 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1598 data.enforceInterface(IActivityManager.descriptor);
1599 int sig = data.readInt();
1600 signalPersistentProcesses(sig);
1601 reply.writeNoException();
1602 return true;
1603 }
1604
Dianne Hackborn03abb812010-01-04 18:43:19 -08001605 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1606 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001607 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001608 int userId = data.readInt();
1609 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001610 reply.writeNoException();
1611 return true;
1612 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001613
1614 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1615 data.enforceInterface(IActivityManager.descriptor);
1616 killAllBackgroundProcesses();
1617 reply.writeNoException();
1618 return true;
1619 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001620
Gustav Sennton6258dcd2015-10-30 19:25:37 +00001621 case KILL_PACKAGE_DEPENDENTS_TRANSACTION: {
1622 data.enforceInterface(IActivityManager.descriptor);
1623 String packageName = data.readString();
1624 int userId = data.readInt();
1625 killPackageDependents(packageName, userId);
1626 reply.writeNoException();
1627 return true;
1628 }
1629
Dianne Hackborn03abb812010-01-04 18:43:19 -08001630 case FORCE_STOP_PACKAGE_TRANSACTION: {
1631 data.enforceInterface(IActivityManager.descriptor);
1632 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001633 int userId = data.readInt();
1634 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001635 reply.writeNoException();
1636 return true;
1637 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001638
1639 case GET_MY_MEMORY_STATE_TRANSACTION: {
1640 data.enforceInterface(IActivityManager.descriptor);
1641 ActivityManager.RunningAppProcessInfo info =
1642 new ActivityManager.RunningAppProcessInfo();
1643 getMyMemoryState(info);
1644 reply.writeNoException();
1645 info.writeToParcel(reply, 0);
1646 return true;
1647 }
1648
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001649 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1650 data.enforceInterface(IActivityManager.descriptor);
1651 ConfigurationInfo config = getDeviceConfigurationInfo();
1652 reply.writeNoException();
1653 config.writeToParcel(reply, 0);
1654 return true;
1655 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001656
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001657 case PROFILE_CONTROL_TRANSACTION: {
1658 data.enforceInterface(IActivityManager.descriptor);
1659 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001660 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001661 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001662 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001663 ProfilerInfo profilerInfo = data.readInt() != 0
1664 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1665 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001666 reply.writeNoException();
1667 reply.writeInt(res ? 1 : 0);
1668 return true;
1669 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001670
Dianne Hackborn55280a92009-05-07 15:53:46 -07001671 case SHUTDOWN_TRANSACTION: {
1672 data.enforceInterface(IActivityManager.descriptor);
1673 boolean res = shutdown(data.readInt());
1674 reply.writeNoException();
1675 reply.writeInt(res ? 1 : 0);
1676 return true;
1677 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001678
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001679 case STOP_APP_SWITCHES_TRANSACTION: {
1680 data.enforceInterface(IActivityManager.descriptor);
1681 stopAppSwitches();
1682 reply.writeNoException();
1683 return true;
1684 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001685
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001686 case RESUME_APP_SWITCHES_TRANSACTION: {
1687 data.enforceInterface(IActivityManager.descriptor);
1688 resumeAppSwitches();
1689 reply.writeNoException();
1690 return true;
1691 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001692
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001693 case PEEK_SERVICE_TRANSACTION: {
1694 data.enforceInterface(IActivityManager.descriptor);
1695 Intent service = Intent.CREATOR.createFromParcel(data);
1696 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001697 String callingPackage = data.readString();
1698 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001699 reply.writeNoException();
1700 reply.writeStrongBinder(binder);
1701 return true;
1702 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001703
Christopher Tate181fafa2009-05-14 11:12:14 -07001704 case START_BACKUP_AGENT_TRANSACTION: {
1705 data.enforceInterface(IActivityManager.descriptor);
1706 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1707 int backupRestoreMode = data.readInt();
1708 boolean success = bindBackupAgent(info, backupRestoreMode);
1709 reply.writeNoException();
1710 reply.writeInt(success ? 1 : 0);
1711 return true;
1712 }
1713
1714 case BACKUP_AGENT_CREATED_TRANSACTION: {
1715 data.enforceInterface(IActivityManager.descriptor);
1716 String packageName = data.readString();
1717 IBinder agent = data.readStrongBinder();
1718 backupAgentCreated(packageName, agent);
1719 reply.writeNoException();
1720 return true;
1721 }
1722
1723 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1724 data.enforceInterface(IActivityManager.descriptor);
1725 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1726 unbindBackupAgent(info);
1727 reply.writeNoException();
1728 return true;
1729 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001730
1731 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1732 data.enforceInterface(IActivityManager.descriptor);
1733 String packageName = data.readString();
1734 addPackageDependency(packageName);
1735 reply.writeNoException();
1736 return true;
1737 }
1738
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001739 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001740 data.enforceInterface(IActivityManager.descriptor);
1741 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001742 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001743 String reason = data.readString();
1744 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001745 reply.writeNoException();
1746 return true;
1747 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001748
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001749 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1750 data.enforceInterface(IActivityManager.descriptor);
1751 String reason = data.readString();
1752 closeSystemDialogs(reason);
1753 reply.writeNoException();
1754 return true;
1755 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001756
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001757 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1758 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001759 int[] pids = data.createIntArray();
1760 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001761 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001762 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001763 return true;
1764 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001765
1766 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1767 data.enforceInterface(IActivityManager.descriptor);
1768 String processName = data.readString();
1769 int uid = data.readInt();
1770 killApplicationProcess(processName, uid);
1771 reply.writeNoException();
1772 return true;
1773 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001774
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001775 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1776 data.enforceInterface(IActivityManager.descriptor);
1777 IBinder token = data.readStrongBinder();
1778 String packageName = data.readString();
1779 int enterAnim = data.readInt();
1780 int exitAnim = data.readInt();
1781 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001782 reply.writeNoException();
1783 return true;
1784 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001785
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001786 case IS_USER_A_MONKEY_TRANSACTION: {
1787 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001788 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001789 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001790 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001791 return true;
1792 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001793
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001794 case SET_USER_IS_MONKEY_TRANSACTION: {
1795 data.enforceInterface(IActivityManager.descriptor);
1796 final boolean monkey = (data.readInt() == 1);
1797 setUserIsMonkey(monkey);
1798 reply.writeNoException();
1799 return true;
1800 }
1801
Dianne Hackborn860755f2010-06-03 18:47:52 -07001802 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1803 data.enforceInterface(IActivityManager.descriptor);
1804 finishHeavyWeightApp();
1805 reply.writeNoException();
1806 return true;
1807 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001808
1809 case IS_IMMERSIVE_TRANSACTION: {
1810 data.enforceInterface(IActivityManager.descriptor);
1811 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001812 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001813 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001814 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001815 return true;
1816 }
1817
Craig Mautnerd61dc202014-07-07 11:09:11 -07001818 case IS_TOP_OF_TASK_TRANSACTION: {
1819 data.enforceInterface(IActivityManager.descriptor);
1820 IBinder token = data.readStrongBinder();
1821 final boolean isTopOfTask = isTopOfTask(token);
1822 reply.writeNoException();
1823 reply.writeInt(isTopOfTask ? 1 : 0);
1824 return true;
1825 }
1826
Craig Mautner5eda9b32013-07-02 11:58:16 -07001827 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001828 data.enforceInterface(IActivityManager.descriptor);
1829 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001830 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001831 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001832 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001833 return true;
1834 }
1835
1836 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1837 data.enforceInterface(IActivityManager.descriptor);
1838 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001839 final Bundle bundle;
1840 if (data.readInt() == 0) {
1841 bundle = null;
1842 } else {
1843 bundle = data.readBundle();
1844 }
Chong Zhang280d3322015-11-03 17:27:26 -08001845 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Craig Mautner233ceee2014-05-09 17:05:11 -07001846 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001847 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001848 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001849 return true;
1850 }
1851
Craig Mautner233ceee2014-05-09 17:05:11 -07001852 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1853 data.enforceInterface(IActivityManager.descriptor);
1854 IBinder token = data.readStrongBinder();
1855 final ActivityOptions options = getActivityOptions(token);
1856 reply.writeNoException();
1857 reply.writeBundle(options == null ? null : options.toBundle());
1858 return true;
1859 }
1860
Daniel Sandler69a48172010-06-23 16:29:36 -04001861 case SET_IMMERSIVE_TRANSACTION: {
1862 data.enforceInterface(IActivityManager.descriptor);
1863 IBinder token = data.readStrongBinder();
1864 boolean imm = data.readInt() == 1;
1865 setImmersive(token, imm);
1866 reply.writeNoException();
1867 return true;
1868 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001869
Daniel Sandler69a48172010-06-23 16:29:36 -04001870 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1871 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001872 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001873 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001874 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001875 return true;
1876 }
1877
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001878 case CRASH_APPLICATION_TRANSACTION: {
1879 data.enforceInterface(IActivityManager.descriptor);
1880 int uid = data.readInt();
1881 int initialPid = data.readInt();
1882 String packageName = data.readString();
1883 String message = data.readString();
1884 crashApplication(uid, initialPid, packageName, message);
1885 reply.writeNoException();
1886 return true;
1887 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001888
1889 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1890 data.enforceInterface(IActivityManager.descriptor);
1891 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001892 int userId = data.readInt();
1893 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001894 reply.writeNoException();
1895 reply.writeString(type);
1896 return true;
1897 }
1898
Dianne Hackborn7e269642010-08-25 19:50:20 -07001899 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1900 data.enforceInterface(IActivityManager.descriptor);
1901 String name = data.readString();
1902 IBinder perm = newUriPermissionOwner(name);
1903 reply.writeNoException();
1904 reply.writeStrongBinder(perm);
1905 return true;
1906 }
1907
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08001908 case GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION: {
1909 data.enforceInterface(IActivityManager.descriptor);
1910 IBinder activityToken = data.readStrongBinder();
1911 IBinder perm = getUriPermissionOwnerForActivity(activityToken);
1912 reply.writeNoException();
1913 reply.writeStrongBinder(perm);
1914 return true;
1915 }
1916
Dianne Hackborn7e269642010-08-25 19:50:20 -07001917 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1918 data.enforceInterface(IActivityManager.descriptor);
1919 IBinder owner = data.readStrongBinder();
1920 int fromUid = data.readInt();
1921 String targetPkg = data.readString();
1922 Uri uri = Uri.CREATOR.createFromParcel(data);
1923 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001924 int sourceUserId = data.readInt();
1925 int targetUserId = data.readInt();
1926 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1927 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001928 reply.writeNoException();
1929 return true;
1930 }
1931
1932 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1933 data.enforceInterface(IActivityManager.descriptor);
1934 IBinder owner = data.readStrongBinder();
1935 Uri uri = null;
1936 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001937 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001938 }
1939 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001940 int userId = data.readInt();
1941 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001942 reply.writeNoException();
1943 return true;
1944 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001945
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001946 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1947 data.enforceInterface(IActivityManager.descriptor);
1948 int callingUid = data.readInt();
1949 String targetPkg = data.readString();
1950 Uri uri = Uri.CREATOR.createFromParcel(data);
1951 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001952 int userId = data.readInt();
1953 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001954 reply.writeNoException();
1955 reply.writeInt(res);
1956 return true;
1957 }
1958
Andy McFadden824c5102010-07-09 16:26:57 -07001959 case DUMP_HEAP_TRANSACTION: {
1960 data.enforceInterface(IActivityManager.descriptor);
1961 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001962 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001963 boolean managed = data.readInt() != 0;
1964 String path = data.readString();
1965 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001966 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001967 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001968 reply.writeNoException();
1969 reply.writeInt(res ? 1 : 0);
1970 return true;
1971 }
1972
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001973 case START_ACTIVITIES_TRANSACTION:
1974 {
1975 data.enforceInterface(IActivityManager.descriptor);
1976 IBinder b = data.readStrongBinder();
1977 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001978 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001979 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1980 String[] resolvedTypes = data.createStringArray();
1981 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001982 Bundle options = data.readInt() != 0
1983 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001984 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001985 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001986 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001987 reply.writeNoException();
1988 reply.writeInt(result);
1989 return true;
1990 }
1991
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001992 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1993 {
1994 data.enforceInterface(IActivityManager.descriptor);
1995 int mode = getFrontActivityScreenCompatMode();
1996 reply.writeNoException();
1997 reply.writeInt(mode);
1998 return true;
1999 }
2000
2001 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
2002 {
2003 data.enforceInterface(IActivityManager.descriptor);
2004 int mode = data.readInt();
2005 setFrontActivityScreenCompatMode(mode);
2006 reply.writeNoException();
2007 reply.writeInt(mode);
2008 return true;
2009 }
2010
2011 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
2012 {
2013 data.enforceInterface(IActivityManager.descriptor);
2014 String pkg = data.readString();
2015 int mode = getPackageScreenCompatMode(pkg);
2016 reply.writeNoException();
2017 reply.writeInt(mode);
2018 return true;
2019 }
2020
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002021 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
2022 {
2023 data.enforceInterface(IActivityManager.descriptor);
2024 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07002025 int mode = data.readInt();
2026 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002027 reply.writeNoException();
2028 return true;
2029 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002030
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002031 case SWITCH_USER_TRANSACTION: {
2032 data.enforceInterface(IActivityManager.descriptor);
2033 int userid = data.readInt();
2034 boolean result = switchUser(userid);
2035 reply.writeNoException();
2036 reply.writeInt(result ? 1 : 0);
2037 return true;
2038 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07002039
Kenny Guy08488bf2014-02-21 17:40:37 +00002040 case START_USER_IN_BACKGROUND_TRANSACTION: {
2041 data.enforceInterface(IActivityManager.descriptor);
2042 int userid = data.readInt();
2043 boolean result = startUserInBackground(userid);
2044 reply.writeNoException();
2045 reply.writeInt(result ? 1 : 0);
2046 return true;
2047 }
2048
Jeff Sharkeyba512352015-11-12 20:17:45 -08002049 case UNLOCK_USER_TRANSACTION: {
2050 data.enforceInterface(IActivityManager.descriptor);
2051 int userId = data.readInt();
2052 byte[] token = data.createByteArray();
2053 boolean result = unlockUser(userId, token);
2054 reply.writeNoException();
2055 reply.writeInt(result ? 1 : 0);
2056 return true;
2057 }
2058
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002059 case STOP_USER_TRANSACTION: {
2060 data.enforceInterface(IActivityManager.descriptor);
2061 int userid = data.readInt();
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002062 boolean force = data.readInt() != 0;
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002063 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
2064 data.readStrongBinder());
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002065 int result = stopUser(userid, force, callback);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002066 reply.writeNoException();
2067 reply.writeInt(result);
2068 return true;
2069 }
2070
Amith Yamasani52f1d752012-03-28 18:19:29 -07002071 case GET_CURRENT_USER_TRANSACTION: {
2072 data.enforceInterface(IActivityManager.descriptor);
2073 UserInfo userInfo = getCurrentUser();
2074 reply.writeNoException();
2075 userInfo.writeToParcel(reply, 0);
2076 return true;
2077 }
2078
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002079 case IS_USER_RUNNING_TRANSACTION: {
2080 data.enforceInterface(IActivityManager.descriptor);
2081 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08002082 int _flags = data.readInt();
2083 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002084 reply.writeNoException();
2085 reply.writeInt(result ? 1 : 0);
2086 return true;
2087 }
2088
Dianne Hackbornc72fc672012-09-20 13:12:03 -07002089 case GET_RUNNING_USER_IDS_TRANSACTION: {
2090 data.enforceInterface(IActivityManager.descriptor);
2091 int[] result = getRunningUserIds();
2092 reply.writeNoException();
2093 reply.writeIntArray(result);
2094 return true;
2095 }
2096
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002097 case REMOVE_TASK_TRANSACTION:
2098 {
2099 data.enforceInterface(IActivityManager.descriptor);
2100 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002101 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002102 reply.writeNoException();
2103 reply.writeInt(result ? 1 : 0);
2104 return true;
2105 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002106
Jeff Sharkeya4620792011-05-20 15:29:23 -07002107 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2108 data.enforceInterface(IActivityManager.descriptor);
2109 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2110 data.readStrongBinder());
2111 registerProcessObserver(observer);
2112 return true;
2113 }
2114
2115 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2116 data.enforceInterface(IActivityManager.descriptor);
2117 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2118 data.readStrongBinder());
2119 unregisterProcessObserver(observer);
2120 return true;
2121 }
2122
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002123 case REGISTER_UID_OBSERVER_TRANSACTION: {
2124 data.enforceInterface(IActivityManager.descriptor);
2125 IUidObserver observer = IUidObserver.Stub.asInterface(
2126 data.readStrongBinder());
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002127 int which = data.readInt();
2128 registerUidObserver(observer, which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002129 return true;
2130 }
2131
2132 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2133 data.enforceInterface(IActivityManager.descriptor);
2134 IUidObserver observer = IUidObserver.Stub.asInterface(
2135 data.readStrongBinder());
2136 unregisterUidObserver(observer);
2137 return true;
2138 }
2139
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002140 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2141 {
2142 data.enforceInterface(IActivityManager.descriptor);
2143 String pkg = data.readString();
2144 boolean ask = getPackageAskScreenCompat(pkg);
2145 reply.writeNoException();
2146 reply.writeInt(ask ? 1 : 0);
2147 return true;
2148 }
2149
2150 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2151 {
2152 data.enforceInterface(IActivityManager.descriptor);
2153 String pkg = data.readString();
2154 boolean ask = data.readInt() != 0;
2155 setPackageAskScreenCompat(pkg, ask);
2156 reply.writeNoException();
2157 return true;
2158 }
2159
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002160 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2161 data.enforceInterface(IActivityManager.descriptor);
2162 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002163 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002164 boolean res = isIntentSenderTargetedToPackage(r);
2165 reply.writeNoException();
2166 reply.writeInt(res ? 1 : 0);
2167 return true;
2168 }
2169
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002170 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2171 data.enforceInterface(IActivityManager.descriptor);
2172 IIntentSender r = IIntentSender.Stub.asInterface(
2173 data.readStrongBinder());
2174 boolean res = isIntentSenderAnActivity(r);
2175 reply.writeNoException();
2176 reply.writeInt(res ? 1 : 0);
2177 return true;
2178 }
2179
Dianne Hackborn81038902012-11-26 17:04:09 -08002180 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2181 data.enforceInterface(IActivityManager.descriptor);
2182 IIntentSender r = IIntentSender.Stub.asInterface(
2183 data.readStrongBinder());
2184 Intent intent = getIntentForIntentSender(r);
2185 reply.writeNoException();
2186 if (intent != null) {
2187 reply.writeInt(1);
2188 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2189 } else {
2190 reply.writeInt(0);
2191 }
2192 return true;
2193 }
2194
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002195 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2196 data.enforceInterface(IActivityManager.descriptor);
2197 IIntentSender r = IIntentSender.Stub.asInterface(
2198 data.readStrongBinder());
2199 String prefix = data.readString();
2200 String tag = getTagForIntentSender(r, prefix);
2201 reply.writeNoException();
2202 reply.writeString(tag);
2203 return true;
2204 }
2205
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002206 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2207 data.enforceInterface(IActivityManager.descriptor);
2208 Configuration config = Configuration.CREATOR.createFromParcel(data);
2209 updatePersistentConfiguration(config);
2210 reply.writeNoException();
2211 return true;
2212 }
2213
Dianne Hackbornb437e092011-08-05 17:50:29 -07002214 case GET_PROCESS_PSS_TRANSACTION: {
2215 data.enforceInterface(IActivityManager.descriptor);
2216 int[] pids = data.createIntArray();
2217 long[] pss = getProcessPss(pids);
2218 reply.writeNoException();
2219 reply.writeLongArray(pss);
2220 return true;
2221 }
2222
Dianne Hackborn661cd522011-08-22 00:26:20 -07002223 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2224 data.enforceInterface(IActivityManager.descriptor);
2225 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2226 boolean always = data.readInt() != 0;
2227 showBootMessage(msg, always);
2228 reply.writeNoException();
2229 return true;
2230 }
2231
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002232 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002233 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002234 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002235 reply.writeNoException();
2236 return true;
2237 }
2238
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002239 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2240 data.enforceInterface(IActivityManager.descriptor);
2241 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2242 reply.writeNoException();
2243 return true;
2244 }
2245
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002246 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002247 data.enforceInterface(IActivityManager.descriptor);
2248 IBinder token = data.readStrongBinder();
2249 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002250 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002251 reply.writeNoException();
2252 reply.writeInt(res ? 1 : 0);
2253 return true;
2254 }
2255
2256 case NAVIGATE_UP_TO_TRANSACTION: {
2257 data.enforceInterface(IActivityManager.descriptor);
2258 IBinder token = data.readStrongBinder();
2259 Intent target = Intent.CREATOR.createFromParcel(data);
2260 int resultCode = data.readInt();
2261 Intent resultData = null;
2262 if (data.readInt() != 0) {
2263 resultData = Intent.CREATOR.createFromParcel(data);
2264 }
2265 boolean res = navigateUpTo(token, target, resultCode, resultData);
2266 reply.writeNoException();
2267 reply.writeInt(res ? 1 : 0);
2268 return true;
2269 }
2270
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002271 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2272 data.enforceInterface(IActivityManager.descriptor);
2273 IBinder token = data.readStrongBinder();
2274 int res = getLaunchedFromUid(token);
2275 reply.writeNoException();
2276 reply.writeInt(res);
2277 return true;
2278 }
2279
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002280 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2281 data.enforceInterface(IActivityManager.descriptor);
2282 IBinder token = data.readStrongBinder();
2283 String res = getLaunchedFromPackage(token);
2284 reply.writeNoException();
2285 reply.writeString(res);
2286 return true;
2287 }
2288
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002289 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2290 data.enforceInterface(IActivityManager.descriptor);
2291 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2292 data.readStrongBinder());
2293 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002294 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002295 return true;
2296 }
2297
2298 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2299 data.enforceInterface(IActivityManager.descriptor);
2300 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2301 data.readStrongBinder());
2302 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002303 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002304 return true;
2305 }
2306
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002307 case REQUEST_BUG_REPORT_TRANSACTION: {
2308 data.enforceInterface(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00002309 int bugreportType = data.readInt();
2310 requestBugReport(bugreportType);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002311 reply.writeNoException();
2312 return true;
2313 }
2314
2315 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2316 data.enforceInterface(IActivityManager.descriptor);
2317 int pid = data.readInt();
2318 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002319 String reason = data.readString();
2320 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002321 reply.writeNoException();
2322 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002323 return true;
2324 }
2325
Adam Skorydfc7fd72013-08-05 19:23:41 -07002326 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002327 data.enforceInterface(IActivityManager.descriptor);
2328 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002329 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002330 reply.writeNoException();
2331 reply.writeBundle(res);
2332 return true;
2333 }
2334
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002335 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2336 data.enforceInterface(IActivityManager.descriptor);
2337 int requestType = data.readInt();
2338 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002339 IBinder activityToken = data.readStrongBinder();
2340 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002341 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002342 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002343 return true;
2344 }
2345
Adam Skorydfc7fd72013-08-05 19:23:41 -07002346 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002347 data.enforceInterface(IActivityManager.descriptor);
2348 IBinder token = data.readStrongBinder();
2349 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002350 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2351 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002352 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2353 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002354 reply.writeNoException();
2355 return true;
2356 }
2357
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002358 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2359 data.enforceInterface(IActivityManager.descriptor);
2360 Intent intent = Intent.CREATOR.createFromParcel(data);
2361 int requestType = data.readInt();
2362 String hint = data.readString();
2363 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002364 Bundle args = data.readBundle();
2365 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002366 reply.writeNoException();
2367 reply.writeInt(res ? 1 : 0);
2368 return true;
2369 }
2370
Benjamin Franzc200f442015-06-25 18:20:04 +01002371 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2372 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002373 boolean res = isAssistDataAllowedOnCurrentActivity();
2374 reply.writeNoException();
2375 reply.writeInt(res ? 1 : 0);
2376 return true;
2377 }
2378
2379 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2380 data.enforceInterface(IActivityManager.descriptor);
2381 IBinder token = data.readStrongBinder();
2382 Bundle args = data.readBundle();
2383 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002384 reply.writeNoException();
2385 reply.writeInt(res ? 1 : 0);
2386 return true;
2387 }
2388
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002389 case KILL_UID_TRANSACTION: {
2390 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002391 int appId = data.readInt();
2392 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002393 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002394 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002395 reply.writeNoException();
2396 return true;
2397 }
2398
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002399 case HANG_TRANSACTION: {
2400 data.enforceInterface(IActivityManager.descriptor);
2401 IBinder who = data.readStrongBinder();
2402 boolean allowRestart = data.readInt() != 0;
2403 hang(who, allowRestart);
2404 reply.writeNoException();
2405 return true;
2406 }
2407
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002408 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2409 data.enforceInterface(IActivityManager.descriptor);
2410 IBinder token = data.readStrongBinder();
2411 reportActivityFullyDrawn(token);
2412 reply.writeNoException();
2413 return true;
2414 }
2415
Craig Mautner5eda9b32013-07-02 11:58:16 -07002416 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2417 data.enforceInterface(IActivityManager.descriptor);
2418 IBinder token = data.readStrongBinder();
2419 notifyActivityDrawn(token);
2420 reply.writeNoException();
2421 return true;
2422 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002423
2424 case RESTART_TRANSACTION: {
2425 data.enforceInterface(IActivityManager.descriptor);
2426 restart();
2427 reply.writeNoException();
2428 return true;
2429 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002430
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002431 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2432 data.enforceInterface(IActivityManager.descriptor);
2433 performIdleMaintenance();
2434 reply.writeNoException();
2435 return true;
2436 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002437
Todd Kennedyca4d8422015-01-15 15:19:22 -08002438 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002439 data.enforceInterface(IActivityManager.descriptor);
2440 IBinder parentActivityToken = data.readStrongBinder();
2441 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002442 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002443 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002444 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002445 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002446 if (activityContainer != null) {
2447 reply.writeInt(1);
2448 reply.writeStrongBinder(activityContainer.asBinder());
2449 } else {
2450 reply.writeInt(0);
2451 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002452 return true;
2453 }
2454
Craig Mautner95da1082014-02-24 17:54:35 -08002455 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2456 data.enforceInterface(IActivityManager.descriptor);
2457 IActivityContainer activityContainer =
2458 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2459 deleteActivityContainer(activityContainer);
2460 reply.writeNoException();
2461 return true;
2462 }
2463
Todd Kennedy4900bf92015-01-16 16:05:14 -08002464 case CREATE_STACK_ON_DISPLAY: {
2465 data.enforceInterface(IActivityManager.descriptor);
2466 int displayId = data.readInt();
2467 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2468 reply.writeNoException();
2469 if (activityContainer != null) {
2470 reply.writeInt(1);
2471 reply.writeStrongBinder(activityContainer.asBinder());
2472 } else {
2473 reply.writeInt(0);
2474 }
2475 return true;
2476 }
2477
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002478 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002479 data.enforceInterface(IActivityManager.descriptor);
2480 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002481 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002482 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002483 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002484 return true;
2485 }
2486
Craig Mautneraea74a52014-03-08 14:23:10 -08002487 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2488 data.enforceInterface(IActivityManager.descriptor);
2489 final int taskId = data.readInt();
2490 startLockTaskMode(taskId);
2491 reply.writeNoException();
2492 return true;
2493 }
2494
2495 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2496 data.enforceInterface(IActivityManager.descriptor);
2497 IBinder token = data.readStrongBinder();
2498 startLockTaskMode(token);
2499 reply.writeNoException();
2500 return true;
2501 }
2502
Craig Mautnerd61dc202014-07-07 11:09:11 -07002503 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002504 data.enforceInterface(IActivityManager.descriptor);
2505 startLockTaskModeOnCurrent();
2506 reply.writeNoException();
2507 return true;
2508 }
2509
Craig Mautneraea74a52014-03-08 14:23:10 -08002510 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2511 data.enforceInterface(IActivityManager.descriptor);
2512 stopLockTaskMode();
2513 reply.writeNoException();
2514 return true;
2515 }
2516
Craig Mautnerd61dc202014-07-07 11:09:11 -07002517 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002518 data.enforceInterface(IActivityManager.descriptor);
2519 stopLockTaskModeOnCurrent();
2520 reply.writeNoException();
2521 return true;
2522 }
2523
Craig Mautneraea74a52014-03-08 14:23:10 -08002524 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2525 data.enforceInterface(IActivityManager.descriptor);
2526 final boolean isInLockTaskMode = isInLockTaskMode();
2527 reply.writeNoException();
2528 reply.writeInt(isInLockTaskMode ? 1 : 0);
2529 return true;
2530 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002531
Benjamin Franz43261142015-02-11 15:59:44 +00002532 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2533 data.enforceInterface(IActivityManager.descriptor);
2534 final int lockTaskModeState = getLockTaskModeState();
2535 reply.writeNoException();
2536 reply.writeInt(lockTaskModeState);
2537 return true;
2538 }
2539
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002540 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2541 data.enforceInterface(IActivityManager.descriptor);
2542 final IBinder token = data.readStrongBinder();
2543 showLockTaskEscapeMessage(token);
2544 reply.writeNoException();
2545 return true;
2546 }
2547
Winson Chunga449dc02014-05-16 11:15:04 -07002548 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002549 data.enforceInterface(IActivityManager.descriptor);
2550 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002551 ActivityManager.TaskDescription values =
2552 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2553 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002554 reply.writeNoException();
2555 return true;
2556 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002557
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002558 case SET_TASK_RESIZEABLE_TRANSACTION: {
2559 data.enforceInterface(IActivityManager.descriptor);
2560 int taskId = data.readInt();
2561 boolean resizeable = (data.readInt() == 1) ? true : false;
2562 setTaskResizeable(taskId, resizeable);
2563 reply.writeNoException();
2564 return true;
2565 }
2566
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002567 case RESIZE_TASK_TRANSACTION: {
2568 data.enforceInterface(IActivityManager.descriptor);
2569 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002570 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002571 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002572 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002573 reply.writeNoException();
2574 return true;
2575 }
2576
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002577 case GET_TASK_BOUNDS_TRANSACTION: {
2578 data.enforceInterface(IActivityManager.descriptor);
2579 int taskId = data.readInt();
2580 Rect r = getTaskBounds(taskId);
2581 reply.writeNoException();
2582 r.writeToParcel(reply, 0);
2583 return true;
2584 }
2585
Craig Mautner648f69b2014-09-18 14:16:26 -07002586 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2587 data.enforceInterface(IActivityManager.descriptor);
2588 String filename = data.readString();
Suprabh Shukla23593142015-11-03 17:31:15 -08002589 int userId = data.readInt();
2590 Bitmap icon = getTaskDescriptionIcon(filename, userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07002591 reply.writeNoException();
2592 if (icon == null) {
2593 reply.writeInt(0);
2594 } else {
2595 reply.writeInt(1);
2596 icon.writeToParcel(reply, 0);
2597 }
2598 return true;
2599 }
2600
Winson Chung044d5292014-11-06 11:05:19 -08002601 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2602 data.enforceInterface(IActivityManager.descriptor);
2603 final Bundle bundle;
2604 if (data.readInt() == 0) {
2605 bundle = null;
2606 } else {
2607 bundle = data.readBundle();
2608 }
Chong Zhang280d3322015-11-03 17:27:26 -08002609 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002610 startInPlaceAnimationOnFrontMostApplication(options);
2611 reply.writeNoException();
2612 return true;
2613 }
2614
Jose Lima4b6c6692014-08-12 17:41:12 -07002615 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002616 data.enforceInterface(IActivityManager.descriptor);
2617 IBinder token = data.readStrongBinder();
2618 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002619 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002620 reply.writeNoException();
2621 reply.writeInt(success ? 1 : 0);
2622 return true;
2623 }
2624
Jose Lima4b6c6692014-08-12 17:41:12 -07002625 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002626 data.enforceInterface(IActivityManager.descriptor);
2627 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002628 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002629 reply.writeNoException();
2630 reply.writeInt(enabled ? 1 : 0);
2631 return true;
2632 }
2633
Jose Lima4b6c6692014-08-12 17:41:12 -07002634 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002635 data.enforceInterface(IActivityManager.descriptor);
2636 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002637 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002638 reply.writeNoException();
2639 return true;
2640 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002641
2642 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2643 data.enforceInterface(IActivityManager.descriptor);
2644 IBinder token = data.readStrongBinder();
2645 notifyLaunchTaskBehindComplete(token);
2646 reply.writeNoException();
2647 return true;
2648 }
Craig Mautner8746a472014-07-24 15:12:54 -07002649
2650 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2651 data.enforceInterface(IActivityManager.descriptor);
2652 IBinder token = data.readStrongBinder();
2653 notifyEnterAnimationComplete(token);
2654 reply.writeNoException();
2655 return true;
2656 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002657
2658 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2659 data.enforceInterface(IActivityManager.descriptor);
2660 bootAnimationComplete();
2661 reply.writeNoException();
2662 return true;
2663 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002664
Jeff Sharkey605eb792014-11-04 13:34:06 -08002665 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2666 data.enforceInterface(IActivityManager.descriptor);
2667 final int uid = data.readInt();
2668 final byte[] firstPacket = data.createByteArray();
2669 notifyCleartextNetwork(uid, firstPacket);
2670 reply.writeNoException();
2671 return true;
2672 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002673
2674 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2675 data.enforceInterface(IActivityManager.descriptor);
2676 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002677 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002678 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002679 String reportPackage = data.readString();
2680 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002681 reply.writeNoException();
2682 return true;
2683 }
2684
2685 case DUMP_HEAP_FINISHED_TRANSACTION: {
2686 data.enforceInterface(IActivityManager.descriptor);
2687 String path = data.readString();
2688 dumpHeapFinished(path);
2689 reply.writeNoException();
2690 return true;
2691 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002692
2693 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2694 data.enforceInterface(IActivityManager.descriptor);
2695 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2696 data.readStrongBinder());
2697 boolean keepAwake = data.readInt() != 0;
2698 setVoiceKeepAwake(session, keepAwake);
2699 reply.writeNoException();
2700 return true;
2701 }
Craig Mautnere5600772015-04-03 21:36:37 -07002702
2703 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2704 data.enforceInterface(IActivityManager.descriptor);
2705 int userId = data.readInt();
2706 String[] packages = data.readStringArray();
2707 updateLockTaskPackages(userId, packages);
2708 reply.writeNoException();
2709 return true;
2710 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002711
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002712 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2713 data.enforceInterface(IActivityManager.descriptor);
2714 String packageName = data.readString();
2715 updateDeviceOwner(packageName);
2716 reply.writeNoException();
2717 return true;
2718 }
2719
Dianne Hackborn1e383822015-04-10 14:02:33 -07002720 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2721 data.enforceInterface(IActivityManager.descriptor);
2722 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002723 String callingPackage = data.readString();
2724 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002725 reply.writeNoException();
2726 reply.writeInt(res);
2727 return true;
2728 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002729
2730 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2731 data.enforceInterface(IActivityManager.descriptor);
2732 String process = data.readString();
2733 int userId = data.readInt();
2734 int level = data.readInt();
2735 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2736 reply.writeNoException();
2737 reply.writeInt(res ? 1 : 0);
2738 return true;
2739 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002740
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002741 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2742 data.enforceInterface(IActivityManager.descriptor);
2743 IBinder token = data.readStrongBinder();
2744 boolean res = isRootVoiceInteraction(token);
2745 reply.writeNoException();
2746 reply.writeInt(res ? 1 : 0);
2747 return true;
2748 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002749
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002750 case START_BINDER_TRACKING_TRANSACTION: {
2751 data.enforceInterface(IActivityManager.descriptor);
2752 boolean res = startBinderTracking();
2753 reply.writeNoException();
2754 reply.writeInt(res ? 1 : 0);
2755 return true;
2756 }
2757
2758 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2759 data.enforceInterface(IActivityManager.descriptor);
2760 ParcelFileDescriptor fd = data.readInt() != 0
2761 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2762 boolean res = stopBinderTrackingAndDump(fd);
2763 reply.writeNoException();
2764 reply.writeInt(res ? 1 : 0);
2765 return true;
2766 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002767 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2768 data.enforceInterface(IActivityManager.descriptor);
2769 IBinder token = data.readStrongBinder();
2770 int stackId = getActivityStackId(token);
2771 reply.writeNoException();
2772 reply.writeInt(stackId);
2773 return true;
2774 }
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002775 case EXIT_FREEFORM_MODE_TRANSACTION: {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002776 data.enforceInterface(IActivityManager.descriptor);
2777 IBinder token = data.readStrongBinder();
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002778 exitFreeformMode(token);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002779 reply.writeNoException();
2780 return true;
2781 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002782 case REPORT_SIZE_CONFIGURATIONS: {
2783 data.enforceInterface(IActivityManager.descriptor);
2784 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002785 int[] horizontal = readIntArray(data);
2786 int[] vertical = readIntArray(data);
2787 int[] smallest = readIntArray(data);
2788 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002789 return true;
2790 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002791 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2792 data.enforceInterface(IActivityManager.descriptor);
2793 final boolean suppress = data.readInt() == 1;
2794 suppressResizeConfigChanges(suppress);
2795 reply.writeNoException();
2796 return true;
2797 }
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08002798 case MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002799 data.enforceInterface(IActivityManager.descriptor);
2800 final int stackId = data.readInt();
Wale Ogunwale9101d262016-01-15 08:56:11 -08002801 final boolean onTop = data.readInt() == 1;
2802 moveTasksToFullscreenStack(stackId, onTop);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002803 reply.writeNoException();
2804 return true;
2805 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002806 case GET_APP_START_MODE_TRANSACTION: {
2807 data.enforceInterface(IActivityManager.descriptor);
2808 final int uid = data.readInt();
2809 final String pkg = data.readString();
2810 int res = getAppStartMode(uid, pkg);
2811 reply.writeNoException();
2812 reply.writeInt(res);
2813 return true;
2814 }
Wale Ogunwale5f986092015-12-04 15:35:38 -08002815 case IN_MULTI_WINDOW_MODE_TRANSACTION: {
2816 data.enforceInterface(IActivityManager.descriptor);
2817 final IBinder token = data.readStrongBinder();
2818 final boolean multiWindowMode = inMultiWindowMode(token);
2819 reply.writeNoException();
2820 reply.writeInt(multiWindowMode ? 1 : 0);
2821 return true;
2822 }
2823 case IN_PICTURE_IN_PICTURE_MODE_TRANSACTION: {
2824 data.enforceInterface(IActivityManager.descriptor);
2825 final IBinder token = data.readStrongBinder();
2826 final boolean pipMode = inPictureInPictureMode(token);
2827 reply.writeNoException();
2828 reply.writeInt(pipMode ? 1 : 0);
2829 return true;
2830 }
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002831 case ENTER_PICTURE_IN_PICTURE_MODE_TRANSACTION: {
2832 data.enforceInterface(IActivityManager.descriptor);
2833 final IBinder token = data.readStrongBinder();
2834 enterPictureInPictureMode(token);
2835 reply.writeNoException();
2836 return true;
2837 }
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002838 case SET_VR_MODE_TRANSACTION: {
2839 data.enforceInterface(IActivityManager.descriptor);
2840 final IBinder token = data.readStrongBinder();
2841 final boolean enable = data.readInt() == 1;
2842 setVrMode(token, enable);
2843 reply.writeNoException();
2844 return true;
2845 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002846 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002847
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002848 return super.onTransact(code, data, reply, flags);
2849 }
2850
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002851 private int[] readIntArray(Parcel data) {
2852 int[] smallest = null;
2853 int smallestSize = data.readInt();
2854 if (smallestSize > 0) {
2855 smallest = new int[smallestSize];
2856 data.readIntArray(smallest);
2857 }
2858 return smallest;
2859 }
2860
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002861 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002862 return this;
2863 }
2864
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002865 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2866 protected IActivityManager create() {
2867 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002868 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002869 Log.v("ActivityManager", "default service binder = " + b);
2870 }
2871 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002872 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002873 Log.v("ActivityManager", "default service = " + am);
2874 }
2875 return am;
2876 }
2877 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002878}
2879
2880class ActivityManagerProxy implements IActivityManager
2881{
2882 public ActivityManagerProxy(IBinder remote)
2883 {
2884 mRemote = remote;
2885 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002886
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002887 public IBinder asBinder()
2888 {
2889 return mRemote;
2890 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002891
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002892 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002893 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002894 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002895 Parcel data = Parcel.obtain();
2896 Parcel reply = Parcel.obtain();
2897 data.writeInterfaceToken(IActivityManager.descriptor);
2898 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002899 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002900 intent.writeToParcel(data, 0);
2901 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002902 data.writeStrongBinder(resultTo);
2903 data.writeString(resultWho);
2904 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002905 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002906 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002907 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002908 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002909 } else {
2910 data.writeInt(0);
2911 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002912 if (options != null) {
2913 data.writeInt(1);
2914 options.writeToParcel(data, 0);
2915 } else {
2916 data.writeInt(0);
2917 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002918 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2919 reply.readException();
2920 int result = reply.readInt();
2921 reply.recycle();
2922 data.recycle();
2923 return result;
2924 }
Amith Yamasani82644082012-08-03 13:09:11 -07002925
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002926 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002927 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002928 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2929 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002930 Parcel data = Parcel.obtain();
2931 Parcel reply = Parcel.obtain();
2932 data.writeInterfaceToken(IActivityManager.descriptor);
2933 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002934 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002935 intent.writeToParcel(data, 0);
2936 data.writeString(resolvedType);
2937 data.writeStrongBinder(resultTo);
2938 data.writeString(resultWho);
2939 data.writeInt(requestCode);
2940 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002941 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002942 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002943 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002944 } else {
2945 data.writeInt(0);
2946 }
2947 if (options != null) {
2948 data.writeInt(1);
2949 options.writeToParcel(data, 0);
2950 } else {
2951 data.writeInt(0);
2952 }
2953 data.writeInt(userId);
2954 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2955 reply.readException();
2956 int result = reply.readInt();
2957 reply.recycle();
2958 data.recycle();
2959 return result;
2960 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002961 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2962 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002963 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2964 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002965 Parcel data = Parcel.obtain();
2966 Parcel reply = Parcel.obtain();
2967 data.writeInterfaceToken(IActivityManager.descriptor);
2968 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2969 data.writeString(callingPackage);
2970 intent.writeToParcel(data, 0);
2971 data.writeString(resolvedType);
2972 data.writeStrongBinder(resultTo);
2973 data.writeString(resultWho);
2974 data.writeInt(requestCode);
2975 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002976 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002977 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002978 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002979 } else {
2980 data.writeInt(0);
2981 }
2982 if (options != null) {
2983 data.writeInt(1);
2984 options.writeToParcel(data, 0);
2985 } else {
2986 data.writeInt(0);
2987 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002988 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002989 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002990 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2991 reply.readException();
2992 int result = reply.readInt();
2993 reply.recycle();
2994 data.recycle();
2995 return result;
2996 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002997 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2998 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002999 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
3000 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003001 Parcel data = Parcel.obtain();
3002 Parcel reply = Parcel.obtain();
3003 data.writeInterfaceToken(IActivityManager.descriptor);
3004 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003005 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003006 intent.writeToParcel(data, 0);
3007 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003008 data.writeStrongBinder(resultTo);
3009 data.writeString(resultWho);
3010 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003011 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003012 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003013 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003014 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003015 } else {
3016 data.writeInt(0);
3017 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07003018 if (options != null) {
3019 data.writeInt(1);
3020 options.writeToParcel(data, 0);
3021 } else {
3022 data.writeInt(0);
3023 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003024 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003025 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
3026 reply.readException();
3027 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
3028 reply.recycle();
3029 data.recycle();
3030 return result;
3031 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003032 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
3033 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003034 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07003035 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003036 Parcel data = Parcel.obtain();
3037 Parcel reply = Parcel.obtain();
3038 data.writeInterfaceToken(IActivityManager.descriptor);
3039 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003040 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003041 intent.writeToParcel(data, 0);
3042 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003043 data.writeStrongBinder(resultTo);
3044 data.writeString(resultWho);
3045 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003046 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003047 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003048 if (options != null) {
3049 data.writeInt(1);
3050 options.writeToParcel(data, 0);
3051 } else {
3052 data.writeInt(0);
3053 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003054 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003055 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
3056 reply.readException();
3057 int result = reply.readInt();
3058 reply.recycle();
3059 data.recycle();
3060 return result;
3061 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003062 public int startActivityIntentSender(IApplicationThread caller,
3063 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003064 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003065 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003066 Parcel data = Parcel.obtain();
3067 Parcel reply = Parcel.obtain();
3068 data.writeInterfaceToken(IActivityManager.descriptor);
3069 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3070 intent.writeToParcel(data, 0);
3071 if (fillInIntent != null) {
3072 data.writeInt(1);
3073 fillInIntent.writeToParcel(data, 0);
3074 } else {
3075 data.writeInt(0);
3076 }
3077 data.writeString(resolvedType);
3078 data.writeStrongBinder(resultTo);
3079 data.writeString(resultWho);
3080 data.writeInt(requestCode);
3081 data.writeInt(flagsMask);
3082 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003083 if (options != null) {
3084 data.writeInt(1);
3085 options.writeToParcel(data, 0);
3086 } else {
3087 data.writeInt(0);
3088 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003089 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003090 reply.readException();
3091 int result = reply.readInt();
3092 reply.recycle();
3093 data.recycle();
3094 return result;
3095 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07003096 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
3097 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07003098 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
3099 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003100 Parcel data = Parcel.obtain();
3101 Parcel reply = Parcel.obtain();
3102 data.writeInterfaceToken(IActivityManager.descriptor);
3103 data.writeString(callingPackage);
3104 data.writeInt(callingPid);
3105 data.writeInt(callingUid);
3106 intent.writeToParcel(data, 0);
3107 data.writeString(resolvedType);
3108 data.writeStrongBinder(session.asBinder());
3109 data.writeStrongBinder(interactor.asBinder());
3110 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003111 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003112 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003113 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07003114 } else {
3115 data.writeInt(0);
3116 }
3117 if (options != null) {
3118 data.writeInt(1);
3119 options.writeToParcel(data, 0);
3120 } else {
3121 data.writeInt(0);
3122 }
3123 data.writeInt(userId);
3124 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3125 reply.readException();
3126 int result = reply.readInt();
3127 reply.recycle();
3128 data.recycle();
3129 return result;
3130 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003131 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003132 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003133 Parcel data = Parcel.obtain();
3134 Parcel reply = Parcel.obtain();
3135 data.writeInterfaceToken(IActivityManager.descriptor);
3136 data.writeStrongBinder(callingActivity);
3137 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003138 if (options != null) {
3139 data.writeInt(1);
3140 options.writeToParcel(data, 0);
3141 } else {
3142 data.writeInt(0);
3143 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003144 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3145 reply.readException();
3146 int result = reply.readInt();
3147 reply.recycle();
3148 data.recycle();
3149 return result != 0;
3150 }
Wale Ogunwale854809c2015-12-27 16:18:19 -08003151 public int startActivityFromRecents(int taskId, Bundle options)
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003152 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003153 Parcel data = Parcel.obtain();
3154 Parcel reply = Parcel.obtain();
3155 data.writeInterfaceToken(IActivityManager.descriptor);
3156 data.writeInt(taskId);
3157 if (options == null) {
3158 data.writeInt(0);
3159 } else {
3160 data.writeInt(1);
3161 options.writeToParcel(data, 0);
3162 }
3163 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3164 reply.readException();
3165 int result = reply.readInt();
3166 reply.recycle();
3167 data.recycle();
3168 return result;
3169 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003170 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003171 throws RemoteException {
3172 Parcel data = Parcel.obtain();
3173 Parcel reply = Parcel.obtain();
3174 data.writeInterfaceToken(IActivityManager.descriptor);
3175 data.writeStrongBinder(token);
3176 data.writeInt(resultCode);
3177 if (resultData != null) {
3178 data.writeInt(1);
3179 resultData.writeToParcel(data, 0);
3180 } else {
3181 data.writeInt(0);
3182 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003183 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003184 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3185 reply.readException();
3186 boolean res = reply.readInt() != 0;
3187 data.recycle();
3188 reply.recycle();
3189 return res;
3190 }
3191 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3192 {
3193 Parcel data = Parcel.obtain();
3194 Parcel reply = Parcel.obtain();
3195 data.writeInterfaceToken(IActivityManager.descriptor);
3196 data.writeStrongBinder(token);
3197 data.writeString(resultWho);
3198 data.writeInt(requestCode);
3199 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3200 reply.readException();
3201 data.recycle();
3202 reply.recycle();
3203 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003204 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3205 Parcel data = Parcel.obtain();
3206 Parcel reply = Parcel.obtain();
3207 data.writeInterfaceToken(IActivityManager.descriptor);
3208 data.writeStrongBinder(token);
3209 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3210 reply.readException();
3211 boolean res = reply.readInt() != 0;
3212 data.recycle();
3213 reply.recycle();
3214 return res;
3215 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003216 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3217 Parcel data = Parcel.obtain();
3218 Parcel reply = Parcel.obtain();
3219 data.writeInterfaceToken(IActivityManager.descriptor);
3220 data.writeStrongBinder(session.asBinder());
3221 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3222 reply.readException();
3223 data.recycle();
3224 reply.recycle();
3225 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003226 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3227 Parcel data = Parcel.obtain();
3228 Parcel reply = Parcel.obtain();
3229 data.writeInterfaceToken(IActivityManager.descriptor);
3230 data.writeStrongBinder(token);
3231 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3232 reply.readException();
3233 boolean res = reply.readInt() != 0;
3234 data.recycle();
3235 reply.recycle();
3236 return res;
3237 }
3238 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3239 Parcel data = Parcel.obtain();
3240 Parcel reply = Parcel.obtain();
3241 data.writeInterfaceToken(IActivityManager.descriptor);
3242 data.writeStrongBinder(app.asBinder());
3243 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3244 reply.readException();
3245 data.recycle();
3246 reply.recycle();
3247 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003248 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3249 Parcel data = Parcel.obtain();
3250 Parcel reply = Parcel.obtain();
3251 data.writeInterfaceToken(IActivityManager.descriptor);
3252 data.writeStrongBinder(token);
3253 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3254 reply.readException();
3255 boolean res = reply.readInt() != 0;
3256 data.recycle();
3257 reply.recycle();
3258 return res;
3259 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003260 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003261 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003262 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003263 {
3264 Parcel data = Parcel.obtain();
3265 Parcel reply = Parcel.obtain();
3266 data.writeInterfaceToken(IActivityManager.descriptor);
3267 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003268 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003269 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3270 filter.writeToParcel(data, 0);
3271 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003272 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003273 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3274 reply.readException();
3275 Intent intent = null;
3276 int haveIntent = reply.readInt();
3277 if (haveIntent != 0) {
3278 intent = Intent.CREATOR.createFromParcel(reply);
3279 }
3280 reply.recycle();
3281 data.recycle();
3282 return intent;
3283 }
3284 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3285 {
3286 Parcel data = Parcel.obtain();
3287 Parcel reply = Parcel.obtain();
3288 data.writeInterfaceToken(IActivityManager.descriptor);
3289 data.writeStrongBinder(receiver.asBinder());
3290 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3291 reply.readException();
3292 data.recycle();
3293 reply.recycle();
3294 }
3295 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003296 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003297 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003298 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003299 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003300 {
3301 Parcel data = Parcel.obtain();
3302 Parcel reply = Parcel.obtain();
3303 data.writeInterfaceToken(IActivityManager.descriptor);
3304 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3305 intent.writeToParcel(data, 0);
3306 data.writeString(resolvedType);
3307 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3308 data.writeInt(resultCode);
3309 data.writeString(resultData);
3310 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003311 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003312 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003313 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003314 data.writeInt(serialized ? 1 : 0);
3315 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003316 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003317 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3318 reply.readException();
3319 int res = reply.readInt();
3320 reply.recycle();
3321 data.recycle();
3322 return res;
3323 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003324 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3325 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003326 {
3327 Parcel data = Parcel.obtain();
3328 Parcel reply = Parcel.obtain();
3329 data.writeInterfaceToken(IActivityManager.descriptor);
3330 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3331 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003332 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003333 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3334 reply.readException();
3335 data.recycle();
3336 reply.recycle();
3337 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003338 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3339 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003340 {
3341 Parcel data = Parcel.obtain();
3342 Parcel reply = Parcel.obtain();
3343 data.writeInterfaceToken(IActivityManager.descriptor);
3344 data.writeStrongBinder(who);
3345 data.writeInt(resultCode);
3346 data.writeString(resultData);
3347 data.writeBundle(map);
3348 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003349 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003350 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3351 reply.readException();
3352 data.recycle();
3353 reply.recycle();
3354 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003355 public void attachApplication(IApplicationThread app) throws RemoteException
3356 {
3357 Parcel data = Parcel.obtain();
3358 Parcel reply = Parcel.obtain();
3359 data.writeInterfaceToken(IActivityManager.descriptor);
3360 data.writeStrongBinder(app.asBinder());
3361 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3362 reply.readException();
3363 data.recycle();
3364 reply.recycle();
3365 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003366 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3367 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003368 {
3369 Parcel data = Parcel.obtain();
3370 Parcel reply = Parcel.obtain();
3371 data.writeInterfaceToken(IActivityManager.descriptor);
3372 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003373 if (config != null) {
3374 data.writeInt(1);
3375 config.writeToParcel(data, 0);
3376 } else {
3377 data.writeInt(0);
3378 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003379 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003380 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3381 reply.readException();
3382 data.recycle();
3383 reply.recycle();
3384 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003385 public void activityResumed(IBinder token) throws RemoteException
3386 {
3387 Parcel data = Parcel.obtain();
3388 Parcel reply = Parcel.obtain();
3389 data.writeInterfaceToken(IActivityManager.descriptor);
3390 data.writeStrongBinder(token);
3391 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3392 reply.readException();
3393 data.recycle();
3394 reply.recycle();
3395 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003396 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003397 {
3398 Parcel data = Parcel.obtain();
3399 Parcel reply = Parcel.obtain();
3400 data.writeInterfaceToken(IActivityManager.descriptor);
3401 data.writeStrongBinder(token);
3402 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3403 reply.readException();
3404 data.recycle();
3405 reply.recycle();
3406 }
3407 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003408 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003409 {
3410 Parcel data = Parcel.obtain();
3411 Parcel reply = Parcel.obtain();
3412 data.writeInterfaceToken(IActivityManager.descriptor);
3413 data.writeStrongBinder(token);
3414 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003415 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003416 TextUtils.writeToParcel(description, data, 0);
3417 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3418 reply.readException();
3419 data.recycle();
3420 reply.recycle();
3421 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003422 public void activitySlept(IBinder token) throws RemoteException
3423 {
3424 Parcel data = Parcel.obtain();
3425 Parcel reply = Parcel.obtain();
3426 data.writeInterfaceToken(IActivityManager.descriptor);
3427 data.writeStrongBinder(token);
3428 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3429 reply.readException();
3430 data.recycle();
3431 reply.recycle();
3432 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003433 public void activityDestroyed(IBinder token) throws RemoteException
3434 {
3435 Parcel data = Parcel.obtain();
3436 Parcel reply = Parcel.obtain();
3437 data.writeInterfaceToken(IActivityManager.descriptor);
3438 data.writeStrongBinder(token);
3439 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3440 reply.readException();
3441 data.recycle();
3442 reply.recycle();
3443 }
Jorim Jaggife89d122015-12-22 16:28:44 +01003444 public void activityRelaunched(IBinder token) throws RemoteException
3445 {
3446 Parcel data = Parcel.obtain();
3447 Parcel reply = Parcel.obtain();
3448 data.writeInterfaceToken(IActivityManager.descriptor);
3449 data.writeStrongBinder(token);
3450 mRemote.transact(ACTIVITY_RELAUNCHED_TRANSACTION, data, reply, 0);
3451 reply.readException();
3452 data.recycle();
3453 reply.recycle();
3454 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003455 public String getCallingPackage(IBinder token) throws RemoteException
3456 {
3457 Parcel data = Parcel.obtain();
3458 Parcel reply = Parcel.obtain();
3459 data.writeInterfaceToken(IActivityManager.descriptor);
3460 data.writeStrongBinder(token);
3461 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3462 reply.readException();
3463 String res = reply.readString();
3464 data.recycle();
3465 reply.recycle();
3466 return res;
3467 }
3468 public ComponentName getCallingActivity(IBinder token)
3469 throws RemoteException {
3470 Parcel data = Parcel.obtain();
3471 Parcel reply = Parcel.obtain();
3472 data.writeInterfaceToken(IActivityManager.descriptor);
3473 data.writeStrongBinder(token);
3474 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3475 reply.readException();
3476 ComponentName res = ComponentName.readFromParcel(reply);
3477 data.recycle();
3478 reply.recycle();
3479 return res;
3480 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003481 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003482 Parcel data = Parcel.obtain();
3483 Parcel reply = Parcel.obtain();
3484 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003485 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003486 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3487 reply.readException();
3488 ArrayList<IAppTask> list = null;
3489 int N = reply.readInt();
3490 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003491 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003492 while (N > 0) {
3493 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3494 list.add(task);
3495 N--;
3496 }
3497 }
3498 data.recycle();
3499 reply.recycle();
3500 return list;
3501 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003502 public int addAppTask(IBinder activityToken, Intent intent,
3503 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3504 Parcel data = Parcel.obtain();
3505 Parcel reply = Parcel.obtain();
3506 data.writeInterfaceToken(IActivityManager.descriptor);
3507 data.writeStrongBinder(activityToken);
3508 intent.writeToParcel(data, 0);
3509 description.writeToParcel(data, 0);
3510 thumbnail.writeToParcel(data, 0);
3511 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3512 reply.readException();
3513 int res = reply.readInt();
3514 data.recycle();
3515 reply.recycle();
3516 return res;
3517 }
3518 public Point getAppTaskThumbnailSize() throws RemoteException {
3519 Parcel data = Parcel.obtain();
3520 Parcel reply = Parcel.obtain();
3521 data.writeInterfaceToken(IActivityManager.descriptor);
3522 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3523 reply.readException();
3524 Point size = Point.CREATOR.createFromParcel(reply);
3525 data.recycle();
3526 reply.recycle();
3527 return size;
3528 }
Todd Kennedye635f662015-01-20 10:36:49 -08003529 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3530 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003531 Parcel data = Parcel.obtain();
3532 Parcel reply = Parcel.obtain();
3533 data.writeInterfaceToken(IActivityManager.descriptor);
3534 data.writeInt(maxNum);
3535 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003536 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3537 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003538 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003539 int N = reply.readInt();
3540 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003541 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003542 while (N > 0) {
3543 ActivityManager.RunningTaskInfo info =
3544 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003545 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003546 list.add(info);
3547 N--;
3548 }
3549 }
3550 data.recycle();
3551 reply.recycle();
3552 return list;
3553 }
3554 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003555 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003556 Parcel data = Parcel.obtain();
3557 Parcel reply = Parcel.obtain();
3558 data.writeInterfaceToken(IActivityManager.descriptor);
3559 data.writeInt(maxNum);
3560 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003561 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003562 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3563 reply.readException();
3564 ArrayList<ActivityManager.RecentTaskInfo> list
3565 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3566 data.recycle();
3567 reply.recycle();
3568 return list;
3569 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003570 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003571 Parcel data = Parcel.obtain();
3572 Parcel reply = Parcel.obtain();
3573 data.writeInterfaceToken(IActivityManager.descriptor);
3574 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003575 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003576 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003577 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003578 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003579 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003580 }
3581 data.recycle();
3582 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003583 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003584 }
Todd Kennedye635f662015-01-20 10:36:49 -08003585 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3586 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003587 Parcel data = Parcel.obtain();
3588 Parcel reply = Parcel.obtain();
3589 data.writeInterfaceToken(IActivityManager.descriptor);
3590 data.writeInt(maxNum);
3591 data.writeInt(flags);
3592 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3593 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003594 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003595 int N = reply.readInt();
3596 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003597 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003598 while (N > 0) {
3599 ActivityManager.RunningServiceInfo info =
3600 ActivityManager.RunningServiceInfo.CREATOR
3601 .createFromParcel(reply);
3602 list.add(info);
3603 N--;
3604 }
3605 }
3606 data.recycle();
3607 reply.recycle();
3608 return list;
3609 }
3610 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3611 throws RemoteException {
3612 Parcel data = Parcel.obtain();
3613 Parcel reply = Parcel.obtain();
3614 data.writeInterfaceToken(IActivityManager.descriptor);
3615 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3616 reply.readException();
3617 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3618 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3619 data.recycle();
3620 reply.recycle();
3621 return list;
3622 }
3623 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3624 throws RemoteException {
3625 Parcel data = Parcel.obtain();
3626 Parcel reply = Parcel.obtain();
3627 data.writeInterfaceToken(IActivityManager.descriptor);
3628 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3629 reply.readException();
3630 ArrayList<ActivityManager.RunningAppProcessInfo> list
3631 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3632 data.recycle();
3633 reply.recycle();
3634 return list;
3635 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003636 public List<ApplicationInfo> getRunningExternalApplications()
3637 throws RemoteException {
3638 Parcel data = Parcel.obtain();
3639 Parcel reply = Parcel.obtain();
3640 data.writeInterfaceToken(IActivityManager.descriptor);
3641 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3642 reply.readException();
3643 ArrayList<ApplicationInfo> list
3644 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3645 data.recycle();
3646 reply.recycle();
3647 return list;
3648 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003649 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003650 {
3651 Parcel data = Parcel.obtain();
3652 Parcel reply = Parcel.obtain();
3653 data.writeInterfaceToken(IActivityManager.descriptor);
3654 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003655 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003656 if (options != null) {
3657 data.writeInt(1);
3658 options.writeToParcel(data, 0);
3659 } else {
3660 data.writeInt(0);
3661 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003662 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3663 reply.readException();
3664 data.recycle();
3665 reply.recycle();
3666 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003667 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3668 throws RemoteException {
3669 Parcel data = Parcel.obtain();
3670 Parcel reply = Parcel.obtain();
3671 data.writeInterfaceToken(IActivityManager.descriptor);
3672 data.writeStrongBinder(token);
3673 data.writeInt(nonRoot ? 1 : 0);
3674 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3675 reply.readException();
3676 boolean res = reply.readInt() != 0;
3677 data.recycle();
3678 reply.recycle();
3679 return res;
3680 }
3681 public void moveTaskBackwards(int task) throws RemoteException
3682 {
3683 Parcel data = Parcel.obtain();
3684 Parcel reply = Parcel.obtain();
3685 data.writeInterfaceToken(IActivityManager.descriptor);
3686 data.writeInt(task);
3687 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3688 reply.readException();
3689 data.recycle();
3690 reply.recycle();
3691 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003692 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003693 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3694 {
3695 Parcel data = Parcel.obtain();
3696 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003697 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003698 data.writeInt(taskId);
3699 data.writeInt(stackId);
3700 data.writeInt(toTop ? 1 : 0);
3701 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3702 reply.readException();
3703 data.recycle();
3704 reply.recycle();
3705 }
3706 @Override
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003707 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
3708 Rect initialBounds) throws RemoteException
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003709 {
3710 Parcel data = Parcel.obtain();
3711 Parcel reply = Parcel.obtain();
3712 data.writeInterfaceToken(IActivityManager.descriptor);
3713 data.writeInt(taskId);
3714 data.writeInt(createMode);
3715 data.writeInt(toTop ? 1 : 0);
Jorim Jaggi030979c2015-11-20 15:14:43 -08003716 data.writeInt(animate ? 1 : 0);
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003717 if (initialBounds != null) {
3718 data.writeInt(1);
3719 initialBounds.writeToParcel(data, 0);
3720 } else {
3721 data.writeInt(0);
3722 }
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003723 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3724 reply.readException();
3725 data.recycle();
3726 reply.recycle();
3727 }
3728 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003729 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3730 throws RemoteException
3731 {
3732 Parcel data = Parcel.obtain();
3733 Parcel reply = Parcel.obtain();
3734 data.writeInterfaceToken(IActivityManager.descriptor);
3735 data.writeInt(stackId);
3736 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003737 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003738 reply.readException();
3739 final boolean res = reply.readInt() != 0;
3740 data.recycle();
3741 reply.recycle();
3742 return res;
3743 }
3744 @Override
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003745 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode)
3746 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003747 {
3748 Parcel data = Parcel.obtain();
3749 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003750 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003751 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003752 if (r != null) {
3753 data.writeInt(1);
3754 r.writeToParcel(data, 0);
3755 } else {
3756 data.writeInt(0);
3757 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003758 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003759 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003760 reply.readException();
3761 data.recycle();
3762 reply.recycle();
3763 }
Craig Mautner967212c2013-04-13 21:10:58 -07003764 @Override
Jorim Jaggidc249c42015-12-15 14:57:31 -08003765 public void resizeDockedStack(Rect dockedBounds, Rect tempDockedTaskBounds,
3766 Rect tempDockedTaskInsetBounds,
3767 Rect tempOtherTaskBounds, Rect tempOtherTaskInsetBounds)
3768 throws RemoteException
3769 {
3770 Parcel data = Parcel.obtain();
3771 Parcel reply = Parcel.obtain();
3772 data.writeInterfaceToken(IActivityManager.descriptor);
3773 if (dockedBounds != null) {
3774 data.writeInt(1);
3775 dockedBounds.writeToParcel(data, 0);
3776 } else {
3777 data.writeInt(0);
3778 }
3779 if (tempDockedTaskBounds != null) {
3780 data.writeInt(1);
3781 tempDockedTaskBounds.writeToParcel(data, 0);
3782 } else {
3783 data.writeInt(0);
3784 }
3785 if (tempDockedTaskInsetBounds != null) {
3786 data.writeInt(1);
3787 tempDockedTaskInsetBounds.writeToParcel(data, 0);
3788 } else {
3789 data.writeInt(0);
3790 }
3791 if (tempOtherTaskBounds != null) {
3792 data.writeInt(1);
3793 tempOtherTaskBounds.writeToParcel(data, 0);
3794 } else {
3795 data.writeInt(0);
3796 }
3797 if (tempOtherTaskInsetBounds != null) {
3798 data.writeInt(1);
3799 tempOtherTaskInsetBounds.writeToParcel(data, 0);
3800 } else {
3801 data.writeInt(0);
3802 }
3803 mRemote.transact(RESIZE_DOCKED_STACK_TRANSACTION, data, reply, 0);
3804 reply.readException();
3805 data.recycle();
3806 reply.recycle();
3807 }
3808 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003809 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3810 {
3811 Parcel data = Parcel.obtain();
3812 Parcel reply = Parcel.obtain();
3813 data.writeInterfaceToken(IActivityManager.descriptor);
3814 data.writeInt(taskId);
3815 data.writeInt(stackId);
3816 data.writeInt(position);
3817 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3818 reply.readException();
3819 data.recycle();
3820 reply.recycle();
3821 }
3822 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003823 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003824 {
3825 Parcel data = Parcel.obtain();
3826 Parcel reply = Parcel.obtain();
3827 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003828 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003829 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003830 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003831 data.recycle();
3832 reply.recycle();
3833 return list;
3834 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003835 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003836 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003837 {
3838 Parcel data = Parcel.obtain();
3839 Parcel reply = Parcel.obtain();
3840 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003841 data.writeInt(stackId);
3842 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003843 reply.readException();
3844 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003845 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003846 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003847 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003848 }
3849 data.recycle();
3850 reply.recycle();
3851 return info;
3852 }
3853 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003854 public boolean isInHomeStack(int taskId) throws RemoteException {
3855 Parcel data = Parcel.obtain();
3856 Parcel reply = Parcel.obtain();
3857 data.writeInterfaceToken(IActivityManager.descriptor);
3858 data.writeInt(taskId);
3859 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3860 reply.readException();
3861 boolean isInHomeStack = reply.readInt() > 0;
3862 data.recycle();
3863 reply.recycle();
3864 return isInHomeStack;
3865 }
3866 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003867 public void setFocusedStack(int stackId) throws RemoteException
3868 {
3869 Parcel data = Parcel.obtain();
3870 Parcel reply = Parcel.obtain();
3871 data.writeInterfaceToken(IActivityManager.descriptor);
3872 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003873 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003874 reply.readException();
3875 data.recycle();
3876 reply.recycle();
3877 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003878 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003879 public int getFocusedStackId() throws RemoteException {
3880 Parcel data = Parcel.obtain();
3881 Parcel reply = Parcel.obtain();
3882 data.writeInterfaceToken(IActivityManager.descriptor);
3883 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3884 reply.readException();
3885 int focusedStackId = reply.readInt();
3886 data.recycle();
3887 reply.recycle();
3888 return focusedStackId;
3889 }
3890 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003891 public void setFocusedTask(int taskId) throws RemoteException
3892 {
3893 Parcel data = Parcel.obtain();
3894 Parcel reply = Parcel.obtain();
3895 data.writeInterfaceToken(IActivityManager.descriptor);
3896 data.writeInt(taskId);
3897 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3898 reply.readException();
3899 data.recycle();
3900 reply.recycle();
3901 }
3902 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003903 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3904 {
3905 Parcel data = Parcel.obtain();
3906 Parcel reply = Parcel.obtain();
3907 data.writeInterfaceToken(IActivityManager.descriptor);
3908 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003909 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003910 reply.readException();
3911 data.recycle();
3912 reply.recycle();
3913 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003914 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3915 {
3916 Parcel data = Parcel.obtain();
3917 Parcel reply = Parcel.obtain();
3918 data.writeInterfaceToken(IActivityManager.descriptor);
3919 data.writeStrongBinder(token);
3920 data.writeInt(onlyRoot ? 1 : 0);
3921 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3922 reply.readException();
3923 int res = reply.readInt();
3924 data.recycle();
3925 reply.recycle();
3926 return res;
3927 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003928 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003929 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003930 Parcel data = Parcel.obtain();
3931 Parcel reply = Parcel.obtain();
3932 data.writeInterfaceToken(IActivityManager.descriptor);
3933 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3934 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003935 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003936 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003937 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3938 reply.readException();
3939 int res = reply.readInt();
3940 ContentProviderHolder cph = null;
3941 if (res != 0) {
3942 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3943 }
3944 data.recycle();
3945 reply.recycle();
3946 return cph;
3947 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003948 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3949 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003950 Parcel data = Parcel.obtain();
3951 Parcel reply = Parcel.obtain();
3952 data.writeInterfaceToken(IActivityManager.descriptor);
3953 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003954 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003955 data.writeStrongBinder(token);
3956 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3957 reply.readException();
3958 int res = reply.readInt();
3959 ContentProviderHolder cph = null;
3960 if (res != 0) {
3961 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3962 }
3963 data.recycle();
3964 reply.recycle();
3965 return cph;
3966 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003967 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003968 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003969 {
3970 Parcel data = Parcel.obtain();
3971 Parcel reply = Parcel.obtain();
3972 data.writeInterfaceToken(IActivityManager.descriptor);
3973 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3974 data.writeTypedList(providers);
3975 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3976 reply.readException();
3977 data.recycle();
3978 reply.recycle();
3979 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003980 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3981 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003982 Parcel data = Parcel.obtain();
3983 Parcel reply = Parcel.obtain();
3984 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003985 data.writeStrongBinder(connection);
3986 data.writeInt(stable);
3987 data.writeInt(unstable);
3988 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3989 reply.readException();
3990 boolean res = reply.readInt() != 0;
3991 data.recycle();
3992 reply.recycle();
3993 return res;
3994 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003995
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003996 public void unstableProviderDied(IBinder connection) throws RemoteException {
3997 Parcel data = Parcel.obtain();
3998 Parcel reply = Parcel.obtain();
3999 data.writeInterfaceToken(IActivityManager.descriptor);
4000 data.writeStrongBinder(connection);
4001 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
4002 reply.readException();
4003 data.recycle();
4004 reply.recycle();
4005 }
4006
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004007 @Override
4008 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
4009 Parcel data = Parcel.obtain();
4010 Parcel reply = Parcel.obtain();
4011 data.writeInterfaceToken(IActivityManager.descriptor);
4012 data.writeStrongBinder(connection);
4013 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
4014 reply.readException();
4015 data.recycle();
4016 reply.recycle();
4017 }
4018
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004019 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
4020 Parcel data = Parcel.obtain();
4021 Parcel reply = Parcel.obtain();
4022 data.writeInterfaceToken(IActivityManager.descriptor);
4023 data.writeStrongBinder(connection);
4024 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004025 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4026 reply.readException();
4027 data.recycle();
4028 reply.recycle();
4029 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004030
4031 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
4032 Parcel data = Parcel.obtain();
4033 Parcel reply = Parcel.obtain();
4034 data.writeInterfaceToken(IActivityManager.descriptor);
4035 data.writeString(name);
4036 data.writeStrongBinder(token);
4037 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4038 reply.readException();
4039 data.recycle();
4040 reply.recycle();
4041 }
4042
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07004043 public PendingIntent getRunningServiceControlPanel(ComponentName service)
4044 throws RemoteException
4045 {
4046 Parcel data = Parcel.obtain();
4047 Parcel reply = Parcel.obtain();
4048 data.writeInterfaceToken(IActivityManager.descriptor);
4049 service.writeToParcel(data, 0);
4050 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
4051 reply.readException();
4052 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
4053 data.recycle();
4054 reply.recycle();
4055 return res;
4056 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004057
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004058 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07004059 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004060 {
4061 Parcel data = Parcel.obtain();
4062 Parcel reply = Parcel.obtain();
4063 data.writeInterfaceToken(IActivityManager.descriptor);
4064 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4065 service.writeToParcel(data, 0);
4066 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004067 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004068 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004069 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
4070 reply.readException();
4071 ComponentName res = ComponentName.readFromParcel(reply);
4072 data.recycle();
4073 reply.recycle();
4074 return res;
4075 }
4076 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004077 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004078 {
4079 Parcel data = Parcel.obtain();
4080 Parcel reply = Parcel.obtain();
4081 data.writeInterfaceToken(IActivityManager.descriptor);
4082 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4083 service.writeToParcel(data, 0);
4084 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004085 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004086 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
4087 reply.readException();
4088 int res = reply.readInt();
4089 reply.recycle();
4090 data.recycle();
4091 return res;
4092 }
4093 public boolean stopServiceToken(ComponentName className, IBinder token,
4094 int startId) throws RemoteException {
4095 Parcel data = Parcel.obtain();
4096 Parcel reply = Parcel.obtain();
4097 data.writeInterfaceToken(IActivityManager.descriptor);
4098 ComponentName.writeToParcel(className, data);
4099 data.writeStrongBinder(token);
4100 data.writeInt(startId);
4101 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
4102 reply.readException();
4103 boolean res = reply.readInt() != 0;
4104 data.recycle();
4105 reply.recycle();
4106 return res;
4107 }
4108 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004109 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004110 Parcel data = Parcel.obtain();
4111 Parcel reply = Parcel.obtain();
4112 data.writeInterfaceToken(IActivityManager.descriptor);
4113 ComponentName.writeToParcel(className, data);
4114 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004115 data.writeInt(id);
4116 if (notification != null) {
4117 data.writeInt(1);
4118 notification.writeToParcel(data, 0);
4119 } else {
4120 data.writeInt(0);
4121 }
4122 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004123 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
4124 reply.readException();
4125 data.recycle();
4126 reply.recycle();
4127 }
4128 public int bindService(IApplicationThread caller, IBinder token,
4129 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07004130 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004131 Parcel data = Parcel.obtain();
4132 Parcel reply = Parcel.obtain();
4133 data.writeInterfaceToken(IActivityManager.descriptor);
4134 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4135 data.writeStrongBinder(token);
4136 service.writeToParcel(data, 0);
4137 data.writeString(resolvedType);
4138 data.writeStrongBinder(connection.asBinder());
4139 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07004140 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08004141 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004142 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
4143 reply.readException();
4144 int res = reply.readInt();
4145 data.recycle();
4146 reply.recycle();
4147 return res;
4148 }
4149 public boolean unbindService(IServiceConnection connection) throws RemoteException
4150 {
4151 Parcel data = Parcel.obtain();
4152 Parcel reply = Parcel.obtain();
4153 data.writeInterfaceToken(IActivityManager.descriptor);
4154 data.writeStrongBinder(connection.asBinder());
4155 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
4156 reply.readException();
4157 boolean res = reply.readInt() != 0;
4158 data.recycle();
4159 reply.recycle();
4160 return res;
4161 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004162
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004163 public void publishService(IBinder token,
4164 Intent intent, IBinder service) throws RemoteException {
4165 Parcel data = Parcel.obtain();
4166 Parcel reply = Parcel.obtain();
4167 data.writeInterfaceToken(IActivityManager.descriptor);
4168 data.writeStrongBinder(token);
4169 intent.writeToParcel(data, 0);
4170 data.writeStrongBinder(service);
4171 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
4172 reply.readException();
4173 data.recycle();
4174 reply.recycle();
4175 }
4176
4177 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
4178 throws RemoteException {
4179 Parcel data = Parcel.obtain();
4180 Parcel reply = Parcel.obtain();
4181 data.writeInterfaceToken(IActivityManager.descriptor);
4182 data.writeStrongBinder(token);
4183 intent.writeToParcel(data, 0);
4184 data.writeInt(doRebind ? 1 : 0);
4185 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4186 reply.readException();
4187 data.recycle();
4188 reply.recycle();
4189 }
4190
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004191 public void serviceDoneExecuting(IBinder token, int type, int startId,
4192 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004193 Parcel data = Parcel.obtain();
4194 Parcel reply = Parcel.obtain();
4195 data.writeInterfaceToken(IActivityManager.descriptor);
4196 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004197 data.writeInt(type);
4198 data.writeInt(startId);
4199 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004200 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4201 reply.readException();
4202 data.recycle();
4203 reply.recycle();
4204 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004205
Svet Ganov99b60432015-06-27 13:15:22 -07004206 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4207 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004208 Parcel data = Parcel.obtain();
4209 Parcel reply = Parcel.obtain();
4210 data.writeInterfaceToken(IActivityManager.descriptor);
4211 service.writeToParcel(data, 0);
4212 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004213 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004214 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4215 reply.readException();
4216 IBinder binder = reply.readStrongBinder();
4217 reply.recycle();
4218 data.recycle();
4219 return binder;
4220 }
4221
Christopher Tate181fafa2009-05-14 11:12:14 -07004222 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4223 throws RemoteException {
4224 Parcel data = Parcel.obtain();
4225 Parcel reply = Parcel.obtain();
4226 data.writeInterfaceToken(IActivityManager.descriptor);
4227 app.writeToParcel(data, 0);
4228 data.writeInt(backupRestoreMode);
4229 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4230 reply.readException();
4231 boolean success = reply.readInt() != 0;
4232 reply.recycle();
4233 data.recycle();
4234 return success;
4235 }
4236
Christopher Tate346acb12012-10-15 19:20:25 -07004237 public void clearPendingBackup() throws RemoteException {
4238 Parcel data = Parcel.obtain();
4239 Parcel reply = Parcel.obtain();
4240 data.writeInterfaceToken(IActivityManager.descriptor);
4241 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4242 reply.recycle();
4243 data.recycle();
4244 }
4245
Christopher Tate181fafa2009-05-14 11:12:14 -07004246 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4247 Parcel data = Parcel.obtain();
4248 Parcel reply = Parcel.obtain();
4249 data.writeInterfaceToken(IActivityManager.descriptor);
4250 data.writeString(packageName);
4251 data.writeStrongBinder(agent);
4252 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4253 reply.recycle();
4254 data.recycle();
4255 }
4256
4257 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4258 Parcel data = Parcel.obtain();
4259 Parcel reply = Parcel.obtain();
4260 data.writeInterfaceToken(IActivityManager.descriptor);
4261 app.writeToParcel(data, 0);
4262 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4263 reply.readException();
4264 reply.recycle();
4265 data.recycle();
4266 }
4267
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004268 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004269 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004270 IUiAutomationConnection connection, int userId, String instructionSet)
4271 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004272 Parcel data = Parcel.obtain();
4273 Parcel reply = Parcel.obtain();
4274 data.writeInterfaceToken(IActivityManager.descriptor);
4275 ComponentName.writeToParcel(className, data);
4276 data.writeString(profileFile);
4277 data.writeInt(flags);
4278 data.writeBundle(arguments);
4279 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004280 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004281 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004282 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004283 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4284 reply.readException();
4285 boolean res = reply.readInt() != 0;
4286 reply.recycle();
4287 data.recycle();
4288 return res;
4289 }
4290
4291 public void finishInstrumentation(IApplicationThread target,
4292 int resultCode, Bundle results) throws RemoteException {
4293 Parcel data = Parcel.obtain();
4294 Parcel reply = Parcel.obtain();
4295 data.writeInterfaceToken(IActivityManager.descriptor);
4296 data.writeStrongBinder(target != null ? target.asBinder() : null);
4297 data.writeInt(resultCode);
4298 data.writeBundle(results);
4299 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4300 reply.readException();
4301 data.recycle();
4302 reply.recycle();
4303 }
4304 public Configuration getConfiguration() throws RemoteException
4305 {
4306 Parcel data = Parcel.obtain();
4307 Parcel reply = Parcel.obtain();
4308 data.writeInterfaceToken(IActivityManager.descriptor);
4309 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4310 reply.readException();
4311 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4312 reply.recycle();
4313 data.recycle();
4314 return res;
4315 }
4316 public void updateConfiguration(Configuration values) throws RemoteException
4317 {
4318 Parcel data = Parcel.obtain();
4319 Parcel reply = Parcel.obtain();
4320 data.writeInterfaceToken(IActivityManager.descriptor);
4321 values.writeToParcel(data, 0);
4322 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4323 reply.readException();
4324 data.recycle();
4325 reply.recycle();
4326 }
4327 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4328 throws RemoteException {
4329 Parcel data = Parcel.obtain();
4330 Parcel reply = Parcel.obtain();
4331 data.writeInterfaceToken(IActivityManager.descriptor);
4332 data.writeStrongBinder(token);
4333 data.writeInt(requestedOrientation);
4334 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4335 reply.readException();
4336 data.recycle();
4337 reply.recycle();
4338 }
4339 public int getRequestedOrientation(IBinder token) throws RemoteException {
4340 Parcel data = Parcel.obtain();
4341 Parcel reply = Parcel.obtain();
4342 data.writeInterfaceToken(IActivityManager.descriptor);
4343 data.writeStrongBinder(token);
4344 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4345 reply.readException();
4346 int res = reply.readInt();
4347 data.recycle();
4348 reply.recycle();
4349 return res;
4350 }
4351 public ComponentName getActivityClassForToken(IBinder token)
4352 throws RemoteException {
4353 Parcel data = Parcel.obtain();
4354 Parcel reply = Parcel.obtain();
4355 data.writeInterfaceToken(IActivityManager.descriptor);
4356 data.writeStrongBinder(token);
4357 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4358 reply.readException();
4359 ComponentName res = ComponentName.readFromParcel(reply);
4360 data.recycle();
4361 reply.recycle();
4362 return res;
4363 }
4364 public String getPackageForToken(IBinder token) throws RemoteException
4365 {
4366 Parcel data = Parcel.obtain();
4367 Parcel reply = Parcel.obtain();
4368 data.writeInterfaceToken(IActivityManager.descriptor);
4369 data.writeStrongBinder(token);
4370 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4371 reply.readException();
4372 String res = reply.readString();
4373 data.recycle();
4374 reply.recycle();
4375 return res;
4376 }
4377 public IIntentSender getIntentSender(int type,
4378 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004379 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004380 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004381 Parcel data = Parcel.obtain();
4382 Parcel reply = Parcel.obtain();
4383 data.writeInterfaceToken(IActivityManager.descriptor);
4384 data.writeInt(type);
4385 data.writeString(packageName);
4386 data.writeStrongBinder(token);
4387 data.writeString(resultWho);
4388 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004389 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004390 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004391 data.writeTypedArray(intents, 0);
4392 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004393 } else {
4394 data.writeInt(0);
4395 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004396 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004397 if (options != null) {
4398 data.writeInt(1);
4399 options.writeToParcel(data, 0);
4400 } else {
4401 data.writeInt(0);
4402 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004403 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004404 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4405 reply.readException();
4406 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004407 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004408 data.recycle();
4409 reply.recycle();
4410 return res;
4411 }
4412 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4413 Parcel data = Parcel.obtain();
4414 Parcel reply = Parcel.obtain();
4415 data.writeInterfaceToken(IActivityManager.descriptor);
4416 data.writeStrongBinder(sender.asBinder());
4417 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4418 reply.readException();
4419 data.recycle();
4420 reply.recycle();
4421 }
4422 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4423 Parcel data = Parcel.obtain();
4424 Parcel reply = Parcel.obtain();
4425 data.writeInterfaceToken(IActivityManager.descriptor);
4426 data.writeStrongBinder(sender.asBinder());
4427 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4428 reply.readException();
4429 String res = reply.readString();
4430 data.recycle();
4431 reply.recycle();
4432 return res;
4433 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004434 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4435 Parcel data = Parcel.obtain();
4436 Parcel reply = Parcel.obtain();
4437 data.writeInterfaceToken(IActivityManager.descriptor);
4438 data.writeStrongBinder(sender.asBinder());
4439 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4440 reply.readException();
4441 int res = reply.readInt();
4442 data.recycle();
4443 reply.recycle();
4444 return res;
4445 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004446 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4447 boolean requireFull, String name, String callerPackage) throws RemoteException {
4448 Parcel data = Parcel.obtain();
4449 Parcel reply = Parcel.obtain();
4450 data.writeInterfaceToken(IActivityManager.descriptor);
4451 data.writeInt(callingPid);
4452 data.writeInt(callingUid);
4453 data.writeInt(userId);
4454 data.writeInt(allowAll ? 1 : 0);
4455 data.writeInt(requireFull ? 1 : 0);
4456 data.writeString(name);
4457 data.writeString(callerPackage);
4458 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4459 reply.readException();
4460 int res = reply.readInt();
4461 data.recycle();
4462 reply.recycle();
4463 return res;
4464 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004465 public void setProcessLimit(int max) throws RemoteException
4466 {
4467 Parcel data = Parcel.obtain();
4468 Parcel reply = Parcel.obtain();
4469 data.writeInterfaceToken(IActivityManager.descriptor);
4470 data.writeInt(max);
4471 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4472 reply.readException();
4473 data.recycle();
4474 reply.recycle();
4475 }
4476 public int getProcessLimit() throws RemoteException
4477 {
4478 Parcel data = Parcel.obtain();
4479 Parcel reply = Parcel.obtain();
4480 data.writeInterfaceToken(IActivityManager.descriptor);
4481 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4482 reply.readException();
4483 int res = reply.readInt();
4484 data.recycle();
4485 reply.recycle();
4486 return res;
4487 }
4488 public void setProcessForeground(IBinder token, int pid,
4489 boolean isForeground) throws RemoteException {
4490 Parcel data = Parcel.obtain();
4491 Parcel reply = Parcel.obtain();
4492 data.writeInterfaceToken(IActivityManager.descriptor);
4493 data.writeStrongBinder(token);
4494 data.writeInt(pid);
4495 data.writeInt(isForeground ? 1 : 0);
4496 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4497 reply.readException();
4498 data.recycle();
4499 reply.recycle();
4500 }
4501 public int checkPermission(String permission, int pid, int uid)
4502 throws RemoteException {
4503 Parcel data = Parcel.obtain();
4504 Parcel reply = Parcel.obtain();
4505 data.writeInterfaceToken(IActivityManager.descriptor);
4506 data.writeString(permission);
4507 data.writeInt(pid);
4508 data.writeInt(uid);
4509 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4510 reply.readException();
4511 int res = reply.readInt();
4512 data.recycle();
4513 reply.recycle();
4514 return res;
4515 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004516 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4517 throws RemoteException {
4518 Parcel data = Parcel.obtain();
4519 Parcel reply = Parcel.obtain();
4520 data.writeInterfaceToken(IActivityManager.descriptor);
4521 data.writeString(permission);
4522 data.writeInt(pid);
4523 data.writeInt(uid);
4524 data.writeStrongBinder(callerToken);
4525 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4526 reply.readException();
4527 int res = reply.readInt();
4528 data.recycle();
4529 reply.recycle();
4530 return res;
4531 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004532 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004533 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004534 Parcel data = Parcel.obtain();
4535 Parcel reply = Parcel.obtain();
4536 data.writeInterfaceToken(IActivityManager.descriptor);
4537 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004538 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004539 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004540 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4541 reply.readException();
4542 boolean res = reply.readInt() != 0;
4543 data.recycle();
4544 reply.recycle();
4545 return res;
4546 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004547 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4548 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004549 Parcel data = Parcel.obtain();
4550 Parcel reply = Parcel.obtain();
4551 data.writeInterfaceToken(IActivityManager.descriptor);
4552 uri.writeToParcel(data, 0);
4553 data.writeInt(pid);
4554 data.writeInt(uid);
4555 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004556 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004557 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004558 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4559 reply.readException();
4560 int res = reply.readInt();
4561 data.recycle();
4562 reply.recycle();
4563 return res;
4564 }
4565 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004566 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004567 Parcel data = Parcel.obtain();
4568 Parcel reply = Parcel.obtain();
4569 data.writeInterfaceToken(IActivityManager.descriptor);
4570 data.writeStrongBinder(caller.asBinder());
4571 data.writeString(targetPkg);
4572 uri.writeToParcel(data, 0);
4573 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004574 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004575 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4576 reply.readException();
4577 data.recycle();
4578 reply.recycle();
4579 }
4580 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004581 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004582 Parcel data = Parcel.obtain();
4583 Parcel reply = Parcel.obtain();
4584 data.writeInterfaceToken(IActivityManager.descriptor);
4585 data.writeStrongBinder(caller.asBinder());
4586 uri.writeToParcel(data, 0);
4587 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004588 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004589 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4590 reply.readException();
4591 data.recycle();
4592 reply.recycle();
4593 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004594
4595 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004596 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4597 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004598 Parcel data = Parcel.obtain();
4599 Parcel reply = Parcel.obtain();
4600 data.writeInterfaceToken(IActivityManager.descriptor);
4601 uri.writeToParcel(data, 0);
4602 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004603 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004604 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4605 reply.readException();
4606 data.recycle();
4607 reply.recycle();
4608 }
4609
4610 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004611 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4612 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004613 Parcel data = Parcel.obtain();
4614 Parcel reply = Parcel.obtain();
4615 data.writeInterfaceToken(IActivityManager.descriptor);
4616 uri.writeToParcel(data, 0);
4617 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004618 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004619 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4620 reply.readException();
4621 data.recycle();
4622 reply.recycle();
4623 }
4624
4625 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004626 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4627 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004628 Parcel data = Parcel.obtain();
4629 Parcel reply = Parcel.obtain();
4630 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004631 data.writeString(packageName);
4632 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004633 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4634 reply.readException();
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004635 @SuppressWarnings("unchecked")
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004636 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4637 reply);
4638 data.recycle();
4639 reply.recycle();
4640 return perms;
4641 }
4642
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004643 @Override
4644 public ParceledListSlice<UriPermission> getGrantedUriPermissions(String packageName, int userId)
4645 throws RemoteException {
4646 Parcel data = Parcel.obtain();
4647 Parcel reply = Parcel.obtain();
4648 data.writeInterfaceToken(IActivityManager.descriptor);
4649 data.writeString(packageName);
4650 data.writeInt(userId);
4651 mRemote.transact(GET_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4652 reply.readException();
4653 @SuppressWarnings("unchecked")
4654 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4655 reply);
4656 data.recycle();
4657 reply.recycle();
4658 return perms;
4659 }
4660
4661 @Override
4662 public void clearGrantedUriPermissions(String packageName, int userId) throws RemoteException {
4663 Parcel data = Parcel.obtain();
4664 Parcel reply = Parcel.obtain();
4665 data.writeInterfaceToken(IActivityManager.descriptor);
4666 data.writeString(packageName);
4667 data.writeInt(userId);
4668 mRemote.transact(CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4669 reply.readException();
4670 data.recycle();
4671 reply.recycle();
4672 }
4673
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004674 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4675 throws RemoteException {
4676 Parcel data = Parcel.obtain();
4677 Parcel reply = Parcel.obtain();
4678 data.writeInterfaceToken(IActivityManager.descriptor);
4679 data.writeStrongBinder(who.asBinder());
4680 data.writeInt(waiting ? 1 : 0);
4681 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4682 reply.readException();
4683 data.recycle();
4684 reply.recycle();
4685 }
4686 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4687 Parcel data = Parcel.obtain();
4688 Parcel reply = Parcel.obtain();
4689 data.writeInterfaceToken(IActivityManager.descriptor);
4690 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4691 reply.readException();
4692 outInfo.readFromParcel(reply);
4693 data.recycle();
4694 reply.recycle();
4695 }
4696 public void unhandledBack() throws RemoteException
4697 {
4698 Parcel data = Parcel.obtain();
4699 Parcel reply = Parcel.obtain();
4700 data.writeInterfaceToken(IActivityManager.descriptor);
4701 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4702 reply.readException();
4703 data.recycle();
4704 reply.recycle();
4705 }
4706 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4707 {
4708 Parcel data = Parcel.obtain();
4709 Parcel reply = Parcel.obtain();
4710 data.writeInterfaceToken(IActivityManager.descriptor);
4711 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4712 reply.readException();
4713 ParcelFileDescriptor pfd = null;
4714 if (reply.readInt() != 0) {
4715 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4716 }
4717 data.recycle();
4718 reply.recycle();
4719 return pfd;
4720 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004721 public void setLockScreenShown(boolean shown) throws RemoteException
4722 {
4723 Parcel data = Parcel.obtain();
4724 Parcel reply = Parcel.obtain();
4725 data.writeInterfaceToken(IActivityManager.descriptor);
4726 data.writeInt(shown ? 1 : 0);
4727 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4728 reply.readException();
4729 data.recycle();
4730 reply.recycle();
4731 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004732 public void setDebugApp(
4733 String packageName, boolean waitForDebugger, boolean persistent)
4734 throws RemoteException
4735 {
4736 Parcel data = Parcel.obtain();
4737 Parcel reply = Parcel.obtain();
4738 data.writeInterfaceToken(IActivityManager.descriptor);
4739 data.writeString(packageName);
4740 data.writeInt(waitForDebugger ? 1 : 0);
4741 data.writeInt(persistent ? 1 : 0);
4742 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4743 reply.readException();
4744 data.recycle();
4745 reply.recycle();
4746 }
4747 public void setAlwaysFinish(boolean enabled) throws RemoteException
4748 {
4749 Parcel data = Parcel.obtain();
4750 Parcel reply = Parcel.obtain();
4751 data.writeInterfaceToken(IActivityManager.descriptor);
4752 data.writeInt(enabled ? 1 : 0);
4753 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4754 reply.readException();
4755 data.recycle();
4756 reply.recycle();
4757 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004758 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004759 {
4760 Parcel data = Parcel.obtain();
4761 Parcel reply = Parcel.obtain();
4762 data.writeInterfaceToken(IActivityManager.descriptor);
4763 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004764 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004765 reply.readException();
4766 data.recycle();
4767 reply.recycle();
4768 }
4769 public void enterSafeMode() throws RemoteException {
4770 Parcel data = Parcel.obtain();
4771 data.writeInterfaceToken(IActivityManager.descriptor);
4772 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4773 data.recycle();
4774 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004775 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004776 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004777 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004778 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004779 data.writeStrongBinder(sender.asBinder());
4780 data.writeInt(sourceUid);
4781 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004782 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004783 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4784 data.recycle();
4785 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004786 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4787 throws RemoteException {
4788 Parcel data = Parcel.obtain();
4789 data.writeInterfaceToken(IActivityManager.descriptor);
4790 data.writeStrongBinder(sender.asBinder());
4791 data.writeInt(sourceUid);
4792 data.writeString(tag);
4793 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4794 data.recycle();
4795 }
4796 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4797 throws RemoteException {
4798 Parcel data = Parcel.obtain();
4799 data.writeInterfaceToken(IActivityManager.descriptor);
4800 data.writeStrongBinder(sender.asBinder());
4801 data.writeInt(sourceUid);
4802 data.writeString(tag);
4803 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4804 data.recycle();
4805 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004806 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004807 Parcel data = Parcel.obtain();
4808 Parcel reply = Parcel.obtain();
4809 data.writeInterfaceToken(IActivityManager.descriptor);
4810 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004811 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004812 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004813 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004814 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004815 boolean res = reply.readInt() != 0;
4816 data.recycle();
4817 reply.recycle();
4818 return res;
4819 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004820 @Override
4821 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4822 Parcel data = Parcel.obtain();
4823 Parcel reply = Parcel.obtain();
4824 data.writeInterfaceToken(IActivityManager.descriptor);
4825 data.writeString(reason);
4826 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4827 boolean res = reply.readInt() != 0;
4828 data.recycle();
4829 reply.recycle();
4830 return res;
4831 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004832 public boolean testIsSystemReady()
4833 {
4834 /* this base class version is never called */
4835 return true;
4836 }
Dan Egnor60d87622009-12-16 16:32:58 -08004837 public void handleApplicationCrash(IBinder app,
4838 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4839 {
4840 Parcel data = Parcel.obtain();
4841 Parcel reply = Parcel.obtain();
4842 data.writeInterfaceToken(IActivityManager.descriptor);
4843 data.writeStrongBinder(app);
4844 crashInfo.writeToParcel(data, 0);
4845 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4846 reply.readException();
4847 reply.recycle();
4848 data.recycle();
4849 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004850
Dianne Hackborn52322712014-08-26 22:47:26 -07004851 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004852 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004853 {
4854 Parcel data = Parcel.obtain();
4855 Parcel reply = Parcel.obtain();
4856 data.writeInterfaceToken(IActivityManager.descriptor);
4857 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004858 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004859 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004860 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004861 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004862 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004863 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004864 reply.recycle();
4865 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004866 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004867 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004868
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004869 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004870 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004871 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004872 {
4873 Parcel data = Parcel.obtain();
4874 Parcel reply = Parcel.obtain();
4875 data.writeInterfaceToken(IActivityManager.descriptor);
4876 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004877 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004878 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004879 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4880 reply.readException();
4881 reply.recycle();
4882 data.recycle();
4883 }
4884
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004885 public void signalPersistentProcesses(int sig) throws RemoteException {
4886 Parcel data = Parcel.obtain();
4887 Parcel reply = Parcel.obtain();
4888 data.writeInterfaceToken(IActivityManager.descriptor);
4889 data.writeInt(sig);
4890 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4891 reply.readException();
4892 data.recycle();
4893 reply.recycle();
4894 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004895
Dianne Hackborn1676c852012-09-10 14:52:30 -07004896 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004897 Parcel data = Parcel.obtain();
4898 Parcel reply = Parcel.obtain();
4899 data.writeInterfaceToken(IActivityManager.descriptor);
4900 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004901 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004902 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4903 reply.readException();
4904 data.recycle();
4905 reply.recycle();
4906 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004907
4908 public void killAllBackgroundProcesses() throws RemoteException {
4909 Parcel data = Parcel.obtain();
4910 Parcel reply = Parcel.obtain();
4911 data.writeInterfaceToken(IActivityManager.descriptor);
4912 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4913 reply.readException();
4914 data.recycle();
4915 reply.recycle();
4916 }
4917
Gustav Sennton6258dcd2015-10-30 19:25:37 +00004918 public void killPackageDependents(String packageName, int userId) throws RemoteException {
4919 Parcel data = Parcel.obtain();
4920 Parcel reply = Parcel.obtain();
4921 data.writeInterfaceToken(IActivityManager.descriptor);
4922 data.writeString(packageName);
4923 data.writeInt(userId);
4924 mRemote.transact(KILL_PACKAGE_DEPENDENTS_TRANSACTION, data, reply, 0);
4925 reply.readException();
4926 data.recycle();
4927 reply.recycle();
4928 }
4929
Dianne Hackborn1676c852012-09-10 14:52:30 -07004930 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004931 Parcel data = Parcel.obtain();
4932 Parcel reply = Parcel.obtain();
4933 data.writeInterfaceToken(IActivityManager.descriptor);
4934 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004935 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004936 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004937 reply.readException();
4938 data.recycle();
4939 reply.recycle();
4940 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004941
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004942 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4943 throws RemoteException
4944 {
4945 Parcel data = Parcel.obtain();
4946 Parcel reply = Parcel.obtain();
4947 data.writeInterfaceToken(IActivityManager.descriptor);
4948 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4949 reply.readException();
4950 outInfo.readFromParcel(reply);
4951 reply.recycle();
4952 data.recycle();
4953 }
4954
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004955 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4956 {
4957 Parcel data = Parcel.obtain();
4958 Parcel reply = Parcel.obtain();
4959 data.writeInterfaceToken(IActivityManager.descriptor);
4960 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4961 reply.readException();
4962 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4963 reply.recycle();
4964 data.recycle();
4965 return res;
4966 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004967
Dianne Hackborn1676c852012-09-10 14:52:30 -07004968 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004969 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004970 {
4971 Parcel data = Parcel.obtain();
4972 Parcel reply = Parcel.obtain();
4973 data.writeInterfaceToken(IActivityManager.descriptor);
4974 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004975 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004976 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004977 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004978 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004979 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004980 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004981 } else {
4982 data.writeInt(0);
4983 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004984 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4985 reply.readException();
4986 boolean res = reply.readInt() != 0;
4987 reply.recycle();
4988 data.recycle();
4989 return res;
4990 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004991
Dianne Hackborn55280a92009-05-07 15:53:46 -07004992 public boolean shutdown(int timeout) throws RemoteException
4993 {
4994 Parcel data = Parcel.obtain();
4995 Parcel reply = Parcel.obtain();
4996 data.writeInterfaceToken(IActivityManager.descriptor);
4997 data.writeInt(timeout);
4998 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4999 reply.readException();
5000 boolean res = reply.readInt() != 0;
5001 reply.recycle();
5002 data.recycle();
5003 return res;
5004 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005005
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005006 public void stopAppSwitches() throws RemoteException {
5007 Parcel data = Parcel.obtain();
5008 Parcel reply = Parcel.obtain();
5009 data.writeInterfaceToken(IActivityManager.descriptor);
5010 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
5011 reply.readException();
5012 reply.recycle();
5013 data.recycle();
5014 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005015
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005016 public void resumeAppSwitches() throws RemoteException {
5017 Parcel data = Parcel.obtain();
5018 Parcel reply = Parcel.obtain();
5019 data.writeInterfaceToken(IActivityManager.descriptor);
5020 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
5021 reply.readException();
5022 reply.recycle();
5023 data.recycle();
5024 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07005025
5026 public void addPackageDependency(String packageName) throws RemoteException {
5027 Parcel data = Parcel.obtain();
5028 Parcel reply = Parcel.obtain();
5029 data.writeInterfaceToken(IActivityManager.descriptor);
5030 data.writeString(packageName);
5031 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
5032 reply.readException();
5033 data.recycle();
5034 reply.recycle();
5035 }
5036
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005037 public void killApplicationWithAppId(String pkg, int appid, String reason)
5038 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005039 Parcel data = Parcel.obtain();
5040 Parcel reply = Parcel.obtain();
5041 data.writeInterfaceToken(IActivityManager.descriptor);
5042 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005043 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005044 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005045 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005046 reply.readException();
5047 data.recycle();
5048 reply.recycle();
5049 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005050
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07005051 public void closeSystemDialogs(String reason) throws RemoteException {
5052 Parcel data = Parcel.obtain();
5053 Parcel reply = Parcel.obtain();
5054 data.writeInterfaceToken(IActivityManager.descriptor);
5055 data.writeString(reason);
5056 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
5057 reply.readException();
5058 data.recycle();
5059 reply.recycle();
5060 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005061
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005062 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005063 throws RemoteException {
5064 Parcel data = Parcel.obtain();
5065 Parcel reply = Parcel.obtain();
5066 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005067 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005068 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
5069 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005070 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005071 data.recycle();
5072 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005073 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005074 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07005075
5076 public void killApplicationProcess(String processName, int uid) throws RemoteException {
5077 Parcel data = Parcel.obtain();
5078 Parcel reply = Parcel.obtain();
5079 data.writeInterfaceToken(IActivityManager.descriptor);
5080 data.writeString(processName);
5081 data.writeInt(uid);
5082 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
5083 reply.readException();
5084 data.recycle();
5085 reply.recycle();
5086 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005087
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07005088 public void overridePendingTransition(IBinder token, String packageName,
5089 int enterAnim, int exitAnim) throws RemoteException {
5090 Parcel data = Parcel.obtain();
5091 Parcel reply = Parcel.obtain();
5092 data.writeInterfaceToken(IActivityManager.descriptor);
5093 data.writeStrongBinder(token);
5094 data.writeString(packageName);
5095 data.writeInt(enterAnim);
5096 data.writeInt(exitAnim);
5097 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
5098 reply.readException();
5099 data.recycle();
5100 reply.recycle();
5101 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005102
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08005103 public boolean isUserAMonkey() throws RemoteException {
5104 Parcel data = Parcel.obtain();
5105 Parcel reply = Parcel.obtain();
5106 data.writeInterfaceToken(IActivityManager.descriptor);
5107 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
5108 reply.readException();
5109 boolean res = reply.readInt() != 0;
5110 data.recycle();
5111 reply.recycle();
5112 return res;
5113 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07005114
5115 public void setUserIsMonkey(boolean monkey) throws RemoteException {
5116 Parcel data = Parcel.obtain();
5117 Parcel reply = Parcel.obtain();
5118 data.writeInterfaceToken(IActivityManager.descriptor);
5119 data.writeInt(monkey ? 1 : 0);
5120 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
5121 reply.readException();
5122 data.recycle();
5123 reply.recycle();
5124 }
5125
Dianne Hackborn860755f2010-06-03 18:47:52 -07005126 public void finishHeavyWeightApp() throws RemoteException {
5127 Parcel data = Parcel.obtain();
5128 Parcel reply = Parcel.obtain();
5129 data.writeInterfaceToken(IActivityManager.descriptor);
5130 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
5131 reply.readException();
5132 data.recycle();
5133 reply.recycle();
5134 }
Craig Mautner4addfc52013-06-25 08:05:45 -07005135
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005136 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07005137 throws RemoteException {
5138 Parcel data = Parcel.obtain();
5139 Parcel reply = Parcel.obtain();
5140 data.writeInterfaceToken(IActivityManager.descriptor);
5141 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07005142 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
5143 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005144 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005145 data.recycle();
5146 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005147 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005148 }
5149
Craig Mautner233ceee2014-05-09 17:05:11 -07005150 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07005151 throws RemoteException {
5152 Parcel data = Parcel.obtain();
5153 Parcel reply = Parcel.obtain();
5154 data.writeInterfaceToken(IActivityManager.descriptor);
5155 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07005156 if (options == null) {
5157 data.writeInt(0);
5158 } else {
5159 data.writeInt(1);
5160 data.writeBundle(options.toBundle());
5161 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07005162 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07005163 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005164 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07005165 data.recycle();
5166 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005167 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07005168 }
5169
Craig Mautner233ceee2014-05-09 17:05:11 -07005170 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
5171 Parcel data = Parcel.obtain();
5172 Parcel reply = Parcel.obtain();
5173 data.writeInterfaceToken(IActivityManager.descriptor);
5174 data.writeStrongBinder(token);
5175 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
5176 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08005177 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07005178 data.recycle();
5179 reply.recycle();
5180 return options;
5181 }
5182
Daniel Sandler69a48172010-06-23 16:29:36 -04005183 public void setImmersive(IBinder token, boolean immersive)
5184 throws RemoteException {
5185 Parcel data = Parcel.obtain();
5186 Parcel reply = Parcel.obtain();
5187 data.writeInterfaceToken(IActivityManager.descriptor);
5188 data.writeStrongBinder(token);
5189 data.writeInt(immersive ? 1 : 0);
5190 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
5191 reply.readException();
5192 data.recycle();
5193 reply.recycle();
5194 }
5195
5196 public boolean isImmersive(IBinder token)
5197 throws RemoteException {
5198 Parcel data = Parcel.obtain();
5199 Parcel reply = Parcel.obtain();
5200 data.writeInterfaceToken(IActivityManager.descriptor);
5201 data.writeStrongBinder(token);
5202 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005203 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005204 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005205 data.recycle();
5206 reply.recycle();
5207 return res;
5208 }
5209
Craig Mautnerd61dc202014-07-07 11:09:11 -07005210 public boolean isTopOfTask(IBinder token) throws RemoteException {
5211 Parcel data = Parcel.obtain();
5212 Parcel reply = Parcel.obtain();
5213 data.writeInterfaceToken(IActivityManager.descriptor);
5214 data.writeStrongBinder(token);
5215 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
5216 reply.readException();
5217 boolean res = reply.readInt() == 1;
5218 data.recycle();
5219 reply.recycle();
5220 return res;
5221 }
5222
Daniel Sandler69a48172010-06-23 16:29:36 -04005223 public boolean isTopActivityImmersive()
5224 throws RemoteException {
5225 Parcel data = Parcel.obtain();
5226 Parcel reply = Parcel.obtain();
5227 data.writeInterfaceToken(IActivityManager.descriptor);
5228 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005229 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005230 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005231 data.recycle();
5232 reply.recycle();
5233 return res;
5234 }
5235
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005236 public void crashApplication(int uid, int initialPid, String packageName,
5237 String message) throws RemoteException {
5238 Parcel data = Parcel.obtain();
5239 Parcel reply = Parcel.obtain();
5240 data.writeInterfaceToken(IActivityManager.descriptor);
5241 data.writeInt(uid);
5242 data.writeInt(initialPid);
5243 data.writeString(packageName);
5244 data.writeString(message);
5245 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5246 reply.readException();
5247 data.recycle();
5248 reply.recycle();
5249 }
Andy McFadden824c5102010-07-09 16:26:57 -07005250
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005251 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005252 Parcel data = Parcel.obtain();
5253 Parcel reply = Parcel.obtain();
5254 data.writeInterfaceToken(IActivityManager.descriptor);
5255 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005256 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005257 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5258 reply.readException();
5259 String res = reply.readString();
5260 data.recycle();
5261 reply.recycle();
5262 return res;
5263 }
5264
Dianne Hackborn7e269642010-08-25 19:50:20 -07005265 public IBinder newUriPermissionOwner(String name)
5266 throws RemoteException {
5267 Parcel data = Parcel.obtain();
5268 Parcel reply = Parcel.obtain();
5269 data.writeInterfaceToken(IActivityManager.descriptor);
5270 data.writeString(name);
5271 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5272 reply.readException();
5273 IBinder res = reply.readStrongBinder();
5274 data.recycle();
5275 reply.recycle();
5276 return res;
5277 }
5278
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08005279 public IBinder getUriPermissionOwnerForActivity(IBinder activityToken) throws RemoteException {
5280 Parcel data = Parcel.obtain();
5281 Parcel reply = Parcel.obtain();
5282 data.writeInterfaceToken(IActivityManager.descriptor);
5283 data.writeStrongBinder(activityToken);
5284 mRemote.transact(GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
5285 reply.readException();
5286 IBinder res = reply.readStrongBinder();
5287 data.recycle();
5288 reply.recycle();
5289 return res;
5290 }
5291
Dianne Hackborn7e269642010-08-25 19:50:20 -07005292 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005293 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005294 Parcel data = Parcel.obtain();
5295 Parcel reply = Parcel.obtain();
5296 data.writeInterfaceToken(IActivityManager.descriptor);
5297 data.writeStrongBinder(owner);
5298 data.writeInt(fromUid);
5299 data.writeString(targetPkg);
5300 uri.writeToParcel(data, 0);
5301 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005302 data.writeInt(sourceUserId);
5303 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005304 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5305 reply.readException();
5306 data.recycle();
5307 reply.recycle();
5308 }
5309
5310 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005311 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005312 Parcel data = Parcel.obtain();
5313 Parcel reply = Parcel.obtain();
5314 data.writeInterfaceToken(IActivityManager.descriptor);
5315 data.writeStrongBinder(owner);
5316 if (uri != null) {
5317 data.writeInt(1);
5318 uri.writeToParcel(data, 0);
5319 } else {
5320 data.writeInt(0);
5321 }
5322 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005323 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005324 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5325 reply.readException();
5326 data.recycle();
5327 reply.recycle();
5328 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005329
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005330 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005331 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005332 Parcel data = Parcel.obtain();
5333 Parcel reply = Parcel.obtain();
5334 data.writeInterfaceToken(IActivityManager.descriptor);
5335 data.writeInt(callingUid);
5336 data.writeString(targetPkg);
5337 uri.writeToParcel(data, 0);
5338 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005339 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005340 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5341 reply.readException();
5342 int res = reply.readInt();
5343 data.recycle();
5344 reply.recycle();
5345 return res;
5346 }
5347
Dianne Hackborn1676c852012-09-10 14:52:30 -07005348 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005349 String path, ParcelFileDescriptor fd) throws RemoteException {
5350 Parcel data = Parcel.obtain();
5351 Parcel reply = Parcel.obtain();
5352 data.writeInterfaceToken(IActivityManager.descriptor);
5353 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005354 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005355 data.writeInt(managed ? 1 : 0);
5356 data.writeString(path);
5357 if (fd != null) {
5358 data.writeInt(1);
5359 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5360 } else {
5361 data.writeInt(0);
5362 }
5363 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5364 reply.readException();
5365 boolean res = reply.readInt() != 0;
5366 reply.recycle();
5367 data.recycle();
5368 return res;
5369 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005370
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005371 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005372 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005373 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005374 Parcel data = Parcel.obtain();
5375 Parcel reply = Parcel.obtain();
5376 data.writeInterfaceToken(IActivityManager.descriptor);
5377 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005378 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005379 data.writeTypedArray(intents, 0);
5380 data.writeStringArray(resolvedTypes);
5381 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005382 if (options != null) {
5383 data.writeInt(1);
5384 options.writeToParcel(data, 0);
5385 } else {
5386 data.writeInt(0);
5387 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005388 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005389 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5390 reply.readException();
5391 int result = reply.readInt();
5392 reply.recycle();
5393 data.recycle();
5394 return result;
5395 }
5396
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005397 public int getFrontActivityScreenCompatMode() throws RemoteException {
5398 Parcel data = Parcel.obtain();
5399 Parcel reply = Parcel.obtain();
5400 data.writeInterfaceToken(IActivityManager.descriptor);
5401 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5402 reply.readException();
5403 int mode = reply.readInt();
5404 reply.recycle();
5405 data.recycle();
5406 return mode;
5407 }
5408
5409 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5410 Parcel data = Parcel.obtain();
5411 Parcel reply = Parcel.obtain();
5412 data.writeInterfaceToken(IActivityManager.descriptor);
5413 data.writeInt(mode);
5414 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5415 reply.readException();
5416 reply.recycle();
5417 data.recycle();
5418 }
5419
5420 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5421 Parcel data = Parcel.obtain();
5422 Parcel reply = Parcel.obtain();
5423 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005424 data.writeString(packageName);
5425 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005426 reply.readException();
5427 int mode = reply.readInt();
5428 reply.recycle();
5429 data.recycle();
5430 return mode;
5431 }
5432
5433 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005434 throws RemoteException {
5435 Parcel data = Parcel.obtain();
5436 Parcel reply = Parcel.obtain();
5437 data.writeInterfaceToken(IActivityManager.descriptor);
5438 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005439 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005440 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5441 reply.readException();
5442 reply.recycle();
5443 data.recycle();
5444 }
5445
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005446 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5447 Parcel data = Parcel.obtain();
5448 Parcel reply = Parcel.obtain();
5449 data.writeInterfaceToken(IActivityManager.descriptor);
5450 data.writeString(packageName);
5451 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5452 reply.readException();
5453 boolean ask = reply.readInt() != 0;
5454 reply.recycle();
5455 data.recycle();
5456 return ask;
5457 }
5458
5459 public void setPackageAskScreenCompat(String packageName, boolean ask)
5460 throws RemoteException {
5461 Parcel data = Parcel.obtain();
5462 Parcel reply = Parcel.obtain();
5463 data.writeInterfaceToken(IActivityManager.descriptor);
5464 data.writeString(packageName);
5465 data.writeInt(ask ? 1 : 0);
5466 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5467 reply.readException();
5468 reply.recycle();
5469 data.recycle();
5470 }
5471
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005472 public boolean switchUser(int userid) throws RemoteException {
5473 Parcel data = Parcel.obtain();
5474 Parcel reply = Parcel.obtain();
5475 data.writeInterfaceToken(IActivityManager.descriptor);
5476 data.writeInt(userid);
5477 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5478 reply.readException();
5479 boolean result = reply.readInt() != 0;
5480 reply.recycle();
5481 data.recycle();
5482 return result;
5483 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005484
Kenny Guy08488bf2014-02-21 17:40:37 +00005485 public boolean startUserInBackground(int userid) throws RemoteException {
5486 Parcel data = Parcel.obtain();
5487 Parcel reply = Parcel.obtain();
5488 data.writeInterfaceToken(IActivityManager.descriptor);
5489 data.writeInt(userid);
5490 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5491 reply.readException();
5492 boolean result = reply.readInt() != 0;
5493 reply.recycle();
5494 data.recycle();
5495 return result;
5496 }
5497
Jeff Sharkeyba512352015-11-12 20:17:45 -08005498 public boolean unlockUser(int userId, byte[] token) throws RemoteException {
5499 Parcel data = Parcel.obtain();
5500 Parcel reply = Parcel.obtain();
5501 data.writeInterfaceToken(IActivityManager.descriptor);
5502 data.writeInt(userId);
5503 data.writeByteArray(token);
5504 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5505 reply.readException();
5506 boolean result = reply.readInt() != 0;
5507 reply.recycle();
5508 data.recycle();
5509 return result;
5510 }
5511
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005512 public int stopUser(int userid, boolean force, IStopUserCallback callback)
5513 throws RemoteException {
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005514 Parcel data = Parcel.obtain();
5515 Parcel reply = Parcel.obtain();
5516 data.writeInterfaceToken(IActivityManager.descriptor);
5517 data.writeInt(userid);
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005518 data.writeInt(force ? 1 : 0);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005519 data.writeStrongInterface(callback);
5520 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5521 reply.readException();
5522 int result = reply.readInt();
5523 reply.recycle();
5524 data.recycle();
5525 return result;
5526 }
5527
Amith Yamasani52f1d752012-03-28 18:19:29 -07005528 public UserInfo getCurrentUser() throws RemoteException {
5529 Parcel data = Parcel.obtain();
5530 Parcel reply = Parcel.obtain();
5531 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005532 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005533 reply.readException();
5534 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5535 reply.recycle();
5536 data.recycle();
5537 return userInfo;
5538 }
5539
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005540 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005541 Parcel data = Parcel.obtain();
5542 Parcel reply = Parcel.obtain();
5543 data.writeInterfaceToken(IActivityManager.descriptor);
5544 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005545 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005546 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5547 reply.readException();
5548 boolean result = reply.readInt() != 0;
5549 reply.recycle();
5550 data.recycle();
5551 return result;
5552 }
5553
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005554 public int[] getRunningUserIds() throws RemoteException {
5555 Parcel data = Parcel.obtain();
5556 Parcel reply = Parcel.obtain();
5557 data.writeInterfaceToken(IActivityManager.descriptor);
5558 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5559 reply.readException();
5560 int[] result = reply.createIntArray();
5561 reply.recycle();
5562 data.recycle();
5563 return result;
5564 }
5565
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005566 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005567 Parcel data = Parcel.obtain();
5568 Parcel reply = Parcel.obtain();
5569 data.writeInterfaceToken(IActivityManager.descriptor);
5570 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005571 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5572 reply.readException();
5573 boolean result = reply.readInt() != 0;
5574 reply.recycle();
5575 data.recycle();
5576 return result;
5577 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005578
Jeff Sharkeya4620792011-05-20 15:29:23 -07005579 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5580 Parcel data = Parcel.obtain();
5581 Parcel reply = Parcel.obtain();
5582 data.writeInterfaceToken(IActivityManager.descriptor);
5583 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5584 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5585 reply.readException();
5586 data.recycle();
5587 reply.recycle();
5588 }
5589
5590 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5591 Parcel data = Parcel.obtain();
5592 Parcel reply = Parcel.obtain();
5593 data.writeInterfaceToken(IActivityManager.descriptor);
5594 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5595 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5596 reply.readException();
5597 data.recycle();
5598 reply.recycle();
5599 }
5600
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005601 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005602 Parcel data = Parcel.obtain();
5603 Parcel reply = Parcel.obtain();
5604 data.writeInterfaceToken(IActivityManager.descriptor);
5605 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005606 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005607 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5608 reply.readException();
5609 data.recycle();
5610 reply.recycle();
5611 }
5612
5613 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5614 Parcel data = Parcel.obtain();
5615 Parcel reply = Parcel.obtain();
5616 data.writeInterfaceToken(IActivityManager.descriptor);
5617 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5618 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5619 reply.readException();
5620 data.recycle();
5621 reply.recycle();
5622 }
5623
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005624 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5625 Parcel data = Parcel.obtain();
5626 Parcel reply = Parcel.obtain();
5627 data.writeInterfaceToken(IActivityManager.descriptor);
5628 data.writeStrongBinder(sender.asBinder());
5629 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5630 reply.readException();
5631 boolean res = reply.readInt() != 0;
5632 data.recycle();
5633 reply.recycle();
5634 return res;
5635 }
5636
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005637 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5638 Parcel data = Parcel.obtain();
5639 Parcel reply = Parcel.obtain();
5640 data.writeInterfaceToken(IActivityManager.descriptor);
5641 data.writeStrongBinder(sender.asBinder());
5642 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5643 reply.readException();
5644 boolean res = reply.readInt() != 0;
5645 data.recycle();
5646 reply.recycle();
5647 return res;
5648 }
5649
Dianne Hackborn81038902012-11-26 17:04:09 -08005650 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5651 Parcel data = Parcel.obtain();
5652 Parcel reply = Parcel.obtain();
5653 data.writeInterfaceToken(IActivityManager.descriptor);
5654 data.writeStrongBinder(sender.asBinder());
5655 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5656 reply.readException();
5657 Intent res = reply.readInt() != 0
5658 ? Intent.CREATOR.createFromParcel(reply) : null;
5659 data.recycle();
5660 reply.recycle();
5661 return res;
5662 }
5663
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005664 public String getTagForIntentSender(IIntentSender sender, String prefix)
5665 throws RemoteException {
5666 Parcel data = Parcel.obtain();
5667 Parcel reply = Parcel.obtain();
5668 data.writeInterfaceToken(IActivityManager.descriptor);
5669 data.writeStrongBinder(sender.asBinder());
5670 data.writeString(prefix);
5671 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5672 reply.readException();
5673 String res = reply.readString();
5674 data.recycle();
5675 reply.recycle();
5676 return res;
5677 }
5678
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005679 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5680 {
5681 Parcel data = Parcel.obtain();
5682 Parcel reply = Parcel.obtain();
5683 data.writeInterfaceToken(IActivityManager.descriptor);
5684 values.writeToParcel(data, 0);
5685 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5686 reply.readException();
5687 data.recycle();
5688 reply.recycle();
5689 }
5690
Dianne Hackbornb437e092011-08-05 17:50:29 -07005691 public long[] getProcessPss(int[] pids) throws RemoteException {
5692 Parcel data = Parcel.obtain();
5693 Parcel reply = Parcel.obtain();
5694 data.writeInterfaceToken(IActivityManager.descriptor);
5695 data.writeIntArray(pids);
5696 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5697 reply.readException();
5698 long[] res = reply.createLongArray();
5699 data.recycle();
5700 reply.recycle();
5701 return res;
5702 }
5703
Dianne Hackborn661cd522011-08-22 00:26:20 -07005704 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5705 Parcel data = Parcel.obtain();
5706 Parcel reply = Parcel.obtain();
5707 data.writeInterfaceToken(IActivityManager.descriptor);
5708 TextUtils.writeToParcel(msg, data, 0);
5709 data.writeInt(always ? 1 : 0);
5710 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5711 reply.readException();
5712 data.recycle();
5713 reply.recycle();
5714 }
5715
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005716 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005717 Parcel data = Parcel.obtain();
5718 Parcel reply = Parcel.obtain();
5719 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005720 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005721 reply.readException();
5722 data.recycle();
5723 reply.recycle();
5724 }
5725
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005726 public void keyguardGoingAway(boolean disableWindowAnimations,
5727 boolean keyguardGoingToNotificationShade) throws RemoteException {
5728 Parcel data = Parcel.obtain();
5729 Parcel reply = Parcel.obtain();
5730 data.writeInterfaceToken(IActivityManager.descriptor);
5731 data.writeInt(disableWindowAnimations ? 1 : 0);
5732 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5733 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5734 reply.readException();
5735 data.recycle();
5736 reply.recycle();
5737 }
5738
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005739 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005740 throws RemoteException {
5741 Parcel data = Parcel.obtain();
5742 Parcel reply = Parcel.obtain();
5743 data.writeInterfaceToken(IActivityManager.descriptor);
5744 data.writeStrongBinder(token);
5745 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005746 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005747 reply.readException();
5748 boolean result = reply.readInt() != 0;
5749 data.recycle();
5750 reply.recycle();
5751 return result;
5752 }
5753
5754 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5755 throws RemoteException {
5756 Parcel data = Parcel.obtain();
5757 Parcel reply = Parcel.obtain();
5758 data.writeInterfaceToken(IActivityManager.descriptor);
5759 data.writeStrongBinder(token);
5760 target.writeToParcel(data, 0);
5761 data.writeInt(resultCode);
5762 if (resultData != null) {
5763 data.writeInt(1);
5764 resultData.writeToParcel(data, 0);
5765 } else {
5766 data.writeInt(0);
5767 }
5768 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5769 reply.readException();
5770 boolean result = reply.readInt() != 0;
5771 data.recycle();
5772 reply.recycle();
5773 return result;
5774 }
5775
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005776 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5777 Parcel data = Parcel.obtain();
5778 Parcel reply = Parcel.obtain();
5779 data.writeInterfaceToken(IActivityManager.descriptor);
5780 data.writeStrongBinder(activityToken);
5781 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5782 reply.readException();
5783 int result = reply.readInt();
5784 data.recycle();
5785 reply.recycle();
5786 return result;
5787 }
5788
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005789 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5790 Parcel data = Parcel.obtain();
5791 Parcel reply = Parcel.obtain();
5792 data.writeInterfaceToken(IActivityManager.descriptor);
5793 data.writeStrongBinder(activityToken);
5794 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5795 reply.readException();
5796 String result = reply.readString();
5797 data.recycle();
5798 reply.recycle();
5799 return result;
5800 }
5801
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005802 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5803 Parcel data = Parcel.obtain();
5804 Parcel reply = Parcel.obtain();
5805 data.writeInterfaceToken(IActivityManager.descriptor);
5806 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5807 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5808 reply.readException();
5809 data.recycle();
5810 reply.recycle();
5811 }
5812
5813 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5814 Parcel data = Parcel.obtain();
5815 Parcel reply = Parcel.obtain();
5816 data.writeInterfaceToken(IActivityManager.descriptor);
5817 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5818 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5819 reply.readException();
5820 data.recycle();
5821 reply.recycle();
5822 }
5823
Michal Karpinski3da5c972015-12-11 18:16:30 +00005824 public void requestBugReport(@ActivityManager.BugreportMode int bugreportType)
5825 throws RemoteException {
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005826 Parcel data = Parcel.obtain();
5827 Parcel reply = Parcel.obtain();
5828 data.writeInterfaceToken(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00005829 data.writeInt(bugreportType);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005830 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5831 reply.readException();
5832 data.recycle();
5833 reply.recycle();
5834 }
5835
Jeff Brownbd181bb2013-09-10 16:44:24 -07005836 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5837 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005838 Parcel data = Parcel.obtain();
5839 Parcel reply = Parcel.obtain();
5840 data.writeInterfaceToken(IActivityManager.descriptor);
5841 data.writeInt(pid);
5842 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005843 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005844 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5845 reply.readException();
5846 long res = reply.readInt();
5847 data.recycle();
5848 reply.recycle();
5849 return res;
5850 }
5851
Adam Skorydfc7fd72013-08-05 19:23:41 -07005852 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005853 Parcel data = Parcel.obtain();
5854 Parcel reply = Parcel.obtain();
5855 data.writeInterfaceToken(IActivityManager.descriptor);
5856 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005857 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005858 reply.readException();
5859 Bundle res = reply.readBundle();
5860 data.recycle();
5861 reply.recycle();
5862 return res;
5863 }
5864
Dianne Hackborn17f69352015-07-17 18:04:14 -07005865 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5866 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005867 Parcel data = Parcel.obtain();
5868 Parcel reply = Parcel.obtain();
5869 data.writeInterfaceToken(IActivityManager.descriptor);
5870 data.writeInt(requestType);
5871 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005872 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005873 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5874 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005875 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005876 data.recycle();
5877 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005878 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005879 }
5880
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005881 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005882 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005883 Parcel data = Parcel.obtain();
5884 Parcel reply = Parcel.obtain();
5885 data.writeInterfaceToken(IActivityManager.descriptor);
5886 data.writeStrongBinder(token);
5887 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005888 structure.writeToParcel(data, 0);
5889 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005890 if (referrer != null) {
5891 data.writeInt(1);
5892 referrer.writeToParcel(data, 0);
5893 } else {
5894 data.writeInt(0);
5895 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005896 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005897 reply.readException();
5898 data.recycle();
5899 reply.recycle();
5900 }
5901
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005902 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5903 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005904 Parcel data = Parcel.obtain();
5905 Parcel reply = Parcel.obtain();
5906 data.writeInterfaceToken(IActivityManager.descriptor);
5907 intent.writeToParcel(data, 0);
5908 data.writeInt(requestType);
5909 data.writeString(hint);
5910 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005911 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005912 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5913 reply.readException();
5914 boolean res = reply.readInt() != 0;
5915 data.recycle();
5916 reply.recycle();
5917 return res;
5918 }
5919
Dianne Hackborn17f69352015-07-17 18:04:14 -07005920 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005921 Parcel data = Parcel.obtain();
5922 Parcel reply = Parcel.obtain();
5923 data.writeInterfaceToken(IActivityManager.descriptor);
5924 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5925 reply.readException();
5926 boolean res = reply.readInt() != 0;
5927 data.recycle();
5928 reply.recycle();
5929 return res;
5930 }
5931
Dianne Hackborn17f69352015-07-17 18:04:14 -07005932 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5933 Parcel data = Parcel.obtain();
5934 Parcel reply = Parcel.obtain();
5935 data.writeInterfaceToken(IActivityManager.descriptor);
5936 data.writeStrongBinder(token);
5937 data.writeBundle(args);
5938 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5939 reply.readException();
5940 boolean res = reply.readInt() != 0;
5941 data.recycle();
5942 reply.recycle();
5943 return res;
5944 }
5945
Svetoslavaa41add2015-08-06 15:03:55 -07005946 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005947 Parcel data = Parcel.obtain();
5948 Parcel reply = Parcel.obtain();
5949 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07005950 data.writeInt(appId);
5951 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005952 data.writeString(reason);
5953 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5954 reply.readException();
5955 data.recycle();
5956 reply.recycle();
5957 }
5958
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005959 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5960 Parcel data = Parcel.obtain();
5961 Parcel reply = Parcel.obtain();
5962 data.writeInterfaceToken(IActivityManager.descriptor);
5963 data.writeStrongBinder(who);
5964 data.writeInt(allowRestart ? 1 : 0);
5965 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5966 reply.readException();
5967 data.recycle();
5968 reply.recycle();
5969 }
5970
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005971 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5972 Parcel data = Parcel.obtain();
5973 Parcel reply = Parcel.obtain();
5974 data.writeInterfaceToken(IActivityManager.descriptor);
5975 data.writeStrongBinder(token);
5976 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5977 reply.readException();
5978 data.recycle();
5979 reply.recycle();
5980 }
5981
Craig Mautner5eda9b32013-07-02 11:58:16 -07005982 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5983 Parcel data = Parcel.obtain();
5984 Parcel reply = Parcel.obtain();
5985 data.writeInterfaceToken(IActivityManager.descriptor);
5986 data.writeStrongBinder(token);
5987 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5988 reply.readException();
5989 data.recycle();
5990 reply.recycle();
5991 }
5992
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005993 public void restart() throws RemoteException {
5994 Parcel data = Parcel.obtain();
5995 Parcel reply = Parcel.obtain();
5996 data.writeInterfaceToken(IActivityManager.descriptor);
5997 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5998 reply.readException();
5999 data.recycle();
6000 reply.recycle();
6001 }
6002
Dianne Hackborn35f72be2013-09-16 10:57:39 -07006003 public void performIdleMaintenance() throws RemoteException {
6004 Parcel data = Parcel.obtain();
6005 Parcel reply = Parcel.obtain();
6006 data.writeInterfaceToken(IActivityManager.descriptor);
6007 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
6008 reply.readException();
6009 data.recycle();
6010 reply.recycle();
6011 }
6012
Todd Kennedyca4d8422015-01-15 15:19:22 -08006013 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08006014 IActivityContainerCallback callback) throws RemoteException {
6015 Parcel data = Parcel.obtain();
6016 Parcel reply = Parcel.obtain();
6017 data.writeInterfaceToken(IActivityManager.descriptor);
6018 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07006019 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08006020 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08006021 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08006022 final int result = reply.readInt();
6023 final IActivityContainer res;
6024 if (result == 1) {
6025 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6026 } else {
6027 res = null;
6028 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08006029 data.recycle();
6030 reply.recycle();
6031 return res;
6032 }
6033
Craig Mautner95da1082014-02-24 17:54:35 -08006034 public void deleteActivityContainer(IActivityContainer activityContainer)
6035 throws RemoteException {
6036 Parcel data = Parcel.obtain();
6037 Parcel reply = Parcel.obtain();
6038 data.writeInterfaceToken(IActivityManager.descriptor);
6039 data.writeStrongBinder(activityContainer.asBinder());
6040 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
6041 reply.readException();
6042 data.recycle();
6043 reply.recycle();
6044 }
6045
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04006046 public boolean startBinderTracking() throws RemoteException {
6047 Parcel data = Parcel.obtain();
6048 Parcel reply = Parcel.obtain();
6049 data.writeInterfaceToken(IActivityManager.descriptor);
6050 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
6051 reply.readException();
6052 boolean res = reply.readInt() != 0;
6053 reply.recycle();
6054 data.recycle();
6055 return res;
6056 }
6057
6058 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
6059 Parcel data = Parcel.obtain();
6060 Parcel reply = Parcel.obtain();
6061 data.writeInterfaceToken(IActivityManager.descriptor);
6062 if (fd != null) {
6063 data.writeInt(1);
6064 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
6065 } else {
6066 data.writeInt(0);
6067 }
6068 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
6069 reply.readException();
6070 boolean res = reply.readInt() != 0;
6071 reply.recycle();
6072 data.recycle();
6073 return res;
6074 }
6075
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006076 public void setVrMode(IBinder token, boolean enabled) throws RemoteException {
6077 Parcel data = Parcel.obtain();
6078 Parcel reply = Parcel.obtain();
6079 data.writeInterfaceToken(IActivityManager.descriptor);
6080 data.writeStrongBinder(token);
6081 data.writeInt(enabled ? 1 : 0);
6082 mRemote.transact(SET_VR_MODE_TRANSACTION, data, reply, 0);
6083 reply.readException();
6084 data.recycle();
6085 reply.recycle();
6086 }
6087
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006088 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08006089 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
6090 Parcel data = Parcel.obtain();
6091 Parcel reply = Parcel.obtain();
6092 data.writeInterfaceToken(IActivityManager.descriptor);
6093 data.writeInt(displayId);
6094 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
6095 reply.readException();
6096 final int result = reply.readInt();
6097 final IActivityContainer res;
6098 if (result == 1) {
6099 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6100 } else {
6101 res = null;
6102 }
6103 data.recycle();
6104 reply.recycle();
6105 return res;
6106 }
6107
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006108 @Override
6109 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08006110 throws RemoteException {
6111 Parcel data = Parcel.obtain();
6112 Parcel reply = Parcel.obtain();
6113 data.writeInterfaceToken(IActivityManager.descriptor);
6114 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006115 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08006116 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006117 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08006118 data.recycle();
6119 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006120 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08006121 }
6122
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006123 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006124 public void startLockTaskMode(int taskId) throws RemoteException {
6125 Parcel data = Parcel.obtain();
6126 Parcel reply = Parcel.obtain();
6127 data.writeInterfaceToken(IActivityManager.descriptor);
6128 data.writeInt(taskId);
6129 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
6130 reply.readException();
6131 data.recycle();
6132 reply.recycle();
6133 }
6134
6135 @Override
6136 public void startLockTaskMode(IBinder token) throws RemoteException {
6137 Parcel data = Parcel.obtain();
6138 Parcel reply = Parcel.obtain();
6139 data.writeInterfaceToken(IActivityManager.descriptor);
6140 data.writeStrongBinder(token);
6141 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
6142 reply.readException();
6143 data.recycle();
6144 reply.recycle();
6145 }
6146
6147 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006148 public void startLockTaskModeOnCurrent() throws RemoteException {
6149 Parcel data = Parcel.obtain();
6150 Parcel reply = Parcel.obtain();
6151 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006152 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006153 reply.readException();
6154 data.recycle();
6155 reply.recycle();
6156 }
6157
6158 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006159 public void stopLockTaskMode() throws RemoteException {
6160 Parcel data = Parcel.obtain();
6161 Parcel reply = Parcel.obtain();
6162 data.writeInterfaceToken(IActivityManager.descriptor);
6163 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6164 reply.readException();
6165 data.recycle();
6166 reply.recycle();
6167 }
6168
6169 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006170 public void stopLockTaskModeOnCurrent() throws RemoteException {
6171 Parcel data = Parcel.obtain();
6172 Parcel reply = Parcel.obtain();
6173 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006174 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006175 reply.readException();
6176 data.recycle();
6177 reply.recycle();
6178 }
6179
6180 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006181 public boolean isInLockTaskMode() throws RemoteException {
6182 Parcel data = Parcel.obtain();
6183 Parcel reply = Parcel.obtain();
6184 data.writeInterfaceToken(IActivityManager.descriptor);
6185 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6186 reply.readException();
6187 boolean isInLockTaskMode = reply.readInt() == 1;
6188 data.recycle();
6189 reply.recycle();
6190 return isInLockTaskMode;
6191 }
6192
Craig Mautner688b5102014-03-27 16:55:03 -07006193 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00006194 public int getLockTaskModeState() throws RemoteException {
6195 Parcel data = Parcel.obtain();
6196 Parcel reply = Parcel.obtain();
6197 data.writeInterfaceToken(IActivityManager.descriptor);
6198 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
6199 reply.readException();
6200 int lockTaskModeState = reply.readInt();
6201 data.recycle();
6202 reply.recycle();
6203 return lockTaskModeState;
6204 }
6205
6206 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07006207 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
6208 Parcel data = Parcel.obtain();
6209 Parcel reply = Parcel.obtain();
6210 data.writeInterfaceToken(IActivityManager.descriptor);
6211 data.writeStrongBinder(token);
6212 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
6213 IBinder.FLAG_ONEWAY);
6214 reply.readException();
6215 data.recycle();
6216 reply.recycle();
6217 }
6218
6219 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07006220 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07006221 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07006222 Parcel data = Parcel.obtain();
6223 Parcel reply = Parcel.obtain();
6224 data.writeInterfaceToken(IActivityManager.descriptor);
6225 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07006226 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006227 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07006228 reply.readException();
6229 data.recycle();
6230 reply.recycle();
6231 }
6232
Craig Mautneree2e45a2014-06-27 12:10:03 -07006233 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006234 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
6235 Parcel data = Parcel.obtain();
6236 Parcel reply = Parcel.obtain();
6237 data.writeInterfaceToken(IActivityManager.descriptor);
6238 data.writeInt(taskId);
6239 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006240 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006241 reply.readException();
6242 data.recycle();
6243 reply.recycle();
6244 }
6245
6246 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07006247 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006248 {
6249 Parcel data = Parcel.obtain();
6250 Parcel reply = Parcel.obtain();
6251 data.writeInterfaceToken(IActivityManager.descriptor);
6252 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006253 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006254 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006255 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006256 reply.readException();
6257 data.recycle();
6258 reply.recycle();
6259 }
6260
6261 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006262 public Rect getTaskBounds(int taskId) throws RemoteException
6263 {
6264 Parcel data = Parcel.obtain();
6265 Parcel reply = Parcel.obtain();
6266 data.writeInterfaceToken(IActivityManager.descriptor);
6267 data.writeInt(taskId);
6268 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6269 reply.readException();
6270 Rect rect = Rect.CREATOR.createFromParcel(reply);
6271 data.recycle();
6272 reply.recycle();
6273 return rect;
6274 }
6275
6276 @Override
Suprabh Shukla23593142015-11-03 17:31:15 -08006277 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException {
Craig Mautner648f69b2014-09-18 14:16:26 -07006278 Parcel data = Parcel.obtain();
6279 Parcel reply = Parcel.obtain();
6280 data.writeInterfaceToken(IActivityManager.descriptor);
6281 data.writeString(filename);
Suprabh Shukla23593142015-11-03 17:31:15 -08006282 data.writeInt(userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07006283 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6284 reply.readException();
6285 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6286 data.recycle();
6287 reply.recycle();
6288 return icon;
6289 }
6290
6291 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006292 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6293 throws RemoteException {
6294 Parcel data = Parcel.obtain();
6295 Parcel reply = Parcel.obtain();
6296 data.writeInterfaceToken(IActivityManager.descriptor);
6297 if (options == null) {
6298 data.writeInt(0);
6299 } else {
6300 data.writeInt(1);
6301 data.writeBundle(options.toBundle());
6302 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006303 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006304 reply.readException();
6305 data.recycle();
6306 reply.recycle();
6307 }
6308
6309 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006310 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006311 Parcel data = Parcel.obtain();
6312 Parcel reply = Parcel.obtain();
6313 data.writeInterfaceToken(IActivityManager.descriptor);
6314 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006315 data.writeInt(visible ? 1 : 0);
6316 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006317 reply.readException();
6318 boolean success = reply.readInt() > 0;
6319 data.recycle();
6320 reply.recycle();
6321 return success;
6322 }
6323
6324 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006325 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006326 Parcel data = Parcel.obtain();
6327 Parcel reply = Parcel.obtain();
6328 data.writeInterfaceToken(IActivityManager.descriptor);
6329 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006330 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006331 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006332 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006333 data.recycle();
6334 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006335 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006336 }
6337
6338 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006339 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006340 Parcel data = Parcel.obtain();
6341 Parcel reply = Parcel.obtain();
6342 data.writeInterfaceToken(IActivityManager.descriptor);
6343 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006344 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006345 reply.readException();
6346 data.recycle();
6347 reply.recycle();
6348 }
6349
6350 @Override
6351 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6352 Parcel data = Parcel.obtain();
6353 Parcel reply = Parcel.obtain();
6354 data.writeInterfaceToken(IActivityManager.descriptor);
6355 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006356 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006357 reply.readException();
6358 data.recycle();
6359 reply.recycle();
6360 }
6361
Craig Mautner8746a472014-07-24 15:12:54 -07006362 @Override
6363 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6364 Parcel data = Parcel.obtain();
6365 Parcel reply = Parcel.obtain();
6366 data.writeInterfaceToken(IActivityManager.descriptor);
6367 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006368 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006369 reply.readException();
6370 data.recycle();
6371 reply.recycle();
6372 }
6373
Craig Mautner6e2f3952014-09-09 14:26:41 -07006374 @Override
6375 public void bootAnimationComplete() throws RemoteException {
6376 Parcel data = Parcel.obtain();
6377 Parcel reply = Parcel.obtain();
6378 data.writeInterfaceToken(IActivityManager.descriptor);
6379 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6380 reply.readException();
6381 data.recycle();
6382 reply.recycle();
6383 }
6384
Wale Ogunwale18795a22014-12-03 11:38:33 -08006385 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006386 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6387 Parcel data = Parcel.obtain();
6388 Parcel reply = Parcel.obtain();
6389 data.writeInterfaceToken(IActivityManager.descriptor);
6390 data.writeInt(uid);
6391 data.writeByteArray(firstPacket);
6392 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6393 reply.readException();
6394 data.recycle();
6395 reply.recycle();
6396 }
6397
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006398 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006399 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6400 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006401 Parcel data = Parcel.obtain();
6402 Parcel reply = Parcel.obtain();
6403 data.writeInterfaceToken(IActivityManager.descriptor);
6404 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006405 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006406 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006407 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006408 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6409 reply.readException();
6410 data.recycle();
6411 reply.recycle();
6412 }
6413
6414 @Override
6415 public void dumpHeapFinished(String path) throws RemoteException {
6416 Parcel data = Parcel.obtain();
6417 Parcel reply = Parcel.obtain();
6418 data.writeInterfaceToken(IActivityManager.descriptor);
6419 data.writeString(path);
6420 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6421 reply.readException();
6422 data.recycle();
6423 reply.recycle();
6424 }
6425
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006426 @Override
6427 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6428 throws RemoteException {
6429 Parcel data = Parcel.obtain();
6430 Parcel reply = Parcel.obtain();
6431 data.writeInterfaceToken(IActivityManager.descriptor);
6432 data.writeStrongBinder(session.asBinder());
6433 data.writeInt(keepAwake ? 1 : 0);
6434 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6435 reply.readException();
6436 data.recycle();
6437 reply.recycle();
6438 }
6439
Craig Mautnere5600772015-04-03 21:36:37 -07006440 @Override
6441 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6442 Parcel data = Parcel.obtain();
6443 Parcel reply = Parcel.obtain();
6444 data.writeInterfaceToken(IActivityManager.descriptor);
6445 data.writeInt(userId);
6446 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006447 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006448 reply.readException();
6449 data.recycle();
6450 reply.recycle();
6451 }
6452
Dianne Hackborn1e383822015-04-10 14:02:33 -07006453 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006454 public void updateDeviceOwner(String packageName) throws RemoteException {
6455 Parcel data = Parcel.obtain();
6456 Parcel reply = Parcel.obtain();
6457 data.writeInterfaceToken(IActivityManager.descriptor);
6458 data.writeString(packageName);
6459 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6460 reply.readException();
6461 data.recycle();
6462 reply.recycle();
6463 }
6464
6465 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006466 public int getPackageProcessState(String packageName, String callingPackage)
6467 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006468 Parcel data = Parcel.obtain();
6469 Parcel reply = Parcel.obtain();
6470 data.writeInterfaceToken(IActivityManager.descriptor);
6471 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006472 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006473 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6474 reply.readException();
6475 int res = reply.readInt();
6476 data.recycle();
6477 reply.recycle();
6478 return res;
6479 }
6480
Stefan Kuhne16045c22015-06-05 07:18:06 -07006481 @Override
6482 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6483 throws RemoteException {
6484 Parcel data = Parcel.obtain();
6485 Parcel reply = Parcel.obtain();
6486 data.writeInterfaceToken(IActivityManager.descriptor);
6487 data.writeString(process);
6488 data.writeInt(userId);
6489 data.writeInt(level);
6490 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6491 reply.readException();
6492 int res = reply.readInt();
6493 data.recycle();
6494 reply.recycle();
6495 return res != 0;
6496 }
6497
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006498 @Override
6499 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6500 Parcel data = Parcel.obtain();
6501 Parcel reply = Parcel.obtain();
6502 data.writeInterfaceToken(IActivityManager.descriptor);
6503 data.writeStrongBinder(token);
6504 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6505 reply.readException();
6506 int res = reply.readInt();
6507 data.recycle();
6508 reply.recycle();
6509 return res != 0;
6510 }
6511
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006512 @Override
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006513 public void exitFreeformMode(IBinder token) throws RemoteException {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006514 Parcel data = Parcel.obtain();
6515 Parcel reply = Parcel.obtain();
6516 data.writeInterfaceToken(IActivityManager.descriptor);
6517 data.writeStrongBinder(token);
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006518 mRemote.transact(EXIT_FREEFORM_MODE_TRANSACTION, data, reply, 0);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006519 reply.readException();
6520 data.recycle();
6521 reply.recycle();
6522 }
6523
6524 @Override
6525 public int getActivityStackId(IBinder token) throws RemoteException {
6526 Parcel data = Parcel.obtain();
6527 Parcel reply = Parcel.obtain();
6528 data.writeInterfaceToken(IActivityManager.descriptor);
6529 data.writeStrongBinder(token);
6530 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6531 reply.readException();
6532 int stackId = reply.readInt();
6533 data.recycle();
6534 reply.recycle();
6535 return stackId;
6536 }
6537
Filip Gruszczynski23493322015-07-29 17:02:59 -07006538 @Override
6539 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006540 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6541 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006542 Parcel data = Parcel.obtain();
6543 Parcel reply = Parcel.obtain();
6544 data.writeInterfaceToken(IActivityManager.descriptor);
6545 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006546 writeIntArray(horizontalSizeConfiguration, data);
6547 writeIntArray(verticalSizeConfigurations, data);
6548 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006549 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6550 reply.readException();
6551 data.recycle();
6552 reply.recycle();
6553 }
6554
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006555 private static void writeIntArray(int[] array, Parcel data) {
6556 if (array == null) {
6557 data.writeInt(0);
6558 } else {
6559 data.writeInt(array.length);
6560 data.writeIntArray(array);
6561 }
6562 }
6563
Wale Ogunwale83301a92015-09-24 15:54:08 -07006564 @Override
6565 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6566 Parcel data = Parcel.obtain();
6567 Parcel reply = Parcel.obtain();
6568 data.writeInterfaceToken(IActivityManager.descriptor);
6569 data.writeInt(suppress ? 1 : 0);
6570 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6571 reply.readException();
6572 data.recycle();
6573 reply.recycle();
6574 }
6575
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006576 @Override
Wale Ogunwale9101d262016-01-15 08:56:11 -08006577 public void moveTasksToFullscreenStack(int fromStackId, boolean onTop) throws RemoteException {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006578 Parcel data = Parcel.obtain();
6579 Parcel reply = Parcel.obtain();
6580 data.writeInterfaceToken(IActivityManager.descriptor);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006581 data.writeInt(fromStackId);
Wale Ogunwale9101d262016-01-15 08:56:11 -08006582 data.writeInt(onTop ? 1 : 0);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006583 mRemote.transact(MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006584 reply.readException();
6585 data.recycle();
6586 reply.recycle();
6587 }
6588
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006589 @Override
6590 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6591 Parcel data = Parcel.obtain();
6592 Parcel reply = Parcel.obtain();
6593 data.writeInterfaceToken(IActivityManager.descriptor);
6594 data.writeInt(uid);
6595 data.writeString(packageName);
6596 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6597 reply.readException();
6598 int res = reply.readInt();
6599 data.recycle();
6600 reply.recycle();
6601 return res;
6602 }
6603
Wale Ogunwale5f986092015-12-04 15:35:38 -08006604 @Override
6605 public boolean inMultiWindowMode(IBinder token) throws RemoteException {
6606 Parcel data = Parcel.obtain();
6607 Parcel reply = Parcel.obtain();
6608 data.writeInterfaceToken(IActivityManager.descriptor);
6609 data.writeStrongBinder(token);
6610 mRemote.transact(IN_MULTI_WINDOW_MODE_TRANSACTION, data, reply, 0);
6611 reply.readException();
6612 final boolean multiWindowMode = reply.readInt() == 1 ? true : false;
6613 data.recycle();
6614 reply.recycle();
6615 return multiWindowMode;
6616 }
6617
6618 @Override
6619 public boolean inPictureInPictureMode(IBinder token) throws RemoteException {
6620 Parcel data = Parcel.obtain();
6621 Parcel reply = Parcel.obtain();
6622 data.writeInterfaceToken(IActivityManager.descriptor);
6623 data.writeStrongBinder(token);
6624 mRemote.transact(IN_PICTURE_IN_PICTURE_MODE_TRANSACTION, data, reply, 0);
6625 reply.readException();
6626 final boolean pipMode = reply.readInt() == 1 ? true : false;
6627 data.recycle();
6628 reply.recycle();
6629 return pipMode;
6630 }
6631
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006632 @Override
6633 public void enterPictureInPictureMode(IBinder token) throws RemoteException {
6634 Parcel data = Parcel.obtain();
6635 Parcel reply = Parcel.obtain();
6636 data.writeInterfaceToken(IActivityManager.descriptor);
6637 data.writeStrongBinder(token);
6638 mRemote.transact(ENTER_PICTURE_IN_PICTURE_MODE_TRANSACTION, data, reply, 0);
6639 reply.readException();
6640 data.recycle();
6641 reply.recycle();
6642 }
6643
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006644 private IBinder mRemote;
6645}