blob: 8b62ef9d568f1e21f05d740ec7696e47e04cb844 [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
Amith Yamasani0af6fa72016-01-17 15:36:19 -0800318 case START_LOCAL_VOICE_INTERACTION_TRANSACTION:
319 {
320 data.enforceInterface(IActivityManager.descriptor);
321 IBinder token = data.readStrongBinder();
322 Bundle options = data.readBundle();
323 startLocalVoiceInteraction(token, options);
324 reply.writeNoException();
325 return true;
326 }
327
328 case STOP_LOCAL_VOICE_INTERACTION_TRANSACTION:
329 {
330 data.enforceInterface(IActivityManager.descriptor);
331 IBinder token = data.readStrongBinder();
332 stopLocalVoiceInteraction(token);
333 reply.writeNoException();
334 return true;
335 }
336
337 case SUPPORTS_LOCAL_VOICE_INTERACTION_TRANSACTION:
338 {
339 data.enforceInterface(IActivityManager.descriptor);
340 boolean result = supportsLocalVoiceInteraction();
341 reply.writeNoException();
342 reply.writeInt(result? 1 : 0);
343 return true;
344 }
345
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800346 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
347 {
348 data.enforceInterface(IActivityManager.descriptor);
349 IBinder callingActivity = data.readStrongBinder();
350 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700351 Bundle options = data.readInt() != 0
352 ? Bundle.CREATOR.createFromParcel(data) : null;
353 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 reply.writeNoException();
355 reply.writeInt(result ? 1 : 0);
356 return true;
357 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700358
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700359 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
360 {
361 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700362 final int taskId = data.readInt();
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700363 final Bundle options =
364 data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
Wale Ogunwale854809c2015-12-27 16:18:19 -0800365 final int result = startActivityFromRecents(taskId, options);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700366 reply.writeNoException();
367 reply.writeInt(result);
368 return true;
369 }
370
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800371 case FINISH_ACTIVITY_TRANSACTION: {
372 data.enforceInterface(IActivityManager.descriptor);
373 IBinder token = data.readStrongBinder();
374 Intent resultData = null;
375 int resultCode = data.readInt();
376 if (data.readInt() != 0) {
377 resultData = Intent.CREATOR.createFromParcel(data);
378 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700379 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700380 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800381 reply.writeNoException();
382 reply.writeInt(res ? 1 : 0);
383 return true;
384 }
385
386 case FINISH_SUB_ACTIVITY_TRANSACTION: {
387 data.enforceInterface(IActivityManager.descriptor);
388 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700389 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 int requestCode = data.readInt();
391 finishSubActivity(token, resultWho, requestCode);
392 reply.writeNoException();
393 return true;
394 }
395
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700396 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
397 data.enforceInterface(IActivityManager.descriptor);
398 IBinder token = data.readStrongBinder();
399 boolean res = finishActivityAffinity(token);
400 reply.writeNoException();
401 reply.writeInt(res ? 1 : 0);
402 return true;
403 }
404
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700405 case FINISH_VOICE_TASK_TRANSACTION: {
406 data.enforceInterface(IActivityManager.descriptor);
407 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
408 data.readStrongBinder());
409 finishVoiceTask(session);
410 reply.writeNoException();
411 return true;
412 }
413
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700414 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
415 data.enforceInterface(IActivityManager.descriptor);
416 IBinder token = data.readStrongBinder();
417 boolean res = releaseActivityInstance(token);
418 reply.writeNoException();
419 reply.writeInt(res ? 1 : 0);
420 return true;
421 }
422
423 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
424 data.enforceInterface(IActivityManager.descriptor);
425 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
426 releaseSomeActivities(app);
427 reply.writeNoException();
428 return true;
429 }
430
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800431 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
432 data.enforceInterface(IActivityManager.descriptor);
433 IBinder token = data.readStrongBinder();
434 boolean res = willActivityBeVisible(token);
435 reply.writeNoException();
436 reply.writeInt(res ? 1 : 0);
437 return true;
438 }
439
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440 case REGISTER_RECEIVER_TRANSACTION:
441 {
442 data.enforceInterface(IActivityManager.descriptor);
443 IBinder b = data.readStrongBinder();
444 IApplicationThread app =
445 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700446 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447 b = data.readStrongBinder();
448 IIntentReceiver rec
449 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
450 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
451 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700452 int userId = data.readInt();
453 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800454 reply.writeNoException();
455 if (intent != null) {
456 reply.writeInt(1);
457 intent.writeToParcel(reply, 0);
458 } else {
459 reply.writeInt(0);
460 }
461 return true;
462 }
463
464 case UNREGISTER_RECEIVER_TRANSACTION:
465 {
466 data.enforceInterface(IActivityManager.descriptor);
467 IBinder b = data.readStrongBinder();
468 if (b == null) {
469 return true;
470 }
471 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
472 unregisterReceiver(rec);
473 reply.writeNoException();
474 return true;
475 }
476
477 case BROADCAST_INTENT_TRANSACTION:
478 {
479 data.enforceInterface(IActivityManager.descriptor);
480 IBinder b = data.readStrongBinder();
481 IApplicationThread app =
482 b != null ? ApplicationThreadNative.asInterface(b) : null;
483 Intent intent = Intent.CREATOR.createFromParcel(data);
484 String resolvedType = data.readString();
485 b = data.readStrongBinder();
486 IIntentReceiver resultTo =
487 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
488 int resultCode = data.readInt();
489 String resultData = data.readString();
490 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700491 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800492 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700493 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 boolean serialized = data.readInt() != 0;
495 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700496 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700498 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700499 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 reply.writeNoException();
501 reply.writeInt(res);
502 return true;
503 }
504
505 case UNBROADCAST_INTENT_TRANSACTION:
506 {
507 data.enforceInterface(IActivityManager.descriptor);
508 IBinder b = data.readStrongBinder();
509 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
510 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700511 int userId = data.readInt();
512 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800513 reply.writeNoException();
514 return true;
515 }
516
517 case FINISH_RECEIVER_TRANSACTION: {
518 data.enforceInterface(IActivityManager.descriptor);
519 IBinder who = data.readStrongBinder();
520 int resultCode = data.readInt();
521 String resultData = data.readString();
522 Bundle resultExtras = data.readBundle();
523 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800524 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800525 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800526 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800527 }
528 reply.writeNoException();
529 return true;
530 }
531
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800532 case ATTACH_APPLICATION_TRANSACTION: {
533 data.enforceInterface(IActivityManager.descriptor);
534 IApplicationThread app = ApplicationThreadNative.asInterface(
535 data.readStrongBinder());
536 if (app != null) {
537 attachApplication(app);
538 }
539 reply.writeNoException();
540 return true;
541 }
542
543 case ACTIVITY_IDLE_TRANSACTION: {
544 data.enforceInterface(IActivityManager.descriptor);
545 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700546 Configuration config = null;
547 if (data.readInt() != 0) {
548 config = Configuration.CREATOR.createFromParcel(data);
549 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700550 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800551 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700552 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800553 }
554 reply.writeNoException();
555 return true;
556 }
557
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700558 case ACTIVITY_RESUMED_TRANSACTION: {
559 data.enforceInterface(IActivityManager.descriptor);
560 IBinder token = data.readStrongBinder();
561 activityResumed(token);
562 reply.writeNoException();
563 return true;
564 }
565
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800566 case ACTIVITY_PAUSED_TRANSACTION: {
567 data.enforceInterface(IActivityManager.descriptor);
568 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700569 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800570 reply.writeNoException();
571 return true;
572 }
573
574 case ACTIVITY_STOPPED_TRANSACTION: {
575 data.enforceInterface(IActivityManager.descriptor);
576 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800577 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700578 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800579 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700580 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800581 reply.writeNoException();
582 return true;
583 }
584
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800585 case ACTIVITY_SLEPT_TRANSACTION: {
586 data.enforceInterface(IActivityManager.descriptor);
587 IBinder token = data.readStrongBinder();
588 activitySlept(token);
589 reply.writeNoException();
590 return true;
591 }
592
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800593 case ACTIVITY_DESTROYED_TRANSACTION: {
594 data.enforceInterface(IActivityManager.descriptor);
595 IBinder token = data.readStrongBinder();
596 activityDestroyed(token);
597 reply.writeNoException();
598 return true;
599 }
600
Jorim Jaggife89d122015-12-22 16:28:44 +0100601 case ACTIVITY_RELAUNCHED_TRANSACTION: {
602 data.enforceInterface(IActivityManager.descriptor);
603 IBinder token = data.readStrongBinder();
604 activityRelaunched(token);
605 reply.writeNoException();
606 return true;
607 }
608
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800609 case GET_CALLING_PACKAGE_TRANSACTION: {
610 data.enforceInterface(IActivityManager.descriptor);
611 IBinder token = data.readStrongBinder();
612 String res = token != null ? getCallingPackage(token) : null;
613 reply.writeNoException();
614 reply.writeString(res);
615 return true;
616 }
617
618 case GET_CALLING_ACTIVITY_TRANSACTION: {
619 data.enforceInterface(IActivityManager.descriptor);
620 IBinder token = data.readStrongBinder();
621 ComponentName cn = getCallingActivity(token);
622 reply.writeNoException();
623 ComponentName.writeToParcel(cn, reply);
624 return true;
625 }
626
Winson Chung1147c402014-05-14 11:05:00 -0700627 case GET_APP_TASKS_TRANSACTION: {
628 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700629 String callingPackage = data.readString();
630 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700631 reply.writeNoException();
632 int N = list != null ? list.size() : -1;
633 reply.writeInt(N);
634 int i;
635 for (i=0; i<N; i++) {
636 IAppTask task = list.get(i);
637 reply.writeStrongBinder(task.asBinder());
638 }
639 return true;
640 }
641
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700642 case ADD_APP_TASK_TRANSACTION: {
643 data.enforceInterface(IActivityManager.descriptor);
644 IBinder activityToken = data.readStrongBinder();
645 Intent intent = Intent.CREATOR.createFromParcel(data);
646 ActivityManager.TaskDescription descr
647 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
648 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
649 int res = addAppTask(activityToken, intent, descr, thumbnail);
650 reply.writeNoException();
651 reply.writeInt(res);
652 return true;
653 }
654
655 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
656 data.enforceInterface(IActivityManager.descriptor);
657 Point size = getAppTaskThumbnailSize();
658 reply.writeNoException();
659 size.writeToParcel(reply, 0);
660 return true;
661 }
662
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800663 case GET_TASKS_TRANSACTION: {
664 data.enforceInterface(IActivityManager.descriptor);
665 int maxNum = data.readInt();
666 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700667 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800668 reply.writeNoException();
669 int N = list != null ? list.size() : -1;
670 reply.writeInt(N);
671 int i;
672 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700673 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800674 info.writeToParcel(reply, 0);
675 }
676 return true;
677 }
678
679 case GET_RECENT_TASKS_TRANSACTION: {
680 data.enforceInterface(IActivityManager.descriptor);
681 int maxNum = data.readInt();
682 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700683 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800684 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700685 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800686 reply.writeNoException();
687 reply.writeTypedList(list);
688 return true;
689 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700690
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700691 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800692 data.enforceInterface(IActivityManager.descriptor);
693 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700694 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800695 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700696 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800697 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700698 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700699 } else {
700 reply.writeInt(0);
701 }
702 return true;
703 }
704
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800705 case GET_SERVICES_TRANSACTION: {
706 data.enforceInterface(IActivityManager.descriptor);
707 int maxNum = data.readInt();
708 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700709 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 reply.writeNoException();
711 int N = list != null ? list.size() : -1;
712 reply.writeInt(N);
713 int i;
714 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700715 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800716 info.writeToParcel(reply, 0);
717 }
718 return true;
719 }
720
721 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
724 reply.writeNoException();
725 reply.writeTypedList(list);
726 return true;
727 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700728
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800729 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
730 data.enforceInterface(IActivityManager.descriptor);
731 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
732 reply.writeNoException();
733 reply.writeTypedList(list);
734 return true;
735 }
736
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700737 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
738 data.enforceInterface(IActivityManager.descriptor);
739 List<ApplicationInfo> list = getRunningExternalApplications();
740 reply.writeNoException();
741 reply.writeTypedList(list);
742 return true;
743 }
744
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800745 case MOVE_TASK_TO_FRONT_TRANSACTION: {
746 data.enforceInterface(IActivityManager.descriptor);
747 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800748 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700749 Bundle options = data.readInt() != 0
750 ? Bundle.CREATOR.createFromParcel(data) : null;
751 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800752 reply.writeNoException();
753 return true;
754 }
755
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800756 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
757 data.enforceInterface(IActivityManager.descriptor);
758 IBinder token = data.readStrongBinder();
759 boolean nonRoot = data.readInt() != 0;
760 boolean res = moveActivityTaskToBack(token, nonRoot);
761 reply.writeNoException();
762 reply.writeInt(res ? 1 : 0);
763 return true;
764 }
765
766 case MOVE_TASK_BACKWARDS_TRANSACTION: {
767 data.enforceInterface(IActivityManager.descriptor);
768 int task = data.readInt();
769 moveTaskBackwards(task);
770 reply.writeNoException();
771 return true;
772 }
773
Craig Mautnerc00204b2013-03-05 15:02:14 -0800774 case MOVE_TASK_TO_STACK_TRANSACTION: {
775 data.enforceInterface(IActivityManager.descriptor);
776 int taskId = data.readInt();
777 int stackId = data.readInt();
778 boolean toTop = data.readInt() != 0;
779 moveTaskToStack(taskId, stackId, toTop);
780 reply.writeNoException();
781 return true;
782 }
783
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700784 case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: {
785 data.enforceInterface(IActivityManager.descriptor);
786 int taskId = data.readInt();
787 int createMode = data.readInt();
788 boolean toTop = data.readInt() != 0;
Jorim Jaggi030979c2015-11-20 15:14:43 -0800789 boolean animate = data.readInt() != 0;
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -0800790 Rect bounds = null;
791 boolean hasBounds = data.readInt() != 0;
792 if (hasBounds) {
793 bounds = Rect.CREATOR.createFromParcel(data);
794 }
Chong Zhange4fbd322016-03-01 14:44:03 -0800795 boolean res = moveTaskToDockedStack(taskId, createMode, toTop, animate, bounds);
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700796 reply.writeNoException();
Chong Zhange4fbd322016-03-01 14:44:03 -0800797 reply.writeInt(res ? 1 : 0);
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700798 return true;
799 }
800
Dianne Hackbornbef28fe2015-10-29 17:57:11 -0700801 case MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION: {
Wale Ogunwale079a0042015-10-24 11:44:07 -0700802 data.enforceInterface(IActivityManager.descriptor);
803 final int stackId = data.readInt();
804 final Rect r = Rect.CREATOR.createFromParcel(data);
805 final boolean res = moveTopActivityToPinnedStack(stackId, r);
806 reply.writeNoException();
807 reply.writeInt(res ? 1 : 0);
808 return true;
809 }
810
Craig Mautnerc00204b2013-03-05 15:02:14 -0800811 case RESIZE_STACK_TRANSACTION: {
812 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700813 final int stackId = data.readInt();
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100814 final boolean hasRect = data.readInt() != 0;
815 Rect r = null;
816 if (hasRect) {
817 r = Rect.CREATOR.createFromParcel(data);
818 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700819 final boolean allowResizeInDockedMode = data.readInt() == 1;
Filip Gruszczynski84fa3352016-01-25 16:28:49 -0800820 final boolean preserveWindows = data.readInt() == 1;
821 final boolean animate = data.readInt() == 1;
822 resizeStack(stackId, r, allowResizeInDockedMode, preserveWindows, animate);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800823 reply.writeNoException();
824 return true;
825 }
Robert Carr0d00c2e2016-02-29 17:45:02 -0800826 case RESIZE_PINNED_STACK_TRANSACTION: {
827 data.enforceInterface(IActivityManager.descriptor);
828 final boolean hasBounds = data.readInt() != 0;
829 Rect bounds = null;
830 if (hasBounds) {
831 bounds = Rect.CREATOR.createFromParcel(data);
832 }
833 final boolean hasTempPinnedTaskBounds = data.readInt() != 0;
834 Rect tempPinnedTaskBounds = null;
835 if (hasTempPinnedTaskBounds) {
836 tempPinnedTaskBounds = Rect.CREATOR.createFromParcel(data);
837 }
838 resizePinnedStack(bounds, tempPinnedTaskBounds);
839 return true;
840 }
Jorim Jaggid47e7e12016-03-01 09:57:38 +0100841 case SWAP_DOCKED_AND_FULLSCREEN_STACK: {
842 data.enforceInterface(IActivityManager.descriptor);
843 swapDockedAndFullscreenStack();
844 reply.writeNoException();
845 return true;
846 }
Jorim Jaggidc249c42015-12-15 14:57:31 -0800847 case RESIZE_DOCKED_STACK_TRANSACTION: {
848 data.enforceInterface(IActivityManager.descriptor);
849 final boolean hasBounds = data.readInt() != 0;
850 Rect bounds = null;
851 if (hasBounds) {
852 bounds = Rect.CREATOR.createFromParcel(data);
853 }
854 final boolean hasTempDockedTaskBounds = data.readInt() != 0;
855 Rect tempDockedTaskBounds = null;
856 if (hasTempDockedTaskBounds) {
857 tempDockedTaskBounds = Rect.CREATOR.createFromParcel(data);
858 }
859 final boolean hasTempDockedTaskInsetBounds = data.readInt() != 0;
860 Rect tempDockedTaskInsetBounds = null;
861 if (hasTempDockedTaskInsetBounds) {
862 tempDockedTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
863 }
864 final boolean hasTempOtherTaskBounds = data.readInt() != 0;
865 Rect tempOtherTaskBounds = null;
866 if (hasTempOtherTaskBounds) {
867 tempOtherTaskBounds = Rect.CREATOR.createFromParcel(data);
868 }
869 final boolean hasTempOtherTaskInsetBounds = data.readInt() != 0;
870 Rect tempOtherTaskInsetBounds = null;
871 if (hasTempOtherTaskInsetBounds) {
872 tempOtherTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
873 }
874 resizeDockedStack(bounds, tempDockedTaskBounds, tempDockedTaskInsetBounds,
875 tempOtherTaskBounds, tempOtherTaskInsetBounds);
876 reply.writeNoException();
877 return true;
878 }
879
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700880 case POSITION_TASK_IN_STACK_TRANSACTION: {
881 data.enforceInterface(IActivityManager.descriptor);
882 int taskId = data.readInt();
883 int stackId = data.readInt();
884 int position = data.readInt();
885 positionTaskInStack(taskId, stackId, position);
886 reply.writeNoException();
887 return true;
888 }
889
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800890 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700891 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800892 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700893 reply.writeNoException();
894 reply.writeTypedList(list);
895 return true;
896 }
897
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800898 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700899 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800900 int stackId = data.readInt();
901 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700902 reply.writeNoException();
903 if (info != null) {
904 reply.writeInt(1);
905 info.writeToParcel(reply, 0);
906 } else {
907 reply.writeInt(0);
908 }
909 return true;
910 }
911
Winson Chung303e1ff2014-03-07 15:06:19 -0800912 case IS_IN_HOME_STACK_TRANSACTION: {
913 data.enforceInterface(IActivityManager.descriptor);
914 int taskId = data.readInt();
915 boolean isInHomeStack = isInHomeStack(taskId);
916 reply.writeNoException();
917 reply.writeInt(isInHomeStack ? 1 : 0);
918 return true;
919 }
920
Craig Mautnercf910b02013-04-23 11:23:27 -0700921 case SET_FOCUSED_STACK_TRANSACTION: {
922 data.enforceInterface(IActivityManager.descriptor);
923 int stackId = data.readInt();
924 setFocusedStack(stackId);
925 reply.writeNoException();
926 return true;
927 }
928
Winson Chungd16c5652015-01-26 16:11:07 -0800929 case GET_FOCUSED_STACK_ID_TRANSACTION: {
930 data.enforceInterface(IActivityManager.descriptor);
931 int focusedStackId = getFocusedStackId();
932 reply.writeNoException();
933 reply.writeInt(focusedStackId);
934 return true;
935 }
936
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700937 case SET_FOCUSED_TASK_TRANSACTION: {
938 data.enforceInterface(IActivityManager.descriptor);
939 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700940 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700941 reply.writeNoException();
942 return true;
943 }
944
Winson Chung740c3ac2014-11-12 16:14:38 -0800945 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
946 data.enforceInterface(IActivityManager.descriptor);
947 IBinder token = data.readStrongBinder();
948 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
949 reply.writeNoException();
950 return true;
951 }
952
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800953 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
954 data.enforceInterface(IActivityManager.descriptor);
955 IBinder token = data.readStrongBinder();
956 boolean onlyRoot = data.readInt() != 0;
957 int res = token != null
958 ? getTaskForActivity(token, onlyRoot) : -1;
959 reply.writeNoException();
960 reply.writeInt(res);
961 return true;
962 }
963
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800964 case GET_CONTENT_PROVIDER_TRANSACTION: {
965 data.enforceInterface(IActivityManager.descriptor);
966 IBinder b = data.readStrongBinder();
967 IApplicationThread app = ApplicationThreadNative.asInterface(b);
968 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700969 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700970 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700971 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800972 reply.writeNoException();
973 if (cph != null) {
974 reply.writeInt(1);
975 cph.writeToParcel(reply, 0);
976 } else {
977 reply.writeInt(0);
978 }
979 return true;
980 }
981
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800982 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
983 data.enforceInterface(IActivityManager.descriptor);
984 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700985 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800986 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700987 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800988 reply.writeNoException();
989 if (cph != null) {
990 reply.writeInt(1);
991 cph.writeToParcel(reply, 0);
992 } else {
993 reply.writeInt(0);
994 }
995 return true;
996 }
997
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800998 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
999 data.enforceInterface(IActivityManager.descriptor);
1000 IBinder b = data.readStrongBinder();
1001 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1002 ArrayList<ContentProviderHolder> providers =
1003 data.createTypedArrayList(ContentProviderHolder.CREATOR);
1004 publishContentProviders(app, providers);
1005 reply.writeNoException();
1006 return true;
1007 }
1008
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001009 case REF_CONTENT_PROVIDER_TRANSACTION: {
1010 data.enforceInterface(IActivityManager.descriptor);
1011 IBinder b = data.readStrongBinder();
1012 int stable = data.readInt();
1013 int unstable = data.readInt();
1014 boolean res = refContentProvider(b, stable, unstable);
1015 reply.writeNoException();
1016 reply.writeInt(res ? 1 : 0);
1017 return true;
1018 }
1019
1020 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
1021 data.enforceInterface(IActivityManager.descriptor);
1022 IBinder b = data.readStrongBinder();
1023 unstableProviderDied(b);
1024 reply.writeNoException();
1025 return true;
1026 }
1027
Jeff Sharkey7aa76012013-09-30 14:26:27 -07001028 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
1029 data.enforceInterface(IActivityManager.descriptor);
1030 IBinder b = data.readStrongBinder();
1031 appNotRespondingViaProvider(b);
1032 reply.writeNoException();
1033 return true;
1034 }
1035
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001036 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
1037 data.enforceInterface(IActivityManager.descriptor);
1038 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001039 boolean stable = data.readInt() != 0;
1040 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001041 reply.writeNoException();
1042 return true;
1043 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08001044
1045 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
1046 data.enforceInterface(IActivityManager.descriptor);
1047 String name = data.readString();
1048 IBinder token = data.readStrongBinder();
1049 removeContentProviderExternal(name, token);
1050 reply.writeNoException();
1051 return true;
1052 }
1053
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07001054 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
1055 data.enforceInterface(IActivityManager.descriptor);
1056 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
1057 PendingIntent pi = getRunningServiceControlPanel(comp);
1058 reply.writeNoException();
1059 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
1060 return true;
1061 }
1062
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001063 case START_SERVICE_TRANSACTION: {
1064 data.enforceInterface(IActivityManager.descriptor);
1065 IBinder b = data.readStrongBinder();
1066 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1067 Intent service = Intent.CREATOR.createFromParcel(data);
1068 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001069 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001070 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001071 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001072 reply.writeNoException();
1073 ComponentName.writeToParcel(cn, reply);
1074 return true;
1075 }
1076
1077 case STOP_SERVICE_TRANSACTION: {
1078 data.enforceInterface(IActivityManager.descriptor);
1079 IBinder b = data.readStrongBinder();
1080 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1081 Intent service = Intent.CREATOR.createFromParcel(data);
1082 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001083 int userId = data.readInt();
1084 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001085 reply.writeNoException();
1086 reply.writeInt(res);
1087 return true;
1088 }
1089
1090 case STOP_SERVICE_TOKEN_TRANSACTION: {
1091 data.enforceInterface(IActivityManager.descriptor);
1092 ComponentName className = ComponentName.readFromParcel(data);
1093 IBinder token = data.readStrongBinder();
1094 int startId = data.readInt();
1095 boolean res = stopServiceToken(className, token, startId);
1096 reply.writeNoException();
1097 reply.writeInt(res ? 1 : 0);
1098 return true;
1099 }
1100
1101 case SET_SERVICE_FOREGROUND_TRANSACTION: {
1102 data.enforceInterface(IActivityManager.descriptor);
1103 ComponentName className = ComponentName.readFromParcel(data);
1104 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001105 int id = data.readInt();
1106 Notification notification = null;
1107 if (data.readInt() != 0) {
1108 notification = Notification.CREATOR.createFromParcel(data);
1109 }
1110 boolean removeNotification = data.readInt() != 0;
1111 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001112 reply.writeNoException();
1113 return true;
1114 }
1115
1116 case BIND_SERVICE_TRANSACTION: {
1117 data.enforceInterface(IActivityManager.descriptor);
1118 IBinder b = data.readStrongBinder();
1119 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1120 IBinder token = data.readStrongBinder();
1121 Intent service = Intent.CREATOR.createFromParcel(data);
1122 String resolvedType = data.readString();
1123 b = data.readStrongBinder();
1124 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001125 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001126 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001127 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001128 int res = bindService(app, token, service, resolvedType, conn, fl,
1129 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001130 reply.writeNoException();
1131 reply.writeInt(res);
1132 return true;
1133 }
1134
1135 case UNBIND_SERVICE_TRANSACTION: {
1136 data.enforceInterface(IActivityManager.descriptor);
1137 IBinder b = data.readStrongBinder();
1138 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1139 boolean res = unbindService(conn);
1140 reply.writeNoException();
1141 reply.writeInt(res ? 1 : 0);
1142 return true;
1143 }
1144
1145 case PUBLISH_SERVICE_TRANSACTION: {
1146 data.enforceInterface(IActivityManager.descriptor);
1147 IBinder token = data.readStrongBinder();
1148 Intent intent = Intent.CREATOR.createFromParcel(data);
1149 IBinder service = data.readStrongBinder();
1150 publishService(token, intent, service);
1151 reply.writeNoException();
1152 return true;
1153 }
1154
1155 case UNBIND_FINISHED_TRANSACTION: {
1156 data.enforceInterface(IActivityManager.descriptor);
1157 IBinder token = data.readStrongBinder();
1158 Intent intent = Intent.CREATOR.createFromParcel(data);
1159 boolean doRebind = data.readInt() != 0;
1160 unbindFinished(token, intent, doRebind);
1161 reply.writeNoException();
1162 return true;
1163 }
1164
1165 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1166 data.enforceInterface(IActivityManager.descriptor);
1167 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001168 int type = data.readInt();
1169 int startId = data.readInt();
1170 int res = data.readInt();
1171 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001172 reply.writeNoException();
1173 return true;
1174 }
1175
1176 case START_INSTRUMENTATION_TRANSACTION: {
1177 data.enforceInterface(IActivityManager.descriptor);
1178 ComponentName className = ComponentName.readFromParcel(data);
1179 String profileFile = data.readString();
1180 int fl = data.readInt();
1181 Bundle arguments = data.readBundle();
1182 IBinder b = data.readStrongBinder();
1183 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001184 b = data.readStrongBinder();
1185 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001186 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001187 String abiOverride = data.readString();
1188 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1189 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001190 reply.writeNoException();
1191 reply.writeInt(res ? 1 : 0);
1192 return true;
1193 }
1194
1195
1196 case FINISH_INSTRUMENTATION_TRANSACTION: {
1197 data.enforceInterface(IActivityManager.descriptor);
1198 IBinder b = data.readStrongBinder();
1199 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1200 int resultCode = data.readInt();
1201 Bundle results = data.readBundle();
1202 finishInstrumentation(app, resultCode, results);
1203 reply.writeNoException();
1204 return true;
1205 }
1206
1207 case GET_CONFIGURATION_TRANSACTION: {
1208 data.enforceInterface(IActivityManager.descriptor);
1209 Configuration config = getConfiguration();
1210 reply.writeNoException();
1211 config.writeToParcel(reply, 0);
1212 return true;
1213 }
1214
1215 case UPDATE_CONFIGURATION_TRANSACTION: {
1216 data.enforceInterface(IActivityManager.descriptor);
1217 Configuration config = Configuration.CREATOR.createFromParcel(data);
1218 updateConfiguration(config);
1219 reply.writeNoException();
1220 return true;
1221 }
1222
1223 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1224 data.enforceInterface(IActivityManager.descriptor);
1225 IBinder token = data.readStrongBinder();
1226 int requestedOrientation = data.readInt();
1227 setRequestedOrientation(token, requestedOrientation);
1228 reply.writeNoException();
1229 return true;
1230 }
1231
1232 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1233 data.enforceInterface(IActivityManager.descriptor);
1234 IBinder token = data.readStrongBinder();
1235 int req = getRequestedOrientation(token);
1236 reply.writeNoException();
1237 reply.writeInt(req);
1238 return true;
1239 }
1240
1241 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1242 data.enforceInterface(IActivityManager.descriptor);
1243 IBinder token = data.readStrongBinder();
1244 ComponentName cn = getActivityClassForToken(token);
1245 reply.writeNoException();
1246 ComponentName.writeToParcel(cn, reply);
1247 return true;
1248 }
1249
1250 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1251 data.enforceInterface(IActivityManager.descriptor);
1252 IBinder token = data.readStrongBinder();
1253 reply.writeNoException();
1254 reply.writeString(getPackageForToken(token));
1255 return true;
1256 }
1257
1258 case GET_INTENT_SENDER_TRANSACTION: {
1259 data.enforceInterface(IActivityManager.descriptor);
1260 int type = data.readInt();
1261 String packageName = data.readString();
1262 IBinder token = data.readStrongBinder();
1263 String resultWho = data.readString();
1264 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001265 Intent[] requestIntents;
1266 String[] requestResolvedTypes;
1267 if (data.readInt() != 0) {
1268 requestIntents = data.createTypedArray(Intent.CREATOR);
1269 requestResolvedTypes = data.createStringArray();
1270 } else {
1271 requestIntents = null;
1272 requestResolvedTypes = null;
1273 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001274 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001275 Bundle options = data.readInt() != 0
1276 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001277 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001278 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001279 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001280 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001281 reply.writeNoException();
1282 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1283 return true;
1284 }
1285
1286 case CANCEL_INTENT_SENDER_TRANSACTION: {
1287 data.enforceInterface(IActivityManager.descriptor);
1288 IIntentSender r = IIntentSender.Stub.asInterface(
1289 data.readStrongBinder());
1290 cancelIntentSender(r);
1291 reply.writeNoException();
1292 return true;
1293 }
1294
1295 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1296 data.enforceInterface(IActivityManager.descriptor);
1297 IIntentSender r = IIntentSender.Stub.asInterface(
1298 data.readStrongBinder());
1299 String res = getPackageForIntentSender(r);
1300 reply.writeNoException();
1301 reply.writeString(res);
1302 return true;
1303 }
1304
Christopher Tatec4a07d12012-04-06 14:19:13 -07001305 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1306 data.enforceInterface(IActivityManager.descriptor);
1307 IIntentSender r = IIntentSender.Stub.asInterface(
1308 data.readStrongBinder());
1309 int res = getUidForIntentSender(r);
1310 reply.writeNoException();
1311 reply.writeInt(res);
1312 return true;
1313 }
1314
Dianne Hackborn41203752012-08-31 14:05:51 -07001315 case HANDLE_INCOMING_USER_TRANSACTION: {
1316 data.enforceInterface(IActivityManager.descriptor);
1317 int callingPid = data.readInt();
1318 int callingUid = data.readInt();
1319 int userId = data.readInt();
1320 boolean allowAll = data.readInt() != 0 ;
1321 boolean requireFull = data.readInt() != 0;
1322 String name = data.readString();
1323 String callerPackage = data.readString();
1324 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1325 requireFull, name, callerPackage);
1326 reply.writeNoException();
1327 reply.writeInt(res);
1328 return true;
1329 }
1330
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001331 case SET_PROCESS_LIMIT_TRANSACTION: {
1332 data.enforceInterface(IActivityManager.descriptor);
1333 int max = data.readInt();
1334 setProcessLimit(max);
1335 reply.writeNoException();
1336 return true;
1337 }
1338
1339 case GET_PROCESS_LIMIT_TRANSACTION: {
1340 data.enforceInterface(IActivityManager.descriptor);
1341 int limit = getProcessLimit();
1342 reply.writeNoException();
1343 reply.writeInt(limit);
1344 return true;
1345 }
1346
1347 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1348 data.enforceInterface(IActivityManager.descriptor);
1349 IBinder token = data.readStrongBinder();
1350 int pid = data.readInt();
1351 boolean isForeground = data.readInt() != 0;
1352 setProcessForeground(token, pid, isForeground);
1353 reply.writeNoException();
1354 return true;
1355 }
1356
1357 case CHECK_PERMISSION_TRANSACTION: {
1358 data.enforceInterface(IActivityManager.descriptor);
1359 String perm = data.readString();
1360 int pid = data.readInt();
1361 int uid = data.readInt();
1362 int res = checkPermission(perm, pid, uid);
1363 reply.writeNoException();
1364 reply.writeInt(res);
1365 return true;
1366 }
1367
Dianne Hackbornff170242014-11-19 10:59:01 -08001368 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1369 data.enforceInterface(IActivityManager.descriptor);
1370 String perm = data.readString();
1371 int pid = data.readInt();
1372 int uid = data.readInt();
1373 IBinder token = data.readStrongBinder();
1374 int res = checkPermissionWithToken(perm, pid, uid, token);
1375 reply.writeNoException();
1376 reply.writeInt(res);
1377 return true;
1378 }
1379
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001380 case CHECK_URI_PERMISSION_TRANSACTION: {
1381 data.enforceInterface(IActivityManager.descriptor);
1382 Uri uri = Uri.CREATOR.createFromParcel(data);
1383 int pid = data.readInt();
1384 int uid = data.readInt();
1385 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001386 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001387 IBinder callerToken = data.readStrongBinder();
1388 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001389 reply.writeNoException();
1390 reply.writeInt(res);
1391 return true;
1392 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001393
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001394 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001395 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001396 String packageName = data.readString();
1397 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1398 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001399 int userId = data.readInt();
1400 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001401 reply.writeNoException();
1402 reply.writeInt(res ? 1 : 0);
1403 return true;
1404 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001405
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001406 case GRANT_URI_PERMISSION_TRANSACTION: {
1407 data.enforceInterface(IActivityManager.descriptor);
1408 IBinder b = data.readStrongBinder();
1409 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1410 String targetPkg = data.readString();
1411 Uri uri = Uri.CREATOR.createFromParcel(data);
1412 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001413 int userId = data.readInt();
1414 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001415 reply.writeNoException();
1416 return true;
1417 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001418
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001419 case REVOKE_URI_PERMISSION_TRANSACTION: {
1420 data.enforceInterface(IActivityManager.descriptor);
1421 IBinder b = data.readStrongBinder();
1422 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1423 Uri uri = Uri.CREATOR.createFromParcel(data);
1424 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001425 int userId = data.readInt();
1426 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001427 reply.writeNoException();
1428 return true;
1429 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001430
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001431 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1432 data.enforceInterface(IActivityManager.descriptor);
1433 Uri uri = Uri.CREATOR.createFromParcel(data);
1434 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001435 int userId = data.readInt();
1436 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001437 reply.writeNoException();
1438 return true;
1439 }
1440
1441 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1442 data.enforceInterface(IActivityManager.descriptor);
1443 Uri uri = Uri.CREATOR.createFromParcel(data);
1444 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001445 int userId = data.readInt();
1446 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001447 reply.writeNoException();
1448 return true;
1449 }
1450
1451 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1452 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001453 final String packageName = data.readString();
1454 final boolean incoming = data.readInt() != 0;
1455 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1456 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001457 reply.writeNoException();
1458 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1459 return true;
1460 }
1461
Felipe Lemef3fa0f82016-01-07 12:08:19 -08001462 case GET_GRANTED_URI_PERMISSIONS_TRANSACTION: {
1463 data.enforceInterface(IActivityManager.descriptor);
1464 final String packageName = data.readString();
1465 final int userId = data.readInt();
1466 final ParceledListSlice<UriPermission> perms = getGrantedUriPermissions(packageName,
1467 userId);
1468 reply.writeNoException();
1469 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1470 return true;
1471 }
1472
1473 case CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION: {
1474 data.enforceInterface(IActivityManager.descriptor);
1475 final String packageName = data.readString();
1476 final int userId = data.readInt();
1477 clearGrantedUriPermissions(packageName, userId);
1478 reply.writeNoException();
1479 return true;
1480 }
1481
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001482 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1483 data.enforceInterface(IActivityManager.descriptor);
1484 IBinder b = data.readStrongBinder();
1485 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1486 boolean waiting = data.readInt() != 0;
1487 showWaitingForDebugger(app, waiting);
1488 reply.writeNoException();
1489 return true;
1490 }
1491
1492 case GET_MEMORY_INFO_TRANSACTION: {
1493 data.enforceInterface(IActivityManager.descriptor);
1494 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1495 getMemoryInfo(mi);
1496 reply.writeNoException();
1497 mi.writeToParcel(reply, 0);
1498 return true;
1499 }
1500
1501 case UNHANDLED_BACK_TRANSACTION: {
1502 data.enforceInterface(IActivityManager.descriptor);
1503 unhandledBack();
1504 reply.writeNoException();
1505 return true;
1506 }
1507
1508 case OPEN_CONTENT_URI_TRANSACTION: {
1509 data.enforceInterface(IActivityManager.descriptor);
1510 Uri uri = Uri.parse(data.readString());
1511 ParcelFileDescriptor pfd = openContentUri(uri);
1512 reply.writeNoException();
1513 if (pfd != null) {
1514 reply.writeInt(1);
1515 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1516 } else {
1517 reply.writeInt(0);
1518 }
1519 return true;
1520 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001521
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001522 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1523 data.enforceInterface(IActivityManager.descriptor);
1524 setLockScreenShown(data.readInt() != 0);
1525 reply.writeNoException();
1526 return true;
1527 }
1528
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001529 case SET_DEBUG_APP_TRANSACTION: {
1530 data.enforceInterface(IActivityManager.descriptor);
1531 String pn = data.readString();
1532 boolean wfd = data.readInt() != 0;
1533 boolean per = data.readInt() != 0;
1534 setDebugApp(pn, wfd, per);
1535 reply.writeNoException();
1536 return true;
1537 }
1538
1539 case SET_ALWAYS_FINISH_TRANSACTION: {
1540 data.enforceInterface(IActivityManager.descriptor);
1541 boolean enabled = data.readInt() != 0;
1542 setAlwaysFinish(enabled);
1543 reply.writeNoException();
1544 return true;
1545 }
1546
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001547 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001548 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001549 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001550 data.readStrongBinder());
Dianne Hackborn4a18c262016-02-26 17:23:48 -08001551 boolean imAMonkey = data.readInt() != 0;
1552 setActivityController(watcher, imAMonkey);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001553 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001554 return true;
1555 }
1556
Dianne Hackbornb2117d12016-02-16 18:26:35 -08001557 case SET_LENIENT_BACKGROUND_CHECK_TRANSACTION: {
1558 data.enforceInterface(IActivityManager.descriptor);
1559 boolean enabled = data.readInt() != 0;
1560 setLenientBackgroundCheck(enabled);
1561 reply.writeNoException();
1562 return true;
1563 }
1564
Dianne Hackborn970510b2016-02-24 16:56:42 -08001565 case GET_MEMORY_TRIM_LEVEL_TRANSACTION: {
1566 data.enforceInterface(IActivityManager.descriptor);
1567 int level = getMemoryTrimLevel();
1568 reply.writeNoException();
1569 reply.writeInt(level);
1570 return true;
1571 }
1572
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001573 case ENTER_SAFE_MODE_TRANSACTION: {
1574 data.enforceInterface(IActivityManager.descriptor);
1575 enterSafeMode();
1576 reply.writeNoException();
1577 return true;
1578 }
1579
1580 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1581 data.enforceInterface(IActivityManager.descriptor);
1582 IIntentSender is = IIntentSender.Stub.asInterface(
1583 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001584 int sourceUid = data.readInt();
1585 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001586 String tag = data.readString();
1587 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1588 reply.writeNoException();
1589 return true;
1590 }
1591
1592 case NOTE_ALARM_START_TRANSACTION: {
1593 data.enforceInterface(IActivityManager.descriptor);
1594 IIntentSender is = IIntentSender.Stub.asInterface(
1595 data.readStrongBinder());
1596 int sourceUid = data.readInt();
1597 String tag = data.readString();
1598 noteAlarmStart(is, sourceUid, tag);
1599 reply.writeNoException();
1600 return true;
1601 }
1602
1603 case NOTE_ALARM_FINISH_TRANSACTION: {
1604 data.enforceInterface(IActivityManager.descriptor);
1605 IIntentSender is = IIntentSender.Stub.asInterface(
1606 data.readStrongBinder());
1607 int sourceUid = data.readInt();
1608 String tag = data.readString();
1609 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001610 reply.writeNoException();
1611 return true;
1612 }
1613
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001614 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001615 data.enforceInterface(IActivityManager.descriptor);
1616 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001617 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001618 boolean secure = data.readInt() != 0;
1619 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001620 reply.writeNoException();
1621 reply.writeInt(res ? 1 : 0);
1622 return true;
1623 }
1624
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001625 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1626 data.enforceInterface(IActivityManager.descriptor);
1627 String reason = data.readString();
1628 boolean res = killProcessesBelowForeground(reason);
1629 reply.writeNoException();
1630 reply.writeInt(res ? 1 : 0);
1631 return true;
1632 }
1633
Dan Egnor60d87622009-12-16 16:32:58 -08001634 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1635 data.enforceInterface(IActivityManager.descriptor);
1636 IBinder app = data.readStrongBinder();
1637 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1638 handleApplicationCrash(app, ci);
1639 reply.writeNoException();
1640 return true;
1641 }
1642
1643 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001644 data.enforceInterface(IActivityManager.descriptor);
1645 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001646 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001647 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001648 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001649 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001650 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001651 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001652 return true;
1653 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001654
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001655 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1656 data.enforceInterface(IActivityManager.descriptor);
1657 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001658 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001659 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1660 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001661 reply.writeNoException();
1662 return true;
1663 }
1664
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001665 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1666 data.enforceInterface(IActivityManager.descriptor);
1667 int sig = data.readInt();
1668 signalPersistentProcesses(sig);
1669 reply.writeNoException();
1670 return true;
1671 }
1672
Dianne Hackborn03abb812010-01-04 18:43:19 -08001673 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1674 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001675 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001676 int userId = data.readInt();
1677 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001678 reply.writeNoException();
1679 return true;
1680 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001681
1682 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1683 data.enforceInterface(IActivityManager.descriptor);
1684 killAllBackgroundProcesses();
1685 reply.writeNoException();
1686 return true;
1687 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001688
Gustav Sennton6258dcd2015-10-30 19:25:37 +00001689 case KILL_PACKAGE_DEPENDENTS_TRANSACTION: {
1690 data.enforceInterface(IActivityManager.descriptor);
1691 String packageName = data.readString();
1692 int userId = data.readInt();
1693 killPackageDependents(packageName, userId);
1694 reply.writeNoException();
1695 return true;
1696 }
1697
Dianne Hackborn03abb812010-01-04 18:43:19 -08001698 case FORCE_STOP_PACKAGE_TRANSACTION: {
1699 data.enforceInterface(IActivityManager.descriptor);
1700 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001701 int userId = data.readInt();
1702 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001703 reply.writeNoException();
1704 return true;
1705 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001706
1707 case GET_MY_MEMORY_STATE_TRANSACTION: {
1708 data.enforceInterface(IActivityManager.descriptor);
1709 ActivityManager.RunningAppProcessInfo info =
1710 new ActivityManager.RunningAppProcessInfo();
1711 getMyMemoryState(info);
1712 reply.writeNoException();
1713 info.writeToParcel(reply, 0);
1714 return true;
1715 }
1716
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001717 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1718 data.enforceInterface(IActivityManager.descriptor);
1719 ConfigurationInfo config = getDeviceConfigurationInfo();
1720 reply.writeNoException();
1721 config.writeToParcel(reply, 0);
1722 return true;
1723 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001724
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001725 case PROFILE_CONTROL_TRANSACTION: {
1726 data.enforceInterface(IActivityManager.descriptor);
1727 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001728 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001729 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001730 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001731 ProfilerInfo profilerInfo = data.readInt() != 0
1732 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1733 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001734 reply.writeNoException();
1735 reply.writeInt(res ? 1 : 0);
1736 return true;
1737 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001738
Dianne Hackborn55280a92009-05-07 15:53:46 -07001739 case SHUTDOWN_TRANSACTION: {
1740 data.enforceInterface(IActivityManager.descriptor);
1741 boolean res = shutdown(data.readInt());
1742 reply.writeNoException();
1743 reply.writeInt(res ? 1 : 0);
1744 return true;
1745 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001746
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001747 case STOP_APP_SWITCHES_TRANSACTION: {
1748 data.enforceInterface(IActivityManager.descriptor);
1749 stopAppSwitches();
1750 reply.writeNoException();
1751 return true;
1752 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001753
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001754 case RESUME_APP_SWITCHES_TRANSACTION: {
1755 data.enforceInterface(IActivityManager.descriptor);
1756 resumeAppSwitches();
1757 reply.writeNoException();
1758 return true;
1759 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001760
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001761 case PEEK_SERVICE_TRANSACTION: {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 Intent service = Intent.CREATOR.createFromParcel(data);
1764 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001765 String callingPackage = data.readString();
1766 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001767 reply.writeNoException();
1768 reply.writeStrongBinder(binder);
1769 return true;
1770 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001771
Christopher Tate181fafa2009-05-14 11:12:14 -07001772 case START_BACKUP_AGENT_TRANSACTION: {
1773 data.enforceInterface(IActivityManager.descriptor);
1774 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1775 int backupRestoreMode = data.readInt();
1776 boolean success = bindBackupAgent(info, backupRestoreMode);
1777 reply.writeNoException();
1778 reply.writeInt(success ? 1 : 0);
1779 return true;
1780 }
1781
1782 case BACKUP_AGENT_CREATED_TRANSACTION: {
1783 data.enforceInterface(IActivityManager.descriptor);
1784 String packageName = data.readString();
1785 IBinder agent = data.readStrongBinder();
1786 backupAgentCreated(packageName, agent);
1787 reply.writeNoException();
1788 return true;
1789 }
1790
1791 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1792 data.enforceInterface(IActivityManager.descriptor);
1793 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1794 unbindBackupAgent(info);
1795 reply.writeNoException();
1796 return true;
1797 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001798
1799 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1800 data.enforceInterface(IActivityManager.descriptor);
1801 String packageName = data.readString();
1802 addPackageDependency(packageName);
1803 reply.writeNoException();
1804 return true;
1805 }
1806
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001807 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001808 data.enforceInterface(IActivityManager.descriptor);
1809 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001810 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001811 String reason = data.readString();
1812 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001813 reply.writeNoException();
1814 return true;
1815 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001816
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001817 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1818 data.enforceInterface(IActivityManager.descriptor);
1819 String reason = data.readString();
1820 closeSystemDialogs(reason);
1821 reply.writeNoException();
1822 return true;
1823 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001824
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001825 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1826 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001827 int[] pids = data.createIntArray();
1828 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001829 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001830 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001831 return true;
1832 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001833
1834 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1835 data.enforceInterface(IActivityManager.descriptor);
1836 String processName = data.readString();
1837 int uid = data.readInt();
1838 killApplicationProcess(processName, uid);
1839 reply.writeNoException();
1840 return true;
1841 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001842
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001843 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1844 data.enforceInterface(IActivityManager.descriptor);
1845 IBinder token = data.readStrongBinder();
1846 String packageName = data.readString();
1847 int enterAnim = data.readInt();
1848 int exitAnim = data.readInt();
1849 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001850 reply.writeNoException();
1851 return true;
1852 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001853
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001854 case IS_USER_A_MONKEY_TRANSACTION: {
1855 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001856 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001857 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001858 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001859 return true;
1860 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001861
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001862 case SET_USER_IS_MONKEY_TRANSACTION: {
1863 data.enforceInterface(IActivityManager.descriptor);
1864 final boolean monkey = (data.readInt() == 1);
1865 setUserIsMonkey(monkey);
1866 reply.writeNoException();
1867 return true;
1868 }
1869
Dianne Hackborn860755f2010-06-03 18:47:52 -07001870 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1871 data.enforceInterface(IActivityManager.descriptor);
1872 finishHeavyWeightApp();
1873 reply.writeNoException();
1874 return true;
1875 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001876
1877 case IS_IMMERSIVE_TRANSACTION: {
1878 data.enforceInterface(IActivityManager.descriptor);
1879 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001880 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001881 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001882 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001883 return true;
1884 }
1885
Craig Mautnerd61dc202014-07-07 11:09:11 -07001886 case IS_TOP_OF_TASK_TRANSACTION: {
1887 data.enforceInterface(IActivityManager.descriptor);
1888 IBinder token = data.readStrongBinder();
1889 final boolean isTopOfTask = isTopOfTask(token);
1890 reply.writeNoException();
1891 reply.writeInt(isTopOfTask ? 1 : 0);
1892 return true;
1893 }
1894
Craig Mautner5eda9b32013-07-02 11:58:16 -07001895 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001896 data.enforceInterface(IActivityManager.descriptor);
1897 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001898 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001899 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001900 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001901 return true;
1902 }
1903
1904 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1905 data.enforceInterface(IActivityManager.descriptor);
1906 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001907 final Bundle bundle;
1908 if (data.readInt() == 0) {
1909 bundle = null;
1910 } else {
1911 bundle = data.readBundle();
1912 }
Chong Zhang280d3322015-11-03 17:27:26 -08001913 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Craig Mautner233ceee2014-05-09 17:05:11 -07001914 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001915 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001916 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001917 return true;
1918 }
1919
Craig Mautner233ceee2014-05-09 17:05:11 -07001920 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1921 data.enforceInterface(IActivityManager.descriptor);
1922 IBinder token = data.readStrongBinder();
1923 final ActivityOptions options = getActivityOptions(token);
1924 reply.writeNoException();
1925 reply.writeBundle(options == null ? null : options.toBundle());
1926 return true;
1927 }
1928
Daniel Sandler69a48172010-06-23 16:29:36 -04001929 case SET_IMMERSIVE_TRANSACTION: {
1930 data.enforceInterface(IActivityManager.descriptor);
1931 IBinder token = data.readStrongBinder();
1932 boolean imm = data.readInt() == 1;
1933 setImmersive(token, imm);
1934 reply.writeNoException();
1935 return true;
1936 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001937
Daniel Sandler69a48172010-06-23 16:29:36 -04001938 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1939 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001940 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001941 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001942 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001943 return true;
1944 }
1945
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001946 case CRASH_APPLICATION_TRANSACTION: {
1947 data.enforceInterface(IActivityManager.descriptor);
1948 int uid = data.readInt();
1949 int initialPid = data.readInt();
1950 String packageName = data.readString();
1951 String message = data.readString();
1952 crashApplication(uid, initialPid, packageName, message);
1953 reply.writeNoException();
1954 return true;
1955 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001956
1957 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1958 data.enforceInterface(IActivityManager.descriptor);
1959 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001960 int userId = data.readInt();
1961 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001962 reply.writeNoException();
1963 reply.writeString(type);
1964 return true;
1965 }
1966
Dianne Hackborn7e269642010-08-25 19:50:20 -07001967 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1968 data.enforceInterface(IActivityManager.descriptor);
1969 String name = data.readString();
1970 IBinder perm = newUriPermissionOwner(name);
1971 reply.writeNoException();
1972 reply.writeStrongBinder(perm);
1973 return true;
1974 }
1975
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08001976 case GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION: {
1977 data.enforceInterface(IActivityManager.descriptor);
1978 IBinder activityToken = data.readStrongBinder();
1979 IBinder perm = getUriPermissionOwnerForActivity(activityToken);
1980 reply.writeNoException();
1981 reply.writeStrongBinder(perm);
1982 return true;
1983 }
1984
Dianne Hackborn7e269642010-08-25 19:50:20 -07001985 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1986 data.enforceInterface(IActivityManager.descriptor);
1987 IBinder owner = data.readStrongBinder();
1988 int fromUid = data.readInt();
1989 String targetPkg = data.readString();
1990 Uri uri = Uri.CREATOR.createFromParcel(data);
1991 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001992 int sourceUserId = data.readInt();
1993 int targetUserId = data.readInt();
1994 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1995 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001996 reply.writeNoException();
1997 return true;
1998 }
1999
2000 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
2001 data.enforceInterface(IActivityManager.descriptor);
2002 IBinder owner = data.readStrongBinder();
2003 Uri uri = null;
2004 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01002005 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07002006 }
2007 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01002008 int userId = data.readInt();
2009 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07002010 reply.writeNoException();
2011 return true;
2012 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07002013
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07002014 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
2015 data.enforceInterface(IActivityManager.descriptor);
2016 int callingUid = data.readInt();
2017 String targetPkg = data.readString();
2018 Uri uri = Uri.CREATOR.createFromParcel(data);
2019 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01002020 int userId = data.readInt();
2021 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07002022 reply.writeNoException();
2023 reply.writeInt(res);
2024 return true;
2025 }
2026
Andy McFadden824c5102010-07-09 16:26:57 -07002027 case DUMP_HEAP_TRANSACTION: {
2028 data.enforceInterface(IActivityManager.descriptor);
2029 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07002030 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07002031 boolean managed = data.readInt() != 0;
2032 String path = data.readString();
2033 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07002034 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07002035 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07002036 reply.writeNoException();
2037 reply.writeInt(res ? 1 : 0);
2038 return true;
2039 }
2040
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002041 case START_ACTIVITIES_TRANSACTION:
2042 {
2043 data.enforceInterface(IActivityManager.descriptor);
2044 IBinder b = data.readStrongBinder();
2045 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002046 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002047 Intent[] intents = data.createTypedArray(Intent.CREATOR);
2048 String[] resolvedTypes = data.createStringArray();
2049 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07002050 Bundle options = data.readInt() != 0
2051 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07002052 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002053 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07002054 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002055 reply.writeNoException();
2056 reply.writeInt(result);
2057 return true;
2058 }
2059
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07002060 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
2061 {
2062 data.enforceInterface(IActivityManager.descriptor);
2063 int mode = getFrontActivityScreenCompatMode();
2064 reply.writeNoException();
2065 reply.writeInt(mode);
2066 return true;
2067 }
2068
2069 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
2070 {
2071 data.enforceInterface(IActivityManager.descriptor);
2072 int mode = data.readInt();
2073 setFrontActivityScreenCompatMode(mode);
2074 reply.writeNoException();
2075 reply.writeInt(mode);
2076 return true;
2077 }
2078
2079 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
2080 {
2081 data.enforceInterface(IActivityManager.descriptor);
2082 String pkg = data.readString();
2083 int mode = getPackageScreenCompatMode(pkg);
2084 reply.writeNoException();
2085 reply.writeInt(mode);
2086 return true;
2087 }
2088
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002089 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
2090 {
2091 data.enforceInterface(IActivityManager.descriptor);
2092 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07002093 int mode = data.readInt();
2094 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002095 reply.writeNoException();
2096 return true;
2097 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002098
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002099 case SWITCH_USER_TRANSACTION: {
2100 data.enforceInterface(IActivityManager.descriptor);
2101 int userid = data.readInt();
2102 boolean result = switchUser(userid);
2103 reply.writeNoException();
2104 reply.writeInt(result ? 1 : 0);
2105 return true;
2106 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07002107
Kenny Guy08488bf2014-02-21 17:40:37 +00002108 case START_USER_IN_BACKGROUND_TRANSACTION: {
2109 data.enforceInterface(IActivityManager.descriptor);
2110 int userid = data.readInt();
2111 boolean result = startUserInBackground(userid);
2112 reply.writeNoException();
2113 reply.writeInt(result ? 1 : 0);
2114 return true;
2115 }
2116
Jeff Sharkeyba512352015-11-12 20:17:45 -08002117 case UNLOCK_USER_TRANSACTION: {
2118 data.enforceInterface(IActivityManager.descriptor);
2119 int userId = data.readInt();
2120 byte[] token = data.createByteArray();
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00002121 byte[] secret = data.createByteArray();
2122 boolean result = unlockUser(userId, token, secret);
Jeff Sharkeyba512352015-11-12 20:17:45 -08002123 reply.writeNoException();
2124 reply.writeInt(result ? 1 : 0);
2125 return true;
2126 }
2127
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002128 case STOP_USER_TRANSACTION: {
2129 data.enforceInterface(IActivityManager.descriptor);
2130 int userid = data.readInt();
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002131 boolean force = data.readInt() != 0;
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002132 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
2133 data.readStrongBinder());
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002134 int result = stopUser(userid, force, callback);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002135 reply.writeNoException();
2136 reply.writeInt(result);
2137 return true;
2138 }
2139
Amith Yamasani52f1d752012-03-28 18:19:29 -07002140 case GET_CURRENT_USER_TRANSACTION: {
2141 data.enforceInterface(IActivityManager.descriptor);
2142 UserInfo userInfo = getCurrentUser();
2143 reply.writeNoException();
2144 userInfo.writeToParcel(reply, 0);
2145 return true;
2146 }
2147
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002148 case IS_USER_RUNNING_TRANSACTION: {
2149 data.enforceInterface(IActivityManager.descriptor);
2150 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08002151 int _flags = data.readInt();
2152 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002153 reply.writeNoException();
2154 reply.writeInt(result ? 1 : 0);
2155 return true;
2156 }
2157
Dianne Hackbornc72fc672012-09-20 13:12:03 -07002158 case GET_RUNNING_USER_IDS_TRANSACTION: {
2159 data.enforceInterface(IActivityManager.descriptor);
2160 int[] result = getRunningUserIds();
2161 reply.writeNoException();
2162 reply.writeIntArray(result);
2163 return true;
2164 }
2165
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002166 case REMOVE_TASK_TRANSACTION:
2167 {
2168 data.enforceInterface(IActivityManager.descriptor);
2169 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002170 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002171 reply.writeNoException();
2172 reply.writeInt(result ? 1 : 0);
2173 return true;
2174 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002175
Jeff Sharkeya4620792011-05-20 15:29:23 -07002176 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2177 data.enforceInterface(IActivityManager.descriptor);
2178 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2179 data.readStrongBinder());
2180 registerProcessObserver(observer);
2181 return true;
2182 }
2183
2184 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2185 data.enforceInterface(IActivityManager.descriptor);
2186 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2187 data.readStrongBinder());
2188 unregisterProcessObserver(observer);
2189 return true;
2190 }
2191
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002192 case REGISTER_UID_OBSERVER_TRANSACTION: {
2193 data.enforceInterface(IActivityManager.descriptor);
2194 IUidObserver observer = IUidObserver.Stub.asInterface(
2195 data.readStrongBinder());
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002196 int which = data.readInt();
2197 registerUidObserver(observer, which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002198 return true;
2199 }
2200
2201 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2202 data.enforceInterface(IActivityManager.descriptor);
2203 IUidObserver observer = IUidObserver.Stub.asInterface(
2204 data.readStrongBinder());
2205 unregisterUidObserver(observer);
2206 return true;
2207 }
2208
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002209 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2210 {
2211 data.enforceInterface(IActivityManager.descriptor);
2212 String pkg = data.readString();
2213 boolean ask = getPackageAskScreenCompat(pkg);
2214 reply.writeNoException();
2215 reply.writeInt(ask ? 1 : 0);
2216 return true;
2217 }
2218
2219 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2220 {
2221 data.enforceInterface(IActivityManager.descriptor);
2222 String pkg = data.readString();
2223 boolean ask = data.readInt() != 0;
2224 setPackageAskScreenCompat(pkg, ask);
2225 reply.writeNoException();
2226 return true;
2227 }
2228
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002229 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2230 data.enforceInterface(IActivityManager.descriptor);
2231 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002232 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002233 boolean res = isIntentSenderTargetedToPackage(r);
2234 reply.writeNoException();
2235 reply.writeInt(res ? 1 : 0);
2236 return true;
2237 }
2238
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002239 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2240 data.enforceInterface(IActivityManager.descriptor);
2241 IIntentSender r = IIntentSender.Stub.asInterface(
2242 data.readStrongBinder());
2243 boolean res = isIntentSenderAnActivity(r);
2244 reply.writeNoException();
2245 reply.writeInt(res ? 1 : 0);
2246 return true;
2247 }
2248
Dianne Hackborn81038902012-11-26 17:04:09 -08002249 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2250 data.enforceInterface(IActivityManager.descriptor);
2251 IIntentSender r = IIntentSender.Stub.asInterface(
2252 data.readStrongBinder());
2253 Intent intent = getIntentForIntentSender(r);
2254 reply.writeNoException();
2255 if (intent != null) {
2256 reply.writeInt(1);
2257 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2258 } else {
2259 reply.writeInt(0);
2260 }
2261 return true;
2262 }
2263
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002264 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2265 data.enforceInterface(IActivityManager.descriptor);
2266 IIntentSender r = IIntentSender.Stub.asInterface(
2267 data.readStrongBinder());
2268 String prefix = data.readString();
2269 String tag = getTagForIntentSender(r, prefix);
2270 reply.writeNoException();
2271 reply.writeString(tag);
2272 return true;
2273 }
2274
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002275 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2276 data.enforceInterface(IActivityManager.descriptor);
2277 Configuration config = Configuration.CREATOR.createFromParcel(data);
2278 updatePersistentConfiguration(config);
2279 reply.writeNoException();
2280 return true;
2281 }
2282
Dianne Hackbornb437e092011-08-05 17:50:29 -07002283 case GET_PROCESS_PSS_TRANSACTION: {
2284 data.enforceInterface(IActivityManager.descriptor);
2285 int[] pids = data.createIntArray();
2286 long[] pss = getProcessPss(pids);
2287 reply.writeNoException();
2288 reply.writeLongArray(pss);
2289 return true;
2290 }
2291
Dianne Hackborn661cd522011-08-22 00:26:20 -07002292 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2293 data.enforceInterface(IActivityManager.descriptor);
2294 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2295 boolean always = data.readInt() != 0;
2296 showBootMessage(msg, always);
2297 reply.writeNoException();
2298 return true;
2299 }
2300
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002301 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002302 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002303 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002304 reply.writeNoException();
2305 return true;
2306 }
2307
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002308 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2309 data.enforceInterface(IActivityManager.descriptor);
2310 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2311 reply.writeNoException();
2312 return true;
2313 }
2314
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002315 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002316 data.enforceInterface(IActivityManager.descriptor);
2317 IBinder token = data.readStrongBinder();
2318 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002319 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002320 reply.writeNoException();
2321 reply.writeInt(res ? 1 : 0);
2322 return true;
2323 }
2324
2325 case NAVIGATE_UP_TO_TRANSACTION: {
2326 data.enforceInterface(IActivityManager.descriptor);
2327 IBinder token = data.readStrongBinder();
2328 Intent target = Intent.CREATOR.createFromParcel(data);
2329 int resultCode = data.readInt();
2330 Intent resultData = null;
2331 if (data.readInt() != 0) {
2332 resultData = Intent.CREATOR.createFromParcel(data);
2333 }
2334 boolean res = navigateUpTo(token, target, resultCode, resultData);
2335 reply.writeNoException();
2336 reply.writeInt(res ? 1 : 0);
2337 return true;
2338 }
2339
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002340 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2341 data.enforceInterface(IActivityManager.descriptor);
2342 IBinder token = data.readStrongBinder();
2343 int res = getLaunchedFromUid(token);
2344 reply.writeNoException();
2345 reply.writeInt(res);
2346 return true;
2347 }
2348
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002349 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2350 data.enforceInterface(IActivityManager.descriptor);
2351 IBinder token = data.readStrongBinder();
2352 String res = getLaunchedFromPackage(token);
2353 reply.writeNoException();
2354 reply.writeString(res);
2355 return true;
2356 }
2357
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002358 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2359 data.enforceInterface(IActivityManager.descriptor);
2360 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2361 data.readStrongBinder());
2362 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002363 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002364 return true;
2365 }
2366
2367 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2368 data.enforceInterface(IActivityManager.descriptor);
2369 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2370 data.readStrongBinder());
2371 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002372 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002373 return true;
2374 }
2375
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002376 case REQUEST_BUG_REPORT_TRANSACTION: {
2377 data.enforceInterface(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00002378 int bugreportType = data.readInt();
2379 requestBugReport(bugreportType);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002380 reply.writeNoException();
2381 return true;
2382 }
2383
2384 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2385 data.enforceInterface(IActivityManager.descriptor);
2386 int pid = data.readInt();
2387 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002388 String reason = data.readString();
2389 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002390 reply.writeNoException();
2391 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002392 return true;
2393 }
2394
Adam Skorydfc7fd72013-08-05 19:23:41 -07002395 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002396 data.enforceInterface(IActivityManager.descriptor);
2397 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002398 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002399 reply.writeNoException();
2400 reply.writeBundle(res);
2401 return true;
2402 }
2403
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002404 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2405 data.enforceInterface(IActivityManager.descriptor);
2406 int requestType = data.readInt();
2407 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002408 IBinder activityToken = data.readStrongBinder();
2409 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002410 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002411 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002412 return true;
2413 }
2414
Adam Skorydfc7fd72013-08-05 19:23:41 -07002415 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002416 data.enforceInterface(IActivityManager.descriptor);
2417 IBinder token = data.readStrongBinder();
2418 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002419 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2420 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002421 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2422 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002423 reply.writeNoException();
2424 return true;
2425 }
2426
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002427 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2428 data.enforceInterface(IActivityManager.descriptor);
2429 Intent intent = Intent.CREATOR.createFromParcel(data);
2430 int requestType = data.readInt();
2431 String hint = data.readString();
2432 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002433 Bundle args = data.readBundle();
2434 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002435 reply.writeNoException();
2436 reply.writeInt(res ? 1 : 0);
2437 return true;
2438 }
2439
Benjamin Franzc200f442015-06-25 18:20:04 +01002440 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2441 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002442 boolean res = isAssistDataAllowedOnCurrentActivity();
2443 reply.writeNoException();
2444 reply.writeInt(res ? 1 : 0);
2445 return true;
2446 }
2447
2448 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2449 data.enforceInterface(IActivityManager.descriptor);
2450 IBinder token = data.readStrongBinder();
2451 Bundle args = data.readBundle();
2452 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002453 reply.writeNoException();
2454 reply.writeInt(res ? 1 : 0);
2455 return true;
2456 }
2457
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002458 case KILL_UID_TRANSACTION: {
2459 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002460 int appId = data.readInt();
2461 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002462 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002463 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002464 reply.writeNoException();
2465 return true;
2466 }
2467
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002468 case HANG_TRANSACTION: {
2469 data.enforceInterface(IActivityManager.descriptor);
2470 IBinder who = data.readStrongBinder();
2471 boolean allowRestart = data.readInt() != 0;
2472 hang(who, allowRestart);
2473 reply.writeNoException();
2474 return true;
2475 }
2476
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002477 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2478 data.enforceInterface(IActivityManager.descriptor);
2479 IBinder token = data.readStrongBinder();
2480 reportActivityFullyDrawn(token);
2481 reply.writeNoException();
2482 return true;
2483 }
2484
Craig Mautner5eda9b32013-07-02 11:58:16 -07002485 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2486 data.enforceInterface(IActivityManager.descriptor);
2487 IBinder token = data.readStrongBinder();
2488 notifyActivityDrawn(token);
2489 reply.writeNoException();
2490 return true;
2491 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002492
2493 case RESTART_TRANSACTION: {
2494 data.enforceInterface(IActivityManager.descriptor);
2495 restart();
2496 reply.writeNoException();
2497 return true;
2498 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002499
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002500 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2501 data.enforceInterface(IActivityManager.descriptor);
2502 performIdleMaintenance();
2503 reply.writeNoException();
2504 return true;
2505 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002506
Todd Kennedyca4d8422015-01-15 15:19:22 -08002507 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002508 data.enforceInterface(IActivityManager.descriptor);
2509 IBinder parentActivityToken = data.readStrongBinder();
2510 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002511 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002512 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002513 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002514 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002515 if (activityContainer != null) {
2516 reply.writeInt(1);
2517 reply.writeStrongBinder(activityContainer.asBinder());
2518 } else {
2519 reply.writeInt(0);
2520 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002521 return true;
2522 }
2523
Craig Mautner95da1082014-02-24 17:54:35 -08002524 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2525 data.enforceInterface(IActivityManager.descriptor);
2526 IActivityContainer activityContainer =
2527 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2528 deleteActivityContainer(activityContainer);
2529 reply.writeNoException();
2530 return true;
2531 }
2532
Todd Kennedy4900bf92015-01-16 16:05:14 -08002533 case CREATE_STACK_ON_DISPLAY: {
2534 data.enforceInterface(IActivityManager.descriptor);
2535 int displayId = data.readInt();
2536 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2537 reply.writeNoException();
2538 if (activityContainer != null) {
2539 reply.writeInt(1);
2540 reply.writeStrongBinder(activityContainer.asBinder());
2541 } else {
2542 reply.writeInt(0);
2543 }
2544 return true;
2545 }
2546
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002547 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002548 data.enforceInterface(IActivityManager.descriptor);
2549 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002550 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002551 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002552 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002553 return true;
2554 }
2555
Craig Mautneraea74a52014-03-08 14:23:10 -08002556 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2557 data.enforceInterface(IActivityManager.descriptor);
2558 final int taskId = data.readInt();
2559 startLockTaskMode(taskId);
2560 reply.writeNoException();
2561 return true;
2562 }
2563
2564 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2565 data.enforceInterface(IActivityManager.descriptor);
2566 IBinder token = data.readStrongBinder();
2567 startLockTaskMode(token);
2568 reply.writeNoException();
2569 return true;
2570 }
2571
Craig Mautnerd61dc202014-07-07 11:09:11 -07002572 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002573 data.enforceInterface(IActivityManager.descriptor);
2574 startLockTaskModeOnCurrent();
2575 reply.writeNoException();
2576 return true;
2577 }
2578
Craig Mautneraea74a52014-03-08 14:23:10 -08002579 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2580 data.enforceInterface(IActivityManager.descriptor);
2581 stopLockTaskMode();
2582 reply.writeNoException();
2583 return true;
2584 }
2585
Craig Mautnerd61dc202014-07-07 11:09:11 -07002586 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002587 data.enforceInterface(IActivityManager.descriptor);
2588 stopLockTaskModeOnCurrent();
2589 reply.writeNoException();
2590 return true;
2591 }
2592
Craig Mautneraea74a52014-03-08 14:23:10 -08002593 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2594 data.enforceInterface(IActivityManager.descriptor);
2595 final boolean isInLockTaskMode = isInLockTaskMode();
2596 reply.writeNoException();
2597 reply.writeInt(isInLockTaskMode ? 1 : 0);
2598 return true;
2599 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002600
Benjamin Franz43261142015-02-11 15:59:44 +00002601 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2602 data.enforceInterface(IActivityManager.descriptor);
2603 final int lockTaskModeState = getLockTaskModeState();
2604 reply.writeNoException();
2605 reply.writeInt(lockTaskModeState);
2606 return true;
2607 }
2608
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002609 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2610 data.enforceInterface(IActivityManager.descriptor);
2611 final IBinder token = data.readStrongBinder();
2612 showLockTaskEscapeMessage(token);
2613 reply.writeNoException();
2614 return true;
2615 }
2616
Winson Chunga449dc02014-05-16 11:15:04 -07002617 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002618 data.enforceInterface(IActivityManager.descriptor);
2619 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002620 ActivityManager.TaskDescription values =
2621 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2622 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002623 reply.writeNoException();
2624 return true;
2625 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002626
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002627 case SET_TASK_RESIZEABLE_TRANSACTION: {
2628 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08002629 final int taskId = data.readInt();
2630 final int resizeableMode = data.readInt();
2631 setTaskResizeable(taskId, resizeableMode);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002632 reply.writeNoException();
2633 return true;
2634 }
2635
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002636 case RESIZE_TASK_TRANSACTION: {
2637 data.enforceInterface(IActivityManager.descriptor);
2638 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002639 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002640 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002641 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002642 reply.writeNoException();
2643 return true;
2644 }
2645
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002646 case GET_TASK_BOUNDS_TRANSACTION: {
2647 data.enforceInterface(IActivityManager.descriptor);
2648 int taskId = data.readInt();
2649 Rect r = getTaskBounds(taskId);
2650 reply.writeNoException();
2651 r.writeToParcel(reply, 0);
2652 return true;
2653 }
2654
Craig Mautner648f69b2014-09-18 14:16:26 -07002655 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2656 data.enforceInterface(IActivityManager.descriptor);
2657 String filename = data.readString();
Suprabh Shukla23593142015-11-03 17:31:15 -08002658 int userId = data.readInt();
2659 Bitmap icon = getTaskDescriptionIcon(filename, userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07002660 reply.writeNoException();
2661 if (icon == null) {
2662 reply.writeInt(0);
2663 } else {
2664 reply.writeInt(1);
2665 icon.writeToParcel(reply, 0);
2666 }
2667 return true;
2668 }
2669
Winson Chung044d5292014-11-06 11:05:19 -08002670 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2671 data.enforceInterface(IActivityManager.descriptor);
2672 final Bundle bundle;
2673 if (data.readInt() == 0) {
2674 bundle = null;
2675 } else {
2676 bundle = data.readBundle();
2677 }
Chong Zhang280d3322015-11-03 17:27:26 -08002678 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002679 startInPlaceAnimationOnFrontMostApplication(options);
2680 reply.writeNoException();
2681 return true;
2682 }
2683
Jose Lima4b6c6692014-08-12 17:41:12 -07002684 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002685 data.enforceInterface(IActivityManager.descriptor);
2686 IBinder token = data.readStrongBinder();
2687 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002688 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002689 reply.writeNoException();
2690 reply.writeInt(success ? 1 : 0);
2691 return true;
2692 }
2693
Jose Lima4b6c6692014-08-12 17:41:12 -07002694 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002695 data.enforceInterface(IActivityManager.descriptor);
2696 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002697 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002698 reply.writeNoException();
2699 reply.writeInt(enabled ? 1 : 0);
2700 return true;
2701 }
2702
Jose Lima4b6c6692014-08-12 17:41:12 -07002703 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002704 data.enforceInterface(IActivityManager.descriptor);
2705 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002706 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002707 reply.writeNoException();
2708 return true;
2709 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002710
2711 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2712 data.enforceInterface(IActivityManager.descriptor);
2713 IBinder token = data.readStrongBinder();
2714 notifyLaunchTaskBehindComplete(token);
2715 reply.writeNoException();
2716 return true;
2717 }
Craig Mautner8746a472014-07-24 15:12:54 -07002718
2719 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2720 data.enforceInterface(IActivityManager.descriptor);
2721 IBinder token = data.readStrongBinder();
2722 notifyEnterAnimationComplete(token);
2723 reply.writeNoException();
2724 return true;
2725 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002726
2727 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2728 data.enforceInterface(IActivityManager.descriptor);
2729 bootAnimationComplete();
2730 reply.writeNoException();
2731 return true;
2732 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002733
Jeff Sharkey605eb792014-11-04 13:34:06 -08002734 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2735 data.enforceInterface(IActivityManager.descriptor);
2736 final int uid = data.readInt();
2737 final byte[] firstPacket = data.createByteArray();
2738 notifyCleartextNetwork(uid, firstPacket);
2739 reply.writeNoException();
2740 return true;
2741 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002742
2743 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2744 data.enforceInterface(IActivityManager.descriptor);
2745 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002746 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002747 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002748 String reportPackage = data.readString();
2749 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002750 reply.writeNoException();
2751 return true;
2752 }
2753
2754 case DUMP_HEAP_FINISHED_TRANSACTION: {
2755 data.enforceInterface(IActivityManager.descriptor);
2756 String path = data.readString();
2757 dumpHeapFinished(path);
2758 reply.writeNoException();
2759 return true;
2760 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002761
2762 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2763 data.enforceInterface(IActivityManager.descriptor);
2764 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2765 data.readStrongBinder());
2766 boolean keepAwake = data.readInt() != 0;
2767 setVoiceKeepAwake(session, keepAwake);
2768 reply.writeNoException();
2769 return true;
2770 }
Craig Mautnere5600772015-04-03 21:36:37 -07002771
2772 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2773 data.enforceInterface(IActivityManager.descriptor);
2774 int userId = data.readInt();
2775 String[] packages = data.readStringArray();
2776 updateLockTaskPackages(userId, packages);
2777 reply.writeNoException();
2778 return true;
2779 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002780
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002781 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2782 data.enforceInterface(IActivityManager.descriptor);
2783 String packageName = data.readString();
2784 updateDeviceOwner(packageName);
2785 reply.writeNoException();
2786 return true;
2787 }
2788
Dianne Hackborn1e383822015-04-10 14:02:33 -07002789 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2790 data.enforceInterface(IActivityManager.descriptor);
2791 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002792 String callingPackage = data.readString();
2793 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002794 reply.writeNoException();
2795 reply.writeInt(res);
2796 return true;
2797 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002798
2799 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2800 data.enforceInterface(IActivityManager.descriptor);
2801 String process = data.readString();
2802 int userId = data.readInt();
2803 int level = data.readInt();
2804 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2805 reply.writeNoException();
2806 reply.writeInt(res ? 1 : 0);
2807 return true;
2808 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002809
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002810 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2811 data.enforceInterface(IActivityManager.descriptor);
2812 IBinder token = data.readStrongBinder();
2813 boolean res = isRootVoiceInteraction(token);
2814 reply.writeNoException();
2815 reply.writeInt(res ? 1 : 0);
2816 return true;
2817 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002818
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002819 case START_BINDER_TRACKING_TRANSACTION: {
2820 data.enforceInterface(IActivityManager.descriptor);
2821 boolean res = startBinderTracking();
2822 reply.writeNoException();
2823 reply.writeInt(res ? 1 : 0);
2824 return true;
2825 }
2826
2827 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2828 data.enforceInterface(IActivityManager.descriptor);
2829 ParcelFileDescriptor fd = data.readInt() != 0
2830 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2831 boolean res = stopBinderTrackingAndDump(fd);
2832 reply.writeNoException();
2833 reply.writeInt(res ? 1 : 0);
2834 return true;
2835 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002836 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2837 data.enforceInterface(IActivityManager.descriptor);
2838 IBinder token = data.readStrongBinder();
2839 int stackId = getActivityStackId(token);
2840 reply.writeNoException();
2841 reply.writeInt(stackId);
2842 return true;
2843 }
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002844 case EXIT_FREEFORM_MODE_TRANSACTION: {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002845 data.enforceInterface(IActivityManager.descriptor);
2846 IBinder token = data.readStrongBinder();
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002847 exitFreeformMode(token);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002848 reply.writeNoException();
2849 return true;
2850 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002851 case REPORT_SIZE_CONFIGURATIONS: {
2852 data.enforceInterface(IActivityManager.descriptor);
2853 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002854 int[] horizontal = readIntArray(data);
2855 int[] vertical = readIntArray(data);
2856 int[] smallest = readIntArray(data);
2857 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002858 return true;
2859 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002860 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2861 data.enforceInterface(IActivityManager.descriptor);
2862 final boolean suppress = data.readInt() == 1;
2863 suppressResizeConfigChanges(suppress);
2864 reply.writeNoException();
2865 return true;
2866 }
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08002867 case MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002868 data.enforceInterface(IActivityManager.descriptor);
2869 final int stackId = data.readInt();
Wale Ogunwale9101d262016-01-15 08:56:11 -08002870 final boolean onTop = data.readInt() == 1;
2871 moveTasksToFullscreenStack(stackId, onTop);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002872 reply.writeNoException();
2873 return true;
2874 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002875 case GET_APP_START_MODE_TRANSACTION: {
2876 data.enforceInterface(IActivityManager.descriptor);
2877 final int uid = data.readInt();
2878 final String pkg = data.readString();
2879 int res = getAppStartMode(uid, pkg);
2880 reply.writeNoException();
2881 reply.writeInt(res);
2882 return true;
2883 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002884 case IN_MULTI_WINDOW_TRANSACTION: {
Wale Ogunwale5f986092015-12-04 15:35:38 -08002885 data.enforceInterface(IActivityManager.descriptor);
2886 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002887 final boolean inMultiWindow = inMultiWindow(token);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002888 reply.writeNoException();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002889 reply.writeInt(inMultiWindow ? 1 : 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002890 return true;
2891 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002892 case IN_PICTURE_IN_PICTURE_TRANSACTION: {
Wale Ogunwale5f986092015-12-04 15:35:38 -08002893 data.enforceInterface(IActivityManager.descriptor);
2894 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002895 final boolean inPip = inPictureInPicture(token);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002896 reply.writeNoException();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002897 reply.writeInt(inPip ? 1 : 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002898 return true;
2899 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002900 case ENTER_PICTURE_IN_PICTURE_TRANSACTION: {
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002901 data.enforceInterface(IActivityManager.descriptor);
2902 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002903 enterPictureInPicture(token);
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002904 reply.writeNoException();
2905 return true;
2906 }
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002907 case SET_VR_MODE_TRANSACTION: {
2908 data.enforceInterface(IActivityManager.descriptor);
2909 final IBinder token = data.readStrongBinder();
2910 final boolean enable = data.readInt() == 1;
Ruben Brunke24b9a62016-02-16 21:38:24 -08002911 final ComponentName packageName = ComponentName.CREATOR.createFromParcel(data);
2912 int res = setVrMode(token, enable, packageName);
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002913 reply.writeNoException();
Ruben Brunke24b9a62016-02-16 21:38:24 -08002914 reply.writeInt(res);
2915 return true;
2916 }
2917 case IS_VR_PACKAGE_ENABLED_TRANSACTION: {
2918 data.enforceInterface(IActivityManager.descriptor);
2919 final ComponentName packageName = ComponentName.CREATOR.createFromParcel(data);
2920 boolean res = isVrModePackageEnabled(packageName);
2921 reply.writeNoException();
2922 reply.writeInt(res ? 1 : 0);
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002923 return true;
2924 }
Christopher Tate63fec3e2015-12-11 18:35:28 -08002925 case IS_APP_FOREGROUND_TRANSACTION: {
2926 data.enforceInterface(IActivityManager.descriptor);
2927 final int userHandle = data.readInt();
2928 final boolean isForeground = isAppForeground(userHandle);
2929 reply.writeNoException();
2930 reply.writeInt(isForeground ? 1 : 0);
2931 return true;
2932 }
Wale Ogunwale480dca02016-02-06 13:58:29 -08002933 case NOTIFY_PINNED_STACK_ANIMATION_ENDED_TRANSACTION: {
2934 data.enforceInterface(IActivityManager.descriptor);
2935 reply.writeNoException();
2936 return true;
2937 }
Wale Ogunwale06e8ee02016-02-12 12:56:32 -08002938 case REMOVE_STACK: {
2939 data.enforceInterface(IActivityManager.descriptor);
2940 final int stackId = data.readInt();
2941 removeStack(stackId);
2942 reply.writeNoException();
2943 return true;
2944 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002945 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002946
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002947 return super.onTransact(code, data, reply, flags);
2948 }
2949
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002950 private int[] readIntArray(Parcel data) {
2951 int[] smallest = null;
2952 int smallestSize = data.readInt();
2953 if (smallestSize > 0) {
2954 smallest = new int[smallestSize];
2955 data.readIntArray(smallest);
2956 }
2957 return smallest;
2958 }
2959
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002960 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002961 return this;
2962 }
2963
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002964 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2965 protected IActivityManager create() {
2966 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002967 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002968 Log.v("ActivityManager", "default service binder = " + b);
2969 }
2970 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002971 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002972 Log.v("ActivityManager", "default service = " + am);
2973 }
2974 return am;
2975 }
2976 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002977}
2978
2979class ActivityManagerProxy implements IActivityManager
2980{
2981 public ActivityManagerProxy(IBinder remote)
2982 {
2983 mRemote = remote;
2984 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002985
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002986 public IBinder asBinder()
2987 {
2988 return mRemote;
2989 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002990
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002991 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002992 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002993 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002994 Parcel data = Parcel.obtain();
2995 Parcel reply = Parcel.obtain();
2996 data.writeInterfaceToken(IActivityManager.descriptor);
2997 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002998 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002999 intent.writeToParcel(data, 0);
3000 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003001 data.writeStrongBinder(resultTo);
3002 data.writeString(resultWho);
3003 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003004 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003005 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003006 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003007 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003008 } else {
3009 data.writeInt(0);
3010 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07003011 if (options != null) {
3012 data.writeInt(1);
3013 options.writeToParcel(data, 0);
3014 } else {
3015 data.writeInt(0);
3016 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003017 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
3018 reply.readException();
3019 int result = reply.readInt();
3020 reply.recycle();
3021 data.recycle();
3022 return result;
3023 }
Amith Yamasani82644082012-08-03 13:09:11 -07003024
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003025 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07003026 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07003027 int startFlags, ProfilerInfo profilerInfo, Bundle options,
3028 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07003029 Parcel data = Parcel.obtain();
3030 Parcel reply = Parcel.obtain();
3031 data.writeInterfaceToken(IActivityManager.descriptor);
3032 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003033 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07003034 intent.writeToParcel(data, 0);
3035 data.writeString(resolvedType);
3036 data.writeStrongBinder(resultTo);
3037 data.writeString(resultWho);
3038 data.writeInt(requestCode);
3039 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003040 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07003041 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003042 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07003043 } else {
3044 data.writeInt(0);
3045 }
3046 if (options != null) {
3047 data.writeInt(1);
3048 options.writeToParcel(data, 0);
3049 } else {
3050 data.writeInt(0);
3051 }
3052 data.writeInt(userId);
3053 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
3054 reply.readException();
3055 int result = reply.readInt();
3056 reply.recycle();
3057 data.recycle();
3058 return result;
3059 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003060 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
3061 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07003062 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
3063 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003064 Parcel data = Parcel.obtain();
3065 Parcel reply = Parcel.obtain();
3066 data.writeInterfaceToken(IActivityManager.descriptor);
3067 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3068 data.writeString(callingPackage);
3069 intent.writeToParcel(data, 0);
3070 data.writeString(resolvedType);
3071 data.writeStrongBinder(resultTo);
3072 data.writeString(resultWho);
3073 data.writeInt(requestCode);
3074 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003075 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003076 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003077 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003078 } else {
3079 data.writeInt(0);
3080 }
3081 if (options != null) {
3082 data.writeInt(1);
3083 options.writeToParcel(data, 0);
3084 } else {
3085 data.writeInt(0);
3086 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07003087 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07003088 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003089 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
3090 reply.readException();
3091 int result = reply.readInt();
3092 reply.recycle();
3093 data.recycle();
3094 return result;
3095 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003096 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
3097 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07003098 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
3099 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003100 Parcel data = Parcel.obtain();
3101 Parcel reply = Parcel.obtain();
3102 data.writeInterfaceToken(IActivityManager.descriptor);
3103 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003104 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003105 intent.writeToParcel(data, 0);
3106 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003107 data.writeStrongBinder(resultTo);
3108 data.writeString(resultWho);
3109 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003110 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003111 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003112 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003113 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003114 } else {
3115 data.writeInt(0);
3116 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07003117 if (options != null) {
3118 data.writeInt(1);
3119 options.writeToParcel(data, 0);
3120 } else {
3121 data.writeInt(0);
3122 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003123 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003124 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
3125 reply.readException();
3126 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
3127 reply.recycle();
3128 data.recycle();
3129 return result;
3130 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003131 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
3132 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003133 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07003134 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003135 Parcel data = Parcel.obtain();
3136 Parcel reply = Parcel.obtain();
3137 data.writeInterfaceToken(IActivityManager.descriptor);
3138 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003139 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003140 intent.writeToParcel(data, 0);
3141 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003142 data.writeStrongBinder(resultTo);
3143 data.writeString(resultWho);
3144 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003145 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003146 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003147 if (options != null) {
3148 data.writeInt(1);
3149 options.writeToParcel(data, 0);
3150 } else {
3151 data.writeInt(0);
3152 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003153 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003154 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
3155 reply.readException();
3156 int result = reply.readInt();
3157 reply.recycle();
3158 data.recycle();
3159 return result;
3160 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003161 public int startActivityIntentSender(IApplicationThread caller,
3162 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003163 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003164 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003165 Parcel data = Parcel.obtain();
3166 Parcel reply = Parcel.obtain();
3167 data.writeInterfaceToken(IActivityManager.descriptor);
3168 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3169 intent.writeToParcel(data, 0);
3170 if (fillInIntent != null) {
3171 data.writeInt(1);
3172 fillInIntent.writeToParcel(data, 0);
3173 } else {
3174 data.writeInt(0);
3175 }
3176 data.writeString(resolvedType);
3177 data.writeStrongBinder(resultTo);
3178 data.writeString(resultWho);
3179 data.writeInt(requestCode);
3180 data.writeInt(flagsMask);
3181 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003182 if (options != null) {
3183 data.writeInt(1);
3184 options.writeToParcel(data, 0);
3185 } else {
3186 data.writeInt(0);
3187 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003188 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003189 reply.readException();
3190 int result = reply.readInt();
3191 reply.recycle();
3192 data.recycle();
3193 return result;
3194 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07003195 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
3196 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07003197 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
3198 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003199 Parcel data = Parcel.obtain();
3200 Parcel reply = Parcel.obtain();
3201 data.writeInterfaceToken(IActivityManager.descriptor);
3202 data.writeString(callingPackage);
3203 data.writeInt(callingPid);
3204 data.writeInt(callingUid);
3205 intent.writeToParcel(data, 0);
3206 data.writeString(resolvedType);
3207 data.writeStrongBinder(session.asBinder());
3208 data.writeStrongBinder(interactor.asBinder());
3209 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003210 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003211 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003212 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07003213 } else {
3214 data.writeInt(0);
3215 }
3216 if (options != null) {
3217 data.writeInt(1);
3218 options.writeToParcel(data, 0);
3219 } else {
3220 data.writeInt(0);
3221 }
3222 data.writeInt(userId);
3223 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3224 reply.readException();
3225 int result = reply.readInt();
3226 reply.recycle();
3227 data.recycle();
3228 return result;
3229 }
Amith Yamasani0af6fa72016-01-17 15:36:19 -08003230
3231 public void startLocalVoiceInteraction(IBinder callingActivity, Bundle options)
3232 throws RemoteException {
3233 Parcel data = Parcel.obtain();
3234 Parcel reply = Parcel.obtain();
3235 data.writeInterfaceToken(IActivityManager.descriptor);
3236 data.writeStrongBinder(callingActivity);
3237 data.writeBundle(options);
3238 mRemote.transact(START_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3239 reply.readException();
3240 reply.recycle();
3241 data.recycle();
3242 }
3243
3244 public void stopLocalVoiceInteraction(IBinder callingActivity) throws RemoteException {
3245 Parcel data = Parcel.obtain();
3246 Parcel reply = Parcel.obtain();
3247 data.writeInterfaceToken(IActivityManager.descriptor);
3248 data.writeStrongBinder(callingActivity);
3249 mRemote.transact(STOP_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3250 reply.readException();
3251 reply.recycle();
3252 data.recycle();
3253 }
3254
3255 public boolean supportsLocalVoiceInteraction() throws RemoteException {
3256 Parcel data = Parcel.obtain();
3257 Parcel reply = Parcel.obtain();
3258 data.writeInterfaceToken(IActivityManager.descriptor);
3259 mRemote.transact(SUPPORTS_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3260 reply.readException();
3261 int result = reply.readInt();
3262 reply.recycle();
3263 data.recycle();
3264 return result != 0;
3265 }
3266
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003267 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003268 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003269 Parcel data = Parcel.obtain();
3270 Parcel reply = Parcel.obtain();
3271 data.writeInterfaceToken(IActivityManager.descriptor);
3272 data.writeStrongBinder(callingActivity);
3273 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003274 if (options != null) {
3275 data.writeInt(1);
3276 options.writeToParcel(data, 0);
3277 } else {
3278 data.writeInt(0);
3279 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003280 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3281 reply.readException();
3282 int result = reply.readInt();
3283 reply.recycle();
3284 data.recycle();
3285 return result != 0;
3286 }
Wale Ogunwale854809c2015-12-27 16:18:19 -08003287 public int startActivityFromRecents(int taskId, Bundle options)
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003288 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003289 Parcel data = Parcel.obtain();
3290 Parcel reply = Parcel.obtain();
3291 data.writeInterfaceToken(IActivityManager.descriptor);
3292 data.writeInt(taskId);
3293 if (options == null) {
3294 data.writeInt(0);
3295 } else {
3296 data.writeInt(1);
3297 options.writeToParcel(data, 0);
3298 }
3299 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3300 reply.readException();
3301 int result = reply.readInt();
3302 reply.recycle();
3303 data.recycle();
3304 return result;
3305 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003306 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003307 throws RemoteException {
3308 Parcel data = Parcel.obtain();
3309 Parcel reply = Parcel.obtain();
3310 data.writeInterfaceToken(IActivityManager.descriptor);
3311 data.writeStrongBinder(token);
3312 data.writeInt(resultCode);
3313 if (resultData != null) {
3314 data.writeInt(1);
3315 resultData.writeToParcel(data, 0);
3316 } else {
3317 data.writeInt(0);
3318 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003319 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003320 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3321 reply.readException();
3322 boolean res = reply.readInt() != 0;
3323 data.recycle();
3324 reply.recycle();
3325 return res;
3326 }
3327 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3328 {
3329 Parcel data = Parcel.obtain();
3330 Parcel reply = Parcel.obtain();
3331 data.writeInterfaceToken(IActivityManager.descriptor);
3332 data.writeStrongBinder(token);
3333 data.writeString(resultWho);
3334 data.writeInt(requestCode);
3335 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3336 reply.readException();
3337 data.recycle();
3338 reply.recycle();
3339 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003340 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3341 Parcel data = Parcel.obtain();
3342 Parcel reply = Parcel.obtain();
3343 data.writeInterfaceToken(IActivityManager.descriptor);
3344 data.writeStrongBinder(token);
3345 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3346 reply.readException();
3347 boolean res = reply.readInt() != 0;
3348 data.recycle();
3349 reply.recycle();
3350 return res;
3351 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003352 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3353 Parcel data = Parcel.obtain();
3354 Parcel reply = Parcel.obtain();
3355 data.writeInterfaceToken(IActivityManager.descriptor);
3356 data.writeStrongBinder(session.asBinder());
3357 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3358 reply.readException();
3359 data.recycle();
3360 reply.recycle();
3361 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003362 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3363 Parcel data = Parcel.obtain();
3364 Parcel reply = Parcel.obtain();
3365 data.writeInterfaceToken(IActivityManager.descriptor);
3366 data.writeStrongBinder(token);
3367 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3368 reply.readException();
3369 boolean res = reply.readInt() != 0;
3370 data.recycle();
3371 reply.recycle();
3372 return res;
3373 }
3374 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3375 Parcel data = Parcel.obtain();
3376 Parcel reply = Parcel.obtain();
3377 data.writeInterfaceToken(IActivityManager.descriptor);
3378 data.writeStrongBinder(app.asBinder());
3379 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3380 reply.readException();
3381 data.recycle();
3382 reply.recycle();
3383 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003384 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3385 Parcel data = Parcel.obtain();
3386 Parcel reply = Parcel.obtain();
3387 data.writeInterfaceToken(IActivityManager.descriptor);
3388 data.writeStrongBinder(token);
3389 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3390 reply.readException();
3391 boolean res = reply.readInt() != 0;
3392 data.recycle();
3393 reply.recycle();
3394 return res;
3395 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003396 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003397 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003398 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003399 {
3400 Parcel data = Parcel.obtain();
3401 Parcel reply = Parcel.obtain();
3402 data.writeInterfaceToken(IActivityManager.descriptor);
3403 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003404 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003405 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3406 filter.writeToParcel(data, 0);
3407 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003408 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003409 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3410 reply.readException();
3411 Intent intent = null;
3412 int haveIntent = reply.readInt();
3413 if (haveIntent != 0) {
3414 intent = Intent.CREATOR.createFromParcel(reply);
3415 }
3416 reply.recycle();
3417 data.recycle();
3418 return intent;
3419 }
3420 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3421 {
3422 Parcel data = Parcel.obtain();
3423 Parcel reply = Parcel.obtain();
3424 data.writeInterfaceToken(IActivityManager.descriptor);
3425 data.writeStrongBinder(receiver.asBinder());
3426 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3427 reply.readException();
3428 data.recycle();
3429 reply.recycle();
3430 }
3431 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003432 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003433 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003434 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003435 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003436 {
3437 Parcel data = Parcel.obtain();
3438 Parcel reply = Parcel.obtain();
3439 data.writeInterfaceToken(IActivityManager.descriptor);
3440 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3441 intent.writeToParcel(data, 0);
3442 data.writeString(resolvedType);
3443 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3444 data.writeInt(resultCode);
3445 data.writeString(resultData);
3446 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003447 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003448 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003449 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003450 data.writeInt(serialized ? 1 : 0);
3451 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003452 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003453 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3454 reply.readException();
3455 int res = reply.readInt();
3456 reply.recycle();
3457 data.recycle();
3458 return res;
3459 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003460 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3461 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003462 {
3463 Parcel data = Parcel.obtain();
3464 Parcel reply = Parcel.obtain();
3465 data.writeInterfaceToken(IActivityManager.descriptor);
3466 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3467 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003468 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003469 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3470 reply.readException();
3471 data.recycle();
3472 reply.recycle();
3473 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003474 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3475 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003476 {
3477 Parcel data = Parcel.obtain();
3478 Parcel reply = Parcel.obtain();
3479 data.writeInterfaceToken(IActivityManager.descriptor);
3480 data.writeStrongBinder(who);
3481 data.writeInt(resultCode);
3482 data.writeString(resultData);
3483 data.writeBundle(map);
3484 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003485 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003486 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3487 reply.readException();
3488 data.recycle();
3489 reply.recycle();
3490 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003491 public void attachApplication(IApplicationThread app) throws RemoteException
3492 {
3493 Parcel data = Parcel.obtain();
3494 Parcel reply = Parcel.obtain();
3495 data.writeInterfaceToken(IActivityManager.descriptor);
3496 data.writeStrongBinder(app.asBinder());
3497 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3498 reply.readException();
3499 data.recycle();
3500 reply.recycle();
3501 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003502 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3503 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003504 {
3505 Parcel data = Parcel.obtain();
3506 Parcel reply = Parcel.obtain();
3507 data.writeInterfaceToken(IActivityManager.descriptor);
3508 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003509 if (config != null) {
3510 data.writeInt(1);
3511 config.writeToParcel(data, 0);
3512 } else {
3513 data.writeInt(0);
3514 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003515 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003516 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3517 reply.readException();
3518 data.recycle();
3519 reply.recycle();
3520 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003521 public void activityResumed(IBinder token) throws RemoteException
3522 {
3523 Parcel data = Parcel.obtain();
3524 Parcel reply = Parcel.obtain();
3525 data.writeInterfaceToken(IActivityManager.descriptor);
3526 data.writeStrongBinder(token);
3527 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3528 reply.readException();
3529 data.recycle();
3530 reply.recycle();
3531 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003532 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003533 {
3534 Parcel data = Parcel.obtain();
3535 Parcel reply = Parcel.obtain();
3536 data.writeInterfaceToken(IActivityManager.descriptor);
3537 data.writeStrongBinder(token);
3538 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3539 reply.readException();
3540 data.recycle();
3541 reply.recycle();
3542 }
3543 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003544 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003545 {
3546 Parcel data = Parcel.obtain();
3547 Parcel reply = Parcel.obtain();
3548 data.writeInterfaceToken(IActivityManager.descriptor);
3549 data.writeStrongBinder(token);
3550 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003551 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003552 TextUtils.writeToParcel(description, data, 0);
3553 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3554 reply.readException();
3555 data.recycle();
3556 reply.recycle();
3557 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003558 public void activitySlept(IBinder token) throws RemoteException
3559 {
3560 Parcel data = Parcel.obtain();
3561 Parcel reply = Parcel.obtain();
3562 data.writeInterfaceToken(IActivityManager.descriptor);
3563 data.writeStrongBinder(token);
3564 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3565 reply.readException();
3566 data.recycle();
3567 reply.recycle();
3568 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003569 public void activityDestroyed(IBinder token) throws RemoteException
3570 {
3571 Parcel data = Parcel.obtain();
3572 Parcel reply = Parcel.obtain();
3573 data.writeInterfaceToken(IActivityManager.descriptor);
3574 data.writeStrongBinder(token);
3575 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3576 reply.readException();
3577 data.recycle();
3578 reply.recycle();
3579 }
Jorim Jaggife89d122015-12-22 16:28:44 +01003580 public void activityRelaunched(IBinder token) throws RemoteException
3581 {
3582 Parcel data = Parcel.obtain();
3583 Parcel reply = Parcel.obtain();
3584 data.writeInterfaceToken(IActivityManager.descriptor);
3585 data.writeStrongBinder(token);
3586 mRemote.transact(ACTIVITY_RELAUNCHED_TRANSACTION, data, reply, 0);
3587 reply.readException();
3588 data.recycle();
3589 reply.recycle();
3590 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003591 public String getCallingPackage(IBinder token) throws RemoteException
3592 {
3593 Parcel data = Parcel.obtain();
3594 Parcel reply = Parcel.obtain();
3595 data.writeInterfaceToken(IActivityManager.descriptor);
3596 data.writeStrongBinder(token);
3597 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3598 reply.readException();
3599 String res = reply.readString();
3600 data.recycle();
3601 reply.recycle();
3602 return res;
3603 }
3604 public ComponentName getCallingActivity(IBinder token)
3605 throws RemoteException {
3606 Parcel data = Parcel.obtain();
3607 Parcel reply = Parcel.obtain();
3608 data.writeInterfaceToken(IActivityManager.descriptor);
3609 data.writeStrongBinder(token);
3610 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3611 reply.readException();
3612 ComponentName res = ComponentName.readFromParcel(reply);
3613 data.recycle();
3614 reply.recycle();
3615 return res;
3616 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003617 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003618 Parcel data = Parcel.obtain();
3619 Parcel reply = Parcel.obtain();
3620 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003621 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003622 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3623 reply.readException();
3624 ArrayList<IAppTask> list = null;
3625 int N = reply.readInt();
3626 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003627 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003628 while (N > 0) {
3629 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3630 list.add(task);
3631 N--;
3632 }
3633 }
3634 data.recycle();
3635 reply.recycle();
3636 return list;
3637 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003638 public int addAppTask(IBinder activityToken, Intent intent,
3639 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3640 Parcel data = Parcel.obtain();
3641 Parcel reply = Parcel.obtain();
3642 data.writeInterfaceToken(IActivityManager.descriptor);
3643 data.writeStrongBinder(activityToken);
3644 intent.writeToParcel(data, 0);
3645 description.writeToParcel(data, 0);
3646 thumbnail.writeToParcel(data, 0);
3647 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3648 reply.readException();
3649 int res = reply.readInt();
3650 data.recycle();
3651 reply.recycle();
3652 return res;
3653 }
3654 public Point getAppTaskThumbnailSize() throws RemoteException {
3655 Parcel data = Parcel.obtain();
3656 Parcel reply = Parcel.obtain();
3657 data.writeInterfaceToken(IActivityManager.descriptor);
3658 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3659 reply.readException();
3660 Point size = Point.CREATOR.createFromParcel(reply);
3661 data.recycle();
3662 reply.recycle();
3663 return size;
3664 }
Todd Kennedye635f662015-01-20 10:36:49 -08003665 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3666 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003667 Parcel data = Parcel.obtain();
3668 Parcel reply = Parcel.obtain();
3669 data.writeInterfaceToken(IActivityManager.descriptor);
3670 data.writeInt(maxNum);
3671 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003672 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3673 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003674 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003675 int N = reply.readInt();
3676 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003677 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003678 while (N > 0) {
3679 ActivityManager.RunningTaskInfo info =
3680 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003681 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003682 list.add(info);
3683 N--;
3684 }
3685 }
3686 data.recycle();
3687 reply.recycle();
3688 return list;
3689 }
3690 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003691 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003692 Parcel data = Parcel.obtain();
3693 Parcel reply = Parcel.obtain();
3694 data.writeInterfaceToken(IActivityManager.descriptor);
3695 data.writeInt(maxNum);
3696 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003697 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003698 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3699 reply.readException();
3700 ArrayList<ActivityManager.RecentTaskInfo> list
3701 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3702 data.recycle();
3703 reply.recycle();
3704 return list;
3705 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003706 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003707 Parcel data = Parcel.obtain();
3708 Parcel reply = Parcel.obtain();
3709 data.writeInterfaceToken(IActivityManager.descriptor);
3710 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003711 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003712 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003713 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003714 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003715 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003716 }
3717 data.recycle();
3718 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003719 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003720 }
Todd Kennedye635f662015-01-20 10:36:49 -08003721 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3722 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003723 Parcel data = Parcel.obtain();
3724 Parcel reply = Parcel.obtain();
3725 data.writeInterfaceToken(IActivityManager.descriptor);
3726 data.writeInt(maxNum);
3727 data.writeInt(flags);
3728 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3729 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003730 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003731 int N = reply.readInt();
3732 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003733 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003734 while (N > 0) {
3735 ActivityManager.RunningServiceInfo info =
3736 ActivityManager.RunningServiceInfo.CREATOR
3737 .createFromParcel(reply);
3738 list.add(info);
3739 N--;
3740 }
3741 }
3742 data.recycle();
3743 reply.recycle();
3744 return list;
3745 }
3746 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3747 throws RemoteException {
3748 Parcel data = Parcel.obtain();
3749 Parcel reply = Parcel.obtain();
3750 data.writeInterfaceToken(IActivityManager.descriptor);
3751 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3752 reply.readException();
3753 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3754 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3755 data.recycle();
3756 reply.recycle();
3757 return list;
3758 }
3759 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3760 throws RemoteException {
3761 Parcel data = Parcel.obtain();
3762 Parcel reply = Parcel.obtain();
3763 data.writeInterfaceToken(IActivityManager.descriptor);
3764 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3765 reply.readException();
3766 ArrayList<ActivityManager.RunningAppProcessInfo> list
3767 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3768 data.recycle();
3769 reply.recycle();
3770 return list;
3771 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003772 public List<ApplicationInfo> getRunningExternalApplications()
3773 throws RemoteException {
3774 Parcel data = Parcel.obtain();
3775 Parcel reply = Parcel.obtain();
3776 data.writeInterfaceToken(IActivityManager.descriptor);
3777 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3778 reply.readException();
3779 ArrayList<ApplicationInfo> list
3780 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3781 data.recycle();
3782 reply.recycle();
3783 return list;
3784 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003785 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003786 {
3787 Parcel data = Parcel.obtain();
3788 Parcel reply = Parcel.obtain();
3789 data.writeInterfaceToken(IActivityManager.descriptor);
3790 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003791 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003792 if (options != null) {
3793 data.writeInt(1);
3794 options.writeToParcel(data, 0);
3795 } else {
3796 data.writeInt(0);
3797 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003798 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3799 reply.readException();
3800 data.recycle();
3801 reply.recycle();
3802 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003803 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3804 throws RemoteException {
3805 Parcel data = Parcel.obtain();
3806 Parcel reply = Parcel.obtain();
3807 data.writeInterfaceToken(IActivityManager.descriptor);
3808 data.writeStrongBinder(token);
3809 data.writeInt(nonRoot ? 1 : 0);
3810 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3811 reply.readException();
3812 boolean res = reply.readInt() != 0;
3813 data.recycle();
3814 reply.recycle();
3815 return res;
3816 }
3817 public void moveTaskBackwards(int task) throws RemoteException
3818 {
3819 Parcel data = Parcel.obtain();
3820 Parcel reply = Parcel.obtain();
3821 data.writeInterfaceToken(IActivityManager.descriptor);
3822 data.writeInt(task);
3823 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3824 reply.readException();
3825 data.recycle();
3826 reply.recycle();
3827 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003828 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003829 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3830 {
3831 Parcel data = Parcel.obtain();
3832 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003833 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003834 data.writeInt(taskId);
3835 data.writeInt(stackId);
3836 data.writeInt(toTop ? 1 : 0);
3837 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3838 reply.readException();
3839 data.recycle();
3840 reply.recycle();
3841 }
3842 @Override
Chong Zhange4fbd322016-03-01 14:44:03 -08003843 public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003844 Rect initialBounds) throws RemoteException
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003845 {
3846 Parcel data = Parcel.obtain();
3847 Parcel reply = Parcel.obtain();
3848 data.writeInterfaceToken(IActivityManager.descriptor);
3849 data.writeInt(taskId);
3850 data.writeInt(createMode);
3851 data.writeInt(toTop ? 1 : 0);
Jorim Jaggi030979c2015-11-20 15:14:43 -08003852 data.writeInt(animate ? 1 : 0);
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003853 if (initialBounds != null) {
3854 data.writeInt(1);
3855 initialBounds.writeToParcel(data, 0);
3856 } else {
3857 data.writeInt(0);
3858 }
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003859 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3860 reply.readException();
Chong Zhange4fbd322016-03-01 14:44:03 -08003861 boolean res = reply.readInt() > 0;
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003862 data.recycle();
3863 reply.recycle();
Chong Zhange4fbd322016-03-01 14:44:03 -08003864 return res;
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003865 }
3866 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003867 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3868 throws RemoteException
3869 {
3870 Parcel data = Parcel.obtain();
3871 Parcel reply = Parcel.obtain();
3872 data.writeInterfaceToken(IActivityManager.descriptor);
3873 data.writeInt(stackId);
3874 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003875 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003876 reply.readException();
3877 final boolean res = reply.readInt() != 0;
3878 data.recycle();
3879 reply.recycle();
3880 return res;
3881 }
3882 @Override
Filip Gruszczynski84fa3352016-01-25 16:28:49 -08003883 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode,
3884 boolean preserveWindows, boolean animate) throws RemoteException {
Craig Mautnerc00204b2013-03-05 15:02:14 -08003885 Parcel data = Parcel.obtain();
3886 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003887 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003888 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003889 if (r != null) {
3890 data.writeInt(1);
3891 r.writeToParcel(data, 0);
3892 } else {
3893 data.writeInt(0);
3894 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003895 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Filip Gruszczynski84fa3352016-01-25 16:28:49 -08003896 data.writeInt(preserveWindows ? 1 : 0);
3897 data.writeInt(animate ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003898 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003899 reply.readException();
3900 data.recycle();
3901 reply.recycle();
3902 }
Craig Mautner967212c2013-04-13 21:10:58 -07003903 @Override
Jorim Jaggid47e7e12016-03-01 09:57:38 +01003904 public void swapDockedAndFullscreenStack() throws RemoteException
3905 {
3906 Parcel data = Parcel.obtain();
3907 Parcel reply = Parcel.obtain();
3908 data.writeInterfaceToken(IActivityManager.descriptor);
3909 mRemote.transact(SWAP_DOCKED_AND_FULLSCREEN_STACK, data, reply, 0);
3910 reply.readException();
3911 data.recycle();
3912 reply.recycle();
3913 }
3914 @Override
Jorim Jaggidc249c42015-12-15 14:57:31 -08003915 public void resizeDockedStack(Rect dockedBounds, Rect tempDockedTaskBounds,
3916 Rect tempDockedTaskInsetBounds,
3917 Rect tempOtherTaskBounds, Rect tempOtherTaskInsetBounds)
3918 throws RemoteException
3919 {
3920 Parcel data = Parcel.obtain();
3921 Parcel reply = Parcel.obtain();
3922 data.writeInterfaceToken(IActivityManager.descriptor);
3923 if (dockedBounds != null) {
3924 data.writeInt(1);
3925 dockedBounds.writeToParcel(data, 0);
3926 } else {
3927 data.writeInt(0);
3928 }
3929 if (tempDockedTaskBounds != null) {
3930 data.writeInt(1);
3931 tempDockedTaskBounds.writeToParcel(data, 0);
3932 } else {
3933 data.writeInt(0);
3934 }
3935 if (tempDockedTaskInsetBounds != null) {
3936 data.writeInt(1);
3937 tempDockedTaskInsetBounds.writeToParcel(data, 0);
3938 } else {
3939 data.writeInt(0);
3940 }
3941 if (tempOtherTaskBounds != null) {
3942 data.writeInt(1);
3943 tempOtherTaskBounds.writeToParcel(data, 0);
3944 } else {
3945 data.writeInt(0);
3946 }
3947 if (tempOtherTaskInsetBounds != null) {
3948 data.writeInt(1);
3949 tempOtherTaskInsetBounds.writeToParcel(data, 0);
3950 } else {
3951 data.writeInt(0);
3952 }
3953 mRemote.transact(RESIZE_DOCKED_STACK_TRANSACTION, data, reply, 0);
3954 reply.readException();
3955 data.recycle();
3956 reply.recycle();
3957 }
Robert Carr0d00c2e2016-02-29 17:45:02 -08003958
3959 @Override
3960 public void resizePinnedStack(Rect pinnedBounds, Rect tempPinnedTaskBounds) throws RemoteException
3961 {
3962 Parcel data = Parcel.obtain();
3963 Parcel reply = Parcel.obtain();
3964 data.writeInterfaceToken(IActivityManager.descriptor);
3965 if (pinnedBounds != null) {
3966 data.writeInt(1);
3967 pinnedBounds.writeToParcel(data, 0);
3968 } else {
3969 data.writeInt(0);
3970 }
3971 if (tempPinnedTaskBounds != null) {
3972 data.writeInt(1);
3973 tempPinnedTaskBounds.writeToParcel(data, 0);
3974 } else {
3975 data.writeInt(0);
3976 }
3977 mRemote.transact(RESIZE_PINNED_STACK_TRANSACTION, data, reply, 0);
3978 reply.readException();
3979 data.recycle();
3980 reply.recycle();
3981 }
3982
Jorim Jaggidc249c42015-12-15 14:57:31 -08003983 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003984 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3985 {
3986 Parcel data = Parcel.obtain();
3987 Parcel reply = Parcel.obtain();
3988 data.writeInterfaceToken(IActivityManager.descriptor);
3989 data.writeInt(taskId);
3990 data.writeInt(stackId);
3991 data.writeInt(position);
3992 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3993 reply.readException();
3994 data.recycle();
3995 reply.recycle();
3996 }
3997 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003998 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003999 {
4000 Parcel data = Parcel.obtain();
4001 Parcel reply = Parcel.obtain();
4002 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004003 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07004004 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004005 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07004006 data.recycle();
4007 reply.recycle();
4008 return list;
4009 }
Craig Mautnercf910b02013-04-23 11:23:27 -07004010 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004011 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07004012 {
4013 Parcel data = Parcel.obtain();
4014 Parcel reply = Parcel.obtain();
4015 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004016 data.writeInt(stackId);
4017 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07004018 reply.readException();
4019 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004020 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07004021 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08004022 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07004023 }
4024 data.recycle();
4025 reply.recycle();
4026 return info;
4027 }
4028 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08004029 public boolean isInHomeStack(int taskId) throws RemoteException {
4030 Parcel data = Parcel.obtain();
4031 Parcel reply = Parcel.obtain();
4032 data.writeInterfaceToken(IActivityManager.descriptor);
4033 data.writeInt(taskId);
4034 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
4035 reply.readException();
4036 boolean isInHomeStack = reply.readInt() > 0;
4037 data.recycle();
4038 reply.recycle();
4039 return isInHomeStack;
4040 }
4041 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07004042 public void setFocusedStack(int stackId) throws RemoteException
4043 {
4044 Parcel data = Parcel.obtain();
4045 Parcel reply = Parcel.obtain();
4046 data.writeInterfaceToken(IActivityManager.descriptor);
4047 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004048 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07004049 reply.readException();
4050 data.recycle();
4051 reply.recycle();
4052 }
Winson Chung740c3ac2014-11-12 16:14:38 -08004053 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08004054 public int getFocusedStackId() throws RemoteException {
4055 Parcel data = Parcel.obtain();
4056 Parcel reply = Parcel.obtain();
4057 data.writeInterfaceToken(IActivityManager.descriptor);
4058 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
4059 reply.readException();
4060 int focusedStackId = reply.readInt();
4061 data.recycle();
4062 reply.recycle();
4063 return focusedStackId;
4064 }
4065 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07004066 public void setFocusedTask(int taskId) throws RemoteException
4067 {
4068 Parcel data = Parcel.obtain();
4069 Parcel reply = Parcel.obtain();
4070 data.writeInterfaceToken(IActivityManager.descriptor);
4071 data.writeInt(taskId);
4072 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
4073 reply.readException();
4074 data.recycle();
4075 reply.recycle();
4076 }
4077 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08004078 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
4079 {
4080 Parcel data = Parcel.obtain();
4081 Parcel reply = Parcel.obtain();
4082 data.writeInterfaceToken(IActivityManager.descriptor);
4083 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07004084 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08004085 reply.readException();
4086 data.recycle();
4087 reply.recycle();
4088 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004089 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
4090 {
4091 Parcel data = Parcel.obtain();
4092 Parcel reply = Parcel.obtain();
4093 data.writeInterfaceToken(IActivityManager.descriptor);
4094 data.writeStrongBinder(token);
4095 data.writeInt(onlyRoot ? 1 : 0);
4096 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
4097 reply.readException();
4098 int res = reply.readInt();
4099 data.recycle();
4100 reply.recycle();
4101 return res;
4102 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004103 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07004104 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004105 Parcel data = Parcel.obtain();
4106 Parcel reply = Parcel.obtain();
4107 data.writeInterfaceToken(IActivityManager.descriptor);
4108 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4109 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07004110 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004111 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004112 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4113 reply.readException();
4114 int res = reply.readInt();
4115 ContentProviderHolder cph = null;
4116 if (res != 0) {
4117 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
4118 }
4119 data.recycle();
4120 reply.recycle();
4121 return cph;
4122 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07004123 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
4124 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004125 Parcel data = Parcel.obtain();
4126 Parcel reply = Parcel.obtain();
4127 data.writeInterfaceToken(IActivityManager.descriptor);
4128 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07004129 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004130 data.writeStrongBinder(token);
4131 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4132 reply.readException();
4133 int res = reply.readInt();
4134 ContentProviderHolder cph = null;
4135 if (res != 0) {
4136 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
4137 }
4138 data.recycle();
4139 reply.recycle();
4140 return cph;
4141 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004142 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004143 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004144 {
4145 Parcel data = Parcel.obtain();
4146 Parcel reply = Parcel.obtain();
4147 data.writeInterfaceToken(IActivityManager.descriptor);
4148 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4149 data.writeTypedList(providers);
4150 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
4151 reply.readException();
4152 data.recycle();
4153 reply.recycle();
4154 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004155 public boolean refContentProvider(IBinder connection, int stable, int unstable)
4156 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004157 Parcel data = Parcel.obtain();
4158 Parcel reply = Parcel.obtain();
4159 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004160 data.writeStrongBinder(connection);
4161 data.writeInt(stable);
4162 data.writeInt(unstable);
4163 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4164 reply.readException();
4165 boolean res = reply.readInt() != 0;
4166 data.recycle();
4167 reply.recycle();
4168 return res;
4169 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004170
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004171 public void unstableProviderDied(IBinder connection) throws RemoteException {
4172 Parcel data = Parcel.obtain();
4173 Parcel reply = Parcel.obtain();
4174 data.writeInterfaceToken(IActivityManager.descriptor);
4175 data.writeStrongBinder(connection);
4176 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
4177 reply.readException();
4178 data.recycle();
4179 reply.recycle();
4180 }
4181
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004182 @Override
4183 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
4184 Parcel data = Parcel.obtain();
4185 Parcel reply = Parcel.obtain();
4186 data.writeInterfaceToken(IActivityManager.descriptor);
4187 data.writeStrongBinder(connection);
4188 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
4189 reply.readException();
4190 data.recycle();
4191 reply.recycle();
4192 }
4193
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004194 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
4195 Parcel data = Parcel.obtain();
4196 Parcel reply = Parcel.obtain();
4197 data.writeInterfaceToken(IActivityManager.descriptor);
4198 data.writeStrongBinder(connection);
4199 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004200 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4201 reply.readException();
4202 data.recycle();
4203 reply.recycle();
4204 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004205
4206 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
4207 Parcel data = Parcel.obtain();
4208 Parcel reply = Parcel.obtain();
4209 data.writeInterfaceToken(IActivityManager.descriptor);
4210 data.writeString(name);
4211 data.writeStrongBinder(token);
4212 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4213 reply.readException();
4214 data.recycle();
4215 reply.recycle();
4216 }
4217
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07004218 public PendingIntent getRunningServiceControlPanel(ComponentName service)
4219 throws RemoteException
4220 {
4221 Parcel data = Parcel.obtain();
4222 Parcel reply = Parcel.obtain();
4223 data.writeInterfaceToken(IActivityManager.descriptor);
4224 service.writeToParcel(data, 0);
4225 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
4226 reply.readException();
4227 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
4228 data.recycle();
4229 reply.recycle();
4230 return res;
4231 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004232
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004233 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07004234 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004235 {
4236 Parcel data = Parcel.obtain();
4237 Parcel reply = Parcel.obtain();
4238 data.writeInterfaceToken(IActivityManager.descriptor);
4239 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4240 service.writeToParcel(data, 0);
4241 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004242 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004243 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004244 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
4245 reply.readException();
4246 ComponentName res = ComponentName.readFromParcel(reply);
4247 data.recycle();
4248 reply.recycle();
4249 return res;
4250 }
4251 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004252 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004253 {
4254 Parcel data = Parcel.obtain();
4255 Parcel reply = Parcel.obtain();
4256 data.writeInterfaceToken(IActivityManager.descriptor);
4257 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4258 service.writeToParcel(data, 0);
4259 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004260 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004261 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
4262 reply.readException();
4263 int res = reply.readInt();
4264 reply.recycle();
4265 data.recycle();
4266 return res;
4267 }
4268 public boolean stopServiceToken(ComponentName className, IBinder token,
4269 int startId) throws RemoteException {
4270 Parcel data = Parcel.obtain();
4271 Parcel reply = Parcel.obtain();
4272 data.writeInterfaceToken(IActivityManager.descriptor);
4273 ComponentName.writeToParcel(className, data);
4274 data.writeStrongBinder(token);
4275 data.writeInt(startId);
4276 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
4277 reply.readException();
4278 boolean res = reply.readInt() != 0;
4279 data.recycle();
4280 reply.recycle();
4281 return res;
4282 }
4283 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004284 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004285 Parcel data = Parcel.obtain();
4286 Parcel reply = Parcel.obtain();
4287 data.writeInterfaceToken(IActivityManager.descriptor);
4288 ComponentName.writeToParcel(className, data);
4289 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004290 data.writeInt(id);
4291 if (notification != null) {
4292 data.writeInt(1);
4293 notification.writeToParcel(data, 0);
4294 } else {
4295 data.writeInt(0);
4296 }
4297 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004298 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
4299 reply.readException();
4300 data.recycle();
4301 reply.recycle();
4302 }
4303 public int bindService(IApplicationThread caller, IBinder token,
4304 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07004305 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004306 Parcel data = Parcel.obtain();
4307 Parcel reply = Parcel.obtain();
4308 data.writeInterfaceToken(IActivityManager.descriptor);
4309 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4310 data.writeStrongBinder(token);
4311 service.writeToParcel(data, 0);
4312 data.writeString(resolvedType);
4313 data.writeStrongBinder(connection.asBinder());
4314 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07004315 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08004316 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004317 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
4318 reply.readException();
4319 int res = reply.readInt();
4320 data.recycle();
4321 reply.recycle();
4322 return res;
4323 }
4324 public boolean unbindService(IServiceConnection connection) throws RemoteException
4325 {
4326 Parcel data = Parcel.obtain();
4327 Parcel reply = Parcel.obtain();
4328 data.writeInterfaceToken(IActivityManager.descriptor);
4329 data.writeStrongBinder(connection.asBinder());
4330 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
4331 reply.readException();
4332 boolean res = reply.readInt() != 0;
4333 data.recycle();
4334 reply.recycle();
4335 return res;
4336 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004337
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004338 public void publishService(IBinder token,
4339 Intent intent, IBinder service) throws RemoteException {
4340 Parcel data = Parcel.obtain();
4341 Parcel reply = Parcel.obtain();
4342 data.writeInterfaceToken(IActivityManager.descriptor);
4343 data.writeStrongBinder(token);
4344 intent.writeToParcel(data, 0);
4345 data.writeStrongBinder(service);
4346 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
4347 reply.readException();
4348 data.recycle();
4349 reply.recycle();
4350 }
4351
4352 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
4353 throws RemoteException {
4354 Parcel data = Parcel.obtain();
4355 Parcel reply = Parcel.obtain();
4356 data.writeInterfaceToken(IActivityManager.descriptor);
4357 data.writeStrongBinder(token);
4358 intent.writeToParcel(data, 0);
4359 data.writeInt(doRebind ? 1 : 0);
4360 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4361 reply.readException();
4362 data.recycle();
4363 reply.recycle();
4364 }
4365
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004366 public void serviceDoneExecuting(IBinder token, int type, int startId,
4367 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004368 Parcel data = Parcel.obtain();
4369 Parcel reply = Parcel.obtain();
4370 data.writeInterfaceToken(IActivityManager.descriptor);
4371 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004372 data.writeInt(type);
4373 data.writeInt(startId);
4374 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004375 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4376 reply.readException();
4377 data.recycle();
4378 reply.recycle();
4379 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004380
Svet Ganov99b60432015-06-27 13:15:22 -07004381 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4382 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004383 Parcel data = Parcel.obtain();
4384 Parcel reply = Parcel.obtain();
4385 data.writeInterfaceToken(IActivityManager.descriptor);
4386 service.writeToParcel(data, 0);
4387 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004388 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004389 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4390 reply.readException();
4391 IBinder binder = reply.readStrongBinder();
4392 reply.recycle();
4393 data.recycle();
4394 return binder;
4395 }
4396
Christopher Tate181fafa2009-05-14 11:12:14 -07004397 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4398 throws RemoteException {
4399 Parcel data = Parcel.obtain();
4400 Parcel reply = Parcel.obtain();
4401 data.writeInterfaceToken(IActivityManager.descriptor);
4402 app.writeToParcel(data, 0);
4403 data.writeInt(backupRestoreMode);
4404 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4405 reply.readException();
4406 boolean success = reply.readInt() != 0;
4407 reply.recycle();
4408 data.recycle();
4409 return success;
4410 }
4411
Christopher Tate346acb12012-10-15 19:20:25 -07004412 public void clearPendingBackup() throws RemoteException {
4413 Parcel data = Parcel.obtain();
4414 Parcel reply = Parcel.obtain();
4415 data.writeInterfaceToken(IActivityManager.descriptor);
4416 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4417 reply.recycle();
4418 data.recycle();
4419 }
4420
Christopher Tate181fafa2009-05-14 11:12:14 -07004421 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4422 Parcel data = Parcel.obtain();
4423 Parcel reply = Parcel.obtain();
4424 data.writeInterfaceToken(IActivityManager.descriptor);
4425 data.writeString(packageName);
4426 data.writeStrongBinder(agent);
4427 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4428 reply.recycle();
4429 data.recycle();
4430 }
4431
4432 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4433 Parcel data = Parcel.obtain();
4434 Parcel reply = Parcel.obtain();
4435 data.writeInterfaceToken(IActivityManager.descriptor);
4436 app.writeToParcel(data, 0);
4437 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4438 reply.readException();
4439 reply.recycle();
4440 data.recycle();
4441 }
4442
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004443 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004444 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004445 IUiAutomationConnection connection, int userId, String instructionSet)
4446 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004447 Parcel data = Parcel.obtain();
4448 Parcel reply = Parcel.obtain();
4449 data.writeInterfaceToken(IActivityManager.descriptor);
4450 ComponentName.writeToParcel(className, data);
4451 data.writeString(profileFile);
4452 data.writeInt(flags);
4453 data.writeBundle(arguments);
4454 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004455 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004456 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004457 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004458 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4459 reply.readException();
4460 boolean res = reply.readInt() != 0;
4461 reply.recycle();
4462 data.recycle();
4463 return res;
4464 }
4465
4466 public void finishInstrumentation(IApplicationThread target,
4467 int resultCode, Bundle results) throws RemoteException {
4468 Parcel data = Parcel.obtain();
4469 Parcel reply = Parcel.obtain();
4470 data.writeInterfaceToken(IActivityManager.descriptor);
4471 data.writeStrongBinder(target != null ? target.asBinder() : null);
4472 data.writeInt(resultCode);
4473 data.writeBundle(results);
4474 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4475 reply.readException();
4476 data.recycle();
4477 reply.recycle();
4478 }
4479 public Configuration getConfiguration() throws RemoteException
4480 {
4481 Parcel data = Parcel.obtain();
4482 Parcel reply = Parcel.obtain();
4483 data.writeInterfaceToken(IActivityManager.descriptor);
4484 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4485 reply.readException();
4486 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4487 reply.recycle();
4488 data.recycle();
4489 return res;
4490 }
4491 public void updateConfiguration(Configuration values) throws RemoteException
4492 {
4493 Parcel data = Parcel.obtain();
4494 Parcel reply = Parcel.obtain();
4495 data.writeInterfaceToken(IActivityManager.descriptor);
4496 values.writeToParcel(data, 0);
4497 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4498 reply.readException();
4499 data.recycle();
4500 reply.recycle();
4501 }
4502 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4503 throws RemoteException {
4504 Parcel data = Parcel.obtain();
4505 Parcel reply = Parcel.obtain();
4506 data.writeInterfaceToken(IActivityManager.descriptor);
4507 data.writeStrongBinder(token);
4508 data.writeInt(requestedOrientation);
4509 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4510 reply.readException();
4511 data.recycle();
4512 reply.recycle();
4513 }
4514 public int getRequestedOrientation(IBinder token) throws RemoteException {
4515 Parcel data = Parcel.obtain();
4516 Parcel reply = Parcel.obtain();
4517 data.writeInterfaceToken(IActivityManager.descriptor);
4518 data.writeStrongBinder(token);
4519 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4520 reply.readException();
4521 int res = reply.readInt();
4522 data.recycle();
4523 reply.recycle();
4524 return res;
4525 }
4526 public ComponentName getActivityClassForToken(IBinder token)
4527 throws RemoteException {
4528 Parcel data = Parcel.obtain();
4529 Parcel reply = Parcel.obtain();
4530 data.writeInterfaceToken(IActivityManager.descriptor);
4531 data.writeStrongBinder(token);
4532 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4533 reply.readException();
4534 ComponentName res = ComponentName.readFromParcel(reply);
4535 data.recycle();
4536 reply.recycle();
4537 return res;
4538 }
4539 public String getPackageForToken(IBinder token) throws RemoteException
4540 {
4541 Parcel data = Parcel.obtain();
4542 Parcel reply = Parcel.obtain();
4543 data.writeInterfaceToken(IActivityManager.descriptor);
4544 data.writeStrongBinder(token);
4545 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4546 reply.readException();
4547 String res = reply.readString();
4548 data.recycle();
4549 reply.recycle();
4550 return res;
4551 }
4552 public IIntentSender getIntentSender(int type,
4553 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004554 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004555 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004556 Parcel data = Parcel.obtain();
4557 Parcel reply = Parcel.obtain();
4558 data.writeInterfaceToken(IActivityManager.descriptor);
4559 data.writeInt(type);
4560 data.writeString(packageName);
4561 data.writeStrongBinder(token);
4562 data.writeString(resultWho);
4563 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004564 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004565 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004566 data.writeTypedArray(intents, 0);
4567 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004568 } else {
4569 data.writeInt(0);
4570 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004571 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004572 if (options != null) {
4573 data.writeInt(1);
4574 options.writeToParcel(data, 0);
4575 } else {
4576 data.writeInt(0);
4577 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004578 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004579 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4580 reply.readException();
4581 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004582 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004583 data.recycle();
4584 reply.recycle();
4585 return res;
4586 }
4587 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4588 Parcel data = Parcel.obtain();
4589 Parcel reply = Parcel.obtain();
4590 data.writeInterfaceToken(IActivityManager.descriptor);
4591 data.writeStrongBinder(sender.asBinder());
4592 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4593 reply.readException();
4594 data.recycle();
4595 reply.recycle();
4596 }
4597 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4598 Parcel data = Parcel.obtain();
4599 Parcel reply = Parcel.obtain();
4600 data.writeInterfaceToken(IActivityManager.descriptor);
4601 data.writeStrongBinder(sender.asBinder());
4602 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4603 reply.readException();
4604 String res = reply.readString();
4605 data.recycle();
4606 reply.recycle();
4607 return res;
4608 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004609 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4610 Parcel data = Parcel.obtain();
4611 Parcel reply = Parcel.obtain();
4612 data.writeInterfaceToken(IActivityManager.descriptor);
4613 data.writeStrongBinder(sender.asBinder());
4614 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4615 reply.readException();
4616 int res = reply.readInt();
4617 data.recycle();
4618 reply.recycle();
4619 return res;
4620 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004621 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4622 boolean requireFull, String name, String callerPackage) throws RemoteException {
4623 Parcel data = Parcel.obtain();
4624 Parcel reply = Parcel.obtain();
4625 data.writeInterfaceToken(IActivityManager.descriptor);
4626 data.writeInt(callingPid);
4627 data.writeInt(callingUid);
4628 data.writeInt(userId);
4629 data.writeInt(allowAll ? 1 : 0);
4630 data.writeInt(requireFull ? 1 : 0);
4631 data.writeString(name);
4632 data.writeString(callerPackage);
4633 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4634 reply.readException();
4635 int res = reply.readInt();
4636 data.recycle();
4637 reply.recycle();
4638 return res;
4639 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004640 public void setProcessLimit(int max) throws RemoteException
4641 {
4642 Parcel data = Parcel.obtain();
4643 Parcel reply = Parcel.obtain();
4644 data.writeInterfaceToken(IActivityManager.descriptor);
4645 data.writeInt(max);
4646 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4647 reply.readException();
4648 data.recycle();
4649 reply.recycle();
4650 }
4651 public int getProcessLimit() throws RemoteException
4652 {
4653 Parcel data = Parcel.obtain();
4654 Parcel reply = Parcel.obtain();
4655 data.writeInterfaceToken(IActivityManager.descriptor);
4656 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4657 reply.readException();
4658 int res = reply.readInt();
4659 data.recycle();
4660 reply.recycle();
4661 return res;
4662 }
4663 public void setProcessForeground(IBinder token, int pid,
4664 boolean isForeground) throws RemoteException {
4665 Parcel data = Parcel.obtain();
4666 Parcel reply = Parcel.obtain();
4667 data.writeInterfaceToken(IActivityManager.descriptor);
4668 data.writeStrongBinder(token);
4669 data.writeInt(pid);
4670 data.writeInt(isForeground ? 1 : 0);
4671 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4672 reply.readException();
4673 data.recycle();
4674 reply.recycle();
4675 }
4676 public int checkPermission(String permission, int pid, int uid)
4677 throws RemoteException {
4678 Parcel data = Parcel.obtain();
4679 Parcel reply = Parcel.obtain();
4680 data.writeInterfaceToken(IActivityManager.descriptor);
4681 data.writeString(permission);
4682 data.writeInt(pid);
4683 data.writeInt(uid);
4684 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4685 reply.readException();
4686 int res = reply.readInt();
4687 data.recycle();
4688 reply.recycle();
4689 return res;
4690 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004691 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4692 throws RemoteException {
4693 Parcel data = Parcel.obtain();
4694 Parcel reply = Parcel.obtain();
4695 data.writeInterfaceToken(IActivityManager.descriptor);
4696 data.writeString(permission);
4697 data.writeInt(pid);
4698 data.writeInt(uid);
4699 data.writeStrongBinder(callerToken);
4700 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4701 reply.readException();
4702 int res = reply.readInt();
4703 data.recycle();
4704 reply.recycle();
4705 return res;
4706 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004707 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004708 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004709 Parcel data = Parcel.obtain();
4710 Parcel reply = Parcel.obtain();
4711 data.writeInterfaceToken(IActivityManager.descriptor);
4712 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004713 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004714 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004715 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4716 reply.readException();
4717 boolean res = reply.readInt() != 0;
4718 data.recycle();
4719 reply.recycle();
4720 return res;
4721 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004722 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4723 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004724 Parcel data = Parcel.obtain();
4725 Parcel reply = Parcel.obtain();
4726 data.writeInterfaceToken(IActivityManager.descriptor);
4727 uri.writeToParcel(data, 0);
4728 data.writeInt(pid);
4729 data.writeInt(uid);
4730 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004731 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004732 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004733 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4734 reply.readException();
4735 int res = reply.readInt();
4736 data.recycle();
4737 reply.recycle();
4738 return res;
4739 }
4740 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004741 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004742 Parcel data = Parcel.obtain();
4743 Parcel reply = Parcel.obtain();
4744 data.writeInterfaceToken(IActivityManager.descriptor);
4745 data.writeStrongBinder(caller.asBinder());
4746 data.writeString(targetPkg);
4747 uri.writeToParcel(data, 0);
4748 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004749 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004750 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4751 reply.readException();
4752 data.recycle();
4753 reply.recycle();
4754 }
4755 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004756 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004757 Parcel data = Parcel.obtain();
4758 Parcel reply = Parcel.obtain();
4759 data.writeInterfaceToken(IActivityManager.descriptor);
4760 data.writeStrongBinder(caller.asBinder());
4761 uri.writeToParcel(data, 0);
4762 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004763 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004764 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4765 reply.readException();
4766 data.recycle();
4767 reply.recycle();
4768 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004769
4770 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004771 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4772 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004773 Parcel data = Parcel.obtain();
4774 Parcel reply = Parcel.obtain();
4775 data.writeInterfaceToken(IActivityManager.descriptor);
4776 uri.writeToParcel(data, 0);
4777 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004778 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004779 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4780 reply.readException();
4781 data.recycle();
4782 reply.recycle();
4783 }
4784
4785 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004786 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4787 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004788 Parcel data = Parcel.obtain();
4789 Parcel reply = Parcel.obtain();
4790 data.writeInterfaceToken(IActivityManager.descriptor);
4791 uri.writeToParcel(data, 0);
4792 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004793 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004794 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4795 reply.readException();
4796 data.recycle();
4797 reply.recycle();
4798 }
4799
4800 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004801 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4802 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004803 Parcel data = Parcel.obtain();
4804 Parcel reply = Parcel.obtain();
4805 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004806 data.writeString(packageName);
4807 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004808 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4809 reply.readException();
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004810 @SuppressWarnings("unchecked")
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004811 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4812 reply);
4813 data.recycle();
4814 reply.recycle();
4815 return perms;
4816 }
4817
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004818 @Override
4819 public ParceledListSlice<UriPermission> getGrantedUriPermissions(String packageName, int userId)
4820 throws RemoteException {
4821 Parcel data = Parcel.obtain();
4822 Parcel reply = Parcel.obtain();
4823 data.writeInterfaceToken(IActivityManager.descriptor);
4824 data.writeString(packageName);
4825 data.writeInt(userId);
4826 mRemote.transact(GET_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4827 reply.readException();
4828 @SuppressWarnings("unchecked")
4829 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4830 reply);
4831 data.recycle();
4832 reply.recycle();
4833 return perms;
4834 }
4835
4836 @Override
4837 public void clearGrantedUriPermissions(String packageName, int userId) throws RemoteException {
4838 Parcel data = Parcel.obtain();
4839 Parcel reply = Parcel.obtain();
4840 data.writeInterfaceToken(IActivityManager.descriptor);
4841 data.writeString(packageName);
4842 data.writeInt(userId);
4843 mRemote.transact(CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4844 reply.readException();
4845 data.recycle();
4846 reply.recycle();
4847 }
4848
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004849 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4850 throws RemoteException {
4851 Parcel data = Parcel.obtain();
4852 Parcel reply = Parcel.obtain();
4853 data.writeInterfaceToken(IActivityManager.descriptor);
4854 data.writeStrongBinder(who.asBinder());
4855 data.writeInt(waiting ? 1 : 0);
4856 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4857 reply.readException();
4858 data.recycle();
4859 reply.recycle();
4860 }
4861 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4862 Parcel data = Parcel.obtain();
4863 Parcel reply = Parcel.obtain();
4864 data.writeInterfaceToken(IActivityManager.descriptor);
4865 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4866 reply.readException();
4867 outInfo.readFromParcel(reply);
4868 data.recycle();
4869 reply.recycle();
4870 }
4871 public void unhandledBack() throws RemoteException
4872 {
4873 Parcel data = Parcel.obtain();
4874 Parcel reply = Parcel.obtain();
4875 data.writeInterfaceToken(IActivityManager.descriptor);
4876 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4877 reply.readException();
4878 data.recycle();
4879 reply.recycle();
4880 }
4881 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4882 {
4883 Parcel data = Parcel.obtain();
4884 Parcel reply = Parcel.obtain();
4885 data.writeInterfaceToken(IActivityManager.descriptor);
4886 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4887 reply.readException();
4888 ParcelFileDescriptor pfd = null;
4889 if (reply.readInt() != 0) {
4890 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4891 }
4892 data.recycle();
4893 reply.recycle();
4894 return pfd;
4895 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004896 public void setLockScreenShown(boolean shown) throws RemoteException
4897 {
4898 Parcel data = Parcel.obtain();
4899 Parcel reply = Parcel.obtain();
4900 data.writeInterfaceToken(IActivityManager.descriptor);
4901 data.writeInt(shown ? 1 : 0);
4902 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4903 reply.readException();
4904 data.recycle();
4905 reply.recycle();
4906 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004907 public void setDebugApp(
4908 String packageName, boolean waitForDebugger, boolean persistent)
4909 throws RemoteException
4910 {
4911 Parcel data = Parcel.obtain();
4912 Parcel reply = Parcel.obtain();
4913 data.writeInterfaceToken(IActivityManager.descriptor);
4914 data.writeString(packageName);
4915 data.writeInt(waitForDebugger ? 1 : 0);
4916 data.writeInt(persistent ? 1 : 0);
4917 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4918 reply.readException();
4919 data.recycle();
4920 reply.recycle();
4921 }
4922 public void setAlwaysFinish(boolean enabled) throws RemoteException
4923 {
4924 Parcel data = Parcel.obtain();
4925 Parcel reply = Parcel.obtain();
4926 data.writeInterfaceToken(IActivityManager.descriptor);
4927 data.writeInt(enabled ? 1 : 0);
4928 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4929 reply.readException();
4930 data.recycle();
4931 reply.recycle();
4932 }
Dianne Hackborn4a18c262016-02-26 17:23:48 -08004933 public void setActivityController(IActivityController watcher, boolean imAMonkey)
4934 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004935 {
4936 Parcel data = Parcel.obtain();
4937 Parcel reply = Parcel.obtain();
4938 data.writeInterfaceToken(IActivityManager.descriptor);
4939 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackborn4a18c262016-02-26 17:23:48 -08004940 data.writeInt(imAMonkey ? 1 : 0);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004941 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004942 reply.readException();
4943 data.recycle();
4944 reply.recycle();
4945 }
Dianne Hackbornb2117d12016-02-16 18:26:35 -08004946 public void setLenientBackgroundCheck(boolean enabled) throws RemoteException
4947 {
4948 Parcel data = Parcel.obtain();
4949 Parcel reply = Parcel.obtain();
4950 data.writeInterfaceToken(IActivityManager.descriptor);
4951 data.writeInt(enabled ? 1 : 0);
4952 mRemote.transact(SET_LENIENT_BACKGROUND_CHECK_TRANSACTION, data, reply, 0);
4953 reply.readException();
4954 data.recycle();
4955 reply.recycle();
4956 }
Dianne Hackborn970510b2016-02-24 16:56:42 -08004957 public int getMemoryTrimLevel() throws RemoteException
4958 {
4959 Parcel data = Parcel.obtain();
4960 Parcel reply = Parcel.obtain();
4961 data.writeInterfaceToken(IActivityManager.descriptor);
4962 mRemote.transact(GET_MEMORY_TRIM_LEVEL_TRANSACTION, data, reply, 0);
4963 reply.readException();
4964 int level = reply.readInt();
4965 data.recycle();
4966 reply.recycle();
4967 return level;
4968 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004969 public void enterSafeMode() throws RemoteException {
4970 Parcel data = Parcel.obtain();
4971 data.writeInterfaceToken(IActivityManager.descriptor);
4972 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4973 data.recycle();
4974 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004975 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004976 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004977 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004978 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004979 data.writeStrongBinder(sender.asBinder());
4980 data.writeInt(sourceUid);
4981 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004982 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004983 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4984 data.recycle();
4985 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004986 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4987 throws RemoteException {
4988 Parcel data = Parcel.obtain();
4989 data.writeInterfaceToken(IActivityManager.descriptor);
4990 data.writeStrongBinder(sender.asBinder());
4991 data.writeInt(sourceUid);
4992 data.writeString(tag);
4993 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4994 data.recycle();
4995 }
4996 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4997 throws RemoteException {
4998 Parcel data = Parcel.obtain();
4999 data.writeInterfaceToken(IActivityManager.descriptor);
5000 data.writeStrongBinder(sender.asBinder());
5001 data.writeInt(sourceUid);
5002 data.writeString(tag);
5003 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
5004 data.recycle();
5005 }
Dianne Hackborn64825172011-03-02 21:32:58 -08005006 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005007 Parcel data = Parcel.obtain();
5008 Parcel reply = Parcel.obtain();
5009 data.writeInterfaceToken(IActivityManager.descriptor);
5010 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07005011 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08005012 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07005013 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005014 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005015 boolean res = reply.readInt() != 0;
5016 data.recycle();
5017 reply.recycle();
5018 return res;
5019 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07005020 @Override
5021 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
5022 Parcel data = Parcel.obtain();
5023 Parcel reply = Parcel.obtain();
5024 data.writeInterfaceToken(IActivityManager.descriptor);
5025 data.writeString(reason);
5026 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
5027 boolean res = reply.readInt() != 0;
5028 data.recycle();
5029 reply.recycle();
5030 return res;
5031 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005032 public boolean testIsSystemReady()
5033 {
5034 /* this base class version is never called */
5035 return true;
5036 }
Dan Egnor60d87622009-12-16 16:32:58 -08005037 public void handleApplicationCrash(IBinder app,
5038 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
5039 {
5040 Parcel data = Parcel.obtain();
5041 Parcel reply = Parcel.obtain();
5042 data.writeInterfaceToken(IActivityManager.descriptor);
5043 data.writeStrongBinder(app);
5044 crashInfo.writeToParcel(data, 0);
5045 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
5046 reply.readException();
5047 reply.recycle();
5048 data.recycle();
5049 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07005050
Dianne Hackborn52322712014-08-26 22:47:26 -07005051 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08005052 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005053 {
5054 Parcel data = Parcel.obtain();
5055 Parcel reply = Parcel.obtain();
5056 data.writeInterfaceToken(IActivityManager.descriptor);
5057 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005058 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07005059 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08005060 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08005061 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005062 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08005063 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005064 reply.recycle();
5065 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08005066 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005067 }
Dan Egnorb7f03672009-12-09 16:22:32 -08005068
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07005069 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07005070 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07005071 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07005072 {
5073 Parcel data = Parcel.obtain();
5074 Parcel reply = Parcel.obtain();
5075 data.writeInterfaceToken(IActivityManager.descriptor);
5076 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07005077 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07005078 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07005079 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
5080 reply.readException();
5081 reply.recycle();
5082 data.recycle();
5083 }
5084
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005085 public void signalPersistentProcesses(int sig) throws RemoteException {
5086 Parcel data = Parcel.obtain();
5087 Parcel reply = Parcel.obtain();
5088 data.writeInterfaceToken(IActivityManager.descriptor);
5089 data.writeInt(sig);
5090 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
5091 reply.readException();
5092 data.recycle();
5093 reply.recycle();
5094 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08005095
Dianne Hackborn1676c852012-09-10 14:52:30 -07005096 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005097 Parcel data = Parcel.obtain();
5098 Parcel reply = Parcel.obtain();
5099 data.writeInterfaceToken(IActivityManager.descriptor);
5100 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005101 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08005102 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
5103 reply.readException();
5104 data.recycle();
5105 reply.recycle();
5106 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08005107
5108 public void killAllBackgroundProcesses() throws RemoteException {
5109 Parcel data = Parcel.obtain();
5110 Parcel reply = Parcel.obtain();
5111 data.writeInterfaceToken(IActivityManager.descriptor);
5112 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
5113 reply.readException();
5114 data.recycle();
5115 reply.recycle();
5116 }
5117
Gustav Sennton6258dcd2015-10-30 19:25:37 +00005118 public void killPackageDependents(String packageName, int userId) throws RemoteException {
5119 Parcel data = Parcel.obtain();
5120 Parcel reply = Parcel.obtain();
5121 data.writeInterfaceToken(IActivityManager.descriptor);
5122 data.writeString(packageName);
5123 data.writeInt(userId);
5124 mRemote.transact(KILL_PACKAGE_DEPENDENTS_TRANSACTION, data, reply, 0);
5125 reply.readException();
5126 data.recycle();
5127 reply.recycle();
5128 }
5129
Dianne Hackborn1676c852012-09-10 14:52:30 -07005130 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08005131 Parcel data = Parcel.obtain();
5132 Parcel reply = Parcel.obtain();
5133 data.writeInterfaceToken(IActivityManager.descriptor);
5134 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005135 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08005136 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005137 reply.readException();
5138 data.recycle();
5139 reply.recycle();
5140 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005141
Dianne Hackborn27ff9132012-03-06 14:57:58 -08005142 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
5143 throws RemoteException
5144 {
5145 Parcel data = Parcel.obtain();
5146 Parcel reply = Parcel.obtain();
5147 data.writeInterfaceToken(IActivityManager.descriptor);
5148 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
5149 reply.readException();
5150 outInfo.readFromParcel(reply);
5151 reply.recycle();
5152 data.recycle();
5153 }
5154
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005155 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
5156 {
5157 Parcel data = Parcel.obtain();
5158 Parcel reply = Parcel.obtain();
5159 data.writeInterfaceToken(IActivityManager.descriptor);
5160 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
5161 reply.readException();
5162 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
5163 reply.recycle();
5164 data.recycle();
5165 return res;
5166 }
Jeff Hao1b012d32014-08-20 10:35:34 -07005167
Dianne Hackborn1676c852012-09-10 14:52:30 -07005168 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07005169 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005170 {
5171 Parcel data = Parcel.obtain();
5172 Parcel reply = Parcel.obtain();
5173 data.writeInterfaceToken(IActivityManager.descriptor);
5174 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005175 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005176 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07005177 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07005178 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07005179 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07005180 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07005181 } else {
5182 data.writeInt(0);
5183 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005184 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
5185 reply.readException();
5186 boolean res = reply.readInt() != 0;
5187 reply.recycle();
5188 data.recycle();
5189 return res;
5190 }
Jeff Hao1b012d32014-08-20 10:35:34 -07005191
Dianne Hackborn55280a92009-05-07 15:53:46 -07005192 public boolean shutdown(int timeout) throws RemoteException
5193 {
5194 Parcel data = Parcel.obtain();
5195 Parcel reply = Parcel.obtain();
5196 data.writeInterfaceToken(IActivityManager.descriptor);
5197 data.writeInt(timeout);
5198 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
5199 reply.readException();
5200 boolean res = reply.readInt() != 0;
5201 reply.recycle();
5202 data.recycle();
5203 return res;
5204 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005205
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005206 public void stopAppSwitches() throws RemoteException {
5207 Parcel data = Parcel.obtain();
5208 Parcel reply = Parcel.obtain();
5209 data.writeInterfaceToken(IActivityManager.descriptor);
5210 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
5211 reply.readException();
5212 reply.recycle();
5213 data.recycle();
5214 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005215
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005216 public void resumeAppSwitches() throws RemoteException {
5217 Parcel data = Parcel.obtain();
5218 Parcel reply = Parcel.obtain();
5219 data.writeInterfaceToken(IActivityManager.descriptor);
5220 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
5221 reply.readException();
5222 reply.recycle();
5223 data.recycle();
5224 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07005225
5226 public void addPackageDependency(String packageName) throws RemoteException {
5227 Parcel data = Parcel.obtain();
5228 Parcel reply = Parcel.obtain();
5229 data.writeInterfaceToken(IActivityManager.descriptor);
5230 data.writeString(packageName);
5231 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
5232 reply.readException();
5233 data.recycle();
5234 reply.recycle();
5235 }
5236
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005237 public void killApplicationWithAppId(String pkg, int appid, String reason)
5238 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005239 Parcel data = Parcel.obtain();
5240 Parcel reply = Parcel.obtain();
5241 data.writeInterfaceToken(IActivityManager.descriptor);
5242 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005243 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005244 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005245 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005246 reply.readException();
5247 data.recycle();
5248 reply.recycle();
5249 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005250
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07005251 public void closeSystemDialogs(String reason) throws RemoteException {
5252 Parcel data = Parcel.obtain();
5253 Parcel reply = Parcel.obtain();
5254 data.writeInterfaceToken(IActivityManager.descriptor);
5255 data.writeString(reason);
5256 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
5257 reply.readException();
5258 data.recycle();
5259 reply.recycle();
5260 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005261
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005262 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005263 throws RemoteException {
5264 Parcel data = Parcel.obtain();
5265 Parcel reply = Parcel.obtain();
5266 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005267 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005268 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
5269 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005270 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005271 data.recycle();
5272 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005273 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005274 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07005275
5276 public void killApplicationProcess(String processName, int uid) throws RemoteException {
5277 Parcel data = Parcel.obtain();
5278 Parcel reply = Parcel.obtain();
5279 data.writeInterfaceToken(IActivityManager.descriptor);
5280 data.writeString(processName);
5281 data.writeInt(uid);
5282 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
5283 reply.readException();
5284 data.recycle();
5285 reply.recycle();
5286 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005287
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07005288 public void overridePendingTransition(IBinder token, String packageName,
5289 int enterAnim, int exitAnim) throws RemoteException {
5290 Parcel data = Parcel.obtain();
5291 Parcel reply = Parcel.obtain();
5292 data.writeInterfaceToken(IActivityManager.descriptor);
5293 data.writeStrongBinder(token);
5294 data.writeString(packageName);
5295 data.writeInt(enterAnim);
5296 data.writeInt(exitAnim);
5297 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
5298 reply.readException();
5299 data.recycle();
5300 reply.recycle();
5301 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005302
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08005303 public boolean isUserAMonkey() throws RemoteException {
5304 Parcel data = Parcel.obtain();
5305 Parcel reply = Parcel.obtain();
5306 data.writeInterfaceToken(IActivityManager.descriptor);
5307 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
5308 reply.readException();
5309 boolean res = reply.readInt() != 0;
5310 data.recycle();
5311 reply.recycle();
5312 return res;
5313 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07005314
5315 public void setUserIsMonkey(boolean monkey) throws RemoteException {
5316 Parcel data = Parcel.obtain();
5317 Parcel reply = Parcel.obtain();
5318 data.writeInterfaceToken(IActivityManager.descriptor);
5319 data.writeInt(monkey ? 1 : 0);
5320 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
5321 reply.readException();
5322 data.recycle();
5323 reply.recycle();
5324 }
5325
Dianne Hackborn860755f2010-06-03 18:47:52 -07005326 public void finishHeavyWeightApp() throws RemoteException {
5327 Parcel data = Parcel.obtain();
5328 Parcel reply = Parcel.obtain();
5329 data.writeInterfaceToken(IActivityManager.descriptor);
5330 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
5331 reply.readException();
5332 data.recycle();
5333 reply.recycle();
5334 }
Craig Mautner4addfc52013-06-25 08:05:45 -07005335
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005336 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07005337 throws RemoteException {
5338 Parcel data = Parcel.obtain();
5339 Parcel reply = Parcel.obtain();
5340 data.writeInterfaceToken(IActivityManager.descriptor);
5341 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07005342 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
5343 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005344 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005345 data.recycle();
5346 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005347 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005348 }
5349
Craig Mautner233ceee2014-05-09 17:05:11 -07005350 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07005351 throws RemoteException {
5352 Parcel data = Parcel.obtain();
5353 Parcel reply = Parcel.obtain();
5354 data.writeInterfaceToken(IActivityManager.descriptor);
5355 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07005356 if (options == null) {
5357 data.writeInt(0);
5358 } else {
5359 data.writeInt(1);
5360 data.writeBundle(options.toBundle());
5361 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07005362 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07005363 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005364 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07005365 data.recycle();
5366 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005367 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07005368 }
5369
Craig Mautner233ceee2014-05-09 17:05:11 -07005370 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
5371 Parcel data = Parcel.obtain();
5372 Parcel reply = Parcel.obtain();
5373 data.writeInterfaceToken(IActivityManager.descriptor);
5374 data.writeStrongBinder(token);
5375 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
5376 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08005377 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07005378 data.recycle();
5379 reply.recycle();
5380 return options;
5381 }
5382
Daniel Sandler69a48172010-06-23 16:29:36 -04005383 public void setImmersive(IBinder token, boolean immersive)
5384 throws RemoteException {
5385 Parcel data = Parcel.obtain();
5386 Parcel reply = Parcel.obtain();
5387 data.writeInterfaceToken(IActivityManager.descriptor);
5388 data.writeStrongBinder(token);
5389 data.writeInt(immersive ? 1 : 0);
5390 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
5391 reply.readException();
5392 data.recycle();
5393 reply.recycle();
5394 }
5395
5396 public boolean isImmersive(IBinder token)
5397 throws RemoteException {
5398 Parcel data = Parcel.obtain();
5399 Parcel reply = Parcel.obtain();
5400 data.writeInterfaceToken(IActivityManager.descriptor);
5401 data.writeStrongBinder(token);
5402 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005403 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005404 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005405 data.recycle();
5406 reply.recycle();
5407 return res;
5408 }
5409
Craig Mautnerd61dc202014-07-07 11:09:11 -07005410 public boolean isTopOfTask(IBinder token) throws RemoteException {
5411 Parcel data = Parcel.obtain();
5412 Parcel reply = Parcel.obtain();
5413 data.writeInterfaceToken(IActivityManager.descriptor);
5414 data.writeStrongBinder(token);
5415 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
5416 reply.readException();
5417 boolean res = reply.readInt() == 1;
5418 data.recycle();
5419 reply.recycle();
5420 return res;
5421 }
5422
Daniel Sandler69a48172010-06-23 16:29:36 -04005423 public boolean isTopActivityImmersive()
5424 throws RemoteException {
5425 Parcel data = Parcel.obtain();
5426 Parcel reply = Parcel.obtain();
5427 data.writeInterfaceToken(IActivityManager.descriptor);
5428 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005429 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005430 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005431 data.recycle();
5432 reply.recycle();
5433 return res;
5434 }
5435
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005436 public void crashApplication(int uid, int initialPid, String packageName,
5437 String message) throws RemoteException {
5438 Parcel data = Parcel.obtain();
5439 Parcel reply = Parcel.obtain();
5440 data.writeInterfaceToken(IActivityManager.descriptor);
5441 data.writeInt(uid);
5442 data.writeInt(initialPid);
5443 data.writeString(packageName);
5444 data.writeString(message);
5445 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5446 reply.readException();
5447 data.recycle();
5448 reply.recycle();
5449 }
Andy McFadden824c5102010-07-09 16:26:57 -07005450
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005451 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005452 Parcel data = Parcel.obtain();
5453 Parcel reply = Parcel.obtain();
5454 data.writeInterfaceToken(IActivityManager.descriptor);
5455 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005456 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005457 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5458 reply.readException();
5459 String res = reply.readString();
5460 data.recycle();
5461 reply.recycle();
5462 return res;
5463 }
5464
Dianne Hackborn7e269642010-08-25 19:50:20 -07005465 public IBinder newUriPermissionOwner(String name)
5466 throws RemoteException {
5467 Parcel data = Parcel.obtain();
5468 Parcel reply = Parcel.obtain();
5469 data.writeInterfaceToken(IActivityManager.descriptor);
5470 data.writeString(name);
5471 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5472 reply.readException();
5473 IBinder res = reply.readStrongBinder();
5474 data.recycle();
5475 reply.recycle();
5476 return res;
5477 }
5478
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08005479 public IBinder getUriPermissionOwnerForActivity(IBinder activityToken) throws RemoteException {
5480 Parcel data = Parcel.obtain();
5481 Parcel reply = Parcel.obtain();
5482 data.writeInterfaceToken(IActivityManager.descriptor);
5483 data.writeStrongBinder(activityToken);
5484 mRemote.transact(GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
5485 reply.readException();
5486 IBinder res = reply.readStrongBinder();
5487 data.recycle();
5488 reply.recycle();
5489 return res;
5490 }
5491
Dianne Hackborn7e269642010-08-25 19:50:20 -07005492 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005493 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005494 Parcel data = Parcel.obtain();
5495 Parcel reply = Parcel.obtain();
5496 data.writeInterfaceToken(IActivityManager.descriptor);
5497 data.writeStrongBinder(owner);
5498 data.writeInt(fromUid);
5499 data.writeString(targetPkg);
5500 uri.writeToParcel(data, 0);
5501 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005502 data.writeInt(sourceUserId);
5503 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005504 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5505 reply.readException();
5506 data.recycle();
5507 reply.recycle();
5508 }
5509
5510 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005511 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005512 Parcel data = Parcel.obtain();
5513 Parcel reply = Parcel.obtain();
5514 data.writeInterfaceToken(IActivityManager.descriptor);
5515 data.writeStrongBinder(owner);
5516 if (uri != null) {
5517 data.writeInt(1);
5518 uri.writeToParcel(data, 0);
5519 } else {
5520 data.writeInt(0);
5521 }
5522 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005523 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005524 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5525 reply.readException();
5526 data.recycle();
5527 reply.recycle();
5528 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005529
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005530 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005531 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005532 Parcel data = Parcel.obtain();
5533 Parcel reply = Parcel.obtain();
5534 data.writeInterfaceToken(IActivityManager.descriptor);
5535 data.writeInt(callingUid);
5536 data.writeString(targetPkg);
5537 uri.writeToParcel(data, 0);
5538 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005539 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005540 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5541 reply.readException();
5542 int res = reply.readInt();
5543 data.recycle();
5544 reply.recycle();
5545 return res;
5546 }
5547
Dianne Hackborn1676c852012-09-10 14:52:30 -07005548 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005549 String path, ParcelFileDescriptor fd) throws RemoteException {
5550 Parcel data = Parcel.obtain();
5551 Parcel reply = Parcel.obtain();
5552 data.writeInterfaceToken(IActivityManager.descriptor);
5553 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005554 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005555 data.writeInt(managed ? 1 : 0);
5556 data.writeString(path);
5557 if (fd != null) {
5558 data.writeInt(1);
5559 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5560 } else {
5561 data.writeInt(0);
5562 }
5563 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5564 reply.readException();
5565 boolean res = reply.readInt() != 0;
5566 reply.recycle();
5567 data.recycle();
5568 return res;
5569 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005570
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005571 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005572 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005573 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005574 Parcel data = Parcel.obtain();
5575 Parcel reply = Parcel.obtain();
5576 data.writeInterfaceToken(IActivityManager.descriptor);
5577 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005578 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005579 data.writeTypedArray(intents, 0);
5580 data.writeStringArray(resolvedTypes);
5581 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005582 if (options != null) {
5583 data.writeInt(1);
5584 options.writeToParcel(data, 0);
5585 } else {
5586 data.writeInt(0);
5587 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005588 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005589 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5590 reply.readException();
5591 int result = reply.readInt();
5592 reply.recycle();
5593 data.recycle();
5594 return result;
5595 }
5596
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005597 public int getFrontActivityScreenCompatMode() throws RemoteException {
5598 Parcel data = Parcel.obtain();
5599 Parcel reply = Parcel.obtain();
5600 data.writeInterfaceToken(IActivityManager.descriptor);
5601 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5602 reply.readException();
5603 int mode = reply.readInt();
5604 reply.recycle();
5605 data.recycle();
5606 return mode;
5607 }
5608
5609 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5610 Parcel data = Parcel.obtain();
5611 Parcel reply = Parcel.obtain();
5612 data.writeInterfaceToken(IActivityManager.descriptor);
5613 data.writeInt(mode);
5614 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5615 reply.readException();
5616 reply.recycle();
5617 data.recycle();
5618 }
5619
5620 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5621 Parcel data = Parcel.obtain();
5622 Parcel reply = Parcel.obtain();
5623 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005624 data.writeString(packageName);
5625 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005626 reply.readException();
5627 int mode = reply.readInt();
5628 reply.recycle();
5629 data.recycle();
5630 return mode;
5631 }
5632
5633 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005634 throws RemoteException {
5635 Parcel data = Parcel.obtain();
5636 Parcel reply = Parcel.obtain();
5637 data.writeInterfaceToken(IActivityManager.descriptor);
5638 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005639 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005640 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5641 reply.readException();
5642 reply.recycle();
5643 data.recycle();
5644 }
5645
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005646 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5647 Parcel data = Parcel.obtain();
5648 Parcel reply = Parcel.obtain();
5649 data.writeInterfaceToken(IActivityManager.descriptor);
5650 data.writeString(packageName);
5651 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5652 reply.readException();
5653 boolean ask = reply.readInt() != 0;
5654 reply.recycle();
5655 data.recycle();
5656 return ask;
5657 }
5658
5659 public void setPackageAskScreenCompat(String packageName, boolean ask)
5660 throws RemoteException {
5661 Parcel data = Parcel.obtain();
5662 Parcel reply = Parcel.obtain();
5663 data.writeInterfaceToken(IActivityManager.descriptor);
5664 data.writeString(packageName);
5665 data.writeInt(ask ? 1 : 0);
5666 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5667 reply.readException();
5668 reply.recycle();
5669 data.recycle();
5670 }
5671
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005672 public boolean switchUser(int userid) throws RemoteException {
5673 Parcel data = Parcel.obtain();
5674 Parcel reply = Parcel.obtain();
5675 data.writeInterfaceToken(IActivityManager.descriptor);
5676 data.writeInt(userid);
5677 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5678 reply.readException();
5679 boolean result = reply.readInt() != 0;
5680 reply.recycle();
5681 data.recycle();
5682 return result;
5683 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005684
Kenny Guy08488bf2014-02-21 17:40:37 +00005685 public boolean startUserInBackground(int userid) throws RemoteException {
5686 Parcel data = Parcel.obtain();
5687 Parcel reply = Parcel.obtain();
5688 data.writeInterfaceToken(IActivityManager.descriptor);
5689 data.writeInt(userid);
5690 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5691 reply.readException();
5692 boolean result = reply.readInt() != 0;
5693 reply.recycle();
5694 data.recycle();
5695 return result;
5696 }
5697
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00005698 public boolean unlockUser(int userId, byte[] token, byte[] secret) throws RemoteException {
Jeff Sharkeyba512352015-11-12 20:17:45 -08005699 Parcel data = Parcel.obtain();
5700 Parcel reply = Parcel.obtain();
5701 data.writeInterfaceToken(IActivityManager.descriptor);
5702 data.writeInt(userId);
5703 data.writeByteArray(token);
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00005704 data.writeByteArray(secret);
Jeff Sharkeyba512352015-11-12 20:17:45 -08005705 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5706 reply.readException();
5707 boolean result = reply.readInt() != 0;
5708 reply.recycle();
5709 data.recycle();
5710 return result;
5711 }
5712
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005713 public int stopUser(int userid, boolean force, IStopUserCallback callback)
5714 throws RemoteException {
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005715 Parcel data = Parcel.obtain();
5716 Parcel reply = Parcel.obtain();
5717 data.writeInterfaceToken(IActivityManager.descriptor);
5718 data.writeInt(userid);
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005719 data.writeInt(force ? 1 : 0);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005720 data.writeStrongInterface(callback);
5721 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5722 reply.readException();
5723 int result = reply.readInt();
5724 reply.recycle();
5725 data.recycle();
5726 return result;
5727 }
5728
Amith Yamasani52f1d752012-03-28 18:19:29 -07005729 public UserInfo getCurrentUser() throws RemoteException {
5730 Parcel data = Parcel.obtain();
5731 Parcel reply = Parcel.obtain();
5732 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005733 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005734 reply.readException();
5735 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5736 reply.recycle();
5737 data.recycle();
5738 return userInfo;
5739 }
5740
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005741 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005742 Parcel data = Parcel.obtain();
5743 Parcel reply = Parcel.obtain();
5744 data.writeInterfaceToken(IActivityManager.descriptor);
5745 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005746 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005747 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5748 reply.readException();
5749 boolean result = reply.readInt() != 0;
5750 reply.recycle();
5751 data.recycle();
5752 return result;
5753 }
5754
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005755 public int[] getRunningUserIds() throws RemoteException {
5756 Parcel data = Parcel.obtain();
5757 Parcel reply = Parcel.obtain();
5758 data.writeInterfaceToken(IActivityManager.descriptor);
5759 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5760 reply.readException();
5761 int[] result = reply.createIntArray();
5762 reply.recycle();
5763 data.recycle();
5764 return result;
5765 }
5766
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005767 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005768 Parcel data = Parcel.obtain();
5769 Parcel reply = Parcel.obtain();
5770 data.writeInterfaceToken(IActivityManager.descriptor);
5771 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005772 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5773 reply.readException();
5774 boolean result = reply.readInt() != 0;
5775 reply.recycle();
5776 data.recycle();
5777 return result;
5778 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005779
Jeff Sharkeya4620792011-05-20 15:29:23 -07005780 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5781 Parcel data = Parcel.obtain();
5782 Parcel reply = Parcel.obtain();
5783 data.writeInterfaceToken(IActivityManager.descriptor);
5784 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5785 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5786 reply.readException();
5787 data.recycle();
5788 reply.recycle();
5789 }
5790
5791 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5792 Parcel data = Parcel.obtain();
5793 Parcel reply = Parcel.obtain();
5794 data.writeInterfaceToken(IActivityManager.descriptor);
5795 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5796 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5797 reply.readException();
5798 data.recycle();
5799 reply.recycle();
5800 }
5801
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005802 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005803 Parcel data = Parcel.obtain();
5804 Parcel reply = Parcel.obtain();
5805 data.writeInterfaceToken(IActivityManager.descriptor);
5806 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005807 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005808 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5809 reply.readException();
5810 data.recycle();
5811 reply.recycle();
5812 }
5813
5814 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5815 Parcel data = Parcel.obtain();
5816 Parcel reply = Parcel.obtain();
5817 data.writeInterfaceToken(IActivityManager.descriptor);
5818 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5819 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5820 reply.readException();
5821 data.recycle();
5822 reply.recycle();
5823 }
5824
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005825 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5826 Parcel data = Parcel.obtain();
5827 Parcel reply = Parcel.obtain();
5828 data.writeInterfaceToken(IActivityManager.descriptor);
5829 data.writeStrongBinder(sender.asBinder());
5830 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5831 reply.readException();
5832 boolean res = reply.readInt() != 0;
5833 data.recycle();
5834 reply.recycle();
5835 return res;
5836 }
5837
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005838 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5839 Parcel data = Parcel.obtain();
5840 Parcel reply = Parcel.obtain();
5841 data.writeInterfaceToken(IActivityManager.descriptor);
5842 data.writeStrongBinder(sender.asBinder());
5843 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5844 reply.readException();
5845 boolean res = reply.readInt() != 0;
5846 data.recycle();
5847 reply.recycle();
5848 return res;
5849 }
5850
Dianne Hackborn81038902012-11-26 17:04:09 -08005851 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5852 Parcel data = Parcel.obtain();
5853 Parcel reply = Parcel.obtain();
5854 data.writeInterfaceToken(IActivityManager.descriptor);
5855 data.writeStrongBinder(sender.asBinder());
5856 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5857 reply.readException();
5858 Intent res = reply.readInt() != 0
5859 ? Intent.CREATOR.createFromParcel(reply) : null;
5860 data.recycle();
5861 reply.recycle();
5862 return res;
5863 }
5864
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005865 public String getTagForIntentSender(IIntentSender sender, String prefix)
5866 throws RemoteException {
5867 Parcel data = Parcel.obtain();
5868 Parcel reply = Parcel.obtain();
5869 data.writeInterfaceToken(IActivityManager.descriptor);
5870 data.writeStrongBinder(sender.asBinder());
5871 data.writeString(prefix);
5872 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5873 reply.readException();
5874 String res = reply.readString();
5875 data.recycle();
5876 reply.recycle();
5877 return res;
5878 }
5879
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005880 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5881 {
5882 Parcel data = Parcel.obtain();
5883 Parcel reply = Parcel.obtain();
5884 data.writeInterfaceToken(IActivityManager.descriptor);
5885 values.writeToParcel(data, 0);
5886 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5887 reply.readException();
5888 data.recycle();
5889 reply.recycle();
5890 }
5891
Dianne Hackbornb437e092011-08-05 17:50:29 -07005892 public long[] getProcessPss(int[] pids) throws RemoteException {
5893 Parcel data = Parcel.obtain();
5894 Parcel reply = Parcel.obtain();
5895 data.writeInterfaceToken(IActivityManager.descriptor);
5896 data.writeIntArray(pids);
5897 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5898 reply.readException();
5899 long[] res = reply.createLongArray();
5900 data.recycle();
5901 reply.recycle();
5902 return res;
5903 }
5904
Dianne Hackborn661cd522011-08-22 00:26:20 -07005905 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5906 Parcel data = Parcel.obtain();
5907 Parcel reply = Parcel.obtain();
5908 data.writeInterfaceToken(IActivityManager.descriptor);
5909 TextUtils.writeToParcel(msg, data, 0);
5910 data.writeInt(always ? 1 : 0);
5911 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5912 reply.readException();
5913 data.recycle();
5914 reply.recycle();
5915 }
5916
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005917 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005918 Parcel data = Parcel.obtain();
5919 Parcel reply = Parcel.obtain();
5920 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005921 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005922 reply.readException();
5923 data.recycle();
5924 reply.recycle();
5925 }
5926
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005927 public void keyguardGoingAway(boolean disableWindowAnimations,
5928 boolean keyguardGoingToNotificationShade) throws RemoteException {
5929 Parcel data = Parcel.obtain();
5930 Parcel reply = Parcel.obtain();
5931 data.writeInterfaceToken(IActivityManager.descriptor);
5932 data.writeInt(disableWindowAnimations ? 1 : 0);
5933 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5934 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5935 reply.readException();
5936 data.recycle();
5937 reply.recycle();
5938 }
5939
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005940 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005941 throws RemoteException {
5942 Parcel data = Parcel.obtain();
5943 Parcel reply = Parcel.obtain();
5944 data.writeInterfaceToken(IActivityManager.descriptor);
5945 data.writeStrongBinder(token);
5946 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005947 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005948 reply.readException();
5949 boolean result = reply.readInt() != 0;
5950 data.recycle();
5951 reply.recycle();
5952 return result;
5953 }
5954
5955 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5956 throws RemoteException {
5957 Parcel data = Parcel.obtain();
5958 Parcel reply = Parcel.obtain();
5959 data.writeInterfaceToken(IActivityManager.descriptor);
5960 data.writeStrongBinder(token);
5961 target.writeToParcel(data, 0);
5962 data.writeInt(resultCode);
5963 if (resultData != null) {
5964 data.writeInt(1);
5965 resultData.writeToParcel(data, 0);
5966 } else {
5967 data.writeInt(0);
5968 }
5969 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5970 reply.readException();
5971 boolean result = reply.readInt() != 0;
5972 data.recycle();
5973 reply.recycle();
5974 return result;
5975 }
5976
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005977 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5978 Parcel data = Parcel.obtain();
5979 Parcel reply = Parcel.obtain();
5980 data.writeInterfaceToken(IActivityManager.descriptor);
5981 data.writeStrongBinder(activityToken);
5982 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5983 reply.readException();
5984 int result = reply.readInt();
5985 data.recycle();
5986 reply.recycle();
5987 return result;
5988 }
5989
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005990 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5991 Parcel data = Parcel.obtain();
5992 Parcel reply = Parcel.obtain();
5993 data.writeInterfaceToken(IActivityManager.descriptor);
5994 data.writeStrongBinder(activityToken);
5995 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5996 reply.readException();
5997 String result = reply.readString();
5998 data.recycle();
5999 reply.recycle();
6000 return result;
6001 }
6002
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07006003 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
6004 Parcel data = Parcel.obtain();
6005 Parcel reply = Parcel.obtain();
6006 data.writeInterfaceToken(IActivityManager.descriptor);
6007 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
6008 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
6009 reply.readException();
6010 data.recycle();
6011 reply.recycle();
6012 }
6013
6014 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
6015 Parcel data = Parcel.obtain();
6016 Parcel reply = Parcel.obtain();
6017 data.writeInterfaceToken(IActivityManager.descriptor);
6018 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
6019 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
6020 reply.readException();
6021 data.recycle();
6022 reply.recycle();
6023 }
6024
Michal Karpinski3da5c972015-12-11 18:16:30 +00006025 public void requestBugReport(@ActivityManager.BugreportMode int bugreportType)
6026 throws RemoteException {
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07006027 Parcel data = Parcel.obtain();
6028 Parcel reply = Parcel.obtain();
6029 data.writeInterfaceToken(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00006030 data.writeInt(bugreportType);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07006031 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
6032 reply.readException();
6033 data.recycle();
6034 reply.recycle();
6035 }
6036
Jeff Brownbd181bb2013-09-10 16:44:24 -07006037 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
6038 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07006039 Parcel data = Parcel.obtain();
6040 Parcel reply = Parcel.obtain();
6041 data.writeInterfaceToken(IActivityManager.descriptor);
6042 data.writeInt(pid);
6043 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07006044 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07006045 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
6046 reply.readException();
6047 long res = reply.readInt();
6048 data.recycle();
6049 reply.recycle();
6050 return res;
6051 }
6052
Adam Skorydfc7fd72013-08-05 19:23:41 -07006053 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08006054 Parcel data = Parcel.obtain();
6055 Parcel reply = Parcel.obtain();
6056 data.writeInterfaceToken(IActivityManager.descriptor);
6057 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07006058 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08006059 reply.readException();
6060 Bundle res = reply.readBundle();
6061 data.recycle();
6062 reply.recycle();
6063 return res;
6064 }
6065
Dianne Hackborn17f69352015-07-17 18:04:14 -07006066 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
6067 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08006068 Parcel data = Parcel.obtain();
6069 Parcel reply = Parcel.obtain();
6070 data.writeInterfaceToken(IActivityManager.descriptor);
6071 data.writeInt(requestType);
6072 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07006073 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08006074 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
6075 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07006076 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08006077 data.recycle();
6078 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07006079 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08006080 }
6081
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07006082 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07006083 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08006084 Parcel data = Parcel.obtain();
6085 Parcel reply = Parcel.obtain();
6086 data.writeInterfaceToken(IActivityManager.descriptor);
6087 data.writeStrongBinder(token);
6088 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07006089 structure.writeToParcel(data, 0);
6090 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07006091 if (referrer != null) {
6092 data.writeInt(1);
6093 referrer.writeToParcel(data, 0);
6094 } else {
6095 data.writeInt(0);
6096 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07006097 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08006098 reply.readException();
6099 data.recycle();
6100 reply.recycle();
6101 }
6102
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07006103 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
6104 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07006105 Parcel data = Parcel.obtain();
6106 Parcel reply = Parcel.obtain();
6107 data.writeInterfaceToken(IActivityManager.descriptor);
6108 intent.writeToParcel(data, 0);
6109 data.writeInt(requestType);
6110 data.writeString(hint);
6111 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07006112 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07006113 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
6114 reply.readException();
6115 boolean res = reply.readInt() != 0;
6116 data.recycle();
6117 reply.recycle();
6118 return res;
6119 }
6120
Dianne Hackborn17f69352015-07-17 18:04:14 -07006121 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01006122 Parcel data = Parcel.obtain();
6123 Parcel reply = Parcel.obtain();
6124 data.writeInterfaceToken(IActivityManager.descriptor);
6125 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
6126 reply.readException();
6127 boolean res = reply.readInt() != 0;
6128 data.recycle();
6129 reply.recycle();
6130 return res;
6131 }
6132
Dianne Hackborn17f69352015-07-17 18:04:14 -07006133 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
6134 Parcel data = Parcel.obtain();
6135 Parcel reply = Parcel.obtain();
6136 data.writeInterfaceToken(IActivityManager.descriptor);
6137 data.writeStrongBinder(token);
6138 data.writeBundle(args);
6139 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
6140 reply.readException();
6141 boolean res = reply.readInt() != 0;
6142 data.recycle();
6143 reply.recycle();
6144 return res;
6145 }
6146
Svetoslavaa41add2015-08-06 15:03:55 -07006147 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07006148 Parcel data = Parcel.obtain();
6149 Parcel reply = Parcel.obtain();
6150 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07006151 data.writeInt(appId);
6152 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07006153 data.writeString(reason);
6154 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
6155 reply.readException();
6156 data.recycle();
6157 reply.recycle();
6158 }
6159
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07006160 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
6161 Parcel data = Parcel.obtain();
6162 Parcel reply = Parcel.obtain();
6163 data.writeInterfaceToken(IActivityManager.descriptor);
6164 data.writeStrongBinder(who);
6165 data.writeInt(allowRestart ? 1 : 0);
6166 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
6167 reply.readException();
6168 data.recycle();
6169 reply.recycle();
6170 }
6171
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07006172 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
6173 Parcel data = Parcel.obtain();
6174 Parcel reply = Parcel.obtain();
6175 data.writeInterfaceToken(IActivityManager.descriptor);
6176 data.writeStrongBinder(token);
6177 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
6178 reply.readException();
6179 data.recycle();
6180 reply.recycle();
6181 }
6182
Craig Mautner5eda9b32013-07-02 11:58:16 -07006183 public void notifyActivityDrawn(IBinder token) throws RemoteException {
6184 Parcel data = Parcel.obtain();
6185 Parcel reply = Parcel.obtain();
6186 data.writeInterfaceToken(IActivityManager.descriptor);
6187 data.writeStrongBinder(token);
6188 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
6189 reply.readException();
6190 data.recycle();
6191 reply.recycle();
6192 }
6193
Dianne Hackborn57a7f592013-07-22 18:21:32 -07006194 public void restart() throws RemoteException {
6195 Parcel data = Parcel.obtain();
6196 Parcel reply = Parcel.obtain();
6197 data.writeInterfaceToken(IActivityManager.descriptor);
6198 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
6199 reply.readException();
6200 data.recycle();
6201 reply.recycle();
6202 }
6203
Dianne Hackborn35f72be2013-09-16 10:57:39 -07006204 public void performIdleMaintenance() throws RemoteException {
6205 Parcel data = Parcel.obtain();
6206 Parcel reply = Parcel.obtain();
6207 data.writeInterfaceToken(IActivityManager.descriptor);
6208 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
6209 reply.readException();
6210 data.recycle();
6211 reply.recycle();
6212 }
6213
Todd Kennedyca4d8422015-01-15 15:19:22 -08006214 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08006215 IActivityContainerCallback callback) throws RemoteException {
6216 Parcel data = Parcel.obtain();
6217 Parcel reply = Parcel.obtain();
6218 data.writeInterfaceToken(IActivityManager.descriptor);
6219 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07006220 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08006221 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08006222 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08006223 final int result = reply.readInt();
6224 final IActivityContainer res;
6225 if (result == 1) {
6226 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6227 } else {
6228 res = null;
6229 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08006230 data.recycle();
6231 reply.recycle();
6232 return res;
6233 }
6234
Craig Mautner95da1082014-02-24 17:54:35 -08006235 public void deleteActivityContainer(IActivityContainer activityContainer)
6236 throws RemoteException {
6237 Parcel data = Parcel.obtain();
6238 Parcel reply = Parcel.obtain();
6239 data.writeInterfaceToken(IActivityManager.descriptor);
6240 data.writeStrongBinder(activityContainer.asBinder());
6241 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
6242 reply.readException();
6243 data.recycle();
6244 reply.recycle();
6245 }
6246
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04006247 public boolean startBinderTracking() throws RemoteException {
6248 Parcel data = Parcel.obtain();
6249 Parcel reply = Parcel.obtain();
6250 data.writeInterfaceToken(IActivityManager.descriptor);
6251 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
6252 reply.readException();
6253 boolean res = reply.readInt() != 0;
6254 reply.recycle();
6255 data.recycle();
6256 return res;
6257 }
6258
6259 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
6260 Parcel data = Parcel.obtain();
6261 Parcel reply = Parcel.obtain();
6262 data.writeInterfaceToken(IActivityManager.descriptor);
6263 if (fd != null) {
6264 data.writeInt(1);
6265 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
6266 } else {
6267 data.writeInt(0);
6268 }
6269 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
6270 reply.readException();
6271 boolean res = reply.readInt() != 0;
6272 reply.recycle();
6273 data.recycle();
6274 return res;
6275 }
6276
Ruben Brunke24b9a62016-02-16 21:38:24 -08006277 public int setVrMode(IBinder token, boolean enabled, ComponentName packageName)
6278 throws RemoteException {
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006279 Parcel data = Parcel.obtain();
6280 Parcel reply = Parcel.obtain();
6281 data.writeInterfaceToken(IActivityManager.descriptor);
6282 data.writeStrongBinder(token);
6283 data.writeInt(enabled ? 1 : 0);
Ruben Brunke24b9a62016-02-16 21:38:24 -08006284 packageName.writeToParcel(data, 0);
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006285 mRemote.transact(SET_VR_MODE_TRANSACTION, data, reply, 0);
6286 reply.readException();
Ruben Brunke24b9a62016-02-16 21:38:24 -08006287 int res = reply.readInt();
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006288 data.recycle();
6289 reply.recycle();
Ruben Brunke24b9a62016-02-16 21:38:24 -08006290 return res;
6291 }
6292
6293 public boolean isVrModePackageEnabled(ComponentName packageName)
6294 throws RemoteException {
6295 Parcel data = Parcel.obtain();
6296 Parcel reply = Parcel.obtain();
6297 data.writeInterfaceToken(IActivityManager.descriptor);
6298 packageName.writeToParcel(data, 0);
6299 mRemote.transact(IS_VR_PACKAGE_ENABLED_TRANSACTION, data, reply, 0);
6300 reply.readException();
6301 int res = reply.readInt();
6302 data.recycle();
6303 reply.recycle();
6304 return res == 1;
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006305 }
6306
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006307 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08006308 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
6309 Parcel data = Parcel.obtain();
6310 Parcel reply = Parcel.obtain();
6311 data.writeInterfaceToken(IActivityManager.descriptor);
6312 data.writeInt(displayId);
6313 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
6314 reply.readException();
6315 final int result = reply.readInt();
6316 final IActivityContainer res;
6317 if (result == 1) {
6318 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6319 } else {
6320 res = null;
6321 }
6322 data.recycle();
6323 reply.recycle();
6324 return res;
6325 }
6326
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006327 @Override
6328 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08006329 throws RemoteException {
6330 Parcel data = Parcel.obtain();
6331 Parcel reply = Parcel.obtain();
6332 data.writeInterfaceToken(IActivityManager.descriptor);
6333 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006334 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08006335 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006336 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08006337 data.recycle();
6338 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006339 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08006340 }
6341
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006342 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006343 public void startLockTaskMode(int taskId) throws RemoteException {
6344 Parcel data = Parcel.obtain();
6345 Parcel reply = Parcel.obtain();
6346 data.writeInterfaceToken(IActivityManager.descriptor);
6347 data.writeInt(taskId);
6348 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
6349 reply.readException();
6350 data.recycle();
6351 reply.recycle();
6352 }
6353
6354 @Override
6355 public void startLockTaskMode(IBinder token) throws RemoteException {
6356 Parcel data = Parcel.obtain();
6357 Parcel reply = Parcel.obtain();
6358 data.writeInterfaceToken(IActivityManager.descriptor);
6359 data.writeStrongBinder(token);
6360 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
6361 reply.readException();
6362 data.recycle();
6363 reply.recycle();
6364 }
6365
6366 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006367 public void startLockTaskModeOnCurrent() throws RemoteException {
6368 Parcel data = Parcel.obtain();
6369 Parcel reply = Parcel.obtain();
6370 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006371 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006372 reply.readException();
6373 data.recycle();
6374 reply.recycle();
6375 }
6376
6377 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006378 public void stopLockTaskMode() throws RemoteException {
6379 Parcel data = Parcel.obtain();
6380 Parcel reply = Parcel.obtain();
6381 data.writeInterfaceToken(IActivityManager.descriptor);
6382 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6383 reply.readException();
6384 data.recycle();
6385 reply.recycle();
6386 }
6387
6388 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006389 public void stopLockTaskModeOnCurrent() throws RemoteException {
6390 Parcel data = Parcel.obtain();
6391 Parcel reply = Parcel.obtain();
6392 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006393 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006394 reply.readException();
6395 data.recycle();
6396 reply.recycle();
6397 }
6398
6399 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006400 public boolean isInLockTaskMode() throws RemoteException {
6401 Parcel data = Parcel.obtain();
6402 Parcel reply = Parcel.obtain();
6403 data.writeInterfaceToken(IActivityManager.descriptor);
6404 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6405 reply.readException();
6406 boolean isInLockTaskMode = reply.readInt() == 1;
6407 data.recycle();
6408 reply.recycle();
6409 return isInLockTaskMode;
6410 }
6411
Craig Mautner688b5102014-03-27 16:55:03 -07006412 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00006413 public int getLockTaskModeState() throws RemoteException {
6414 Parcel data = Parcel.obtain();
6415 Parcel reply = Parcel.obtain();
6416 data.writeInterfaceToken(IActivityManager.descriptor);
6417 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
6418 reply.readException();
6419 int lockTaskModeState = reply.readInt();
6420 data.recycle();
6421 reply.recycle();
6422 return lockTaskModeState;
6423 }
6424
6425 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07006426 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
6427 Parcel data = Parcel.obtain();
6428 Parcel reply = Parcel.obtain();
6429 data.writeInterfaceToken(IActivityManager.descriptor);
6430 data.writeStrongBinder(token);
6431 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
6432 IBinder.FLAG_ONEWAY);
6433 reply.readException();
6434 data.recycle();
6435 reply.recycle();
6436 }
6437
6438 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07006439 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07006440 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07006441 Parcel data = Parcel.obtain();
6442 Parcel reply = Parcel.obtain();
6443 data.writeInterfaceToken(IActivityManager.descriptor);
6444 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07006445 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006446 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07006447 reply.readException();
6448 data.recycle();
6449 reply.recycle();
6450 }
6451
Craig Mautneree2e45a2014-06-27 12:10:03 -07006452 @Override
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08006453 public void setTaskResizeable(int taskId, int resizeableMode) throws RemoteException {
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006454 Parcel data = Parcel.obtain();
6455 Parcel reply = Parcel.obtain();
6456 data.writeInterfaceToken(IActivityManager.descriptor);
6457 data.writeInt(taskId);
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08006458 data.writeInt(resizeableMode);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006459 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006460 reply.readException();
6461 data.recycle();
6462 reply.recycle();
6463 }
6464
6465 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07006466 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006467 {
6468 Parcel data = Parcel.obtain();
6469 Parcel reply = Parcel.obtain();
6470 data.writeInterfaceToken(IActivityManager.descriptor);
6471 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006472 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006473 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006474 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006475 reply.readException();
6476 data.recycle();
6477 reply.recycle();
6478 }
6479
6480 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006481 public Rect getTaskBounds(int taskId) throws RemoteException
6482 {
6483 Parcel data = Parcel.obtain();
6484 Parcel reply = Parcel.obtain();
6485 data.writeInterfaceToken(IActivityManager.descriptor);
6486 data.writeInt(taskId);
6487 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6488 reply.readException();
6489 Rect rect = Rect.CREATOR.createFromParcel(reply);
6490 data.recycle();
6491 reply.recycle();
6492 return rect;
6493 }
6494
6495 @Override
Suprabh Shukla23593142015-11-03 17:31:15 -08006496 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException {
Craig Mautner648f69b2014-09-18 14:16:26 -07006497 Parcel data = Parcel.obtain();
6498 Parcel reply = Parcel.obtain();
6499 data.writeInterfaceToken(IActivityManager.descriptor);
6500 data.writeString(filename);
Suprabh Shukla23593142015-11-03 17:31:15 -08006501 data.writeInt(userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07006502 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6503 reply.readException();
6504 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6505 data.recycle();
6506 reply.recycle();
6507 return icon;
6508 }
6509
6510 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006511 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6512 throws RemoteException {
6513 Parcel data = Parcel.obtain();
6514 Parcel reply = Parcel.obtain();
6515 data.writeInterfaceToken(IActivityManager.descriptor);
6516 if (options == null) {
6517 data.writeInt(0);
6518 } else {
6519 data.writeInt(1);
6520 data.writeBundle(options.toBundle());
6521 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006522 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006523 reply.readException();
6524 data.recycle();
6525 reply.recycle();
6526 }
6527
6528 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006529 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006530 Parcel data = Parcel.obtain();
6531 Parcel reply = Parcel.obtain();
6532 data.writeInterfaceToken(IActivityManager.descriptor);
6533 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006534 data.writeInt(visible ? 1 : 0);
6535 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006536 reply.readException();
6537 boolean success = reply.readInt() > 0;
6538 data.recycle();
6539 reply.recycle();
6540 return success;
6541 }
6542
6543 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006544 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006545 Parcel data = Parcel.obtain();
6546 Parcel reply = Parcel.obtain();
6547 data.writeInterfaceToken(IActivityManager.descriptor);
6548 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006549 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006550 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006551 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006552 data.recycle();
6553 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006554 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006555 }
6556
6557 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006558 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006559 Parcel data = Parcel.obtain();
6560 Parcel reply = Parcel.obtain();
6561 data.writeInterfaceToken(IActivityManager.descriptor);
6562 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006563 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006564 reply.readException();
6565 data.recycle();
6566 reply.recycle();
6567 }
6568
6569 @Override
6570 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6571 Parcel data = Parcel.obtain();
6572 Parcel reply = Parcel.obtain();
6573 data.writeInterfaceToken(IActivityManager.descriptor);
6574 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006575 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006576 reply.readException();
6577 data.recycle();
6578 reply.recycle();
6579 }
6580
Craig Mautner8746a472014-07-24 15:12:54 -07006581 @Override
6582 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6583 Parcel data = Parcel.obtain();
6584 Parcel reply = Parcel.obtain();
6585 data.writeInterfaceToken(IActivityManager.descriptor);
6586 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006587 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006588 reply.readException();
6589 data.recycle();
6590 reply.recycle();
6591 }
6592
Craig Mautner6e2f3952014-09-09 14:26:41 -07006593 @Override
6594 public void bootAnimationComplete() throws RemoteException {
6595 Parcel data = Parcel.obtain();
6596 Parcel reply = Parcel.obtain();
6597 data.writeInterfaceToken(IActivityManager.descriptor);
6598 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6599 reply.readException();
6600 data.recycle();
6601 reply.recycle();
6602 }
6603
Wale Ogunwale18795a22014-12-03 11:38:33 -08006604 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006605 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6606 Parcel data = Parcel.obtain();
6607 Parcel reply = Parcel.obtain();
6608 data.writeInterfaceToken(IActivityManager.descriptor);
6609 data.writeInt(uid);
6610 data.writeByteArray(firstPacket);
6611 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6612 reply.readException();
6613 data.recycle();
6614 reply.recycle();
6615 }
6616
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006617 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006618 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6619 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006620 Parcel data = Parcel.obtain();
6621 Parcel reply = Parcel.obtain();
6622 data.writeInterfaceToken(IActivityManager.descriptor);
6623 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006624 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006625 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006626 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006627 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6628 reply.readException();
6629 data.recycle();
6630 reply.recycle();
6631 }
6632
6633 @Override
6634 public void dumpHeapFinished(String path) throws RemoteException {
6635 Parcel data = Parcel.obtain();
6636 Parcel reply = Parcel.obtain();
6637 data.writeInterfaceToken(IActivityManager.descriptor);
6638 data.writeString(path);
6639 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6640 reply.readException();
6641 data.recycle();
6642 reply.recycle();
6643 }
6644
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006645 @Override
6646 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6647 throws RemoteException {
6648 Parcel data = Parcel.obtain();
6649 Parcel reply = Parcel.obtain();
6650 data.writeInterfaceToken(IActivityManager.descriptor);
6651 data.writeStrongBinder(session.asBinder());
6652 data.writeInt(keepAwake ? 1 : 0);
6653 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6654 reply.readException();
6655 data.recycle();
6656 reply.recycle();
6657 }
6658
Craig Mautnere5600772015-04-03 21:36:37 -07006659 @Override
6660 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6661 Parcel data = Parcel.obtain();
6662 Parcel reply = Parcel.obtain();
6663 data.writeInterfaceToken(IActivityManager.descriptor);
6664 data.writeInt(userId);
6665 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006666 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006667 reply.readException();
6668 data.recycle();
6669 reply.recycle();
6670 }
6671
Dianne Hackborn1e383822015-04-10 14:02:33 -07006672 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006673 public void updateDeviceOwner(String packageName) throws RemoteException {
6674 Parcel data = Parcel.obtain();
6675 Parcel reply = Parcel.obtain();
6676 data.writeInterfaceToken(IActivityManager.descriptor);
6677 data.writeString(packageName);
6678 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6679 reply.readException();
6680 data.recycle();
6681 reply.recycle();
6682 }
6683
6684 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006685 public int getPackageProcessState(String packageName, String callingPackage)
6686 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006687 Parcel data = Parcel.obtain();
6688 Parcel reply = Parcel.obtain();
6689 data.writeInterfaceToken(IActivityManager.descriptor);
6690 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006691 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006692 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6693 reply.readException();
6694 int res = reply.readInt();
6695 data.recycle();
6696 reply.recycle();
6697 return res;
6698 }
6699
Stefan Kuhne16045c22015-06-05 07:18:06 -07006700 @Override
6701 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6702 throws RemoteException {
6703 Parcel data = Parcel.obtain();
6704 Parcel reply = Parcel.obtain();
6705 data.writeInterfaceToken(IActivityManager.descriptor);
6706 data.writeString(process);
6707 data.writeInt(userId);
6708 data.writeInt(level);
6709 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6710 reply.readException();
6711 int res = reply.readInt();
6712 data.recycle();
6713 reply.recycle();
6714 return res != 0;
6715 }
6716
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006717 @Override
6718 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6719 Parcel data = Parcel.obtain();
6720 Parcel reply = Parcel.obtain();
6721 data.writeInterfaceToken(IActivityManager.descriptor);
6722 data.writeStrongBinder(token);
6723 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6724 reply.readException();
6725 int res = reply.readInt();
6726 data.recycle();
6727 reply.recycle();
6728 return res != 0;
6729 }
6730
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006731 @Override
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006732 public void exitFreeformMode(IBinder token) throws RemoteException {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006733 Parcel data = Parcel.obtain();
6734 Parcel reply = Parcel.obtain();
6735 data.writeInterfaceToken(IActivityManager.descriptor);
6736 data.writeStrongBinder(token);
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006737 mRemote.transact(EXIT_FREEFORM_MODE_TRANSACTION, data, reply, 0);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006738 reply.readException();
6739 data.recycle();
6740 reply.recycle();
6741 }
6742
6743 @Override
6744 public int getActivityStackId(IBinder token) throws RemoteException {
6745 Parcel data = Parcel.obtain();
6746 Parcel reply = Parcel.obtain();
6747 data.writeInterfaceToken(IActivityManager.descriptor);
6748 data.writeStrongBinder(token);
6749 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6750 reply.readException();
6751 int stackId = reply.readInt();
6752 data.recycle();
6753 reply.recycle();
6754 return stackId;
6755 }
6756
Filip Gruszczynski23493322015-07-29 17:02:59 -07006757 @Override
6758 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006759 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6760 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006761 Parcel data = Parcel.obtain();
6762 Parcel reply = Parcel.obtain();
6763 data.writeInterfaceToken(IActivityManager.descriptor);
6764 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006765 writeIntArray(horizontalSizeConfiguration, data);
6766 writeIntArray(verticalSizeConfigurations, data);
6767 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006768 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6769 reply.readException();
6770 data.recycle();
6771 reply.recycle();
6772 }
6773
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006774 private static void writeIntArray(int[] array, Parcel data) {
6775 if (array == null) {
6776 data.writeInt(0);
6777 } else {
6778 data.writeInt(array.length);
6779 data.writeIntArray(array);
6780 }
6781 }
6782
Wale Ogunwale83301a92015-09-24 15:54:08 -07006783 @Override
6784 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6785 Parcel data = Parcel.obtain();
6786 Parcel reply = Parcel.obtain();
6787 data.writeInterfaceToken(IActivityManager.descriptor);
6788 data.writeInt(suppress ? 1 : 0);
6789 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6790 reply.readException();
6791 data.recycle();
6792 reply.recycle();
6793 }
6794
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006795 @Override
Wale Ogunwale9101d262016-01-15 08:56:11 -08006796 public void moveTasksToFullscreenStack(int fromStackId, boolean onTop) throws RemoteException {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006797 Parcel data = Parcel.obtain();
6798 Parcel reply = Parcel.obtain();
6799 data.writeInterfaceToken(IActivityManager.descriptor);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006800 data.writeInt(fromStackId);
Wale Ogunwale9101d262016-01-15 08:56:11 -08006801 data.writeInt(onTop ? 1 : 0);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006802 mRemote.transact(MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006803 reply.readException();
6804 data.recycle();
6805 reply.recycle();
6806 }
6807
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006808 @Override
6809 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6810 Parcel data = Parcel.obtain();
6811 Parcel reply = Parcel.obtain();
6812 data.writeInterfaceToken(IActivityManager.descriptor);
6813 data.writeInt(uid);
6814 data.writeString(packageName);
6815 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6816 reply.readException();
6817 int res = reply.readInt();
6818 data.recycle();
6819 reply.recycle();
6820 return res;
6821 }
6822
Wale Ogunwale5f986092015-12-04 15:35:38 -08006823 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006824 public boolean inMultiWindow(IBinder token) throws RemoteException {
Wale Ogunwale5f986092015-12-04 15:35:38 -08006825 Parcel data = Parcel.obtain();
6826 Parcel reply = Parcel.obtain();
6827 data.writeInterfaceToken(IActivityManager.descriptor);
6828 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006829 mRemote.transact(IN_MULTI_WINDOW_TRANSACTION, data, reply, 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08006830 reply.readException();
6831 final boolean multiWindowMode = reply.readInt() == 1 ? true : false;
6832 data.recycle();
6833 reply.recycle();
6834 return multiWindowMode;
6835 }
6836
6837 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006838 public boolean inPictureInPicture(IBinder token) throws RemoteException {
Wale Ogunwale5f986092015-12-04 15:35:38 -08006839 Parcel data = Parcel.obtain();
6840 Parcel reply = Parcel.obtain();
6841 data.writeInterfaceToken(IActivityManager.descriptor);
6842 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006843 mRemote.transact(IN_PICTURE_IN_PICTURE_TRANSACTION, data, reply, 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08006844 reply.readException();
6845 final boolean pipMode = reply.readInt() == 1 ? true : false;
6846 data.recycle();
6847 reply.recycle();
6848 return pipMode;
6849 }
6850
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006851 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006852 public void enterPictureInPicture(IBinder token) throws RemoteException {
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006853 Parcel data = Parcel.obtain();
6854 Parcel reply = Parcel.obtain();
6855 data.writeInterfaceToken(IActivityManager.descriptor);
6856 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006857 mRemote.transact(ENTER_PICTURE_IN_PICTURE_TRANSACTION, data, reply, 0);
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006858 reply.readException();
6859 data.recycle();
6860 reply.recycle();
6861 }
6862
Christopher Tate63fec3e2015-12-11 18:35:28 -08006863 @Override
6864 public boolean isAppForeground(int uid) throws RemoteException {
6865 Parcel data = Parcel.obtain();
6866 Parcel reply = Parcel.obtain();
6867 data.writeInterfaceToken(IActivityManager.descriptor);
6868 data.writeInt(uid);
6869 mRemote.transact(IS_APP_FOREGROUND_TRANSACTION, data, reply, 0);
6870 final boolean isForeground = reply.readInt() == 1 ? true : false;
6871 data.recycle();
6872 reply.recycle();
6873 return isForeground;
6874 };
6875
Wale Ogunwale480dca02016-02-06 13:58:29 -08006876 @Override
6877 public void notifyPinnedStackAnimationEnded() throws RemoteException {
6878 Parcel data = Parcel.obtain();
6879 Parcel reply = Parcel.obtain();
6880 data.writeInterfaceToken(IActivityManager.descriptor);
6881 mRemote.transact(NOTIFY_PINNED_STACK_ANIMATION_ENDED_TRANSACTION, data, reply, 0);
6882 data.recycle();
6883 reply.recycle();
6884 };
6885
Wale Ogunwale06e8ee02016-02-12 12:56:32 -08006886 @Override
6887 public void removeStack(int stackId) throws RemoteException {
6888 Parcel data = Parcel.obtain();
6889 Parcel reply = Parcel.obtain();
6890 data.writeInterfaceToken(IActivityManager.descriptor);
6891 data.writeInt(stackId);
6892 mRemote.transact(REMOVE_STACK, data, reply, 0);
6893 reply.readException();
6894 data.recycle();
6895 reply.recycle();
6896 }
6897
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006898 private IBinder mRemote;
6899}