blob: b264e8ec69939f6161631c558131e831734122da [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 }
795 moveTaskToDockedStack(taskId, createMode, toTop, animate, bounds);
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700796 reply.writeNoException();
797 return true;
798 }
799
Dianne Hackbornbef28fe2015-10-29 17:57:11 -0700800 case MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION: {
Wale Ogunwale079a0042015-10-24 11:44:07 -0700801 data.enforceInterface(IActivityManager.descriptor);
802 final int stackId = data.readInt();
803 final Rect r = Rect.CREATOR.createFromParcel(data);
804 final boolean res = moveTopActivityToPinnedStack(stackId, r);
805 reply.writeNoException();
806 reply.writeInt(res ? 1 : 0);
807 return true;
808 }
809
Craig Mautnerc00204b2013-03-05 15:02:14 -0800810 case RESIZE_STACK_TRANSACTION: {
811 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700812 final int stackId = data.readInt();
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100813 final boolean hasRect = data.readInt() != 0;
814 Rect r = null;
815 if (hasRect) {
816 r = Rect.CREATOR.createFromParcel(data);
817 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700818 final boolean allowResizeInDockedMode = data.readInt() == 1;
Filip Gruszczynski84fa3352016-01-25 16:28:49 -0800819 final boolean preserveWindows = data.readInt() == 1;
820 final boolean animate = data.readInt() == 1;
821 resizeStack(stackId, r, allowResizeInDockedMode, preserveWindows, animate);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800822 reply.writeNoException();
823 return true;
824 }
825
Jorim Jaggidc249c42015-12-15 14:57:31 -0800826 case RESIZE_DOCKED_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 hasTempDockedTaskBounds = data.readInt() != 0;
834 Rect tempDockedTaskBounds = null;
835 if (hasTempDockedTaskBounds) {
836 tempDockedTaskBounds = Rect.CREATOR.createFromParcel(data);
837 }
838 final boolean hasTempDockedTaskInsetBounds = data.readInt() != 0;
839 Rect tempDockedTaskInsetBounds = null;
840 if (hasTempDockedTaskInsetBounds) {
841 tempDockedTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
842 }
843 final boolean hasTempOtherTaskBounds = data.readInt() != 0;
844 Rect tempOtherTaskBounds = null;
845 if (hasTempOtherTaskBounds) {
846 tempOtherTaskBounds = Rect.CREATOR.createFromParcel(data);
847 }
848 final boolean hasTempOtherTaskInsetBounds = data.readInt() != 0;
849 Rect tempOtherTaskInsetBounds = null;
850 if (hasTempOtherTaskInsetBounds) {
851 tempOtherTaskInsetBounds = Rect.CREATOR.createFromParcel(data);
852 }
853 resizeDockedStack(bounds, tempDockedTaskBounds, tempDockedTaskInsetBounds,
854 tempOtherTaskBounds, tempOtherTaskInsetBounds);
855 reply.writeNoException();
856 return true;
857 }
858
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700859 case POSITION_TASK_IN_STACK_TRANSACTION: {
860 data.enforceInterface(IActivityManager.descriptor);
861 int taskId = data.readInt();
862 int stackId = data.readInt();
863 int position = data.readInt();
864 positionTaskInStack(taskId, stackId, position);
865 reply.writeNoException();
866 return true;
867 }
868
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800869 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700870 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800871 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700872 reply.writeNoException();
873 reply.writeTypedList(list);
874 return true;
875 }
876
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800877 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700878 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800879 int stackId = data.readInt();
880 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700881 reply.writeNoException();
882 if (info != null) {
883 reply.writeInt(1);
884 info.writeToParcel(reply, 0);
885 } else {
886 reply.writeInt(0);
887 }
888 return true;
889 }
890
Winson Chung303e1ff2014-03-07 15:06:19 -0800891 case IS_IN_HOME_STACK_TRANSACTION: {
892 data.enforceInterface(IActivityManager.descriptor);
893 int taskId = data.readInt();
894 boolean isInHomeStack = isInHomeStack(taskId);
895 reply.writeNoException();
896 reply.writeInt(isInHomeStack ? 1 : 0);
897 return true;
898 }
899
Craig Mautnercf910b02013-04-23 11:23:27 -0700900 case SET_FOCUSED_STACK_TRANSACTION: {
901 data.enforceInterface(IActivityManager.descriptor);
902 int stackId = data.readInt();
903 setFocusedStack(stackId);
904 reply.writeNoException();
905 return true;
906 }
907
Winson Chungd16c5652015-01-26 16:11:07 -0800908 case GET_FOCUSED_STACK_ID_TRANSACTION: {
909 data.enforceInterface(IActivityManager.descriptor);
910 int focusedStackId = getFocusedStackId();
911 reply.writeNoException();
912 reply.writeInt(focusedStackId);
913 return true;
914 }
915
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700916 case SET_FOCUSED_TASK_TRANSACTION: {
917 data.enforceInterface(IActivityManager.descriptor);
918 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700919 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700920 reply.writeNoException();
921 return true;
922 }
923
Winson Chung740c3ac2014-11-12 16:14:38 -0800924 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
925 data.enforceInterface(IActivityManager.descriptor);
926 IBinder token = data.readStrongBinder();
927 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
928 reply.writeNoException();
929 return true;
930 }
931
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800932 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
933 data.enforceInterface(IActivityManager.descriptor);
934 IBinder token = data.readStrongBinder();
935 boolean onlyRoot = data.readInt() != 0;
936 int res = token != null
937 ? getTaskForActivity(token, onlyRoot) : -1;
938 reply.writeNoException();
939 reply.writeInt(res);
940 return true;
941 }
942
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800943 case GET_CONTENT_PROVIDER_TRANSACTION: {
944 data.enforceInterface(IActivityManager.descriptor);
945 IBinder b = data.readStrongBinder();
946 IApplicationThread app = ApplicationThreadNative.asInterface(b);
947 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700948 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700949 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700950 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800951 reply.writeNoException();
952 if (cph != null) {
953 reply.writeInt(1);
954 cph.writeToParcel(reply, 0);
955 } else {
956 reply.writeInt(0);
957 }
958 return true;
959 }
960
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800961 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
962 data.enforceInterface(IActivityManager.descriptor);
963 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700964 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800965 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700966 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800967 reply.writeNoException();
968 if (cph != null) {
969 reply.writeInt(1);
970 cph.writeToParcel(reply, 0);
971 } else {
972 reply.writeInt(0);
973 }
974 return true;
975 }
976
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800977 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 IBinder b = data.readStrongBinder();
980 IApplicationThread app = ApplicationThreadNative.asInterface(b);
981 ArrayList<ContentProviderHolder> providers =
982 data.createTypedArrayList(ContentProviderHolder.CREATOR);
983 publishContentProviders(app, providers);
984 reply.writeNoException();
985 return true;
986 }
987
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700988 case REF_CONTENT_PROVIDER_TRANSACTION: {
989 data.enforceInterface(IActivityManager.descriptor);
990 IBinder b = data.readStrongBinder();
991 int stable = data.readInt();
992 int unstable = data.readInt();
993 boolean res = refContentProvider(b, stable, unstable);
994 reply.writeNoException();
995 reply.writeInt(res ? 1 : 0);
996 return true;
997 }
998
999 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
1000 data.enforceInterface(IActivityManager.descriptor);
1001 IBinder b = data.readStrongBinder();
1002 unstableProviderDied(b);
1003 reply.writeNoException();
1004 return true;
1005 }
1006
Jeff Sharkey7aa76012013-09-30 14:26:27 -07001007 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
1008 data.enforceInterface(IActivityManager.descriptor);
1009 IBinder b = data.readStrongBinder();
1010 appNotRespondingViaProvider(b);
1011 reply.writeNoException();
1012 return true;
1013 }
1014
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001015 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
1016 data.enforceInterface(IActivityManager.descriptor);
1017 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07001018 boolean stable = data.readInt() != 0;
1019 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001020 reply.writeNoException();
1021 return true;
1022 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08001023
1024 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
1025 data.enforceInterface(IActivityManager.descriptor);
1026 String name = data.readString();
1027 IBinder token = data.readStrongBinder();
1028 removeContentProviderExternal(name, token);
1029 reply.writeNoException();
1030 return true;
1031 }
1032
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07001033 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
1034 data.enforceInterface(IActivityManager.descriptor);
1035 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
1036 PendingIntent pi = getRunningServiceControlPanel(comp);
1037 reply.writeNoException();
1038 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
1039 return true;
1040 }
1041
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001042 case START_SERVICE_TRANSACTION: {
1043 data.enforceInterface(IActivityManager.descriptor);
1044 IBinder b = data.readStrongBinder();
1045 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1046 Intent service = Intent.CREATOR.createFromParcel(data);
1047 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001048 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001049 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001050 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001051 reply.writeNoException();
1052 ComponentName.writeToParcel(cn, reply);
1053 return true;
1054 }
1055
1056 case STOP_SERVICE_TRANSACTION: {
1057 data.enforceInterface(IActivityManager.descriptor);
1058 IBinder b = data.readStrongBinder();
1059 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1060 Intent service = Intent.CREATOR.createFromParcel(data);
1061 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -07001062 int userId = data.readInt();
1063 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001064 reply.writeNoException();
1065 reply.writeInt(res);
1066 return true;
1067 }
1068
1069 case STOP_SERVICE_TOKEN_TRANSACTION: {
1070 data.enforceInterface(IActivityManager.descriptor);
1071 ComponentName className = ComponentName.readFromParcel(data);
1072 IBinder token = data.readStrongBinder();
1073 int startId = data.readInt();
1074 boolean res = stopServiceToken(className, token, startId);
1075 reply.writeNoException();
1076 reply.writeInt(res ? 1 : 0);
1077 return true;
1078 }
1079
1080 case SET_SERVICE_FOREGROUND_TRANSACTION: {
1081 data.enforceInterface(IActivityManager.descriptor);
1082 ComponentName className = ComponentName.readFromParcel(data);
1083 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001084 int id = data.readInt();
1085 Notification notification = null;
1086 if (data.readInt() != 0) {
1087 notification = Notification.CREATOR.createFromParcel(data);
1088 }
1089 boolean removeNotification = data.readInt() != 0;
1090 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001091 reply.writeNoException();
1092 return true;
1093 }
1094
1095 case BIND_SERVICE_TRANSACTION: {
1096 data.enforceInterface(IActivityManager.descriptor);
1097 IBinder b = data.readStrongBinder();
1098 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1099 IBinder token = data.readStrongBinder();
1100 Intent service = Intent.CREATOR.createFromParcel(data);
1101 String resolvedType = data.readString();
1102 b = data.readStrongBinder();
1103 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001104 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001105 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001106 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001107 int res = bindService(app, token, service, resolvedType, conn, fl,
1108 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001109 reply.writeNoException();
1110 reply.writeInt(res);
1111 return true;
1112 }
1113
1114 case UNBIND_SERVICE_TRANSACTION: {
1115 data.enforceInterface(IActivityManager.descriptor);
1116 IBinder b = data.readStrongBinder();
1117 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1118 boolean res = unbindService(conn);
1119 reply.writeNoException();
1120 reply.writeInt(res ? 1 : 0);
1121 return true;
1122 }
1123
1124 case PUBLISH_SERVICE_TRANSACTION: {
1125 data.enforceInterface(IActivityManager.descriptor);
1126 IBinder token = data.readStrongBinder();
1127 Intent intent = Intent.CREATOR.createFromParcel(data);
1128 IBinder service = data.readStrongBinder();
1129 publishService(token, intent, service);
1130 reply.writeNoException();
1131 return true;
1132 }
1133
1134 case UNBIND_FINISHED_TRANSACTION: {
1135 data.enforceInterface(IActivityManager.descriptor);
1136 IBinder token = data.readStrongBinder();
1137 Intent intent = Intent.CREATOR.createFromParcel(data);
1138 boolean doRebind = data.readInt() != 0;
1139 unbindFinished(token, intent, doRebind);
1140 reply.writeNoException();
1141 return true;
1142 }
1143
1144 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1145 data.enforceInterface(IActivityManager.descriptor);
1146 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001147 int type = data.readInt();
1148 int startId = data.readInt();
1149 int res = data.readInt();
1150 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 reply.writeNoException();
1152 return true;
1153 }
1154
1155 case START_INSTRUMENTATION_TRANSACTION: {
1156 data.enforceInterface(IActivityManager.descriptor);
1157 ComponentName className = ComponentName.readFromParcel(data);
1158 String profileFile = data.readString();
1159 int fl = data.readInt();
1160 Bundle arguments = data.readBundle();
1161 IBinder b = data.readStrongBinder();
1162 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001163 b = data.readStrongBinder();
1164 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001165 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001166 String abiOverride = data.readString();
1167 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1168 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001169 reply.writeNoException();
1170 reply.writeInt(res ? 1 : 0);
1171 return true;
1172 }
1173
1174
1175 case FINISH_INSTRUMENTATION_TRANSACTION: {
1176 data.enforceInterface(IActivityManager.descriptor);
1177 IBinder b = data.readStrongBinder();
1178 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1179 int resultCode = data.readInt();
1180 Bundle results = data.readBundle();
1181 finishInstrumentation(app, resultCode, results);
1182 reply.writeNoException();
1183 return true;
1184 }
1185
1186 case GET_CONFIGURATION_TRANSACTION: {
1187 data.enforceInterface(IActivityManager.descriptor);
1188 Configuration config = getConfiguration();
1189 reply.writeNoException();
1190 config.writeToParcel(reply, 0);
1191 return true;
1192 }
1193
1194 case UPDATE_CONFIGURATION_TRANSACTION: {
1195 data.enforceInterface(IActivityManager.descriptor);
1196 Configuration config = Configuration.CREATOR.createFromParcel(data);
1197 updateConfiguration(config);
1198 reply.writeNoException();
1199 return true;
1200 }
1201
1202 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1203 data.enforceInterface(IActivityManager.descriptor);
1204 IBinder token = data.readStrongBinder();
1205 int requestedOrientation = data.readInt();
1206 setRequestedOrientation(token, requestedOrientation);
1207 reply.writeNoException();
1208 return true;
1209 }
1210
1211 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1212 data.enforceInterface(IActivityManager.descriptor);
1213 IBinder token = data.readStrongBinder();
1214 int req = getRequestedOrientation(token);
1215 reply.writeNoException();
1216 reply.writeInt(req);
1217 return true;
1218 }
1219
1220 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1221 data.enforceInterface(IActivityManager.descriptor);
1222 IBinder token = data.readStrongBinder();
1223 ComponentName cn = getActivityClassForToken(token);
1224 reply.writeNoException();
1225 ComponentName.writeToParcel(cn, reply);
1226 return true;
1227 }
1228
1229 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1230 data.enforceInterface(IActivityManager.descriptor);
1231 IBinder token = data.readStrongBinder();
1232 reply.writeNoException();
1233 reply.writeString(getPackageForToken(token));
1234 return true;
1235 }
1236
1237 case GET_INTENT_SENDER_TRANSACTION: {
1238 data.enforceInterface(IActivityManager.descriptor);
1239 int type = data.readInt();
1240 String packageName = data.readString();
1241 IBinder token = data.readStrongBinder();
1242 String resultWho = data.readString();
1243 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001244 Intent[] requestIntents;
1245 String[] requestResolvedTypes;
1246 if (data.readInt() != 0) {
1247 requestIntents = data.createTypedArray(Intent.CREATOR);
1248 requestResolvedTypes = data.createStringArray();
1249 } else {
1250 requestIntents = null;
1251 requestResolvedTypes = null;
1252 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001254 Bundle options = data.readInt() != 0
1255 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001256 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001257 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001258 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001259 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001260 reply.writeNoException();
1261 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1262 return true;
1263 }
1264
1265 case CANCEL_INTENT_SENDER_TRANSACTION: {
1266 data.enforceInterface(IActivityManager.descriptor);
1267 IIntentSender r = IIntentSender.Stub.asInterface(
1268 data.readStrongBinder());
1269 cancelIntentSender(r);
1270 reply.writeNoException();
1271 return true;
1272 }
1273
1274 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1275 data.enforceInterface(IActivityManager.descriptor);
1276 IIntentSender r = IIntentSender.Stub.asInterface(
1277 data.readStrongBinder());
1278 String res = getPackageForIntentSender(r);
1279 reply.writeNoException();
1280 reply.writeString(res);
1281 return true;
1282 }
1283
Christopher Tatec4a07d12012-04-06 14:19:13 -07001284 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1285 data.enforceInterface(IActivityManager.descriptor);
1286 IIntentSender r = IIntentSender.Stub.asInterface(
1287 data.readStrongBinder());
1288 int res = getUidForIntentSender(r);
1289 reply.writeNoException();
1290 reply.writeInt(res);
1291 return true;
1292 }
1293
Dianne Hackborn41203752012-08-31 14:05:51 -07001294 case HANDLE_INCOMING_USER_TRANSACTION: {
1295 data.enforceInterface(IActivityManager.descriptor);
1296 int callingPid = data.readInt();
1297 int callingUid = data.readInt();
1298 int userId = data.readInt();
1299 boolean allowAll = data.readInt() != 0 ;
1300 boolean requireFull = data.readInt() != 0;
1301 String name = data.readString();
1302 String callerPackage = data.readString();
1303 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1304 requireFull, name, callerPackage);
1305 reply.writeNoException();
1306 reply.writeInt(res);
1307 return true;
1308 }
1309
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001310 case SET_PROCESS_LIMIT_TRANSACTION: {
1311 data.enforceInterface(IActivityManager.descriptor);
1312 int max = data.readInt();
1313 setProcessLimit(max);
1314 reply.writeNoException();
1315 return true;
1316 }
1317
1318 case GET_PROCESS_LIMIT_TRANSACTION: {
1319 data.enforceInterface(IActivityManager.descriptor);
1320 int limit = getProcessLimit();
1321 reply.writeNoException();
1322 reply.writeInt(limit);
1323 return true;
1324 }
1325
1326 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1327 data.enforceInterface(IActivityManager.descriptor);
1328 IBinder token = data.readStrongBinder();
1329 int pid = data.readInt();
1330 boolean isForeground = data.readInt() != 0;
1331 setProcessForeground(token, pid, isForeground);
1332 reply.writeNoException();
1333 return true;
1334 }
1335
1336 case CHECK_PERMISSION_TRANSACTION: {
1337 data.enforceInterface(IActivityManager.descriptor);
1338 String perm = data.readString();
1339 int pid = data.readInt();
1340 int uid = data.readInt();
1341 int res = checkPermission(perm, pid, uid);
1342 reply.writeNoException();
1343 reply.writeInt(res);
1344 return true;
1345 }
1346
Dianne Hackbornff170242014-11-19 10:59:01 -08001347 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1348 data.enforceInterface(IActivityManager.descriptor);
1349 String perm = data.readString();
1350 int pid = data.readInt();
1351 int uid = data.readInt();
1352 IBinder token = data.readStrongBinder();
1353 int res = checkPermissionWithToken(perm, pid, uid, token);
1354 reply.writeNoException();
1355 reply.writeInt(res);
1356 return true;
1357 }
1358
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001359 case CHECK_URI_PERMISSION_TRANSACTION: {
1360 data.enforceInterface(IActivityManager.descriptor);
1361 Uri uri = Uri.CREATOR.createFromParcel(data);
1362 int pid = data.readInt();
1363 int uid = data.readInt();
1364 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001365 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001366 IBinder callerToken = data.readStrongBinder();
1367 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001368 reply.writeNoException();
1369 reply.writeInt(res);
1370 return true;
1371 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001372
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001373 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001374 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001375 String packageName = data.readString();
1376 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1377 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001378 int userId = data.readInt();
1379 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001380 reply.writeNoException();
1381 reply.writeInt(res ? 1 : 0);
1382 return true;
1383 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001385 case GRANT_URI_PERMISSION_TRANSACTION: {
1386 data.enforceInterface(IActivityManager.descriptor);
1387 IBinder b = data.readStrongBinder();
1388 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1389 String targetPkg = data.readString();
1390 Uri uri = Uri.CREATOR.createFromParcel(data);
1391 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001392 int userId = data.readInt();
1393 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001394 reply.writeNoException();
1395 return true;
1396 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001397
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001398 case REVOKE_URI_PERMISSION_TRANSACTION: {
1399 data.enforceInterface(IActivityManager.descriptor);
1400 IBinder b = data.readStrongBinder();
1401 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1402 Uri uri = Uri.CREATOR.createFromParcel(data);
1403 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001404 int userId = data.readInt();
1405 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001406 reply.writeNoException();
1407 return true;
1408 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001409
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001410 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 Uri uri = Uri.CREATOR.createFromParcel(data);
1413 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001414 int userId = data.readInt();
1415 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001416 reply.writeNoException();
1417 return true;
1418 }
1419
1420 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1421 data.enforceInterface(IActivityManager.descriptor);
1422 Uri uri = Uri.CREATOR.createFromParcel(data);
1423 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001424 int userId = data.readInt();
1425 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001426 reply.writeNoException();
1427 return true;
1428 }
1429
1430 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1431 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001432 final String packageName = data.readString();
1433 final boolean incoming = data.readInt() != 0;
1434 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1435 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001436 reply.writeNoException();
1437 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1438 return true;
1439 }
1440
Felipe Lemef3fa0f82016-01-07 12:08:19 -08001441 case GET_GRANTED_URI_PERMISSIONS_TRANSACTION: {
1442 data.enforceInterface(IActivityManager.descriptor);
1443 final String packageName = data.readString();
1444 final int userId = data.readInt();
1445 final ParceledListSlice<UriPermission> perms = getGrantedUriPermissions(packageName,
1446 userId);
1447 reply.writeNoException();
1448 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1449 return true;
1450 }
1451
1452 case CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION: {
1453 data.enforceInterface(IActivityManager.descriptor);
1454 final String packageName = data.readString();
1455 final int userId = data.readInt();
1456 clearGrantedUriPermissions(packageName, userId);
1457 reply.writeNoException();
1458 return true;
1459 }
1460
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001461 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1462 data.enforceInterface(IActivityManager.descriptor);
1463 IBinder b = data.readStrongBinder();
1464 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1465 boolean waiting = data.readInt() != 0;
1466 showWaitingForDebugger(app, waiting);
1467 reply.writeNoException();
1468 return true;
1469 }
1470
1471 case GET_MEMORY_INFO_TRANSACTION: {
1472 data.enforceInterface(IActivityManager.descriptor);
1473 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1474 getMemoryInfo(mi);
1475 reply.writeNoException();
1476 mi.writeToParcel(reply, 0);
1477 return true;
1478 }
1479
1480 case UNHANDLED_BACK_TRANSACTION: {
1481 data.enforceInterface(IActivityManager.descriptor);
1482 unhandledBack();
1483 reply.writeNoException();
1484 return true;
1485 }
1486
1487 case OPEN_CONTENT_URI_TRANSACTION: {
1488 data.enforceInterface(IActivityManager.descriptor);
1489 Uri uri = Uri.parse(data.readString());
1490 ParcelFileDescriptor pfd = openContentUri(uri);
1491 reply.writeNoException();
1492 if (pfd != null) {
1493 reply.writeInt(1);
1494 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1495 } else {
1496 reply.writeInt(0);
1497 }
1498 return true;
1499 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001500
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001501 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1502 data.enforceInterface(IActivityManager.descriptor);
1503 setLockScreenShown(data.readInt() != 0);
1504 reply.writeNoException();
1505 return true;
1506 }
1507
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001508 case SET_DEBUG_APP_TRANSACTION: {
1509 data.enforceInterface(IActivityManager.descriptor);
1510 String pn = data.readString();
1511 boolean wfd = data.readInt() != 0;
1512 boolean per = data.readInt() != 0;
1513 setDebugApp(pn, wfd, per);
1514 reply.writeNoException();
1515 return true;
1516 }
1517
1518 case SET_ALWAYS_FINISH_TRANSACTION: {
1519 data.enforceInterface(IActivityManager.descriptor);
1520 boolean enabled = data.readInt() != 0;
1521 setAlwaysFinish(enabled);
1522 reply.writeNoException();
1523 return true;
1524 }
1525
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001526 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001527 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001528 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001529 data.readStrongBinder());
Dianne Hackborn4a18c262016-02-26 17:23:48 -08001530 boolean imAMonkey = data.readInt() != 0;
1531 setActivityController(watcher, imAMonkey);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001532 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001533 return true;
1534 }
1535
Dianne Hackbornb2117d12016-02-16 18:26:35 -08001536 case SET_LENIENT_BACKGROUND_CHECK_TRANSACTION: {
1537 data.enforceInterface(IActivityManager.descriptor);
1538 boolean enabled = data.readInt() != 0;
1539 setLenientBackgroundCheck(enabled);
1540 reply.writeNoException();
1541 return true;
1542 }
1543
Dianne Hackborn970510b2016-02-24 16:56:42 -08001544 case GET_MEMORY_TRIM_LEVEL_TRANSACTION: {
1545 data.enforceInterface(IActivityManager.descriptor);
1546 int level = getMemoryTrimLevel();
1547 reply.writeNoException();
1548 reply.writeInt(level);
1549 return true;
1550 }
1551
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001552 case ENTER_SAFE_MODE_TRANSACTION: {
1553 data.enforceInterface(IActivityManager.descriptor);
1554 enterSafeMode();
1555 reply.writeNoException();
1556 return true;
1557 }
1558
1559 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1560 data.enforceInterface(IActivityManager.descriptor);
1561 IIntentSender is = IIntentSender.Stub.asInterface(
1562 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001563 int sourceUid = data.readInt();
1564 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001565 String tag = data.readString();
1566 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1567 reply.writeNoException();
1568 return true;
1569 }
1570
1571 case NOTE_ALARM_START_TRANSACTION: {
1572 data.enforceInterface(IActivityManager.descriptor);
1573 IIntentSender is = IIntentSender.Stub.asInterface(
1574 data.readStrongBinder());
1575 int sourceUid = data.readInt();
1576 String tag = data.readString();
1577 noteAlarmStart(is, sourceUid, tag);
1578 reply.writeNoException();
1579 return true;
1580 }
1581
1582 case NOTE_ALARM_FINISH_TRANSACTION: {
1583 data.enforceInterface(IActivityManager.descriptor);
1584 IIntentSender is = IIntentSender.Stub.asInterface(
1585 data.readStrongBinder());
1586 int sourceUid = data.readInt();
1587 String tag = data.readString();
1588 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001589 reply.writeNoException();
1590 return true;
1591 }
1592
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001593 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001594 data.enforceInterface(IActivityManager.descriptor);
1595 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001596 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001597 boolean secure = data.readInt() != 0;
1598 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001599 reply.writeNoException();
1600 reply.writeInt(res ? 1 : 0);
1601 return true;
1602 }
1603
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001604 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1605 data.enforceInterface(IActivityManager.descriptor);
1606 String reason = data.readString();
1607 boolean res = killProcessesBelowForeground(reason);
1608 reply.writeNoException();
1609 reply.writeInt(res ? 1 : 0);
1610 return true;
1611 }
1612
Dan Egnor60d87622009-12-16 16:32:58 -08001613 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1614 data.enforceInterface(IActivityManager.descriptor);
1615 IBinder app = data.readStrongBinder();
1616 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1617 handleApplicationCrash(app, ci);
1618 reply.writeNoException();
1619 return true;
1620 }
1621
1622 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001623 data.enforceInterface(IActivityManager.descriptor);
1624 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001625 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001626 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001627 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001628 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001629 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001630 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001631 return true;
1632 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001633
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001634 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1635 data.enforceInterface(IActivityManager.descriptor);
1636 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001637 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001638 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1639 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001640 reply.writeNoException();
1641 return true;
1642 }
1643
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001644 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1645 data.enforceInterface(IActivityManager.descriptor);
1646 int sig = data.readInt();
1647 signalPersistentProcesses(sig);
1648 reply.writeNoException();
1649 return true;
1650 }
1651
Dianne Hackborn03abb812010-01-04 18:43:19 -08001652 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1653 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001654 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001655 int userId = data.readInt();
1656 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001657 reply.writeNoException();
1658 return true;
1659 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001660
1661 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1662 data.enforceInterface(IActivityManager.descriptor);
1663 killAllBackgroundProcesses();
1664 reply.writeNoException();
1665 return true;
1666 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001667
Gustav Sennton6258dcd2015-10-30 19:25:37 +00001668 case KILL_PACKAGE_DEPENDENTS_TRANSACTION: {
1669 data.enforceInterface(IActivityManager.descriptor);
1670 String packageName = data.readString();
1671 int userId = data.readInt();
1672 killPackageDependents(packageName, userId);
1673 reply.writeNoException();
1674 return true;
1675 }
1676
Dianne Hackborn03abb812010-01-04 18:43:19 -08001677 case FORCE_STOP_PACKAGE_TRANSACTION: {
1678 data.enforceInterface(IActivityManager.descriptor);
1679 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001680 int userId = data.readInt();
1681 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001682 reply.writeNoException();
1683 return true;
1684 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001685
1686 case GET_MY_MEMORY_STATE_TRANSACTION: {
1687 data.enforceInterface(IActivityManager.descriptor);
1688 ActivityManager.RunningAppProcessInfo info =
1689 new ActivityManager.RunningAppProcessInfo();
1690 getMyMemoryState(info);
1691 reply.writeNoException();
1692 info.writeToParcel(reply, 0);
1693 return true;
1694 }
1695
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001696 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1697 data.enforceInterface(IActivityManager.descriptor);
1698 ConfigurationInfo config = getDeviceConfigurationInfo();
1699 reply.writeNoException();
1700 config.writeToParcel(reply, 0);
1701 return true;
1702 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001703
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001704 case PROFILE_CONTROL_TRANSACTION: {
1705 data.enforceInterface(IActivityManager.descriptor);
1706 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001707 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001708 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001709 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001710 ProfilerInfo profilerInfo = data.readInt() != 0
1711 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1712 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001713 reply.writeNoException();
1714 reply.writeInt(res ? 1 : 0);
1715 return true;
1716 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001717
Dianne Hackborn55280a92009-05-07 15:53:46 -07001718 case SHUTDOWN_TRANSACTION: {
1719 data.enforceInterface(IActivityManager.descriptor);
1720 boolean res = shutdown(data.readInt());
1721 reply.writeNoException();
1722 reply.writeInt(res ? 1 : 0);
1723 return true;
1724 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001725
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001726 case STOP_APP_SWITCHES_TRANSACTION: {
1727 data.enforceInterface(IActivityManager.descriptor);
1728 stopAppSwitches();
1729 reply.writeNoException();
1730 return true;
1731 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001732
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001733 case RESUME_APP_SWITCHES_TRANSACTION: {
1734 data.enforceInterface(IActivityManager.descriptor);
1735 resumeAppSwitches();
1736 reply.writeNoException();
1737 return true;
1738 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001739
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001740 case PEEK_SERVICE_TRANSACTION: {
1741 data.enforceInterface(IActivityManager.descriptor);
1742 Intent service = Intent.CREATOR.createFromParcel(data);
1743 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001744 String callingPackage = data.readString();
1745 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001746 reply.writeNoException();
1747 reply.writeStrongBinder(binder);
1748 return true;
1749 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001750
Christopher Tate181fafa2009-05-14 11:12:14 -07001751 case START_BACKUP_AGENT_TRANSACTION: {
1752 data.enforceInterface(IActivityManager.descriptor);
1753 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1754 int backupRestoreMode = data.readInt();
1755 boolean success = bindBackupAgent(info, backupRestoreMode);
1756 reply.writeNoException();
1757 reply.writeInt(success ? 1 : 0);
1758 return true;
1759 }
1760
1761 case BACKUP_AGENT_CREATED_TRANSACTION: {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 String packageName = data.readString();
1764 IBinder agent = data.readStrongBinder();
1765 backupAgentCreated(packageName, agent);
1766 reply.writeNoException();
1767 return true;
1768 }
1769
1770 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1771 data.enforceInterface(IActivityManager.descriptor);
1772 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1773 unbindBackupAgent(info);
1774 reply.writeNoException();
1775 return true;
1776 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001777
1778 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1779 data.enforceInterface(IActivityManager.descriptor);
1780 String packageName = data.readString();
1781 addPackageDependency(packageName);
1782 reply.writeNoException();
1783 return true;
1784 }
1785
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001786 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001787 data.enforceInterface(IActivityManager.descriptor);
1788 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001789 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001790 String reason = data.readString();
1791 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001792 reply.writeNoException();
1793 return true;
1794 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001795
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001796 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1797 data.enforceInterface(IActivityManager.descriptor);
1798 String reason = data.readString();
1799 closeSystemDialogs(reason);
1800 reply.writeNoException();
1801 return true;
1802 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001803
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001804 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1805 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001806 int[] pids = data.createIntArray();
1807 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001808 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001809 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001810 return true;
1811 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001812
1813 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1814 data.enforceInterface(IActivityManager.descriptor);
1815 String processName = data.readString();
1816 int uid = data.readInt();
1817 killApplicationProcess(processName, uid);
1818 reply.writeNoException();
1819 return true;
1820 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001821
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001822 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1823 data.enforceInterface(IActivityManager.descriptor);
1824 IBinder token = data.readStrongBinder();
1825 String packageName = data.readString();
1826 int enterAnim = data.readInt();
1827 int exitAnim = data.readInt();
1828 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001829 reply.writeNoException();
1830 return true;
1831 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001832
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001833 case IS_USER_A_MONKEY_TRANSACTION: {
1834 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001835 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001836 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001837 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001838 return true;
1839 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001840
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001841 case SET_USER_IS_MONKEY_TRANSACTION: {
1842 data.enforceInterface(IActivityManager.descriptor);
1843 final boolean monkey = (data.readInt() == 1);
1844 setUserIsMonkey(monkey);
1845 reply.writeNoException();
1846 return true;
1847 }
1848
Dianne Hackborn860755f2010-06-03 18:47:52 -07001849 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1850 data.enforceInterface(IActivityManager.descriptor);
1851 finishHeavyWeightApp();
1852 reply.writeNoException();
1853 return true;
1854 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001855
1856 case IS_IMMERSIVE_TRANSACTION: {
1857 data.enforceInterface(IActivityManager.descriptor);
1858 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001859 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001860 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001861 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001862 return true;
1863 }
1864
Craig Mautnerd61dc202014-07-07 11:09:11 -07001865 case IS_TOP_OF_TASK_TRANSACTION: {
1866 data.enforceInterface(IActivityManager.descriptor);
1867 IBinder token = data.readStrongBinder();
1868 final boolean isTopOfTask = isTopOfTask(token);
1869 reply.writeNoException();
1870 reply.writeInt(isTopOfTask ? 1 : 0);
1871 return true;
1872 }
1873
Craig Mautner5eda9b32013-07-02 11:58:16 -07001874 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001875 data.enforceInterface(IActivityManager.descriptor);
1876 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001877 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001878 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001879 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001880 return true;
1881 }
1882
1883 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1884 data.enforceInterface(IActivityManager.descriptor);
1885 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001886 final Bundle bundle;
1887 if (data.readInt() == 0) {
1888 bundle = null;
1889 } else {
1890 bundle = data.readBundle();
1891 }
Chong Zhang280d3322015-11-03 17:27:26 -08001892 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Craig Mautner233ceee2014-05-09 17:05:11 -07001893 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001894 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001895 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001896 return true;
1897 }
1898
Craig Mautner233ceee2014-05-09 17:05:11 -07001899 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1900 data.enforceInterface(IActivityManager.descriptor);
1901 IBinder token = data.readStrongBinder();
1902 final ActivityOptions options = getActivityOptions(token);
1903 reply.writeNoException();
1904 reply.writeBundle(options == null ? null : options.toBundle());
1905 return true;
1906 }
1907
Daniel Sandler69a48172010-06-23 16:29:36 -04001908 case SET_IMMERSIVE_TRANSACTION: {
1909 data.enforceInterface(IActivityManager.descriptor);
1910 IBinder token = data.readStrongBinder();
1911 boolean imm = data.readInt() == 1;
1912 setImmersive(token, imm);
1913 reply.writeNoException();
1914 return true;
1915 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001916
Daniel Sandler69a48172010-06-23 16:29:36 -04001917 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1918 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001919 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001920 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001921 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001922 return true;
1923 }
1924
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001925 case CRASH_APPLICATION_TRANSACTION: {
1926 data.enforceInterface(IActivityManager.descriptor);
1927 int uid = data.readInt();
1928 int initialPid = data.readInt();
1929 String packageName = data.readString();
1930 String message = data.readString();
1931 crashApplication(uid, initialPid, packageName, message);
1932 reply.writeNoException();
1933 return true;
1934 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001935
1936 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1937 data.enforceInterface(IActivityManager.descriptor);
1938 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001939 int userId = data.readInt();
1940 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001941 reply.writeNoException();
1942 reply.writeString(type);
1943 return true;
1944 }
1945
Dianne Hackborn7e269642010-08-25 19:50:20 -07001946 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1947 data.enforceInterface(IActivityManager.descriptor);
1948 String name = data.readString();
1949 IBinder perm = newUriPermissionOwner(name);
1950 reply.writeNoException();
1951 reply.writeStrongBinder(perm);
1952 return true;
1953 }
1954
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08001955 case GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION: {
1956 data.enforceInterface(IActivityManager.descriptor);
1957 IBinder activityToken = data.readStrongBinder();
1958 IBinder perm = getUriPermissionOwnerForActivity(activityToken);
1959 reply.writeNoException();
1960 reply.writeStrongBinder(perm);
1961 return true;
1962 }
1963
Dianne Hackborn7e269642010-08-25 19:50:20 -07001964 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1965 data.enforceInterface(IActivityManager.descriptor);
1966 IBinder owner = data.readStrongBinder();
1967 int fromUid = data.readInt();
1968 String targetPkg = data.readString();
1969 Uri uri = Uri.CREATOR.createFromParcel(data);
1970 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001971 int sourceUserId = data.readInt();
1972 int targetUserId = data.readInt();
1973 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1974 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001975 reply.writeNoException();
1976 return true;
1977 }
1978
1979 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1980 data.enforceInterface(IActivityManager.descriptor);
1981 IBinder owner = data.readStrongBinder();
1982 Uri uri = null;
1983 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001984 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001985 }
1986 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001987 int userId = data.readInt();
1988 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001989 reply.writeNoException();
1990 return true;
1991 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001992
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001993 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1994 data.enforceInterface(IActivityManager.descriptor);
1995 int callingUid = data.readInt();
1996 String targetPkg = data.readString();
1997 Uri uri = Uri.CREATOR.createFromParcel(data);
1998 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001999 int userId = data.readInt();
2000 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07002001 reply.writeNoException();
2002 reply.writeInt(res);
2003 return true;
2004 }
2005
Andy McFadden824c5102010-07-09 16:26:57 -07002006 case DUMP_HEAP_TRANSACTION: {
2007 data.enforceInterface(IActivityManager.descriptor);
2008 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07002009 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07002010 boolean managed = data.readInt() != 0;
2011 String path = data.readString();
2012 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07002013 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07002014 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07002015 reply.writeNoException();
2016 reply.writeInt(res ? 1 : 0);
2017 return true;
2018 }
2019
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002020 case START_ACTIVITIES_TRANSACTION:
2021 {
2022 data.enforceInterface(IActivityManager.descriptor);
2023 IBinder b = data.readStrongBinder();
2024 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002025 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002026 Intent[] intents = data.createTypedArray(Intent.CREATOR);
2027 String[] resolvedTypes = data.createStringArray();
2028 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07002029 Bundle options = data.readInt() != 0
2030 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07002031 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002032 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07002033 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002034 reply.writeNoException();
2035 reply.writeInt(result);
2036 return true;
2037 }
2038
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07002039 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
2040 {
2041 data.enforceInterface(IActivityManager.descriptor);
2042 int mode = getFrontActivityScreenCompatMode();
2043 reply.writeNoException();
2044 reply.writeInt(mode);
2045 return true;
2046 }
2047
2048 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
2049 {
2050 data.enforceInterface(IActivityManager.descriptor);
2051 int mode = data.readInt();
2052 setFrontActivityScreenCompatMode(mode);
2053 reply.writeNoException();
2054 reply.writeInt(mode);
2055 return true;
2056 }
2057
2058 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
2059 {
2060 data.enforceInterface(IActivityManager.descriptor);
2061 String pkg = data.readString();
2062 int mode = getPackageScreenCompatMode(pkg);
2063 reply.writeNoException();
2064 reply.writeInt(mode);
2065 return true;
2066 }
2067
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002068 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
2069 {
2070 data.enforceInterface(IActivityManager.descriptor);
2071 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07002072 int mode = data.readInt();
2073 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04002074 reply.writeNoException();
2075 return true;
2076 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002077
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002078 case SWITCH_USER_TRANSACTION: {
2079 data.enforceInterface(IActivityManager.descriptor);
2080 int userid = data.readInt();
2081 boolean result = switchUser(userid);
2082 reply.writeNoException();
2083 reply.writeInt(result ? 1 : 0);
2084 return true;
2085 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07002086
Kenny Guy08488bf2014-02-21 17:40:37 +00002087 case START_USER_IN_BACKGROUND_TRANSACTION: {
2088 data.enforceInterface(IActivityManager.descriptor);
2089 int userid = data.readInt();
2090 boolean result = startUserInBackground(userid);
2091 reply.writeNoException();
2092 reply.writeInt(result ? 1 : 0);
2093 return true;
2094 }
2095
Jeff Sharkeyba512352015-11-12 20:17:45 -08002096 case UNLOCK_USER_TRANSACTION: {
2097 data.enforceInterface(IActivityManager.descriptor);
2098 int userId = data.readInt();
2099 byte[] token = data.createByteArray();
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00002100 byte[] secret = data.createByteArray();
2101 boolean result = unlockUser(userId, token, secret);
Jeff Sharkeyba512352015-11-12 20:17:45 -08002102 reply.writeNoException();
2103 reply.writeInt(result ? 1 : 0);
2104 return true;
2105 }
2106
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002107 case STOP_USER_TRANSACTION: {
2108 data.enforceInterface(IActivityManager.descriptor);
2109 int userid = data.readInt();
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002110 boolean force = data.readInt() != 0;
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002111 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
2112 data.readStrongBinder());
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07002113 int result = stopUser(userid, force, callback);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07002114 reply.writeNoException();
2115 reply.writeInt(result);
2116 return true;
2117 }
2118
Amith Yamasani52f1d752012-03-28 18:19:29 -07002119 case GET_CURRENT_USER_TRANSACTION: {
2120 data.enforceInterface(IActivityManager.descriptor);
2121 UserInfo userInfo = getCurrentUser();
2122 reply.writeNoException();
2123 userInfo.writeToParcel(reply, 0);
2124 return true;
2125 }
2126
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002127 case IS_USER_RUNNING_TRANSACTION: {
2128 data.enforceInterface(IActivityManager.descriptor);
2129 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08002130 int _flags = data.readInt();
2131 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002132 reply.writeNoException();
2133 reply.writeInt(result ? 1 : 0);
2134 return true;
2135 }
2136
Dianne Hackbornc72fc672012-09-20 13:12:03 -07002137 case GET_RUNNING_USER_IDS_TRANSACTION: {
2138 data.enforceInterface(IActivityManager.descriptor);
2139 int[] result = getRunningUserIds();
2140 reply.writeNoException();
2141 reply.writeIntArray(result);
2142 return true;
2143 }
2144
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002145 case REMOVE_TASK_TRANSACTION:
2146 {
2147 data.enforceInterface(IActivityManager.descriptor);
2148 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002149 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002150 reply.writeNoException();
2151 reply.writeInt(result ? 1 : 0);
2152 return true;
2153 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002154
Jeff Sharkeya4620792011-05-20 15:29:23 -07002155 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2156 data.enforceInterface(IActivityManager.descriptor);
2157 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2158 data.readStrongBinder());
2159 registerProcessObserver(observer);
2160 return true;
2161 }
2162
2163 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2164 data.enforceInterface(IActivityManager.descriptor);
2165 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2166 data.readStrongBinder());
2167 unregisterProcessObserver(observer);
2168 return true;
2169 }
2170
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002171 case REGISTER_UID_OBSERVER_TRANSACTION: {
2172 data.enforceInterface(IActivityManager.descriptor);
2173 IUidObserver observer = IUidObserver.Stub.asInterface(
2174 data.readStrongBinder());
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002175 int which = data.readInt();
2176 registerUidObserver(observer, which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002177 return true;
2178 }
2179
2180 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2181 data.enforceInterface(IActivityManager.descriptor);
2182 IUidObserver observer = IUidObserver.Stub.asInterface(
2183 data.readStrongBinder());
2184 unregisterUidObserver(observer);
2185 return true;
2186 }
2187
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002188 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2189 {
2190 data.enforceInterface(IActivityManager.descriptor);
2191 String pkg = data.readString();
2192 boolean ask = getPackageAskScreenCompat(pkg);
2193 reply.writeNoException();
2194 reply.writeInt(ask ? 1 : 0);
2195 return true;
2196 }
2197
2198 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2199 {
2200 data.enforceInterface(IActivityManager.descriptor);
2201 String pkg = data.readString();
2202 boolean ask = data.readInt() != 0;
2203 setPackageAskScreenCompat(pkg, ask);
2204 reply.writeNoException();
2205 return true;
2206 }
2207
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002208 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2209 data.enforceInterface(IActivityManager.descriptor);
2210 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002211 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002212 boolean res = isIntentSenderTargetedToPackage(r);
2213 reply.writeNoException();
2214 reply.writeInt(res ? 1 : 0);
2215 return true;
2216 }
2217
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002218 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2219 data.enforceInterface(IActivityManager.descriptor);
2220 IIntentSender r = IIntentSender.Stub.asInterface(
2221 data.readStrongBinder());
2222 boolean res = isIntentSenderAnActivity(r);
2223 reply.writeNoException();
2224 reply.writeInt(res ? 1 : 0);
2225 return true;
2226 }
2227
Dianne Hackborn81038902012-11-26 17:04:09 -08002228 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2229 data.enforceInterface(IActivityManager.descriptor);
2230 IIntentSender r = IIntentSender.Stub.asInterface(
2231 data.readStrongBinder());
2232 Intent intent = getIntentForIntentSender(r);
2233 reply.writeNoException();
2234 if (intent != null) {
2235 reply.writeInt(1);
2236 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2237 } else {
2238 reply.writeInt(0);
2239 }
2240 return true;
2241 }
2242
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002243 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2244 data.enforceInterface(IActivityManager.descriptor);
2245 IIntentSender r = IIntentSender.Stub.asInterface(
2246 data.readStrongBinder());
2247 String prefix = data.readString();
2248 String tag = getTagForIntentSender(r, prefix);
2249 reply.writeNoException();
2250 reply.writeString(tag);
2251 return true;
2252 }
2253
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002254 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2255 data.enforceInterface(IActivityManager.descriptor);
2256 Configuration config = Configuration.CREATOR.createFromParcel(data);
2257 updatePersistentConfiguration(config);
2258 reply.writeNoException();
2259 return true;
2260 }
2261
Dianne Hackbornb437e092011-08-05 17:50:29 -07002262 case GET_PROCESS_PSS_TRANSACTION: {
2263 data.enforceInterface(IActivityManager.descriptor);
2264 int[] pids = data.createIntArray();
2265 long[] pss = getProcessPss(pids);
2266 reply.writeNoException();
2267 reply.writeLongArray(pss);
2268 return true;
2269 }
2270
Dianne Hackborn661cd522011-08-22 00:26:20 -07002271 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2272 data.enforceInterface(IActivityManager.descriptor);
2273 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2274 boolean always = data.readInt() != 0;
2275 showBootMessage(msg, always);
2276 reply.writeNoException();
2277 return true;
2278 }
2279
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002280 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002281 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002282 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002283 reply.writeNoException();
2284 return true;
2285 }
2286
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002287 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2288 data.enforceInterface(IActivityManager.descriptor);
2289 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2290 reply.writeNoException();
2291 return true;
2292 }
2293
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002294 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002295 data.enforceInterface(IActivityManager.descriptor);
2296 IBinder token = data.readStrongBinder();
2297 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002298 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002299 reply.writeNoException();
2300 reply.writeInt(res ? 1 : 0);
2301 return true;
2302 }
2303
2304 case NAVIGATE_UP_TO_TRANSACTION: {
2305 data.enforceInterface(IActivityManager.descriptor);
2306 IBinder token = data.readStrongBinder();
2307 Intent target = Intent.CREATOR.createFromParcel(data);
2308 int resultCode = data.readInt();
2309 Intent resultData = null;
2310 if (data.readInt() != 0) {
2311 resultData = Intent.CREATOR.createFromParcel(data);
2312 }
2313 boolean res = navigateUpTo(token, target, resultCode, resultData);
2314 reply.writeNoException();
2315 reply.writeInt(res ? 1 : 0);
2316 return true;
2317 }
2318
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002319 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2320 data.enforceInterface(IActivityManager.descriptor);
2321 IBinder token = data.readStrongBinder();
2322 int res = getLaunchedFromUid(token);
2323 reply.writeNoException();
2324 reply.writeInt(res);
2325 return true;
2326 }
2327
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002328 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2329 data.enforceInterface(IActivityManager.descriptor);
2330 IBinder token = data.readStrongBinder();
2331 String res = getLaunchedFromPackage(token);
2332 reply.writeNoException();
2333 reply.writeString(res);
2334 return true;
2335 }
2336
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002337 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2338 data.enforceInterface(IActivityManager.descriptor);
2339 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2340 data.readStrongBinder());
2341 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002342 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002343 return true;
2344 }
2345
2346 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2347 data.enforceInterface(IActivityManager.descriptor);
2348 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2349 data.readStrongBinder());
2350 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002351 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002352 return true;
2353 }
2354
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002355 case REQUEST_BUG_REPORT_TRANSACTION: {
2356 data.enforceInterface(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00002357 int bugreportType = data.readInt();
2358 requestBugReport(bugreportType);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002359 reply.writeNoException();
2360 return true;
2361 }
2362
2363 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2364 data.enforceInterface(IActivityManager.descriptor);
2365 int pid = data.readInt();
2366 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002367 String reason = data.readString();
2368 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002369 reply.writeNoException();
2370 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002371 return true;
2372 }
2373
Adam Skorydfc7fd72013-08-05 19:23:41 -07002374 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002375 data.enforceInterface(IActivityManager.descriptor);
2376 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002377 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002378 reply.writeNoException();
2379 reply.writeBundle(res);
2380 return true;
2381 }
2382
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002383 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2384 data.enforceInterface(IActivityManager.descriptor);
2385 int requestType = data.readInt();
2386 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002387 IBinder activityToken = data.readStrongBinder();
2388 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002389 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002390 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002391 return true;
2392 }
2393
Adam Skorydfc7fd72013-08-05 19:23:41 -07002394 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002395 data.enforceInterface(IActivityManager.descriptor);
2396 IBinder token = data.readStrongBinder();
2397 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002398 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2399 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002400 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2401 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002402 reply.writeNoException();
2403 return true;
2404 }
2405
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002406 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2407 data.enforceInterface(IActivityManager.descriptor);
2408 Intent intent = Intent.CREATOR.createFromParcel(data);
2409 int requestType = data.readInt();
2410 String hint = data.readString();
2411 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002412 Bundle args = data.readBundle();
2413 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002414 reply.writeNoException();
2415 reply.writeInt(res ? 1 : 0);
2416 return true;
2417 }
2418
Benjamin Franzc200f442015-06-25 18:20:04 +01002419 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2420 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002421 boolean res = isAssistDataAllowedOnCurrentActivity();
2422 reply.writeNoException();
2423 reply.writeInt(res ? 1 : 0);
2424 return true;
2425 }
2426
2427 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2428 data.enforceInterface(IActivityManager.descriptor);
2429 IBinder token = data.readStrongBinder();
2430 Bundle args = data.readBundle();
2431 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002432 reply.writeNoException();
2433 reply.writeInt(res ? 1 : 0);
2434 return true;
2435 }
2436
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002437 case KILL_UID_TRANSACTION: {
2438 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002439 int appId = data.readInt();
2440 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002441 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002442 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002443 reply.writeNoException();
2444 return true;
2445 }
2446
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002447 case HANG_TRANSACTION: {
2448 data.enforceInterface(IActivityManager.descriptor);
2449 IBinder who = data.readStrongBinder();
2450 boolean allowRestart = data.readInt() != 0;
2451 hang(who, allowRestart);
2452 reply.writeNoException();
2453 return true;
2454 }
2455
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002456 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2457 data.enforceInterface(IActivityManager.descriptor);
2458 IBinder token = data.readStrongBinder();
2459 reportActivityFullyDrawn(token);
2460 reply.writeNoException();
2461 return true;
2462 }
2463
Craig Mautner5eda9b32013-07-02 11:58:16 -07002464 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2465 data.enforceInterface(IActivityManager.descriptor);
2466 IBinder token = data.readStrongBinder();
2467 notifyActivityDrawn(token);
2468 reply.writeNoException();
2469 return true;
2470 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002471
2472 case RESTART_TRANSACTION: {
2473 data.enforceInterface(IActivityManager.descriptor);
2474 restart();
2475 reply.writeNoException();
2476 return true;
2477 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002478
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002479 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2480 data.enforceInterface(IActivityManager.descriptor);
2481 performIdleMaintenance();
2482 reply.writeNoException();
2483 return true;
2484 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002485
Todd Kennedyca4d8422015-01-15 15:19:22 -08002486 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002487 data.enforceInterface(IActivityManager.descriptor);
2488 IBinder parentActivityToken = data.readStrongBinder();
2489 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002490 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002491 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002492 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002493 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002494 if (activityContainer != null) {
2495 reply.writeInt(1);
2496 reply.writeStrongBinder(activityContainer.asBinder());
2497 } else {
2498 reply.writeInt(0);
2499 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002500 return true;
2501 }
2502
Craig Mautner95da1082014-02-24 17:54:35 -08002503 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2504 data.enforceInterface(IActivityManager.descriptor);
2505 IActivityContainer activityContainer =
2506 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2507 deleteActivityContainer(activityContainer);
2508 reply.writeNoException();
2509 return true;
2510 }
2511
Todd Kennedy4900bf92015-01-16 16:05:14 -08002512 case CREATE_STACK_ON_DISPLAY: {
2513 data.enforceInterface(IActivityManager.descriptor);
2514 int displayId = data.readInt();
2515 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2516 reply.writeNoException();
2517 if (activityContainer != null) {
2518 reply.writeInt(1);
2519 reply.writeStrongBinder(activityContainer.asBinder());
2520 } else {
2521 reply.writeInt(0);
2522 }
2523 return true;
2524 }
2525
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002526 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002527 data.enforceInterface(IActivityManager.descriptor);
2528 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002529 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002530 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002531 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002532 return true;
2533 }
2534
Craig Mautneraea74a52014-03-08 14:23:10 -08002535 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2536 data.enforceInterface(IActivityManager.descriptor);
2537 final int taskId = data.readInt();
2538 startLockTaskMode(taskId);
2539 reply.writeNoException();
2540 return true;
2541 }
2542
2543 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2544 data.enforceInterface(IActivityManager.descriptor);
2545 IBinder token = data.readStrongBinder();
2546 startLockTaskMode(token);
2547 reply.writeNoException();
2548 return true;
2549 }
2550
Craig Mautnerd61dc202014-07-07 11:09:11 -07002551 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002552 data.enforceInterface(IActivityManager.descriptor);
2553 startLockTaskModeOnCurrent();
2554 reply.writeNoException();
2555 return true;
2556 }
2557
Craig Mautneraea74a52014-03-08 14:23:10 -08002558 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2559 data.enforceInterface(IActivityManager.descriptor);
2560 stopLockTaskMode();
2561 reply.writeNoException();
2562 return true;
2563 }
2564
Craig Mautnerd61dc202014-07-07 11:09:11 -07002565 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002566 data.enforceInterface(IActivityManager.descriptor);
2567 stopLockTaskModeOnCurrent();
2568 reply.writeNoException();
2569 return true;
2570 }
2571
Craig Mautneraea74a52014-03-08 14:23:10 -08002572 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2573 data.enforceInterface(IActivityManager.descriptor);
2574 final boolean isInLockTaskMode = isInLockTaskMode();
2575 reply.writeNoException();
2576 reply.writeInt(isInLockTaskMode ? 1 : 0);
2577 return true;
2578 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002579
Benjamin Franz43261142015-02-11 15:59:44 +00002580 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2581 data.enforceInterface(IActivityManager.descriptor);
2582 final int lockTaskModeState = getLockTaskModeState();
2583 reply.writeNoException();
2584 reply.writeInt(lockTaskModeState);
2585 return true;
2586 }
2587
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002588 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2589 data.enforceInterface(IActivityManager.descriptor);
2590 final IBinder token = data.readStrongBinder();
2591 showLockTaskEscapeMessage(token);
2592 reply.writeNoException();
2593 return true;
2594 }
2595
Winson Chunga449dc02014-05-16 11:15:04 -07002596 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002597 data.enforceInterface(IActivityManager.descriptor);
2598 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002599 ActivityManager.TaskDescription values =
2600 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2601 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002602 reply.writeNoException();
2603 return true;
2604 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002605
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002606 case SET_TASK_RESIZEABLE_TRANSACTION: {
2607 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08002608 final int taskId = data.readInt();
2609 final int resizeableMode = data.readInt();
2610 setTaskResizeable(taskId, resizeableMode);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002611 reply.writeNoException();
2612 return true;
2613 }
2614
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002615 case RESIZE_TASK_TRANSACTION: {
2616 data.enforceInterface(IActivityManager.descriptor);
2617 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002618 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002619 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002620 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002621 reply.writeNoException();
2622 return true;
2623 }
2624
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002625 case GET_TASK_BOUNDS_TRANSACTION: {
2626 data.enforceInterface(IActivityManager.descriptor);
2627 int taskId = data.readInt();
2628 Rect r = getTaskBounds(taskId);
2629 reply.writeNoException();
2630 r.writeToParcel(reply, 0);
2631 return true;
2632 }
2633
Craig Mautner648f69b2014-09-18 14:16:26 -07002634 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2635 data.enforceInterface(IActivityManager.descriptor);
2636 String filename = data.readString();
Suprabh Shukla23593142015-11-03 17:31:15 -08002637 int userId = data.readInt();
2638 Bitmap icon = getTaskDescriptionIcon(filename, userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07002639 reply.writeNoException();
2640 if (icon == null) {
2641 reply.writeInt(0);
2642 } else {
2643 reply.writeInt(1);
2644 icon.writeToParcel(reply, 0);
2645 }
2646 return true;
2647 }
2648
Winson Chung044d5292014-11-06 11:05:19 -08002649 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2650 data.enforceInterface(IActivityManager.descriptor);
2651 final Bundle bundle;
2652 if (data.readInt() == 0) {
2653 bundle = null;
2654 } else {
2655 bundle = data.readBundle();
2656 }
Chong Zhang280d3322015-11-03 17:27:26 -08002657 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002658 startInPlaceAnimationOnFrontMostApplication(options);
2659 reply.writeNoException();
2660 return true;
2661 }
2662
Jose Lima4b6c6692014-08-12 17:41:12 -07002663 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002664 data.enforceInterface(IActivityManager.descriptor);
2665 IBinder token = data.readStrongBinder();
2666 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002667 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002668 reply.writeNoException();
2669 reply.writeInt(success ? 1 : 0);
2670 return true;
2671 }
2672
Jose Lima4b6c6692014-08-12 17:41:12 -07002673 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002674 data.enforceInterface(IActivityManager.descriptor);
2675 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002676 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002677 reply.writeNoException();
2678 reply.writeInt(enabled ? 1 : 0);
2679 return true;
2680 }
2681
Jose Lima4b6c6692014-08-12 17:41:12 -07002682 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002683 data.enforceInterface(IActivityManager.descriptor);
2684 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002685 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002686 reply.writeNoException();
2687 return true;
2688 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002689
2690 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2691 data.enforceInterface(IActivityManager.descriptor);
2692 IBinder token = data.readStrongBinder();
2693 notifyLaunchTaskBehindComplete(token);
2694 reply.writeNoException();
2695 return true;
2696 }
Craig Mautner8746a472014-07-24 15:12:54 -07002697
2698 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2699 data.enforceInterface(IActivityManager.descriptor);
2700 IBinder token = data.readStrongBinder();
2701 notifyEnterAnimationComplete(token);
2702 reply.writeNoException();
2703 return true;
2704 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002705
2706 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2707 data.enforceInterface(IActivityManager.descriptor);
2708 bootAnimationComplete();
2709 reply.writeNoException();
2710 return true;
2711 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002712
Jeff Sharkey605eb792014-11-04 13:34:06 -08002713 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2714 data.enforceInterface(IActivityManager.descriptor);
2715 final int uid = data.readInt();
2716 final byte[] firstPacket = data.createByteArray();
2717 notifyCleartextNetwork(uid, firstPacket);
2718 reply.writeNoException();
2719 return true;
2720 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002721
2722 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2723 data.enforceInterface(IActivityManager.descriptor);
2724 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002725 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002726 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002727 String reportPackage = data.readString();
2728 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002729 reply.writeNoException();
2730 return true;
2731 }
2732
2733 case DUMP_HEAP_FINISHED_TRANSACTION: {
2734 data.enforceInterface(IActivityManager.descriptor);
2735 String path = data.readString();
2736 dumpHeapFinished(path);
2737 reply.writeNoException();
2738 return true;
2739 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002740
2741 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2742 data.enforceInterface(IActivityManager.descriptor);
2743 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2744 data.readStrongBinder());
2745 boolean keepAwake = data.readInt() != 0;
2746 setVoiceKeepAwake(session, keepAwake);
2747 reply.writeNoException();
2748 return true;
2749 }
Craig Mautnere5600772015-04-03 21:36:37 -07002750
2751 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2752 data.enforceInterface(IActivityManager.descriptor);
2753 int userId = data.readInt();
2754 String[] packages = data.readStringArray();
2755 updateLockTaskPackages(userId, packages);
2756 reply.writeNoException();
2757 return true;
2758 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002759
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002760 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2761 data.enforceInterface(IActivityManager.descriptor);
2762 String packageName = data.readString();
2763 updateDeviceOwner(packageName);
2764 reply.writeNoException();
2765 return true;
2766 }
2767
Dianne Hackborn1e383822015-04-10 14:02:33 -07002768 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2769 data.enforceInterface(IActivityManager.descriptor);
2770 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002771 String callingPackage = data.readString();
2772 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002773 reply.writeNoException();
2774 reply.writeInt(res);
2775 return true;
2776 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002777
2778 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2779 data.enforceInterface(IActivityManager.descriptor);
2780 String process = data.readString();
2781 int userId = data.readInt();
2782 int level = data.readInt();
2783 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2784 reply.writeNoException();
2785 reply.writeInt(res ? 1 : 0);
2786 return true;
2787 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002788
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002789 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2790 data.enforceInterface(IActivityManager.descriptor);
2791 IBinder token = data.readStrongBinder();
2792 boolean res = isRootVoiceInteraction(token);
2793 reply.writeNoException();
2794 reply.writeInt(res ? 1 : 0);
2795 return true;
2796 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002797
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002798 case START_BINDER_TRACKING_TRANSACTION: {
2799 data.enforceInterface(IActivityManager.descriptor);
2800 boolean res = startBinderTracking();
2801 reply.writeNoException();
2802 reply.writeInt(res ? 1 : 0);
2803 return true;
2804 }
2805
2806 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2807 data.enforceInterface(IActivityManager.descriptor);
2808 ParcelFileDescriptor fd = data.readInt() != 0
2809 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2810 boolean res = stopBinderTrackingAndDump(fd);
2811 reply.writeNoException();
2812 reply.writeInt(res ? 1 : 0);
2813 return true;
2814 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002815 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2816 data.enforceInterface(IActivityManager.descriptor);
2817 IBinder token = data.readStrongBinder();
2818 int stackId = getActivityStackId(token);
2819 reply.writeNoException();
2820 reply.writeInt(stackId);
2821 return true;
2822 }
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002823 case EXIT_FREEFORM_MODE_TRANSACTION: {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002824 data.enforceInterface(IActivityManager.descriptor);
2825 IBinder token = data.readStrongBinder();
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08002826 exitFreeformMode(token);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002827 reply.writeNoException();
2828 return true;
2829 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002830 case REPORT_SIZE_CONFIGURATIONS: {
2831 data.enforceInterface(IActivityManager.descriptor);
2832 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002833 int[] horizontal = readIntArray(data);
2834 int[] vertical = readIntArray(data);
2835 int[] smallest = readIntArray(data);
2836 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002837 return true;
2838 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002839 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2840 data.enforceInterface(IActivityManager.descriptor);
2841 final boolean suppress = data.readInt() == 1;
2842 suppressResizeConfigChanges(suppress);
2843 reply.writeNoException();
2844 return true;
2845 }
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08002846 case MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002847 data.enforceInterface(IActivityManager.descriptor);
2848 final int stackId = data.readInt();
Wale Ogunwale9101d262016-01-15 08:56:11 -08002849 final boolean onTop = data.readInt() == 1;
2850 moveTasksToFullscreenStack(stackId, onTop);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002851 reply.writeNoException();
2852 return true;
2853 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002854 case GET_APP_START_MODE_TRANSACTION: {
2855 data.enforceInterface(IActivityManager.descriptor);
2856 final int uid = data.readInt();
2857 final String pkg = data.readString();
2858 int res = getAppStartMode(uid, pkg);
2859 reply.writeNoException();
2860 reply.writeInt(res);
2861 return true;
2862 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002863 case IN_MULTI_WINDOW_TRANSACTION: {
Wale Ogunwale5f986092015-12-04 15:35:38 -08002864 data.enforceInterface(IActivityManager.descriptor);
2865 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002866 final boolean inMultiWindow = inMultiWindow(token);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002867 reply.writeNoException();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002868 reply.writeInt(inMultiWindow ? 1 : 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002869 return true;
2870 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002871 case IN_PICTURE_IN_PICTURE_TRANSACTION: {
Wale Ogunwale5f986092015-12-04 15:35:38 -08002872 data.enforceInterface(IActivityManager.descriptor);
2873 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002874 final boolean inPip = inPictureInPicture(token);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002875 reply.writeNoException();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002876 reply.writeInt(inPip ? 1 : 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08002877 return true;
2878 }
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002879 case ENTER_PICTURE_IN_PICTURE_TRANSACTION: {
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002880 data.enforceInterface(IActivityManager.descriptor);
2881 final IBinder token = data.readStrongBinder();
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08002882 enterPictureInPicture(token);
Wale Ogunwale9c604c72015-12-06 18:42:57 -08002883 reply.writeNoException();
2884 return true;
2885 }
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08002886 case SET_VR_MODE_TRANSACTION: {
2887 data.enforceInterface(IActivityManager.descriptor);
2888 final IBinder token = data.readStrongBinder();
2889 final boolean enable = data.readInt() == 1;
2890 setVrMode(token, enable);
2891 reply.writeNoException();
2892 return true;
2893 }
Christopher Tate63fec3e2015-12-11 18:35:28 -08002894 case IS_APP_FOREGROUND_TRANSACTION: {
2895 data.enforceInterface(IActivityManager.descriptor);
2896 final int userHandle = data.readInt();
2897 final boolean isForeground = isAppForeground(userHandle);
2898 reply.writeNoException();
2899 reply.writeInt(isForeground ? 1 : 0);
2900 return true;
2901 }
Wale Ogunwale480dca02016-02-06 13:58:29 -08002902 case NOTIFY_PINNED_STACK_ANIMATION_ENDED_TRANSACTION: {
2903 data.enforceInterface(IActivityManager.descriptor);
2904 reply.writeNoException();
2905 return true;
2906 }
Wale Ogunwale06e8ee02016-02-12 12:56:32 -08002907 case REMOVE_STACK: {
2908 data.enforceInterface(IActivityManager.descriptor);
2909 final int stackId = data.readInt();
2910 removeStack(stackId);
2911 reply.writeNoException();
2912 return true;
2913 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002914 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002915
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002916 return super.onTransact(code, data, reply, flags);
2917 }
2918
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002919 private int[] readIntArray(Parcel data) {
2920 int[] smallest = null;
2921 int smallestSize = data.readInt();
2922 if (smallestSize > 0) {
2923 smallest = new int[smallestSize];
2924 data.readIntArray(smallest);
2925 }
2926 return smallest;
2927 }
2928
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002929 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002930 return this;
2931 }
2932
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002933 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2934 protected IActivityManager create() {
2935 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002936 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002937 Log.v("ActivityManager", "default service binder = " + b);
2938 }
2939 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002940 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002941 Log.v("ActivityManager", "default service = " + am);
2942 }
2943 return am;
2944 }
2945 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002946}
2947
2948class ActivityManagerProxy implements IActivityManager
2949{
2950 public ActivityManagerProxy(IBinder remote)
2951 {
2952 mRemote = remote;
2953 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002954
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002955 public IBinder asBinder()
2956 {
2957 return mRemote;
2958 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002959
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002960 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002961 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002962 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002963 Parcel data = Parcel.obtain();
2964 Parcel reply = Parcel.obtain();
2965 data.writeInterfaceToken(IActivityManager.descriptor);
2966 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002967 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002968 intent.writeToParcel(data, 0);
2969 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002970 data.writeStrongBinder(resultTo);
2971 data.writeString(resultWho);
2972 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002973 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002974 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002975 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002976 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002977 } else {
2978 data.writeInt(0);
2979 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002980 if (options != null) {
2981 data.writeInt(1);
2982 options.writeToParcel(data, 0);
2983 } else {
2984 data.writeInt(0);
2985 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002986 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2987 reply.readException();
2988 int result = reply.readInt();
2989 reply.recycle();
2990 data.recycle();
2991 return result;
2992 }
Amith Yamasani82644082012-08-03 13:09:11 -07002993
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002994 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002995 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002996 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2997 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002998 Parcel data = Parcel.obtain();
2999 Parcel reply = Parcel.obtain();
3000 data.writeInterfaceToken(IActivityManager.descriptor);
3001 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003002 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07003003 intent.writeToParcel(data, 0);
3004 data.writeString(resolvedType);
3005 data.writeStrongBinder(resultTo);
3006 data.writeString(resultWho);
3007 data.writeInt(requestCode);
3008 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003009 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07003010 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003011 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07003012 } else {
3013 data.writeInt(0);
3014 }
3015 if (options != null) {
3016 data.writeInt(1);
3017 options.writeToParcel(data, 0);
3018 } else {
3019 data.writeInt(0);
3020 }
3021 data.writeInt(userId);
3022 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
3023 reply.readException();
3024 int result = reply.readInt();
3025 reply.recycle();
3026 data.recycle();
3027 return result;
3028 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003029 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
3030 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07003031 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
3032 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003033 Parcel data = Parcel.obtain();
3034 Parcel reply = Parcel.obtain();
3035 data.writeInterfaceToken(IActivityManager.descriptor);
3036 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3037 data.writeString(callingPackage);
3038 intent.writeToParcel(data, 0);
3039 data.writeString(resolvedType);
3040 data.writeStrongBinder(resultTo);
3041 data.writeString(resultWho);
3042 data.writeInt(requestCode);
3043 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003044 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003045 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003046 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003047 } else {
3048 data.writeInt(0);
3049 }
3050 if (options != null) {
3051 data.writeInt(1);
3052 options.writeToParcel(data, 0);
3053 } else {
3054 data.writeInt(0);
3055 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07003056 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07003057 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07003058 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
3059 reply.readException();
3060 int result = reply.readInt();
3061 reply.recycle();
3062 data.recycle();
3063 return result;
3064 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003065 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
3066 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07003067 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
3068 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003069 Parcel data = Parcel.obtain();
3070 Parcel reply = Parcel.obtain();
3071 data.writeInterfaceToken(IActivityManager.descriptor);
3072 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003073 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003074 intent.writeToParcel(data, 0);
3075 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003076 data.writeStrongBinder(resultTo);
3077 data.writeString(resultWho);
3078 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003079 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003080 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003081 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003082 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003083 } else {
3084 data.writeInt(0);
3085 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07003086 if (options != null) {
3087 data.writeInt(1);
3088 options.writeToParcel(data, 0);
3089 } else {
3090 data.writeInt(0);
3091 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003092 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08003093 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
3094 reply.readException();
3095 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
3096 reply.recycle();
3097 data.recycle();
3098 return result;
3099 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003100 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
3101 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003102 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07003103 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003104 Parcel data = Parcel.obtain();
3105 Parcel reply = Parcel.obtain();
3106 data.writeInterfaceToken(IActivityManager.descriptor);
3107 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08003108 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003109 intent.writeToParcel(data, 0);
3110 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003111 data.writeStrongBinder(resultTo);
3112 data.writeString(resultWho);
3113 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003114 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003115 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003116 if (options != null) {
3117 data.writeInt(1);
3118 options.writeToParcel(data, 0);
3119 } else {
3120 data.writeInt(0);
3121 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003122 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003123 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
3124 reply.readException();
3125 int result = reply.readInt();
3126 reply.recycle();
3127 data.recycle();
3128 return result;
3129 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003130 public int startActivityIntentSender(IApplicationThread caller,
3131 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003132 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003133 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003134 Parcel data = Parcel.obtain();
3135 Parcel reply = Parcel.obtain();
3136 data.writeInterfaceToken(IActivityManager.descriptor);
3137 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3138 intent.writeToParcel(data, 0);
3139 if (fillInIntent != null) {
3140 data.writeInt(1);
3141 fillInIntent.writeToParcel(data, 0);
3142 } else {
3143 data.writeInt(0);
3144 }
3145 data.writeString(resolvedType);
3146 data.writeStrongBinder(resultTo);
3147 data.writeString(resultWho);
3148 data.writeInt(requestCode);
3149 data.writeInt(flagsMask);
3150 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003151 if (options != null) {
3152 data.writeInt(1);
3153 options.writeToParcel(data, 0);
3154 } else {
3155 data.writeInt(0);
3156 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07003157 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07003158 reply.readException();
3159 int result = reply.readInt();
3160 reply.recycle();
3161 data.recycle();
3162 return result;
3163 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07003164 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
3165 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07003166 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
3167 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003168 Parcel data = Parcel.obtain();
3169 Parcel reply = Parcel.obtain();
3170 data.writeInterfaceToken(IActivityManager.descriptor);
3171 data.writeString(callingPackage);
3172 data.writeInt(callingPid);
3173 data.writeInt(callingUid);
3174 intent.writeToParcel(data, 0);
3175 data.writeString(resolvedType);
3176 data.writeStrongBinder(session.asBinder());
3177 data.writeStrongBinder(interactor.asBinder());
3178 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07003179 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07003180 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07003181 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07003182 } else {
3183 data.writeInt(0);
3184 }
3185 if (options != null) {
3186 data.writeInt(1);
3187 options.writeToParcel(data, 0);
3188 } else {
3189 data.writeInt(0);
3190 }
3191 data.writeInt(userId);
3192 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3193 reply.readException();
3194 int result = reply.readInt();
3195 reply.recycle();
3196 data.recycle();
3197 return result;
3198 }
Amith Yamasani0af6fa72016-01-17 15:36:19 -08003199
3200 public void startLocalVoiceInteraction(IBinder callingActivity, Bundle options)
3201 throws RemoteException {
3202 Parcel data = Parcel.obtain();
3203 Parcel reply = Parcel.obtain();
3204 data.writeInterfaceToken(IActivityManager.descriptor);
3205 data.writeStrongBinder(callingActivity);
3206 data.writeBundle(options);
3207 mRemote.transact(START_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3208 reply.readException();
3209 reply.recycle();
3210 data.recycle();
3211 }
3212
3213 public void stopLocalVoiceInteraction(IBinder callingActivity) throws RemoteException {
3214 Parcel data = Parcel.obtain();
3215 Parcel reply = Parcel.obtain();
3216 data.writeInterfaceToken(IActivityManager.descriptor);
3217 data.writeStrongBinder(callingActivity);
3218 mRemote.transact(STOP_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3219 reply.readException();
3220 reply.recycle();
3221 data.recycle();
3222 }
3223
3224 public boolean supportsLocalVoiceInteraction() throws RemoteException {
3225 Parcel data = Parcel.obtain();
3226 Parcel reply = Parcel.obtain();
3227 data.writeInterfaceToken(IActivityManager.descriptor);
3228 mRemote.transact(SUPPORTS_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
3229 reply.readException();
3230 int result = reply.readInt();
3231 reply.recycle();
3232 data.recycle();
3233 return result != 0;
3234 }
3235
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003236 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003237 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003238 Parcel data = Parcel.obtain();
3239 Parcel reply = Parcel.obtain();
3240 data.writeInterfaceToken(IActivityManager.descriptor);
3241 data.writeStrongBinder(callingActivity);
3242 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003243 if (options != null) {
3244 data.writeInt(1);
3245 options.writeToParcel(data, 0);
3246 } else {
3247 data.writeInt(0);
3248 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003249 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3250 reply.readException();
3251 int result = reply.readInt();
3252 reply.recycle();
3253 data.recycle();
3254 return result != 0;
3255 }
Wale Ogunwale854809c2015-12-27 16:18:19 -08003256 public int startActivityFromRecents(int taskId, Bundle options)
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003257 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003258 Parcel data = Parcel.obtain();
3259 Parcel reply = Parcel.obtain();
3260 data.writeInterfaceToken(IActivityManager.descriptor);
3261 data.writeInt(taskId);
3262 if (options == null) {
3263 data.writeInt(0);
3264 } else {
3265 data.writeInt(1);
3266 options.writeToParcel(data, 0);
3267 }
3268 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3269 reply.readException();
3270 int result = reply.readInt();
3271 reply.recycle();
3272 data.recycle();
3273 return result;
3274 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003275 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003276 throws RemoteException {
3277 Parcel data = Parcel.obtain();
3278 Parcel reply = Parcel.obtain();
3279 data.writeInterfaceToken(IActivityManager.descriptor);
3280 data.writeStrongBinder(token);
3281 data.writeInt(resultCode);
3282 if (resultData != null) {
3283 data.writeInt(1);
3284 resultData.writeToParcel(data, 0);
3285 } else {
3286 data.writeInt(0);
3287 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003288 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003289 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3290 reply.readException();
3291 boolean res = reply.readInt() != 0;
3292 data.recycle();
3293 reply.recycle();
3294 return res;
3295 }
3296 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3297 {
3298 Parcel data = Parcel.obtain();
3299 Parcel reply = Parcel.obtain();
3300 data.writeInterfaceToken(IActivityManager.descriptor);
3301 data.writeStrongBinder(token);
3302 data.writeString(resultWho);
3303 data.writeInt(requestCode);
3304 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3305 reply.readException();
3306 data.recycle();
3307 reply.recycle();
3308 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003309 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3310 Parcel data = Parcel.obtain();
3311 Parcel reply = Parcel.obtain();
3312 data.writeInterfaceToken(IActivityManager.descriptor);
3313 data.writeStrongBinder(token);
3314 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3315 reply.readException();
3316 boolean res = reply.readInt() != 0;
3317 data.recycle();
3318 reply.recycle();
3319 return res;
3320 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003321 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3322 Parcel data = Parcel.obtain();
3323 Parcel reply = Parcel.obtain();
3324 data.writeInterfaceToken(IActivityManager.descriptor);
3325 data.writeStrongBinder(session.asBinder());
3326 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3327 reply.readException();
3328 data.recycle();
3329 reply.recycle();
3330 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003331 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3332 Parcel data = Parcel.obtain();
3333 Parcel reply = Parcel.obtain();
3334 data.writeInterfaceToken(IActivityManager.descriptor);
3335 data.writeStrongBinder(token);
3336 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3337 reply.readException();
3338 boolean res = reply.readInt() != 0;
3339 data.recycle();
3340 reply.recycle();
3341 return res;
3342 }
3343 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3344 Parcel data = Parcel.obtain();
3345 Parcel reply = Parcel.obtain();
3346 data.writeInterfaceToken(IActivityManager.descriptor);
3347 data.writeStrongBinder(app.asBinder());
3348 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3349 reply.readException();
3350 data.recycle();
3351 reply.recycle();
3352 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003353 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3354 Parcel data = Parcel.obtain();
3355 Parcel reply = Parcel.obtain();
3356 data.writeInterfaceToken(IActivityManager.descriptor);
3357 data.writeStrongBinder(token);
3358 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3359 reply.readException();
3360 boolean res = reply.readInt() != 0;
3361 data.recycle();
3362 reply.recycle();
3363 return res;
3364 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003365 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003366 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003367 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003368 {
3369 Parcel data = Parcel.obtain();
3370 Parcel reply = Parcel.obtain();
3371 data.writeInterfaceToken(IActivityManager.descriptor);
3372 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003373 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003374 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3375 filter.writeToParcel(data, 0);
3376 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003377 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003378 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3379 reply.readException();
3380 Intent intent = null;
3381 int haveIntent = reply.readInt();
3382 if (haveIntent != 0) {
3383 intent = Intent.CREATOR.createFromParcel(reply);
3384 }
3385 reply.recycle();
3386 data.recycle();
3387 return intent;
3388 }
3389 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3390 {
3391 Parcel data = Parcel.obtain();
3392 Parcel reply = Parcel.obtain();
3393 data.writeInterfaceToken(IActivityManager.descriptor);
3394 data.writeStrongBinder(receiver.asBinder());
3395 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3396 reply.readException();
3397 data.recycle();
3398 reply.recycle();
3399 }
3400 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003401 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003402 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003403 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003404 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003405 {
3406 Parcel data = Parcel.obtain();
3407 Parcel reply = Parcel.obtain();
3408 data.writeInterfaceToken(IActivityManager.descriptor);
3409 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3410 intent.writeToParcel(data, 0);
3411 data.writeString(resolvedType);
3412 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3413 data.writeInt(resultCode);
3414 data.writeString(resultData);
3415 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003416 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003417 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003418 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003419 data.writeInt(serialized ? 1 : 0);
3420 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003421 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003422 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3423 reply.readException();
3424 int res = reply.readInt();
3425 reply.recycle();
3426 data.recycle();
3427 return res;
3428 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003429 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3430 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003431 {
3432 Parcel data = Parcel.obtain();
3433 Parcel reply = Parcel.obtain();
3434 data.writeInterfaceToken(IActivityManager.descriptor);
3435 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3436 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003437 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003438 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3439 reply.readException();
3440 data.recycle();
3441 reply.recycle();
3442 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003443 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3444 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003445 {
3446 Parcel data = Parcel.obtain();
3447 Parcel reply = Parcel.obtain();
3448 data.writeInterfaceToken(IActivityManager.descriptor);
3449 data.writeStrongBinder(who);
3450 data.writeInt(resultCode);
3451 data.writeString(resultData);
3452 data.writeBundle(map);
3453 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003454 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003455 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3456 reply.readException();
3457 data.recycle();
3458 reply.recycle();
3459 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003460 public void attachApplication(IApplicationThread app) throws RemoteException
3461 {
3462 Parcel data = Parcel.obtain();
3463 Parcel reply = Parcel.obtain();
3464 data.writeInterfaceToken(IActivityManager.descriptor);
3465 data.writeStrongBinder(app.asBinder());
3466 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3467 reply.readException();
3468 data.recycle();
3469 reply.recycle();
3470 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003471 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3472 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003473 {
3474 Parcel data = Parcel.obtain();
3475 Parcel reply = Parcel.obtain();
3476 data.writeInterfaceToken(IActivityManager.descriptor);
3477 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003478 if (config != null) {
3479 data.writeInt(1);
3480 config.writeToParcel(data, 0);
3481 } else {
3482 data.writeInt(0);
3483 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003484 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003485 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3486 reply.readException();
3487 data.recycle();
3488 reply.recycle();
3489 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003490 public void activityResumed(IBinder token) throws RemoteException
3491 {
3492 Parcel data = Parcel.obtain();
3493 Parcel reply = Parcel.obtain();
3494 data.writeInterfaceToken(IActivityManager.descriptor);
3495 data.writeStrongBinder(token);
3496 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3497 reply.readException();
3498 data.recycle();
3499 reply.recycle();
3500 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003501 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003502 {
3503 Parcel data = Parcel.obtain();
3504 Parcel reply = Parcel.obtain();
3505 data.writeInterfaceToken(IActivityManager.descriptor);
3506 data.writeStrongBinder(token);
3507 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3508 reply.readException();
3509 data.recycle();
3510 reply.recycle();
3511 }
3512 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003513 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003514 {
3515 Parcel data = Parcel.obtain();
3516 Parcel reply = Parcel.obtain();
3517 data.writeInterfaceToken(IActivityManager.descriptor);
3518 data.writeStrongBinder(token);
3519 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003520 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003521 TextUtils.writeToParcel(description, data, 0);
3522 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3523 reply.readException();
3524 data.recycle();
3525 reply.recycle();
3526 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003527 public void activitySlept(IBinder token) throws RemoteException
3528 {
3529 Parcel data = Parcel.obtain();
3530 Parcel reply = Parcel.obtain();
3531 data.writeInterfaceToken(IActivityManager.descriptor);
3532 data.writeStrongBinder(token);
3533 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3534 reply.readException();
3535 data.recycle();
3536 reply.recycle();
3537 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003538 public void activityDestroyed(IBinder token) throws RemoteException
3539 {
3540 Parcel data = Parcel.obtain();
3541 Parcel reply = Parcel.obtain();
3542 data.writeInterfaceToken(IActivityManager.descriptor);
3543 data.writeStrongBinder(token);
3544 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3545 reply.readException();
3546 data.recycle();
3547 reply.recycle();
3548 }
Jorim Jaggife89d122015-12-22 16:28:44 +01003549 public void activityRelaunched(IBinder token) throws RemoteException
3550 {
3551 Parcel data = Parcel.obtain();
3552 Parcel reply = Parcel.obtain();
3553 data.writeInterfaceToken(IActivityManager.descriptor);
3554 data.writeStrongBinder(token);
3555 mRemote.transact(ACTIVITY_RELAUNCHED_TRANSACTION, data, reply, 0);
3556 reply.readException();
3557 data.recycle();
3558 reply.recycle();
3559 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003560 public String getCallingPackage(IBinder token) throws RemoteException
3561 {
3562 Parcel data = Parcel.obtain();
3563 Parcel reply = Parcel.obtain();
3564 data.writeInterfaceToken(IActivityManager.descriptor);
3565 data.writeStrongBinder(token);
3566 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3567 reply.readException();
3568 String res = reply.readString();
3569 data.recycle();
3570 reply.recycle();
3571 return res;
3572 }
3573 public ComponentName getCallingActivity(IBinder token)
3574 throws RemoteException {
3575 Parcel data = Parcel.obtain();
3576 Parcel reply = Parcel.obtain();
3577 data.writeInterfaceToken(IActivityManager.descriptor);
3578 data.writeStrongBinder(token);
3579 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3580 reply.readException();
3581 ComponentName res = ComponentName.readFromParcel(reply);
3582 data.recycle();
3583 reply.recycle();
3584 return res;
3585 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003586 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003587 Parcel data = Parcel.obtain();
3588 Parcel reply = Parcel.obtain();
3589 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003590 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003591 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3592 reply.readException();
3593 ArrayList<IAppTask> list = null;
3594 int N = reply.readInt();
3595 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003596 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003597 while (N > 0) {
3598 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3599 list.add(task);
3600 N--;
3601 }
3602 }
3603 data.recycle();
3604 reply.recycle();
3605 return list;
3606 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003607 public int addAppTask(IBinder activityToken, Intent intent,
3608 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3609 Parcel data = Parcel.obtain();
3610 Parcel reply = Parcel.obtain();
3611 data.writeInterfaceToken(IActivityManager.descriptor);
3612 data.writeStrongBinder(activityToken);
3613 intent.writeToParcel(data, 0);
3614 description.writeToParcel(data, 0);
3615 thumbnail.writeToParcel(data, 0);
3616 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3617 reply.readException();
3618 int res = reply.readInt();
3619 data.recycle();
3620 reply.recycle();
3621 return res;
3622 }
3623 public Point getAppTaskThumbnailSize() throws RemoteException {
3624 Parcel data = Parcel.obtain();
3625 Parcel reply = Parcel.obtain();
3626 data.writeInterfaceToken(IActivityManager.descriptor);
3627 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3628 reply.readException();
3629 Point size = Point.CREATOR.createFromParcel(reply);
3630 data.recycle();
3631 reply.recycle();
3632 return size;
3633 }
Todd Kennedye635f662015-01-20 10:36:49 -08003634 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3635 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003636 Parcel data = Parcel.obtain();
3637 Parcel reply = Parcel.obtain();
3638 data.writeInterfaceToken(IActivityManager.descriptor);
3639 data.writeInt(maxNum);
3640 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003641 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3642 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003643 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003644 int N = reply.readInt();
3645 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003646 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003647 while (N > 0) {
3648 ActivityManager.RunningTaskInfo info =
3649 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003650 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003651 list.add(info);
3652 N--;
3653 }
3654 }
3655 data.recycle();
3656 reply.recycle();
3657 return list;
3658 }
3659 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003660 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003661 Parcel data = Parcel.obtain();
3662 Parcel reply = Parcel.obtain();
3663 data.writeInterfaceToken(IActivityManager.descriptor);
3664 data.writeInt(maxNum);
3665 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003666 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003667 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3668 reply.readException();
3669 ArrayList<ActivityManager.RecentTaskInfo> list
3670 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3671 data.recycle();
3672 reply.recycle();
3673 return list;
3674 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003675 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003676 Parcel data = Parcel.obtain();
3677 Parcel reply = Parcel.obtain();
3678 data.writeInterfaceToken(IActivityManager.descriptor);
3679 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003680 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003681 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003682 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003683 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003684 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003685 }
3686 data.recycle();
3687 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003688 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003689 }
Todd Kennedye635f662015-01-20 10:36:49 -08003690 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3691 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);
3697 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3698 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003699 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003700 int N = reply.readInt();
3701 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003702 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003703 while (N > 0) {
3704 ActivityManager.RunningServiceInfo info =
3705 ActivityManager.RunningServiceInfo.CREATOR
3706 .createFromParcel(reply);
3707 list.add(info);
3708 N--;
3709 }
3710 }
3711 data.recycle();
3712 reply.recycle();
3713 return list;
3714 }
3715 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3716 throws RemoteException {
3717 Parcel data = Parcel.obtain();
3718 Parcel reply = Parcel.obtain();
3719 data.writeInterfaceToken(IActivityManager.descriptor);
3720 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3721 reply.readException();
3722 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3723 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3724 data.recycle();
3725 reply.recycle();
3726 return list;
3727 }
3728 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3729 throws RemoteException {
3730 Parcel data = Parcel.obtain();
3731 Parcel reply = Parcel.obtain();
3732 data.writeInterfaceToken(IActivityManager.descriptor);
3733 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3734 reply.readException();
3735 ArrayList<ActivityManager.RunningAppProcessInfo> list
3736 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3737 data.recycle();
3738 reply.recycle();
3739 return list;
3740 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003741 public List<ApplicationInfo> getRunningExternalApplications()
3742 throws RemoteException {
3743 Parcel data = Parcel.obtain();
3744 Parcel reply = Parcel.obtain();
3745 data.writeInterfaceToken(IActivityManager.descriptor);
3746 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3747 reply.readException();
3748 ArrayList<ApplicationInfo> list
3749 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3750 data.recycle();
3751 reply.recycle();
3752 return list;
3753 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003754 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003755 {
3756 Parcel data = Parcel.obtain();
3757 Parcel reply = Parcel.obtain();
3758 data.writeInterfaceToken(IActivityManager.descriptor);
3759 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003760 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003761 if (options != null) {
3762 data.writeInt(1);
3763 options.writeToParcel(data, 0);
3764 } else {
3765 data.writeInt(0);
3766 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003767 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3768 reply.readException();
3769 data.recycle();
3770 reply.recycle();
3771 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003772 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3773 throws RemoteException {
3774 Parcel data = Parcel.obtain();
3775 Parcel reply = Parcel.obtain();
3776 data.writeInterfaceToken(IActivityManager.descriptor);
3777 data.writeStrongBinder(token);
3778 data.writeInt(nonRoot ? 1 : 0);
3779 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3780 reply.readException();
3781 boolean res = reply.readInt() != 0;
3782 data.recycle();
3783 reply.recycle();
3784 return res;
3785 }
3786 public void moveTaskBackwards(int task) throws RemoteException
3787 {
3788 Parcel data = Parcel.obtain();
3789 Parcel reply = Parcel.obtain();
3790 data.writeInterfaceToken(IActivityManager.descriptor);
3791 data.writeInt(task);
3792 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3793 reply.readException();
3794 data.recycle();
3795 reply.recycle();
3796 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003797 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003798 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3799 {
3800 Parcel data = Parcel.obtain();
3801 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003802 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003803 data.writeInt(taskId);
3804 data.writeInt(stackId);
3805 data.writeInt(toTop ? 1 : 0);
3806 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3807 reply.readException();
3808 data.recycle();
3809 reply.recycle();
3810 }
3811 @Override
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003812 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
3813 Rect initialBounds) throws RemoteException
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003814 {
3815 Parcel data = Parcel.obtain();
3816 Parcel reply = Parcel.obtain();
3817 data.writeInterfaceToken(IActivityManager.descriptor);
3818 data.writeInt(taskId);
3819 data.writeInt(createMode);
3820 data.writeInt(toTop ? 1 : 0);
Jorim Jaggi030979c2015-11-20 15:14:43 -08003821 data.writeInt(animate ? 1 : 0);
Jorim Jaggi9ea2f7b2015-11-23 18:08:28 -08003822 if (initialBounds != null) {
3823 data.writeInt(1);
3824 initialBounds.writeToParcel(data, 0);
3825 } else {
3826 data.writeInt(0);
3827 }
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003828 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3829 reply.readException();
3830 data.recycle();
3831 reply.recycle();
3832 }
3833 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003834 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3835 throws RemoteException
3836 {
3837 Parcel data = Parcel.obtain();
3838 Parcel reply = Parcel.obtain();
3839 data.writeInterfaceToken(IActivityManager.descriptor);
3840 data.writeInt(stackId);
3841 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003842 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003843 reply.readException();
3844 final boolean res = reply.readInt() != 0;
3845 data.recycle();
3846 reply.recycle();
3847 return res;
3848 }
3849 @Override
Filip Gruszczynski84fa3352016-01-25 16:28:49 -08003850 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode,
3851 boolean preserveWindows, boolean animate) throws RemoteException {
Craig Mautnerc00204b2013-03-05 15:02:14 -08003852 Parcel data = Parcel.obtain();
3853 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003854 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003855 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003856 if (r != null) {
3857 data.writeInt(1);
3858 r.writeToParcel(data, 0);
3859 } else {
3860 data.writeInt(0);
3861 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003862 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Filip Gruszczynski84fa3352016-01-25 16:28:49 -08003863 data.writeInt(preserveWindows ? 1 : 0);
3864 data.writeInt(animate ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003865 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003866 reply.readException();
3867 data.recycle();
3868 reply.recycle();
3869 }
Craig Mautner967212c2013-04-13 21:10:58 -07003870 @Override
Jorim Jaggidc249c42015-12-15 14:57:31 -08003871 public void resizeDockedStack(Rect dockedBounds, Rect tempDockedTaskBounds,
3872 Rect tempDockedTaskInsetBounds,
3873 Rect tempOtherTaskBounds, Rect tempOtherTaskInsetBounds)
3874 throws RemoteException
3875 {
3876 Parcel data = Parcel.obtain();
3877 Parcel reply = Parcel.obtain();
3878 data.writeInterfaceToken(IActivityManager.descriptor);
3879 if (dockedBounds != null) {
3880 data.writeInt(1);
3881 dockedBounds.writeToParcel(data, 0);
3882 } else {
3883 data.writeInt(0);
3884 }
3885 if (tempDockedTaskBounds != null) {
3886 data.writeInt(1);
3887 tempDockedTaskBounds.writeToParcel(data, 0);
3888 } else {
3889 data.writeInt(0);
3890 }
3891 if (tempDockedTaskInsetBounds != null) {
3892 data.writeInt(1);
3893 tempDockedTaskInsetBounds.writeToParcel(data, 0);
3894 } else {
3895 data.writeInt(0);
3896 }
3897 if (tempOtherTaskBounds != null) {
3898 data.writeInt(1);
3899 tempOtherTaskBounds.writeToParcel(data, 0);
3900 } else {
3901 data.writeInt(0);
3902 }
3903 if (tempOtherTaskInsetBounds != null) {
3904 data.writeInt(1);
3905 tempOtherTaskInsetBounds.writeToParcel(data, 0);
3906 } else {
3907 data.writeInt(0);
3908 }
3909 mRemote.transact(RESIZE_DOCKED_STACK_TRANSACTION, data, reply, 0);
3910 reply.readException();
3911 data.recycle();
3912 reply.recycle();
3913 }
3914 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003915 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3916 {
3917 Parcel data = Parcel.obtain();
3918 Parcel reply = Parcel.obtain();
3919 data.writeInterfaceToken(IActivityManager.descriptor);
3920 data.writeInt(taskId);
3921 data.writeInt(stackId);
3922 data.writeInt(position);
3923 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3924 reply.readException();
3925 data.recycle();
3926 reply.recycle();
3927 }
3928 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003929 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003930 {
3931 Parcel data = Parcel.obtain();
3932 Parcel reply = Parcel.obtain();
3933 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003934 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003935 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003936 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003937 data.recycle();
3938 reply.recycle();
3939 return list;
3940 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003941 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003942 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003943 {
3944 Parcel data = Parcel.obtain();
3945 Parcel reply = Parcel.obtain();
3946 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003947 data.writeInt(stackId);
3948 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003949 reply.readException();
3950 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003951 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003952 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003953 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003954 }
3955 data.recycle();
3956 reply.recycle();
3957 return info;
3958 }
3959 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003960 public boolean isInHomeStack(int taskId) throws RemoteException {
3961 Parcel data = Parcel.obtain();
3962 Parcel reply = Parcel.obtain();
3963 data.writeInterfaceToken(IActivityManager.descriptor);
3964 data.writeInt(taskId);
3965 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3966 reply.readException();
3967 boolean isInHomeStack = reply.readInt() > 0;
3968 data.recycle();
3969 reply.recycle();
3970 return isInHomeStack;
3971 }
3972 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003973 public void setFocusedStack(int stackId) throws RemoteException
3974 {
3975 Parcel data = Parcel.obtain();
3976 Parcel reply = Parcel.obtain();
3977 data.writeInterfaceToken(IActivityManager.descriptor);
3978 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003979 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003980 reply.readException();
3981 data.recycle();
3982 reply.recycle();
3983 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003984 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003985 public int getFocusedStackId() throws RemoteException {
3986 Parcel data = Parcel.obtain();
3987 Parcel reply = Parcel.obtain();
3988 data.writeInterfaceToken(IActivityManager.descriptor);
3989 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3990 reply.readException();
3991 int focusedStackId = reply.readInt();
3992 data.recycle();
3993 reply.recycle();
3994 return focusedStackId;
3995 }
3996 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003997 public void setFocusedTask(int taskId) throws RemoteException
3998 {
3999 Parcel data = Parcel.obtain();
4000 Parcel reply = Parcel.obtain();
4001 data.writeInterfaceToken(IActivityManager.descriptor);
4002 data.writeInt(taskId);
4003 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
4004 reply.readException();
4005 data.recycle();
4006 reply.recycle();
4007 }
4008 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08004009 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
4010 {
4011 Parcel data = Parcel.obtain();
4012 Parcel reply = Parcel.obtain();
4013 data.writeInterfaceToken(IActivityManager.descriptor);
4014 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07004015 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08004016 reply.readException();
4017 data.recycle();
4018 reply.recycle();
4019 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004020 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
4021 {
4022 Parcel data = Parcel.obtain();
4023 Parcel reply = Parcel.obtain();
4024 data.writeInterfaceToken(IActivityManager.descriptor);
4025 data.writeStrongBinder(token);
4026 data.writeInt(onlyRoot ? 1 : 0);
4027 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
4028 reply.readException();
4029 int res = reply.readInt();
4030 data.recycle();
4031 reply.recycle();
4032 return res;
4033 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004034 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07004035 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004036 Parcel data = Parcel.obtain();
4037 Parcel reply = Parcel.obtain();
4038 data.writeInterfaceToken(IActivityManager.descriptor);
4039 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4040 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07004041 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004042 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004043 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4044 reply.readException();
4045 int res = reply.readInt();
4046 ContentProviderHolder cph = null;
4047 if (res != 0) {
4048 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
4049 }
4050 data.recycle();
4051 reply.recycle();
4052 return cph;
4053 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07004054 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
4055 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004056 Parcel data = Parcel.obtain();
4057 Parcel reply = Parcel.obtain();
4058 data.writeInterfaceToken(IActivityManager.descriptor);
4059 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07004060 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004061 data.writeStrongBinder(token);
4062 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4063 reply.readException();
4064 int res = reply.readInt();
4065 ContentProviderHolder cph = null;
4066 if (res != 0) {
4067 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
4068 }
4069 data.recycle();
4070 reply.recycle();
4071 return cph;
4072 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004073 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004074 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004075 {
4076 Parcel data = Parcel.obtain();
4077 Parcel reply = Parcel.obtain();
4078 data.writeInterfaceToken(IActivityManager.descriptor);
4079 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4080 data.writeTypedList(providers);
4081 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
4082 reply.readException();
4083 data.recycle();
4084 reply.recycle();
4085 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004086 public boolean refContentProvider(IBinder connection, int stable, int unstable)
4087 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004088 Parcel data = Parcel.obtain();
4089 Parcel reply = Parcel.obtain();
4090 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004091 data.writeStrongBinder(connection);
4092 data.writeInt(stable);
4093 data.writeInt(unstable);
4094 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4095 reply.readException();
4096 boolean res = reply.readInt() != 0;
4097 data.recycle();
4098 reply.recycle();
4099 return res;
4100 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004101
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004102 public void unstableProviderDied(IBinder connection) throws RemoteException {
4103 Parcel data = Parcel.obtain();
4104 Parcel reply = Parcel.obtain();
4105 data.writeInterfaceToken(IActivityManager.descriptor);
4106 data.writeStrongBinder(connection);
4107 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
4108 reply.readException();
4109 data.recycle();
4110 reply.recycle();
4111 }
4112
Jeff Sharkey7aa76012013-09-30 14:26:27 -07004113 @Override
4114 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
4115 Parcel data = Parcel.obtain();
4116 Parcel reply = Parcel.obtain();
4117 data.writeInterfaceToken(IActivityManager.descriptor);
4118 data.writeStrongBinder(connection);
4119 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
4120 reply.readException();
4121 data.recycle();
4122 reply.recycle();
4123 }
4124
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07004125 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
4126 Parcel data = Parcel.obtain();
4127 Parcel reply = Parcel.obtain();
4128 data.writeInterfaceToken(IActivityManager.descriptor);
4129 data.writeStrongBinder(connection);
4130 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004131 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
4132 reply.readException();
4133 data.recycle();
4134 reply.recycle();
4135 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08004136
4137 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
4138 Parcel data = Parcel.obtain();
4139 Parcel reply = Parcel.obtain();
4140 data.writeInterfaceToken(IActivityManager.descriptor);
4141 data.writeString(name);
4142 data.writeStrongBinder(token);
4143 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
4144 reply.readException();
4145 data.recycle();
4146 reply.recycle();
4147 }
4148
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07004149 public PendingIntent getRunningServiceControlPanel(ComponentName service)
4150 throws RemoteException
4151 {
4152 Parcel data = Parcel.obtain();
4153 Parcel reply = Parcel.obtain();
4154 data.writeInterfaceToken(IActivityManager.descriptor);
4155 service.writeToParcel(data, 0);
4156 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
4157 reply.readException();
4158 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
4159 data.recycle();
4160 reply.recycle();
4161 return res;
4162 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004163
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004164 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07004165 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004166 {
4167 Parcel data = Parcel.obtain();
4168 Parcel reply = Parcel.obtain();
4169 data.writeInterfaceToken(IActivityManager.descriptor);
4170 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4171 service.writeToParcel(data, 0);
4172 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004173 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004174 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004175 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
4176 reply.readException();
4177 ComponentName res = ComponentName.readFromParcel(reply);
4178 data.recycle();
4179 reply.recycle();
4180 return res;
4181 }
4182 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004183 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004184 {
4185 Parcel data = Parcel.obtain();
4186 Parcel reply = Parcel.obtain();
4187 data.writeInterfaceToken(IActivityManager.descriptor);
4188 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4189 service.writeToParcel(data, 0);
4190 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07004191 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004192 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
4193 reply.readException();
4194 int res = reply.readInt();
4195 reply.recycle();
4196 data.recycle();
4197 return res;
4198 }
4199 public boolean stopServiceToken(ComponentName className, IBinder token,
4200 int startId) throws RemoteException {
4201 Parcel data = Parcel.obtain();
4202 Parcel reply = Parcel.obtain();
4203 data.writeInterfaceToken(IActivityManager.descriptor);
4204 ComponentName.writeToParcel(className, data);
4205 data.writeStrongBinder(token);
4206 data.writeInt(startId);
4207 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
4208 reply.readException();
4209 boolean res = reply.readInt() != 0;
4210 data.recycle();
4211 reply.recycle();
4212 return res;
4213 }
4214 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004215 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004216 Parcel data = Parcel.obtain();
4217 Parcel reply = Parcel.obtain();
4218 data.writeInterfaceToken(IActivityManager.descriptor);
4219 ComponentName.writeToParcel(className, data);
4220 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07004221 data.writeInt(id);
4222 if (notification != null) {
4223 data.writeInt(1);
4224 notification.writeToParcel(data, 0);
4225 } else {
4226 data.writeInt(0);
4227 }
4228 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004229 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
4230 reply.readException();
4231 data.recycle();
4232 reply.recycle();
4233 }
4234 public int bindService(IApplicationThread caller, IBinder token,
4235 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07004236 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004237 Parcel data = Parcel.obtain();
4238 Parcel reply = Parcel.obtain();
4239 data.writeInterfaceToken(IActivityManager.descriptor);
4240 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
4241 data.writeStrongBinder(token);
4242 service.writeToParcel(data, 0);
4243 data.writeString(resolvedType);
4244 data.writeStrongBinder(connection.asBinder());
4245 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07004246 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08004247 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004248 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
4249 reply.readException();
4250 int res = reply.readInt();
4251 data.recycle();
4252 reply.recycle();
4253 return res;
4254 }
4255 public boolean unbindService(IServiceConnection connection) throws RemoteException
4256 {
4257 Parcel data = Parcel.obtain();
4258 Parcel reply = Parcel.obtain();
4259 data.writeInterfaceToken(IActivityManager.descriptor);
4260 data.writeStrongBinder(connection.asBinder());
4261 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
4262 reply.readException();
4263 boolean res = reply.readInt() != 0;
4264 data.recycle();
4265 reply.recycle();
4266 return res;
4267 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004268
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004269 public void publishService(IBinder token,
4270 Intent intent, IBinder service) throws RemoteException {
4271 Parcel data = Parcel.obtain();
4272 Parcel reply = Parcel.obtain();
4273 data.writeInterfaceToken(IActivityManager.descriptor);
4274 data.writeStrongBinder(token);
4275 intent.writeToParcel(data, 0);
4276 data.writeStrongBinder(service);
4277 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
4278 reply.readException();
4279 data.recycle();
4280 reply.recycle();
4281 }
4282
4283 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
4284 throws RemoteException {
4285 Parcel data = Parcel.obtain();
4286 Parcel reply = Parcel.obtain();
4287 data.writeInterfaceToken(IActivityManager.descriptor);
4288 data.writeStrongBinder(token);
4289 intent.writeToParcel(data, 0);
4290 data.writeInt(doRebind ? 1 : 0);
4291 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4292 reply.readException();
4293 data.recycle();
4294 reply.recycle();
4295 }
4296
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004297 public void serviceDoneExecuting(IBinder token, int type, int startId,
4298 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004299 Parcel data = Parcel.obtain();
4300 Parcel reply = Parcel.obtain();
4301 data.writeInterfaceToken(IActivityManager.descriptor);
4302 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004303 data.writeInt(type);
4304 data.writeInt(startId);
4305 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004306 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4307 reply.readException();
4308 data.recycle();
4309 reply.recycle();
4310 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004311
Svet Ganov99b60432015-06-27 13:15:22 -07004312 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4313 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004314 Parcel data = Parcel.obtain();
4315 Parcel reply = Parcel.obtain();
4316 data.writeInterfaceToken(IActivityManager.descriptor);
4317 service.writeToParcel(data, 0);
4318 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004319 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004320 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4321 reply.readException();
4322 IBinder binder = reply.readStrongBinder();
4323 reply.recycle();
4324 data.recycle();
4325 return binder;
4326 }
4327
Christopher Tate181fafa2009-05-14 11:12:14 -07004328 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4329 throws RemoteException {
4330 Parcel data = Parcel.obtain();
4331 Parcel reply = Parcel.obtain();
4332 data.writeInterfaceToken(IActivityManager.descriptor);
4333 app.writeToParcel(data, 0);
4334 data.writeInt(backupRestoreMode);
4335 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4336 reply.readException();
4337 boolean success = reply.readInt() != 0;
4338 reply.recycle();
4339 data.recycle();
4340 return success;
4341 }
4342
Christopher Tate346acb12012-10-15 19:20:25 -07004343 public void clearPendingBackup() throws RemoteException {
4344 Parcel data = Parcel.obtain();
4345 Parcel reply = Parcel.obtain();
4346 data.writeInterfaceToken(IActivityManager.descriptor);
4347 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4348 reply.recycle();
4349 data.recycle();
4350 }
4351
Christopher Tate181fafa2009-05-14 11:12:14 -07004352 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4353 Parcel data = Parcel.obtain();
4354 Parcel reply = Parcel.obtain();
4355 data.writeInterfaceToken(IActivityManager.descriptor);
4356 data.writeString(packageName);
4357 data.writeStrongBinder(agent);
4358 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4359 reply.recycle();
4360 data.recycle();
4361 }
4362
4363 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4364 Parcel data = Parcel.obtain();
4365 Parcel reply = Parcel.obtain();
4366 data.writeInterfaceToken(IActivityManager.descriptor);
4367 app.writeToParcel(data, 0);
4368 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4369 reply.readException();
4370 reply.recycle();
4371 data.recycle();
4372 }
4373
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004374 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004375 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004376 IUiAutomationConnection connection, int userId, String instructionSet)
4377 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004378 Parcel data = Parcel.obtain();
4379 Parcel reply = Parcel.obtain();
4380 data.writeInterfaceToken(IActivityManager.descriptor);
4381 ComponentName.writeToParcel(className, data);
4382 data.writeString(profileFile);
4383 data.writeInt(flags);
4384 data.writeBundle(arguments);
4385 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004386 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004387 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004388 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004389 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4390 reply.readException();
4391 boolean res = reply.readInt() != 0;
4392 reply.recycle();
4393 data.recycle();
4394 return res;
4395 }
4396
4397 public void finishInstrumentation(IApplicationThread target,
4398 int resultCode, Bundle results) throws RemoteException {
4399 Parcel data = Parcel.obtain();
4400 Parcel reply = Parcel.obtain();
4401 data.writeInterfaceToken(IActivityManager.descriptor);
4402 data.writeStrongBinder(target != null ? target.asBinder() : null);
4403 data.writeInt(resultCode);
4404 data.writeBundle(results);
4405 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4406 reply.readException();
4407 data.recycle();
4408 reply.recycle();
4409 }
4410 public Configuration getConfiguration() throws RemoteException
4411 {
4412 Parcel data = Parcel.obtain();
4413 Parcel reply = Parcel.obtain();
4414 data.writeInterfaceToken(IActivityManager.descriptor);
4415 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4416 reply.readException();
4417 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4418 reply.recycle();
4419 data.recycle();
4420 return res;
4421 }
4422 public void updateConfiguration(Configuration values) throws RemoteException
4423 {
4424 Parcel data = Parcel.obtain();
4425 Parcel reply = Parcel.obtain();
4426 data.writeInterfaceToken(IActivityManager.descriptor);
4427 values.writeToParcel(data, 0);
4428 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4429 reply.readException();
4430 data.recycle();
4431 reply.recycle();
4432 }
4433 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4434 throws RemoteException {
4435 Parcel data = Parcel.obtain();
4436 Parcel reply = Parcel.obtain();
4437 data.writeInterfaceToken(IActivityManager.descriptor);
4438 data.writeStrongBinder(token);
4439 data.writeInt(requestedOrientation);
4440 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4441 reply.readException();
4442 data.recycle();
4443 reply.recycle();
4444 }
4445 public int getRequestedOrientation(IBinder token) throws RemoteException {
4446 Parcel data = Parcel.obtain();
4447 Parcel reply = Parcel.obtain();
4448 data.writeInterfaceToken(IActivityManager.descriptor);
4449 data.writeStrongBinder(token);
4450 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4451 reply.readException();
4452 int res = reply.readInt();
4453 data.recycle();
4454 reply.recycle();
4455 return res;
4456 }
4457 public ComponentName getActivityClassForToken(IBinder token)
4458 throws RemoteException {
4459 Parcel data = Parcel.obtain();
4460 Parcel reply = Parcel.obtain();
4461 data.writeInterfaceToken(IActivityManager.descriptor);
4462 data.writeStrongBinder(token);
4463 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4464 reply.readException();
4465 ComponentName res = ComponentName.readFromParcel(reply);
4466 data.recycle();
4467 reply.recycle();
4468 return res;
4469 }
4470 public String getPackageForToken(IBinder token) throws RemoteException
4471 {
4472 Parcel data = Parcel.obtain();
4473 Parcel reply = Parcel.obtain();
4474 data.writeInterfaceToken(IActivityManager.descriptor);
4475 data.writeStrongBinder(token);
4476 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4477 reply.readException();
4478 String res = reply.readString();
4479 data.recycle();
4480 reply.recycle();
4481 return res;
4482 }
4483 public IIntentSender getIntentSender(int type,
4484 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004485 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004486 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004487 Parcel data = Parcel.obtain();
4488 Parcel reply = Parcel.obtain();
4489 data.writeInterfaceToken(IActivityManager.descriptor);
4490 data.writeInt(type);
4491 data.writeString(packageName);
4492 data.writeStrongBinder(token);
4493 data.writeString(resultWho);
4494 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004495 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004496 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004497 data.writeTypedArray(intents, 0);
4498 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004499 } else {
4500 data.writeInt(0);
4501 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004502 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004503 if (options != null) {
4504 data.writeInt(1);
4505 options.writeToParcel(data, 0);
4506 } else {
4507 data.writeInt(0);
4508 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004509 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004510 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4511 reply.readException();
4512 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004513 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004514 data.recycle();
4515 reply.recycle();
4516 return res;
4517 }
4518 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4519 Parcel data = Parcel.obtain();
4520 Parcel reply = Parcel.obtain();
4521 data.writeInterfaceToken(IActivityManager.descriptor);
4522 data.writeStrongBinder(sender.asBinder());
4523 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4524 reply.readException();
4525 data.recycle();
4526 reply.recycle();
4527 }
4528 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4529 Parcel data = Parcel.obtain();
4530 Parcel reply = Parcel.obtain();
4531 data.writeInterfaceToken(IActivityManager.descriptor);
4532 data.writeStrongBinder(sender.asBinder());
4533 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4534 reply.readException();
4535 String res = reply.readString();
4536 data.recycle();
4537 reply.recycle();
4538 return res;
4539 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004540 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4541 Parcel data = Parcel.obtain();
4542 Parcel reply = Parcel.obtain();
4543 data.writeInterfaceToken(IActivityManager.descriptor);
4544 data.writeStrongBinder(sender.asBinder());
4545 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4546 reply.readException();
4547 int res = reply.readInt();
4548 data.recycle();
4549 reply.recycle();
4550 return res;
4551 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004552 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4553 boolean requireFull, String name, String callerPackage) throws RemoteException {
4554 Parcel data = Parcel.obtain();
4555 Parcel reply = Parcel.obtain();
4556 data.writeInterfaceToken(IActivityManager.descriptor);
4557 data.writeInt(callingPid);
4558 data.writeInt(callingUid);
4559 data.writeInt(userId);
4560 data.writeInt(allowAll ? 1 : 0);
4561 data.writeInt(requireFull ? 1 : 0);
4562 data.writeString(name);
4563 data.writeString(callerPackage);
4564 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4565 reply.readException();
4566 int res = reply.readInt();
4567 data.recycle();
4568 reply.recycle();
4569 return res;
4570 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004571 public void setProcessLimit(int max) throws RemoteException
4572 {
4573 Parcel data = Parcel.obtain();
4574 Parcel reply = Parcel.obtain();
4575 data.writeInterfaceToken(IActivityManager.descriptor);
4576 data.writeInt(max);
4577 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4578 reply.readException();
4579 data.recycle();
4580 reply.recycle();
4581 }
4582 public int getProcessLimit() throws RemoteException
4583 {
4584 Parcel data = Parcel.obtain();
4585 Parcel reply = Parcel.obtain();
4586 data.writeInterfaceToken(IActivityManager.descriptor);
4587 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4588 reply.readException();
4589 int res = reply.readInt();
4590 data.recycle();
4591 reply.recycle();
4592 return res;
4593 }
4594 public void setProcessForeground(IBinder token, int pid,
4595 boolean isForeground) throws RemoteException {
4596 Parcel data = Parcel.obtain();
4597 Parcel reply = Parcel.obtain();
4598 data.writeInterfaceToken(IActivityManager.descriptor);
4599 data.writeStrongBinder(token);
4600 data.writeInt(pid);
4601 data.writeInt(isForeground ? 1 : 0);
4602 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4603 reply.readException();
4604 data.recycle();
4605 reply.recycle();
4606 }
4607 public int checkPermission(String permission, int pid, int uid)
4608 throws RemoteException {
4609 Parcel data = Parcel.obtain();
4610 Parcel reply = Parcel.obtain();
4611 data.writeInterfaceToken(IActivityManager.descriptor);
4612 data.writeString(permission);
4613 data.writeInt(pid);
4614 data.writeInt(uid);
4615 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4616 reply.readException();
4617 int res = reply.readInt();
4618 data.recycle();
4619 reply.recycle();
4620 return res;
4621 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004622 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4623 throws RemoteException {
4624 Parcel data = Parcel.obtain();
4625 Parcel reply = Parcel.obtain();
4626 data.writeInterfaceToken(IActivityManager.descriptor);
4627 data.writeString(permission);
4628 data.writeInt(pid);
4629 data.writeInt(uid);
4630 data.writeStrongBinder(callerToken);
4631 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4632 reply.readException();
4633 int res = reply.readInt();
4634 data.recycle();
4635 reply.recycle();
4636 return res;
4637 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004638 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004639 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004640 Parcel data = Parcel.obtain();
4641 Parcel reply = Parcel.obtain();
4642 data.writeInterfaceToken(IActivityManager.descriptor);
4643 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004644 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004645 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004646 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4647 reply.readException();
4648 boolean res = reply.readInt() != 0;
4649 data.recycle();
4650 reply.recycle();
4651 return res;
4652 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004653 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4654 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004655 Parcel data = Parcel.obtain();
4656 Parcel reply = Parcel.obtain();
4657 data.writeInterfaceToken(IActivityManager.descriptor);
4658 uri.writeToParcel(data, 0);
4659 data.writeInt(pid);
4660 data.writeInt(uid);
4661 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004662 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004663 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004664 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4665 reply.readException();
4666 int res = reply.readInt();
4667 data.recycle();
4668 reply.recycle();
4669 return res;
4670 }
4671 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004672 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004673 Parcel data = Parcel.obtain();
4674 Parcel reply = Parcel.obtain();
4675 data.writeInterfaceToken(IActivityManager.descriptor);
4676 data.writeStrongBinder(caller.asBinder());
4677 data.writeString(targetPkg);
4678 uri.writeToParcel(data, 0);
4679 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004680 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004681 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4682 reply.readException();
4683 data.recycle();
4684 reply.recycle();
4685 }
4686 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004687 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004688 Parcel data = Parcel.obtain();
4689 Parcel reply = Parcel.obtain();
4690 data.writeInterfaceToken(IActivityManager.descriptor);
4691 data.writeStrongBinder(caller.asBinder());
4692 uri.writeToParcel(data, 0);
4693 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004694 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004695 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4696 reply.readException();
4697 data.recycle();
4698 reply.recycle();
4699 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004700
4701 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004702 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4703 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004704 Parcel data = Parcel.obtain();
4705 Parcel reply = Parcel.obtain();
4706 data.writeInterfaceToken(IActivityManager.descriptor);
4707 uri.writeToParcel(data, 0);
4708 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004709 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004710 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4711 reply.readException();
4712 data.recycle();
4713 reply.recycle();
4714 }
4715
4716 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004717 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4718 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004719 Parcel data = Parcel.obtain();
4720 Parcel reply = Parcel.obtain();
4721 data.writeInterfaceToken(IActivityManager.descriptor);
4722 uri.writeToParcel(data, 0);
4723 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004724 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004725 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4726 reply.readException();
4727 data.recycle();
4728 reply.recycle();
4729 }
4730
4731 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004732 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4733 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004734 Parcel data = Parcel.obtain();
4735 Parcel reply = Parcel.obtain();
4736 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004737 data.writeString(packageName);
4738 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004739 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4740 reply.readException();
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004741 @SuppressWarnings("unchecked")
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004742 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4743 reply);
4744 data.recycle();
4745 reply.recycle();
4746 return perms;
4747 }
4748
Felipe Lemef3fa0f82016-01-07 12:08:19 -08004749 @Override
4750 public ParceledListSlice<UriPermission> getGrantedUriPermissions(String packageName, int userId)
4751 throws RemoteException {
4752 Parcel data = Parcel.obtain();
4753 Parcel reply = Parcel.obtain();
4754 data.writeInterfaceToken(IActivityManager.descriptor);
4755 data.writeString(packageName);
4756 data.writeInt(userId);
4757 mRemote.transact(GET_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4758 reply.readException();
4759 @SuppressWarnings("unchecked")
4760 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4761 reply);
4762 data.recycle();
4763 reply.recycle();
4764 return perms;
4765 }
4766
4767 @Override
4768 public void clearGrantedUriPermissions(String packageName, int userId) throws RemoteException {
4769 Parcel data = Parcel.obtain();
4770 Parcel reply = Parcel.obtain();
4771 data.writeInterfaceToken(IActivityManager.descriptor);
4772 data.writeString(packageName);
4773 data.writeInt(userId);
4774 mRemote.transact(CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4775 reply.readException();
4776 data.recycle();
4777 reply.recycle();
4778 }
4779
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004780 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4781 throws RemoteException {
4782 Parcel data = Parcel.obtain();
4783 Parcel reply = Parcel.obtain();
4784 data.writeInterfaceToken(IActivityManager.descriptor);
4785 data.writeStrongBinder(who.asBinder());
4786 data.writeInt(waiting ? 1 : 0);
4787 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4788 reply.readException();
4789 data.recycle();
4790 reply.recycle();
4791 }
4792 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4793 Parcel data = Parcel.obtain();
4794 Parcel reply = Parcel.obtain();
4795 data.writeInterfaceToken(IActivityManager.descriptor);
4796 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4797 reply.readException();
4798 outInfo.readFromParcel(reply);
4799 data.recycle();
4800 reply.recycle();
4801 }
4802 public void unhandledBack() throws RemoteException
4803 {
4804 Parcel data = Parcel.obtain();
4805 Parcel reply = Parcel.obtain();
4806 data.writeInterfaceToken(IActivityManager.descriptor);
4807 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4808 reply.readException();
4809 data.recycle();
4810 reply.recycle();
4811 }
4812 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4813 {
4814 Parcel data = Parcel.obtain();
4815 Parcel reply = Parcel.obtain();
4816 data.writeInterfaceToken(IActivityManager.descriptor);
4817 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4818 reply.readException();
4819 ParcelFileDescriptor pfd = null;
4820 if (reply.readInt() != 0) {
4821 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4822 }
4823 data.recycle();
4824 reply.recycle();
4825 return pfd;
4826 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004827 public void setLockScreenShown(boolean shown) throws RemoteException
4828 {
4829 Parcel data = Parcel.obtain();
4830 Parcel reply = Parcel.obtain();
4831 data.writeInterfaceToken(IActivityManager.descriptor);
4832 data.writeInt(shown ? 1 : 0);
4833 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4834 reply.readException();
4835 data.recycle();
4836 reply.recycle();
4837 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004838 public void setDebugApp(
4839 String packageName, boolean waitForDebugger, boolean persistent)
4840 throws RemoteException
4841 {
4842 Parcel data = Parcel.obtain();
4843 Parcel reply = Parcel.obtain();
4844 data.writeInterfaceToken(IActivityManager.descriptor);
4845 data.writeString(packageName);
4846 data.writeInt(waitForDebugger ? 1 : 0);
4847 data.writeInt(persistent ? 1 : 0);
4848 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4849 reply.readException();
4850 data.recycle();
4851 reply.recycle();
4852 }
4853 public void setAlwaysFinish(boolean enabled) throws RemoteException
4854 {
4855 Parcel data = Parcel.obtain();
4856 Parcel reply = Parcel.obtain();
4857 data.writeInterfaceToken(IActivityManager.descriptor);
4858 data.writeInt(enabled ? 1 : 0);
4859 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4860 reply.readException();
4861 data.recycle();
4862 reply.recycle();
4863 }
Dianne Hackborn4a18c262016-02-26 17:23:48 -08004864 public void setActivityController(IActivityController watcher, boolean imAMonkey)
4865 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004866 {
4867 Parcel data = Parcel.obtain();
4868 Parcel reply = Parcel.obtain();
4869 data.writeInterfaceToken(IActivityManager.descriptor);
4870 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackborn4a18c262016-02-26 17:23:48 -08004871 data.writeInt(imAMonkey ? 1 : 0);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004872 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004873 reply.readException();
4874 data.recycle();
4875 reply.recycle();
4876 }
Dianne Hackbornb2117d12016-02-16 18:26:35 -08004877 public void setLenientBackgroundCheck(boolean enabled) throws RemoteException
4878 {
4879 Parcel data = Parcel.obtain();
4880 Parcel reply = Parcel.obtain();
4881 data.writeInterfaceToken(IActivityManager.descriptor);
4882 data.writeInt(enabled ? 1 : 0);
4883 mRemote.transact(SET_LENIENT_BACKGROUND_CHECK_TRANSACTION, data, reply, 0);
4884 reply.readException();
4885 data.recycle();
4886 reply.recycle();
4887 }
Dianne Hackborn970510b2016-02-24 16:56:42 -08004888 public int getMemoryTrimLevel() throws RemoteException
4889 {
4890 Parcel data = Parcel.obtain();
4891 Parcel reply = Parcel.obtain();
4892 data.writeInterfaceToken(IActivityManager.descriptor);
4893 mRemote.transact(GET_MEMORY_TRIM_LEVEL_TRANSACTION, data, reply, 0);
4894 reply.readException();
4895 int level = reply.readInt();
4896 data.recycle();
4897 reply.recycle();
4898 return level;
4899 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004900 public void enterSafeMode() throws RemoteException {
4901 Parcel data = Parcel.obtain();
4902 data.writeInterfaceToken(IActivityManager.descriptor);
4903 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4904 data.recycle();
4905 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004906 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004907 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004908 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004909 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004910 data.writeStrongBinder(sender.asBinder());
4911 data.writeInt(sourceUid);
4912 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004913 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004914 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4915 data.recycle();
4916 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004917 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4918 throws RemoteException {
4919 Parcel data = Parcel.obtain();
4920 data.writeInterfaceToken(IActivityManager.descriptor);
4921 data.writeStrongBinder(sender.asBinder());
4922 data.writeInt(sourceUid);
4923 data.writeString(tag);
4924 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4925 data.recycle();
4926 }
4927 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4928 throws RemoteException {
4929 Parcel data = Parcel.obtain();
4930 data.writeInterfaceToken(IActivityManager.descriptor);
4931 data.writeStrongBinder(sender.asBinder());
4932 data.writeInt(sourceUid);
4933 data.writeString(tag);
4934 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4935 data.recycle();
4936 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004937 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004938 Parcel data = Parcel.obtain();
4939 Parcel reply = Parcel.obtain();
4940 data.writeInterfaceToken(IActivityManager.descriptor);
4941 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004942 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004943 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004944 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004945 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004946 boolean res = reply.readInt() != 0;
4947 data.recycle();
4948 reply.recycle();
4949 return res;
4950 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004951 @Override
4952 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4953 Parcel data = Parcel.obtain();
4954 Parcel reply = Parcel.obtain();
4955 data.writeInterfaceToken(IActivityManager.descriptor);
4956 data.writeString(reason);
4957 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4958 boolean res = reply.readInt() != 0;
4959 data.recycle();
4960 reply.recycle();
4961 return res;
4962 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004963 public boolean testIsSystemReady()
4964 {
4965 /* this base class version is never called */
4966 return true;
4967 }
Dan Egnor60d87622009-12-16 16:32:58 -08004968 public void handleApplicationCrash(IBinder app,
4969 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4970 {
4971 Parcel data = Parcel.obtain();
4972 Parcel reply = Parcel.obtain();
4973 data.writeInterfaceToken(IActivityManager.descriptor);
4974 data.writeStrongBinder(app);
4975 crashInfo.writeToParcel(data, 0);
4976 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4977 reply.readException();
4978 reply.recycle();
4979 data.recycle();
4980 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004981
Dianne Hackborn52322712014-08-26 22:47:26 -07004982 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004983 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004984 {
4985 Parcel data = Parcel.obtain();
4986 Parcel reply = Parcel.obtain();
4987 data.writeInterfaceToken(IActivityManager.descriptor);
4988 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004989 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004990 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004991 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004992 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004993 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004994 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004995 reply.recycle();
4996 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004997 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004998 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004999
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07005000 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07005001 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07005002 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07005003 {
5004 Parcel data = Parcel.obtain();
5005 Parcel reply = Parcel.obtain();
5006 data.writeInterfaceToken(IActivityManager.descriptor);
5007 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07005008 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07005009 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07005010 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
5011 reply.readException();
5012 reply.recycle();
5013 data.recycle();
5014 }
5015
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005016 public void signalPersistentProcesses(int sig) throws RemoteException {
5017 Parcel data = Parcel.obtain();
5018 Parcel reply = Parcel.obtain();
5019 data.writeInterfaceToken(IActivityManager.descriptor);
5020 data.writeInt(sig);
5021 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
5022 reply.readException();
5023 data.recycle();
5024 reply.recycle();
5025 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08005026
Dianne Hackborn1676c852012-09-10 14:52:30 -07005027 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005028 Parcel data = Parcel.obtain();
5029 Parcel reply = Parcel.obtain();
5030 data.writeInterfaceToken(IActivityManager.descriptor);
5031 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005032 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08005033 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
5034 reply.readException();
5035 data.recycle();
5036 reply.recycle();
5037 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08005038
5039 public void killAllBackgroundProcesses() throws RemoteException {
5040 Parcel data = Parcel.obtain();
5041 Parcel reply = Parcel.obtain();
5042 data.writeInterfaceToken(IActivityManager.descriptor);
5043 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
5044 reply.readException();
5045 data.recycle();
5046 reply.recycle();
5047 }
5048
Gustav Sennton6258dcd2015-10-30 19:25:37 +00005049 public void killPackageDependents(String packageName, int userId) throws RemoteException {
5050 Parcel data = Parcel.obtain();
5051 Parcel reply = Parcel.obtain();
5052 data.writeInterfaceToken(IActivityManager.descriptor);
5053 data.writeString(packageName);
5054 data.writeInt(userId);
5055 mRemote.transact(KILL_PACKAGE_DEPENDENTS_TRANSACTION, data, reply, 0);
5056 reply.readException();
5057 data.recycle();
5058 reply.recycle();
5059 }
5060
Dianne Hackborn1676c852012-09-10 14:52:30 -07005061 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08005062 Parcel data = Parcel.obtain();
5063 Parcel reply = Parcel.obtain();
5064 data.writeInterfaceToken(IActivityManager.descriptor);
5065 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005066 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08005067 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005068 reply.readException();
5069 data.recycle();
5070 reply.recycle();
5071 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005072
Dianne Hackborn27ff9132012-03-06 14:57:58 -08005073 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
5074 throws RemoteException
5075 {
5076 Parcel data = Parcel.obtain();
5077 Parcel reply = Parcel.obtain();
5078 data.writeInterfaceToken(IActivityManager.descriptor);
5079 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
5080 reply.readException();
5081 outInfo.readFromParcel(reply);
5082 reply.recycle();
5083 data.recycle();
5084 }
5085
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005086 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
5087 {
5088 Parcel data = Parcel.obtain();
5089 Parcel reply = Parcel.obtain();
5090 data.writeInterfaceToken(IActivityManager.descriptor);
5091 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
5092 reply.readException();
5093 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
5094 reply.recycle();
5095 data.recycle();
5096 return res;
5097 }
Jeff Hao1b012d32014-08-20 10:35:34 -07005098
Dianne Hackborn1676c852012-09-10 14:52:30 -07005099 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07005100 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005101 {
5102 Parcel data = Parcel.obtain();
5103 Parcel reply = Parcel.obtain();
5104 data.writeInterfaceToken(IActivityManager.descriptor);
5105 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005106 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005107 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07005108 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07005109 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07005110 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07005111 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07005112 } else {
5113 data.writeInt(0);
5114 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08005115 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
5116 reply.readException();
5117 boolean res = reply.readInt() != 0;
5118 reply.recycle();
5119 data.recycle();
5120 return res;
5121 }
Jeff Hao1b012d32014-08-20 10:35:34 -07005122
Dianne Hackborn55280a92009-05-07 15:53:46 -07005123 public boolean shutdown(int timeout) throws RemoteException
5124 {
5125 Parcel data = Parcel.obtain();
5126 Parcel reply = Parcel.obtain();
5127 data.writeInterfaceToken(IActivityManager.descriptor);
5128 data.writeInt(timeout);
5129 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
5130 reply.readException();
5131 boolean res = reply.readInt() != 0;
5132 reply.recycle();
5133 data.recycle();
5134 return res;
5135 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005136
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005137 public void stopAppSwitches() throws RemoteException {
5138 Parcel data = Parcel.obtain();
5139 Parcel reply = Parcel.obtain();
5140 data.writeInterfaceToken(IActivityManager.descriptor);
5141 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
5142 reply.readException();
5143 reply.recycle();
5144 data.recycle();
5145 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005146
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07005147 public void resumeAppSwitches() throws RemoteException {
5148 Parcel data = Parcel.obtain();
5149 Parcel reply = Parcel.obtain();
5150 data.writeInterfaceToken(IActivityManager.descriptor);
5151 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
5152 reply.readException();
5153 reply.recycle();
5154 data.recycle();
5155 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07005156
5157 public void addPackageDependency(String packageName) throws RemoteException {
5158 Parcel data = Parcel.obtain();
5159 Parcel reply = Parcel.obtain();
5160 data.writeInterfaceToken(IActivityManager.descriptor);
5161 data.writeString(packageName);
5162 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
5163 reply.readException();
5164 data.recycle();
5165 reply.recycle();
5166 }
5167
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005168 public void killApplicationWithAppId(String pkg, int appid, String reason)
5169 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005170 Parcel data = Parcel.obtain();
5171 Parcel reply = Parcel.obtain();
5172 data.writeInterfaceToken(IActivityManager.descriptor);
5173 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005174 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07005175 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005176 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07005177 reply.readException();
5178 data.recycle();
5179 reply.recycle();
5180 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005181
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07005182 public void closeSystemDialogs(String reason) throws RemoteException {
5183 Parcel data = Parcel.obtain();
5184 Parcel reply = Parcel.obtain();
5185 data.writeInterfaceToken(IActivityManager.descriptor);
5186 data.writeString(reason);
5187 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
5188 reply.readException();
5189 data.recycle();
5190 reply.recycle();
5191 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005192
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005193 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005194 throws RemoteException {
5195 Parcel data = Parcel.obtain();
5196 Parcel reply = Parcel.obtain();
5197 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005198 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005199 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
5200 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005201 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005202 data.recycle();
5203 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07005204 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07005205 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07005206
5207 public void killApplicationProcess(String processName, int uid) throws RemoteException {
5208 Parcel data = Parcel.obtain();
5209 Parcel reply = Parcel.obtain();
5210 data.writeInterfaceToken(IActivityManager.descriptor);
5211 data.writeString(processName);
5212 data.writeInt(uid);
5213 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
5214 reply.readException();
5215 data.recycle();
5216 reply.recycle();
5217 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005218
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07005219 public void overridePendingTransition(IBinder token, String packageName,
5220 int enterAnim, int exitAnim) throws RemoteException {
5221 Parcel data = Parcel.obtain();
5222 Parcel reply = Parcel.obtain();
5223 data.writeInterfaceToken(IActivityManager.descriptor);
5224 data.writeStrongBinder(token);
5225 data.writeString(packageName);
5226 data.writeInt(enterAnim);
5227 data.writeInt(exitAnim);
5228 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
5229 reply.readException();
5230 data.recycle();
5231 reply.recycle();
5232 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005233
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08005234 public boolean isUserAMonkey() throws RemoteException {
5235 Parcel data = Parcel.obtain();
5236 Parcel reply = Parcel.obtain();
5237 data.writeInterfaceToken(IActivityManager.descriptor);
5238 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
5239 reply.readException();
5240 boolean res = reply.readInt() != 0;
5241 data.recycle();
5242 reply.recycle();
5243 return res;
5244 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07005245
5246 public void setUserIsMonkey(boolean monkey) throws RemoteException {
5247 Parcel data = Parcel.obtain();
5248 Parcel reply = Parcel.obtain();
5249 data.writeInterfaceToken(IActivityManager.descriptor);
5250 data.writeInt(monkey ? 1 : 0);
5251 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
5252 reply.readException();
5253 data.recycle();
5254 reply.recycle();
5255 }
5256
Dianne Hackborn860755f2010-06-03 18:47:52 -07005257 public void finishHeavyWeightApp() throws RemoteException {
5258 Parcel data = Parcel.obtain();
5259 Parcel reply = Parcel.obtain();
5260 data.writeInterfaceToken(IActivityManager.descriptor);
5261 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
5262 reply.readException();
5263 data.recycle();
5264 reply.recycle();
5265 }
Craig Mautner4addfc52013-06-25 08:05:45 -07005266
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005267 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07005268 throws RemoteException {
5269 Parcel data = Parcel.obtain();
5270 Parcel reply = Parcel.obtain();
5271 data.writeInterfaceToken(IActivityManager.descriptor);
5272 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07005273 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
5274 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005275 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005276 data.recycle();
5277 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005278 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07005279 }
5280
Craig Mautner233ceee2014-05-09 17:05:11 -07005281 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07005282 throws RemoteException {
5283 Parcel data = Parcel.obtain();
5284 Parcel reply = Parcel.obtain();
5285 data.writeInterfaceToken(IActivityManager.descriptor);
5286 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07005287 if (options == null) {
5288 data.writeInt(0);
5289 } else {
5290 data.writeInt(1);
5291 data.writeBundle(options.toBundle());
5292 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07005293 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07005294 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005295 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07005296 data.recycle();
5297 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07005298 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07005299 }
5300
Craig Mautner233ceee2014-05-09 17:05:11 -07005301 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
5302 Parcel data = Parcel.obtain();
5303 Parcel reply = Parcel.obtain();
5304 data.writeInterfaceToken(IActivityManager.descriptor);
5305 data.writeStrongBinder(token);
5306 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
5307 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08005308 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07005309 data.recycle();
5310 reply.recycle();
5311 return options;
5312 }
5313
Daniel Sandler69a48172010-06-23 16:29:36 -04005314 public void setImmersive(IBinder token, boolean immersive)
5315 throws RemoteException {
5316 Parcel data = Parcel.obtain();
5317 Parcel reply = Parcel.obtain();
5318 data.writeInterfaceToken(IActivityManager.descriptor);
5319 data.writeStrongBinder(token);
5320 data.writeInt(immersive ? 1 : 0);
5321 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
5322 reply.readException();
5323 data.recycle();
5324 reply.recycle();
5325 }
5326
5327 public boolean isImmersive(IBinder token)
5328 throws RemoteException {
5329 Parcel data = Parcel.obtain();
5330 Parcel reply = Parcel.obtain();
5331 data.writeInterfaceToken(IActivityManager.descriptor);
5332 data.writeStrongBinder(token);
5333 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005334 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005335 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005336 data.recycle();
5337 reply.recycle();
5338 return res;
5339 }
5340
Craig Mautnerd61dc202014-07-07 11:09:11 -07005341 public boolean isTopOfTask(IBinder token) throws RemoteException {
5342 Parcel data = Parcel.obtain();
5343 Parcel reply = Parcel.obtain();
5344 data.writeInterfaceToken(IActivityManager.descriptor);
5345 data.writeStrongBinder(token);
5346 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
5347 reply.readException();
5348 boolean res = reply.readInt() == 1;
5349 data.recycle();
5350 reply.recycle();
5351 return res;
5352 }
5353
Daniel Sandler69a48172010-06-23 16:29:36 -04005354 public boolean isTopActivityImmersive()
5355 throws RemoteException {
5356 Parcel data = Parcel.obtain();
5357 Parcel reply = Parcel.obtain();
5358 data.writeInterfaceToken(IActivityManager.descriptor);
5359 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005360 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005361 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005362 data.recycle();
5363 reply.recycle();
5364 return res;
5365 }
5366
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005367 public void crashApplication(int uid, int initialPid, String packageName,
5368 String message) throws RemoteException {
5369 Parcel data = Parcel.obtain();
5370 Parcel reply = Parcel.obtain();
5371 data.writeInterfaceToken(IActivityManager.descriptor);
5372 data.writeInt(uid);
5373 data.writeInt(initialPid);
5374 data.writeString(packageName);
5375 data.writeString(message);
5376 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5377 reply.readException();
5378 data.recycle();
5379 reply.recycle();
5380 }
Andy McFadden824c5102010-07-09 16:26:57 -07005381
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005382 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005383 Parcel data = Parcel.obtain();
5384 Parcel reply = Parcel.obtain();
5385 data.writeInterfaceToken(IActivityManager.descriptor);
5386 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005387 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005388 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5389 reply.readException();
5390 String res = reply.readString();
5391 data.recycle();
5392 reply.recycle();
5393 return res;
5394 }
5395
Dianne Hackborn7e269642010-08-25 19:50:20 -07005396 public IBinder newUriPermissionOwner(String name)
5397 throws RemoteException {
5398 Parcel data = Parcel.obtain();
5399 Parcel reply = Parcel.obtain();
5400 data.writeInterfaceToken(IActivityManager.descriptor);
5401 data.writeString(name);
5402 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5403 reply.readException();
5404 IBinder res = reply.readStrongBinder();
5405 data.recycle();
5406 reply.recycle();
5407 return res;
5408 }
5409
Vladislav Kaznacheevb23a7572015-12-18 12:23:43 -08005410 public IBinder getUriPermissionOwnerForActivity(IBinder activityToken) throws RemoteException {
5411 Parcel data = Parcel.obtain();
5412 Parcel reply = Parcel.obtain();
5413 data.writeInterfaceToken(IActivityManager.descriptor);
5414 data.writeStrongBinder(activityToken);
5415 mRemote.transact(GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
5416 reply.readException();
5417 IBinder res = reply.readStrongBinder();
5418 data.recycle();
5419 reply.recycle();
5420 return res;
5421 }
5422
Dianne Hackborn7e269642010-08-25 19:50:20 -07005423 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005424 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005425 Parcel data = Parcel.obtain();
5426 Parcel reply = Parcel.obtain();
5427 data.writeInterfaceToken(IActivityManager.descriptor);
5428 data.writeStrongBinder(owner);
5429 data.writeInt(fromUid);
5430 data.writeString(targetPkg);
5431 uri.writeToParcel(data, 0);
5432 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005433 data.writeInt(sourceUserId);
5434 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005435 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5436 reply.readException();
5437 data.recycle();
5438 reply.recycle();
5439 }
5440
5441 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005442 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005443 Parcel data = Parcel.obtain();
5444 Parcel reply = Parcel.obtain();
5445 data.writeInterfaceToken(IActivityManager.descriptor);
5446 data.writeStrongBinder(owner);
5447 if (uri != null) {
5448 data.writeInt(1);
5449 uri.writeToParcel(data, 0);
5450 } else {
5451 data.writeInt(0);
5452 }
5453 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005454 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005455 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5456 reply.readException();
5457 data.recycle();
5458 reply.recycle();
5459 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005460
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005461 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005462 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005463 Parcel data = Parcel.obtain();
5464 Parcel reply = Parcel.obtain();
5465 data.writeInterfaceToken(IActivityManager.descriptor);
5466 data.writeInt(callingUid);
5467 data.writeString(targetPkg);
5468 uri.writeToParcel(data, 0);
5469 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005470 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005471 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5472 reply.readException();
5473 int res = reply.readInt();
5474 data.recycle();
5475 reply.recycle();
5476 return res;
5477 }
5478
Dianne Hackborn1676c852012-09-10 14:52:30 -07005479 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005480 String path, ParcelFileDescriptor fd) throws RemoteException {
5481 Parcel data = Parcel.obtain();
5482 Parcel reply = Parcel.obtain();
5483 data.writeInterfaceToken(IActivityManager.descriptor);
5484 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005485 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005486 data.writeInt(managed ? 1 : 0);
5487 data.writeString(path);
5488 if (fd != null) {
5489 data.writeInt(1);
5490 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5491 } else {
5492 data.writeInt(0);
5493 }
5494 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5495 reply.readException();
5496 boolean res = reply.readInt() != 0;
5497 reply.recycle();
5498 data.recycle();
5499 return res;
5500 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005501
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005502 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005503 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005504 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005505 Parcel data = Parcel.obtain();
5506 Parcel reply = Parcel.obtain();
5507 data.writeInterfaceToken(IActivityManager.descriptor);
5508 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005509 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005510 data.writeTypedArray(intents, 0);
5511 data.writeStringArray(resolvedTypes);
5512 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005513 if (options != null) {
5514 data.writeInt(1);
5515 options.writeToParcel(data, 0);
5516 } else {
5517 data.writeInt(0);
5518 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005519 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005520 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5521 reply.readException();
5522 int result = reply.readInt();
5523 reply.recycle();
5524 data.recycle();
5525 return result;
5526 }
5527
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005528 public int getFrontActivityScreenCompatMode() throws RemoteException {
5529 Parcel data = Parcel.obtain();
5530 Parcel reply = Parcel.obtain();
5531 data.writeInterfaceToken(IActivityManager.descriptor);
5532 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5533 reply.readException();
5534 int mode = reply.readInt();
5535 reply.recycle();
5536 data.recycle();
5537 return mode;
5538 }
5539
5540 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5541 Parcel data = Parcel.obtain();
5542 Parcel reply = Parcel.obtain();
5543 data.writeInterfaceToken(IActivityManager.descriptor);
5544 data.writeInt(mode);
5545 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5546 reply.readException();
5547 reply.recycle();
5548 data.recycle();
5549 }
5550
5551 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5552 Parcel data = Parcel.obtain();
5553 Parcel reply = Parcel.obtain();
5554 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005555 data.writeString(packageName);
5556 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005557 reply.readException();
5558 int mode = reply.readInt();
5559 reply.recycle();
5560 data.recycle();
5561 return mode;
5562 }
5563
5564 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005565 throws RemoteException {
5566 Parcel data = Parcel.obtain();
5567 Parcel reply = Parcel.obtain();
5568 data.writeInterfaceToken(IActivityManager.descriptor);
5569 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005570 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005571 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5572 reply.readException();
5573 reply.recycle();
5574 data.recycle();
5575 }
5576
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005577 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5578 Parcel data = Parcel.obtain();
5579 Parcel reply = Parcel.obtain();
5580 data.writeInterfaceToken(IActivityManager.descriptor);
5581 data.writeString(packageName);
5582 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5583 reply.readException();
5584 boolean ask = reply.readInt() != 0;
5585 reply.recycle();
5586 data.recycle();
5587 return ask;
5588 }
5589
5590 public void setPackageAskScreenCompat(String packageName, boolean ask)
5591 throws RemoteException {
5592 Parcel data = Parcel.obtain();
5593 Parcel reply = Parcel.obtain();
5594 data.writeInterfaceToken(IActivityManager.descriptor);
5595 data.writeString(packageName);
5596 data.writeInt(ask ? 1 : 0);
5597 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5598 reply.readException();
5599 reply.recycle();
5600 data.recycle();
5601 }
5602
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005603 public boolean switchUser(int userid) throws RemoteException {
5604 Parcel data = Parcel.obtain();
5605 Parcel reply = Parcel.obtain();
5606 data.writeInterfaceToken(IActivityManager.descriptor);
5607 data.writeInt(userid);
5608 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5609 reply.readException();
5610 boolean result = reply.readInt() != 0;
5611 reply.recycle();
5612 data.recycle();
5613 return result;
5614 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005615
Kenny Guy08488bf2014-02-21 17:40:37 +00005616 public boolean startUserInBackground(int userid) throws RemoteException {
5617 Parcel data = Parcel.obtain();
5618 Parcel reply = Parcel.obtain();
5619 data.writeInterfaceToken(IActivityManager.descriptor);
5620 data.writeInt(userid);
5621 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5622 reply.readException();
5623 boolean result = reply.readInt() != 0;
5624 reply.recycle();
5625 data.recycle();
5626 return result;
5627 }
5628
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00005629 public boolean unlockUser(int userId, byte[] token, byte[] secret) throws RemoteException {
Jeff Sharkeyba512352015-11-12 20:17:45 -08005630 Parcel data = Parcel.obtain();
5631 Parcel reply = Parcel.obtain();
5632 data.writeInterfaceToken(IActivityManager.descriptor);
5633 data.writeInt(userId);
5634 data.writeByteArray(token);
Paul Crowleyfaeb3eb2016-02-08 15:58:29 +00005635 data.writeByteArray(secret);
Jeff Sharkeyba512352015-11-12 20:17:45 -08005636 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5637 reply.readException();
5638 boolean result = reply.readInt() != 0;
5639 reply.recycle();
5640 data.recycle();
5641 return result;
5642 }
5643
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005644 public int stopUser(int userid, boolean force, IStopUserCallback callback)
5645 throws RemoteException {
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005646 Parcel data = Parcel.obtain();
5647 Parcel reply = Parcel.obtain();
5648 data.writeInterfaceToken(IActivityManager.descriptor);
5649 data.writeInt(userid);
Fyodor Kupolov9cbfc9e2015-10-07 15:52:33 -07005650 data.writeInt(force ? 1 : 0);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005651 data.writeStrongInterface(callback);
5652 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5653 reply.readException();
5654 int result = reply.readInt();
5655 reply.recycle();
5656 data.recycle();
5657 return result;
5658 }
5659
Amith Yamasani52f1d752012-03-28 18:19:29 -07005660 public UserInfo getCurrentUser() throws RemoteException {
5661 Parcel data = Parcel.obtain();
5662 Parcel reply = Parcel.obtain();
5663 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005664 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005665 reply.readException();
5666 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5667 reply.recycle();
5668 data.recycle();
5669 return userInfo;
5670 }
5671
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005672 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005673 Parcel data = Parcel.obtain();
5674 Parcel reply = Parcel.obtain();
5675 data.writeInterfaceToken(IActivityManager.descriptor);
5676 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005677 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005678 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5679 reply.readException();
5680 boolean result = reply.readInt() != 0;
5681 reply.recycle();
5682 data.recycle();
5683 return result;
5684 }
5685
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005686 public int[] getRunningUserIds() throws RemoteException {
5687 Parcel data = Parcel.obtain();
5688 Parcel reply = Parcel.obtain();
5689 data.writeInterfaceToken(IActivityManager.descriptor);
5690 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5691 reply.readException();
5692 int[] result = reply.createIntArray();
5693 reply.recycle();
5694 data.recycle();
5695 return result;
5696 }
5697
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005698 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005699 Parcel data = Parcel.obtain();
5700 Parcel reply = Parcel.obtain();
5701 data.writeInterfaceToken(IActivityManager.descriptor);
5702 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005703 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5704 reply.readException();
5705 boolean result = reply.readInt() != 0;
5706 reply.recycle();
5707 data.recycle();
5708 return result;
5709 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005710
Jeff Sharkeya4620792011-05-20 15:29:23 -07005711 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5712 Parcel data = Parcel.obtain();
5713 Parcel reply = Parcel.obtain();
5714 data.writeInterfaceToken(IActivityManager.descriptor);
5715 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5716 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5717 reply.readException();
5718 data.recycle();
5719 reply.recycle();
5720 }
5721
5722 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5723 Parcel data = Parcel.obtain();
5724 Parcel reply = Parcel.obtain();
5725 data.writeInterfaceToken(IActivityManager.descriptor);
5726 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5727 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5728 reply.readException();
5729 data.recycle();
5730 reply.recycle();
5731 }
5732
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005733 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005734 Parcel data = Parcel.obtain();
5735 Parcel reply = Parcel.obtain();
5736 data.writeInterfaceToken(IActivityManager.descriptor);
5737 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005738 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005739 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5740 reply.readException();
5741 data.recycle();
5742 reply.recycle();
5743 }
5744
5745 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5746 Parcel data = Parcel.obtain();
5747 Parcel reply = Parcel.obtain();
5748 data.writeInterfaceToken(IActivityManager.descriptor);
5749 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5750 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5751 reply.readException();
5752 data.recycle();
5753 reply.recycle();
5754 }
5755
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005756 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5757 Parcel data = Parcel.obtain();
5758 Parcel reply = Parcel.obtain();
5759 data.writeInterfaceToken(IActivityManager.descriptor);
5760 data.writeStrongBinder(sender.asBinder());
5761 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5762 reply.readException();
5763 boolean res = reply.readInt() != 0;
5764 data.recycle();
5765 reply.recycle();
5766 return res;
5767 }
5768
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005769 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5770 Parcel data = Parcel.obtain();
5771 Parcel reply = Parcel.obtain();
5772 data.writeInterfaceToken(IActivityManager.descriptor);
5773 data.writeStrongBinder(sender.asBinder());
5774 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5775 reply.readException();
5776 boolean res = reply.readInt() != 0;
5777 data.recycle();
5778 reply.recycle();
5779 return res;
5780 }
5781
Dianne Hackborn81038902012-11-26 17:04:09 -08005782 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5783 Parcel data = Parcel.obtain();
5784 Parcel reply = Parcel.obtain();
5785 data.writeInterfaceToken(IActivityManager.descriptor);
5786 data.writeStrongBinder(sender.asBinder());
5787 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5788 reply.readException();
5789 Intent res = reply.readInt() != 0
5790 ? Intent.CREATOR.createFromParcel(reply) : null;
5791 data.recycle();
5792 reply.recycle();
5793 return res;
5794 }
5795
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005796 public String getTagForIntentSender(IIntentSender sender, String prefix)
5797 throws RemoteException {
5798 Parcel data = Parcel.obtain();
5799 Parcel reply = Parcel.obtain();
5800 data.writeInterfaceToken(IActivityManager.descriptor);
5801 data.writeStrongBinder(sender.asBinder());
5802 data.writeString(prefix);
5803 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5804 reply.readException();
5805 String res = reply.readString();
5806 data.recycle();
5807 reply.recycle();
5808 return res;
5809 }
5810
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005811 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5812 {
5813 Parcel data = Parcel.obtain();
5814 Parcel reply = Parcel.obtain();
5815 data.writeInterfaceToken(IActivityManager.descriptor);
5816 values.writeToParcel(data, 0);
5817 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5818 reply.readException();
5819 data.recycle();
5820 reply.recycle();
5821 }
5822
Dianne Hackbornb437e092011-08-05 17:50:29 -07005823 public long[] getProcessPss(int[] pids) throws RemoteException {
5824 Parcel data = Parcel.obtain();
5825 Parcel reply = Parcel.obtain();
5826 data.writeInterfaceToken(IActivityManager.descriptor);
5827 data.writeIntArray(pids);
5828 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5829 reply.readException();
5830 long[] res = reply.createLongArray();
5831 data.recycle();
5832 reply.recycle();
5833 return res;
5834 }
5835
Dianne Hackborn661cd522011-08-22 00:26:20 -07005836 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5837 Parcel data = Parcel.obtain();
5838 Parcel reply = Parcel.obtain();
5839 data.writeInterfaceToken(IActivityManager.descriptor);
5840 TextUtils.writeToParcel(msg, data, 0);
5841 data.writeInt(always ? 1 : 0);
5842 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5843 reply.readException();
5844 data.recycle();
5845 reply.recycle();
5846 }
5847
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005848 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005849 Parcel data = Parcel.obtain();
5850 Parcel reply = Parcel.obtain();
5851 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005852 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005853 reply.readException();
5854 data.recycle();
5855 reply.recycle();
5856 }
5857
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005858 public void keyguardGoingAway(boolean disableWindowAnimations,
5859 boolean keyguardGoingToNotificationShade) throws RemoteException {
5860 Parcel data = Parcel.obtain();
5861 Parcel reply = Parcel.obtain();
5862 data.writeInterfaceToken(IActivityManager.descriptor);
5863 data.writeInt(disableWindowAnimations ? 1 : 0);
5864 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5865 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5866 reply.readException();
5867 data.recycle();
5868 reply.recycle();
5869 }
5870
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005871 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005872 throws RemoteException {
5873 Parcel data = Parcel.obtain();
5874 Parcel reply = Parcel.obtain();
5875 data.writeInterfaceToken(IActivityManager.descriptor);
5876 data.writeStrongBinder(token);
5877 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005878 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005879 reply.readException();
5880 boolean result = reply.readInt() != 0;
5881 data.recycle();
5882 reply.recycle();
5883 return result;
5884 }
5885
5886 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5887 throws RemoteException {
5888 Parcel data = Parcel.obtain();
5889 Parcel reply = Parcel.obtain();
5890 data.writeInterfaceToken(IActivityManager.descriptor);
5891 data.writeStrongBinder(token);
5892 target.writeToParcel(data, 0);
5893 data.writeInt(resultCode);
5894 if (resultData != null) {
5895 data.writeInt(1);
5896 resultData.writeToParcel(data, 0);
5897 } else {
5898 data.writeInt(0);
5899 }
5900 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5901 reply.readException();
5902 boolean result = reply.readInt() != 0;
5903 data.recycle();
5904 reply.recycle();
5905 return result;
5906 }
5907
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005908 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5909 Parcel data = Parcel.obtain();
5910 Parcel reply = Parcel.obtain();
5911 data.writeInterfaceToken(IActivityManager.descriptor);
5912 data.writeStrongBinder(activityToken);
5913 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5914 reply.readException();
5915 int result = reply.readInt();
5916 data.recycle();
5917 reply.recycle();
5918 return result;
5919 }
5920
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005921 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5922 Parcel data = Parcel.obtain();
5923 Parcel reply = Parcel.obtain();
5924 data.writeInterfaceToken(IActivityManager.descriptor);
5925 data.writeStrongBinder(activityToken);
5926 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5927 reply.readException();
5928 String result = reply.readString();
5929 data.recycle();
5930 reply.recycle();
5931 return result;
5932 }
5933
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005934 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5935 Parcel data = Parcel.obtain();
5936 Parcel reply = Parcel.obtain();
5937 data.writeInterfaceToken(IActivityManager.descriptor);
5938 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5939 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5940 reply.readException();
5941 data.recycle();
5942 reply.recycle();
5943 }
5944
5945 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5946 Parcel data = Parcel.obtain();
5947 Parcel reply = Parcel.obtain();
5948 data.writeInterfaceToken(IActivityManager.descriptor);
5949 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5950 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5951 reply.readException();
5952 data.recycle();
5953 reply.recycle();
5954 }
5955
Michal Karpinski3da5c972015-12-11 18:16:30 +00005956 public void requestBugReport(@ActivityManager.BugreportMode int bugreportType)
5957 throws RemoteException {
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005958 Parcel data = Parcel.obtain();
5959 Parcel reply = Parcel.obtain();
5960 data.writeInterfaceToken(IActivityManager.descriptor);
Michal Karpinski3da5c972015-12-11 18:16:30 +00005961 data.writeInt(bugreportType);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005962 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5963 reply.readException();
5964 data.recycle();
5965 reply.recycle();
5966 }
5967
Jeff Brownbd181bb2013-09-10 16:44:24 -07005968 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5969 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005970 Parcel data = Parcel.obtain();
5971 Parcel reply = Parcel.obtain();
5972 data.writeInterfaceToken(IActivityManager.descriptor);
5973 data.writeInt(pid);
5974 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005975 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005976 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5977 reply.readException();
5978 long res = reply.readInt();
5979 data.recycle();
5980 reply.recycle();
5981 return res;
5982 }
5983
Adam Skorydfc7fd72013-08-05 19:23:41 -07005984 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005985 Parcel data = Parcel.obtain();
5986 Parcel reply = Parcel.obtain();
5987 data.writeInterfaceToken(IActivityManager.descriptor);
5988 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005989 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005990 reply.readException();
5991 Bundle res = reply.readBundle();
5992 data.recycle();
5993 reply.recycle();
5994 return res;
5995 }
5996
Dianne Hackborn17f69352015-07-17 18:04:14 -07005997 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5998 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005999 Parcel data = Parcel.obtain();
6000 Parcel reply = Parcel.obtain();
6001 data.writeInterfaceToken(IActivityManager.descriptor);
6002 data.writeInt(requestType);
6003 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07006004 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08006005 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
6006 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07006007 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08006008 data.recycle();
6009 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07006010 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08006011 }
6012
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07006013 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07006014 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08006015 Parcel data = Parcel.obtain();
6016 Parcel reply = Parcel.obtain();
6017 data.writeInterfaceToken(IActivityManager.descriptor);
6018 data.writeStrongBinder(token);
6019 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07006020 structure.writeToParcel(data, 0);
6021 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07006022 if (referrer != null) {
6023 data.writeInt(1);
6024 referrer.writeToParcel(data, 0);
6025 } else {
6026 data.writeInt(0);
6027 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07006028 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08006029 reply.readException();
6030 data.recycle();
6031 reply.recycle();
6032 }
6033
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07006034 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
6035 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07006036 Parcel data = Parcel.obtain();
6037 Parcel reply = Parcel.obtain();
6038 data.writeInterfaceToken(IActivityManager.descriptor);
6039 intent.writeToParcel(data, 0);
6040 data.writeInt(requestType);
6041 data.writeString(hint);
6042 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07006043 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07006044 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
6045 reply.readException();
6046 boolean res = reply.readInt() != 0;
6047 data.recycle();
6048 reply.recycle();
6049 return res;
6050 }
6051
Dianne Hackborn17f69352015-07-17 18:04:14 -07006052 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01006053 Parcel data = Parcel.obtain();
6054 Parcel reply = Parcel.obtain();
6055 data.writeInterfaceToken(IActivityManager.descriptor);
6056 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
6057 reply.readException();
6058 boolean res = reply.readInt() != 0;
6059 data.recycle();
6060 reply.recycle();
6061 return res;
6062 }
6063
Dianne Hackborn17f69352015-07-17 18:04:14 -07006064 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
6065 Parcel data = Parcel.obtain();
6066 Parcel reply = Parcel.obtain();
6067 data.writeInterfaceToken(IActivityManager.descriptor);
6068 data.writeStrongBinder(token);
6069 data.writeBundle(args);
6070 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
6071 reply.readException();
6072 boolean res = reply.readInt() != 0;
6073 data.recycle();
6074 reply.recycle();
6075 return res;
6076 }
6077
Svetoslavaa41add2015-08-06 15:03:55 -07006078 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07006079 Parcel data = Parcel.obtain();
6080 Parcel reply = Parcel.obtain();
6081 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07006082 data.writeInt(appId);
6083 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07006084 data.writeString(reason);
6085 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
6086 reply.readException();
6087 data.recycle();
6088 reply.recycle();
6089 }
6090
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07006091 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
6092 Parcel data = Parcel.obtain();
6093 Parcel reply = Parcel.obtain();
6094 data.writeInterfaceToken(IActivityManager.descriptor);
6095 data.writeStrongBinder(who);
6096 data.writeInt(allowRestart ? 1 : 0);
6097 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
6098 reply.readException();
6099 data.recycle();
6100 reply.recycle();
6101 }
6102
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07006103 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
6104 Parcel data = Parcel.obtain();
6105 Parcel reply = Parcel.obtain();
6106 data.writeInterfaceToken(IActivityManager.descriptor);
6107 data.writeStrongBinder(token);
6108 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
6109 reply.readException();
6110 data.recycle();
6111 reply.recycle();
6112 }
6113
Craig Mautner5eda9b32013-07-02 11:58:16 -07006114 public void notifyActivityDrawn(IBinder token) throws RemoteException {
6115 Parcel data = Parcel.obtain();
6116 Parcel reply = Parcel.obtain();
6117 data.writeInterfaceToken(IActivityManager.descriptor);
6118 data.writeStrongBinder(token);
6119 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
6120 reply.readException();
6121 data.recycle();
6122 reply.recycle();
6123 }
6124
Dianne Hackborn57a7f592013-07-22 18:21:32 -07006125 public void restart() throws RemoteException {
6126 Parcel data = Parcel.obtain();
6127 Parcel reply = Parcel.obtain();
6128 data.writeInterfaceToken(IActivityManager.descriptor);
6129 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
6130 reply.readException();
6131 data.recycle();
6132 reply.recycle();
6133 }
6134
Dianne Hackborn35f72be2013-09-16 10:57:39 -07006135 public void performIdleMaintenance() throws RemoteException {
6136 Parcel data = Parcel.obtain();
6137 Parcel reply = Parcel.obtain();
6138 data.writeInterfaceToken(IActivityManager.descriptor);
6139 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
6140 reply.readException();
6141 data.recycle();
6142 reply.recycle();
6143 }
6144
Todd Kennedyca4d8422015-01-15 15:19:22 -08006145 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08006146 IActivityContainerCallback callback) throws RemoteException {
6147 Parcel data = Parcel.obtain();
6148 Parcel reply = Parcel.obtain();
6149 data.writeInterfaceToken(IActivityManager.descriptor);
6150 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07006151 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08006152 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08006153 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08006154 final int result = reply.readInt();
6155 final IActivityContainer res;
6156 if (result == 1) {
6157 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6158 } else {
6159 res = null;
6160 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08006161 data.recycle();
6162 reply.recycle();
6163 return res;
6164 }
6165
Craig Mautner95da1082014-02-24 17:54:35 -08006166 public void deleteActivityContainer(IActivityContainer activityContainer)
6167 throws RemoteException {
6168 Parcel data = Parcel.obtain();
6169 Parcel reply = Parcel.obtain();
6170 data.writeInterfaceToken(IActivityManager.descriptor);
6171 data.writeStrongBinder(activityContainer.asBinder());
6172 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
6173 reply.readException();
6174 data.recycle();
6175 reply.recycle();
6176 }
6177
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04006178 public boolean startBinderTracking() throws RemoteException {
6179 Parcel data = Parcel.obtain();
6180 Parcel reply = Parcel.obtain();
6181 data.writeInterfaceToken(IActivityManager.descriptor);
6182 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
6183 reply.readException();
6184 boolean res = reply.readInt() != 0;
6185 reply.recycle();
6186 data.recycle();
6187 return res;
6188 }
6189
6190 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
6191 Parcel data = Parcel.obtain();
6192 Parcel reply = Parcel.obtain();
6193 data.writeInterfaceToken(IActivityManager.descriptor);
6194 if (fd != null) {
6195 data.writeInt(1);
6196 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
6197 } else {
6198 data.writeInt(0);
6199 }
6200 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
6201 reply.readException();
6202 boolean res = reply.readInt() != 0;
6203 reply.recycle();
6204 data.recycle();
6205 return res;
6206 }
6207
Ruben Brunkdd18a0b2015-12-04 16:16:31 -08006208 public void setVrMode(IBinder token, boolean enabled) throws RemoteException {
6209 Parcel data = Parcel.obtain();
6210 Parcel reply = Parcel.obtain();
6211 data.writeInterfaceToken(IActivityManager.descriptor);
6212 data.writeStrongBinder(token);
6213 data.writeInt(enabled ? 1 : 0);
6214 mRemote.transact(SET_VR_MODE_TRANSACTION, data, reply, 0);
6215 reply.readException();
6216 data.recycle();
6217 reply.recycle();
6218 }
6219
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006220 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08006221 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
6222 Parcel data = Parcel.obtain();
6223 Parcel reply = Parcel.obtain();
6224 data.writeInterfaceToken(IActivityManager.descriptor);
6225 data.writeInt(displayId);
6226 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
6227 reply.readException();
6228 final int result = reply.readInt();
6229 final IActivityContainer res;
6230 if (result == 1) {
6231 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
6232 } else {
6233 res = null;
6234 }
6235 data.recycle();
6236 reply.recycle();
6237 return res;
6238 }
6239
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006240 @Override
6241 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08006242 throws RemoteException {
6243 Parcel data = Parcel.obtain();
6244 Parcel reply = Parcel.obtain();
6245 data.writeInterfaceToken(IActivityManager.descriptor);
6246 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006247 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08006248 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006249 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08006250 data.recycle();
6251 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006252 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08006253 }
6254
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08006255 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006256 public void startLockTaskMode(int taskId) throws RemoteException {
6257 Parcel data = Parcel.obtain();
6258 Parcel reply = Parcel.obtain();
6259 data.writeInterfaceToken(IActivityManager.descriptor);
6260 data.writeInt(taskId);
6261 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
6262 reply.readException();
6263 data.recycle();
6264 reply.recycle();
6265 }
6266
6267 @Override
6268 public void startLockTaskMode(IBinder token) throws RemoteException {
6269 Parcel data = Parcel.obtain();
6270 Parcel reply = Parcel.obtain();
6271 data.writeInterfaceToken(IActivityManager.descriptor);
6272 data.writeStrongBinder(token);
6273 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
6274 reply.readException();
6275 data.recycle();
6276 reply.recycle();
6277 }
6278
6279 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006280 public void startLockTaskModeOnCurrent() throws RemoteException {
6281 Parcel data = Parcel.obtain();
6282 Parcel reply = Parcel.obtain();
6283 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006284 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006285 reply.readException();
6286 data.recycle();
6287 reply.recycle();
6288 }
6289
6290 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006291 public void stopLockTaskMode() throws RemoteException {
6292 Parcel data = Parcel.obtain();
6293 Parcel reply = Parcel.obtain();
6294 data.writeInterfaceToken(IActivityManager.descriptor);
6295 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6296 reply.readException();
6297 data.recycle();
6298 reply.recycle();
6299 }
6300
6301 @Override
Jason Monk62515be2014-05-21 16:06:19 -04006302 public void stopLockTaskModeOnCurrent() throws RemoteException {
6303 Parcel data = Parcel.obtain();
6304 Parcel reply = Parcel.obtain();
6305 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07006306 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04006307 reply.readException();
6308 data.recycle();
6309 reply.recycle();
6310 }
6311
6312 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08006313 public boolean isInLockTaskMode() throws RemoteException {
6314 Parcel data = Parcel.obtain();
6315 Parcel reply = Parcel.obtain();
6316 data.writeInterfaceToken(IActivityManager.descriptor);
6317 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
6318 reply.readException();
6319 boolean isInLockTaskMode = reply.readInt() == 1;
6320 data.recycle();
6321 reply.recycle();
6322 return isInLockTaskMode;
6323 }
6324
Craig Mautner688b5102014-03-27 16:55:03 -07006325 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00006326 public int getLockTaskModeState() throws RemoteException {
6327 Parcel data = Parcel.obtain();
6328 Parcel reply = Parcel.obtain();
6329 data.writeInterfaceToken(IActivityManager.descriptor);
6330 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
6331 reply.readException();
6332 int lockTaskModeState = reply.readInt();
6333 data.recycle();
6334 reply.recycle();
6335 return lockTaskModeState;
6336 }
6337
6338 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07006339 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
6340 Parcel data = Parcel.obtain();
6341 Parcel reply = Parcel.obtain();
6342 data.writeInterfaceToken(IActivityManager.descriptor);
6343 data.writeStrongBinder(token);
6344 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
6345 IBinder.FLAG_ONEWAY);
6346 reply.readException();
6347 data.recycle();
6348 reply.recycle();
6349 }
6350
6351 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07006352 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07006353 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07006354 Parcel data = Parcel.obtain();
6355 Parcel reply = Parcel.obtain();
6356 data.writeInterfaceToken(IActivityManager.descriptor);
6357 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07006358 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006359 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07006360 reply.readException();
6361 data.recycle();
6362 reply.recycle();
6363 }
6364
Craig Mautneree2e45a2014-06-27 12:10:03 -07006365 @Override
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08006366 public void setTaskResizeable(int taskId, int resizeableMode) throws RemoteException {
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006367 Parcel data = Parcel.obtain();
6368 Parcel reply = Parcel.obtain();
6369 data.writeInterfaceToken(IActivityManager.descriptor);
6370 data.writeInt(taskId);
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08006371 data.writeInt(resizeableMode);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006372 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08006373 reply.readException();
6374 data.recycle();
6375 reply.recycle();
6376 }
6377
6378 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07006379 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006380 {
6381 Parcel data = Parcel.obtain();
6382 Parcel reply = Parcel.obtain();
6383 data.writeInterfaceToken(IActivityManager.descriptor);
6384 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006385 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006386 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006387 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006388 reply.readException();
6389 data.recycle();
6390 reply.recycle();
6391 }
6392
6393 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006394 public Rect getTaskBounds(int taskId) throws RemoteException
6395 {
6396 Parcel data = Parcel.obtain();
6397 Parcel reply = Parcel.obtain();
6398 data.writeInterfaceToken(IActivityManager.descriptor);
6399 data.writeInt(taskId);
6400 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6401 reply.readException();
6402 Rect rect = Rect.CREATOR.createFromParcel(reply);
6403 data.recycle();
6404 reply.recycle();
6405 return rect;
6406 }
6407
6408 @Override
Suprabh Shukla23593142015-11-03 17:31:15 -08006409 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException {
Craig Mautner648f69b2014-09-18 14:16:26 -07006410 Parcel data = Parcel.obtain();
6411 Parcel reply = Parcel.obtain();
6412 data.writeInterfaceToken(IActivityManager.descriptor);
6413 data.writeString(filename);
Suprabh Shukla23593142015-11-03 17:31:15 -08006414 data.writeInt(userId);
Craig Mautner648f69b2014-09-18 14:16:26 -07006415 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6416 reply.readException();
6417 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6418 data.recycle();
6419 reply.recycle();
6420 return icon;
6421 }
6422
6423 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006424 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6425 throws RemoteException {
6426 Parcel data = Parcel.obtain();
6427 Parcel reply = Parcel.obtain();
6428 data.writeInterfaceToken(IActivityManager.descriptor);
6429 if (options == null) {
6430 data.writeInt(0);
6431 } else {
6432 data.writeInt(1);
6433 data.writeBundle(options.toBundle());
6434 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006435 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006436 reply.readException();
6437 data.recycle();
6438 reply.recycle();
6439 }
6440
6441 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006442 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006443 Parcel data = Parcel.obtain();
6444 Parcel reply = Parcel.obtain();
6445 data.writeInterfaceToken(IActivityManager.descriptor);
6446 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006447 data.writeInt(visible ? 1 : 0);
6448 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006449 reply.readException();
6450 boolean success = reply.readInt() > 0;
6451 data.recycle();
6452 reply.recycle();
6453 return success;
6454 }
6455
6456 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006457 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006458 Parcel data = Parcel.obtain();
6459 Parcel reply = Parcel.obtain();
6460 data.writeInterfaceToken(IActivityManager.descriptor);
6461 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006462 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006463 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006464 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006465 data.recycle();
6466 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006467 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006468 }
6469
6470 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006471 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006472 Parcel data = Parcel.obtain();
6473 Parcel reply = Parcel.obtain();
6474 data.writeInterfaceToken(IActivityManager.descriptor);
6475 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006476 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006477 reply.readException();
6478 data.recycle();
6479 reply.recycle();
6480 }
6481
6482 @Override
6483 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6484 Parcel data = Parcel.obtain();
6485 Parcel reply = Parcel.obtain();
6486 data.writeInterfaceToken(IActivityManager.descriptor);
6487 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006488 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006489 reply.readException();
6490 data.recycle();
6491 reply.recycle();
6492 }
6493
Craig Mautner8746a472014-07-24 15:12:54 -07006494 @Override
6495 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6496 Parcel data = Parcel.obtain();
6497 Parcel reply = Parcel.obtain();
6498 data.writeInterfaceToken(IActivityManager.descriptor);
6499 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006500 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006501 reply.readException();
6502 data.recycle();
6503 reply.recycle();
6504 }
6505
Craig Mautner6e2f3952014-09-09 14:26:41 -07006506 @Override
6507 public void bootAnimationComplete() throws RemoteException {
6508 Parcel data = Parcel.obtain();
6509 Parcel reply = Parcel.obtain();
6510 data.writeInterfaceToken(IActivityManager.descriptor);
6511 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6512 reply.readException();
6513 data.recycle();
6514 reply.recycle();
6515 }
6516
Wale Ogunwale18795a22014-12-03 11:38:33 -08006517 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006518 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6519 Parcel data = Parcel.obtain();
6520 Parcel reply = Parcel.obtain();
6521 data.writeInterfaceToken(IActivityManager.descriptor);
6522 data.writeInt(uid);
6523 data.writeByteArray(firstPacket);
6524 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6525 reply.readException();
6526 data.recycle();
6527 reply.recycle();
6528 }
6529
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006530 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006531 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6532 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006533 Parcel data = Parcel.obtain();
6534 Parcel reply = Parcel.obtain();
6535 data.writeInterfaceToken(IActivityManager.descriptor);
6536 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006537 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006538 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006539 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006540 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6541 reply.readException();
6542 data.recycle();
6543 reply.recycle();
6544 }
6545
6546 @Override
6547 public void dumpHeapFinished(String path) throws RemoteException {
6548 Parcel data = Parcel.obtain();
6549 Parcel reply = Parcel.obtain();
6550 data.writeInterfaceToken(IActivityManager.descriptor);
6551 data.writeString(path);
6552 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6553 reply.readException();
6554 data.recycle();
6555 reply.recycle();
6556 }
6557
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006558 @Override
6559 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6560 throws RemoteException {
6561 Parcel data = Parcel.obtain();
6562 Parcel reply = Parcel.obtain();
6563 data.writeInterfaceToken(IActivityManager.descriptor);
6564 data.writeStrongBinder(session.asBinder());
6565 data.writeInt(keepAwake ? 1 : 0);
6566 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6567 reply.readException();
6568 data.recycle();
6569 reply.recycle();
6570 }
6571
Craig Mautnere5600772015-04-03 21:36:37 -07006572 @Override
6573 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6574 Parcel data = Parcel.obtain();
6575 Parcel reply = Parcel.obtain();
6576 data.writeInterfaceToken(IActivityManager.descriptor);
6577 data.writeInt(userId);
6578 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006579 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006580 reply.readException();
6581 data.recycle();
6582 reply.recycle();
6583 }
6584
Dianne Hackborn1e383822015-04-10 14:02:33 -07006585 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006586 public void updateDeviceOwner(String packageName) throws RemoteException {
6587 Parcel data = Parcel.obtain();
6588 Parcel reply = Parcel.obtain();
6589 data.writeInterfaceToken(IActivityManager.descriptor);
6590 data.writeString(packageName);
6591 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6592 reply.readException();
6593 data.recycle();
6594 reply.recycle();
6595 }
6596
6597 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006598 public int getPackageProcessState(String packageName, String callingPackage)
6599 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006600 Parcel data = Parcel.obtain();
6601 Parcel reply = Parcel.obtain();
6602 data.writeInterfaceToken(IActivityManager.descriptor);
6603 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006604 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006605 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6606 reply.readException();
6607 int res = reply.readInt();
6608 data.recycle();
6609 reply.recycle();
6610 return res;
6611 }
6612
Stefan Kuhne16045c22015-06-05 07:18:06 -07006613 @Override
6614 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6615 throws RemoteException {
6616 Parcel data = Parcel.obtain();
6617 Parcel reply = Parcel.obtain();
6618 data.writeInterfaceToken(IActivityManager.descriptor);
6619 data.writeString(process);
6620 data.writeInt(userId);
6621 data.writeInt(level);
6622 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6623 reply.readException();
6624 int res = reply.readInt();
6625 data.recycle();
6626 reply.recycle();
6627 return res != 0;
6628 }
6629
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006630 @Override
6631 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6632 Parcel data = Parcel.obtain();
6633 Parcel reply = Parcel.obtain();
6634 data.writeInterfaceToken(IActivityManager.descriptor);
6635 data.writeStrongBinder(token);
6636 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6637 reply.readException();
6638 int res = reply.readInt();
6639 data.recycle();
6640 reply.recycle();
6641 return res != 0;
6642 }
6643
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006644 @Override
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006645 public void exitFreeformMode(IBinder token) throws RemoteException {
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006646 Parcel data = Parcel.obtain();
6647 Parcel reply = Parcel.obtain();
6648 data.writeInterfaceToken(IActivityManager.descriptor);
6649 data.writeStrongBinder(token);
Filip Gruszczynski411c06f2016-01-07 09:44:44 -08006650 mRemote.transact(EXIT_FREEFORM_MODE_TRANSACTION, data, reply, 0);
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006651 reply.readException();
6652 data.recycle();
6653 reply.recycle();
6654 }
6655
6656 @Override
6657 public int getActivityStackId(IBinder token) throws RemoteException {
6658 Parcel data = Parcel.obtain();
6659 Parcel reply = Parcel.obtain();
6660 data.writeInterfaceToken(IActivityManager.descriptor);
6661 data.writeStrongBinder(token);
6662 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6663 reply.readException();
6664 int stackId = reply.readInt();
6665 data.recycle();
6666 reply.recycle();
6667 return stackId;
6668 }
6669
Filip Gruszczynski23493322015-07-29 17:02:59 -07006670 @Override
6671 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006672 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6673 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006674 Parcel data = Parcel.obtain();
6675 Parcel reply = Parcel.obtain();
6676 data.writeInterfaceToken(IActivityManager.descriptor);
6677 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006678 writeIntArray(horizontalSizeConfiguration, data);
6679 writeIntArray(verticalSizeConfigurations, data);
6680 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006681 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6682 reply.readException();
6683 data.recycle();
6684 reply.recycle();
6685 }
6686
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006687 private static void writeIntArray(int[] array, Parcel data) {
6688 if (array == null) {
6689 data.writeInt(0);
6690 } else {
6691 data.writeInt(array.length);
6692 data.writeIntArray(array);
6693 }
6694 }
6695
Wale Ogunwale83301a92015-09-24 15:54:08 -07006696 @Override
6697 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6698 Parcel data = Parcel.obtain();
6699 Parcel reply = Parcel.obtain();
6700 data.writeInterfaceToken(IActivityManager.descriptor);
6701 data.writeInt(suppress ? 1 : 0);
6702 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6703 reply.readException();
6704 data.recycle();
6705 reply.recycle();
6706 }
6707
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006708 @Override
Wale Ogunwale9101d262016-01-15 08:56:11 -08006709 public void moveTasksToFullscreenStack(int fromStackId, boolean onTop) throws RemoteException {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006710 Parcel data = Parcel.obtain();
6711 Parcel reply = Parcel.obtain();
6712 data.writeInterfaceToken(IActivityManager.descriptor);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006713 data.writeInt(fromStackId);
Wale Ogunwale9101d262016-01-15 08:56:11 -08006714 data.writeInt(onTop ? 1 : 0);
Filip Gruszczynskib3da8342015-12-10 16:40:01 -08006715 mRemote.transact(MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006716 reply.readException();
6717 data.recycle();
6718 reply.recycle();
6719 }
6720
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006721 @Override
6722 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6723 Parcel data = Parcel.obtain();
6724 Parcel reply = Parcel.obtain();
6725 data.writeInterfaceToken(IActivityManager.descriptor);
6726 data.writeInt(uid);
6727 data.writeString(packageName);
6728 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6729 reply.readException();
6730 int res = reply.readInt();
6731 data.recycle();
6732 reply.recycle();
6733 return res;
6734 }
6735
Wale Ogunwale5f986092015-12-04 15:35:38 -08006736 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006737 public boolean inMultiWindow(IBinder token) throws RemoteException {
Wale Ogunwale5f986092015-12-04 15:35:38 -08006738 Parcel data = Parcel.obtain();
6739 Parcel reply = Parcel.obtain();
6740 data.writeInterfaceToken(IActivityManager.descriptor);
6741 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006742 mRemote.transact(IN_MULTI_WINDOW_TRANSACTION, data, reply, 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08006743 reply.readException();
6744 final boolean multiWindowMode = reply.readInt() == 1 ? true : false;
6745 data.recycle();
6746 reply.recycle();
6747 return multiWindowMode;
6748 }
6749
6750 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006751 public boolean inPictureInPicture(IBinder token) throws RemoteException {
Wale Ogunwale5f986092015-12-04 15:35:38 -08006752 Parcel data = Parcel.obtain();
6753 Parcel reply = Parcel.obtain();
6754 data.writeInterfaceToken(IActivityManager.descriptor);
6755 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006756 mRemote.transact(IN_PICTURE_IN_PICTURE_TRANSACTION, data, reply, 0);
Wale Ogunwale5f986092015-12-04 15:35:38 -08006757 reply.readException();
6758 final boolean pipMode = reply.readInt() == 1 ? true : false;
6759 data.recycle();
6760 reply.recycle();
6761 return pipMode;
6762 }
6763
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006764 @Override
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006765 public void enterPictureInPicture(IBinder token) throws RemoteException {
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006766 Parcel data = Parcel.obtain();
6767 Parcel reply = Parcel.obtain();
6768 data.writeInterfaceToken(IActivityManager.descriptor);
6769 data.writeStrongBinder(token);
Wale Ogunwale3b93a4d2016-01-29 17:46:53 -08006770 mRemote.transact(ENTER_PICTURE_IN_PICTURE_TRANSACTION, data, reply, 0);
Wale Ogunwale9c604c72015-12-06 18:42:57 -08006771 reply.readException();
6772 data.recycle();
6773 reply.recycle();
6774 }
6775
Christopher Tate63fec3e2015-12-11 18:35:28 -08006776 @Override
6777 public boolean isAppForeground(int uid) throws RemoteException {
6778 Parcel data = Parcel.obtain();
6779 Parcel reply = Parcel.obtain();
6780 data.writeInterfaceToken(IActivityManager.descriptor);
6781 data.writeInt(uid);
6782 mRemote.transact(IS_APP_FOREGROUND_TRANSACTION, data, reply, 0);
6783 final boolean isForeground = reply.readInt() == 1 ? true : false;
6784 data.recycle();
6785 reply.recycle();
6786 return isForeground;
6787 };
6788
Wale Ogunwale480dca02016-02-06 13:58:29 -08006789 @Override
6790 public void notifyPinnedStackAnimationEnded() throws RemoteException {
6791 Parcel data = Parcel.obtain();
6792 Parcel reply = Parcel.obtain();
6793 data.writeInterfaceToken(IActivityManager.descriptor);
6794 mRemote.transact(NOTIFY_PINNED_STACK_ANIMATION_ENDED_TRANSACTION, data, reply, 0);
6795 data.recycle();
6796 reply.recycle();
6797 };
6798
Wale Ogunwale06e8ee02016-02-12 12:56:32 -08006799 @Override
6800 public void removeStack(int stackId) throws RemoteException {
6801 Parcel data = Parcel.obtain();
6802 Parcel reply = Parcel.obtain();
6803 data.writeInterfaceToken(IActivityManager.descriptor);
6804 data.writeInt(stackId);
6805 mRemote.transact(REMOVE_STACK, data, reply, 0);
6806 reply.readException();
6807 data.recycle();
6808 reply.recycle();
6809 }
6810
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006811 private IBinder mRemote;
6812}