blob: e246e620dc728e09c748f3f8d61928f0f09a383a [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
Dianne Hackborn69c6adc2015-06-02 10:52:59 -070020import android.app.assist.AssistContent;
21import android.app.assist.AssistStructure;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070023import android.content.IIntentReceiver;
24import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.content.Intent;
26import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070027import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070028import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070029import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.pm.ConfigurationInfo;
31import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070032import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070033import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070035import android.graphics.Bitmap;
36import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080037import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.net.Uri;
39import android.os.Binder;
40import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070041import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.os.IBinder;
43import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.ParcelFileDescriptor;
45import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070046import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070047import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070049import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070050import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080053import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070054import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080055import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057import java.util.ArrayList;
58import java.util.List;
59
60/** {@hide} */
61public abstract class ActivityManagerNative extends Binder implements IActivityManager
62{
63 /**
64 * Cast a Binder object into an activity manager interface, generating
65 * a proxy if needed.
66 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080067 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 if (obj == null) {
69 return null;
70 }
71 IActivityManager in =
72 (IActivityManager)obj.queryLocalInterface(descriptor);
73 if (in != null) {
74 return in;
75 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 return new ActivityManagerProxy(obj);
78 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 /**
81 * Retrieve the system's default/global activity manager.
82 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080083 static public IActivityManager getDefault() {
84 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 }
86
87 /**
88 * Convenience for checking whether the system is ready. For internal use only.
89 */
90 static public boolean isSystemReady() {
91 if (!sSystemReady) {
92 sSystemReady = getDefault().testIsSystemReady();
93 }
94 return sSystemReady;
95 }
96 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080097
Svet Ganov16a16892015-04-16 10:32:04 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
99 broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId);
100 }
101
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 /**
103 * Convenience for sending a sticky broadcast. For internal use only.
104 * If you don't care about permission, use null.
105 */
Svet Ganov16a16892015-04-16 10:32:04 -0700106 static public void broadcastStickyIntent(Intent intent, String permission, int appOp,
107 int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
109 getDefault().broadcastIntent(
Filip Gruszczynski23493322015-07-29 17:02:59 -0700110 null, intent, null, null, Activity.RESULT_OK, null, null,
111 null /*permission*/, appOp, null, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Dianne Hackborn1e383822015-04-10 14:02:33 -0700116 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
117 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700119 getDefault().noteWakeupAlarm((ps != null) ? ps.getTarget() : null,
120 sourceUid, sourcePkg, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700121 } catch (RemoteException ex) {
122 }
123 }
124
125 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
126 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700127 getDefault().noteAlarmStart((ps != null) ? ps.getTarget() : null, sourceUid, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700128 } catch (RemoteException ex) {
129 }
130 }
131
132 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
133 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700134 getDefault().noteAlarmFinish((ps != null) ? ps.getTarget() : null, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135 } catch (RemoteException ex) {
136 }
137 }
138
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800139 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800140 attachInterface(this, descriptor);
141 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700142
143 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
145 throws RemoteException {
146 switch (code) {
147 case START_ACTIVITY_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800155 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800156 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700158 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700159 ProfilerInfo profilerInfo = data.readInt() != 0
160 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800163 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700164 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165 reply.writeNoException();
166 reply.writeInt(result);
167 return true;
168 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700169
Amith Yamasani82644082012-08-03 13:09:11 -0700170 case START_ACTIVITY_AS_USER_TRANSACTION:
171 {
172 data.enforceInterface(IActivityManager.descriptor);
173 IBinder b = data.readStrongBinder();
174 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800175 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700176 Intent intent = Intent.CREATOR.createFromParcel(data);
177 String resolvedType = data.readString();
178 IBinder resultTo = data.readStrongBinder();
179 String resultWho = data.readString();
180 int requestCode = data.readInt();
181 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700182 ProfilerInfo profilerInfo = data.readInt() != 0
183 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700184 Bundle options = data.readInt() != 0
185 ? Bundle.CREATOR.createFromParcel(data) : null;
186 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800187 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700188 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700189 reply.writeNoException();
190 reply.writeInt(result);
191 return true;
192 }
193
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700194 case START_ACTIVITY_AS_CALLER_TRANSACTION:
195 {
196 data.enforceInterface(IActivityManager.descriptor);
197 IBinder b = data.readStrongBinder();
198 IApplicationThread app = ApplicationThreadNative.asInterface(b);
199 String callingPackage = data.readString();
200 Intent intent = Intent.CREATOR.createFromParcel(data);
201 String resolvedType = data.readString();
202 IBinder resultTo = data.readStrongBinder();
203 String resultWho = data.readString();
204 int requestCode = data.readInt();
205 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700206 ProfilerInfo profilerInfo = data.readInt() != 0
207 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700208 Bundle options = data.readInt() != 0
209 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700210 boolean ignoreTargetSecurity = data.readInt() != 0;
Jeff Sharkey97978802014-10-14 10:48:18 -0700211 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700212 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700213 resultTo, resultWho, requestCode, startFlags, profilerInfo, options,
214 ignoreTargetSecurity, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700215 reply.writeNoException();
216 reply.writeInt(result);
217 return true;
218 }
219
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800220 case START_ACTIVITY_AND_WAIT_TRANSACTION:
221 {
222 data.enforceInterface(IActivityManager.descriptor);
223 IBinder b = data.readStrongBinder();
224 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800225 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800226 Intent intent = Intent.CREATOR.createFromParcel(data);
227 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800228 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800229 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800230 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700232 ProfilerInfo profilerInfo = data.readInt() != 0
233 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700234 Bundle options = data.readInt() != 0
235 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700236 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800237 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700238 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800239 reply.writeNoException();
240 result.writeToParcel(reply, 0);
241 return true;
242 }
243
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700244 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
245 {
246 data.enforceInterface(IActivityManager.descriptor);
247 IBinder b = data.readStrongBinder();
248 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800249 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700250 Intent intent = Intent.CREATOR.createFromParcel(data);
251 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700252 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700253 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700254 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700255 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700256 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700257 Bundle options = data.readInt() != 0
258 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700259 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800260 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700261 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700262 reply.writeNoException();
263 reply.writeInt(result);
264 return true;
265 }
266
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700267 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700268 {
269 data.enforceInterface(IActivityManager.descriptor);
270 IBinder b = data.readStrongBinder();
271 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700272 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700273 Intent fillInIntent = null;
274 if (data.readInt() != 0) {
275 fillInIntent = Intent.CREATOR.createFromParcel(data);
276 }
277 String resolvedType = data.readString();
278 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700279 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700280 int requestCode = data.readInt();
281 int flagsMask = data.readInt();
282 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700283 Bundle options = data.readInt() != 0
284 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700285 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700286 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700287 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700288 reply.writeNoException();
289 reply.writeInt(result);
290 return true;
291 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700292
Dianne Hackborn91097de2014-04-04 18:02:06 -0700293 case START_VOICE_ACTIVITY_TRANSACTION:
294 {
295 data.enforceInterface(IActivityManager.descriptor);
296 String callingPackage = data.readString();
297 int callingPid = data.readInt();
298 int callingUid = data.readInt();
299 Intent intent = Intent.CREATOR.createFromParcel(data);
300 String resolvedType = data.readString();
301 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
302 data.readStrongBinder());
303 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
304 data.readStrongBinder());
305 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700306 ProfilerInfo profilerInfo = data.readInt() != 0
307 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700308 Bundle options = data.readInt() != 0
309 ? Bundle.CREATOR.createFromParcel(data) : null;
310 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700311 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
312 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700313 reply.writeNoException();
314 reply.writeInt(result);
315 return true;
316 }
317
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800318 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
319 {
320 data.enforceInterface(IActivityManager.descriptor);
321 IBinder callingActivity = data.readStrongBinder();
322 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700323 Bundle options = data.readInt() != 0
324 ? Bundle.CREATOR.createFromParcel(data) : null;
325 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 reply.writeNoException();
327 reply.writeInt(result ? 1 : 0);
328 return true;
329 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700330
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700331 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
332 {
333 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700334 final int taskId = data.readInt();
335 final int launchStackId = data.readInt();
336 final Bundle options =
337 data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
338 final int result = startActivityFromRecents(taskId, launchStackId, options);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700339 reply.writeNoException();
340 reply.writeInt(result);
341 return true;
342 }
343
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800344 case FINISH_ACTIVITY_TRANSACTION: {
345 data.enforceInterface(IActivityManager.descriptor);
346 IBinder token = data.readStrongBinder();
347 Intent resultData = null;
348 int resultCode = data.readInt();
349 if (data.readInt() != 0) {
350 resultData = Intent.CREATOR.createFromParcel(data);
351 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700352 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700353 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 reply.writeNoException();
355 reply.writeInt(res ? 1 : 0);
356 return true;
357 }
358
359 case FINISH_SUB_ACTIVITY_TRANSACTION: {
360 data.enforceInterface(IActivityManager.descriptor);
361 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700362 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 int requestCode = data.readInt();
364 finishSubActivity(token, resultWho, requestCode);
365 reply.writeNoException();
366 return true;
367 }
368
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700369 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
370 data.enforceInterface(IActivityManager.descriptor);
371 IBinder token = data.readStrongBinder();
372 boolean res = finishActivityAffinity(token);
373 reply.writeNoException();
374 reply.writeInt(res ? 1 : 0);
375 return true;
376 }
377
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700378 case FINISH_VOICE_TASK_TRANSACTION: {
379 data.enforceInterface(IActivityManager.descriptor);
380 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
381 data.readStrongBinder());
382 finishVoiceTask(session);
383 reply.writeNoException();
384 return true;
385 }
386
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700387 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
388 data.enforceInterface(IActivityManager.descriptor);
389 IBinder token = data.readStrongBinder();
390 boolean res = releaseActivityInstance(token);
391 reply.writeNoException();
392 reply.writeInt(res ? 1 : 0);
393 return true;
394 }
395
396 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
397 data.enforceInterface(IActivityManager.descriptor);
398 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
399 releaseSomeActivities(app);
400 reply.writeNoException();
401 return true;
402 }
403
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800404 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
405 data.enforceInterface(IActivityManager.descriptor);
406 IBinder token = data.readStrongBinder();
407 boolean res = willActivityBeVisible(token);
408 reply.writeNoException();
409 reply.writeInt(res ? 1 : 0);
410 return true;
411 }
412
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800413 case REGISTER_RECEIVER_TRANSACTION:
414 {
415 data.enforceInterface(IActivityManager.descriptor);
416 IBinder b = data.readStrongBinder();
417 IApplicationThread app =
418 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700419 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800420 b = data.readStrongBinder();
421 IIntentReceiver rec
422 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
423 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
424 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700425 int userId = data.readInt();
426 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 reply.writeNoException();
428 if (intent != null) {
429 reply.writeInt(1);
430 intent.writeToParcel(reply, 0);
431 } else {
432 reply.writeInt(0);
433 }
434 return true;
435 }
436
437 case UNREGISTER_RECEIVER_TRANSACTION:
438 {
439 data.enforceInterface(IActivityManager.descriptor);
440 IBinder b = data.readStrongBinder();
441 if (b == null) {
442 return true;
443 }
444 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
445 unregisterReceiver(rec);
446 reply.writeNoException();
447 return true;
448 }
449
450 case BROADCAST_INTENT_TRANSACTION:
451 {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder b = data.readStrongBinder();
454 IApplicationThread app =
455 b != null ? ApplicationThreadNative.asInterface(b) : null;
456 Intent intent = Intent.CREATOR.createFromParcel(data);
457 String resolvedType = data.readString();
458 b = data.readStrongBinder();
459 IIntentReceiver resultTo =
460 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
461 int resultCode = data.readInt();
462 String resultData = data.readString();
463 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700464 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800465 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700466 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 boolean serialized = data.readInt() != 0;
468 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700469 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700471 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700472 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800473 reply.writeNoException();
474 reply.writeInt(res);
475 return true;
476 }
477
478 case UNBROADCAST_INTENT_TRANSACTION:
479 {
480 data.enforceInterface(IActivityManager.descriptor);
481 IBinder b = data.readStrongBinder();
482 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
483 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700484 int userId = data.readInt();
485 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800486 reply.writeNoException();
487 return true;
488 }
489
490 case FINISH_RECEIVER_TRANSACTION: {
491 data.enforceInterface(IActivityManager.descriptor);
492 IBinder who = data.readStrongBinder();
493 int resultCode = data.readInt();
494 String resultData = data.readString();
495 Bundle resultExtras = data.readBundle();
496 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800497 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800498 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800499 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 }
501 reply.writeNoException();
502 return true;
503 }
504
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 case ATTACH_APPLICATION_TRANSACTION: {
506 data.enforceInterface(IActivityManager.descriptor);
507 IApplicationThread app = ApplicationThreadNative.asInterface(
508 data.readStrongBinder());
509 if (app != null) {
510 attachApplication(app);
511 }
512 reply.writeNoException();
513 return true;
514 }
515
516 case ACTIVITY_IDLE_TRANSACTION: {
517 data.enforceInterface(IActivityManager.descriptor);
518 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700519 Configuration config = null;
520 if (data.readInt() != 0) {
521 config = Configuration.CREATOR.createFromParcel(data);
522 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700523 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800524 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700525 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 }
527 reply.writeNoException();
528 return true;
529 }
530
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700531 case ACTIVITY_RESUMED_TRANSACTION: {
532 data.enforceInterface(IActivityManager.descriptor);
533 IBinder token = data.readStrongBinder();
534 activityResumed(token);
535 reply.writeNoException();
536 return true;
537 }
538
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800539 case ACTIVITY_PAUSED_TRANSACTION: {
540 data.enforceInterface(IActivityManager.descriptor);
541 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700542 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800543 reply.writeNoException();
544 return true;
545 }
546
547 case ACTIVITY_STOPPED_TRANSACTION: {
548 data.enforceInterface(IActivityManager.descriptor);
549 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800550 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700551 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800552 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700553 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554 reply.writeNoException();
555 return true;
556 }
557
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800558 case ACTIVITY_SLEPT_TRANSACTION: {
559 data.enforceInterface(IActivityManager.descriptor);
560 IBinder token = data.readStrongBinder();
561 activitySlept(token);
562 reply.writeNoException();
563 return true;
564 }
565
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800566 case ACTIVITY_DESTROYED_TRANSACTION: {
567 data.enforceInterface(IActivityManager.descriptor);
568 IBinder token = data.readStrongBinder();
569 activityDestroyed(token);
570 reply.writeNoException();
571 return true;
572 }
573
574 case GET_CALLING_PACKAGE_TRANSACTION: {
575 data.enforceInterface(IActivityManager.descriptor);
576 IBinder token = data.readStrongBinder();
577 String res = token != null ? getCallingPackage(token) : null;
578 reply.writeNoException();
579 reply.writeString(res);
580 return true;
581 }
582
583 case GET_CALLING_ACTIVITY_TRANSACTION: {
584 data.enforceInterface(IActivityManager.descriptor);
585 IBinder token = data.readStrongBinder();
586 ComponentName cn = getCallingActivity(token);
587 reply.writeNoException();
588 ComponentName.writeToParcel(cn, reply);
589 return true;
590 }
591
Winson Chung1147c402014-05-14 11:05:00 -0700592 case GET_APP_TASKS_TRANSACTION: {
593 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700594 String callingPackage = data.readString();
595 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700596 reply.writeNoException();
597 int N = list != null ? list.size() : -1;
598 reply.writeInt(N);
599 int i;
600 for (i=0; i<N; i++) {
601 IAppTask task = list.get(i);
602 reply.writeStrongBinder(task.asBinder());
603 }
604 return true;
605 }
606
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700607 case ADD_APP_TASK_TRANSACTION: {
608 data.enforceInterface(IActivityManager.descriptor);
609 IBinder activityToken = data.readStrongBinder();
610 Intent intent = Intent.CREATOR.createFromParcel(data);
611 ActivityManager.TaskDescription descr
612 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
613 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
614 int res = addAppTask(activityToken, intent, descr, thumbnail);
615 reply.writeNoException();
616 reply.writeInt(res);
617 return true;
618 }
619
620 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
621 data.enforceInterface(IActivityManager.descriptor);
622 Point size = getAppTaskThumbnailSize();
623 reply.writeNoException();
624 size.writeToParcel(reply, 0);
625 return true;
626 }
627
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800628 case GET_TASKS_TRANSACTION: {
629 data.enforceInterface(IActivityManager.descriptor);
630 int maxNum = data.readInt();
631 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700632 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800633 reply.writeNoException();
634 int N = list != null ? list.size() : -1;
635 reply.writeInt(N);
636 int i;
637 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700638 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800639 info.writeToParcel(reply, 0);
640 }
641 return true;
642 }
643
644 case GET_RECENT_TASKS_TRANSACTION: {
645 data.enforceInterface(IActivityManager.descriptor);
646 int maxNum = data.readInt();
647 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700648 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800649 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700650 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800651 reply.writeNoException();
652 reply.writeTypedList(list);
653 return true;
654 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700655
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700656 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800657 data.enforceInterface(IActivityManager.descriptor);
658 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700659 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800660 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700661 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800662 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700663 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700664 } else {
665 reply.writeInt(0);
666 }
667 return true;
668 }
669
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 case GET_SERVICES_TRANSACTION: {
671 data.enforceInterface(IActivityManager.descriptor);
672 int maxNum = data.readInt();
673 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700674 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800675 reply.writeNoException();
676 int N = list != null ? list.size() : -1;
677 reply.writeInt(N);
678 int i;
679 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700680 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800681 info.writeToParcel(reply, 0);
682 }
683 return true;
684 }
685
686 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
687 data.enforceInterface(IActivityManager.descriptor);
688 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
689 reply.writeNoException();
690 reply.writeTypedList(list);
691 return true;
692 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700693
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800694 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
695 data.enforceInterface(IActivityManager.descriptor);
696 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
697 reply.writeNoException();
698 reply.writeTypedList(list);
699 return true;
700 }
701
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700702 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
703 data.enforceInterface(IActivityManager.descriptor);
704 List<ApplicationInfo> list = getRunningExternalApplications();
705 reply.writeNoException();
706 reply.writeTypedList(list);
707 return true;
708 }
709
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 case MOVE_TASK_TO_FRONT_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800713 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700714 Bundle options = data.readInt() != 0
715 ? Bundle.CREATOR.createFromParcel(data) : null;
716 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800717 reply.writeNoException();
718 return true;
719 }
720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 IBinder token = data.readStrongBinder();
724 boolean nonRoot = data.readInt() != 0;
725 boolean res = moveActivityTaskToBack(token, nonRoot);
726 reply.writeNoException();
727 reply.writeInt(res ? 1 : 0);
728 return true;
729 }
730
731 case MOVE_TASK_BACKWARDS_TRANSACTION: {
732 data.enforceInterface(IActivityManager.descriptor);
733 int task = data.readInt();
734 moveTaskBackwards(task);
735 reply.writeNoException();
736 return true;
737 }
738
Craig Mautnerc00204b2013-03-05 15:02:14 -0800739 case MOVE_TASK_TO_STACK_TRANSACTION: {
740 data.enforceInterface(IActivityManager.descriptor);
741 int taskId = data.readInt();
742 int stackId = data.readInt();
743 boolean toTop = data.readInt() != 0;
744 moveTaskToStack(taskId, stackId, toTop);
745 reply.writeNoException();
746 return true;
747 }
748
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700749 case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: {
750 data.enforceInterface(IActivityManager.descriptor);
751 int taskId = data.readInt();
752 int createMode = data.readInt();
753 boolean toTop = data.readInt() != 0;
754 moveTaskToDockedStack(taskId, createMode, toTop);
755 reply.writeNoException();
756 return true;
757 }
758
Dianne Hackbornbef28fe2015-10-29 17:57:11 -0700759 case MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION: {
Wale Ogunwale079a0042015-10-24 11:44:07 -0700760 data.enforceInterface(IActivityManager.descriptor);
761 final int stackId = data.readInt();
762 final Rect r = Rect.CREATOR.createFromParcel(data);
763 final boolean res = moveTopActivityToPinnedStack(stackId, r);
764 reply.writeNoException();
765 reply.writeInt(res ? 1 : 0);
766 return true;
767 }
768
Craig Mautnerc00204b2013-03-05 15:02:14 -0800769 case RESIZE_STACK_TRANSACTION: {
770 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700771 final int stackId = data.readInt();
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100772 final boolean hasRect = data.readInt() != 0;
773 Rect r = null;
774 if (hasRect) {
775 r = Rect.CREATOR.createFromParcel(data);
776 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700777 final boolean allowResizeInDockedMode = data.readInt() == 1;
778 resizeStack(stackId, r, allowResizeInDockedMode);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800779 reply.writeNoException();
780 return true;
781 }
782
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700783 case POSITION_TASK_IN_STACK_TRANSACTION: {
784 data.enforceInterface(IActivityManager.descriptor);
785 int taskId = data.readInt();
786 int stackId = data.readInt();
787 int position = data.readInt();
788 positionTaskInStack(taskId, stackId, position);
789 reply.writeNoException();
790 return true;
791 }
792
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800793 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700794 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800795 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700796 reply.writeNoException();
797 reply.writeTypedList(list);
798 return true;
799 }
800
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800801 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700802 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800803 int stackId = data.readInt();
804 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700805 reply.writeNoException();
806 if (info != null) {
807 reply.writeInt(1);
808 info.writeToParcel(reply, 0);
809 } else {
810 reply.writeInt(0);
811 }
812 return true;
813 }
814
Winson Chung303e1ff2014-03-07 15:06:19 -0800815 case IS_IN_HOME_STACK_TRANSACTION: {
816 data.enforceInterface(IActivityManager.descriptor);
817 int taskId = data.readInt();
818 boolean isInHomeStack = isInHomeStack(taskId);
819 reply.writeNoException();
820 reply.writeInt(isInHomeStack ? 1 : 0);
821 return true;
822 }
823
Craig Mautnercf910b02013-04-23 11:23:27 -0700824 case SET_FOCUSED_STACK_TRANSACTION: {
825 data.enforceInterface(IActivityManager.descriptor);
826 int stackId = data.readInt();
827 setFocusedStack(stackId);
828 reply.writeNoException();
829 return true;
830 }
831
Winson Chungd16c5652015-01-26 16:11:07 -0800832 case GET_FOCUSED_STACK_ID_TRANSACTION: {
833 data.enforceInterface(IActivityManager.descriptor);
834 int focusedStackId = getFocusedStackId();
835 reply.writeNoException();
836 reply.writeInt(focusedStackId);
837 return true;
838 }
839
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700840 case SET_FOCUSED_TASK_TRANSACTION: {
841 data.enforceInterface(IActivityManager.descriptor);
842 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700843 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700844 reply.writeNoException();
845 return true;
846 }
847
Winson Chung740c3ac2014-11-12 16:14:38 -0800848 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
849 data.enforceInterface(IActivityManager.descriptor);
850 IBinder token = data.readStrongBinder();
851 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
852 reply.writeNoException();
853 return true;
854 }
855
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800856 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
857 data.enforceInterface(IActivityManager.descriptor);
858 IBinder token = data.readStrongBinder();
859 boolean onlyRoot = data.readInt() != 0;
860 int res = token != null
861 ? getTaskForActivity(token, onlyRoot) : -1;
862 reply.writeNoException();
863 reply.writeInt(res);
864 return true;
865 }
866
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800867 case GET_CONTENT_PROVIDER_TRANSACTION: {
868 data.enforceInterface(IActivityManager.descriptor);
869 IBinder b = data.readStrongBinder();
870 IApplicationThread app = ApplicationThreadNative.asInterface(b);
871 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700872 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700873 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700874 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800875 reply.writeNoException();
876 if (cph != null) {
877 reply.writeInt(1);
878 cph.writeToParcel(reply, 0);
879 } else {
880 reply.writeInt(0);
881 }
882 return true;
883 }
884
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800885 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
886 data.enforceInterface(IActivityManager.descriptor);
887 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700888 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800889 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700890 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800891 reply.writeNoException();
892 if (cph != null) {
893 reply.writeInt(1);
894 cph.writeToParcel(reply, 0);
895 } else {
896 reply.writeInt(0);
897 }
898 return true;
899 }
900
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800901 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
902 data.enforceInterface(IActivityManager.descriptor);
903 IBinder b = data.readStrongBinder();
904 IApplicationThread app = ApplicationThreadNative.asInterface(b);
905 ArrayList<ContentProviderHolder> providers =
906 data.createTypedArrayList(ContentProviderHolder.CREATOR);
907 publishContentProviders(app, providers);
908 reply.writeNoException();
909 return true;
910 }
911
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700912 case REF_CONTENT_PROVIDER_TRANSACTION: {
913 data.enforceInterface(IActivityManager.descriptor);
914 IBinder b = data.readStrongBinder();
915 int stable = data.readInt();
916 int unstable = data.readInt();
917 boolean res = refContentProvider(b, stable, unstable);
918 reply.writeNoException();
919 reply.writeInt(res ? 1 : 0);
920 return true;
921 }
922
923 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
924 data.enforceInterface(IActivityManager.descriptor);
925 IBinder b = data.readStrongBinder();
926 unstableProviderDied(b);
927 reply.writeNoException();
928 return true;
929 }
930
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700931 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
932 data.enforceInterface(IActivityManager.descriptor);
933 IBinder b = data.readStrongBinder();
934 appNotRespondingViaProvider(b);
935 reply.writeNoException();
936 return true;
937 }
938
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800939 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
940 data.enforceInterface(IActivityManager.descriptor);
941 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700942 boolean stable = data.readInt() != 0;
943 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800944 reply.writeNoException();
945 return true;
946 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800947
948 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
949 data.enforceInterface(IActivityManager.descriptor);
950 String name = data.readString();
951 IBinder token = data.readStrongBinder();
952 removeContentProviderExternal(name, token);
953 reply.writeNoException();
954 return true;
955 }
956
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700957 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
958 data.enforceInterface(IActivityManager.descriptor);
959 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
960 PendingIntent pi = getRunningServiceControlPanel(comp);
961 reply.writeNoException();
962 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
963 return true;
964 }
965
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800966 case START_SERVICE_TRANSACTION: {
967 data.enforceInterface(IActivityManager.descriptor);
968 IBinder b = data.readStrongBinder();
969 IApplicationThread app = ApplicationThreadNative.asInterface(b);
970 Intent service = Intent.CREATOR.createFromParcel(data);
971 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -0700972 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700973 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700974 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800975 reply.writeNoException();
976 ComponentName.writeToParcel(cn, reply);
977 return true;
978 }
979
980 case STOP_SERVICE_TRANSACTION: {
981 data.enforceInterface(IActivityManager.descriptor);
982 IBinder b = data.readStrongBinder();
983 IApplicationThread app = ApplicationThreadNative.asInterface(b);
984 Intent service = Intent.CREATOR.createFromParcel(data);
985 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700986 int userId = data.readInt();
987 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800988 reply.writeNoException();
989 reply.writeInt(res);
990 return true;
991 }
992
993 case STOP_SERVICE_TOKEN_TRANSACTION: {
994 data.enforceInterface(IActivityManager.descriptor);
995 ComponentName className = ComponentName.readFromParcel(data);
996 IBinder token = data.readStrongBinder();
997 int startId = data.readInt();
998 boolean res = stopServiceToken(className, token, startId);
999 reply.writeNoException();
1000 reply.writeInt(res ? 1 : 0);
1001 return true;
1002 }
1003
1004 case SET_SERVICE_FOREGROUND_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 ComponentName className = ComponentName.readFromParcel(data);
1007 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001008 int id = data.readInt();
1009 Notification notification = null;
1010 if (data.readInt() != 0) {
1011 notification = Notification.CREATOR.createFromParcel(data);
1012 }
1013 boolean removeNotification = data.readInt() != 0;
1014 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001015 reply.writeNoException();
1016 return true;
1017 }
1018
1019 case BIND_SERVICE_TRANSACTION: {
1020 data.enforceInterface(IActivityManager.descriptor);
1021 IBinder b = data.readStrongBinder();
1022 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1023 IBinder token = data.readStrongBinder();
1024 Intent service = Intent.CREATOR.createFromParcel(data);
1025 String resolvedType = data.readString();
1026 b = data.readStrongBinder();
1027 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001028 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001029 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001030 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001031 int res = bindService(app, token, service, resolvedType, conn, fl,
1032 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001033 reply.writeNoException();
1034 reply.writeInt(res);
1035 return true;
1036 }
1037
1038 case UNBIND_SERVICE_TRANSACTION: {
1039 data.enforceInterface(IActivityManager.descriptor);
1040 IBinder b = data.readStrongBinder();
1041 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1042 boolean res = unbindService(conn);
1043 reply.writeNoException();
1044 reply.writeInt(res ? 1 : 0);
1045 return true;
1046 }
1047
1048 case PUBLISH_SERVICE_TRANSACTION: {
1049 data.enforceInterface(IActivityManager.descriptor);
1050 IBinder token = data.readStrongBinder();
1051 Intent intent = Intent.CREATOR.createFromParcel(data);
1052 IBinder service = data.readStrongBinder();
1053 publishService(token, intent, service);
1054 reply.writeNoException();
1055 return true;
1056 }
1057
1058 case UNBIND_FINISHED_TRANSACTION: {
1059 data.enforceInterface(IActivityManager.descriptor);
1060 IBinder token = data.readStrongBinder();
1061 Intent intent = Intent.CREATOR.createFromParcel(data);
1062 boolean doRebind = data.readInt() != 0;
1063 unbindFinished(token, intent, doRebind);
1064 reply.writeNoException();
1065 return true;
1066 }
1067
1068 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1069 data.enforceInterface(IActivityManager.descriptor);
1070 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001071 int type = data.readInt();
1072 int startId = data.readInt();
1073 int res = data.readInt();
1074 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001075 reply.writeNoException();
1076 return true;
1077 }
1078
1079 case START_INSTRUMENTATION_TRANSACTION: {
1080 data.enforceInterface(IActivityManager.descriptor);
1081 ComponentName className = ComponentName.readFromParcel(data);
1082 String profileFile = data.readString();
1083 int fl = data.readInt();
1084 Bundle arguments = data.readBundle();
1085 IBinder b = data.readStrongBinder();
1086 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001087 b = data.readStrongBinder();
1088 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001089 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001090 String abiOverride = data.readString();
1091 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1092 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001093 reply.writeNoException();
1094 reply.writeInt(res ? 1 : 0);
1095 return true;
1096 }
1097
1098
1099 case FINISH_INSTRUMENTATION_TRANSACTION: {
1100 data.enforceInterface(IActivityManager.descriptor);
1101 IBinder b = data.readStrongBinder();
1102 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1103 int resultCode = data.readInt();
1104 Bundle results = data.readBundle();
1105 finishInstrumentation(app, resultCode, results);
1106 reply.writeNoException();
1107 return true;
1108 }
1109
1110 case GET_CONFIGURATION_TRANSACTION: {
1111 data.enforceInterface(IActivityManager.descriptor);
1112 Configuration config = getConfiguration();
1113 reply.writeNoException();
1114 config.writeToParcel(reply, 0);
1115 return true;
1116 }
1117
1118 case UPDATE_CONFIGURATION_TRANSACTION: {
1119 data.enforceInterface(IActivityManager.descriptor);
1120 Configuration config = Configuration.CREATOR.createFromParcel(data);
1121 updateConfiguration(config);
1122 reply.writeNoException();
1123 return true;
1124 }
1125
1126 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1127 data.enforceInterface(IActivityManager.descriptor);
1128 IBinder token = data.readStrongBinder();
1129 int requestedOrientation = data.readInt();
1130 setRequestedOrientation(token, requestedOrientation);
1131 reply.writeNoException();
1132 return true;
1133 }
1134
1135 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1136 data.enforceInterface(IActivityManager.descriptor);
1137 IBinder token = data.readStrongBinder();
1138 int req = getRequestedOrientation(token);
1139 reply.writeNoException();
1140 reply.writeInt(req);
1141 return true;
1142 }
1143
1144 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1145 data.enforceInterface(IActivityManager.descriptor);
1146 IBinder token = data.readStrongBinder();
1147 ComponentName cn = getActivityClassForToken(token);
1148 reply.writeNoException();
1149 ComponentName.writeToParcel(cn, reply);
1150 return true;
1151 }
1152
1153 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1154 data.enforceInterface(IActivityManager.descriptor);
1155 IBinder token = data.readStrongBinder();
1156 reply.writeNoException();
1157 reply.writeString(getPackageForToken(token));
1158 return true;
1159 }
1160
1161 case GET_INTENT_SENDER_TRANSACTION: {
1162 data.enforceInterface(IActivityManager.descriptor);
1163 int type = data.readInt();
1164 String packageName = data.readString();
1165 IBinder token = data.readStrongBinder();
1166 String resultWho = data.readString();
1167 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001168 Intent[] requestIntents;
1169 String[] requestResolvedTypes;
1170 if (data.readInt() != 0) {
1171 requestIntents = data.createTypedArray(Intent.CREATOR);
1172 requestResolvedTypes = data.createStringArray();
1173 } else {
1174 requestIntents = null;
1175 requestResolvedTypes = null;
1176 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001177 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001178 Bundle options = data.readInt() != 0
1179 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001180 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001181 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001182 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001183 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001184 reply.writeNoException();
1185 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1186 return true;
1187 }
1188
1189 case CANCEL_INTENT_SENDER_TRANSACTION: {
1190 data.enforceInterface(IActivityManager.descriptor);
1191 IIntentSender r = IIntentSender.Stub.asInterface(
1192 data.readStrongBinder());
1193 cancelIntentSender(r);
1194 reply.writeNoException();
1195 return true;
1196 }
1197
1198 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1199 data.enforceInterface(IActivityManager.descriptor);
1200 IIntentSender r = IIntentSender.Stub.asInterface(
1201 data.readStrongBinder());
1202 String res = getPackageForIntentSender(r);
1203 reply.writeNoException();
1204 reply.writeString(res);
1205 return true;
1206 }
1207
Christopher Tatec4a07d12012-04-06 14:19:13 -07001208 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1209 data.enforceInterface(IActivityManager.descriptor);
1210 IIntentSender r = IIntentSender.Stub.asInterface(
1211 data.readStrongBinder());
1212 int res = getUidForIntentSender(r);
1213 reply.writeNoException();
1214 reply.writeInt(res);
1215 return true;
1216 }
1217
Dianne Hackborn41203752012-08-31 14:05:51 -07001218 case HANDLE_INCOMING_USER_TRANSACTION: {
1219 data.enforceInterface(IActivityManager.descriptor);
1220 int callingPid = data.readInt();
1221 int callingUid = data.readInt();
1222 int userId = data.readInt();
1223 boolean allowAll = data.readInt() != 0 ;
1224 boolean requireFull = data.readInt() != 0;
1225 String name = data.readString();
1226 String callerPackage = data.readString();
1227 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1228 requireFull, name, callerPackage);
1229 reply.writeNoException();
1230 reply.writeInt(res);
1231 return true;
1232 }
1233
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001234 case SET_PROCESS_LIMIT_TRANSACTION: {
1235 data.enforceInterface(IActivityManager.descriptor);
1236 int max = data.readInt();
1237 setProcessLimit(max);
1238 reply.writeNoException();
1239 return true;
1240 }
1241
1242 case GET_PROCESS_LIMIT_TRANSACTION: {
1243 data.enforceInterface(IActivityManager.descriptor);
1244 int limit = getProcessLimit();
1245 reply.writeNoException();
1246 reply.writeInt(limit);
1247 return true;
1248 }
1249
1250 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1251 data.enforceInterface(IActivityManager.descriptor);
1252 IBinder token = data.readStrongBinder();
1253 int pid = data.readInt();
1254 boolean isForeground = data.readInt() != 0;
1255 setProcessForeground(token, pid, isForeground);
1256 reply.writeNoException();
1257 return true;
1258 }
1259
1260 case CHECK_PERMISSION_TRANSACTION: {
1261 data.enforceInterface(IActivityManager.descriptor);
1262 String perm = data.readString();
1263 int pid = data.readInt();
1264 int uid = data.readInt();
1265 int res = checkPermission(perm, pid, uid);
1266 reply.writeNoException();
1267 reply.writeInt(res);
1268 return true;
1269 }
1270
Dianne Hackbornff170242014-11-19 10:59:01 -08001271 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1272 data.enforceInterface(IActivityManager.descriptor);
1273 String perm = data.readString();
1274 int pid = data.readInt();
1275 int uid = data.readInt();
1276 IBinder token = data.readStrongBinder();
1277 int res = checkPermissionWithToken(perm, pid, uid, token);
1278 reply.writeNoException();
1279 reply.writeInt(res);
1280 return true;
1281 }
1282
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001283 case CHECK_URI_PERMISSION_TRANSACTION: {
1284 data.enforceInterface(IActivityManager.descriptor);
1285 Uri uri = Uri.CREATOR.createFromParcel(data);
1286 int pid = data.readInt();
1287 int uid = data.readInt();
1288 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001289 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001290 IBinder callerToken = data.readStrongBinder();
1291 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001292 reply.writeNoException();
1293 reply.writeInt(res);
1294 return true;
1295 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001296
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001297 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001298 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001299 String packageName = data.readString();
1300 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1301 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001302 int userId = data.readInt();
1303 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001304 reply.writeNoException();
1305 reply.writeInt(res ? 1 : 0);
1306 return true;
1307 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001308
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001309 case GRANT_URI_PERMISSION_TRANSACTION: {
1310 data.enforceInterface(IActivityManager.descriptor);
1311 IBinder b = data.readStrongBinder();
1312 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1313 String targetPkg = data.readString();
1314 Uri uri = Uri.CREATOR.createFromParcel(data);
1315 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001316 int userId = data.readInt();
1317 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001318 reply.writeNoException();
1319 return true;
1320 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001321
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001322 case REVOKE_URI_PERMISSION_TRANSACTION: {
1323 data.enforceInterface(IActivityManager.descriptor);
1324 IBinder b = data.readStrongBinder();
1325 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1326 Uri uri = Uri.CREATOR.createFromParcel(data);
1327 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001328 int userId = data.readInt();
1329 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001330 reply.writeNoException();
1331 return true;
1332 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001333
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001334 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1335 data.enforceInterface(IActivityManager.descriptor);
1336 Uri uri = Uri.CREATOR.createFromParcel(data);
1337 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001338 int userId = data.readInt();
1339 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001340 reply.writeNoException();
1341 return true;
1342 }
1343
1344 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1345 data.enforceInterface(IActivityManager.descriptor);
1346 Uri uri = Uri.CREATOR.createFromParcel(data);
1347 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001348 int userId = data.readInt();
1349 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001350 reply.writeNoException();
1351 return true;
1352 }
1353
1354 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1355 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001356 final String packageName = data.readString();
1357 final boolean incoming = data.readInt() != 0;
1358 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1359 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001360 reply.writeNoException();
1361 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1362 return true;
1363 }
1364
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001365 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1366 data.enforceInterface(IActivityManager.descriptor);
1367 IBinder b = data.readStrongBinder();
1368 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1369 boolean waiting = data.readInt() != 0;
1370 showWaitingForDebugger(app, waiting);
1371 reply.writeNoException();
1372 return true;
1373 }
1374
1375 case GET_MEMORY_INFO_TRANSACTION: {
1376 data.enforceInterface(IActivityManager.descriptor);
1377 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1378 getMemoryInfo(mi);
1379 reply.writeNoException();
1380 mi.writeToParcel(reply, 0);
1381 return true;
1382 }
1383
1384 case UNHANDLED_BACK_TRANSACTION: {
1385 data.enforceInterface(IActivityManager.descriptor);
1386 unhandledBack();
1387 reply.writeNoException();
1388 return true;
1389 }
1390
1391 case OPEN_CONTENT_URI_TRANSACTION: {
1392 data.enforceInterface(IActivityManager.descriptor);
1393 Uri uri = Uri.parse(data.readString());
1394 ParcelFileDescriptor pfd = openContentUri(uri);
1395 reply.writeNoException();
1396 if (pfd != null) {
1397 reply.writeInt(1);
1398 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1399 } else {
1400 reply.writeInt(0);
1401 }
1402 return true;
1403 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001404
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001405 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1406 data.enforceInterface(IActivityManager.descriptor);
1407 setLockScreenShown(data.readInt() != 0);
1408 reply.writeNoException();
1409 return true;
1410 }
1411
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001412 case SET_DEBUG_APP_TRANSACTION: {
1413 data.enforceInterface(IActivityManager.descriptor);
1414 String pn = data.readString();
1415 boolean wfd = data.readInt() != 0;
1416 boolean per = data.readInt() != 0;
1417 setDebugApp(pn, wfd, per);
1418 reply.writeNoException();
1419 return true;
1420 }
1421
1422 case SET_ALWAYS_FINISH_TRANSACTION: {
1423 data.enforceInterface(IActivityManager.descriptor);
1424 boolean enabled = data.readInt() != 0;
1425 setAlwaysFinish(enabled);
1426 reply.writeNoException();
1427 return true;
1428 }
1429
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001430 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001431 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001432 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001433 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001434 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001435 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001436 return true;
1437 }
1438
1439 case ENTER_SAFE_MODE_TRANSACTION: {
1440 data.enforceInterface(IActivityManager.descriptor);
1441 enterSafeMode();
1442 reply.writeNoException();
1443 return true;
1444 }
1445
1446 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
1448 IIntentSender is = IIntentSender.Stub.asInterface(
1449 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001450 int sourceUid = data.readInt();
1451 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001452 String tag = data.readString();
1453 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1454 reply.writeNoException();
1455 return true;
1456 }
1457
1458 case NOTE_ALARM_START_TRANSACTION: {
1459 data.enforceInterface(IActivityManager.descriptor);
1460 IIntentSender is = IIntentSender.Stub.asInterface(
1461 data.readStrongBinder());
1462 int sourceUid = data.readInt();
1463 String tag = data.readString();
1464 noteAlarmStart(is, sourceUid, tag);
1465 reply.writeNoException();
1466 return true;
1467 }
1468
1469 case NOTE_ALARM_FINISH_TRANSACTION: {
1470 data.enforceInterface(IActivityManager.descriptor);
1471 IIntentSender is = IIntentSender.Stub.asInterface(
1472 data.readStrongBinder());
1473 int sourceUid = data.readInt();
1474 String tag = data.readString();
1475 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001476 reply.writeNoException();
1477 return true;
1478 }
1479
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001480 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001481 data.enforceInterface(IActivityManager.descriptor);
1482 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001483 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001484 boolean secure = data.readInt() != 0;
1485 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001486 reply.writeNoException();
1487 reply.writeInt(res ? 1 : 0);
1488 return true;
1489 }
1490
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001491 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1492 data.enforceInterface(IActivityManager.descriptor);
1493 String reason = data.readString();
1494 boolean res = killProcessesBelowForeground(reason);
1495 reply.writeNoException();
1496 reply.writeInt(res ? 1 : 0);
1497 return true;
1498 }
1499
Dan Egnor60d87622009-12-16 16:32:58 -08001500 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1501 data.enforceInterface(IActivityManager.descriptor);
1502 IBinder app = data.readStrongBinder();
1503 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1504 handleApplicationCrash(app, ci);
1505 reply.writeNoException();
1506 return true;
1507 }
1508
1509 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001510 data.enforceInterface(IActivityManager.descriptor);
1511 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001512 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001513 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001514 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001515 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001516 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001517 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001518 return true;
1519 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001520
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001521 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1522 data.enforceInterface(IActivityManager.descriptor);
1523 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001524 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001525 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1526 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001527 reply.writeNoException();
1528 return true;
1529 }
1530
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001531 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1532 data.enforceInterface(IActivityManager.descriptor);
1533 int sig = data.readInt();
1534 signalPersistentProcesses(sig);
1535 reply.writeNoException();
1536 return true;
1537 }
1538
Dianne Hackborn03abb812010-01-04 18:43:19 -08001539 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1540 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001541 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001542 int userId = data.readInt();
1543 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001544 reply.writeNoException();
1545 return true;
1546 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001547
1548 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1549 data.enforceInterface(IActivityManager.descriptor);
1550 killAllBackgroundProcesses();
1551 reply.writeNoException();
1552 return true;
1553 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001554
Dianne Hackborn03abb812010-01-04 18:43:19 -08001555 case FORCE_STOP_PACKAGE_TRANSACTION: {
1556 data.enforceInterface(IActivityManager.descriptor);
1557 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001558 int userId = data.readInt();
1559 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001560 reply.writeNoException();
1561 return true;
1562 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001563
1564 case GET_MY_MEMORY_STATE_TRANSACTION: {
1565 data.enforceInterface(IActivityManager.descriptor);
1566 ActivityManager.RunningAppProcessInfo info =
1567 new ActivityManager.RunningAppProcessInfo();
1568 getMyMemoryState(info);
1569 reply.writeNoException();
1570 info.writeToParcel(reply, 0);
1571 return true;
1572 }
1573
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001574 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1575 data.enforceInterface(IActivityManager.descriptor);
1576 ConfigurationInfo config = getDeviceConfigurationInfo();
1577 reply.writeNoException();
1578 config.writeToParcel(reply, 0);
1579 return true;
1580 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001581
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001582 case PROFILE_CONTROL_TRANSACTION: {
1583 data.enforceInterface(IActivityManager.descriptor);
1584 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001585 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001586 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001587 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001588 ProfilerInfo profilerInfo = data.readInt() != 0
1589 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1590 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001591 reply.writeNoException();
1592 reply.writeInt(res ? 1 : 0);
1593 return true;
1594 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001595
Dianne Hackborn55280a92009-05-07 15:53:46 -07001596 case SHUTDOWN_TRANSACTION: {
1597 data.enforceInterface(IActivityManager.descriptor);
1598 boolean res = shutdown(data.readInt());
1599 reply.writeNoException();
1600 reply.writeInt(res ? 1 : 0);
1601 return true;
1602 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001603
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001604 case STOP_APP_SWITCHES_TRANSACTION: {
1605 data.enforceInterface(IActivityManager.descriptor);
1606 stopAppSwitches();
1607 reply.writeNoException();
1608 return true;
1609 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001610
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001611 case RESUME_APP_SWITCHES_TRANSACTION: {
1612 data.enforceInterface(IActivityManager.descriptor);
1613 resumeAppSwitches();
1614 reply.writeNoException();
1615 return true;
1616 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001617
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001618 case PEEK_SERVICE_TRANSACTION: {
1619 data.enforceInterface(IActivityManager.descriptor);
1620 Intent service = Intent.CREATOR.createFromParcel(data);
1621 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001622 String callingPackage = data.readString();
1623 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001624 reply.writeNoException();
1625 reply.writeStrongBinder(binder);
1626 return true;
1627 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001628
Christopher Tate181fafa2009-05-14 11:12:14 -07001629 case START_BACKUP_AGENT_TRANSACTION: {
1630 data.enforceInterface(IActivityManager.descriptor);
1631 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1632 int backupRestoreMode = data.readInt();
1633 boolean success = bindBackupAgent(info, backupRestoreMode);
1634 reply.writeNoException();
1635 reply.writeInt(success ? 1 : 0);
1636 return true;
1637 }
1638
1639 case BACKUP_AGENT_CREATED_TRANSACTION: {
1640 data.enforceInterface(IActivityManager.descriptor);
1641 String packageName = data.readString();
1642 IBinder agent = data.readStrongBinder();
1643 backupAgentCreated(packageName, agent);
1644 reply.writeNoException();
1645 return true;
1646 }
1647
1648 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1649 data.enforceInterface(IActivityManager.descriptor);
1650 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1651 unbindBackupAgent(info);
1652 reply.writeNoException();
1653 return true;
1654 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001655
1656 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1657 data.enforceInterface(IActivityManager.descriptor);
1658 String packageName = data.readString();
1659 addPackageDependency(packageName);
1660 reply.writeNoException();
1661 return true;
1662 }
1663
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001664 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001665 data.enforceInterface(IActivityManager.descriptor);
1666 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001667 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001668 String reason = data.readString();
1669 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001670 reply.writeNoException();
1671 return true;
1672 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001673
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001674 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1675 data.enforceInterface(IActivityManager.descriptor);
1676 String reason = data.readString();
1677 closeSystemDialogs(reason);
1678 reply.writeNoException();
1679 return true;
1680 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001681
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001682 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1683 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001684 int[] pids = data.createIntArray();
1685 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001686 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001687 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001688 return true;
1689 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001690
1691 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1692 data.enforceInterface(IActivityManager.descriptor);
1693 String processName = data.readString();
1694 int uid = data.readInt();
1695 killApplicationProcess(processName, uid);
1696 reply.writeNoException();
1697 return true;
1698 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001699
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001700 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1701 data.enforceInterface(IActivityManager.descriptor);
1702 IBinder token = data.readStrongBinder();
1703 String packageName = data.readString();
1704 int enterAnim = data.readInt();
1705 int exitAnim = data.readInt();
1706 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001707 reply.writeNoException();
1708 return true;
1709 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001710
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001711 case IS_USER_A_MONKEY_TRANSACTION: {
1712 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001713 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001714 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001715 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001716 return true;
1717 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001718
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001719 case SET_USER_IS_MONKEY_TRANSACTION: {
1720 data.enforceInterface(IActivityManager.descriptor);
1721 final boolean monkey = (data.readInt() == 1);
1722 setUserIsMonkey(monkey);
1723 reply.writeNoException();
1724 return true;
1725 }
1726
Dianne Hackborn860755f2010-06-03 18:47:52 -07001727 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1728 data.enforceInterface(IActivityManager.descriptor);
1729 finishHeavyWeightApp();
1730 reply.writeNoException();
1731 return true;
1732 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001733
1734 case IS_IMMERSIVE_TRANSACTION: {
1735 data.enforceInterface(IActivityManager.descriptor);
1736 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001737 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001738 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001739 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001740 return true;
1741 }
1742
Craig Mautnerd61dc202014-07-07 11:09:11 -07001743 case IS_TOP_OF_TASK_TRANSACTION: {
1744 data.enforceInterface(IActivityManager.descriptor);
1745 IBinder token = data.readStrongBinder();
1746 final boolean isTopOfTask = isTopOfTask(token);
1747 reply.writeNoException();
1748 reply.writeInt(isTopOfTask ? 1 : 0);
1749 return true;
1750 }
1751
Craig Mautner5eda9b32013-07-02 11:58:16 -07001752 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001753 data.enforceInterface(IActivityManager.descriptor);
1754 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001755 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001756 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001757 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001758 return true;
1759 }
1760
1761 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001764 final Bundle bundle;
1765 if (data.readInt() == 0) {
1766 bundle = null;
1767 } else {
1768 bundle = data.readBundle();
1769 }
Chong Zhang280d3322015-11-03 17:27:26 -08001770 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Craig Mautner233ceee2014-05-09 17:05:11 -07001771 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001772 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001773 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001774 return true;
1775 }
1776
Craig Mautner233ceee2014-05-09 17:05:11 -07001777 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1778 data.enforceInterface(IActivityManager.descriptor);
1779 IBinder token = data.readStrongBinder();
1780 final ActivityOptions options = getActivityOptions(token);
1781 reply.writeNoException();
1782 reply.writeBundle(options == null ? null : options.toBundle());
1783 return true;
1784 }
1785
Daniel Sandler69a48172010-06-23 16:29:36 -04001786 case SET_IMMERSIVE_TRANSACTION: {
1787 data.enforceInterface(IActivityManager.descriptor);
1788 IBinder token = data.readStrongBinder();
1789 boolean imm = data.readInt() == 1;
1790 setImmersive(token, imm);
1791 reply.writeNoException();
1792 return true;
1793 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001794
Daniel Sandler69a48172010-06-23 16:29:36 -04001795 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1796 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001797 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001798 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001799 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001800 return true;
1801 }
1802
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001803 case CRASH_APPLICATION_TRANSACTION: {
1804 data.enforceInterface(IActivityManager.descriptor);
1805 int uid = data.readInt();
1806 int initialPid = data.readInt();
1807 String packageName = data.readString();
1808 String message = data.readString();
1809 crashApplication(uid, initialPid, packageName, message);
1810 reply.writeNoException();
1811 return true;
1812 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001813
1814 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1815 data.enforceInterface(IActivityManager.descriptor);
1816 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001817 int userId = data.readInt();
1818 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001819 reply.writeNoException();
1820 reply.writeString(type);
1821 return true;
1822 }
1823
Dianne Hackborn7e269642010-08-25 19:50:20 -07001824 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1825 data.enforceInterface(IActivityManager.descriptor);
1826 String name = data.readString();
1827 IBinder perm = newUriPermissionOwner(name);
1828 reply.writeNoException();
1829 reply.writeStrongBinder(perm);
1830 return true;
1831 }
1832
1833 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1834 data.enforceInterface(IActivityManager.descriptor);
1835 IBinder owner = data.readStrongBinder();
1836 int fromUid = data.readInt();
1837 String targetPkg = data.readString();
1838 Uri uri = Uri.CREATOR.createFromParcel(data);
1839 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001840 int sourceUserId = data.readInt();
1841 int targetUserId = data.readInt();
1842 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1843 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001844 reply.writeNoException();
1845 return true;
1846 }
1847
1848 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1849 data.enforceInterface(IActivityManager.descriptor);
1850 IBinder owner = data.readStrongBinder();
1851 Uri uri = null;
1852 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001853 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001854 }
1855 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001856 int userId = data.readInt();
1857 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001858 reply.writeNoException();
1859 return true;
1860 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001861
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001862 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1863 data.enforceInterface(IActivityManager.descriptor);
1864 int callingUid = data.readInt();
1865 String targetPkg = data.readString();
1866 Uri uri = Uri.CREATOR.createFromParcel(data);
1867 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001868 int userId = data.readInt();
1869 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001870 reply.writeNoException();
1871 reply.writeInt(res);
1872 return true;
1873 }
1874
Andy McFadden824c5102010-07-09 16:26:57 -07001875 case DUMP_HEAP_TRANSACTION: {
1876 data.enforceInterface(IActivityManager.descriptor);
1877 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001878 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001879 boolean managed = data.readInt() != 0;
1880 String path = data.readString();
1881 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001882 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001883 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001884 reply.writeNoException();
1885 reply.writeInt(res ? 1 : 0);
1886 return true;
1887 }
1888
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001889 case START_ACTIVITIES_TRANSACTION:
1890 {
1891 data.enforceInterface(IActivityManager.descriptor);
1892 IBinder b = data.readStrongBinder();
1893 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001894 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001895 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1896 String[] resolvedTypes = data.createStringArray();
1897 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001898 Bundle options = data.readInt() != 0
1899 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001900 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001901 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001902 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001903 reply.writeNoException();
1904 reply.writeInt(result);
1905 return true;
1906 }
1907
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001908 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1909 {
1910 data.enforceInterface(IActivityManager.descriptor);
1911 int mode = getFrontActivityScreenCompatMode();
1912 reply.writeNoException();
1913 reply.writeInt(mode);
1914 return true;
1915 }
1916
1917 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1918 {
1919 data.enforceInterface(IActivityManager.descriptor);
1920 int mode = data.readInt();
1921 setFrontActivityScreenCompatMode(mode);
1922 reply.writeNoException();
1923 reply.writeInt(mode);
1924 return true;
1925 }
1926
1927 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1928 {
1929 data.enforceInterface(IActivityManager.descriptor);
1930 String pkg = data.readString();
1931 int mode = getPackageScreenCompatMode(pkg);
1932 reply.writeNoException();
1933 reply.writeInt(mode);
1934 return true;
1935 }
1936
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001937 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1938 {
1939 data.enforceInterface(IActivityManager.descriptor);
1940 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001941 int mode = data.readInt();
1942 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001943 reply.writeNoException();
1944 return true;
1945 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001946
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001947 case SWITCH_USER_TRANSACTION: {
1948 data.enforceInterface(IActivityManager.descriptor);
1949 int userid = data.readInt();
1950 boolean result = switchUser(userid);
1951 reply.writeNoException();
1952 reply.writeInt(result ? 1 : 0);
1953 return true;
1954 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001955
Kenny Guy08488bf2014-02-21 17:40:37 +00001956 case START_USER_IN_BACKGROUND_TRANSACTION: {
1957 data.enforceInterface(IActivityManager.descriptor);
1958 int userid = data.readInt();
1959 boolean result = startUserInBackground(userid);
1960 reply.writeNoException();
1961 reply.writeInt(result ? 1 : 0);
1962 return true;
1963 }
1964
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001965 case STOP_USER_TRANSACTION: {
1966 data.enforceInterface(IActivityManager.descriptor);
1967 int userid = data.readInt();
1968 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1969 data.readStrongBinder());
1970 int result = stopUser(userid, callback);
1971 reply.writeNoException();
1972 reply.writeInt(result);
1973 return true;
1974 }
1975
Amith Yamasani52f1d752012-03-28 18:19:29 -07001976 case GET_CURRENT_USER_TRANSACTION: {
1977 data.enforceInterface(IActivityManager.descriptor);
1978 UserInfo userInfo = getCurrentUser();
1979 reply.writeNoException();
1980 userInfo.writeToParcel(reply, 0);
1981 return true;
1982 }
1983
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001984 case IS_USER_RUNNING_TRANSACTION: {
1985 data.enforceInterface(IActivityManager.descriptor);
1986 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08001987 int _flags = data.readInt();
1988 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001989 reply.writeNoException();
1990 reply.writeInt(result ? 1 : 0);
1991 return true;
1992 }
1993
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001994 case GET_RUNNING_USER_IDS_TRANSACTION: {
1995 data.enforceInterface(IActivityManager.descriptor);
1996 int[] result = getRunningUserIds();
1997 reply.writeNoException();
1998 reply.writeIntArray(result);
1999 return true;
2000 }
2001
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002002 case REMOVE_TASK_TRANSACTION:
2003 {
2004 data.enforceInterface(IActivityManager.descriptor);
2005 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002006 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002007 reply.writeNoException();
2008 reply.writeInt(result ? 1 : 0);
2009 return true;
2010 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002011
Jeff Sharkeya4620792011-05-20 15:29:23 -07002012 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2013 data.enforceInterface(IActivityManager.descriptor);
2014 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2015 data.readStrongBinder());
2016 registerProcessObserver(observer);
2017 return true;
2018 }
2019
2020 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2021 data.enforceInterface(IActivityManager.descriptor);
2022 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2023 data.readStrongBinder());
2024 unregisterProcessObserver(observer);
2025 return true;
2026 }
2027
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002028 case REGISTER_UID_OBSERVER_TRANSACTION: {
2029 data.enforceInterface(IActivityManager.descriptor);
2030 IUidObserver observer = IUidObserver.Stub.asInterface(
2031 data.readStrongBinder());
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002032 int which = data.readInt();
2033 registerUidObserver(observer, which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002034 return true;
2035 }
2036
2037 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2038 data.enforceInterface(IActivityManager.descriptor);
2039 IUidObserver observer = IUidObserver.Stub.asInterface(
2040 data.readStrongBinder());
2041 unregisterUidObserver(observer);
2042 return true;
2043 }
2044
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002045 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2046 {
2047 data.enforceInterface(IActivityManager.descriptor);
2048 String pkg = data.readString();
2049 boolean ask = getPackageAskScreenCompat(pkg);
2050 reply.writeNoException();
2051 reply.writeInt(ask ? 1 : 0);
2052 return true;
2053 }
2054
2055 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2056 {
2057 data.enforceInterface(IActivityManager.descriptor);
2058 String pkg = data.readString();
2059 boolean ask = data.readInt() != 0;
2060 setPackageAskScreenCompat(pkg, ask);
2061 reply.writeNoException();
2062 return true;
2063 }
2064
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002065 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2066 data.enforceInterface(IActivityManager.descriptor);
2067 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002068 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002069 boolean res = isIntentSenderTargetedToPackage(r);
2070 reply.writeNoException();
2071 reply.writeInt(res ? 1 : 0);
2072 return true;
2073 }
2074
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002075 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2076 data.enforceInterface(IActivityManager.descriptor);
2077 IIntentSender r = IIntentSender.Stub.asInterface(
2078 data.readStrongBinder());
2079 boolean res = isIntentSenderAnActivity(r);
2080 reply.writeNoException();
2081 reply.writeInt(res ? 1 : 0);
2082 return true;
2083 }
2084
Dianne Hackborn81038902012-11-26 17:04:09 -08002085 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2086 data.enforceInterface(IActivityManager.descriptor);
2087 IIntentSender r = IIntentSender.Stub.asInterface(
2088 data.readStrongBinder());
2089 Intent intent = getIntentForIntentSender(r);
2090 reply.writeNoException();
2091 if (intent != null) {
2092 reply.writeInt(1);
2093 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2094 } else {
2095 reply.writeInt(0);
2096 }
2097 return true;
2098 }
2099
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002100 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2101 data.enforceInterface(IActivityManager.descriptor);
2102 IIntentSender r = IIntentSender.Stub.asInterface(
2103 data.readStrongBinder());
2104 String prefix = data.readString();
2105 String tag = getTagForIntentSender(r, prefix);
2106 reply.writeNoException();
2107 reply.writeString(tag);
2108 return true;
2109 }
2110
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002111 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2112 data.enforceInterface(IActivityManager.descriptor);
2113 Configuration config = Configuration.CREATOR.createFromParcel(data);
2114 updatePersistentConfiguration(config);
2115 reply.writeNoException();
2116 return true;
2117 }
2118
Dianne Hackbornb437e092011-08-05 17:50:29 -07002119 case GET_PROCESS_PSS_TRANSACTION: {
2120 data.enforceInterface(IActivityManager.descriptor);
2121 int[] pids = data.createIntArray();
2122 long[] pss = getProcessPss(pids);
2123 reply.writeNoException();
2124 reply.writeLongArray(pss);
2125 return true;
2126 }
2127
Dianne Hackborn661cd522011-08-22 00:26:20 -07002128 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2129 data.enforceInterface(IActivityManager.descriptor);
2130 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2131 boolean always = data.readInt() != 0;
2132 showBootMessage(msg, always);
2133 reply.writeNoException();
2134 return true;
2135 }
2136
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002137 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002138 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002139 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002140 reply.writeNoException();
2141 return true;
2142 }
2143
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002144 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2145 data.enforceInterface(IActivityManager.descriptor);
2146 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2147 reply.writeNoException();
2148 return true;
2149 }
2150
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002151 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002152 data.enforceInterface(IActivityManager.descriptor);
2153 IBinder token = data.readStrongBinder();
2154 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002155 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002156 reply.writeNoException();
2157 reply.writeInt(res ? 1 : 0);
2158 return true;
2159 }
2160
2161 case NAVIGATE_UP_TO_TRANSACTION: {
2162 data.enforceInterface(IActivityManager.descriptor);
2163 IBinder token = data.readStrongBinder();
2164 Intent target = Intent.CREATOR.createFromParcel(data);
2165 int resultCode = data.readInt();
2166 Intent resultData = null;
2167 if (data.readInt() != 0) {
2168 resultData = Intent.CREATOR.createFromParcel(data);
2169 }
2170 boolean res = navigateUpTo(token, target, resultCode, resultData);
2171 reply.writeNoException();
2172 reply.writeInt(res ? 1 : 0);
2173 return true;
2174 }
2175
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002176 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2177 data.enforceInterface(IActivityManager.descriptor);
2178 IBinder token = data.readStrongBinder();
2179 int res = getLaunchedFromUid(token);
2180 reply.writeNoException();
2181 reply.writeInt(res);
2182 return true;
2183 }
2184
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002185 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2186 data.enforceInterface(IActivityManager.descriptor);
2187 IBinder token = data.readStrongBinder();
2188 String res = getLaunchedFromPackage(token);
2189 reply.writeNoException();
2190 reply.writeString(res);
2191 return true;
2192 }
2193
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002194 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2195 data.enforceInterface(IActivityManager.descriptor);
2196 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2197 data.readStrongBinder());
2198 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002199 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002200 return true;
2201 }
2202
2203 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2204 data.enforceInterface(IActivityManager.descriptor);
2205 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2206 data.readStrongBinder());
2207 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002208 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002209 return true;
2210 }
2211
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002212 case REQUEST_BUG_REPORT_TRANSACTION: {
2213 data.enforceInterface(IActivityManager.descriptor);
2214 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002215 reply.writeNoException();
2216 return true;
2217 }
2218
2219 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2220 data.enforceInterface(IActivityManager.descriptor);
2221 int pid = data.readInt();
2222 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002223 String reason = data.readString();
2224 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002225 reply.writeNoException();
2226 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002227 return true;
2228 }
2229
Adam Skorydfc7fd72013-08-05 19:23:41 -07002230 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002231 data.enforceInterface(IActivityManager.descriptor);
2232 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002233 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002234 reply.writeNoException();
2235 reply.writeBundle(res);
2236 return true;
2237 }
2238
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002239 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2240 data.enforceInterface(IActivityManager.descriptor);
2241 int requestType = data.readInt();
2242 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002243 IBinder activityToken = data.readStrongBinder();
2244 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002245 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002246 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002247 return true;
2248 }
2249
Adam Skorydfc7fd72013-08-05 19:23:41 -07002250 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002251 data.enforceInterface(IActivityManager.descriptor);
2252 IBinder token = data.readStrongBinder();
2253 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002254 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2255 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002256 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2257 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002258 reply.writeNoException();
2259 return true;
2260 }
2261
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002262 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2263 data.enforceInterface(IActivityManager.descriptor);
2264 Intent intent = Intent.CREATOR.createFromParcel(data);
2265 int requestType = data.readInt();
2266 String hint = data.readString();
2267 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002268 Bundle args = data.readBundle();
2269 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002270 reply.writeNoException();
2271 reply.writeInt(res ? 1 : 0);
2272 return true;
2273 }
2274
Benjamin Franzc200f442015-06-25 18:20:04 +01002275 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2276 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002277 boolean res = isAssistDataAllowedOnCurrentActivity();
2278 reply.writeNoException();
2279 reply.writeInt(res ? 1 : 0);
2280 return true;
2281 }
2282
2283 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2284 data.enforceInterface(IActivityManager.descriptor);
2285 IBinder token = data.readStrongBinder();
2286 Bundle args = data.readBundle();
2287 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002288 reply.writeNoException();
2289 reply.writeInt(res ? 1 : 0);
2290 return true;
2291 }
2292
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002293 case KILL_UID_TRANSACTION: {
2294 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002295 int appId = data.readInt();
2296 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002297 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002298 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002299 reply.writeNoException();
2300 return true;
2301 }
2302
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002303 case HANG_TRANSACTION: {
2304 data.enforceInterface(IActivityManager.descriptor);
2305 IBinder who = data.readStrongBinder();
2306 boolean allowRestart = data.readInt() != 0;
2307 hang(who, allowRestart);
2308 reply.writeNoException();
2309 return true;
2310 }
2311
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002312 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2313 data.enforceInterface(IActivityManager.descriptor);
2314 IBinder token = data.readStrongBinder();
2315 reportActivityFullyDrawn(token);
2316 reply.writeNoException();
2317 return true;
2318 }
2319
Craig Mautner5eda9b32013-07-02 11:58:16 -07002320 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2321 data.enforceInterface(IActivityManager.descriptor);
2322 IBinder token = data.readStrongBinder();
2323 notifyActivityDrawn(token);
2324 reply.writeNoException();
2325 return true;
2326 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002327
2328 case RESTART_TRANSACTION: {
2329 data.enforceInterface(IActivityManager.descriptor);
2330 restart();
2331 reply.writeNoException();
2332 return true;
2333 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002334
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002335 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2336 data.enforceInterface(IActivityManager.descriptor);
2337 performIdleMaintenance();
2338 reply.writeNoException();
2339 return true;
2340 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002341
Todd Kennedyca4d8422015-01-15 15:19:22 -08002342 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002343 data.enforceInterface(IActivityManager.descriptor);
2344 IBinder parentActivityToken = data.readStrongBinder();
2345 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002346 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002347 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002348 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002349 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002350 if (activityContainer != null) {
2351 reply.writeInt(1);
2352 reply.writeStrongBinder(activityContainer.asBinder());
2353 } else {
2354 reply.writeInt(0);
2355 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002356 return true;
2357 }
2358
Craig Mautner95da1082014-02-24 17:54:35 -08002359 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2360 data.enforceInterface(IActivityManager.descriptor);
2361 IActivityContainer activityContainer =
2362 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2363 deleteActivityContainer(activityContainer);
2364 reply.writeNoException();
2365 return true;
2366 }
2367
Todd Kennedy4900bf92015-01-16 16:05:14 -08002368 case CREATE_STACK_ON_DISPLAY: {
2369 data.enforceInterface(IActivityManager.descriptor);
2370 int displayId = data.readInt();
2371 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2372 reply.writeNoException();
2373 if (activityContainer != null) {
2374 reply.writeInt(1);
2375 reply.writeStrongBinder(activityContainer.asBinder());
2376 } else {
2377 reply.writeInt(0);
2378 }
2379 return true;
2380 }
2381
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002382 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002383 data.enforceInterface(IActivityManager.descriptor);
2384 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002385 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002386 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002387 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002388 return true;
2389 }
2390
Craig Mautneraea74a52014-03-08 14:23:10 -08002391 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2392 data.enforceInterface(IActivityManager.descriptor);
2393 final int taskId = data.readInt();
2394 startLockTaskMode(taskId);
2395 reply.writeNoException();
2396 return true;
2397 }
2398
2399 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2400 data.enforceInterface(IActivityManager.descriptor);
2401 IBinder token = data.readStrongBinder();
2402 startLockTaskMode(token);
2403 reply.writeNoException();
2404 return true;
2405 }
2406
Craig Mautnerd61dc202014-07-07 11:09:11 -07002407 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002408 data.enforceInterface(IActivityManager.descriptor);
2409 startLockTaskModeOnCurrent();
2410 reply.writeNoException();
2411 return true;
2412 }
2413
Craig Mautneraea74a52014-03-08 14:23:10 -08002414 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2415 data.enforceInterface(IActivityManager.descriptor);
2416 stopLockTaskMode();
2417 reply.writeNoException();
2418 return true;
2419 }
2420
Craig Mautnerd61dc202014-07-07 11:09:11 -07002421 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002422 data.enforceInterface(IActivityManager.descriptor);
2423 stopLockTaskModeOnCurrent();
2424 reply.writeNoException();
2425 return true;
2426 }
2427
Craig Mautneraea74a52014-03-08 14:23:10 -08002428 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2429 data.enforceInterface(IActivityManager.descriptor);
2430 final boolean isInLockTaskMode = isInLockTaskMode();
2431 reply.writeNoException();
2432 reply.writeInt(isInLockTaskMode ? 1 : 0);
2433 return true;
2434 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002435
Benjamin Franz43261142015-02-11 15:59:44 +00002436 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2437 data.enforceInterface(IActivityManager.descriptor);
2438 final int lockTaskModeState = getLockTaskModeState();
2439 reply.writeNoException();
2440 reply.writeInt(lockTaskModeState);
2441 return true;
2442 }
2443
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002444 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2445 data.enforceInterface(IActivityManager.descriptor);
2446 final IBinder token = data.readStrongBinder();
2447 showLockTaskEscapeMessage(token);
2448 reply.writeNoException();
2449 return true;
2450 }
2451
Winson Chunga449dc02014-05-16 11:15:04 -07002452 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002453 data.enforceInterface(IActivityManager.descriptor);
2454 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002455 ActivityManager.TaskDescription values =
2456 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2457 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002458 reply.writeNoException();
2459 return true;
2460 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002461
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002462 case SET_TASK_RESIZEABLE_TRANSACTION: {
2463 data.enforceInterface(IActivityManager.descriptor);
2464 int taskId = data.readInt();
2465 boolean resizeable = (data.readInt() == 1) ? true : false;
2466 setTaskResizeable(taskId, resizeable);
2467 reply.writeNoException();
2468 return true;
2469 }
2470
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002471 case RESIZE_TASK_TRANSACTION: {
2472 data.enforceInterface(IActivityManager.descriptor);
2473 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002474 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002475 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002476 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002477 reply.writeNoException();
2478 return true;
2479 }
2480
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002481 case GET_TASK_BOUNDS_TRANSACTION: {
2482 data.enforceInterface(IActivityManager.descriptor);
2483 int taskId = data.readInt();
2484 Rect r = getTaskBounds(taskId);
2485 reply.writeNoException();
2486 r.writeToParcel(reply, 0);
2487 return true;
2488 }
2489
Craig Mautner648f69b2014-09-18 14:16:26 -07002490 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2491 data.enforceInterface(IActivityManager.descriptor);
2492 String filename = data.readString();
2493 Bitmap icon = getTaskDescriptionIcon(filename);
2494 reply.writeNoException();
2495 if (icon == null) {
2496 reply.writeInt(0);
2497 } else {
2498 reply.writeInt(1);
2499 icon.writeToParcel(reply, 0);
2500 }
2501 return true;
2502 }
2503
Winson Chung044d5292014-11-06 11:05:19 -08002504 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2505 data.enforceInterface(IActivityManager.descriptor);
2506 final Bundle bundle;
2507 if (data.readInt() == 0) {
2508 bundle = null;
2509 } else {
2510 bundle = data.readBundle();
2511 }
Chong Zhang280d3322015-11-03 17:27:26 -08002512 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002513 startInPlaceAnimationOnFrontMostApplication(options);
2514 reply.writeNoException();
2515 return true;
2516 }
2517
Jose Lima4b6c6692014-08-12 17:41:12 -07002518 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002519 data.enforceInterface(IActivityManager.descriptor);
2520 IBinder token = data.readStrongBinder();
2521 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002522 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002523 reply.writeNoException();
2524 reply.writeInt(success ? 1 : 0);
2525 return true;
2526 }
2527
Jose Lima4b6c6692014-08-12 17:41:12 -07002528 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002529 data.enforceInterface(IActivityManager.descriptor);
2530 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002531 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002532 reply.writeNoException();
2533 reply.writeInt(enabled ? 1 : 0);
2534 return true;
2535 }
2536
Jose Lima4b6c6692014-08-12 17:41:12 -07002537 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002538 data.enforceInterface(IActivityManager.descriptor);
2539 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002540 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002541 reply.writeNoException();
2542 return true;
2543 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002544
2545 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2546 data.enforceInterface(IActivityManager.descriptor);
2547 IBinder token = data.readStrongBinder();
2548 notifyLaunchTaskBehindComplete(token);
2549 reply.writeNoException();
2550 return true;
2551 }
Craig Mautner8746a472014-07-24 15:12:54 -07002552
2553 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2554 data.enforceInterface(IActivityManager.descriptor);
2555 IBinder token = data.readStrongBinder();
2556 notifyEnterAnimationComplete(token);
2557 reply.writeNoException();
2558 return true;
2559 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002560
2561 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2562 data.enforceInterface(IActivityManager.descriptor);
2563 bootAnimationComplete();
2564 reply.writeNoException();
2565 return true;
2566 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002567
Jeff Sharkey605eb792014-11-04 13:34:06 -08002568 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2569 data.enforceInterface(IActivityManager.descriptor);
2570 final int uid = data.readInt();
2571 final byte[] firstPacket = data.createByteArray();
2572 notifyCleartextNetwork(uid, firstPacket);
2573 reply.writeNoException();
2574 return true;
2575 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002576
2577 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2578 data.enforceInterface(IActivityManager.descriptor);
2579 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002580 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002581 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002582 String reportPackage = data.readString();
2583 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002584 reply.writeNoException();
2585 return true;
2586 }
2587
2588 case DUMP_HEAP_FINISHED_TRANSACTION: {
2589 data.enforceInterface(IActivityManager.descriptor);
2590 String path = data.readString();
2591 dumpHeapFinished(path);
2592 reply.writeNoException();
2593 return true;
2594 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002595
2596 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2597 data.enforceInterface(IActivityManager.descriptor);
2598 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2599 data.readStrongBinder());
2600 boolean keepAwake = data.readInt() != 0;
2601 setVoiceKeepAwake(session, keepAwake);
2602 reply.writeNoException();
2603 return true;
2604 }
Craig Mautnere5600772015-04-03 21:36:37 -07002605
2606 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2607 data.enforceInterface(IActivityManager.descriptor);
2608 int userId = data.readInt();
2609 String[] packages = data.readStringArray();
2610 updateLockTaskPackages(userId, packages);
2611 reply.writeNoException();
2612 return true;
2613 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002614
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002615 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2616 data.enforceInterface(IActivityManager.descriptor);
2617 String packageName = data.readString();
2618 updateDeviceOwner(packageName);
2619 reply.writeNoException();
2620 return true;
2621 }
2622
Dianne Hackborn1e383822015-04-10 14:02:33 -07002623 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2624 data.enforceInterface(IActivityManager.descriptor);
2625 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002626 String callingPackage = data.readString();
2627 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002628 reply.writeNoException();
2629 reply.writeInt(res);
2630 return true;
2631 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002632
2633 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2634 data.enforceInterface(IActivityManager.descriptor);
2635 String process = data.readString();
2636 int userId = data.readInt();
2637 int level = data.readInt();
2638 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2639 reply.writeNoException();
2640 reply.writeInt(res ? 1 : 0);
2641 return true;
2642 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002643
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002644 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2645 data.enforceInterface(IActivityManager.descriptor);
2646 IBinder token = data.readStrongBinder();
2647 boolean res = isRootVoiceInteraction(token);
2648 reply.writeNoException();
2649 reply.writeInt(res ? 1 : 0);
2650 return true;
2651 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002652
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002653 case START_BINDER_TRACKING_TRANSACTION: {
2654 data.enforceInterface(IActivityManager.descriptor);
2655 boolean res = startBinderTracking();
2656 reply.writeNoException();
2657 reply.writeInt(res ? 1 : 0);
2658 return true;
2659 }
2660
2661 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2662 data.enforceInterface(IActivityManager.descriptor);
2663 ParcelFileDescriptor fd = data.readInt() != 0
2664 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2665 boolean res = stopBinderTrackingAndDump(fd);
2666 reply.writeNoException();
2667 reply.writeInt(res ? 1 : 0);
2668 return true;
2669 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002670 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2671 data.enforceInterface(IActivityManager.descriptor);
2672 IBinder token = data.readStrongBinder();
2673 int stackId = getActivityStackId(token);
2674 reply.writeNoException();
2675 reply.writeInt(stackId);
2676 return true;
2677 }
2678 case MOVE_ACTIVITY_TO_STACK_TRANSACTION: {
2679 data.enforceInterface(IActivityManager.descriptor);
2680 IBinder token = data.readStrongBinder();
2681 int stackId = data.readInt();
2682 moveActivityToStack(token, stackId);
2683 reply.writeNoException();
2684 return true;
2685 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002686 case REPORT_SIZE_CONFIGURATIONS: {
2687 data.enforceInterface(IActivityManager.descriptor);
2688 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002689 int[] horizontal = readIntArray(data);
2690 int[] vertical = readIntArray(data);
2691 int[] smallest = readIntArray(data);
2692 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002693 return true;
2694 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002695 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2696 data.enforceInterface(IActivityManager.descriptor);
2697 final boolean suppress = data.readInt() == 1;
2698 suppressResizeConfigChanges(suppress);
2699 reply.writeNoException();
2700 return true;
2701 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002702 case REMOVE_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002703 data.enforceInterface(IActivityManager.descriptor);
2704 final int stackId = data.readInt();
2705 removeStack(stackId);
2706 reply.writeNoException();
2707 return true;
2708 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002709 case GET_APP_START_MODE_TRANSACTION: {
2710 data.enforceInterface(IActivityManager.descriptor);
2711 final int uid = data.readInt();
2712 final String pkg = data.readString();
2713 int res = getAppStartMode(uid, pkg);
2714 reply.writeNoException();
2715 reply.writeInt(res);
2716 return true;
2717 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002718 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002719
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002720 return super.onTransact(code, data, reply, flags);
2721 }
2722
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002723 private int[] readIntArray(Parcel data) {
2724 int[] smallest = null;
2725 int smallestSize = data.readInt();
2726 if (smallestSize > 0) {
2727 smallest = new int[smallestSize];
2728 data.readIntArray(smallest);
2729 }
2730 return smallest;
2731 }
2732
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002733 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002734 return this;
2735 }
2736
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002737 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2738 protected IActivityManager create() {
2739 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002740 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002741 Log.v("ActivityManager", "default service binder = " + b);
2742 }
2743 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002744 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002745 Log.v("ActivityManager", "default service = " + am);
2746 }
2747 return am;
2748 }
2749 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002750}
2751
2752class ActivityManagerProxy implements IActivityManager
2753{
2754 public ActivityManagerProxy(IBinder remote)
2755 {
2756 mRemote = remote;
2757 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002758
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002759 public IBinder asBinder()
2760 {
2761 return mRemote;
2762 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002763
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002764 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002765 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002766 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002767 Parcel data = Parcel.obtain();
2768 Parcel reply = Parcel.obtain();
2769 data.writeInterfaceToken(IActivityManager.descriptor);
2770 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002771 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002772 intent.writeToParcel(data, 0);
2773 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002774 data.writeStrongBinder(resultTo);
2775 data.writeString(resultWho);
2776 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002777 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002778 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002779 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002780 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002781 } else {
2782 data.writeInt(0);
2783 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002784 if (options != null) {
2785 data.writeInt(1);
2786 options.writeToParcel(data, 0);
2787 } else {
2788 data.writeInt(0);
2789 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002790 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2791 reply.readException();
2792 int result = reply.readInt();
2793 reply.recycle();
2794 data.recycle();
2795 return result;
2796 }
Amith Yamasani82644082012-08-03 13:09:11 -07002797
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002798 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002799 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002800 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2801 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002802 Parcel data = Parcel.obtain();
2803 Parcel reply = Parcel.obtain();
2804 data.writeInterfaceToken(IActivityManager.descriptor);
2805 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002806 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002807 intent.writeToParcel(data, 0);
2808 data.writeString(resolvedType);
2809 data.writeStrongBinder(resultTo);
2810 data.writeString(resultWho);
2811 data.writeInt(requestCode);
2812 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002813 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002814 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002815 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002816 } else {
2817 data.writeInt(0);
2818 }
2819 if (options != null) {
2820 data.writeInt(1);
2821 options.writeToParcel(data, 0);
2822 } else {
2823 data.writeInt(0);
2824 }
2825 data.writeInt(userId);
2826 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2827 reply.readException();
2828 int result = reply.readInt();
2829 reply.recycle();
2830 data.recycle();
2831 return result;
2832 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002833 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2834 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002835 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2836 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002837 Parcel data = Parcel.obtain();
2838 Parcel reply = Parcel.obtain();
2839 data.writeInterfaceToken(IActivityManager.descriptor);
2840 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2841 data.writeString(callingPackage);
2842 intent.writeToParcel(data, 0);
2843 data.writeString(resolvedType);
2844 data.writeStrongBinder(resultTo);
2845 data.writeString(resultWho);
2846 data.writeInt(requestCode);
2847 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002848 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002849 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002850 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002851 } else {
2852 data.writeInt(0);
2853 }
2854 if (options != null) {
2855 data.writeInt(1);
2856 options.writeToParcel(data, 0);
2857 } else {
2858 data.writeInt(0);
2859 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002860 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002861 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002862 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2863 reply.readException();
2864 int result = reply.readInt();
2865 reply.recycle();
2866 data.recycle();
2867 return result;
2868 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002869 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2870 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002871 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2872 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002873 Parcel data = Parcel.obtain();
2874 Parcel reply = Parcel.obtain();
2875 data.writeInterfaceToken(IActivityManager.descriptor);
2876 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002877 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002878 intent.writeToParcel(data, 0);
2879 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002880 data.writeStrongBinder(resultTo);
2881 data.writeString(resultWho);
2882 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002883 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002884 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002885 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002886 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002887 } else {
2888 data.writeInt(0);
2889 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002890 if (options != null) {
2891 data.writeInt(1);
2892 options.writeToParcel(data, 0);
2893 } else {
2894 data.writeInt(0);
2895 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002896 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002897 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2898 reply.readException();
2899 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2900 reply.recycle();
2901 data.recycle();
2902 return result;
2903 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002904 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2905 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002906 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002907 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002908 Parcel data = Parcel.obtain();
2909 Parcel reply = Parcel.obtain();
2910 data.writeInterfaceToken(IActivityManager.descriptor);
2911 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002912 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002913 intent.writeToParcel(data, 0);
2914 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002915 data.writeStrongBinder(resultTo);
2916 data.writeString(resultWho);
2917 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002918 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002919 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002920 if (options != null) {
2921 data.writeInt(1);
2922 options.writeToParcel(data, 0);
2923 } else {
2924 data.writeInt(0);
2925 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002926 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002927 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2928 reply.readException();
2929 int result = reply.readInt();
2930 reply.recycle();
2931 data.recycle();
2932 return result;
2933 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002934 public int startActivityIntentSender(IApplicationThread caller,
2935 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002936 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002937 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002938 Parcel data = Parcel.obtain();
2939 Parcel reply = Parcel.obtain();
2940 data.writeInterfaceToken(IActivityManager.descriptor);
2941 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2942 intent.writeToParcel(data, 0);
2943 if (fillInIntent != null) {
2944 data.writeInt(1);
2945 fillInIntent.writeToParcel(data, 0);
2946 } else {
2947 data.writeInt(0);
2948 }
2949 data.writeString(resolvedType);
2950 data.writeStrongBinder(resultTo);
2951 data.writeString(resultWho);
2952 data.writeInt(requestCode);
2953 data.writeInt(flagsMask);
2954 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002955 if (options != null) {
2956 data.writeInt(1);
2957 options.writeToParcel(data, 0);
2958 } else {
2959 data.writeInt(0);
2960 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002961 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002962 reply.readException();
2963 int result = reply.readInt();
2964 reply.recycle();
2965 data.recycle();
2966 return result;
2967 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002968 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2969 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002970 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2971 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002972 Parcel data = Parcel.obtain();
2973 Parcel reply = Parcel.obtain();
2974 data.writeInterfaceToken(IActivityManager.descriptor);
2975 data.writeString(callingPackage);
2976 data.writeInt(callingPid);
2977 data.writeInt(callingUid);
2978 intent.writeToParcel(data, 0);
2979 data.writeString(resolvedType);
2980 data.writeStrongBinder(session.asBinder());
2981 data.writeStrongBinder(interactor.asBinder());
2982 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002983 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002984 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002985 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -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 }
2995 data.writeInt(userId);
2996 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2997 reply.readException();
2998 int result = reply.readInt();
2999 reply.recycle();
3000 data.recycle();
3001 return result;
3002 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003003 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003004 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003005 Parcel data = Parcel.obtain();
3006 Parcel reply = Parcel.obtain();
3007 data.writeInterfaceToken(IActivityManager.descriptor);
3008 data.writeStrongBinder(callingActivity);
3009 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003010 if (options != null) {
3011 data.writeInt(1);
3012 options.writeToParcel(data, 0);
3013 } else {
3014 data.writeInt(0);
3015 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003016 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3017 reply.readException();
3018 int result = reply.readInt();
3019 reply.recycle();
3020 data.recycle();
3021 return result != 0;
3022 }
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003023 public int startActivityFromRecents(int taskId, int launchStackId, Bundle options)
3024 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003025 Parcel data = Parcel.obtain();
3026 Parcel reply = Parcel.obtain();
3027 data.writeInterfaceToken(IActivityManager.descriptor);
3028 data.writeInt(taskId);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003029 data.writeInt(launchStackId);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003030 if (options == null) {
3031 data.writeInt(0);
3032 } else {
3033 data.writeInt(1);
3034 options.writeToParcel(data, 0);
3035 }
3036 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3037 reply.readException();
3038 int result = reply.readInt();
3039 reply.recycle();
3040 data.recycle();
3041 return result;
3042 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003043 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003044 throws RemoteException {
3045 Parcel data = Parcel.obtain();
3046 Parcel reply = Parcel.obtain();
3047 data.writeInterfaceToken(IActivityManager.descriptor);
3048 data.writeStrongBinder(token);
3049 data.writeInt(resultCode);
3050 if (resultData != null) {
3051 data.writeInt(1);
3052 resultData.writeToParcel(data, 0);
3053 } else {
3054 data.writeInt(0);
3055 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003056 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003057 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3058 reply.readException();
3059 boolean res = reply.readInt() != 0;
3060 data.recycle();
3061 reply.recycle();
3062 return res;
3063 }
3064 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3065 {
3066 Parcel data = Parcel.obtain();
3067 Parcel reply = Parcel.obtain();
3068 data.writeInterfaceToken(IActivityManager.descriptor);
3069 data.writeStrongBinder(token);
3070 data.writeString(resultWho);
3071 data.writeInt(requestCode);
3072 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3073 reply.readException();
3074 data.recycle();
3075 reply.recycle();
3076 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003077 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3078 Parcel data = Parcel.obtain();
3079 Parcel reply = Parcel.obtain();
3080 data.writeInterfaceToken(IActivityManager.descriptor);
3081 data.writeStrongBinder(token);
3082 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3083 reply.readException();
3084 boolean res = reply.readInt() != 0;
3085 data.recycle();
3086 reply.recycle();
3087 return res;
3088 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003089 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3090 Parcel data = Parcel.obtain();
3091 Parcel reply = Parcel.obtain();
3092 data.writeInterfaceToken(IActivityManager.descriptor);
3093 data.writeStrongBinder(session.asBinder());
3094 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3095 reply.readException();
3096 data.recycle();
3097 reply.recycle();
3098 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003099 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3100 Parcel data = Parcel.obtain();
3101 Parcel reply = Parcel.obtain();
3102 data.writeInterfaceToken(IActivityManager.descriptor);
3103 data.writeStrongBinder(token);
3104 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3105 reply.readException();
3106 boolean res = reply.readInt() != 0;
3107 data.recycle();
3108 reply.recycle();
3109 return res;
3110 }
3111 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3112 Parcel data = Parcel.obtain();
3113 Parcel reply = Parcel.obtain();
3114 data.writeInterfaceToken(IActivityManager.descriptor);
3115 data.writeStrongBinder(app.asBinder());
3116 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3117 reply.readException();
3118 data.recycle();
3119 reply.recycle();
3120 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003121 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3122 Parcel data = Parcel.obtain();
3123 Parcel reply = Parcel.obtain();
3124 data.writeInterfaceToken(IActivityManager.descriptor);
3125 data.writeStrongBinder(token);
3126 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3127 reply.readException();
3128 boolean res = reply.readInt() != 0;
3129 data.recycle();
3130 reply.recycle();
3131 return res;
3132 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003133 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003134 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003135 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003136 {
3137 Parcel data = Parcel.obtain();
3138 Parcel reply = Parcel.obtain();
3139 data.writeInterfaceToken(IActivityManager.descriptor);
3140 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003141 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003142 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3143 filter.writeToParcel(data, 0);
3144 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003145 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003146 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3147 reply.readException();
3148 Intent intent = null;
3149 int haveIntent = reply.readInt();
3150 if (haveIntent != 0) {
3151 intent = Intent.CREATOR.createFromParcel(reply);
3152 }
3153 reply.recycle();
3154 data.recycle();
3155 return intent;
3156 }
3157 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3158 {
3159 Parcel data = Parcel.obtain();
3160 Parcel reply = Parcel.obtain();
3161 data.writeInterfaceToken(IActivityManager.descriptor);
3162 data.writeStrongBinder(receiver.asBinder());
3163 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3164 reply.readException();
3165 data.recycle();
3166 reply.recycle();
3167 }
3168 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003169 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003170 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003171 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003172 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003173 {
3174 Parcel data = Parcel.obtain();
3175 Parcel reply = Parcel.obtain();
3176 data.writeInterfaceToken(IActivityManager.descriptor);
3177 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3178 intent.writeToParcel(data, 0);
3179 data.writeString(resolvedType);
3180 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3181 data.writeInt(resultCode);
3182 data.writeString(resultData);
3183 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003184 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003185 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003186 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003187 data.writeInt(serialized ? 1 : 0);
3188 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003189 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003190 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3191 reply.readException();
3192 int res = reply.readInt();
3193 reply.recycle();
3194 data.recycle();
3195 return res;
3196 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003197 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3198 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003199 {
3200 Parcel data = Parcel.obtain();
3201 Parcel reply = Parcel.obtain();
3202 data.writeInterfaceToken(IActivityManager.descriptor);
3203 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3204 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003205 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003206 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3207 reply.readException();
3208 data.recycle();
3209 reply.recycle();
3210 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003211 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3212 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003213 {
3214 Parcel data = Parcel.obtain();
3215 Parcel reply = Parcel.obtain();
3216 data.writeInterfaceToken(IActivityManager.descriptor);
3217 data.writeStrongBinder(who);
3218 data.writeInt(resultCode);
3219 data.writeString(resultData);
3220 data.writeBundle(map);
3221 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003222 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003223 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3224 reply.readException();
3225 data.recycle();
3226 reply.recycle();
3227 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003228 public void attachApplication(IApplicationThread app) throws RemoteException
3229 {
3230 Parcel data = Parcel.obtain();
3231 Parcel reply = Parcel.obtain();
3232 data.writeInterfaceToken(IActivityManager.descriptor);
3233 data.writeStrongBinder(app.asBinder());
3234 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3235 reply.readException();
3236 data.recycle();
3237 reply.recycle();
3238 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003239 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3240 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003241 {
3242 Parcel data = Parcel.obtain();
3243 Parcel reply = Parcel.obtain();
3244 data.writeInterfaceToken(IActivityManager.descriptor);
3245 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003246 if (config != null) {
3247 data.writeInt(1);
3248 config.writeToParcel(data, 0);
3249 } else {
3250 data.writeInt(0);
3251 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003252 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003253 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3254 reply.readException();
3255 data.recycle();
3256 reply.recycle();
3257 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003258 public void activityResumed(IBinder token) throws RemoteException
3259 {
3260 Parcel data = Parcel.obtain();
3261 Parcel reply = Parcel.obtain();
3262 data.writeInterfaceToken(IActivityManager.descriptor);
3263 data.writeStrongBinder(token);
3264 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3265 reply.readException();
3266 data.recycle();
3267 reply.recycle();
3268 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003269 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003270 {
3271 Parcel data = Parcel.obtain();
3272 Parcel reply = Parcel.obtain();
3273 data.writeInterfaceToken(IActivityManager.descriptor);
3274 data.writeStrongBinder(token);
3275 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3276 reply.readException();
3277 data.recycle();
3278 reply.recycle();
3279 }
3280 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003281 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003282 {
3283 Parcel data = Parcel.obtain();
3284 Parcel reply = Parcel.obtain();
3285 data.writeInterfaceToken(IActivityManager.descriptor);
3286 data.writeStrongBinder(token);
3287 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003288 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003289 TextUtils.writeToParcel(description, data, 0);
3290 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3291 reply.readException();
3292 data.recycle();
3293 reply.recycle();
3294 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003295 public void activitySlept(IBinder token) throws RemoteException
3296 {
3297 Parcel data = Parcel.obtain();
3298 Parcel reply = Parcel.obtain();
3299 data.writeInterfaceToken(IActivityManager.descriptor);
3300 data.writeStrongBinder(token);
3301 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3302 reply.readException();
3303 data.recycle();
3304 reply.recycle();
3305 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003306 public void activityDestroyed(IBinder token) throws RemoteException
3307 {
3308 Parcel data = Parcel.obtain();
3309 Parcel reply = Parcel.obtain();
3310 data.writeInterfaceToken(IActivityManager.descriptor);
3311 data.writeStrongBinder(token);
3312 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3313 reply.readException();
3314 data.recycle();
3315 reply.recycle();
3316 }
3317 public String getCallingPackage(IBinder token) throws RemoteException
3318 {
3319 Parcel data = Parcel.obtain();
3320 Parcel reply = Parcel.obtain();
3321 data.writeInterfaceToken(IActivityManager.descriptor);
3322 data.writeStrongBinder(token);
3323 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3324 reply.readException();
3325 String res = reply.readString();
3326 data.recycle();
3327 reply.recycle();
3328 return res;
3329 }
3330 public ComponentName getCallingActivity(IBinder token)
3331 throws RemoteException {
3332 Parcel data = Parcel.obtain();
3333 Parcel reply = Parcel.obtain();
3334 data.writeInterfaceToken(IActivityManager.descriptor);
3335 data.writeStrongBinder(token);
3336 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3337 reply.readException();
3338 ComponentName res = ComponentName.readFromParcel(reply);
3339 data.recycle();
3340 reply.recycle();
3341 return res;
3342 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003343 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003344 Parcel data = Parcel.obtain();
3345 Parcel reply = Parcel.obtain();
3346 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003347 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003348 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3349 reply.readException();
3350 ArrayList<IAppTask> list = null;
3351 int N = reply.readInt();
3352 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003353 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003354 while (N > 0) {
3355 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3356 list.add(task);
3357 N--;
3358 }
3359 }
3360 data.recycle();
3361 reply.recycle();
3362 return list;
3363 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003364 public int addAppTask(IBinder activityToken, Intent intent,
3365 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3366 Parcel data = Parcel.obtain();
3367 Parcel reply = Parcel.obtain();
3368 data.writeInterfaceToken(IActivityManager.descriptor);
3369 data.writeStrongBinder(activityToken);
3370 intent.writeToParcel(data, 0);
3371 description.writeToParcel(data, 0);
3372 thumbnail.writeToParcel(data, 0);
3373 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3374 reply.readException();
3375 int res = reply.readInt();
3376 data.recycle();
3377 reply.recycle();
3378 return res;
3379 }
3380 public Point getAppTaskThumbnailSize() throws RemoteException {
3381 Parcel data = Parcel.obtain();
3382 Parcel reply = Parcel.obtain();
3383 data.writeInterfaceToken(IActivityManager.descriptor);
3384 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3385 reply.readException();
3386 Point size = Point.CREATOR.createFromParcel(reply);
3387 data.recycle();
3388 reply.recycle();
3389 return size;
3390 }
Todd Kennedye635f662015-01-20 10:36:49 -08003391 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3392 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003393 Parcel data = Parcel.obtain();
3394 Parcel reply = Parcel.obtain();
3395 data.writeInterfaceToken(IActivityManager.descriptor);
3396 data.writeInt(maxNum);
3397 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003398 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3399 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003400 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003401 int N = reply.readInt();
3402 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003403 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003404 while (N > 0) {
3405 ActivityManager.RunningTaskInfo info =
3406 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003407 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003408 list.add(info);
3409 N--;
3410 }
3411 }
3412 data.recycle();
3413 reply.recycle();
3414 return list;
3415 }
3416 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003417 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003418 Parcel data = Parcel.obtain();
3419 Parcel reply = Parcel.obtain();
3420 data.writeInterfaceToken(IActivityManager.descriptor);
3421 data.writeInt(maxNum);
3422 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003423 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003424 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3425 reply.readException();
3426 ArrayList<ActivityManager.RecentTaskInfo> list
3427 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3428 data.recycle();
3429 reply.recycle();
3430 return list;
3431 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003432 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003433 Parcel data = Parcel.obtain();
3434 Parcel reply = Parcel.obtain();
3435 data.writeInterfaceToken(IActivityManager.descriptor);
3436 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003437 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003438 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003439 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003440 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003441 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003442 }
3443 data.recycle();
3444 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003445 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003446 }
Todd Kennedye635f662015-01-20 10:36:49 -08003447 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3448 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003449 Parcel data = Parcel.obtain();
3450 Parcel reply = Parcel.obtain();
3451 data.writeInterfaceToken(IActivityManager.descriptor);
3452 data.writeInt(maxNum);
3453 data.writeInt(flags);
3454 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3455 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003456 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003457 int N = reply.readInt();
3458 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003459 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003460 while (N > 0) {
3461 ActivityManager.RunningServiceInfo info =
3462 ActivityManager.RunningServiceInfo.CREATOR
3463 .createFromParcel(reply);
3464 list.add(info);
3465 N--;
3466 }
3467 }
3468 data.recycle();
3469 reply.recycle();
3470 return list;
3471 }
3472 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3473 throws RemoteException {
3474 Parcel data = Parcel.obtain();
3475 Parcel reply = Parcel.obtain();
3476 data.writeInterfaceToken(IActivityManager.descriptor);
3477 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3478 reply.readException();
3479 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3480 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3481 data.recycle();
3482 reply.recycle();
3483 return list;
3484 }
3485 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3486 throws RemoteException {
3487 Parcel data = Parcel.obtain();
3488 Parcel reply = Parcel.obtain();
3489 data.writeInterfaceToken(IActivityManager.descriptor);
3490 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3491 reply.readException();
3492 ArrayList<ActivityManager.RunningAppProcessInfo> list
3493 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3494 data.recycle();
3495 reply.recycle();
3496 return list;
3497 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003498 public List<ApplicationInfo> getRunningExternalApplications()
3499 throws RemoteException {
3500 Parcel data = Parcel.obtain();
3501 Parcel reply = Parcel.obtain();
3502 data.writeInterfaceToken(IActivityManager.descriptor);
3503 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3504 reply.readException();
3505 ArrayList<ApplicationInfo> list
3506 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3507 data.recycle();
3508 reply.recycle();
3509 return list;
3510 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003511 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003512 {
3513 Parcel data = Parcel.obtain();
3514 Parcel reply = Parcel.obtain();
3515 data.writeInterfaceToken(IActivityManager.descriptor);
3516 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003517 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003518 if (options != null) {
3519 data.writeInt(1);
3520 options.writeToParcel(data, 0);
3521 } else {
3522 data.writeInt(0);
3523 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003524 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3525 reply.readException();
3526 data.recycle();
3527 reply.recycle();
3528 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003529 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3530 throws RemoteException {
3531 Parcel data = Parcel.obtain();
3532 Parcel reply = Parcel.obtain();
3533 data.writeInterfaceToken(IActivityManager.descriptor);
3534 data.writeStrongBinder(token);
3535 data.writeInt(nonRoot ? 1 : 0);
3536 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3537 reply.readException();
3538 boolean res = reply.readInt() != 0;
3539 data.recycle();
3540 reply.recycle();
3541 return res;
3542 }
3543 public void moveTaskBackwards(int task) throws RemoteException
3544 {
3545 Parcel data = Parcel.obtain();
3546 Parcel reply = Parcel.obtain();
3547 data.writeInterfaceToken(IActivityManager.descriptor);
3548 data.writeInt(task);
3549 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3550 reply.readException();
3551 data.recycle();
3552 reply.recycle();
3553 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003554 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003555 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3556 {
3557 Parcel data = Parcel.obtain();
3558 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003559 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003560 data.writeInt(taskId);
3561 data.writeInt(stackId);
3562 data.writeInt(toTop ? 1 : 0);
3563 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3564 reply.readException();
3565 data.recycle();
3566 reply.recycle();
3567 }
3568 @Override
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003569 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop)
3570 throws RemoteException
3571 {
3572 Parcel data = Parcel.obtain();
3573 Parcel reply = Parcel.obtain();
3574 data.writeInterfaceToken(IActivityManager.descriptor);
3575 data.writeInt(taskId);
3576 data.writeInt(createMode);
3577 data.writeInt(toTop ? 1 : 0);
3578 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3579 reply.readException();
3580 data.recycle();
3581 reply.recycle();
3582 }
3583 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003584 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3585 throws RemoteException
3586 {
3587 Parcel data = Parcel.obtain();
3588 Parcel reply = Parcel.obtain();
3589 data.writeInterfaceToken(IActivityManager.descriptor);
3590 data.writeInt(stackId);
3591 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003592 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003593 reply.readException();
3594 final boolean res = reply.readInt() != 0;
3595 data.recycle();
3596 reply.recycle();
3597 return res;
3598 }
3599 @Override
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003600 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode)
3601 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003602 {
3603 Parcel data = Parcel.obtain();
3604 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003605 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003606 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003607 if (r != null) {
3608 data.writeInt(1);
3609 r.writeToParcel(data, 0);
3610 } else {
3611 data.writeInt(0);
3612 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003613 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003614 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003615 reply.readException();
3616 data.recycle();
3617 reply.recycle();
3618 }
Craig Mautner967212c2013-04-13 21:10:58 -07003619 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003620 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3621 {
3622 Parcel data = Parcel.obtain();
3623 Parcel reply = Parcel.obtain();
3624 data.writeInterfaceToken(IActivityManager.descriptor);
3625 data.writeInt(taskId);
3626 data.writeInt(stackId);
3627 data.writeInt(position);
3628 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3629 reply.readException();
3630 data.recycle();
3631 reply.recycle();
3632 }
3633 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003634 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003635 {
3636 Parcel data = Parcel.obtain();
3637 Parcel reply = Parcel.obtain();
3638 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003639 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003640 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003641 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003642 data.recycle();
3643 reply.recycle();
3644 return list;
3645 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003646 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003647 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003648 {
3649 Parcel data = Parcel.obtain();
3650 Parcel reply = Parcel.obtain();
3651 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003652 data.writeInt(stackId);
3653 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003654 reply.readException();
3655 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003656 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003657 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003658 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003659 }
3660 data.recycle();
3661 reply.recycle();
3662 return info;
3663 }
3664 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003665 public boolean isInHomeStack(int taskId) throws RemoteException {
3666 Parcel data = Parcel.obtain();
3667 Parcel reply = Parcel.obtain();
3668 data.writeInterfaceToken(IActivityManager.descriptor);
3669 data.writeInt(taskId);
3670 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3671 reply.readException();
3672 boolean isInHomeStack = reply.readInt() > 0;
3673 data.recycle();
3674 reply.recycle();
3675 return isInHomeStack;
3676 }
3677 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003678 public void setFocusedStack(int stackId) throws RemoteException
3679 {
3680 Parcel data = Parcel.obtain();
3681 Parcel reply = Parcel.obtain();
3682 data.writeInterfaceToken(IActivityManager.descriptor);
3683 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003684 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003685 reply.readException();
3686 data.recycle();
3687 reply.recycle();
3688 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003689 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003690 public int getFocusedStackId() throws RemoteException {
3691 Parcel data = Parcel.obtain();
3692 Parcel reply = Parcel.obtain();
3693 data.writeInterfaceToken(IActivityManager.descriptor);
3694 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3695 reply.readException();
3696 int focusedStackId = reply.readInt();
3697 data.recycle();
3698 reply.recycle();
3699 return focusedStackId;
3700 }
3701 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003702 public void setFocusedTask(int taskId) throws RemoteException
3703 {
3704 Parcel data = Parcel.obtain();
3705 Parcel reply = Parcel.obtain();
3706 data.writeInterfaceToken(IActivityManager.descriptor);
3707 data.writeInt(taskId);
3708 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3709 reply.readException();
3710 data.recycle();
3711 reply.recycle();
3712 }
3713 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003714 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3715 {
3716 Parcel data = Parcel.obtain();
3717 Parcel reply = Parcel.obtain();
3718 data.writeInterfaceToken(IActivityManager.descriptor);
3719 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003720 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003721 reply.readException();
3722 data.recycle();
3723 reply.recycle();
3724 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003725 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3726 {
3727 Parcel data = Parcel.obtain();
3728 Parcel reply = Parcel.obtain();
3729 data.writeInterfaceToken(IActivityManager.descriptor);
3730 data.writeStrongBinder(token);
3731 data.writeInt(onlyRoot ? 1 : 0);
3732 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3733 reply.readException();
3734 int res = reply.readInt();
3735 data.recycle();
3736 reply.recycle();
3737 return res;
3738 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003739 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003740 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003741 Parcel data = Parcel.obtain();
3742 Parcel reply = Parcel.obtain();
3743 data.writeInterfaceToken(IActivityManager.descriptor);
3744 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3745 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003746 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003747 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003748 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3749 reply.readException();
3750 int res = reply.readInt();
3751 ContentProviderHolder cph = null;
3752 if (res != 0) {
3753 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3754 }
3755 data.recycle();
3756 reply.recycle();
3757 return cph;
3758 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003759 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3760 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003761 Parcel data = Parcel.obtain();
3762 Parcel reply = Parcel.obtain();
3763 data.writeInterfaceToken(IActivityManager.descriptor);
3764 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003765 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003766 data.writeStrongBinder(token);
3767 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3768 reply.readException();
3769 int res = reply.readInt();
3770 ContentProviderHolder cph = null;
3771 if (res != 0) {
3772 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3773 }
3774 data.recycle();
3775 reply.recycle();
3776 return cph;
3777 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003778 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003779 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003780 {
3781 Parcel data = Parcel.obtain();
3782 Parcel reply = Parcel.obtain();
3783 data.writeInterfaceToken(IActivityManager.descriptor);
3784 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3785 data.writeTypedList(providers);
3786 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3787 reply.readException();
3788 data.recycle();
3789 reply.recycle();
3790 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003791 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3792 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003793 Parcel data = Parcel.obtain();
3794 Parcel reply = Parcel.obtain();
3795 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003796 data.writeStrongBinder(connection);
3797 data.writeInt(stable);
3798 data.writeInt(unstable);
3799 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3800 reply.readException();
3801 boolean res = reply.readInt() != 0;
3802 data.recycle();
3803 reply.recycle();
3804 return res;
3805 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003806
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003807 public void unstableProviderDied(IBinder connection) throws RemoteException {
3808 Parcel data = Parcel.obtain();
3809 Parcel reply = Parcel.obtain();
3810 data.writeInterfaceToken(IActivityManager.descriptor);
3811 data.writeStrongBinder(connection);
3812 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3813 reply.readException();
3814 data.recycle();
3815 reply.recycle();
3816 }
3817
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003818 @Override
3819 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3820 Parcel data = Parcel.obtain();
3821 Parcel reply = Parcel.obtain();
3822 data.writeInterfaceToken(IActivityManager.descriptor);
3823 data.writeStrongBinder(connection);
3824 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3825 reply.readException();
3826 data.recycle();
3827 reply.recycle();
3828 }
3829
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003830 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3831 Parcel data = Parcel.obtain();
3832 Parcel reply = Parcel.obtain();
3833 data.writeInterfaceToken(IActivityManager.descriptor);
3834 data.writeStrongBinder(connection);
3835 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003836 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3837 reply.readException();
3838 data.recycle();
3839 reply.recycle();
3840 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003841
3842 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3843 Parcel data = Parcel.obtain();
3844 Parcel reply = Parcel.obtain();
3845 data.writeInterfaceToken(IActivityManager.descriptor);
3846 data.writeString(name);
3847 data.writeStrongBinder(token);
3848 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3849 reply.readException();
3850 data.recycle();
3851 reply.recycle();
3852 }
3853
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003854 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3855 throws RemoteException
3856 {
3857 Parcel data = Parcel.obtain();
3858 Parcel reply = Parcel.obtain();
3859 data.writeInterfaceToken(IActivityManager.descriptor);
3860 service.writeToParcel(data, 0);
3861 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3862 reply.readException();
3863 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3864 data.recycle();
3865 reply.recycle();
3866 return res;
3867 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003868
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003869 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003870 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003871 {
3872 Parcel data = Parcel.obtain();
3873 Parcel reply = Parcel.obtain();
3874 data.writeInterfaceToken(IActivityManager.descriptor);
3875 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3876 service.writeToParcel(data, 0);
3877 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003878 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003879 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003880 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3881 reply.readException();
3882 ComponentName res = ComponentName.readFromParcel(reply);
3883 data.recycle();
3884 reply.recycle();
3885 return res;
3886 }
3887 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003888 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003889 {
3890 Parcel data = Parcel.obtain();
3891 Parcel reply = Parcel.obtain();
3892 data.writeInterfaceToken(IActivityManager.descriptor);
3893 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3894 service.writeToParcel(data, 0);
3895 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003896 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003897 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3898 reply.readException();
3899 int res = reply.readInt();
3900 reply.recycle();
3901 data.recycle();
3902 return res;
3903 }
3904 public boolean stopServiceToken(ComponentName className, IBinder token,
3905 int startId) throws RemoteException {
3906 Parcel data = Parcel.obtain();
3907 Parcel reply = Parcel.obtain();
3908 data.writeInterfaceToken(IActivityManager.descriptor);
3909 ComponentName.writeToParcel(className, data);
3910 data.writeStrongBinder(token);
3911 data.writeInt(startId);
3912 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3913 reply.readException();
3914 boolean res = reply.readInt() != 0;
3915 data.recycle();
3916 reply.recycle();
3917 return res;
3918 }
3919 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003920 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003921 Parcel data = Parcel.obtain();
3922 Parcel reply = Parcel.obtain();
3923 data.writeInterfaceToken(IActivityManager.descriptor);
3924 ComponentName.writeToParcel(className, data);
3925 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003926 data.writeInt(id);
3927 if (notification != null) {
3928 data.writeInt(1);
3929 notification.writeToParcel(data, 0);
3930 } else {
3931 data.writeInt(0);
3932 }
3933 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003934 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3935 reply.readException();
3936 data.recycle();
3937 reply.recycle();
3938 }
3939 public int bindService(IApplicationThread caller, IBinder token,
3940 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07003941 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003942 Parcel data = Parcel.obtain();
3943 Parcel reply = Parcel.obtain();
3944 data.writeInterfaceToken(IActivityManager.descriptor);
3945 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3946 data.writeStrongBinder(token);
3947 service.writeToParcel(data, 0);
3948 data.writeString(resolvedType);
3949 data.writeStrongBinder(connection.asBinder());
3950 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07003951 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003952 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003953 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3954 reply.readException();
3955 int res = reply.readInt();
3956 data.recycle();
3957 reply.recycle();
3958 return res;
3959 }
3960 public boolean unbindService(IServiceConnection connection) throws RemoteException
3961 {
3962 Parcel data = Parcel.obtain();
3963 Parcel reply = Parcel.obtain();
3964 data.writeInterfaceToken(IActivityManager.descriptor);
3965 data.writeStrongBinder(connection.asBinder());
3966 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3967 reply.readException();
3968 boolean res = reply.readInt() != 0;
3969 data.recycle();
3970 reply.recycle();
3971 return res;
3972 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003973
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003974 public void publishService(IBinder token,
3975 Intent intent, IBinder service) throws RemoteException {
3976 Parcel data = Parcel.obtain();
3977 Parcel reply = Parcel.obtain();
3978 data.writeInterfaceToken(IActivityManager.descriptor);
3979 data.writeStrongBinder(token);
3980 intent.writeToParcel(data, 0);
3981 data.writeStrongBinder(service);
3982 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3983 reply.readException();
3984 data.recycle();
3985 reply.recycle();
3986 }
3987
3988 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3989 throws RemoteException {
3990 Parcel data = Parcel.obtain();
3991 Parcel reply = Parcel.obtain();
3992 data.writeInterfaceToken(IActivityManager.descriptor);
3993 data.writeStrongBinder(token);
3994 intent.writeToParcel(data, 0);
3995 data.writeInt(doRebind ? 1 : 0);
3996 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3997 reply.readException();
3998 data.recycle();
3999 reply.recycle();
4000 }
4001
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004002 public void serviceDoneExecuting(IBinder token, int type, int startId,
4003 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004004 Parcel data = Parcel.obtain();
4005 Parcel reply = Parcel.obtain();
4006 data.writeInterfaceToken(IActivityManager.descriptor);
4007 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004008 data.writeInt(type);
4009 data.writeInt(startId);
4010 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004011 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4012 reply.readException();
4013 data.recycle();
4014 reply.recycle();
4015 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004016
Svet Ganov99b60432015-06-27 13:15:22 -07004017 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4018 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004019 Parcel data = Parcel.obtain();
4020 Parcel reply = Parcel.obtain();
4021 data.writeInterfaceToken(IActivityManager.descriptor);
4022 service.writeToParcel(data, 0);
4023 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004024 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004025 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4026 reply.readException();
4027 IBinder binder = reply.readStrongBinder();
4028 reply.recycle();
4029 data.recycle();
4030 return binder;
4031 }
4032
Christopher Tate181fafa2009-05-14 11:12:14 -07004033 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4034 throws RemoteException {
4035 Parcel data = Parcel.obtain();
4036 Parcel reply = Parcel.obtain();
4037 data.writeInterfaceToken(IActivityManager.descriptor);
4038 app.writeToParcel(data, 0);
4039 data.writeInt(backupRestoreMode);
4040 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4041 reply.readException();
4042 boolean success = reply.readInt() != 0;
4043 reply.recycle();
4044 data.recycle();
4045 return success;
4046 }
4047
Christopher Tate346acb12012-10-15 19:20:25 -07004048 public void clearPendingBackup() throws RemoteException {
4049 Parcel data = Parcel.obtain();
4050 Parcel reply = Parcel.obtain();
4051 data.writeInterfaceToken(IActivityManager.descriptor);
4052 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4053 reply.recycle();
4054 data.recycle();
4055 }
4056
Christopher Tate181fafa2009-05-14 11:12:14 -07004057 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4058 Parcel data = Parcel.obtain();
4059 Parcel reply = Parcel.obtain();
4060 data.writeInterfaceToken(IActivityManager.descriptor);
4061 data.writeString(packageName);
4062 data.writeStrongBinder(agent);
4063 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4064 reply.recycle();
4065 data.recycle();
4066 }
4067
4068 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4069 Parcel data = Parcel.obtain();
4070 Parcel reply = Parcel.obtain();
4071 data.writeInterfaceToken(IActivityManager.descriptor);
4072 app.writeToParcel(data, 0);
4073 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4074 reply.readException();
4075 reply.recycle();
4076 data.recycle();
4077 }
4078
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004079 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004080 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004081 IUiAutomationConnection connection, int userId, String instructionSet)
4082 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004083 Parcel data = Parcel.obtain();
4084 Parcel reply = Parcel.obtain();
4085 data.writeInterfaceToken(IActivityManager.descriptor);
4086 ComponentName.writeToParcel(className, data);
4087 data.writeString(profileFile);
4088 data.writeInt(flags);
4089 data.writeBundle(arguments);
4090 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004091 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004092 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004093 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004094 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4095 reply.readException();
4096 boolean res = reply.readInt() != 0;
4097 reply.recycle();
4098 data.recycle();
4099 return res;
4100 }
4101
4102 public void finishInstrumentation(IApplicationThread target,
4103 int resultCode, Bundle results) throws RemoteException {
4104 Parcel data = Parcel.obtain();
4105 Parcel reply = Parcel.obtain();
4106 data.writeInterfaceToken(IActivityManager.descriptor);
4107 data.writeStrongBinder(target != null ? target.asBinder() : null);
4108 data.writeInt(resultCode);
4109 data.writeBundle(results);
4110 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4111 reply.readException();
4112 data.recycle();
4113 reply.recycle();
4114 }
4115 public Configuration getConfiguration() throws RemoteException
4116 {
4117 Parcel data = Parcel.obtain();
4118 Parcel reply = Parcel.obtain();
4119 data.writeInterfaceToken(IActivityManager.descriptor);
4120 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4121 reply.readException();
4122 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4123 reply.recycle();
4124 data.recycle();
4125 return res;
4126 }
4127 public void updateConfiguration(Configuration values) throws RemoteException
4128 {
4129 Parcel data = Parcel.obtain();
4130 Parcel reply = Parcel.obtain();
4131 data.writeInterfaceToken(IActivityManager.descriptor);
4132 values.writeToParcel(data, 0);
4133 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4134 reply.readException();
4135 data.recycle();
4136 reply.recycle();
4137 }
4138 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4139 throws RemoteException {
4140 Parcel data = Parcel.obtain();
4141 Parcel reply = Parcel.obtain();
4142 data.writeInterfaceToken(IActivityManager.descriptor);
4143 data.writeStrongBinder(token);
4144 data.writeInt(requestedOrientation);
4145 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4146 reply.readException();
4147 data.recycle();
4148 reply.recycle();
4149 }
4150 public int getRequestedOrientation(IBinder token) throws RemoteException {
4151 Parcel data = Parcel.obtain();
4152 Parcel reply = Parcel.obtain();
4153 data.writeInterfaceToken(IActivityManager.descriptor);
4154 data.writeStrongBinder(token);
4155 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4156 reply.readException();
4157 int res = reply.readInt();
4158 data.recycle();
4159 reply.recycle();
4160 return res;
4161 }
4162 public ComponentName getActivityClassForToken(IBinder token)
4163 throws RemoteException {
4164 Parcel data = Parcel.obtain();
4165 Parcel reply = Parcel.obtain();
4166 data.writeInterfaceToken(IActivityManager.descriptor);
4167 data.writeStrongBinder(token);
4168 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4169 reply.readException();
4170 ComponentName res = ComponentName.readFromParcel(reply);
4171 data.recycle();
4172 reply.recycle();
4173 return res;
4174 }
4175 public String getPackageForToken(IBinder token) throws RemoteException
4176 {
4177 Parcel data = Parcel.obtain();
4178 Parcel reply = Parcel.obtain();
4179 data.writeInterfaceToken(IActivityManager.descriptor);
4180 data.writeStrongBinder(token);
4181 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4182 reply.readException();
4183 String res = reply.readString();
4184 data.recycle();
4185 reply.recycle();
4186 return res;
4187 }
4188 public IIntentSender getIntentSender(int type,
4189 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004190 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004191 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004192 Parcel data = Parcel.obtain();
4193 Parcel reply = Parcel.obtain();
4194 data.writeInterfaceToken(IActivityManager.descriptor);
4195 data.writeInt(type);
4196 data.writeString(packageName);
4197 data.writeStrongBinder(token);
4198 data.writeString(resultWho);
4199 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004200 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004201 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004202 data.writeTypedArray(intents, 0);
4203 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004204 } else {
4205 data.writeInt(0);
4206 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004207 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004208 if (options != null) {
4209 data.writeInt(1);
4210 options.writeToParcel(data, 0);
4211 } else {
4212 data.writeInt(0);
4213 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004214 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004215 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4216 reply.readException();
4217 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004218 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004219 data.recycle();
4220 reply.recycle();
4221 return res;
4222 }
4223 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4224 Parcel data = Parcel.obtain();
4225 Parcel reply = Parcel.obtain();
4226 data.writeInterfaceToken(IActivityManager.descriptor);
4227 data.writeStrongBinder(sender.asBinder());
4228 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4229 reply.readException();
4230 data.recycle();
4231 reply.recycle();
4232 }
4233 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4234 Parcel data = Parcel.obtain();
4235 Parcel reply = Parcel.obtain();
4236 data.writeInterfaceToken(IActivityManager.descriptor);
4237 data.writeStrongBinder(sender.asBinder());
4238 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4239 reply.readException();
4240 String res = reply.readString();
4241 data.recycle();
4242 reply.recycle();
4243 return res;
4244 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004245 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4246 Parcel data = Parcel.obtain();
4247 Parcel reply = Parcel.obtain();
4248 data.writeInterfaceToken(IActivityManager.descriptor);
4249 data.writeStrongBinder(sender.asBinder());
4250 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4251 reply.readException();
4252 int res = reply.readInt();
4253 data.recycle();
4254 reply.recycle();
4255 return res;
4256 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004257 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4258 boolean requireFull, String name, String callerPackage) throws RemoteException {
4259 Parcel data = Parcel.obtain();
4260 Parcel reply = Parcel.obtain();
4261 data.writeInterfaceToken(IActivityManager.descriptor);
4262 data.writeInt(callingPid);
4263 data.writeInt(callingUid);
4264 data.writeInt(userId);
4265 data.writeInt(allowAll ? 1 : 0);
4266 data.writeInt(requireFull ? 1 : 0);
4267 data.writeString(name);
4268 data.writeString(callerPackage);
4269 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4270 reply.readException();
4271 int res = reply.readInt();
4272 data.recycle();
4273 reply.recycle();
4274 return res;
4275 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004276 public void setProcessLimit(int max) throws RemoteException
4277 {
4278 Parcel data = Parcel.obtain();
4279 Parcel reply = Parcel.obtain();
4280 data.writeInterfaceToken(IActivityManager.descriptor);
4281 data.writeInt(max);
4282 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4283 reply.readException();
4284 data.recycle();
4285 reply.recycle();
4286 }
4287 public int getProcessLimit() throws RemoteException
4288 {
4289 Parcel data = Parcel.obtain();
4290 Parcel reply = Parcel.obtain();
4291 data.writeInterfaceToken(IActivityManager.descriptor);
4292 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4293 reply.readException();
4294 int res = reply.readInt();
4295 data.recycle();
4296 reply.recycle();
4297 return res;
4298 }
4299 public void setProcessForeground(IBinder token, int pid,
4300 boolean isForeground) throws RemoteException {
4301 Parcel data = Parcel.obtain();
4302 Parcel reply = Parcel.obtain();
4303 data.writeInterfaceToken(IActivityManager.descriptor);
4304 data.writeStrongBinder(token);
4305 data.writeInt(pid);
4306 data.writeInt(isForeground ? 1 : 0);
4307 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4308 reply.readException();
4309 data.recycle();
4310 reply.recycle();
4311 }
4312 public int checkPermission(String permission, int pid, int uid)
4313 throws RemoteException {
4314 Parcel data = Parcel.obtain();
4315 Parcel reply = Parcel.obtain();
4316 data.writeInterfaceToken(IActivityManager.descriptor);
4317 data.writeString(permission);
4318 data.writeInt(pid);
4319 data.writeInt(uid);
4320 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4321 reply.readException();
4322 int res = reply.readInt();
4323 data.recycle();
4324 reply.recycle();
4325 return res;
4326 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004327 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4328 throws RemoteException {
4329 Parcel data = Parcel.obtain();
4330 Parcel reply = Parcel.obtain();
4331 data.writeInterfaceToken(IActivityManager.descriptor);
4332 data.writeString(permission);
4333 data.writeInt(pid);
4334 data.writeInt(uid);
4335 data.writeStrongBinder(callerToken);
4336 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4337 reply.readException();
4338 int res = reply.readInt();
4339 data.recycle();
4340 reply.recycle();
4341 return res;
4342 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004343 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004344 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004345 Parcel data = Parcel.obtain();
4346 Parcel reply = Parcel.obtain();
4347 data.writeInterfaceToken(IActivityManager.descriptor);
4348 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004349 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004350 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004351 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4352 reply.readException();
4353 boolean res = reply.readInt() != 0;
4354 data.recycle();
4355 reply.recycle();
4356 return res;
4357 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004358 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4359 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004360 Parcel data = Parcel.obtain();
4361 Parcel reply = Parcel.obtain();
4362 data.writeInterfaceToken(IActivityManager.descriptor);
4363 uri.writeToParcel(data, 0);
4364 data.writeInt(pid);
4365 data.writeInt(uid);
4366 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004367 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004368 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004369 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4370 reply.readException();
4371 int res = reply.readInt();
4372 data.recycle();
4373 reply.recycle();
4374 return res;
4375 }
4376 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004377 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004378 Parcel data = Parcel.obtain();
4379 Parcel reply = Parcel.obtain();
4380 data.writeInterfaceToken(IActivityManager.descriptor);
4381 data.writeStrongBinder(caller.asBinder());
4382 data.writeString(targetPkg);
4383 uri.writeToParcel(data, 0);
4384 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004385 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004386 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4387 reply.readException();
4388 data.recycle();
4389 reply.recycle();
4390 }
4391 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004392 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004393 Parcel data = Parcel.obtain();
4394 Parcel reply = Parcel.obtain();
4395 data.writeInterfaceToken(IActivityManager.descriptor);
4396 data.writeStrongBinder(caller.asBinder());
4397 uri.writeToParcel(data, 0);
4398 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004399 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004400 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4401 reply.readException();
4402 data.recycle();
4403 reply.recycle();
4404 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004405
4406 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004407 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4408 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004409 Parcel data = Parcel.obtain();
4410 Parcel reply = Parcel.obtain();
4411 data.writeInterfaceToken(IActivityManager.descriptor);
4412 uri.writeToParcel(data, 0);
4413 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004414 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004415 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4416 reply.readException();
4417 data.recycle();
4418 reply.recycle();
4419 }
4420
4421 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004422 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4423 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004424 Parcel data = Parcel.obtain();
4425 Parcel reply = Parcel.obtain();
4426 data.writeInterfaceToken(IActivityManager.descriptor);
4427 uri.writeToParcel(data, 0);
4428 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004429 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004430 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4431 reply.readException();
4432 data.recycle();
4433 reply.recycle();
4434 }
4435
4436 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004437 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4438 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004439 Parcel data = Parcel.obtain();
4440 Parcel reply = Parcel.obtain();
4441 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004442 data.writeString(packageName);
4443 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004444 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4445 reply.readException();
4446 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4447 reply);
4448 data.recycle();
4449 reply.recycle();
4450 return perms;
4451 }
4452
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004453 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4454 throws RemoteException {
4455 Parcel data = Parcel.obtain();
4456 Parcel reply = Parcel.obtain();
4457 data.writeInterfaceToken(IActivityManager.descriptor);
4458 data.writeStrongBinder(who.asBinder());
4459 data.writeInt(waiting ? 1 : 0);
4460 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4461 reply.readException();
4462 data.recycle();
4463 reply.recycle();
4464 }
4465 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4466 Parcel data = Parcel.obtain();
4467 Parcel reply = Parcel.obtain();
4468 data.writeInterfaceToken(IActivityManager.descriptor);
4469 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4470 reply.readException();
4471 outInfo.readFromParcel(reply);
4472 data.recycle();
4473 reply.recycle();
4474 }
4475 public void unhandledBack() throws RemoteException
4476 {
4477 Parcel data = Parcel.obtain();
4478 Parcel reply = Parcel.obtain();
4479 data.writeInterfaceToken(IActivityManager.descriptor);
4480 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4481 reply.readException();
4482 data.recycle();
4483 reply.recycle();
4484 }
4485 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4486 {
4487 Parcel data = Parcel.obtain();
4488 Parcel reply = Parcel.obtain();
4489 data.writeInterfaceToken(IActivityManager.descriptor);
4490 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4491 reply.readException();
4492 ParcelFileDescriptor pfd = null;
4493 if (reply.readInt() != 0) {
4494 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4495 }
4496 data.recycle();
4497 reply.recycle();
4498 return pfd;
4499 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004500 public void setLockScreenShown(boolean shown) throws RemoteException
4501 {
4502 Parcel data = Parcel.obtain();
4503 Parcel reply = Parcel.obtain();
4504 data.writeInterfaceToken(IActivityManager.descriptor);
4505 data.writeInt(shown ? 1 : 0);
4506 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4507 reply.readException();
4508 data.recycle();
4509 reply.recycle();
4510 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004511 public void setDebugApp(
4512 String packageName, boolean waitForDebugger, boolean persistent)
4513 throws RemoteException
4514 {
4515 Parcel data = Parcel.obtain();
4516 Parcel reply = Parcel.obtain();
4517 data.writeInterfaceToken(IActivityManager.descriptor);
4518 data.writeString(packageName);
4519 data.writeInt(waitForDebugger ? 1 : 0);
4520 data.writeInt(persistent ? 1 : 0);
4521 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4522 reply.readException();
4523 data.recycle();
4524 reply.recycle();
4525 }
4526 public void setAlwaysFinish(boolean enabled) throws RemoteException
4527 {
4528 Parcel data = Parcel.obtain();
4529 Parcel reply = Parcel.obtain();
4530 data.writeInterfaceToken(IActivityManager.descriptor);
4531 data.writeInt(enabled ? 1 : 0);
4532 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4533 reply.readException();
4534 data.recycle();
4535 reply.recycle();
4536 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004537 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004538 {
4539 Parcel data = Parcel.obtain();
4540 Parcel reply = Parcel.obtain();
4541 data.writeInterfaceToken(IActivityManager.descriptor);
4542 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004543 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004544 reply.readException();
4545 data.recycle();
4546 reply.recycle();
4547 }
4548 public void enterSafeMode() throws RemoteException {
4549 Parcel data = Parcel.obtain();
4550 data.writeInterfaceToken(IActivityManager.descriptor);
4551 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4552 data.recycle();
4553 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004554 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004555 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004556 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004557 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004558 data.writeStrongBinder(sender.asBinder());
4559 data.writeInt(sourceUid);
4560 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004561 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004562 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4563 data.recycle();
4564 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004565 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4566 throws RemoteException {
4567 Parcel data = Parcel.obtain();
4568 data.writeInterfaceToken(IActivityManager.descriptor);
4569 data.writeStrongBinder(sender.asBinder());
4570 data.writeInt(sourceUid);
4571 data.writeString(tag);
4572 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4573 data.recycle();
4574 }
4575 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4576 throws RemoteException {
4577 Parcel data = Parcel.obtain();
4578 data.writeInterfaceToken(IActivityManager.descriptor);
4579 data.writeStrongBinder(sender.asBinder());
4580 data.writeInt(sourceUid);
4581 data.writeString(tag);
4582 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4583 data.recycle();
4584 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004585 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004586 Parcel data = Parcel.obtain();
4587 Parcel reply = Parcel.obtain();
4588 data.writeInterfaceToken(IActivityManager.descriptor);
4589 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004590 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004591 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004592 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004593 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004594 boolean res = reply.readInt() != 0;
4595 data.recycle();
4596 reply.recycle();
4597 return res;
4598 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004599 @Override
4600 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4601 Parcel data = Parcel.obtain();
4602 Parcel reply = Parcel.obtain();
4603 data.writeInterfaceToken(IActivityManager.descriptor);
4604 data.writeString(reason);
4605 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4606 boolean res = reply.readInt() != 0;
4607 data.recycle();
4608 reply.recycle();
4609 return res;
4610 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004611 public boolean testIsSystemReady()
4612 {
4613 /* this base class version is never called */
4614 return true;
4615 }
Dan Egnor60d87622009-12-16 16:32:58 -08004616 public void handleApplicationCrash(IBinder app,
4617 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4618 {
4619 Parcel data = Parcel.obtain();
4620 Parcel reply = Parcel.obtain();
4621 data.writeInterfaceToken(IActivityManager.descriptor);
4622 data.writeStrongBinder(app);
4623 crashInfo.writeToParcel(data, 0);
4624 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4625 reply.readException();
4626 reply.recycle();
4627 data.recycle();
4628 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004629
Dianne Hackborn52322712014-08-26 22:47:26 -07004630 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004631 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004632 {
4633 Parcel data = Parcel.obtain();
4634 Parcel reply = Parcel.obtain();
4635 data.writeInterfaceToken(IActivityManager.descriptor);
4636 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004637 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004638 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004639 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004640 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004641 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004642 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004643 reply.recycle();
4644 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004645 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004646 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004647
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004648 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004649 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004650 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004651 {
4652 Parcel data = Parcel.obtain();
4653 Parcel reply = Parcel.obtain();
4654 data.writeInterfaceToken(IActivityManager.descriptor);
4655 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004656 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004657 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004658 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4659 reply.readException();
4660 reply.recycle();
4661 data.recycle();
4662 }
4663
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004664 public void signalPersistentProcesses(int sig) throws RemoteException {
4665 Parcel data = Parcel.obtain();
4666 Parcel reply = Parcel.obtain();
4667 data.writeInterfaceToken(IActivityManager.descriptor);
4668 data.writeInt(sig);
4669 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4670 reply.readException();
4671 data.recycle();
4672 reply.recycle();
4673 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004674
Dianne Hackborn1676c852012-09-10 14:52:30 -07004675 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004676 Parcel data = Parcel.obtain();
4677 Parcel reply = Parcel.obtain();
4678 data.writeInterfaceToken(IActivityManager.descriptor);
4679 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004680 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004681 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4682 reply.readException();
4683 data.recycle();
4684 reply.recycle();
4685 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004686
4687 public void killAllBackgroundProcesses() throws RemoteException {
4688 Parcel data = Parcel.obtain();
4689 Parcel reply = Parcel.obtain();
4690 data.writeInterfaceToken(IActivityManager.descriptor);
4691 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4692 reply.readException();
4693 data.recycle();
4694 reply.recycle();
4695 }
4696
Dianne Hackborn1676c852012-09-10 14:52:30 -07004697 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004698 Parcel data = Parcel.obtain();
4699 Parcel reply = Parcel.obtain();
4700 data.writeInterfaceToken(IActivityManager.descriptor);
4701 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004702 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004703 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004704 reply.readException();
4705 data.recycle();
4706 reply.recycle();
4707 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004708
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004709 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4710 throws RemoteException
4711 {
4712 Parcel data = Parcel.obtain();
4713 Parcel reply = Parcel.obtain();
4714 data.writeInterfaceToken(IActivityManager.descriptor);
4715 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4716 reply.readException();
4717 outInfo.readFromParcel(reply);
4718 reply.recycle();
4719 data.recycle();
4720 }
4721
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004722 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4723 {
4724 Parcel data = Parcel.obtain();
4725 Parcel reply = Parcel.obtain();
4726 data.writeInterfaceToken(IActivityManager.descriptor);
4727 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4728 reply.readException();
4729 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4730 reply.recycle();
4731 data.recycle();
4732 return res;
4733 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004734
Dianne Hackborn1676c852012-09-10 14:52:30 -07004735 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004736 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004737 {
4738 Parcel data = Parcel.obtain();
4739 Parcel reply = Parcel.obtain();
4740 data.writeInterfaceToken(IActivityManager.descriptor);
4741 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004742 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004743 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004744 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004745 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004746 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004747 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004748 } else {
4749 data.writeInt(0);
4750 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004751 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4752 reply.readException();
4753 boolean res = reply.readInt() != 0;
4754 reply.recycle();
4755 data.recycle();
4756 return res;
4757 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004758
Dianne Hackborn55280a92009-05-07 15:53:46 -07004759 public boolean shutdown(int timeout) throws RemoteException
4760 {
4761 Parcel data = Parcel.obtain();
4762 Parcel reply = Parcel.obtain();
4763 data.writeInterfaceToken(IActivityManager.descriptor);
4764 data.writeInt(timeout);
4765 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4766 reply.readException();
4767 boolean res = reply.readInt() != 0;
4768 reply.recycle();
4769 data.recycle();
4770 return res;
4771 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004772
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004773 public void stopAppSwitches() throws RemoteException {
4774 Parcel data = Parcel.obtain();
4775 Parcel reply = Parcel.obtain();
4776 data.writeInterfaceToken(IActivityManager.descriptor);
4777 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4778 reply.readException();
4779 reply.recycle();
4780 data.recycle();
4781 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004782
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004783 public void resumeAppSwitches() throws RemoteException {
4784 Parcel data = Parcel.obtain();
4785 Parcel reply = Parcel.obtain();
4786 data.writeInterfaceToken(IActivityManager.descriptor);
4787 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4788 reply.readException();
4789 reply.recycle();
4790 data.recycle();
4791 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004792
4793 public void addPackageDependency(String packageName) throws RemoteException {
4794 Parcel data = Parcel.obtain();
4795 Parcel reply = Parcel.obtain();
4796 data.writeInterfaceToken(IActivityManager.descriptor);
4797 data.writeString(packageName);
4798 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4799 reply.readException();
4800 data.recycle();
4801 reply.recycle();
4802 }
4803
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004804 public void killApplicationWithAppId(String pkg, int appid, String reason)
4805 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004806 Parcel data = Parcel.obtain();
4807 Parcel reply = Parcel.obtain();
4808 data.writeInterfaceToken(IActivityManager.descriptor);
4809 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004810 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004811 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004812 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004813 reply.readException();
4814 data.recycle();
4815 reply.recycle();
4816 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004817
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004818 public void closeSystemDialogs(String reason) throws RemoteException {
4819 Parcel data = Parcel.obtain();
4820 Parcel reply = Parcel.obtain();
4821 data.writeInterfaceToken(IActivityManager.descriptor);
4822 data.writeString(reason);
4823 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4824 reply.readException();
4825 data.recycle();
4826 reply.recycle();
4827 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004828
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004829 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004830 throws RemoteException {
4831 Parcel data = Parcel.obtain();
4832 Parcel reply = Parcel.obtain();
4833 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004834 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004835 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4836 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004837 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004838 data.recycle();
4839 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004840 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004841 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004842
4843 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4844 Parcel data = Parcel.obtain();
4845 Parcel reply = Parcel.obtain();
4846 data.writeInterfaceToken(IActivityManager.descriptor);
4847 data.writeString(processName);
4848 data.writeInt(uid);
4849 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4850 reply.readException();
4851 data.recycle();
4852 reply.recycle();
4853 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004854
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004855 public void overridePendingTransition(IBinder token, String packageName,
4856 int enterAnim, int exitAnim) throws RemoteException {
4857 Parcel data = Parcel.obtain();
4858 Parcel reply = Parcel.obtain();
4859 data.writeInterfaceToken(IActivityManager.descriptor);
4860 data.writeStrongBinder(token);
4861 data.writeString(packageName);
4862 data.writeInt(enterAnim);
4863 data.writeInt(exitAnim);
4864 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4865 reply.readException();
4866 data.recycle();
4867 reply.recycle();
4868 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004869
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004870 public boolean isUserAMonkey() throws RemoteException {
4871 Parcel data = Parcel.obtain();
4872 Parcel reply = Parcel.obtain();
4873 data.writeInterfaceToken(IActivityManager.descriptor);
4874 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4875 reply.readException();
4876 boolean res = reply.readInt() != 0;
4877 data.recycle();
4878 reply.recycle();
4879 return res;
4880 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004881
4882 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4883 Parcel data = Parcel.obtain();
4884 Parcel reply = Parcel.obtain();
4885 data.writeInterfaceToken(IActivityManager.descriptor);
4886 data.writeInt(monkey ? 1 : 0);
4887 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4888 reply.readException();
4889 data.recycle();
4890 reply.recycle();
4891 }
4892
Dianne Hackborn860755f2010-06-03 18:47:52 -07004893 public void finishHeavyWeightApp() throws RemoteException {
4894 Parcel data = Parcel.obtain();
4895 Parcel reply = Parcel.obtain();
4896 data.writeInterfaceToken(IActivityManager.descriptor);
4897 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4898 reply.readException();
4899 data.recycle();
4900 reply.recycle();
4901 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004902
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004903 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004904 throws RemoteException {
4905 Parcel data = Parcel.obtain();
4906 Parcel reply = Parcel.obtain();
4907 data.writeInterfaceToken(IActivityManager.descriptor);
4908 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004909 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4910 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004911 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004912 data.recycle();
4913 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004914 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004915 }
4916
Craig Mautner233ceee2014-05-09 17:05:11 -07004917 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004918 throws RemoteException {
4919 Parcel data = Parcel.obtain();
4920 Parcel reply = Parcel.obtain();
4921 data.writeInterfaceToken(IActivityManager.descriptor);
4922 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004923 if (options == null) {
4924 data.writeInt(0);
4925 } else {
4926 data.writeInt(1);
4927 data.writeBundle(options.toBundle());
4928 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004929 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004930 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004931 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004932 data.recycle();
4933 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004934 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004935 }
4936
Craig Mautner233ceee2014-05-09 17:05:11 -07004937 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4938 Parcel data = Parcel.obtain();
4939 Parcel reply = Parcel.obtain();
4940 data.writeInterfaceToken(IActivityManager.descriptor);
4941 data.writeStrongBinder(token);
4942 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4943 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08004944 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07004945 data.recycle();
4946 reply.recycle();
4947 return options;
4948 }
4949
Daniel Sandler69a48172010-06-23 16:29:36 -04004950 public void setImmersive(IBinder token, boolean immersive)
4951 throws RemoteException {
4952 Parcel data = Parcel.obtain();
4953 Parcel reply = Parcel.obtain();
4954 data.writeInterfaceToken(IActivityManager.descriptor);
4955 data.writeStrongBinder(token);
4956 data.writeInt(immersive ? 1 : 0);
4957 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4958 reply.readException();
4959 data.recycle();
4960 reply.recycle();
4961 }
4962
4963 public boolean isImmersive(IBinder token)
4964 throws RemoteException {
4965 Parcel data = Parcel.obtain();
4966 Parcel reply = Parcel.obtain();
4967 data.writeInterfaceToken(IActivityManager.descriptor);
4968 data.writeStrongBinder(token);
4969 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004970 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004971 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004972 data.recycle();
4973 reply.recycle();
4974 return res;
4975 }
4976
Craig Mautnerd61dc202014-07-07 11:09:11 -07004977 public boolean isTopOfTask(IBinder token) throws RemoteException {
4978 Parcel data = Parcel.obtain();
4979 Parcel reply = Parcel.obtain();
4980 data.writeInterfaceToken(IActivityManager.descriptor);
4981 data.writeStrongBinder(token);
4982 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4983 reply.readException();
4984 boolean res = reply.readInt() == 1;
4985 data.recycle();
4986 reply.recycle();
4987 return res;
4988 }
4989
Daniel Sandler69a48172010-06-23 16:29:36 -04004990 public boolean isTopActivityImmersive()
4991 throws RemoteException {
4992 Parcel data = Parcel.obtain();
4993 Parcel reply = Parcel.obtain();
4994 data.writeInterfaceToken(IActivityManager.descriptor);
4995 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004996 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004997 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004998 data.recycle();
4999 reply.recycle();
5000 return res;
5001 }
5002
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005003 public void crashApplication(int uid, int initialPid, String packageName,
5004 String message) throws RemoteException {
5005 Parcel data = Parcel.obtain();
5006 Parcel reply = Parcel.obtain();
5007 data.writeInterfaceToken(IActivityManager.descriptor);
5008 data.writeInt(uid);
5009 data.writeInt(initialPid);
5010 data.writeString(packageName);
5011 data.writeString(message);
5012 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5013 reply.readException();
5014 data.recycle();
5015 reply.recycle();
5016 }
Andy McFadden824c5102010-07-09 16:26:57 -07005017
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005018 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005019 Parcel data = Parcel.obtain();
5020 Parcel reply = Parcel.obtain();
5021 data.writeInterfaceToken(IActivityManager.descriptor);
5022 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005023 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005024 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5025 reply.readException();
5026 String res = reply.readString();
5027 data.recycle();
5028 reply.recycle();
5029 return res;
5030 }
5031
Dianne Hackborn7e269642010-08-25 19:50:20 -07005032 public IBinder newUriPermissionOwner(String name)
5033 throws RemoteException {
5034 Parcel data = Parcel.obtain();
5035 Parcel reply = Parcel.obtain();
5036 data.writeInterfaceToken(IActivityManager.descriptor);
5037 data.writeString(name);
5038 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5039 reply.readException();
5040 IBinder res = reply.readStrongBinder();
5041 data.recycle();
5042 reply.recycle();
5043 return res;
5044 }
5045
5046 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005047 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005048 Parcel data = Parcel.obtain();
5049 Parcel reply = Parcel.obtain();
5050 data.writeInterfaceToken(IActivityManager.descriptor);
5051 data.writeStrongBinder(owner);
5052 data.writeInt(fromUid);
5053 data.writeString(targetPkg);
5054 uri.writeToParcel(data, 0);
5055 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005056 data.writeInt(sourceUserId);
5057 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005058 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5059 reply.readException();
5060 data.recycle();
5061 reply.recycle();
5062 }
5063
5064 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005065 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005066 Parcel data = Parcel.obtain();
5067 Parcel reply = Parcel.obtain();
5068 data.writeInterfaceToken(IActivityManager.descriptor);
5069 data.writeStrongBinder(owner);
5070 if (uri != null) {
5071 data.writeInt(1);
5072 uri.writeToParcel(data, 0);
5073 } else {
5074 data.writeInt(0);
5075 }
5076 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005077 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005078 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5079 reply.readException();
5080 data.recycle();
5081 reply.recycle();
5082 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005083
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005084 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005085 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005086 Parcel data = Parcel.obtain();
5087 Parcel reply = Parcel.obtain();
5088 data.writeInterfaceToken(IActivityManager.descriptor);
5089 data.writeInt(callingUid);
5090 data.writeString(targetPkg);
5091 uri.writeToParcel(data, 0);
5092 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005093 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005094 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5095 reply.readException();
5096 int res = reply.readInt();
5097 data.recycle();
5098 reply.recycle();
5099 return res;
5100 }
5101
Dianne Hackborn1676c852012-09-10 14:52:30 -07005102 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005103 String path, ParcelFileDescriptor fd) throws RemoteException {
5104 Parcel data = Parcel.obtain();
5105 Parcel reply = Parcel.obtain();
5106 data.writeInterfaceToken(IActivityManager.descriptor);
5107 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005108 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005109 data.writeInt(managed ? 1 : 0);
5110 data.writeString(path);
5111 if (fd != null) {
5112 data.writeInt(1);
5113 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5114 } else {
5115 data.writeInt(0);
5116 }
5117 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5118 reply.readException();
5119 boolean res = reply.readInt() != 0;
5120 reply.recycle();
5121 data.recycle();
5122 return res;
5123 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005124
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005125 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005126 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005127 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005128 Parcel data = Parcel.obtain();
5129 Parcel reply = Parcel.obtain();
5130 data.writeInterfaceToken(IActivityManager.descriptor);
5131 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005132 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005133 data.writeTypedArray(intents, 0);
5134 data.writeStringArray(resolvedTypes);
5135 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005136 if (options != null) {
5137 data.writeInt(1);
5138 options.writeToParcel(data, 0);
5139 } else {
5140 data.writeInt(0);
5141 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005142 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005143 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5144 reply.readException();
5145 int result = reply.readInt();
5146 reply.recycle();
5147 data.recycle();
5148 return result;
5149 }
5150
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005151 public int getFrontActivityScreenCompatMode() throws RemoteException {
5152 Parcel data = Parcel.obtain();
5153 Parcel reply = Parcel.obtain();
5154 data.writeInterfaceToken(IActivityManager.descriptor);
5155 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5156 reply.readException();
5157 int mode = reply.readInt();
5158 reply.recycle();
5159 data.recycle();
5160 return mode;
5161 }
5162
5163 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5164 Parcel data = Parcel.obtain();
5165 Parcel reply = Parcel.obtain();
5166 data.writeInterfaceToken(IActivityManager.descriptor);
5167 data.writeInt(mode);
5168 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5169 reply.readException();
5170 reply.recycle();
5171 data.recycle();
5172 }
5173
5174 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5175 Parcel data = Parcel.obtain();
5176 Parcel reply = Parcel.obtain();
5177 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005178 data.writeString(packageName);
5179 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005180 reply.readException();
5181 int mode = reply.readInt();
5182 reply.recycle();
5183 data.recycle();
5184 return mode;
5185 }
5186
5187 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005188 throws RemoteException {
5189 Parcel data = Parcel.obtain();
5190 Parcel reply = Parcel.obtain();
5191 data.writeInterfaceToken(IActivityManager.descriptor);
5192 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005193 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005194 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5195 reply.readException();
5196 reply.recycle();
5197 data.recycle();
5198 }
5199
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005200 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5201 Parcel data = Parcel.obtain();
5202 Parcel reply = Parcel.obtain();
5203 data.writeInterfaceToken(IActivityManager.descriptor);
5204 data.writeString(packageName);
5205 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5206 reply.readException();
5207 boolean ask = reply.readInt() != 0;
5208 reply.recycle();
5209 data.recycle();
5210 return ask;
5211 }
5212
5213 public void setPackageAskScreenCompat(String packageName, boolean ask)
5214 throws RemoteException {
5215 Parcel data = Parcel.obtain();
5216 Parcel reply = Parcel.obtain();
5217 data.writeInterfaceToken(IActivityManager.descriptor);
5218 data.writeString(packageName);
5219 data.writeInt(ask ? 1 : 0);
5220 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5221 reply.readException();
5222 reply.recycle();
5223 data.recycle();
5224 }
5225
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005226 public boolean switchUser(int userid) throws RemoteException {
5227 Parcel data = Parcel.obtain();
5228 Parcel reply = Parcel.obtain();
5229 data.writeInterfaceToken(IActivityManager.descriptor);
5230 data.writeInt(userid);
5231 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5232 reply.readException();
5233 boolean result = reply.readInt() != 0;
5234 reply.recycle();
5235 data.recycle();
5236 return result;
5237 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005238
Kenny Guy08488bf2014-02-21 17:40:37 +00005239 public boolean startUserInBackground(int userid) throws RemoteException {
5240 Parcel data = Parcel.obtain();
5241 Parcel reply = Parcel.obtain();
5242 data.writeInterfaceToken(IActivityManager.descriptor);
5243 data.writeInt(userid);
5244 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5245 reply.readException();
5246 boolean result = reply.readInt() != 0;
5247 reply.recycle();
5248 data.recycle();
5249 return result;
5250 }
5251
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005252 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5253 Parcel data = Parcel.obtain();
5254 Parcel reply = Parcel.obtain();
5255 data.writeInterfaceToken(IActivityManager.descriptor);
5256 data.writeInt(userid);
5257 data.writeStrongInterface(callback);
5258 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5259 reply.readException();
5260 int result = reply.readInt();
5261 reply.recycle();
5262 data.recycle();
5263 return result;
5264 }
5265
Amith Yamasani52f1d752012-03-28 18:19:29 -07005266 public UserInfo getCurrentUser() throws RemoteException {
5267 Parcel data = Parcel.obtain();
5268 Parcel reply = Parcel.obtain();
5269 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005270 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005271 reply.readException();
5272 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5273 reply.recycle();
5274 data.recycle();
5275 return userInfo;
5276 }
5277
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005278 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005279 Parcel data = Parcel.obtain();
5280 Parcel reply = Parcel.obtain();
5281 data.writeInterfaceToken(IActivityManager.descriptor);
5282 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005283 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005284 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5285 reply.readException();
5286 boolean result = reply.readInt() != 0;
5287 reply.recycle();
5288 data.recycle();
5289 return result;
5290 }
5291
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005292 public int[] getRunningUserIds() throws RemoteException {
5293 Parcel data = Parcel.obtain();
5294 Parcel reply = Parcel.obtain();
5295 data.writeInterfaceToken(IActivityManager.descriptor);
5296 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5297 reply.readException();
5298 int[] result = reply.createIntArray();
5299 reply.recycle();
5300 data.recycle();
5301 return result;
5302 }
5303
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005304 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005305 Parcel data = Parcel.obtain();
5306 Parcel reply = Parcel.obtain();
5307 data.writeInterfaceToken(IActivityManager.descriptor);
5308 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005309 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5310 reply.readException();
5311 boolean result = reply.readInt() != 0;
5312 reply.recycle();
5313 data.recycle();
5314 return result;
5315 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005316
Jeff Sharkeya4620792011-05-20 15:29:23 -07005317 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5318 Parcel data = Parcel.obtain();
5319 Parcel reply = Parcel.obtain();
5320 data.writeInterfaceToken(IActivityManager.descriptor);
5321 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5322 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5323 reply.readException();
5324 data.recycle();
5325 reply.recycle();
5326 }
5327
5328 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5329 Parcel data = Parcel.obtain();
5330 Parcel reply = Parcel.obtain();
5331 data.writeInterfaceToken(IActivityManager.descriptor);
5332 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5333 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5334 reply.readException();
5335 data.recycle();
5336 reply.recycle();
5337 }
5338
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005339 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005340 Parcel data = Parcel.obtain();
5341 Parcel reply = Parcel.obtain();
5342 data.writeInterfaceToken(IActivityManager.descriptor);
5343 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005344 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005345 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5346 reply.readException();
5347 data.recycle();
5348 reply.recycle();
5349 }
5350
5351 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5352 Parcel data = Parcel.obtain();
5353 Parcel reply = Parcel.obtain();
5354 data.writeInterfaceToken(IActivityManager.descriptor);
5355 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5356 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5357 reply.readException();
5358 data.recycle();
5359 reply.recycle();
5360 }
5361
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005362 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5363 Parcel data = Parcel.obtain();
5364 Parcel reply = Parcel.obtain();
5365 data.writeInterfaceToken(IActivityManager.descriptor);
5366 data.writeStrongBinder(sender.asBinder());
5367 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5368 reply.readException();
5369 boolean res = reply.readInt() != 0;
5370 data.recycle();
5371 reply.recycle();
5372 return res;
5373 }
5374
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005375 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5376 Parcel data = Parcel.obtain();
5377 Parcel reply = Parcel.obtain();
5378 data.writeInterfaceToken(IActivityManager.descriptor);
5379 data.writeStrongBinder(sender.asBinder());
5380 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5381 reply.readException();
5382 boolean res = reply.readInt() != 0;
5383 data.recycle();
5384 reply.recycle();
5385 return res;
5386 }
5387
Dianne Hackborn81038902012-11-26 17:04:09 -08005388 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5389 Parcel data = Parcel.obtain();
5390 Parcel reply = Parcel.obtain();
5391 data.writeInterfaceToken(IActivityManager.descriptor);
5392 data.writeStrongBinder(sender.asBinder());
5393 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5394 reply.readException();
5395 Intent res = reply.readInt() != 0
5396 ? Intent.CREATOR.createFromParcel(reply) : null;
5397 data.recycle();
5398 reply.recycle();
5399 return res;
5400 }
5401
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005402 public String getTagForIntentSender(IIntentSender sender, String prefix)
5403 throws RemoteException {
5404 Parcel data = Parcel.obtain();
5405 Parcel reply = Parcel.obtain();
5406 data.writeInterfaceToken(IActivityManager.descriptor);
5407 data.writeStrongBinder(sender.asBinder());
5408 data.writeString(prefix);
5409 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5410 reply.readException();
5411 String res = reply.readString();
5412 data.recycle();
5413 reply.recycle();
5414 return res;
5415 }
5416
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005417 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5418 {
5419 Parcel data = Parcel.obtain();
5420 Parcel reply = Parcel.obtain();
5421 data.writeInterfaceToken(IActivityManager.descriptor);
5422 values.writeToParcel(data, 0);
5423 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5424 reply.readException();
5425 data.recycle();
5426 reply.recycle();
5427 }
5428
Dianne Hackbornb437e092011-08-05 17:50:29 -07005429 public long[] getProcessPss(int[] pids) throws RemoteException {
5430 Parcel data = Parcel.obtain();
5431 Parcel reply = Parcel.obtain();
5432 data.writeInterfaceToken(IActivityManager.descriptor);
5433 data.writeIntArray(pids);
5434 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5435 reply.readException();
5436 long[] res = reply.createLongArray();
5437 data.recycle();
5438 reply.recycle();
5439 return res;
5440 }
5441
Dianne Hackborn661cd522011-08-22 00:26:20 -07005442 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5443 Parcel data = Parcel.obtain();
5444 Parcel reply = Parcel.obtain();
5445 data.writeInterfaceToken(IActivityManager.descriptor);
5446 TextUtils.writeToParcel(msg, data, 0);
5447 data.writeInt(always ? 1 : 0);
5448 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5449 reply.readException();
5450 data.recycle();
5451 reply.recycle();
5452 }
5453
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005454 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005455 Parcel data = Parcel.obtain();
5456 Parcel reply = Parcel.obtain();
5457 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005458 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005459 reply.readException();
5460 data.recycle();
5461 reply.recycle();
5462 }
5463
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005464 public void keyguardGoingAway(boolean disableWindowAnimations,
5465 boolean keyguardGoingToNotificationShade) throws RemoteException {
5466 Parcel data = Parcel.obtain();
5467 Parcel reply = Parcel.obtain();
5468 data.writeInterfaceToken(IActivityManager.descriptor);
5469 data.writeInt(disableWindowAnimations ? 1 : 0);
5470 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5471 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5472 reply.readException();
5473 data.recycle();
5474 reply.recycle();
5475 }
5476
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005477 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005478 throws RemoteException {
5479 Parcel data = Parcel.obtain();
5480 Parcel reply = Parcel.obtain();
5481 data.writeInterfaceToken(IActivityManager.descriptor);
5482 data.writeStrongBinder(token);
5483 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005484 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005485 reply.readException();
5486 boolean result = reply.readInt() != 0;
5487 data.recycle();
5488 reply.recycle();
5489 return result;
5490 }
5491
5492 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5493 throws RemoteException {
5494 Parcel data = Parcel.obtain();
5495 Parcel reply = Parcel.obtain();
5496 data.writeInterfaceToken(IActivityManager.descriptor);
5497 data.writeStrongBinder(token);
5498 target.writeToParcel(data, 0);
5499 data.writeInt(resultCode);
5500 if (resultData != null) {
5501 data.writeInt(1);
5502 resultData.writeToParcel(data, 0);
5503 } else {
5504 data.writeInt(0);
5505 }
5506 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5507 reply.readException();
5508 boolean result = reply.readInt() != 0;
5509 data.recycle();
5510 reply.recycle();
5511 return result;
5512 }
5513
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005514 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5515 Parcel data = Parcel.obtain();
5516 Parcel reply = Parcel.obtain();
5517 data.writeInterfaceToken(IActivityManager.descriptor);
5518 data.writeStrongBinder(activityToken);
5519 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5520 reply.readException();
5521 int result = reply.readInt();
5522 data.recycle();
5523 reply.recycle();
5524 return result;
5525 }
5526
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005527 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5528 Parcel data = Parcel.obtain();
5529 Parcel reply = Parcel.obtain();
5530 data.writeInterfaceToken(IActivityManager.descriptor);
5531 data.writeStrongBinder(activityToken);
5532 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5533 reply.readException();
5534 String result = reply.readString();
5535 data.recycle();
5536 reply.recycle();
5537 return result;
5538 }
5539
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005540 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5541 Parcel data = Parcel.obtain();
5542 Parcel reply = Parcel.obtain();
5543 data.writeInterfaceToken(IActivityManager.descriptor);
5544 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5545 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5546 reply.readException();
5547 data.recycle();
5548 reply.recycle();
5549 }
5550
5551 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5552 Parcel data = Parcel.obtain();
5553 Parcel reply = Parcel.obtain();
5554 data.writeInterfaceToken(IActivityManager.descriptor);
5555 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5556 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5557 reply.readException();
5558 data.recycle();
5559 reply.recycle();
5560 }
5561
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005562 public void requestBugReport() throws RemoteException {
5563 Parcel data = Parcel.obtain();
5564 Parcel reply = Parcel.obtain();
5565 data.writeInterfaceToken(IActivityManager.descriptor);
5566 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5567 reply.readException();
5568 data.recycle();
5569 reply.recycle();
5570 }
5571
Jeff Brownbd181bb2013-09-10 16:44:24 -07005572 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5573 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005574 Parcel data = Parcel.obtain();
5575 Parcel reply = Parcel.obtain();
5576 data.writeInterfaceToken(IActivityManager.descriptor);
5577 data.writeInt(pid);
5578 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005579 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005580 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5581 reply.readException();
5582 long res = reply.readInt();
5583 data.recycle();
5584 reply.recycle();
5585 return res;
5586 }
5587
Adam Skorydfc7fd72013-08-05 19:23:41 -07005588 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005589 Parcel data = Parcel.obtain();
5590 Parcel reply = Parcel.obtain();
5591 data.writeInterfaceToken(IActivityManager.descriptor);
5592 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005593 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005594 reply.readException();
5595 Bundle res = reply.readBundle();
5596 data.recycle();
5597 reply.recycle();
5598 return res;
5599 }
5600
Dianne Hackborn17f69352015-07-17 18:04:14 -07005601 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5602 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005603 Parcel data = Parcel.obtain();
5604 Parcel reply = Parcel.obtain();
5605 data.writeInterfaceToken(IActivityManager.descriptor);
5606 data.writeInt(requestType);
5607 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005608 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005609 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5610 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005611 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005612 data.recycle();
5613 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005614 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005615 }
5616
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005617 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005618 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005619 Parcel data = Parcel.obtain();
5620 Parcel reply = Parcel.obtain();
5621 data.writeInterfaceToken(IActivityManager.descriptor);
5622 data.writeStrongBinder(token);
5623 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005624 structure.writeToParcel(data, 0);
5625 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005626 if (referrer != null) {
5627 data.writeInt(1);
5628 referrer.writeToParcel(data, 0);
5629 } else {
5630 data.writeInt(0);
5631 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005632 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005633 reply.readException();
5634 data.recycle();
5635 reply.recycle();
5636 }
5637
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005638 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5639 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005640 Parcel data = Parcel.obtain();
5641 Parcel reply = Parcel.obtain();
5642 data.writeInterfaceToken(IActivityManager.descriptor);
5643 intent.writeToParcel(data, 0);
5644 data.writeInt(requestType);
5645 data.writeString(hint);
5646 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005647 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005648 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5649 reply.readException();
5650 boolean res = reply.readInt() != 0;
5651 data.recycle();
5652 reply.recycle();
5653 return res;
5654 }
5655
Dianne Hackborn17f69352015-07-17 18:04:14 -07005656 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005657 Parcel data = Parcel.obtain();
5658 Parcel reply = Parcel.obtain();
5659 data.writeInterfaceToken(IActivityManager.descriptor);
5660 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5661 reply.readException();
5662 boolean res = reply.readInt() != 0;
5663 data.recycle();
5664 reply.recycle();
5665 return res;
5666 }
5667
Dianne Hackborn17f69352015-07-17 18:04:14 -07005668 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5669 Parcel data = Parcel.obtain();
5670 Parcel reply = Parcel.obtain();
5671 data.writeInterfaceToken(IActivityManager.descriptor);
5672 data.writeStrongBinder(token);
5673 data.writeBundle(args);
5674 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5675 reply.readException();
5676 boolean res = reply.readInt() != 0;
5677 data.recycle();
5678 reply.recycle();
5679 return res;
5680 }
5681
Svetoslavaa41add2015-08-06 15:03:55 -07005682 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005683 Parcel data = Parcel.obtain();
5684 Parcel reply = Parcel.obtain();
5685 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07005686 data.writeInt(appId);
5687 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005688 data.writeString(reason);
5689 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5690 reply.readException();
5691 data.recycle();
5692 reply.recycle();
5693 }
5694
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005695 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5696 Parcel data = Parcel.obtain();
5697 Parcel reply = Parcel.obtain();
5698 data.writeInterfaceToken(IActivityManager.descriptor);
5699 data.writeStrongBinder(who);
5700 data.writeInt(allowRestart ? 1 : 0);
5701 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5702 reply.readException();
5703 data.recycle();
5704 reply.recycle();
5705 }
5706
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005707 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5708 Parcel data = Parcel.obtain();
5709 Parcel reply = Parcel.obtain();
5710 data.writeInterfaceToken(IActivityManager.descriptor);
5711 data.writeStrongBinder(token);
5712 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5713 reply.readException();
5714 data.recycle();
5715 reply.recycle();
5716 }
5717
Craig Mautner5eda9b32013-07-02 11:58:16 -07005718 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5719 Parcel data = Parcel.obtain();
5720 Parcel reply = Parcel.obtain();
5721 data.writeInterfaceToken(IActivityManager.descriptor);
5722 data.writeStrongBinder(token);
5723 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5724 reply.readException();
5725 data.recycle();
5726 reply.recycle();
5727 }
5728
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005729 public void restart() throws RemoteException {
5730 Parcel data = Parcel.obtain();
5731 Parcel reply = Parcel.obtain();
5732 data.writeInterfaceToken(IActivityManager.descriptor);
5733 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5734 reply.readException();
5735 data.recycle();
5736 reply.recycle();
5737 }
5738
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005739 public void performIdleMaintenance() throws RemoteException {
5740 Parcel data = Parcel.obtain();
5741 Parcel reply = Parcel.obtain();
5742 data.writeInterfaceToken(IActivityManager.descriptor);
5743 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5744 reply.readException();
5745 data.recycle();
5746 reply.recycle();
5747 }
5748
Todd Kennedyca4d8422015-01-15 15:19:22 -08005749 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005750 IActivityContainerCallback callback) throws RemoteException {
5751 Parcel data = Parcel.obtain();
5752 Parcel reply = Parcel.obtain();
5753 data.writeInterfaceToken(IActivityManager.descriptor);
5754 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005755 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005756 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005757 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005758 final int result = reply.readInt();
5759 final IActivityContainer res;
5760 if (result == 1) {
5761 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5762 } else {
5763 res = null;
5764 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005765 data.recycle();
5766 reply.recycle();
5767 return res;
5768 }
5769
Craig Mautner95da1082014-02-24 17:54:35 -08005770 public void deleteActivityContainer(IActivityContainer activityContainer)
5771 throws RemoteException {
5772 Parcel data = Parcel.obtain();
5773 Parcel reply = Parcel.obtain();
5774 data.writeInterfaceToken(IActivityManager.descriptor);
5775 data.writeStrongBinder(activityContainer.asBinder());
5776 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5777 reply.readException();
5778 data.recycle();
5779 reply.recycle();
5780 }
5781
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04005782 public boolean startBinderTracking() throws RemoteException {
5783 Parcel data = Parcel.obtain();
5784 Parcel reply = Parcel.obtain();
5785 data.writeInterfaceToken(IActivityManager.descriptor);
5786 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
5787 reply.readException();
5788 boolean res = reply.readInt() != 0;
5789 reply.recycle();
5790 data.recycle();
5791 return res;
5792 }
5793
5794 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
5795 Parcel data = Parcel.obtain();
5796 Parcel reply = Parcel.obtain();
5797 data.writeInterfaceToken(IActivityManager.descriptor);
5798 if (fd != null) {
5799 data.writeInt(1);
5800 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5801 } else {
5802 data.writeInt(0);
5803 }
5804 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
5805 reply.readException();
5806 boolean res = reply.readInt() != 0;
5807 reply.recycle();
5808 data.recycle();
5809 return res;
5810 }
5811
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005812 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005813 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5814 Parcel data = Parcel.obtain();
5815 Parcel reply = Parcel.obtain();
5816 data.writeInterfaceToken(IActivityManager.descriptor);
5817 data.writeInt(displayId);
5818 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5819 reply.readException();
5820 final int result = reply.readInt();
5821 final IActivityContainer res;
5822 if (result == 1) {
5823 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5824 } else {
5825 res = null;
5826 }
5827 data.recycle();
5828 reply.recycle();
5829 return res;
5830 }
5831
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005832 @Override
5833 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005834 throws RemoteException {
5835 Parcel data = Parcel.obtain();
5836 Parcel reply = Parcel.obtain();
5837 data.writeInterfaceToken(IActivityManager.descriptor);
5838 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005839 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005840 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005841 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005842 data.recycle();
5843 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005844 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005845 }
5846
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005847 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005848 public void startLockTaskMode(int taskId) throws RemoteException {
5849 Parcel data = Parcel.obtain();
5850 Parcel reply = Parcel.obtain();
5851 data.writeInterfaceToken(IActivityManager.descriptor);
5852 data.writeInt(taskId);
5853 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5854 reply.readException();
5855 data.recycle();
5856 reply.recycle();
5857 }
5858
5859 @Override
5860 public void startLockTaskMode(IBinder token) throws RemoteException {
5861 Parcel data = Parcel.obtain();
5862 Parcel reply = Parcel.obtain();
5863 data.writeInterfaceToken(IActivityManager.descriptor);
5864 data.writeStrongBinder(token);
5865 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5866 reply.readException();
5867 data.recycle();
5868 reply.recycle();
5869 }
5870
5871 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005872 public void startLockTaskModeOnCurrent() throws RemoteException {
5873 Parcel data = Parcel.obtain();
5874 Parcel reply = Parcel.obtain();
5875 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005876 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005877 reply.readException();
5878 data.recycle();
5879 reply.recycle();
5880 }
5881
5882 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005883 public void stopLockTaskMode() throws RemoteException {
5884 Parcel data = Parcel.obtain();
5885 Parcel reply = Parcel.obtain();
5886 data.writeInterfaceToken(IActivityManager.descriptor);
5887 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5888 reply.readException();
5889 data.recycle();
5890 reply.recycle();
5891 }
5892
5893 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005894 public void stopLockTaskModeOnCurrent() throws RemoteException {
5895 Parcel data = Parcel.obtain();
5896 Parcel reply = Parcel.obtain();
5897 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005898 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005899 reply.readException();
5900 data.recycle();
5901 reply.recycle();
5902 }
5903
5904 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005905 public boolean isInLockTaskMode() throws RemoteException {
5906 Parcel data = Parcel.obtain();
5907 Parcel reply = Parcel.obtain();
5908 data.writeInterfaceToken(IActivityManager.descriptor);
5909 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5910 reply.readException();
5911 boolean isInLockTaskMode = reply.readInt() == 1;
5912 data.recycle();
5913 reply.recycle();
5914 return isInLockTaskMode;
5915 }
5916
Craig Mautner688b5102014-03-27 16:55:03 -07005917 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005918 public int getLockTaskModeState() throws RemoteException {
5919 Parcel data = Parcel.obtain();
5920 Parcel reply = Parcel.obtain();
5921 data.writeInterfaceToken(IActivityManager.descriptor);
5922 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5923 reply.readException();
5924 int lockTaskModeState = reply.readInt();
5925 data.recycle();
5926 reply.recycle();
5927 return lockTaskModeState;
5928 }
5929
5930 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005931 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5932 Parcel data = Parcel.obtain();
5933 Parcel reply = Parcel.obtain();
5934 data.writeInterfaceToken(IActivityManager.descriptor);
5935 data.writeStrongBinder(token);
5936 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5937 IBinder.FLAG_ONEWAY);
5938 reply.readException();
5939 data.recycle();
5940 reply.recycle();
5941 }
5942
5943 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005944 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005945 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005946 Parcel data = Parcel.obtain();
5947 Parcel reply = Parcel.obtain();
5948 data.writeInterfaceToken(IActivityManager.descriptor);
5949 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005950 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005951 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005952 reply.readException();
5953 data.recycle();
5954 reply.recycle();
5955 }
5956
Craig Mautneree2e45a2014-06-27 12:10:03 -07005957 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005958 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5959 Parcel data = Parcel.obtain();
5960 Parcel reply = Parcel.obtain();
5961 data.writeInterfaceToken(IActivityManager.descriptor);
5962 data.writeInt(taskId);
5963 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005964 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005965 reply.readException();
5966 data.recycle();
5967 reply.recycle();
5968 }
5969
5970 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07005971 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005972 {
5973 Parcel data = Parcel.obtain();
5974 Parcel reply = Parcel.obtain();
5975 data.writeInterfaceToken(IActivityManager.descriptor);
5976 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07005977 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005978 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005979 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005980 reply.readException();
5981 data.recycle();
5982 reply.recycle();
5983 }
5984
5985 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07005986 public Rect getTaskBounds(int taskId) throws RemoteException
5987 {
5988 Parcel data = Parcel.obtain();
5989 Parcel reply = Parcel.obtain();
5990 data.writeInterfaceToken(IActivityManager.descriptor);
5991 data.writeInt(taskId);
5992 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
5993 reply.readException();
5994 Rect rect = Rect.CREATOR.createFromParcel(reply);
5995 data.recycle();
5996 reply.recycle();
5997 return rect;
5998 }
5999
6000 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07006001 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
6002 Parcel data = Parcel.obtain();
6003 Parcel reply = Parcel.obtain();
6004 data.writeInterfaceToken(IActivityManager.descriptor);
6005 data.writeString(filename);
6006 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6007 reply.readException();
6008 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6009 data.recycle();
6010 reply.recycle();
6011 return icon;
6012 }
6013
6014 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006015 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6016 throws RemoteException {
6017 Parcel data = Parcel.obtain();
6018 Parcel reply = Parcel.obtain();
6019 data.writeInterfaceToken(IActivityManager.descriptor);
6020 if (options == null) {
6021 data.writeInt(0);
6022 } else {
6023 data.writeInt(1);
6024 data.writeBundle(options.toBundle());
6025 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006026 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006027 reply.readException();
6028 data.recycle();
6029 reply.recycle();
6030 }
6031
6032 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006033 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006034 Parcel data = Parcel.obtain();
6035 Parcel reply = Parcel.obtain();
6036 data.writeInterfaceToken(IActivityManager.descriptor);
6037 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006038 data.writeInt(visible ? 1 : 0);
6039 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006040 reply.readException();
6041 boolean success = reply.readInt() > 0;
6042 data.recycle();
6043 reply.recycle();
6044 return success;
6045 }
6046
6047 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006048 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006049 Parcel data = Parcel.obtain();
6050 Parcel reply = Parcel.obtain();
6051 data.writeInterfaceToken(IActivityManager.descriptor);
6052 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006053 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006054 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006055 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006056 data.recycle();
6057 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006058 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006059 }
6060
6061 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006062 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006063 Parcel data = Parcel.obtain();
6064 Parcel reply = Parcel.obtain();
6065 data.writeInterfaceToken(IActivityManager.descriptor);
6066 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006067 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006068 reply.readException();
6069 data.recycle();
6070 reply.recycle();
6071 }
6072
6073 @Override
6074 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6075 Parcel data = Parcel.obtain();
6076 Parcel reply = Parcel.obtain();
6077 data.writeInterfaceToken(IActivityManager.descriptor);
6078 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006079 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006080 reply.readException();
6081 data.recycle();
6082 reply.recycle();
6083 }
6084
Craig Mautner8746a472014-07-24 15:12:54 -07006085 @Override
6086 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6087 Parcel data = Parcel.obtain();
6088 Parcel reply = Parcel.obtain();
6089 data.writeInterfaceToken(IActivityManager.descriptor);
6090 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006091 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006092 reply.readException();
6093 data.recycle();
6094 reply.recycle();
6095 }
6096
Craig Mautner6e2f3952014-09-09 14:26:41 -07006097 @Override
6098 public void bootAnimationComplete() throws RemoteException {
6099 Parcel data = Parcel.obtain();
6100 Parcel reply = Parcel.obtain();
6101 data.writeInterfaceToken(IActivityManager.descriptor);
6102 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6103 reply.readException();
6104 data.recycle();
6105 reply.recycle();
6106 }
6107
Wale Ogunwale18795a22014-12-03 11:38:33 -08006108 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006109 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6110 Parcel data = Parcel.obtain();
6111 Parcel reply = Parcel.obtain();
6112 data.writeInterfaceToken(IActivityManager.descriptor);
6113 data.writeInt(uid);
6114 data.writeByteArray(firstPacket);
6115 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6116 reply.readException();
6117 data.recycle();
6118 reply.recycle();
6119 }
6120
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006121 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006122 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6123 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006124 Parcel data = Parcel.obtain();
6125 Parcel reply = Parcel.obtain();
6126 data.writeInterfaceToken(IActivityManager.descriptor);
6127 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006128 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006129 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006130 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006131 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6132 reply.readException();
6133 data.recycle();
6134 reply.recycle();
6135 }
6136
6137 @Override
6138 public void dumpHeapFinished(String path) throws RemoteException {
6139 Parcel data = Parcel.obtain();
6140 Parcel reply = Parcel.obtain();
6141 data.writeInterfaceToken(IActivityManager.descriptor);
6142 data.writeString(path);
6143 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6144 reply.readException();
6145 data.recycle();
6146 reply.recycle();
6147 }
6148
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006149 @Override
6150 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6151 throws RemoteException {
6152 Parcel data = Parcel.obtain();
6153 Parcel reply = Parcel.obtain();
6154 data.writeInterfaceToken(IActivityManager.descriptor);
6155 data.writeStrongBinder(session.asBinder());
6156 data.writeInt(keepAwake ? 1 : 0);
6157 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6158 reply.readException();
6159 data.recycle();
6160 reply.recycle();
6161 }
6162
Craig Mautnere5600772015-04-03 21:36:37 -07006163 @Override
6164 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6165 Parcel data = Parcel.obtain();
6166 Parcel reply = Parcel.obtain();
6167 data.writeInterfaceToken(IActivityManager.descriptor);
6168 data.writeInt(userId);
6169 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006170 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006171 reply.readException();
6172 data.recycle();
6173 reply.recycle();
6174 }
6175
Dianne Hackborn1e383822015-04-10 14:02:33 -07006176 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006177 public void updateDeviceOwner(String packageName) throws RemoteException {
6178 Parcel data = Parcel.obtain();
6179 Parcel reply = Parcel.obtain();
6180 data.writeInterfaceToken(IActivityManager.descriptor);
6181 data.writeString(packageName);
6182 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6183 reply.readException();
6184 data.recycle();
6185 reply.recycle();
6186 }
6187
6188 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006189 public int getPackageProcessState(String packageName, String callingPackage)
6190 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006191 Parcel data = Parcel.obtain();
6192 Parcel reply = Parcel.obtain();
6193 data.writeInterfaceToken(IActivityManager.descriptor);
6194 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006195 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006196 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6197 reply.readException();
6198 int res = reply.readInt();
6199 data.recycle();
6200 reply.recycle();
6201 return res;
6202 }
6203
Stefan Kuhne16045c22015-06-05 07:18:06 -07006204 @Override
6205 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6206 throws RemoteException {
6207 Parcel data = Parcel.obtain();
6208 Parcel reply = Parcel.obtain();
6209 data.writeInterfaceToken(IActivityManager.descriptor);
6210 data.writeString(process);
6211 data.writeInt(userId);
6212 data.writeInt(level);
6213 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6214 reply.readException();
6215 int res = reply.readInt();
6216 data.recycle();
6217 reply.recycle();
6218 return res != 0;
6219 }
6220
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006221 @Override
6222 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6223 Parcel data = Parcel.obtain();
6224 Parcel reply = Parcel.obtain();
6225 data.writeInterfaceToken(IActivityManager.descriptor);
6226 data.writeStrongBinder(token);
6227 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6228 reply.readException();
6229 int res = reply.readInt();
6230 data.recycle();
6231 reply.recycle();
6232 return res != 0;
6233 }
6234
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006235 @Override
6236 public void moveActivityToStack(IBinder token, int stackId) throws RemoteException {
6237 Parcel data = Parcel.obtain();
6238 Parcel reply = Parcel.obtain();
6239 data.writeInterfaceToken(IActivityManager.descriptor);
6240 data.writeStrongBinder(token);
6241 data.writeInt(stackId);
6242 mRemote.transact(MOVE_ACTIVITY_TO_STACK_TRANSACTION, data, reply, 0);
6243 reply.readException();
6244 data.recycle();
6245 reply.recycle();
6246 }
6247
6248 @Override
6249 public int getActivityStackId(IBinder token) throws RemoteException {
6250 Parcel data = Parcel.obtain();
6251 Parcel reply = Parcel.obtain();
6252 data.writeInterfaceToken(IActivityManager.descriptor);
6253 data.writeStrongBinder(token);
6254 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6255 reply.readException();
6256 int stackId = reply.readInt();
6257 data.recycle();
6258 reply.recycle();
6259 return stackId;
6260 }
6261
Filip Gruszczynski23493322015-07-29 17:02:59 -07006262 @Override
6263 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006264 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6265 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006266 Parcel data = Parcel.obtain();
6267 Parcel reply = Parcel.obtain();
6268 data.writeInterfaceToken(IActivityManager.descriptor);
6269 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006270 writeIntArray(horizontalSizeConfiguration, data);
6271 writeIntArray(verticalSizeConfigurations, data);
6272 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006273 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6274 reply.readException();
6275 data.recycle();
6276 reply.recycle();
6277 }
6278
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006279 private static void writeIntArray(int[] array, Parcel data) {
6280 if (array == null) {
6281 data.writeInt(0);
6282 } else {
6283 data.writeInt(array.length);
6284 data.writeIntArray(array);
6285 }
6286 }
6287
Wale Ogunwale83301a92015-09-24 15:54:08 -07006288 @Override
6289 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6290 Parcel data = Parcel.obtain();
6291 Parcel reply = Parcel.obtain();
6292 data.writeInterfaceToken(IActivityManager.descriptor);
6293 data.writeInt(suppress ? 1 : 0);
6294 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6295 reply.readException();
6296 data.recycle();
6297 reply.recycle();
6298 }
6299
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006300 @Override
6301 public void removeStack(int stackId) throws RemoteException {
6302 Parcel data = Parcel.obtain();
6303 Parcel reply = Parcel.obtain();
6304 data.writeInterfaceToken(IActivityManager.descriptor);
6305 data.writeInt(stackId);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006306 mRemote.transact(REMOVE_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006307 reply.readException();
6308 data.recycle();
6309 reply.recycle();
6310 }
6311
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006312 @Override
6313 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6314 Parcel data = Parcel.obtain();
6315 Parcel reply = Parcel.obtain();
6316 data.writeInterfaceToken(IActivityManager.descriptor);
6317 data.writeInt(uid);
6318 data.writeString(packageName);
6319 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6320 reply.readException();
6321 int res = reply.readInt();
6322 data.recycle();
6323 reply.recycle();
6324 return res;
6325 }
6326
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006327 private IBinder mRemote;
6328}