blob: 94b4e7f54ff0256a85ba2c9d86601194fa93d33b [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();
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08002801 moveTasksToFullscreenStack(stackId);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002802 reply.writeNoException();
2803 return true;
2804 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002805 case GET_APP_START_MODE_TRANSACTION: {
2806 data.enforceInterface(IActivityManager.descriptor);
2807 final int uid = data.readInt();
2808 final String pkg = data.readString();
2809 int res = getAppStartMode(uid, pkg);
2810 reply.writeNoException();
2811 reply.writeInt(res);
2812 return true;
2813 }
Wale Ogunwale5f986092015-12-04 15:35:38 -08002814 case IN_MULTI_WINDOW_MODE_TRANSACTION: {
2815 data.enforceInterface(IActivityManager.descriptor);
2816 final IBinder token = data.readStrongBinder();
2817 final boolean multiWindowMode = inMultiWindowMode(token);
2818 reply.writeNoException();
2819 reply.writeInt(multiWindowMode ? 1 : 0);
2820 return true;
2821 }
2822 case IN_PICTURE_IN_PICTURE_MODE_TRANSACTION: {
2823 data.enforceInterface(IActivityManager.descriptor);
2824 final IBinder token = data.readStrongBinder();
2825 final boolean pipMode = inPictureInPictureMode(token);
2826 reply.writeNoException();
2827 reply.writeInt(pipMode ? 1 : 0);
2828 return true;
2829 }
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002830 case ENTER_PICTURE_IN_PICTURE_MODE_TRANSACTION: {
2831 data.enforceInterface(IActivityManager.descriptor);
2832 final IBinder token = data.readStrongBinder();
2833 enterPictureInPictureMode(token);
2834 reply.writeNoException();
2835 return true;
2836 }
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002837 case SET_VR_MODE_TRANSACTION: {
2838 data.enforceInterface(IActivityManager.descriptor);
2839 final IBinder token = data.readStrongBinder();
2840 final boolean enable = data.readInt() == 1;
2841 setVrMode(token, enable);
2842 reply.writeNoException();
2843 return true;
2844 }
Christopher Tate63fec3e2015-12-11 18:35:28 -08002845 case IS_APP_FOREGROUND_TRANSACTION: {
2846 data.enforceInterface(IActivityManager.descriptor);
2847 final int userHandle = data.readInt();
2848 final boolean isForeground = isAppForeground(userHandle);
2849 reply.writeNoException();
2850 reply.writeInt(isForeground ? 1 : 0);
2851 return true;
2852 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002853 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002854
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002855 return super.onTransact(code, data, reply, flags);
2856 }
2857
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002858 private int[] readIntArray(Parcel data) {
2859 int[] smallest = null;
2860 int smallestSize = data.readInt();
2861 if (smallestSize > 0) {
2862 smallest = new int[smallestSize];
2863 data.readIntArray(smallest);
2864 }
2865 return smallest;
2866 }
2867
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002868 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002869 return this;
2870 }
2871
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002872 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2873 protected IActivityManager create() {
2874 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002875 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002876 Log.v("ActivityManager", "default service binder = " + b);
2877 }
2878 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002879 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002880 Log.v("ActivityManager", "default service = " + am);
2881 }
2882 return am;
2883 }
2884 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002885}
2886
2887class ActivityManagerProxy implements IActivityManager
2888{
2889 public ActivityManagerProxy(IBinder remote)
2890 {
2891 mRemote = remote;
2892 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002893
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002894 public IBinder asBinder()
2895 {
2896 return mRemote;
2897 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002898
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002899 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002900 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002901 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002902 Parcel data = Parcel.obtain();
2903 Parcel reply = Parcel.obtain();
2904 data.writeInterfaceToken(IActivityManager.descriptor);
2905 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002906 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002907 intent.writeToParcel(data, 0);
2908 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002909 data.writeStrongBinder(resultTo);
2910 data.writeString(resultWho);
2911 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002912 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002913 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002914 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002915 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002916 } else {
2917 data.writeInt(0);
2918 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002919 if (options != null) {
2920 data.writeInt(1);
2921 options.writeToParcel(data, 0);
2922 } else {
2923 data.writeInt(0);
2924 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002925 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2926 reply.readException();
2927 int result = reply.readInt();
2928 reply.recycle();
2929 data.recycle();
2930 return result;
2931 }
Amith Yamasani82644082012-08-03 13:09:11 -07002932
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002933 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002934 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002935 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2936 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002937 Parcel data = Parcel.obtain();
2938 Parcel reply = Parcel.obtain();
2939 data.writeInterfaceToken(IActivityManager.descriptor);
2940 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002941 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002942 intent.writeToParcel(data, 0);
2943 data.writeString(resolvedType);
2944 data.writeStrongBinder(resultTo);
2945 data.writeString(resultWho);
2946 data.writeInt(requestCode);
2947 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002948 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002949 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002950 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002951 } else {
2952 data.writeInt(0);
2953 }
2954 if (options != null) {
2955 data.writeInt(1);
2956 options.writeToParcel(data, 0);
2957 } else {
2958 data.writeInt(0);
2959 }
2960 data.writeInt(userId);
2961 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2962 reply.readException();
2963 int result = reply.readInt();
2964 reply.recycle();
2965 data.recycle();
2966 return result;
2967 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002968 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2969 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002970 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2971 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002972 Parcel data = Parcel.obtain();
2973 Parcel reply = Parcel.obtain();
2974 data.writeInterfaceToken(IActivityManager.descriptor);
2975 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2976 data.writeString(callingPackage);
2977 intent.writeToParcel(data, 0);
2978 data.writeString(resolvedType);
2979 data.writeStrongBinder(resultTo);
2980 data.writeString(resultWho);
2981 data.writeInt(requestCode);
2982 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002983 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002984 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002985 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002986 } else {
2987 data.writeInt(0);
2988 }
2989 if (options != null) {
2990 data.writeInt(1);
2991 options.writeToParcel(data, 0);
2992 } else {
2993 data.writeInt(0);
2994 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002995 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002996 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002997 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2998 reply.readException();
2999 int result = reply.readInt();
3000 reply.recycle();
3001 data.recycle();
3002 return result;
3003 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003004 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
3005 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07003006 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
3007 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003008 Parcel data = Parcel.obtain();
3009 Parcel reply = Parcel.obtain();
3010 data.writeInterfaceToken(IActivityManager.descriptor);
3011 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003012 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003013 intent.writeToParcel(data, 0);
3014 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003015 data.writeStrongBinder(resultTo);
3016 data.writeString(resultWho);
3017 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003018 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003019 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003020 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003021 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003022 } else {
3023 data.writeInt(0);
3024 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07003025 if (options != null) {
3026 data.writeInt(1);
3027 options.writeToParcel(data, 0);
3028 } else {
3029 data.writeInt(0);
3030 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003031 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003032 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
3033 reply.readException();
3034 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
3035 reply.recycle();
3036 data.recycle();
3037 return result;
3038 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003039 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
3040 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003041 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07003042 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003043 Parcel data = Parcel.obtain();
3044 Parcel reply = Parcel.obtain();
3045 data.writeInterfaceToken(IActivityManager.descriptor);
3046 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003047 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003048 intent.writeToParcel(data, 0);
3049 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003050 data.writeStrongBinder(resultTo);
3051 data.writeString(resultWho);
3052 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003053 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003054 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003055 if (options != null) {
3056 data.writeInt(1);
3057 options.writeToParcel(data, 0);
3058 } else {
3059 data.writeInt(0);
3060 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003061 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003062 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
3063 reply.readException();
3064 int result = reply.readInt();
3065 reply.recycle();
3066 data.recycle();
3067 return result;
3068 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003069 public int startActivityIntentSender(IApplicationThread caller,
3070 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003071 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003072 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003073 Parcel data = Parcel.obtain();
3074 Parcel reply = Parcel.obtain();
3075 data.writeInterfaceToken(IActivityManager.descriptor);
3076 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3077 intent.writeToParcel(data, 0);
3078 if (fillInIntent != null) {
3079 data.writeInt(1);
3080 fillInIntent.writeToParcel(data, 0);
3081 } else {
3082 data.writeInt(0);
3083 }
3084 data.writeString(resolvedType);
3085 data.writeStrongBinder(resultTo);
3086 data.writeString(resultWho);
3087 data.writeInt(requestCode);
3088 data.writeInt(flagsMask);
3089 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003090 if (options != null) {
3091 data.writeInt(1);
3092 options.writeToParcel(data, 0);
3093 } else {
3094 data.writeInt(0);
3095 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003096 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003097 reply.readException();
3098 int result = reply.readInt();
3099 reply.recycle();
3100 data.recycle();
3101 return result;
3102 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07003103 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
3104 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07003105 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
3106 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003107 Parcel data = Parcel.obtain();
3108 Parcel reply = Parcel.obtain();
3109 data.writeInterfaceToken(IActivityManager.descriptor);
3110 data.writeString(callingPackage);
3111 data.writeInt(callingPid);
3112 data.writeInt(callingUid);
3113 intent.writeToParcel(data, 0);
3114 data.writeString(resolvedType);
3115 data.writeStrongBinder(session.asBinder());
3116 data.writeStrongBinder(interactor.asBinder());
3117 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003118 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003119 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003120 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07003121 } else {
3122 data.writeInt(0);
3123 }
3124 if (options != null) {
3125 data.writeInt(1);
3126 options.writeToParcel(data, 0);
3127 } else {
3128 data.writeInt(0);
3129 }
3130 data.writeInt(userId);
3131 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3132 reply.readException();
3133 int result = reply.readInt();
3134 reply.recycle();
3135 data.recycle();
3136 return result;
3137 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003138 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003139 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003140 Parcel data = Parcel.obtain();
3141 Parcel reply = Parcel.obtain();
3142 data.writeInterfaceToken(IActivityManager.descriptor);
3143 data.writeStrongBinder(callingActivity);
3144 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003145 if (options != null) {
3146 data.writeInt(1);
3147 options.writeToParcel(data, 0);
3148 } else {
3149 data.writeInt(0);
3150 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003151 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3152 reply.readException();
3153 int result = reply.readInt();
3154 reply.recycle();
3155 data.recycle();
3156 return result != 0;
3157 }
Wale Ogunwale854809c2015-12-27 16:18:19 -08003158 public int startActivityFromRecents(int taskId, Bundle options)
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003159 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003160 Parcel data = Parcel.obtain();
3161 Parcel reply = Parcel.obtain();
3162 data.writeInterfaceToken(IActivityManager.descriptor);
3163 data.writeInt(taskId);
3164 if (options == null) {
3165 data.writeInt(0);
3166 } else {
3167 data.writeInt(1);
3168 options.writeToParcel(data, 0);
3169 }
3170 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3171 reply.readException();
3172 int result = reply.readInt();
3173 reply.recycle();
3174 data.recycle();
3175 return result;
3176 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003177 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003178 throws RemoteException {
3179 Parcel data = Parcel.obtain();
3180 Parcel reply = Parcel.obtain();
3181 data.writeInterfaceToken(IActivityManager.descriptor);
3182 data.writeStrongBinder(token);
3183 data.writeInt(resultCode);
3184 if (resultData != null) {
3185 data.writeInt(1);
3186 resultData.writeToParcel(data, 0);
3187 } else {
3188 data.writeInt(0);
3189 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003190 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003191 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3192 reply.readException();
3193 boolean res = reply.readInt() != 0;
3194 data.recycle();
3195 reply.recycle();
3196 return res;
3197 }
3198 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3199 {
3200 Parcel data = Parcel.obtain();
3201 Parcel reply = Parcel.obtain();
3202 data.writeInterfaceToken(IActivityManager.descriptor);
3203 data.writeStrongBinder(token);
3204 data.writeString(resultWho);
3205 data.writeInt(requestCode);
3206 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3207 reply.readException();
3208 data.recycle();
3209 reply.recycle();
3210 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003211 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3212 Parcel data = Parcel.obtain();
3213 Parcel reply = Parcel.obtain();
3214 data.writeInterfaceToken(IActivityManager.descriptor);
3215 data.writeStrongBinder(token);
3216 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3217 reply.readException();
3218 boolean res = reply.readInt() != 0;
3219 data.recycle();
3220 reply.recycle();
3221 return res;
3222 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003223 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3224 Parcel data = Parcel.obtain();
3225 Parcel reply = Parcel.obtain();
3226 data.writeInterfaceToken(IActivityManager.descriptor);
3227 data.writeStrongBinder(session.asBinder());
3228 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3229 reply.readException();
3230 data.recycle();
3231 reply.recycle();
3232 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003233 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3234 Parcel data = Parcel.obtain();
3235 Parcel reply = Parcel.obtain();
3236 data.writeInterfaceToken(IActivityManager.descriptor);
3237 data.writeStrongBinder(token);
3238 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3239 reply.readException();
3240 boolean res = reply.readInt() != 0;
3241 data.recycle();
3242 reply.recycle();
3243 return res;
3244 }
3245 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3246 Parcel data = Parcel.obtain();
3247 Parcel reply = Parcel.obtain();
3248 data.writeInterfaceToken(IActivityManager.descriptor);
3249 data.writeStrongBinder(app.asBinder());
3250 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3251 reply.readException();
3252 data.recycle();
3253 reply.recycle();
3254 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003255 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3256 Parcel data = Parcel.obtain();
3257 Parcel reply = Parcel.obtain();
3258 data.writeInterfaceToken(IActivityManager.descriptor);
3259 data.writeStrongBinder(token);
3260 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3261 reply.readException();
3262 boolean res = reply.readInt() != 0;
3263 data.recycle();
3264 reply.recycle();
3265 return res;
3266 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003267 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003268 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003269 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003270 {
3271 Parcel data = Parcel.obtain();
3272 Parcel reply = Parcel.obtain();
3273 data.writeInterfaceToken(IActivityManager.descriptor);
3274 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003275 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003276 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3277 filter.writeToParcel(data, 0);
3278 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003279 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003280 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3281 reply.readException();
3282 Intent intent = null;
3283 int haveIntent = reply.readInt();
3284 if (haveIntent != 0) {
3285 intent = Intent.CREATOR.createFromParcel(reply);
3286 }
3287 reply.recycle();
3288 data.recycle();
3289 return intent;
3290 }
3291 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3292 {
3293 Parcel data = Parcel.obtain();
3294 Parcel reply = Parcel.obtain();
3295 data.writeInterfaceToken(IActivityManager.descriptor);
3296 data.writeStrongBinder(receiver.asBinder());
3297 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3298 reply.readException();
3299 data.recycle();
3300 reply.recycle();
3301 }
3302 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003303 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003304 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003305 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003306 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003307 {
3308 Parcel data = Parcel.obtain();
3309 Parcel reply = Parcel.obtain();
3310 data.writeInterfaceToken(IActivityManager.descriptor);
3311 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3312 intent.writeToParcel(data, 0);
3313 data.writeString(resolvedType);
3314 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3315 data.writeInt(resultCode);
3316 data.writeString(resultData);
3317 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003318 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003319 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003320 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003321 data.writeInt(serialized ? 1 : 0);
3322 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003323 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003324 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3325 reply.readException();
3326 int res = reply.readInt();
3327 reply.recycle();
3328 data.recycle();
3329 return res;
3330 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003331 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3332 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003333 {
3334 Parcel data = Parcel.obtain();
3335 Parcel reply = Parcel.obtain();
3336 data.writeInterfaceToken(IActivityManager.descriptor);
3337 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3338 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003339 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003340 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3341 reply.readException();
3342 data.recycle();
3343 reply.recycle();
3344 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003345 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3346 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003347 {
3348 Parcel data = Parcel.obtain();
3349 Parcel reply = Parcel.obtain();
3350 data.writeInterfaceToken(IActivityManager.descriptor);
3351 data.writeStrongBinder(who);
3352 data.writeInt(resultCode);
3353 data.writeString(resultData);
3354 data.writeBundle(map);
3355 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003356 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003357 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3358 reply.readException();
3359 data.recycle();
3360 reply.recycle();
3361 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003362 public void attachApplication(IApplicationThread app) throws RemoteException
3363 {
3364 Parcel data = Parcel.obtain();
3365 Parcel reply = Parcel.obtain();
3366 data.writeInterfaceToken(IActivityManager.descriptor);
3367 data.writeStrongBinder(app.asBinder());
3368 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3369 reply.readException();
3370 data.recycle();
3371 reply.recycle();
3372 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003373 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3374 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003375 {
3376 Parcel data = Parcel.obtain();
3377 Parcel reply = Parcel.obtain();
3378 data.writeInterfaceToken(IActivityManager.descriptor);
3379 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003380 if (config != null) {
3381 data.writeInt(1);
3382 config.writeToParcel(data, 0);
3383 } else {
3384 data.writeInt(0);
3385 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003386 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003387 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3388 reply.readException();
3389 data.recycle();
3390 reply.recycle();
3391 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003392 public void activityResumed(IBinder token) throws RemoteException
3393 {
3394 Parcel data = Parcel.obtain();
3395 Parcel reply = Parcel.obtain();
3396 data.writeInterfaceToken(IActivityManager.descriptor);
3397 data.writeStrongBinder(token);
3398 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3399 reply.readException();
3400 data.recycle();
3401 reply.recycle();
3402 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003403 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003404 {
3405 Parcel data = Parcel.obtain();
3406 Parcel reply = Parcel.obtain();
3407 data.writeInterfaceToken(IActivityManager.descriptor);
3408 data.writeStrongBinder(token);
3409 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3410 reply.readException();
3411 data.recycle();
3412 reply.recycle();
3413 }
3414 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003415 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003416 {
3417 Parcel data = Parcel.obtain();
3418 Parcel reply = Parcel.obtain();
3419 data.writeInterfaceToken(IActivityManager.descriptor);
3420 data.writeStrongBinder(token);
3421 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003422 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003423 TextUtils.writeToParcel(description, data, 0);
3424 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3425 reply.readException();
3426 data.recycle();
3427 reply.recycle();
3428 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003429 public void activitySlept(IBinder token) throws RemoteException
3430 {
3431 Parcel data = Parcel.obtain();
3432 Parcel reply = Parcel.obtain();
3433 data.writeInterfaceToken(IActivityManager.descriptor);
3434 data.writeStrongBinder(token);
3435 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3436 reply.readException();
3437 data.recycle();
3438 reply.recycle();
3439 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003440 public void activityDestroyed(IBinder token) throws RemoteException
3441 {
3442 Parcel data = Parcel.obtain();
3443 Parcel reply = Parcel.obtain();
3444 data.writeInterfaceToken(IActivityManager.descriptor);
3445 data.writeStrongBinder(token);
3446 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3447 reply.readException();
3448 data.recycle();
3449 reply.recycle();
3450 }
Jorim Jaggife89d122015-12-22 16:28:44 +01003451 public void activityRelaunched(IBinder token) throws RemoteException
3452 {
3453 Parcel data = Parcel.obtain();
3454 Parcel reply = Parcel.obtain();
3455 data.writeInterfaceToken(IActivityManager.descriptor);
3456 data.writeStrongBinder(token);
3457 mRemote.transact(ACTIVITY_RELAUNCHED_TRANSACTION, data, reply, 0);
3458 reply.readException();
3459 data.recycle();
3460 reply.recycle();
3461 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003462 public String getCallingPackage(IBinder token) throws RemoteException
3463 {
3464 Parcel data = Parcel.obtain();
3465 Parcel reply = Parcel.obtain();
3466 data.writeInterfaceToken(IActivityManager.descriptor);
3467 data.writeStrongBinder(token);
3468 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3469 reply.readException();
3470 String res = reply.readString();
3471 data.recycle();
3472 reply.recycle();
3473 return res;
3474 }
3475 public ComponentName getCallingActivity(IBinder token)
3476 throws RemoteException {
3477 Parcel data = Parcel.obtain();
3478 Parcel reply = Parcel.obtain();
3479 data.writeInterfaceToken(IActivityManager.descriptor);
3480 data.writeStrongBinder(token);
3481 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3482 reply.readException();
3483 ComponentName res = ComponentName.readFromParcel(reply);
3484 data.recycle();
3485 reply.recycle();
3486 return res;
3487 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003488 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003489 Parcel data = Parcel.obtain();
3490 Parcel reply = Parcel.obtain();
3491 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003492 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003493 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3494 reply.readException();
3495 ArrayList<IAppTask> list = null;
3496 int N = reply.readInt();
3497 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003498 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003499 while (N > 0) {
3500 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3501 list.add(task);
3502 N--;
3503 }
3504 }
3505 data.recycle();
3506 reply.recycle();
3507 return list;
3508 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003509 public int addAppTask(IBinder activityToken, Intent intent,
3510 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3511 Parcel data = Parcel.obtain();
3512 Parcel reply = Parcel.obtain();
3513 data.writeInterfaceToken(IActivityManager.descriptor);
3514 data.writeStrongBinder(activityToken);
3515 intent.writeToParcel(data, 0);
3516 description.writeToParcel(data, 0);
3517 thumbnail.writeToParcel(data, 0);
3518 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3519 reply.readException();
3520 int res = reply.readInt();
3521 data.recycle();
3522 reply.recycle();
3523 return res;
3524 }
3525 public Point getAppTaskThumbnailSize() throws RemoteException {
3526 Parcel data = Parcel.obtain();
3527 Parcel reply = Parcel.obtain();
3528 data.writeInterfaceToken(IActivityManager.descriptor);
3529 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3530 reply.readException();
3531 Point size = Point.CREATOR.createFromParcel(reply);
3532 data.recycle();
3533 reply.recycle();
3534 return size;
3535 }
Todd Kennedye635f662015-01-20 10:36:49 -08003536 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3537 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003538 Parcel data = Parcel.obtain();
3539 Parcel reply = Parcel.obtain();
3540 data.writeInterfaceToken(IActivityManager.descriptor);
3541 data.writeInt(maxNum);
3542 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003543 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3544 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003545 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003546 int N = reply.readInt();
3547 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003548 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003549 while (N > 0) {
3550 ActivityManager.RunningTaskInfo info =
3551 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003552 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003553 list.add(info);
3554 N--;
3555 }
3556 }
3557 data.recycle();
3558 reply.recycle();
3559 return list;
3560 }
3561 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003562 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003563 Parcel data = Parcel.obtain();
3564 Parcel reply = Parcel.obtain();
3565 data.writeInterfaceToken(IActivityManager.descriptor);
3566 data.writeInt(maxNum);
3567 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003568 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003569 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3570 reply.readException();
3571 ArrayList<ActivityManager.RecentTaskInfo> list
3572 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3573 data.recycle();
3574 reply.recycle();
3575 return list;
3576 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003577 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003578 Parcel data = Parcel.obtain();
3579 Parcel reply = Parcel.obtain();
3580 data.writeInterfaceToken(IActivityManager.descriptor);
3581 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003582 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003583 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003584 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003585 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003586 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003587 }
3588 data.recycle();
3589 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003590 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003591 }
Todd Kennedye635f662015-01-20 10:36:49 -08003592 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3593 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003594 Parcel data = Parcel.obtain();
3595 Parcel reply = Parcel.obtain();
3596 data.writeInterfaceToken(IActivityManager.descriptor);
3597 data.writeInt(maxNum);
3598 data.writeInt(flags);
3599 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3600 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003601 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003602 int N = reply.readInt();
3603 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003604 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003605 while (N > 0) {
3606 ActivityManager.RunningServiceInfo info =
3607 ActivityManager.RunningServiceInfo.CREATOR
3608 .createFromParcel(reply);
3609 list.add(info);
3610 N--;
3611 }
3612 }
3613 data.recycle();
3614 reply.recycle();
3615 return list;
3616 }
3617 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3618 throws RemoteException {
3619 Parcel data = Parcel.obtain();
3620 Parcel reply = Parcel.obtain();
3621 data.writeInterfaceToken(IActivityManager.descriptor);
3622 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3623 reply.readException();
3624 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3625 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3626 data.recycle();
3627 reply.recycle();
3628 return list;
3629 }
3630 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3631 throws RemoteException {
3632 Parcel data = Parcel.obtain();
3633 Parcel reply = Parcel.obtain();
3634 data.writeInterfaceToken(IActivityManager.descriptor);
3635 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3636 reply.readException();
3637 ArrayList<ActivityManager.RunningAppProcessInfo> list
3638 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3639 data.recycle();
3640 reply.recycle();
3641 return list;
3642 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003643 public List<ApplicationInfo> getRunningExternalApplications()
3644 throws RemoteException {
3645 Parcel data = Parcel.obtain();
3646 Parcel reply = Parcel.obtain();
3647 data.writeInterfaceToken(IActivityManager.descriptor);
3648 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3649 reply.readException();
3650 ArrayList<ApplicationInfo> list
3651 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3652 data.recycle();
3653 reply.recycle();
3654 return list;
3655 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003656 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003657 {
3658 Parcel data = Parcel.obtain();
3659 Parcel reply = Parcel.obtain();
3660 data.writeInterfaceToken(IActivityManager.descriptor);
3661 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003662 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003663 if (options != null) {
3664 data.writeInt(1);
3665 options.writeToParcel(data, 0);
3666 } else {
3667 data.writeInt(0);
3668 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003669 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3670 reply.readException();
3671 data.recycle();
3672 reply.recycle();
3673 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003674 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3675 throws RemoteException {
3676 Parcel data = Parcel.obtain();
3677 Parcel reply = Parcel.obtain();
3678 data.writeInterfaceToken(IActivityManager.descriptor);
3679 data.writeStrongBinder(token);
3680 data.writeInt(nonRoot ? 1 : 0);
3681 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3682 reply.readException();
3683 boolean res = reply.readInt() != 0;
3684 data.recycle();
3685 reply.recycle();
3686 return res;
3687 }
3688 public void moveTaskBackwards(int task) throws RemoteException
3689 {
3690 Parcel data = Parcel.obtain();
3691 Parcel reply = Parcel.obtain();
3692 data.writeInterfaceToken(IActivityManager.descriptor);
3693 data.writeInt(task);
3694 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3695 reply.readException();
3696 data.recycle();
3697 reply.recycle();
3698 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003699 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003700 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3701 {
3702 Parcel data = Parcel.obtain();
3703 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003704 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003705 data.writeInt(taskId);
3706 data.writeInt(stackId);
3707 data.writeInt(toTop ? 1 : 0);
3708 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3709 reply.readException();
3710 data.recycle();
3711 reply.recycle();
3712 }
3713 @Override
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003714 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
3715 Rect initialBounds) throws RemoteException
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003716 {
3717 Parcel data = Parcel.obtain();
3718 Parcel reply = Parcel.obtain();
3719 data.writeInterfaceToken(IActivityManager.descriptor);
3720 data.writeInt(taskId);
3721 data.writeInt(createMode);
3722 data.writeInt(toTop ? 1 : 0);
Jorim Jaggi030979c2015-11-20 15:14:43 -08003723 data.writeInt(animate ? 1 : 0);
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003724 if (initialBounds != null) {
3725 data.writeInt(1);
3726 initialBounds.writeToParcel(data, 0);
3727 } else {
3728 data.writeInt(0);
3729 }
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003730 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3731 reply.readException();
3732 data.recycle();
3733 reply.recycle();
3734 }
3735 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003736 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3737 throws RemoteException
3738 {
3739 Parcel data = Parcel.obtain();
3740 Parcel reply = Parcel.obtain();
3741 data.writeInterfaceToken(IActivityManager.descriptor);
3742 data.writeInt(stackId);
3743 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003744 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003745 reply.readException();
3746 final boolean res = reply.readInt() != 0;
3747 data.recycle();
3748 reply.recycle();
3749 return res;
3750 }
3751 @Override
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003752 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode)
3753 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003754 {
3755 Parcel data = Parcel.obtain();
3756 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003757 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003758 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003759 if (r != null) {
3760 data.writeInt(1);
3761 r.writeToParcel(data, 0);
3762 } else {
3763 data.writeInt(0);
3764 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003765 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003766 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003767 reply.readException();
3768 data.recycle();
3769 reply.recycle();
3770 }
Craig Mautner967212c2013-04-13 21:10:58 -07003771 @Override
Jorim Jaggidc249c42015-12-15 14:57:31 -08003772 public void resizeDockedStack(Rect dockedBounds, Rect tempDockedTaskBounds,
3773 Rect tempDockedTaskInsetBounds,
3774 Rect tempOtherTaskBounds, Rect tempOtherTaskInsetBounds)
3775 throws RemoteException
3776 {
3777 Parcel data = Parcel.obtain();
3778 Parcel reply = Parcel.obtain();
3779 data.writeInterfaceToken(IActivityManager.descriptor);
3780 if (dockedBounds != null) {
3781 data.writeInt(1);
3782 dockedBounds.writeToParcel(data, 0);
3783 } else {
3784 data.writeInt(0);
3785 }
3786 if (tempDockedTaskBounds != null) {
3787 data.writeInt(1);
3788 tempDockedTaskBounds.writeToParcel(data, 0);
3789 } else {
3790 data.writeInt(0);
3791 }
3792 if (tempDockedTaskInsetBounds != null) {
3793 data.writeInt(1);
3794 tempDockedTaskInsetBounds.writeToParcel(data, 0);
3795 } else {
3796 data.writeInt(0);
3797 }
3798 if (tempOtherTaskBounds != null) {
3799 data.writeInt(1);
3800 tempOtherTaskBounds.writeToParcel(data, 0);
3801 } else {
3802 data.writeInt(0);
3803 }
3804 if (tempOtherTaskInsetBounds != null) {
3805 data.writeInt(1);
3806 tempOtherTaskInsetBounds.writeToParcel(data, 0);
3807 } else {
3808 data.writeInt(0);
3809 }
3810 mRemote.transact(RESIZE_DOCKED_STACK_TRANSACTION, data, reply, 0);
3811 reply.readException();
3812 data.recycle();
3813 reply.recycle();
3814 }
3815 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003816 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3817 {
3818 Parcel data = Parcel.obtain();
3819 Parcel reply = Parcel.obtain();
3820 data.writeInterfaceToken(IActivityManager.descriptor);
3821 data.writeInt(taskId);
3822 data.writeInt(stackId);
3823 data.writeInt(position);
3824 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3825 reply.readException();
3826 data.recycle();
3827 reply.recycle();
3828 }
3829 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003830 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003831 {
3832 Parcel data = Parcel.obtain();
3833 Parcel reply = Parcel.obtain();
3834 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003835 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003836 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003837 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003838 data.recycle();
3839 reply.recycle();
3840 return list;
3841 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003842 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003843 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003844 {
3845 Parcel data = Parcel.obtain();
3846 Parcel reply = Parcel.obtain();
3847 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003848 data.writeInt(stackId);
3849 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003850 reply.readException();
3851 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003852 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003853 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003854 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003855 }
3856 data.recycle();
3857 reply.recycle();
3858 return info;
3859 }
3860 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003861 public boolean isInHomeStack(int taskId) throws RemoteException {
3862 Parcel data = Parcel.obtain();
3863 Parcel reply = Parcel.obtain();
3864 data.writeInterfaceToken(IActivityManager.descriptor);
3865 data.writeInt(taskId);
3866 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3867 reply.readException();
3868 boolean isInHomeStack = reply.readInt() > 0;
3869 data.recycle();
3870 reply.recycle();
3871 return isInHomeStack;
3872 }
3873 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003874 public void setFocusedStack(int stackId) throws RemoteException
3875 {
3876 Parcel data = Parcel.obtain();
3877 Parcel reply = Parcel.obtain();
3878 data.writeInterfaceToken(IActivityManager.descriptor);
3879 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003880 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003881 reply.readException();
3882 data.recycle();
3883 reply.recycle();
3884 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003885 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003886 public int getFocusedStackId() throws RemoteException {
3887 Parcel data = Parcel.obtain();
3888 Parcel reply = Parcel.obtain();
3889 data.writeInterfaceToken(IActivityManager.descriptor);
3890 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3891 reply.readException();
3892 int focusedStackId = reply.readInt();
3893 data.recycle();
3894 reply.recycle();
3895 return focusedStackId;
3896 }
3897 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003898 public void setFocusedTask(int taskId) throws RemoteException
3899 {
3900 Parcel data = Parcel.obtain();
3901 Parcel reply = Parcel.obtain();
3902 data.writeInterfaceToken(IActivityManager.descriptor);
3903 data.writeInt(taskId);
3904 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3905 reply.readException();
3906 data.recycle();
3907 reply.recycle();
3908 }
3909 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003910 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3911 {
3912 Parcel data = Parcel.obtain();
3913 Parcel reply = Parcel.obtain();
3914 data.writeInterfaceToken(IActivityManager.descriptor);
3915 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003916 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003917 reply.readException();
3918 data.recycle();
3919 reply.recycle();
3920 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003921 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3922 {
3923 Parcel data = Parcel.obtain();
3924 Parcel reply = Parcel.obtain();
3925 data.writeInterfaceToken(IActivityManager.descriptor);
3926 data.writeStrongBinder(token);
3927 data.writeInt(onlyRoot ? 1 : 0);
3928 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3929 reply.readException();
3930 int res = reply.readInt();
3931 data.recycle();
3932 reply.recycle();
3933 return res;
3934 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003935 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003936 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003937 Parcel data = Parcel.obtain();
3938 Parcel reply = Parcel.obtain();
3939 data.writeInterfaceToken(IActivityManager.descriptor);
3940 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3941 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003942 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003943 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003944 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3945 reply.readException();
3946 int res = reply.readInt();
3947 ContentProviderHolder cph = null;
3948 if (res != 0) {
3949 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3950 }
3951 data.recycle();
3952 reply.recycle();
3953 return cph;
3954 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003955 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3956 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003957 Parcel data = Parcel.obtain();
3958 Parcel reply = Parcel.obtain();
3959 data.writeInterfaceToken(IActivityManager.descriptor);
3960 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003961 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003962 data.writeStrongBinder(token);
3963 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3964 reply.readException();
3965 int res = reply.readInt();
3966 ContentProviderHolder cph = null;
3967 if (res != 0) {
3968 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3969 }
3970 data.recycle();
3971 reply.recycle();
3972 return cph;
3973 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003974 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003975 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003976 {
3977 Parcel data = Parcel.obtain();
3978 Parcel reply = Parcel.obtain();
3979 data.writeInterfaceToken(IActivityManager.descriptor);
3980 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3981 data.writeTypedList(providers);
3982 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3983 reply.readException();
3984 data.recycle();
3985 reply.recycle();
3986 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003987 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3988 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003989 Parcel data = Parcel.obtain();
3990 Parcel reply = Parcel.obtain();
3991 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003992 data.writeStrongBinder(connection);
3993 data.writeInt(stable);
3994 data.writeInt(unstable);
3995 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3996 reply.readException();
3997 boolean res = reply.readInt() != 0;
3998 data.recycle();
3999 reply.recycle();
4000 return res;
4001 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004002
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004003 public void unstableProviderDied(IBinder connection) throws RemoteException {
4004 Parcel data = Parcel.obtain();
4005 Parcel reply = Parcel.obtain();
4006 data.writeInterfaceToken(IActivityManager.descriptor);
4007 data.writeStrongBinder(connection);
4008 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
4009 reply.readException();
4010 data.recycle();
4011 reply.recycle();
4012 }
4013
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004014 @Override
4015 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
4016 Parcel data = Parcel.obtain();
4017 Parcel reply = Parcel.obtain();
4018 data.writeInterfaceToken(IActivityManager.descriptor);
4019 data.writeStrongBinder(connection);
4020 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
4021 reply.readException();
4022 data.recycle();
4023 reply.recycle();
4024 }
4025
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004026 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
4027 Parcel data = Parcel.obtain();
4028 Parcel reply = Parcel.obtain();
4029 data.writeInterfaceToken(IActivityManager.descriptor);
4030 data.writeStrongBinder(connection);
4031 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004032 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4033 reply.readException();
4034 data.recycle();
4035 reply.recycle();
4036 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004037
4038 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
4039 Parcel data = Parcel.obtain();
4040 Parcel reply = Parcel.obtain();
4041 data.writeInterfaceToken(IActivityManager.descriptor);
4042 data.writeString(name);
4043 data.writeStrongBinder(token);
4044 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4045 reply.readException();
4046 data.recycle();
4047 reply.recycle();
4048 }
4049
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07004050 public PendingIntent getRunningServiceControlPanel(ComponentName service)
4051 throws RemoteException
4052 {
4053 Parcel data = Parcel.obtain();
4054 Parcel reply = Parcel.obtain();
4055 data.writeInterfaceToken(IActivityManager.descriptor);
4056 service.writeToParcel(data, 0);
4057 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
4058 reply.readException();
4059 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
4060 data.recycle();
4061 reply.recycle();
4062 return res;
4063 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004064
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004065 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07004066 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004067 {
4068 Parcel data = Parcel.obtain();
4069 Parcel reply = Parcel.obtain();
4070 data.writeInterfaceToken(IActivityManager.descriptor);
4071 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4072 service.writeToParcel(data, 0);
4073 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004074 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004075 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004076 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
4077 reply.readException();
4078 ComponentName res = ComponentName.readFromParcel(reply);
4079 data.recycle();
4080 reply.recycle();
4081 return res;
4082 }
4083 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004084 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004085 {
4086 Parcel data = Parcel.obtain();
4087 Parcel reply = Parcel.obtain();
4088 data.writeInterfaceToken(IActivityManager.descriptor);
4089 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4090 service.writeToParcel(data, 0);
4091 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004092 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004093 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
4094 reply.readException();
4095 int res = reply.readInt();
4096 reply.recycle();
4097 data.recycle();
4098 return res;
4099 }
4100 public boolean stopServiceToken(ComponentName className, IBinder token,
4101 int startId) throws RemoteException {
4102 Parcel data = Parcel.obtain();
4103 Parcel reply = Parcel.obtain();
4104 data.writeInterfaceToken(IActivityManager.descriptor);
4105 ComponentName.writeToParcel(className, data);
4106 data.writeStrongBinder(token);
4107 data.writeInt(startId);
4108 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
4109 reply.readException();
4110 boolean res = reply.readInt() != 0;
4111 data.recycle();
4112 reply.recycle();
4113 return res;
4114 }
4115 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004116 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004117 Parcel data = Parcel.obtain();
4118 Parcel reply = Parcel.obtain();
4119 data.writeInterfaceToken(IActivityManager.descriptor);
4120 ComponentName.writeToParcel(className, data);
4121 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004122 data.writeInt(id);
4123 if (notification != null) {
4124 data.writeInt(1);
4125 notification.writeToParcel(data, 0);
4126 } else {
4127 data.writeInt(0);
4128 }
4129 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004130 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
4131 reply.readException();
4132 data.recycle();
4133 reply.recycle();
4134 }
4135 public int bindService(IApplicationThread caller, IBinder token,
4136 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07004137 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004138 Parcel data = Parcel.obtain();
4139 Parcel reply = Parcel.obtain();
4140 data.writeInterfaceToken(IActivityManager.descriptor);
4141 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4142 data.writeStrongBinder(token);
4143 service.writeToParcel(data, 0);
4144 data.writeString(resolvedType);
4145 data.writeStrongBinder(connection.asBinder());
4146 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07004147 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08004148 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004149 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
4150 reply.readException();
4151 int res = reply.readInt();
4152 data.recycle();
4153 reply.recycle();
4154 return res;
4155 }
4156 public boolean unbindService(IServiceConnection connection) throws RemoteException
4157 {
4158 Parcel data = Parcel.obtain();
4159 Parcel reply = Parcel.obtain();
4160 data.writeInterfaceToken(IActivityManager.descriptor);
4161 data.writeStrongBinder(connection.asBinder());
4162 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
4163 reply.readException();
4164 boolean res = reply.readInt() != 0;
4165 data.recycle();
4166 reply.recycle();
4167 return res;
4168 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004169
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004170 public void publishService(IBinder token,
4171 Intent intent, IBinder service) throws RemoteException {
4172 Parcel data = Parcel.obtain();
4173 Parcel reply = Parcel.obtain();
4174 data.writeInterfaceToken(IActivityManager.descriptor);
4175 data.writeStrongBinder(token);
4176 intent.writeToParcel(data, 0);
4177 data.writeStrongBinder(service);
4178 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
4179 reply.readException();
4180 data.recycle();
4181 reply.recycle();
4182 }
4183
4184 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
4185 throws RemoteException {
4186 Parcel data = Parcel.obtain();
4187 Parcel reply = Parcel.obtain();
4188 data.writeInterfaceToken(IActivityManager.descriptor);
4189 data.writeStrongBinder(token);
4190 intent.writeToParcel(data, 0);
4191 data.writeInt(doRebind ? 1 : 0);
4192 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4193 reply.readException();
4194 data.recycle();
4195 reply.recycle();
4196 }
4197
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004198 public void serviceDoneExecuting(IBinder token, int type, int startId,
4199 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004200 Parcel data = Parcel.obtain();
4201 Parcel reply = Parcel.obtain();
4202 data.writeInterfaceToken(IActivityManager.descriptor);
4203 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004204 data.writeInt(type);
4205 data.writeInt(startId);
4206 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004207 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4208 reply.readException();
4209 data.recycle();
4210 reply.recycle();
4211 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004212
Svet Ganov99b60432015-06-27 13:15:22 -07004213 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4214 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004215 Parcel data = Parcel.obtain();
4216 Parcel reply = Parcel.obtain();
4217 data.writeInterfaceToken(IActivityManager.descriptor);
4218 service.writeToParcel(data, 0);
4219 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004220 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004221 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4222 reply.readException();
4223 IBinder binder = reply.readStrongBinder();
4224 reply.recycle();
4225 data.recycle();
4226 return binder;
4227 }
4228
Christopher Tate181fafa2009-05-14 11:12:14 -07004229 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4230 throws RemoteException {
4231 Parcel data = Parcel.obtain();
4232 Parcel reply = Parcel.obtain();
4233 data.writeInterfaceToken(IActivityManager.descriptor);
4234 app.writeToParcel(data, 0);
4235 data.writeInt(backupRestoreMode);
4236 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4237 reply.readException();
4238 boolean success = reply.readInt() != 0;
4239 reply.recycle();
4240 data.recycle();
4241 return success;
4242 }
4243
Christopher Tate346acb12012-10-15 19:20:25 -07004244 public void clearPendingBackup() throws RemoteException {
4245 Parcel data = Parcel.obtain();
4246 Parcel reply = Parcel.obtain();
4247 data.writeInterfaceToken(IActivityManager.descriptor);
4248 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4249 reply.recycle();
4250 data.recycle();
4251 }
4252
Christopher Tate181fafa2009-05-14 11:12:14 -07004253 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4254 Parcel data = Parcel.obtain();
4255 Parcel reply = Parcel.obtain();
4256 data.writeInterfaceToken(IActivityManager.descriptor);
4257 data.writeString(packageName);
4258 data.writeStrongBinder(agent);
4259 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4260 reply.recycle();
4261 data.recycle();
4262 }
4263
4264 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4265 Parcel data = Parcel.obtain();
4266 Parcel reply = Parcel.obtain();
4267 data.writeInterfaceToken(IActivityManager.descriptor);
4268 app.writeToParcel(data, 0);
4269 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4270 reply.readException();
4271 reply.recycle();
4272 data.recycle();
4273 }
4274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004275 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004276 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004277 IUiAutomationConnection connection, int userId, String instructionSet)
4278 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004279 Parcel data = Parcel.obtain();
4280 Parcel reply = Parcel.obtain();
4281 data.writeInterfaceToken(IActivityManager.descriptor);
4282 ComponentName.writeToParcel(className, data);
4283 data.writeString(profileFile);
4284 data.writeInt(flags);
4285 data.writeBundle(arguments);
4286 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004287 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004288 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004289 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004290 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4291 reply.readException();
4292 boolean res = reply.readInt() != 0;
4293 reply.recycle();
4294 data.recycle();
4295 return res;
4296 }
4297
4298 public void finishInstrumentation(IApplicationThread target,
4299 int resultCode, Bundle results) throws RemoteException {
4300 Parcel data = Parcel.obtain();
4301 Parcel reply = Parcel.obtain();
4302 data.writeInterfaceToken(IActivityManager.descriptor);
4303 data.writeStrongBinder(target != null ? target.asBinder() : null);
4304 data.writeInt(resultCode);
4305 data.writeBundle(results);
4306 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4307 reply.readException();
4308 data.recycle();
4309 reply.recycle();
4310 }
4311 public Configuration getConfiguration() throws RemoteException
4312 {
4313 Parcel data = Parcel.obtain();
4314 Parcel reply = Parcel.obtain();
4315 data.writeInterfaceToken(IActivityManager.descriptor);
4316 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4317 reply.readException();
4318 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4319 reply.recycle();
4320 data.recycle();
4321 return res;
4322 }
4323 public void updateConfiguration(Configuration values) throws RemoteException
4324 {
4325 Parcel data = Parcel.obtain();
4326 Parcel reply = Parcel.obtain();
4327 data.writeInterfaceToken(IActivityManager.descriptor);
4328 values.writeToParcel(data, 0);
4329 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4330 reply.readException();
4331 data.recycle();
4332 reply.recycle();
4333 }
4334 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4335 throws RemoteException {
4336 Parcel data = Parcel.obtain();
4337 Parcel reply = Parcel.obtain();
4338 data.writeInterfaceToken(IActivityManager.descriptor);
4339 data.writeStrongBinder(token);
4340 data.writeInt(requestedOrientation);
4341 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4342 reply.readException();
4343 data.recycle();
4344 reply.recycle();
4345 }
4346 public int getRequestedOrientation(IBinder token) throws RemoteException {
4347 Parcel data = Parcel.obtain();
4348 Parcel reply = Parcel.obtain();
4349 data.writeInterfaceToken(IActivityManager.descriptor);
4350 data.writeStrongBinder(token);
4351 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4352 reply.readException();
4353 int res = reply.readInt();
4354 data.recycle();
4355 reply.recycle();
4356 return res;
4357 }
4358 public ComponentName getActivityClassForToken(IBinder token)
4359 throws RemoteException {
4360 Parcel data = Parcel.obtain();
4361 Parcel reply = Parcel.obtain();
4362 data.writeInterfaceToken(IActivityManager.descriptor);
4363 data.writeStrongBinder(token);
4364 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4365 reply.readException();
4366 ComponentName res = ComponentName.readFromParcel(reply);
4367 data.recycle();
4368 reply.recycle();
4369 return res;
4370 }
4371 public String getPackageForToken(IBinder token) throws RemoteException
4372 {
4373 Parcel data = Parcel.obtain();
4374 Parcel reply = Parcel.obtain();
4375 data.writeInterfaceToken(IActivityManager.descriptor);
4376 data.writeStrongBinder(token);
4377 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4378 reply.readException();
4379 String res = reply.readString();
4380 data.recycle();
4381 reply.recycle();
4382 return res;
4383 }
4384 public IIntentSender getIntentSender(int type,
4385 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004386 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004387 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004388 Parcel data = Parcel.obtain();
4389 Parcel reply = Parcel.obtain();
4390 data.writeInterfaceToken(IActivityManager.descriptor);
4391 data.writeInt(type);
4392 data.writeString(packageName);
4393 data.writeStrongBinder(token);
4394 data.writeString(resultWho);
4395 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004396 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004397 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004398 data.writeTypedArray(intents, 0);
4399 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004400 } else {
4401 data.writeInt(0);
4402 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004403 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004404 if (options != null) {
4405 data.writeInt(1);
4406 options.writeToParcel(data, 0);
4407 } else {
4408 data.writeInt(0);
4409 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004410 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004411 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4412 reply.readException();
4413 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004414 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004415 data.recycle();
4416 reply.recycle();
4417 return res;
4418 }
4419 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4420 Parcel data = Parcel.obtain();
4421 Parcel reply = Parcel.obtain();
4422 data.writeInterfaceToken(IActivityManager.descriptor);
4423 data.writeStrongBinder(sender.asBinder());
4424 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4425 reply.readException();
4426 data.recycle();
4427 reply.recycle();
4428 }
4429 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4430 Parcel data = Parcel.obtain();
4431 Parcel reply = Parcel.obtain();
4432 data.writeInterfaceToken(IActivityManager.descriptor);
4433 data.writeStrongBinder(sender.asBinder());
4434 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4435 reply.readException();
4436 String res = reply.readString();
4437 data.recycle();
4438 reply.recycle();
4439 return res;
4440 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004441 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4442 Parcel data = Parcel.obtain();
4443 Parcel reply = Parcel.obtain();
4444 data.writeInterfaceToken(IActivityManager.descriptor);
4445 data.writeStrongBinder(sender.asBinder());
4446 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4447 reply.readException();
4448 int res = reply.readInt();
4449 data.recycle();
4450 reply.recycle();
4451 return res;
4452 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004453 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4454 boolean requireFull, String name, String callerPackage) throws RemoteException {
4455 Parcel data = Parcel.obtain();
4456 Parcel reply = Parcel.obtain();
4457 data.writeInterfaceToken(IActivityManager.descriptor);
4458 data.writeInt(callingPid);
4459 data.writeInt(callingUid);
4460 data.writeInt(userId);
4461 data.writeInt(allowAll ? 1 : 0);
4462 data.writeInt(requireFull ? 1 : 0);
4463 data.writeString(name);
4464 data.writeString(callerPackage);
4465 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4466 reply.readException();
4467 int res = reply.readInt();
4468 data.recycle();
4469 reply.recycle();
4470 return res;
4471 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004472 public void setProcessLimit(int max) throws RemoteException
4473 {
4474 Parcel data = Parcel.obtain();
4475 Parcel reply = Parcel.obtain();
4476 data.writeInterfaceToken(IActivityManager.descriptor);
4477 data.writeInt(max);
4478 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4479 reply.readException();
4480 data.recycle();
4481 reply.recycle();
4482 }
4483 public int getProcessLimit() throws RemoteException
4484 {
4485 Parcel data = Parcel.obtain();
4486 Parcel reply = Parcel.obtain();
4487 data.writeInterfaceToken(IActivityManager.descriptor);
4488 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4489 reply.readException();
4490 int res = reply.readInt();
4491 data.recycle();
4492 reply.recycle();
4493 return res;
4494 }
4495 public void setProcessForeground(IBinder token, int pid,
4496 boolean isForeground) throws RemoteException {
4497 Parcel data = Parcel.obtain();
4498 Parcel reply = Parcel.obtain();
4499 data.writeInterfaceToken(IActivityManager.descriptor);
4500 data.writeStrongBinder(token);
4501 data.writeInt(pid);
4502 data.writeInt(isForeground ? 1 : 0);
4503 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4504 reply.readException();
4505 data.recycle();
4506 reply.recycle();
4507 }
4508 public int checkPermission(String permission, int pid, int uid)
4509 throws RemoteException {
4510 Parcel data = Parcel.obtain();
4511 Parcel reply = Parcel.obtain();
4512 data.writeInterfaceToken(IActivityManager.descriptor);
4513 data.writeString(permission);
4514 data.writeInt(pid);
4515 data.writeInt(uid);
4516 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4517 reply.readException();
4518 int res = reply.readInt();
4519 data.recycle();
4520 reply.recycle();
4521 return res;
4522 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004523 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4524 throws RemoteException {
4525 Parcel data = Parcel.obtain();
4526 Parcel reply = Parcel.obtain();
4527 data.writeInterfaceToken(IActivityManager.descriptor);
4528 data.writeString(permission);
4529 data.writeInt(pid);
4530 data.writeInt(uid);
4531 data.writeStrongBinder(callerToken);
4532 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4533 reply.readException();
4534 int res = reply.readInt();
4535 data.recycle();
4536 reply.recycle();
4537 return res;
4538 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004539 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004540 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004541 Parcel data = Parcel.obtain();
4542 Parcel reply = Parcel.obtain();
4543 data.writeInterfaceToken(IActivityManager.descriptor);
4544 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004545 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004546 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004547 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4548 reply.readException();
4549 boolean res = reply.readInt() != 0;
4550 data.recycle();
4551 reply.recycle();
4552 return res;
4553 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004554 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4555 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004556 Parcel data = Parcel.obtain();
4557 Parcel reply = Parcel.obtain();
4558 data.writeInterfaceToken(IActivityManager.descriptor);
4559 uri.writeToParcel(data, 0);
4560 data.writeInt(pid);
4561 data.writeInt(uid);
4562 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004563 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004564 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004565 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4566 reply.readException();
4567 int res = reply.readInt();
4568 data.recycle();
4569 reply.recycle();
4570 return res;
4571 }
4572 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004573 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004574 Parcel data = Parcel.obtain();
4575 Parcel reply = Parcel.obtain();
4576 data.writeInterfaceToken(IActivityManager.descriptor);
4577 data.writeStrongBinder(caller.asBinder());
4578 data.writeString(targetPkg);
4579 uri.writeToParcel(data, 0);
4580 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004581 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004582 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4583 reply.readException();
4584 data.recycle();
4585 reply.recycle();
4586 }
4587 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004588 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004589 Parcel data = Parcel.obtain();
4590 Parcel reply = Parcel.obtain();
4591 data.writeInterfaceToken(IActivityManager.descriptor);
4592 data.writeStrongBinder(caller.asBinder());
4593 uri.writeToParcel(data, 0);
4594 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004595 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004596 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4597 reply.readException();
4598 data.recycle();
4599 reply.recycle();
4600 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004601
4602 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004603 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4604 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004605 Parcel data = Parcel.obtain();
4606 Parcel reply = Parcel.obtain();
4607 data.writeInterfaceToken(IActivityManager.descriptor);
4608 uri.writeToParcel(data, 0);
4609 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004610 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004611 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4612 reply.readException();
4613 data.recycle();
4614 reply.recycle();
4615 }
4616
4617 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004618 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4619 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004620 Parcel data = Parcel.obtain();
4621 Parcel reply = Parcel.obtain();
4622 data.writeInterfaceToken(IActivityManager.descriptor);
4623 uri.writeToParcel(data, 0);
4624 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004625 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004626 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4627 reply.readException();
4628 data.recycle();
4629 reply.recycle();
4630 }
4631
4632 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004633 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4634 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004635 Parcel data = Parcel.obtain();
4636 Parcel reply = Parcel.obtain();
4637 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004638 data.writeString(packageName);
4639 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004640 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4641 reply.readException();
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004642 @SuppressWarnings("unchecked")
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004643 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4644 reply);
4645 data.recycle();
4646 reply.recycle();
4647 return perms;
4648 }
4649
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004650 @Override
4651 public ParceledListSlice<UriPermission> getGrantedUriPermissions(String packageName, int userId)
4652 throws RemoteException {
4653 Parcel data = Parcel.obtain();
4654 Parcel reply = Parcel.obtain();
4655 data.writeInterfaceToken(IActivityManager.descriptor);
4656 data.writeString(packageName);
4657 data.writeInt(userId);
4658 mRemote.transact(GET_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4659 reply.readException();
4660 @SuppressWarnings("unchecked")
4661 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4662 reply);
4663 data.recycle();
4664 reply.recycle();
4665 return perms;
4666 }
4667
4668 @Override
4669 public void clearGrantedUriPermissions(String packageName, int userId) throws RemoteException {
4670 Parcel data = Parcel.obtain();
4671 Parcel reply = Parcel.obtain();
4672 data.writeInterfaceToken(IActivityManager.descriptor);
4673 data.writeString(packageName);
4674 data.writeInt(userId);
4675 mRemote.transact(CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4676 reply.readException();
4677 data.recycle();
4678 reply.recycle();
4679 }
4680
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004681 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4682 throws RemoteException {
4683 Parcel data = Parcel.obtain();
4684 Parcel reply = Parcel.obtain();
4685 data.writeInterfaceToken(IActivityManager.descriptor);
4686 data.writeStrongBinder(who.asBinder());
4687 data.writeInt(waiting ? 1 : 0);
4688 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4689 reply.readException();
4690 data.recycle();
4691 reply.recycle();
4692 }
4693 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4694 Parcel data = Parcel.obtain();
4695 Parcel reply = Parcel.obtain();
4696 data.writeInterfaceToken(IActivityManager.descriptor);
4697 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4698 reply.readException();
4699 outInfo.readFromParcel(reply);
4700 data.recycle();
4701 reply.recycle();
4702 }
4703 public void unhandledBack() throws RemoteException
4704 {
4705 Parcel data = Parcel.obtain();
4706 Parcel reply = Parcel.obtain();
4707 data.writeInterfaceToken(IActivityManager.descriptor);
4708 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4709 reply.readException();
4710 data.recycle();
4711 reply.recycle();
4712 }
4713 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4714 {
4715 Parcel data = Parcel.obtain();
4716 Parcel reply = Parcel.obtain();
4717 data.writeInterfaceToken(IActivityManager.descriptor);
4718 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4719 reply.readException();
4720 ParcelFileDescriptor pfd = null;
4721 if (reply.readInt() != 0) {
4722 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4723 }
4724 data.recycle();
4725 reply.recycle();
4726 return pfd;
4727 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004728 public void setLockScreenShown(boolean shown) throws RemoteException
4729 {
4730 Parcel data = Parcel.obtain();
4731 Parcel reply = Parcel.obtain();
4732 data.writeInterfaceToken(IActivityManager.descriptor);
4733 data.writeInt(shown ? 1 : 0);
4734 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4735 reply.readException();
4736 data.recycle();
4737 reply.recycle();
4738 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004739 public void setDebugApp(
4740 String packageName, boolean waitForDebugger, boolean persistent)
4741 throws RemoteException
4742 {
4743 Parcel data = Parcel.obtain();
4744 Parcel reply = Parcel.obtain();
4745 data.writeInterfaceToken(IActivityManager.descriptor);
4746 data.writeString(packageName);
4747 data.writeInt(waitForDebugger ? 1 : 0);
4748 data.writeInt(persistent ? 1 : 0);
4749 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4750 reply.readException();
4751 data.recycle();
4752 reply.recycle();
4753 }
4754 public void setAlwaysFinish(boolean enabled) throws RemoteException
4755 {
4756 Parcel data = Parcel.obtain();
4757 Parcel reply = Parcel.obtain();
4758 data.writeInterfaceToken(IActivityManager.descriptor);
4759 data.writeInt(enabled ? 1 : 0);
4760 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4761 reply.readException();
4762 data.recycle();
4763 reply.recycle();
4764 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004765 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004766 {
4767 Parcel data = Parcel.obtain();
4768 Parcel reply = Parcel.obtain();
4769 data.writeInterfaceToken(IActivityManager.descriptor);
4770 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004771 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004772 reply.readException();
4773 data.recycle();
4774 reply.recycle();
4775 }
4776 public void enterSafeMode() throws RemoteException {
4777 Parcel data = Parcel.obtain();
4778 data.writeInterfaceToken(IActivityManager.descriptor);
4779 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4780 data.recycle();
4781 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004782 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004783 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004784 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004785 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004786 data.writeStrongBinder(sender.asBinder());
4787 data.writeInt(sourceUid);
4788 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004789 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004790 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4791 data.recycle();
4792 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004793 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4794 throws RemoteException {
4795 Parcel data = Parcel.obtain();
4796 data.writeInterfaceToken(IActivityManager.descriptor);
4797 data.writeStrongBinder(sender.asBinder());
4798 data.writeInt(sourceUid);
4799 data.writeString(tag);
4800 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4801 data.recycle();
4802 }
4803 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4804 throws RemoteException {
4805 Parcel data = Parcel.obtain();
4806 data.writeInterfaceToken(IActivityManager.descriptor);
4807 data.writeStrongBinder(sender.asBinder());
4808 data.writeInt(sourceUid);
4809 data.writeString(tag);
4810 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4811 data.recycle();
4812 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004813 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004814 Parcel data = Parcel.obtain();
4815 Parcel reply = Parcel.obtain();
4816 data.writeInterfaceToken(IActivityManager.descriptor);
4817 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004818 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004819 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004820 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004821 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004822 boolean res = reply.readInt() != 0;
4823 data.recycle();
4824 reply.recycle();
4825 return res;
4826 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004827 @Override
4828 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4829 Parcel data = Parcel.obtain();
4830 Parcel reply = Parcel.obtain();
4831 data.writeInterfaceToken(IActivityManager.descriptor);
4832 data.writeString(reason);
4833 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4834 boolean res = reply.readInt() != 0;
4835 data.recycle();
4836 reply.recycle();
4837 return res;
4838 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004839 public boolean testIsSystemReady()
4840 {
4841 /* this base class version is never called */
4842 return true;
4843 }
Dan Egnor60d87622009-12-16 16:32:58 -08004844 public void handleApplicationCrash(IBinder app,
4845 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4846 {
4847 Parcel data = Parcel.obtain();
4848 Parcel reply = Parcel.obtain();
4849 data.writeInterfaceToken(IActivityManager.descriptor);
4850 data.writeStrongBinder(app);
4851 crashInfo.writeToParcel(data, 0);
4852 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4853 reply.readException();
4854 reply.recycle();
4855 data.recycle();
4856 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004857
Dianne Hackborn52322712014-08-26 22:47:26 -07004858 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004859 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004860 {
4861 Parcel data = Parcel.obtain();
4862 Parcel reply = Parcel.obtain();
4863 data.writeInterfaceToken(IActivityManager.descriptor);
4864 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004865 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004866 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004867 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004868 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004869 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004870 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004871 reply.recycle();
4872 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004873 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004874 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004875
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004876 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004877 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004878 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004879 {
4880 Parcel data = Parcel.obtain();
4881 Parcel reply = Parcel.obtain();
4882 data.writeInterfaceToken(IActivityManager.descriptor);
4883 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004884 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004885 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004886 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4887 reply.readException();
4888 reply.recycle();
4889 data.recycle();
4890 }
4891
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004892 public void signalPersistentProcesses(int sig) throws RemoteException {
4893 Parcel data = Parcel.obtain();
4894 Parcel reply = Parcel.obtain();
4895 data.writeInterfaceToken(IActivityManager.descriptor);
4896 data.writeInt(sig);
4897 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4898 reply.readException();
4899 data.recycle();
4900 reply.recycle();
4901 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004902
Dianne Hackborn1676c852012-09-10 14:52:30 -07004903 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004904 Parcel data = Parcel.obtain();
4905 Parcel reply = Parcel.obtain();
4906 data.writeInterfaceToken(IActivityManager.descriptor);
4907 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004908 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004909 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4910 reply.readException();
4911 data.recycle();
4912 reply.recycle();
4913 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004914
4915 public void killAllBackgroundProcesses() throws RemoteException {
4916 Parcel data = Parcel.obtain();
4917 Parcel reply = Parcel.obtain();
4918 data.writeInterfaceToken(IActivityManager.descriptor);
4919 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4920 reply.readException();
4921 data.recycle();
4922 reply.recycle();
4923 }
4924
Gustav Sennton6258dcd2015-10-30 19:25:37 +00004925 public void killPackageDependents(String packageName, int userId) throws RemoteException {
4926 Parcel data = Parcel.obtain();
4927 Parcel reply = Parcel.obtain();
4928 data.writeInterfaceToken(IActivityManager.descriptor);
4929 data.writeString(packageName);
4930 data.writeInt(userId);
4931 mRemote.transact(KILL_PACKAGE_DEPENDENTS_TRANSACTION, data, reply, 0);
4932 reply.readException();
4933 data.recycle();
4934 reply.recycle();
4935 }
4936
Dianne Hackborn1676c852012-09-10 14:52:30 -07004937 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004938 Parcel data = Parcel.obtain();
4939 Parcel reply = Parcel.obtain();
4940 data.writeInterfaceToken(IActivityManager.descriptor);
4941 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004942 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004943 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004944 reply.readException();
4945 data.recycle();
4946 reply.recycle();
4947 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004948
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004949 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4950 throws RemoteException
4951 {
4952 Parcel data = Parcel.obtain();
4953 Parcel reply = Parcel.obtain();
4954 data.writeInterfaceToken(IActivityManager.descriptor);
4955 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4956 reply.readException();
4957 outInfo.readFromParcel(reply);
4958 reply.recycle();
4959 data.recycle();
4960 }
4961
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004962 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4963 {
4964 Parcel data = Parcel.obtain();
4965 Parcel reply = Parcel.obtain();
4966 data.writeInterfaceToken(IActivityManager.descriptor);
4967 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4968 reply.readException();
4969 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4970 reply.recycle();
4971 data.recycle();
4972 return res;
4973 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004974
Dianne Hackborn1676c852012-09-10 14:52:30 -07004975 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004976 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004977 {
4978 Parcel data = Parcel.obtain();
4979 Parcel reply = Parcel.obtain();
4980 data.writeInterfaceToken(IActivityManager.descriptor);
4981 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004982 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004983 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004984 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004985 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004986 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004987 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004988 } else {
4989 data.writeInt(0);
4990 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004991 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4992 reply.readException();
4993 boolean res = reply.readInt() != 0;
4994 reply.recycle();
4995 data.recycle();
4996 return res;
4997 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004998
Dianne Hackborn55280a92009-05-07 15:53:46 -07004999 public boolean shutdown(int timeout) throws RemoteException
5000 {
5001 Parcel data = Parcel.obtain();
5002 Parcel reply = Parcel.obtain();
5003 data.writeInterfaceToken(IActivityManager.descriptor);
5004 data.writeInt(timeout);
5005 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
5006 reply.readException();
5007 boolean res = reply.readInt() != 0;
5008 reply.recycle();
5009 data.recycle();
5010 return res;
5011 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005012
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005013 public void stopAppSwitches() throws RemoteException {
5014 Parcel data = Parcel.obtain();
5015 Parcel reply = Parcel.obtain();
5016 data.writeInterfaceToken(IActivityManager.descriptor);
5017 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
5018 reply.readException();
5019 reply.recycle();
5020 data.recycle();
5021 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005022
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005023 public void resumeAppSwitches() throws RemoteException {
5024 Parcel data = Parcel.obtain();
5025 Parcel reply = Parcel.obtain();
5026 data.writeInterfaceToken(IActivityManager.descriptor);
5027 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
5028 reply.readException();
5029 reply.recycle();
5030 data.recycle();
5031 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07005032
5033 public void addPackageDependency(String packageName) throws RemoteException {
5034 Parcel data = Parcel.obtain();
5035 Parcel reply = Parcel.obtain();
5036 data.writeInterfaceToken(IActivityManager.descriptor);
5037 data.writeString(packageName);
5038 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
5039 reply.readException();
5040 data.recycle();
5041 reply.recycle();
5042 }
5043
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005044 public void killApplicationWithAppId(String pkg, int appid, String reason)
5045 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005046 Parcel data = Parcel.obtain();
5047 Parcel reply = Parcel.obtain();
5048 data.writeInterfaceToken(IActivityManager.descriptor);
5049 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005050 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005051 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005052 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005053 reply.readException();
5054 data.recycle();
5055 reply.recycle();
5056 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005057
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07005058 public void closeSystemDialogs(String reason) throws RemoteException {
5059 Parcel data = Parcel.obtain();
5060 Parcel reply = Parcel.obtain();
5061 data.writeInterfaceToken(IActivityManager.descriptor);
5062 data.writeString(reason);
5063 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
5064 reply.readException();
5065 data.recycle();
5066 reply.recycle();
5067 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005068
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005069 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005070 throws RemoteException {
5071 Parcel data = Parcel.obtain();
5072 Parcel reply = Parcel.obtain();
5073 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005074 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005075 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
5076 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005077 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005078 data.recycle();
5079 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005080 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005081 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07005082
5083 public void killApplicationProcess(String processName, int uid) throws RemoteException {
5084 Parcel data = Parcel.obtain();
5085 Parcel reply = Parcel.obtain();
5086 data.writeInterfaceToken(IActivityManager.descriptor);
5087 data.writeString(processName);
5088 data.writeInt(uid);
5089 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
5090 reply.readException();
5091 data.recycle();
5092 reply.recycle();
5093 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005094
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07005095 public void overridePendingTransition(IBinder token, String packageName,
5096 int enterAnim, int exitAnim) throws RemoteException {
5097 Parcel data = Parcel.obtain();
5098 Parcel reply = Parcel.obtain();
5099 data.writeInterfaceToken(IActivityManager.descriptor);
5100 data.writeStrongBinder(token);
5101 data.writeString(packageName);
5102 data.writeInt(enterAnim);
5103 data.writeInt(exitAnim);
5104 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
5105 reply.readException();
5106 data.recycle();
5107 reply.recycle();
5108 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005109
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08005110 public boolean isUserAMonkey() throws RemoteException {
5111 Parcel data = Parcel.obtain();
5112 Parcel reply = Parcel.obtain();
5113 data.writeInterfaceToken(IActivityManager.descriptor);
5114 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
5115 reply.readException();
5116 boolean res = reply.readInt() != 0;
5117 data.recycle();
5118 reply.recycle();
5119 return res;
5120 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07005121
5122 public void setUserIsMonkey(boolean monkey) throws RemoteException {
5123 Parcel data = Parcel.obtain();
5124 Parcel reply = Parcel.obtain();
5125 data.writeInterfaceToken(IActivityManager.descriptor);
5126 data.writeInt(monkey ? 1 : 0);
5127 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
5128 reply.readException();
5129 data.recycle();
5130 reply.recycle();
5131 }
5132
Dianne Hackborn860755f2010-06-03 18:47:52 -07005133 public void finishHeavyWeightApp() throws RemoteException {
5134 Parcel data = Parcel.obtain();
5135 Parcel reply = Parcel.obtain();
5136 data.writeInterfaceToken(IActivityManager.descriptor);
5137 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
5138 reply.readException();
5139 data.recycle();
5140 reply.recycle();
5141 }
Craig Mautner4addfc52013-06-25 08:05:45 -07005142
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005143 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07005144 throws RemoteException {
5145 Parcel data = Parcel.obtain();
5146 Parcel reply = Parcel.obtain();
5147 data.writeInterfaceToken(IActivityManager.descriptor);
5148 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07005149 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
5150 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005151 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005152 data.recycle();
5153 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005154 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005155 }
5156
Craig Mautner233ceee2014-05-09 17:05:11 -07005157 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07005158 throws RemoteException {
5159 Parcel data = Parcel.obtain();
5160 Parcel reply = Parcel.obtain();
5161 data.writeInterfaceToken(IActivityManager.descriptor);
5162 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07005163 if (options == null) {
5164 data.writeInt(0);
5165 } else {
5166 data.writeInt(1);
5167 data.writeBundle(options.toBundle());
5168 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07005169 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07005170 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005171 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07005172 data.recycle();
5173 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005174 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07005175 }
5176
Craig Mautner233ceee2014-05-09 17:05:11 -07005177 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
5178 Parcel data = Parcel.obtain();
5179 Parcel reply = Parcel.obtain();
5180 data.writeInterfaceToken(IActivityManager.descriptor);
5181 data.writeStrongBinder(token);
5182 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
5183 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08005184 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07005185 data.recycle();
5186 reply.recycle();
5187 return options;
5188 }
5189
Daniel Sandler69a48172010-06-23 16:29:36 -04005190 public void setImmersive(IBinder token, boolean immersive)
5191 throws RemoteException {
5192 Parcel data = Parcel.obtain();
5193 Parcel reply = Parcel.obtain();
5194 data.writeInterfaceToken(IActivityManager.descriptor);
5195 data.writeStrongBinder(token);
5196 data.writeInt(immersive ? 1 : 0);
5197 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
5198 reply.readException();
5199 data.recycle();
5200 reply.recycle();
5201 }
5202
5203 public boolean isImmersive(IBinder token)
5204 throws RemoteException {
5205 Parcel data = Parcel.obtain();
5206 Parcel reply = Parcel.obtain();
5207 data.writeInterfaceToken(IActivityManager.descriptor);
5208 data.writeStrongBinder(token);
5209 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005210 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005211 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005212 data.recycle();
5213 reply.recycle();
5214 return res;
5215 }
5216
Craig Mautnerd61dc202014-07-07 11:09:11 -07005217 public boolean isTopOfTask(IBinder token) throws RemoteException {
5218 Parcel data = Parcel.obtain();
5219 Parcel reply = Parcel.obtain();
5220 data.writeInterfaceToken(IActivityManager.descriptor);
5221 data.writeStrongBinder(token);
5222 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
5223 reply.readException();
5224 boolean res = reply.readInt() == 1;
5225 data.recycle();
5226 reply.recycle();
5227 return res;
5228 }
5229
Daniel Sandler69a48172010-06-23 16:29:36 -04005230 public boolean isTopActivityImmersive()
5231 throws RemoteException {
5232 Parcel data = Parcel.obtain();
5233 Parcel reply = Parcel.obtain();
5234 data.writeInterfaceToken(IActivityManager.descriptor);
5235 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005236 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005237 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005238 data.recycle();
5239 reply.recycle();
5240 return res;
5241 }
5242
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005243 public void crashApplication(int uid, int initialPid, String packageName,
5244 String message) throws RemoteException {
5245 Parcel data = Parcel.obtain();
5246 Parcel reply = Parcel.obtain();
5247 data.writeInterfaceToken(IActivityManager.descriptor);
5248 data.writeInt(uid);
5249 data.writeInt(initialPid);
5250 data.writeString(packageName);
5251 data.writeString(message);
5252 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5253 reply.readException();
5254 data.recycle();
5255 reply.recycle();
5256 }
Andy McFadden824c5102010-07-09 16:26:57 -07005257
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005258 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005259 Parcel data = Parcel.obtain();
5260 Parcel reply = Parcel.obtain();
5261 data.writeInterfaceToken(IActivityManager.descriptor);
5262 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005263 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005264 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5265 reply.readException();
5266 String res = reply.readString();
5267 data.recycle();
5268 reply.recycle();
5269 return res;
5270 }
5271
Dianne Hackborn7e269642010-08-25 19:50:20 -07005272 public IBinder newUriPermissionOwner(String name)
5273 throws RemoteException {
5274 Parcel data = Parcel.obtain();
5275 Parcel reply = Parcel.obtain();
5276 data.writeInterfaceToken(IActivityManager.descriptor);
5277 data.writeString(name);
5278 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5279 reply.readException();
5280 IBinder res = reply.readStrongBinder();
5281 data.recycle();
5282 reply.recycle();
5283 return res;
5284 }
5285
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08005286 public IBinder getUriPermissionOwnerForActivity(IBinder activityToken) throws RemoteException {
5287 Parcel data = Parcel.obtain();
5288 Parcel reply = Parcel.obtain();
5289 data.writeInterfaceToken(IActivityManager.descriptor);
5290 data.writeStrongBinder(activityToken);
5291 mRemote.transact(GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
5292 reply.readException();
5293 IBinder res = reply.readStrongBinder();
5294 data.recycle();
5295 reply.recycle();
5296 return res;
5297 }
5298
Dianne Hackborn7e269642010-08-25 19:50:20 -07005299 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005300 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005301 Parcel data = Parcel.obtain();
5302 Parcel reply = Parcel.obtain();
5303 data.writeInterfaceToken(IActivityManager.descriptor);
5304 data.writeStrongBinder(owner);
5305 data.writeInt(fromUid);
5306 data.writeString(targetPkg);
5307 uri.writeToParcel(data, 0);
5308 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005309 data.writeInt(sourceUserId);
5310 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005311 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5312 reply.readException();
5313 data.recycle();
5314 reply.recycle();
5315 }
5316
5317 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005318 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005319 Parcel data = Parcel.obtain();
5320 Parcel reply = Parcel.obtain();
5321 data.writeInterfaceToken(IActivityManager.descriptor);
5322 data.writeStrongBinder(owner);
5323 if (uri != null) {
5324 data.writeInt(1);
5325 uri.writeToParcel(data, 0);
5326 } else {
5327 data.writeInt(0);
5328 }
5329 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005330 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005331 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5332 reply.readException();
5333 data.recycle();
5334 reply.recycle();
5335 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005336
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005337 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005338 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005339 Parcel data = Parcel.obtain();
5340 Parcel reply = Parcel.obtain();
5341 data.writeInterfaceToken(IActivityManager.descriptor);
5342 data.writeInt(callingUid);
5343 data.writeString(targetPkg);
5344 uri.writeToParcel(data, 0);
5345 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005346 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005347 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5348 reply.readException();
5349 int res = reply.readInt();
5350 data.recycle();
5351 reply.recycle();
5352 return res;
5353 }
5354
Dianne Hackborn1676c852012-09-10 14:52:30 -07005355 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005356 String path, ParcelFileDescriptor fd) throws RemoteException {
5357 Parcel data = Parcel.obtain();
5358 Parcel reply = Parcel.obtain();
5359 data.writeInterfaceToken(IActivityManager.descriptor);
5360 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005361 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005362 data.writeInt(managed ? 1 : 0);
5363 data.writeString(path);
5364 if (fd != null) {
5365 data.writeInt(1);
5366 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5367 } else {
5368 data.writeInt(0);
5369 }
5370 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5371 reply.readException();
5372 boolean res = reply.readInt() != 0;
5373 reply.recycle();
5374 data.recycle();
5375 return res;
5376 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005377
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005378 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005379 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005380 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005381 Parcel data = Parcel.obtain();
5382 Parcel reply = Parcel.obtain();
5383 data.writeInterfaceToken(IActivityManager.descriptor);
5384 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005385 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005386 data.writeTypedArray(intents, 0);
5387 data.writeStringArray(resolvedTypes);
5388 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005389 if (options != null) {
5390 data.writeInt(1);
5391 options.writeToParcel(data, 0);
5392 } else {
5393 data.writeInt(0);
5394 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005395 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005396 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5397 reply.readException();
5398 int result = reply.readInt();
5399 reply.recycle();
5400 data.recycle();
5401 return result;
5402 }
5403
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005404 public int getFrontActivityScreenCompatMode() throws RemoteException {
5405 Parcel data = Parcel.obtain();
5406 Parcel reply = Parcel.obtain();
5407 data.writeInterfaceToken(IActivityManager.descriptor);
5408 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5409 reply.readException();
5410 int mode = reply.readInt();
5411 reply.recycle();
5412 data.recycle();
5413 return mode;
5414 }
5415
5416 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5417 Parcel data = Parcel.obtain();
5418 Parcel reply = Parcel.obtain();
5419 data.writeInterfaceToken(IActivityManager.descriptor);
5420 data.writeInt(mode);
5421 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5422 reply.readException();
5423 reply.recycle();
5424 data.recycle();
5425 }
5426
5427 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5428 Parcel data = Parcel.obtain();
5429 Parcel reply = Parcel.obtain();
5430 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005431 data.writeString(packageName);
5432 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005433 reply.readException();
5434 int mode = reply.readInt();
5435 reply.recycle();
5436 data.recycle();
5437 return mode;
5438 }
5439
5440 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005441 throws RemoteException {
5442 Parcel data = Parcel.obtain();
5443 Parcel reply = Parcel.obtain();
5444 data.writeInterfaceToken(IActivityManager.descriptor);
5445 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005446 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005447 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5448 reply.readException();
5449 reply.recycle();
5450 data.recycle();
5451 }
5452
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005453 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5454 Parcel data = Parcel.obtain();
5455 Parcel reply = Parcel.obtain();
5456 data.writeInterfaceToken(IActivityManager.descriptor);
5457 data.writeString(packageName);
5458 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5459 reply.readException();
5460 boolean ask = reply.readInt() != 0;
5461 reply.recycle();
5462 data.recycle();
5463 return ask;
5464 }
5465
5466 public void setPackageAskScreenCompat(String packageName, boolean ask)
5467 throws RemoteException {
5468 Parcel data = Parcel.obtain();
5469 Parcel reply = Parcel.obtain();
5470 data.writeInterfaceToken(IActivityManager.descriptor);
5471 data.writeString(packageName);
5472 data.writeInt(ask ? 1 : 0);
5473 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5474 reply.readException();
5475 reply.recycle();
5476 data.recycle();
5477 }
5478
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005479 public boolean switchUser(int userid) throws RemoteException {
5480 Parcel data = Parcel.obtain();
5481 Parcel reply = Parcel.obtain();
5482 data.writeInterfaceToken(IActivityManager.descriptor);
5483 data.writeInt(userid);
5484 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5485 reply.readException();
5486 boolean result = reply.readInt() != 0;
5487 reply.recycle();
5488 data.recycle();
5489 return result;
5490 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005491
Kenny Guy08488bf2014-02-21 17:40:37 +00005492 public boolean startUserInBackground(int userid) throws RemoteException {
5493 Parcel data = Parcel.obtain();
5494 Parcel reply = Parcel.obtain();
5495 data.writeInterfaceToken(IActivityManager.descriptor);
5496 data.writeInt(userid);
5497 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5498 reply.readException();
5499 boolean result = reply.readInt() != 0;
5500 reply.recycle();
5501 data.recycle();
5502 return result;
5503 }
5504
Jeff Sharkeyba512352015-11-12 20:17:45 -08005505 public boolean unlockUser(int userId, byte[] token) throws RemoteException {
5506 Parcel data = Parcel.obtain();
5507 Parcel reply = Parcel.obtain();
5508 data.writeInterfaceToken(IActivityManager.descriptor);
5509 data.writeInt(userId);
5510 data.writeByteArray(token);
5511 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5512 reply.readException();
5513 boolean result = reply.readInt() != 0;
5514 reply.recycle();
5515 data.recycle();
5516 return result;
5517 }
5518
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005519 public int stopUser(int userid, boolean force, IStopUserCallback callback)
5520 throws RemoteException {
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005521 Parcel data = Parcel.obtain();
5522 Parcel reply = Parcel.obtain();
5523 data.writeInterfaceToken(IActivityManager.descriptor);
5524 data.writeInt(userid);
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005525 data.writeInt(force ? 1 : 0);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005526 data.writeStrongInterface(callback);
5527 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5528 reply.readException();
5529 int result = reply.readInt();
5530 reply.recycle();
5531 data.recycle();
5532 return result;
5533 }
5534
Amith Yamasani52f1d752012-03-28 18:19:29 -07005535 public UserInfo getCurrentUser() throws RemoteException {
5536 Parcel data = Parcel.obtain();
5537 Parcel reply = Parcel.obtain();
5538 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005539 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005540 reply.readException();
5541 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5542 reply.recycle();
5543 data.recycle();
5544 return userInfo;
5545 }
5546
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005547 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005548 Parcel data = Parcel.obtain();
5549 Parcel reply = Parcel.obtain();
5550 data.writeInterfaceToken(IActivityManager.descriptor);
5551 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005552 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005553 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5554 reply.readException();
5555 boolean result = reply.readInt() != 0;
5556 reply.recycle();
5557 data.recycle();
5558 return result;
5559 }
5560
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005561 public int[] getRunningUserIds() throws RemoteException {
5562 Parcel data = Parcel.obtain();
5563 Parcel reply = Parcel.obtain();
5564 data.writeInterfaceToken(IActivityManager.descriptor);
5565 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5566 reply.readException();
5567 int[] result = reply.createIntArray();
5568 reply.recycle();
5569 data.recycle();
5570 return result;
5571 }
5572
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005573 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005574 Parcel data = Parcel.obtain();
5575 Parcel reply = Parcel.obtain();
5576 data.writeInterfaceToken(IActivityManager.descriptor);
5577 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005578 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5579 reply.readException();
5580 boolean result = reply.readInt() != 0;
5581 reply.recycle();
5582 data.recycle();
5583 return result;
5584 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005585
Jeff Sharkeya4620792011-05-20 15:29:23 -07005586 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5587 Parcel data = Parcel.obtain();
5588 Parcel reply = Parcel.obtain();
5589 data.writeInterfaceToken(IActivityManager.descriptor);
5590 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5591 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5592 reply.readException();
5593 data.recycle();
5594 reply.recycle();
5595 }
5596
5597 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5598 Parcel data = Parcel.obtain();
5599 Parcel reply = Parcel.obtain();
5600 data.writeInterfaceToken(IActivityManager.descriptor);
5601 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5602 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5603 reply.readException();
5604 data.recycle();
5605 reply.recycle();
5606 }
5607
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005608 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005609 Parcel data = Parcel.obtain();
5610 Parcel reply = Parcel.obtain();
5611 data.writeInterfaceToken(IActivityManager.descriptor);
5612 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005613 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005614 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5615 reply.readException();
5616 data.recycle();
5617 reply.recycle();
5618 }
5619
5620 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5621 Parcel data = Parcel.obtain();
5622 Parcel reply = Parcel.obtain();
5623 data.writeInterfaceToken(IActivityManager.descriptor);
5624 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5625 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5626 reply.readException();
5627 data.recycle();
5628 reply.recycle();
5629 }
5630
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005631 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5632 Parcel data = Parcel.obtain();
5633 Parcel reply = Parcel.obtain();
5634 data.writeInterfaceToken(IActivityManager.descriptor);
5635 data.writeStrongBinder(sender.asBinder());
5636 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5637 reply.readException();
5638 boolean res = reply.readInt() != 0;
5639 data.recycle();
5640 reply.recycle();
5641 return res;
5642 }
5643
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005644 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5645 Parcel data = Parcel.obtain();
5646 Parcel reply = Parcel.obtain();
5647 data.writeInterfaceToken(IActivityManager.descriptor);
5648 data.writeStrongBinder(sender.asBinder());
5649 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5650 reply.readException();
5651 boolean res = reply.readInt() != 0;
5652 data.recycle();
5653 reply.recycle();
5654 return res;
5655 }
5656
Dianne Hackborn81038902012-11-26 17:04:09 -08005657 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5658 Parcel data = Parcel.obtain();
5659 Parcel reply = Parcel.obtain();
5660 data.writeInterfaceToken(IActivityManager.descriptor);
5661 data.writeStrongBinder(sender.asBinder());
5662 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5663 reply.readException();
5664 Intent res = reply.readInt() != 0
5665 ? Intent.CREATOR.createFromParcel(reply) : null;
5666 data.recycle();
5667 reply.recycle();
5668 return res;
5669 }
5670
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005671 public String getTagForIntentSender(IIntentSender sender, String prefix)
5672 throws RemoteException {
5673 Parcel data = Parcel.obtain();
5674 Parcel reply = Parcel.obtain();
5675 data.writeInterfaceToken(IActivityManager.descriptor);
5676 data.writeStrongBinder(sender.asBinder());
5677 data.writeString(prefix);
5678 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5679 reply.readException();
5680 String res = reply.readString();
5681 data.recycle();
5682 reply.recycle();
5683 return res;
5684 }
5685
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005686 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5687 {
5688 Parcel data = Parcel.obtain();
5689 Parcel reply = Parcel.obtain();
5690 data.writeInterfaceToken(IActivityManager.descriptor);
5691 values.writeToParcel(data, 0);
5692 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5693 reply.readException();
5694 data.recycle();
5695 reply.recycle();
5696 }
5697
Dianne Hackbornb437e092011-08-05 17:50:29 -07005698 public long[] getProcessPss(int[] pids) throws RemoteException {
5699 Parcel data = Parcel.obtain();
5700 Parcel reply = Parcel.obtain();
5701 data.writeInterfaceToken(IActivityManager.descriptor);
5702 data.writeIntArray(pids);
5703 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5704 reply.readException();
5705 long[] res = reply.createLongArray();
5706 data.recycle();
5707 reply.recycle();
5708 return res;
5709 }
5710
Dianne Hackborn661cd522011-08-22 00:26:20 -07005711 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5712 Parcel data = Parcel.obtain();
5713 Parcel reply = Parcel.obtain();
5714 data.writeInterfaceToken(IActivityManager.descriptor);
5715 TextUtils.writeToParcel(msg, data, 0);
5716 data.writeInt(always ? 1 : 0);
5717 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5718 reply.readException();
5719 data.recycle();
5720 reply.recycle();
5721 }
5722
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005723 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005724 Parcel data = Parcel.obtain();
5725 Parcel reply = Parcel.obtain();
5726 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005727 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005728 reply.readException();
5729 data.recycle();
5730 reply.recycle();
5731 }
5732
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005733 public void keyguardGoingAway(boolean disableWindowAnimations,
5734 boolean keyguardGoingToNotificationShade) throws RemoteException {
5735 Parcel data = Parcel.obtain();
5736 Parcel reply = Parcel.obtain();
5737 data.writeInterfaceToken(IActivityManager.descriptor);
5738 data.writeInt(disableWindowAnimations ? 1 : 0);
5739 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5740 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5741 reply.readException();
5742 data.recycle();
5743 reply.recycle();
5744 }
5745
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005746 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005747 throws RemoteException {
5748 Parcel data = Parcel.obtain();
5749 Parcel reply = Parcel.obtain();
5750 data.writeInterfaceToken(IActivityManager.descriptor);
5751 data.writeStrongBinder(token);
5752 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005753 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005754 reply.readException();
5755 boolean result = reply.readInt() != 0;
5756 data.recycle();
5757 reply.recycle();
5758 return result;
5759 }
5760
5761 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5762 throws RemoteException {
5763 Parcel data = Parcel.obtain();
5764 Parcel reply = Parcel.obtain();
5765 data.writeInterfaceToken(IActivityManager.descriptor);
5766 data.writeStrongBinder(token);
5767 target.writeToParcel(data, 0);
5768 data.writeInt(resultCode);
5769 if (resultData != null) {
5770 data.writeInt(1);
5771 resultData.writeToParcel(data, 0);
5772 } else {
5773 data.writeInt(0);
5774 }
5775 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5776 reply.readException();
5777 boolean result = reply.readInt() != 0;
5778 data.recycle();
5779 reply.recycle();
5780 return result;
5781 }
5782
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005783 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5784 Parcel data = Parcel.obtain();
5785 Parcel reply = Parcel.obtain();
5786 data.writeInterfaceToken(IActivityManager.descriptor);
5787 data.writeStrongBinder(activityToken);
5788 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5789 reply.readException();
5790 int result = reply.readInt();
5791 data.recycle();
5792 reply.recycle();
5793 return result;
5794 }
5795
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005796 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5797 Parcel data = Parcel.obtain();
5798 Parcel reply = Parcel.obtain();
5799 data.writeInterfaceToken(IActivityManager.descriptor);
5800 data.writeStrongBinder(activityToken);
5801 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5802 reply.readException();
5803 String result = reply.readString();
5804 data.recycle();
5805 reply.recycle();
5806 return result;
5807 }
5808
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005809 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5810 Parcel data = Parcel.obtain();
5811 Parcel reply = Parcel.obtain();
5812 data.writeInterfaceToken(IActivityManager.descriptor);
5813 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5814 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5815 reply.readException();
5816 data.recycle();
5817 reply.recycle();
5818 }
5819
5820 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5821 Parcel data = Parcel.obtain();
5822 Parcel reply = Parcel.obtain();
5823 data.writeInterfaceToken(IActivityManager.descriptor);
5824 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5825 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5826 reply.readException();
5827 data.recycle();
5828 reply.recycle();
5829 }
5830
Michal Karpinski3da5c972015-12-11 18:16:30 +00005831 public void requestBugReport(@ActivityManager.BugreportMode int bugreportType)
5832 throws RemoteException {
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005833 Parcel data = Parcel.obtain();
5834 Parcel reply = Parcel.obtain();
5835 data.writeInterfaceToken(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00005836 data.writeInt(bugreportType);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005837 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5838 reply.readException();
5839 data.recycle();
5840 reply.recycle();
5841 }
5842
Jeff Brownbd181bb2013-09-10 16:44:24 -07005843 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5844 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005845 Parcel data = Parcel.obtain();
5846 Parcel reply = Parcel.obtain();
5847 data.writeInterfaceToken(IActivityManager.descriptor);
5848 data.writeInt(pid);
5849 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005850 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005851 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5852 reply.readException();
5853 long res = reply.readInt();
5854 data.recycle();
5855 reply.recycle();
5856 return res;
5857 }
5858
Adam Skorydfc7fd72013-08-05 19:23:41 -07005859 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005860 Parcel data = Parcel.obtain();
5861 Parcel reply = Parcel.obtain();
5862 data.writeInterfaceToken(IActivityManager.descriptor);
5863 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005864 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005865 reply.readException();
5866 Bundle res = reply.readBundle();
5867 data.recycle();
5868 reply.recycle();
5869 return res;
5870 }
5871
Dianne Hackborn17f69352015-07-17 18:04:14 -07005872 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5873 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005874 Parcel data = Parcel.obtain();
5875 Parcel reply = Parcel.obtain();
5876 data.writeInterfaceToken(IActivityManager.descriptor);
5877 data.writeInt(requestType);
5878 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005879 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005880 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5881 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005882 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005883 data.recycle();
5884 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005885 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005886 }
5887
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005888 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005889 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005890 Parcel data = Parcel.obtain();
5891 Parcel reply = Parcel.obtain();
5892 data.writeInterfaceToken(IActivityManager.descriptor);
5893 data.writeStrongBinder(token);
5894 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005895 structure.writeToParcel(data, 0);
5896 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005897 if (referrer != null) {
5898 data.writeInt(1);
5899 referrer.writeToParcel(data, 0);
5900 } else {
5901 data.writeInt(0);
5902 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005903 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005904 reply.readException();
5905 data.recycle();
5906 reply.recycle();
5907 }
5908
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005909 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5910 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005911 Parcel data = Parcel.obtain();
5912 Parcel reply = Parcel.obtain();
5913 data.writeInterfaceToken(IActivityManager.descriptor);
5914 intent.writeToParcel(data, 0);
5915 data.writeInt(requestType);
5916 data.writeString(hint);
5917 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005918 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005919 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5920 reply.readException();
5921 boolean res = reply.readInt() != 0;
5922 data.recycle();
5923 reply.recycle();
5924 return res;
5925 }
5926
Dianne Hackborn17f69352015-07-17 18:04:14 -07005927 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005928 Parcel data = Parcel.obtain();
5929 Parcel reply = Parcel.obtain();
5930 data.writeInterfaceToken(IActivityManager.descriptor);
5931 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5932 reply.readException();
5933 boolean res = reply.readInt() != 0;
5934 data.recycle();
5935 reply.recycle();
5936 return res;
5937 }
5938
Dianne Hackborn17f69352015-07-17 18:04:14 -07005939 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5940 Parcel data = Parcel.obtain();
5941 Parcel reply = Parcel.obtain();
5942 data.writeInterfaceToken(IActivityManager.descriptor);
5943 data.writeStrongBinder(token);
5944 data.writeBundle(args);
5945 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5946 reply.readException();
5947 boolean res = reply.readInt() != 0;
5948 data.recycle();
5949 reply.recycle();
5950 return res;
5951 }
5952
Svetoslavaa41add2015-08-06 15:03:55 -07005953 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005954 Parcel data = Parcel.obtain();
5955 Parcel reply = Parcel.obtain();
5956 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07005957 data.writeInt(appId);
5958 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005959 data.writeString(reason);
5960 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5961 reply.readException();
5962 data.recycle();
5963 reply.recycle();
5964 }
5965
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005966 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5967 Parcel data = Parcel.obtain();
5968 Parcel reply = Parcel.obtain();
5969 data.writeInterfaceToken(IActivityManager.descriptor);
5970 data.writeStrongBinder(who);
5971 data.writeInt(allowRestart ? 1 : 0);
5972 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5973 reply.readException();
5974 data.recycle();
5975 reply.recycle();
5976 }
5977
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005978 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5979 Parcel data = Parcel.obtain();
5980 Parcel reply = Parcel.obtain();
5981 data.writeInterfaceToken(IActivityManager.descriptor);
5982 data.writeStrongBinder(token);
5983 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5984 reply.readException();
5985 data.recycle();
5986 reply.recycle();
5987 }
5988
Craig Mautner5eda9b32013-07-02 11:58:16 -07005989 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5990 Parcel data = Parcel.obtain();
5991 Parcel reply = Parcel.obtain();
5992 data.writeInterfaceToken(IActivityManager.descriptor);
5993 data.writeStrongBinder(token);
5994 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5995 reply.readException();
5996 data.recycle();
5997 reply.recycle();
5998 }
5999
Dianne Hackborn57a7f592013-07-22 18:21:32 -07006000 public void restart() throws RemoteException {
6001 Parcel data = Parcel.obtain();
6002 Parcel reply = Parcel.obtain();
6003 data.writeInterfaceToken(IActivityManager.descriptor);
6004 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
6005 reply.readException();
6006 data.recycle();
6007 reply.recycle();
6008 }
6009
Dianne Hackborn35f72be2013-09-16 10:57:39 -07006010 public void performIdleMaintenance() throws RemoteException {
6011 Parcel data = Parcel.obtain();
6012 Parcel reply = Parcel.obtain();
6013 data.writeInterfaceToken(IActivityManager.descriptor);
6014 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
6015 reply.readException();
6016 data.recycle();
6017 reply.recycle();
6018 }
6019
Todd Kennedyca4d8422015-01-15 15:19:22 -08006020 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08006021 IActivityContainerCallback callback) throws RemoteException {
6022 Parcel data = Parcel.obtain();
6023 Parcel reply = Parcel.obtain();
6024 data.writeInterfaceToken(IActivityManager.descriptor);
6025 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07006026 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08006027 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08006028 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08006029 final int result = reply.readInt();
6030 final IActivityContainer res;
6031 if (result == 1) {
6032 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6033 } else {
6034 res = null;
6035 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08006036 data.recycle();
6037 reply.recycle();
6038 return res;
6039 }
6040
Craig Mautner95da1082014-02-24 17:54:35 -08006041 public void deleteActivityContainer(IActivityContainer activityContainer)
6042 throws RemoteException {
6043 Parcel data = Parcel.obtain();
6044 Parcel reply = Parcel.obtain();
6045 data.writeInterfaceToken(IActivityManager.descriptor);
6046 data.writeStrongBinder(activityContainer.asBinder());
6047 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
6048 reply.readException();
6049 data.recycle();
6050 reply.recycle();
6051 }
6052
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04006053 public boolean startBinderTracking() throws RemoteException {
6054 Parcel data = Parcel.obtain();
6055 Parcel reply = Parcel.obtain();
6056 data.writeInterfaceToken(IActivityManager.descriptor);
6057 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
6058 reply.readException();
6059 boolean res = reply.readInt() != 0;
6060 reply.recycle();
6061 data.recycle();
6062 return res;
6063 }
6064
6065 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
6066 Parcel data = Parcel.obtain();
6067 Parcel reply = Parcel.obtain();
6068 data.writeInterfaceToken(IActivityManager.descriptor);
6069 if (fd != null) {
6070 data.writeInt(1);
6071 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
6072 } else {
6073 data.writeInt(0);
6074 }
6075 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
6076 reply.readException();
6077 boolean res = reply.readInt() != 0;
6078 reply.recycle();
6079 data.recycle();
6080 return res;
6081 }
6082
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006083 public void setVrMode(IBinder token, boolean enabled) throws RemoteException {
6084 Parcel data = Parcel.obtain();
6085 Parcel reply = Parcel.obtain();
6086 data.writeInterfaceToken(IActivityManager.descriptor);
6087 data.writeStrongBinder(token);
6088 data.writeInt(enabled ? 1 : 0);
6089 mRemote.transact(SET_VR_MODE_TRANSACTION, data, reply, 0);
6090 reply.readException();
6091 data.recycle();
6092 reply.recycle();
6093 }
6094
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006095 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08006096 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
6097 Parcel data = Parcel.obtain();
6098 Parcel reply = Parcel.obtain();
6099 data.writeInterfaceToken(IActivityManager.descriptor);
6100 data.writeInt(displayId);
6101 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
6102 reply.readException();
6103 final int result = reply.readInt();
6104 final IActivityContainer res;
6105 if (result == 1) {
6106 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6107 } else {
6108 res = null;
6109 }
6110 data.recycle();
6111 reply.recycle();
6112 return res;
6113 }
6114
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006115 @Override
6116 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08006117 throws RemoteException {
6118 Parcel data = Parcel.obtain();
6119 Parcel reply = Parcel.obtain();
6120 data.writeInterfaceToken(IActivityManager.descriptor);
6121 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006122 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08006123 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006124 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08006125 data.recycle();
6126 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006127 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08006128 }
6129
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006130 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006131 public void startLockTaskMode(int taskId) throws RemoteException {
6132 Parcel data = Parcel.obtain();
6133 Parcel reply = Parcel.obtain();
6134 data.writeInterfaceToken(IActivityManager.descriptor);
6135 data.writeInt(taskId);
6136 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
6137 reply.readException();
6138 data.recycle();
6139 reply.recycle();
6140 }
6141
6142 @Override
6143 public void startLockTaskMode(IBinder token) throws RemoteException {
6144 Parcel data = Parcel.obtain();
6145 Parcel reply = Parcel.obtain();
6146 data.writeInterfaceToken(IActivityManager.descriptor);
6147 data.writeStrongBinder(token);
6148 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
6149 reply.readException();
6150 data.recycle();
6151 reply.recycle();
6152 }
6153
6154 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006155 public void startLockTaskModeOnCurrent() throws RemoteException {
6156 Parcel data = Parcel.obtain();
6157 Parcel reply = Parcel.obtain();
6158 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006159 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006160 reply.readException();
6161 data.recycle();
6162 reply.recycle();
6163 }
6164
6165 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006166 public void stopLockTaskMode() throws RemoteException {
6167 Parcel data = Parcel.obtain();
6168 Parcel reply = Parcel.obtain();
6169 data.writeInterfaceToken(IActivityManager.descriptor);
6170 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6171 reply.readException();
6172 data.recycle();
6173 reply.recycle();
6174 }
6175
6176 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006177 public void stopLockTaskModeOnCurrent() throws RemoteException {
6178 Parcel data = Parcel.obtain();
6179 Parcel reply = Parcel.obtain();
6180 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006181 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006182 reply.readException();
6183 data.recycle();
6184 reply.recycle();
6185 }
6186
6187 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006188 public boolean isInLockTaskMode() throws RemoteException {
6189 Parcel data = Parcel.obtain();
6190 Parcel reply = Parcel.obtain();
6191 data.writeInterfaceToken(IActivityManager.descriptor);
6192 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6193 reply.readException();
6194 boolean isInLockTaskMode = reply.readInt() == 1;
6195 data.recycle();
6196 reply.recycle();
6197 return isInLockTaskMode;
6198 }
6199
Craig Mautner688b5102014-03-27 16:55:03 -07006200 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00006201 public int getLockTaskModeState() throws RemoteException {
6202 Parcel data = Parcel.obtain();
6203 Parcel reply = Parcel.obtain();
6204 data.writeInterfaceToken(IActivityManager.descriptor);
6205 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
6206 reply.readException();
6207 int lockTaskModeState = reply.readInt();
6208 data.recycle();
6209 reply.recycle();
6210 return lockTaskModeState;
6211 }
6212
6213 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07006214 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
6215 Parcel data = Parcel.obtain();
6216 Parcel reply = Parcel.obtain();
6217 data.writeInterfaceToken(IActivityManager.descriptor);
6218 data.writeStrongBinder(token);
6219 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
6220 IBinder.FLAG_ONEWAY);
6221 reply.readException();
6222 data.recycle();
6223 reply.recycle();
6224 }
6225
6226 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07006227 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07006228 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07006229 Parcel data = Parcel.obtain();
6230 Parcel reply = Parcel.obtain();
6231 data.writeInterfaceToken(IActivityManager.descriptor);
6232 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07006233 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006234 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07006235 reply.readException();
6236 data.recycle();
6237 reply.recycle();
6238 }
6239
Craig Mautneree2e45a2014-06-27 12:10:03 -07006240 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006241 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
6242 Parcel data = Parcel.obtain();
6243 Parcel reply = Parcel.obtain();
6244 data.writeInterfaceToken(IActivityManager.descriptor);
6245 data.writeInt(taskId);
6246 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006247 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006248 reply.readException();
6249 data.recycle();
6250 reply.recycle();
6251 }
6252
6253 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07006254 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006255 {
6256 Parcel data = Parcel.obtain();
6257 Parcel reply = Parcel.obtain();
6258 data.writeInterfaceToken(IActivityManager.descriptor);
6259 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006260 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006261 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006262 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006263 reply.readException();
6264 data.recycle();
6265 reply.recycle();
6266 }
6267
6268 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006269 public Rect getTaskBounds(int taskId) throws RemoteException
6270 {
6271 Parcel data = Parcel.obtain();
6272 Parcel reply = Parcel.obtain();
6273 data.writeInterfaceToken(IActivityManager.descriptor);
6274 data.writeInt(taskId);
6275 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6276 reply.readException();
6277 Rect rect = Rect.CREATOR.createFromParcel(reply);
6278 data.recycle();
6279 reply.recycle();
6280 return rect;
6281 }
6282
6283 @Override
Suprabh Shukla23593142015-11-03 17:31:15 -08006284 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException {
Craig Mautner648f69b2014-09-18 14:16:26 -07006285 Parcel data = Parcel.obtain();
6286 Parcel reply = Parcel.obtain();
6287 data.writeInterfaceToken(IActivityManager.descriptor);
6288 data.writeString(filename);
Suprabh Shukla23593142015-11-03 17:31:15 -08006289 data.writeInt(userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07006290 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6291 reply.readException();
6292 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6293 data.recycle();
6294 reply.recycle();
6295 return icon;
6296 }
6297
6298 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006299 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6300 throws RemoteException {
6301 Parcel data = Parcel.obtain();
6302 Parcel reply = Parcel.obtain();
6303 data.writeInterfaceToken(IActivityManager.descriptor);
6304 if (options == null) {
6305 data.writeInt(0);
6306 } else {
6307 data.writeInt(1);
6308 data.writeBundle(options.toBundle());
6309 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006310 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006311 reply.readException();
6312 data.recycle();
6313 reply.recycle();
6314 }
6315
6316 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006317 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006318 Parcel data = Parcel.obtain();
6319 Parcel reply = Parcel.obtain();
6320 data.writeInterfaceToken(IActivityManager.descriptor);
6321 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006322 data.writeInt(visible ? 1 : 0);
6323 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006324 reply.readException();
6325 boolean success = reply.readInt() > 0;
6326 data.recycle();
6327 reply.recycle();
6328 return success;
6329 }
6330
6331 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006332 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006333 Parcel data = Parcel.obtain();
6334 Parcel reply = Parcel.obtain();
6335 data.writeInterfaceToken(IActivityManager.descriptor);
6336 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006337 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006338 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006339 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006340 data.recycle();
6341 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006342 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006343 }
6344
6345 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006346 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006347 Parcel data = Parcel.obtain();
6348 Parcel reply = Parcel.obtain();
6349 data.writeInterfaceToken(IActivityManager.descriptor);
6350 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006351 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006352 reply.readException();
6353 data.recycle();
6354 reply.recycle();
6355 }
6356
6357 @Override
6358 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6359 Parcel data = Parcel.obtain();
6360 Parcel reply = Parcel.obtain();
6361 data.writeInterfaceToken(IActivityManager.descriptor);
6362 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006363 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006364 reply.readException();
6365 data.recycle();
6366 reply.recycle();
6367 }
6368
Craig Mautner8746a472014-07-24 15:12:54 -07006369 @Override
6370 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6371 Parcel data = Parcel.obtain();
6372 Parcel reply = Parcel.obtain();
6373 data.writeInterfaceToken(IActivityManager.descriptor);
6374 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006375 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006376 reply.readException();
6377 data.recycle();
6378 reply.recycle();
6379 }
6380
Craig Mautner6e2f3952014-09-09 14:26:41 -07006381 @Override
6382 public void bootAnimationComplete() throws RemoteException {
6383 Parcel data = Parcel.obtain();
6384 Parcel reply = Parcel.obtain();
6385 data.writeInterfaceToken(IActivityManager.descriptor);
6386 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6387 reply.readException();
6388 data.recycle();
6389 reply.recycle();
6390 }
6391
Wale Ogunwale18795a22014-12-03 11:38:33 -08006392 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006393 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6394 Parcel data = Parcel.obtain();
6395 Parcel reply = Parcel.obtain();
6396 data.writeInterfaceToken(IActivityManager.descriptor);
6397 data.writeInt(uid);
6398 data.writeByteArray(firstPacket);
6399 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6400 reply.readException();
6401 data.recycle();
6402 reply.recycle();
6403 }
6404
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006405 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006406 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6407 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006408 Parcel data = Parcel.obtain();
6409 Parcel reply = Parcel.obtain();
6410 data.writeInterfaceToken(IActivityManager.descriptor);
6411 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006412 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006413 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006414 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006415 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6416 reply.readException();
6417 data.recycle();
6418 reply.recycle();
6419 }
6420
6421 @Override
6422 public void dumpHeapFinished(String path) throws RemoteException {
6423 Parcel data = Parcel.obtain();
6424 Parcel reply = Parcel.obtain();
6425 data.writeInterfaceToken(IActivityManager.descriptor);
6426 data.writeString(path);
6427 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6428 reply.readException();
6429 data.recycle();
6430 reply.recycle();
6431 }
6432
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006433 @Override
6434 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6435 throws RemoteException {
6436 Parcel data = Parcel.obtain();
6437 Parcel reply = Parcel.obtain();
6438 data.writeInterfaceToken(IActivityManager.descriptor);
6439 data.writeStrongBinder(session.asBinder());
6440 data.writeInt(keepAwake ? 1 : 0);
6441 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6442 reply.readException();
6443 data.recycle();
6444 reply.recycle();
6445 }
6446
Craig Mautnere5600772015-04-03 21:36:37 -07006447 @Override
6448 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6449 Parcel data = Parcel.obtain();
6450 Parcel reply = Parcel.obtain();
6451 data.writeInterfaceToken(IActivityManager.descriptor);
6452 data.writeInt(userId);
6453 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006454 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006455 reply.readException();
6456 data.recycle();
6457 reply.recycle();
6458 }
6459
Dianne Hackborn1e383822015-04-10 14:02:33 -07006460 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006461 public void updateDeviceOwner(String packageName) throws RemoteException {
6462 Parcel data = Parcel.obtain();
6463 Parcel reply = Parcel.obtain();
6464 data.writeInterfaceToken(IActivityManager.descriptor);
6465 data.writeString(packageName);
6466 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6467 reply.readException();
6468 data.recycle();
6469 reply.recycle();
6470 }
6471
6472 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006473 public int getPackageProcessState(String packageName, String callingPackage)
6474 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006475 Parcel data = Parcel.obtain();
6476 Parcel reply = Parcel.obtain();
6477 data.writeInterfaceToken(IActivityManager.descriptor);
6478 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006479 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006480 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6481 reply.readException();
6482 int res = reply.readInt();
6483 data.recycle();
6484 reply.recycle();
6485 return res;
6486 }
6487
Stefan Kuhne16045c22015-06-05 07:18:06 -07006488 @Override
6489 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6490 throws RemoteException {
6491 Parcel data = Parcel.obtain();
6492 Parcel reply = Parcel.obtain();
6493 data.writeInterfaceToken(IActivityManager.descriptor);
6494 data.writeString(process);
6495 data.writeInt(userId);
6496 data.writeInt(level);
6497 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6498 reply.readException();
6499 int res = reply.readInt();
6500 data.recycle();
6501 reply.recycle();
6502 return res != 0;
6503 }
6504
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006505 @Override
6506 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6507 Parcel data = Parcel.obtain();
6508 Parcel reply = Parcel.obtain();
6509 data.writeInterfaceToken(IActivityManager.descriptor);
6510 data.writeStrongBinder(token);
6511 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6512 reply.readException();
6513 int res = reply.readInt();
6514 data.recycle();
6515 reply.recycle();
6516 return res != 0;
6517 }
6518
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006519 @Override
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006520 public void exitFreeformMode(IBinder token) throws RemoteException {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006521 Parcel data = Parcel.obtain();
6522 Parcel reply = Parcel.obtain();
6523 data.writeInterfaceToken(IActivityManager.descriptor);
6524 data.writeStrongBinder(token);
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006525 mRemote.transact(EXIT_FREEFORM_MODE_TRANSACTION, data, reply, 0);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006526 reply.readException();
6527 data.recycle();
6528 reply.recycle();
6529 }
6530
6531 @Override
6532 public int getActivityStackId(IBinder token) throws RemoteException {
6533 Parcel data = Parcel.obtain();
6534 Parcel reply = Parcel.obtain();
6535 data.writeInterfaceToken(IActivityManager.descriptor);
6536 data.writeStrongBinder(token);
6537 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6538 reply.readException();
6539 int stackId = reply.readInt();
6540 data.recycle();
6541 reply.recycle();
6542 return stackId;
6543 }
6544
Filip Gruszczynski23493322015-07-29 17:02:59 -07006545 @Override
6546 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006547 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6548 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006549 Parcel data = Parcel.obtain();
6550 Parcel reply = Parcel.obtain();
6551 data.writeInterfaceToken(IActivityManager.descriptor);
6552 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006553 writeIntArray(horizontalSizeConfiguration, data);
6554 writeIntArray(verticalSizeConfigurations, data);
6555 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006556 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6557 reply.readException();
6558 data.recycle();
6559 reply.recycle();
6560 }
6561
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006562 private static void writeIntArray(int[] array, Parcel data) {
6563 if (array == null) {
6564 data.writeInt(0);
6565 } else {
6566 data.writeInt(array.length);
6567 data.writeIntArray(array);
6568 }
6569 }
6570
Wale Ogunwale83301a92015-09-24 15:54:08 -07006571 @Override
6572 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6573 Parcel data = Parcel.obtain();
6574 Parcel reply = Parcel.obtain();
6575 data.writeInterfaceToken(IActivityManager.descriptor);
6576 data.writeInt(suppress ? 1 : 0);
6577 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6578 reply.readException();
6579 data.recycle();
6580 reply.recycle();
6581 }
6582
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006583 @Override
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006584 public void moveTasksToFullscreenStack(int fromStackId) throws RemoteException {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006585 Parcel data = Parcel.obtain();
6586 Parcel reply = Parcel.obtain();
6587 data.writeInterfaceToken(IActivityManager.descriptor);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006588 data.writeInt(fromStackId);
6589 mRemote.transact(MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006590 reply.readException();
6591 data.recycle();
6592 reply.recycle();
6593 }
6594
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006595 @Override
6596 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6597 Parcel data = Parcel.obtain();
6598 Parcel reply = Parcel.obtain();
6599 data.writeInterfaceToken(IActivityManager.descriptor);
6600 data.writeInt(uid);
6601 data.writeString(packageName);
6602 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6603 reply.readException();
6604 int res = reply.readInt();
6605 data.recycle();
6606 reply.recycle();
6607 return res;
6608 }
6609
Wale Ogunwale5f986092015-12-04 15:35:38 -08006610 @Override
6611 public boolean inMultiWindowMode(IBinder token) throws RemoteException {
6612 Parcel data = Parcel.obtain();
6613 Parcel reply = Parcel.obtain();
6614 data.writeInterfaceToken(IActivityManager.descriptor);
6615 data.writeStrongBinder(token);
6616 mRemote.transact(IN_MULTI_WINDOW_MODE_TRANSACTION, data, reply, 0);
6617 reply.readException();
6618 final boolean multiWindowMode = reply.readInt() == 1 ? true : false;
6619 data.recycle();
6620 reply.recycle();
6621 return multiWindowMode;
6622 }
6623
6624 @Override
6625 public boolean inPictureInPictureMode(IBinder token) throws RemoteException {
6626 Parcel data = Parcel.obtain();
6627 Parcel reply = Parcel.obtain();
6628 data.writeInterfaceToken(IActivityManager.descriptor);
6629 data.writeStrongBinder(token);
6630 mRemote.transact(IN_PICTURE_IN_PICTURE_MODE_TRANSACTION, data, reply, 0);
6631 reply.readException();
6632 final boolean pipMode = reply.readInt() == 1 ? true : false;
6633 data.recycle();
6634 reply.recycle();
6635 return pipMode;
6636 }
6637
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006638 @Override
6639 public void enterPictureInPictureMode(IBinder token) throws RemoteException {
6640 Parcel data = Parcel.obtain();
6641 Parcel reply = Parcel.obtain();
6642 data.writeInterfaceToken(IActivityManager.descriptor);
6643 data.writeStrongBinder(token);
6644 mRemote.transact(ENTER_PICTURE_IN_PICTURE_MODE_TRANSACTION, data, reply, 0);
6645 reply.readException();
6646 data.recycle();
6647 reply.recycle();
6648 }
6649
Christopher Tate63fec3e2015-12-11 18:35:28 -08006650 @Override
6651 public boolean isAppForeground(int uid) throws RemoteException {
6652 Parcel data = Parcel.obtain();
6653 Parcel reply = Parcel.obtain();
6654 data.writeInterfaceToken(IActivityManager.descriptor);
6655 data.writeInt(uid);
6656 mRemote.transact(IS_APP_FOREGROUND_TRANSACTION, data, reply, 0);
6657 final boolean isForeground = reply.readInt() == 1 ? true : false;
6658 data.recycle();
6659 reply.recycle();
6660 return isForeground;
6661 };
6662
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006663 private IBinder mRemote;
6664}