blob: 4449e4fa8665c118093ae5ffec7fb2e54b9d43fd [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
Dianne Hackborn69c6adc2015-06-02 10:52:59 -070020import android.app.assist.AssistContent;
21import android.app.assist.AssistStructure;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070023import android.content.IIntentReceiver;
24import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.content.Intent;
26import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070027import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070028import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070029import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.pm.ConfigurationInfo;
31import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070032import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070033import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070035import android.graphics.Bitmap;
36import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080037import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.net.Uri;
39import android.os.Binder;
40import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070041import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.os.IBinder;
43import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.ParcelFileDescriptor;
45import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070046import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070047import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070049import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070050import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080053import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070054import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080055import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057import java.util.ArrayList;
58import java.util.List;
59
60/** {@hide} */
61public abstract class ActivityManagerNative extends Binder implements IActivityManager
62{
63 /**
64 * Cast a Binder object into an activity manager interface, generating
65 * a proxy if needed.
66 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080067 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 if (obj == null) {
69 return null;
70 }
71 IActivityManager in =
72 (IActivityManager)obj.queryLocalInterface(descriptor);
73 if (in != null) {
74 return in;
75 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 return new ActivityManagerProxy(obj);
78 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 /**
81 * Retrieve the system's default/global activity manager.
82 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080083 static public IActivityManager getDefault() {
84 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 }
86
87 /**
88 * Convenience for checking whether the system is ready. For internal use only.
89 */
90 static public boolean isSystemReady() {
91 if (!sSystemReady) {
92 sSystemReady = getDefault().testIsSystemReady();
93 }
94 return sSystemReady;
95 }
96 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080097
Svet Ganov16a16892015-04-16 10:32:04 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
99 broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId);
100 }
101
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 /**
103 * Convenience for sending a sticky broadcast. For internal use only.
104 * If you don't care about permission, use null.
105 */
Svet Ganov16a16892015-04-16 10:32:04 -0700106 static public void broadcastStickyIntent(Intent intent, String permission, int appOp,
107 int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
109 getDefault().broadcastIntent(
Filip Gruszczynski23493322015-07-29 17:02:59 -0700110 null, intent, null, null, Activity.RESULT_OK, null, null,
111 null /*permission*/, appOp, null, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Dianne Hackborn1e383822015-04-10 14:02:33 -0700116 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
117 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700119 getDefault().noteWakeupAlarm((ps != null) ? ps.getTarget() : null,
120 sourceUid, sourcePkg, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700121 } catch (RemoteException ex) {
122 }
123 }
124
125 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
126 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700127 getDefault().noteAlarmStart((ps != null) ? ps.getTarget() : null, sourceUid, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700128 } catch (RemoteException ex) {
129 }
130 }
131
132 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
133 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700134 getDefault().noteAlarmFinish((ps != null) ? ps.getTarget() : null, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135 } catch (RemoteException ex) {
136 }
137 }
138
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800139 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800140 attachInterface(this, descriptor);
141 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700142
143 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
145 throws RemoteException {
146 switch (code) {
147 case START_ACTIVITY_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800155 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800156 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700158 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700159 ProfilerInfo profilerInfo = data.readInt() != 0
160 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800163 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700164 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165 reply.writeNoException();
166 reply.writeInt(result);
167 return true;
168 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700169
Amith Yamasani82644082012-08-03 13:09:11 -0700170 case START_ACTIVITY_AS_USER_TRANSACTION:
171 {
172 data.enforceInterface(IActivityManager.descriptor);
173 IBinder b = data.readStrongBinder();
174 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800175 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700176 Intent intent = Intent.CREATOR.createFromParcel(data);
177 String resolvedType = data.readString();
178 IBinder resultTo = data.readStrongBinder();
179 String resultWho = data.readString();
180 int requestCode = data.readInt();
181 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700182 ProfilerInfo profilerInfo = data.readInt() != 0
183 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700184 Bundle options = data.readInt() != 0
185 ? Bundle.CREATOR.createFromParcel(data) : null;
186 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800187 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700188 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700189 reply.writeNoException();
190 reply.writeInt(result);
191 return true;
192 }
193
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700194 case START_ACTIVITY_AS_CALLER_TRANSACTION:
195 {
196 data.enforceInterface(IActivityManager.descriptor);
197 IBinder b = data.readStrongBinder();
198 IApplicationThread app = ApplicationThreadNative.asInterface(b);
199 String callingPackage = data.readString();
200 Intent intent = Intent.CREATOR.createFromParcel(data);
201 String resolvedType = data.readString();
202 IBinder resultTo = data.readStrongBinder();
203 String resultWho = data.readString();
204 int requestCode = data.readInt();
205 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700206 ProfilerInfo profilerInfo = data.readInt() != 0
207 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700208 Bundle options = data.readInt() != 0
209 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700210 boolean ignoreTargetSecurity = data.readInt() != 0;
Jeff Sharkey97978802014-10-14 10:48:18 -0700211 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700212 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700213 resultTo, resultWho, requestCode, startFlags, profilerInfo, options,
214 ignoreTargetSecurity, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700215 reply.writeNoException();
216 reply.writeInt(result);
217 return true;
218 }
219
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800220 case START_ACTIVITY_AND_WAIT_TRANSACTION:
221 {
222 data.enforceInterface(IActivityManager.descriptor);
223 IBinder b = data.readStrongBinder();
224 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800225 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800226 Intent intent = Intent.CREATOR.createFromParcel(data);
227 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800228 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800229 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800230 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700232 ProfilerInfo profilerInfo = data.readInt() != 0
233 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700234 Bundle options = data.readInt() != 0
235 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700236 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800237 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700238 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800239 reply.writeNoException();
240 result.writeToParcel(reply, 0);
241 return true;
242 }
243
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700244 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
245 {
246 data.enforceInterface(IActivityManager.descriptor);
247 IBinder b = data.readStrongBinder();
248 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800249 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700250 Intent intent = Intent.CREATOR.createFromParcel(data);
251 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700252 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700253 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700254 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700255 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700256 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700257 Bundle options = data.readInt() != 0
258 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700259 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800260 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700261 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700262 reply.writeNoException();
263 reply.writeInt(result);
264 return true;
265 }
266
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700267 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700268 {
269 data.enforceInterface(IActivityManager.descriptor);
270 IBinder b = data.readStrongBinder();
271 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700272 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700273 Intent fillInIntent = null;
274 if (data.readInt() != 0) {
275 fillInIntent = Intent.CREATOR.createFromParcel(data);
276 }
277 String resolvedType = data.readString();
278 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700279 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700280 int requestCode = data.readInt();
281 int flagsMask = data.readInt();
282 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700283 Bundle options = data.readInt() != 0
284 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700285 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700286 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700287 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700288 reply.writeNoException();
289 reply.writeInt(result);
290 return true;
291 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700292
Dianne Hackborn91097de2014-04-04 18:02:06 -0700293 case START_VOICE_ACTIVITY_TRANSACTION:
294 {
295 data.enforceInterface(IActivityManager.descriptor);
296 String callingPackage = data.readString();
297 int callingPid = data.readInt();
298 int callingUid = data.readInt();
299 Intent intent = Intent.CREATOR.createFromParcel(data);
300 String resolvedType = data.readString();
301 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
302 data.readStrongBinder());
303 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
304 data.readStrongBinder());
305 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700306 ProfilerInfo profilerInfo = data.readInt() != 0
307 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700308 Bundle options = data.readInt() != 0
309 ? Bundle.CREATOR.createFromParcel(data) : null;
310 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700311 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
312 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700313 reply.writeNoException();
314 reply.writeInt(result);
315 return true;
316 }
317
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800318 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
319 {
320 data.enforceInterface(IActivityManager.descriptor);
321 IBinder callingActivity = data.readStrongBinder();
322 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700323 Bundle options = data.readInt() != 0
324 ? Bundle.CREATOR.createFromParcel(data) : null;
325 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 reply.writeNoException();
327 reply.writeInt(result ? 1 : 0);
328 return true;
329 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700330
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700331 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
332 {
333 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700334 final int taskId = data.readInt();
335 final int launchStackId = data.readInt();
336 final Bundle options =
337 data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
338 final int result = startActivityFromRecents(taskId, launchStackId, options);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700339 reply.writeNoException();
340 reply.writeInt(result);
341 return true;
342 }
343
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800344 case FINISH_ACTIVITY_TRANSACTION: {
345 data.enforceInterface(IActivityManager.descriptor);
346 IBinder token = data.readStrongBinder();
347 Intent resultData = null;
348 int resultCode = data.readInt();
349 if (data.readInt() != 0) {
350 resultData = Intent.CREATOR.createFromParcel(data);
351 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700352 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700353 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 reply.writeNoException();
355 reply.writeInt(res ? 1 : 0);
356 return true;
357 }
358
359 case FINISH_SUB_ACTIVITY_TRANSACTION: {
360 data.enforceInterface(IActivityManager.descriptor);
361 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700362 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 int requestCode = data.readInt();
364 finishSubActivity(token, resultWho, requestCode);
365 reply.writeNoException();
366 return true;
367 }
368
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700369 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
370 data.enforceInterface(IActivityManager.descriptor);
371 IBinder token = data.readStrongBinder();
372 boolean res = finishActivityAffinity(token);
373 reply.writeNoException();
374 reply.writeInt(res ? 1 : 0);
375 return true;
376 }
377
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700378 case FINISH_VOICE_TASK_TRANSACTION: {
379 data.enforceInterface(IActivityManager.descriptor);
380 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
381 data.readStrongBinder());
382 finishVoiceTask(session);
383 reply.writeNoException();
384 return true;
385 }
386
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700387 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
388 data.enforceInterface(IActivityManager.descriptor);
389 IBinder token = data.readStrongBinder();
390 boolean res = releaseActivityInstance(token);
391 reply.writeNoException();
392 reply.writeInt(res ? 1 : 0);
393 return true;
394 }
395
396 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
397 data.enforceInterface(IActivityManager.descriptor);
398 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
399 releaseSomeActivities(app);
400 reply.writeNoException();
401 return true;
402 }
403
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800404 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
405 data.enforceInterface(IActivityManager.descriptor);
406 IBinder token = data.readStrongBinder();
407 boolean res = willActivityBeVisible(token);
408 reply.writeNoException();
409 reply.writeInt(res ? 1 : 0);
410 return true;
411 }
412
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800413 case REGISTER_RECEIVER_TRANSACTION:
414 {
415 data.enforceInterface(IActivityManager.descriptor);
416 IBinder b = data.readStrongBinder();
417 IApplicationThread app =
418 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700419 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800420 b = data.readStrongBinder();
421 IIntentReceiver rec
422 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
423 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
424 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700425 int userId = data.readInt();
426 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 reply.writeNoException();
428 if (intent != null) {
429 reply.writeInt(1);
430 intent.writeToParcel(reply, 0);
431 } else {
432 reply.writeInt(0);
433 }
434 return true;
435 }
436
437 case UNREGISTER_RECEIVER_TRANSACTION:
438 {
439 data.enforceInterface(IActivityManager.descriptor);
440 IBinder b = data.readStrongBinder();
441 if (b == null) {
442 return true;
443 }
444 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
445 unregisterReceiver(rec);
446 reply.writeNoException();
447 return true;
448 }
449
450 case BROADCAST_INTENT_TRANSACTION:
451 {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder b = data.readStrongBinder();
454 IApplicationThread app =
455 b != null ? ApplicationThreadNative.asInterface(b) : null;
456 Intent intent = Intent.CREATOR.createFromParcel(data);
457 String resolvedType = data.readString();
458 b = data.readStrongBinder();
459 IIntentReceiver resultTo =
460 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
461 int resultCode = data.readInt();
462 String resultData = data.readString();
463 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700464 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800465 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700466 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 boolean serialized = data.readInt() != 0;
468 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700469 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700471 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700472 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800473 reply.writeNoException();
474 reply.writeInt(res);
475 return true;
476 }
477
478 case UNBROADCAST_INTENT_TRANSACTION:
479 {
480 data.enforceInterface(IActivityManager.descriptor);
481 IBinder b = data.readStrongBinder();
482 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
483 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700484 int userId = data.readInt();
485 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800486 reply.writeNoException();
487 return true;
488 }
489
490 case FINISH_RECEIVER_TRANSACTION: {
491 data.enforceInterface(IActivityManager.descriptor);
492 IBinder who = data.readStrongBinder();
493 int resultCode = data.readInt();
494 String resultData = data.readString();
495 Bundle resultExtras = data.readBundle();
496 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800497 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800498 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800499 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 }
501 reply.writeNoException();
502 return true;
503 }
504
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 case ATTACH_APPLICATION_TRANSACTION: {
506 data.enforceInterface(IActivityManager.descriptor);
507 IApplicationThread app = ApplicationThreadNative.asInterface(
508 data.readStrongBinder());
509 if (app != null) {
510 attachApplication(app);
511 }
512 reply.writeNoException();
513 return true;
514 }
515
516 case ACTIVITY_IDLE_TRANSACTION: {
517 data.enforceInterface(IActivityManager.descriptor);
518 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700519 Configuration config = null;
520 if (data.readInt() != 0) {
521 config = Configuration.CREATOR.createFromParcel(data);
522 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700523 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800524 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700525 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 }
527 reply.writeNoException();
528 return true;
529 }
530
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700531 case ACTIVITY_RESUMED_TRANSACTION: {
532 data.enforceInterface(IActivityManager.descriptor);
533 IBinder token = data.readStrongBinder();
534 activityResumed(token);
535 reply.writeNoException();
536 return true;
537 }
538
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800539 case ACTIVITY_PAUSED_TRANSACTION: {
540 data.enforceInterface(IActivityManager.descriptor);
541 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700542 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800543 reply.writeNoException();
544 return true;
545 }
546
547 case ACTIVITY_STOPPED_TRANSACTION: {
548 data.enforceInterface(IActivityManager.descriptor);
549 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800550 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700551 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800552 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700553 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554 reply.writeNoException();
555 return true;
556 }
557
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800558 case ACTIVITY_SLEPT_TRANSACTION: {
559 data.enforceInterface(IActivityManager.descriptor);
560 IBinder token = data.readStrongBinder();
561 activitySlept(token);
562 reply.writeNoException();
563 return true;
564 }
565
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800566 case ACTIVITY_DESTROYED_TRANSACTION: {
567 data.enforceInterface(IActivityManager.descriptor);
568 IBinder token = data.readStrongBinder();
569 activityDestroyed(token);
570 reply.writeNoException();
571 return true;
572 }
573
574 case GET_CALLING_PACKAGE_TRANSACTION: {
575 data.enforceInterface(IActivityManager.descriptor);
576 IBinder token = data.readStrongBinder();
577 String res = token != null ? getCallingPackage(token) : null;
578 reply.writeNoException();
579 reply.writeString(res);
580 return true;
581 }
582
583 case GET_CALLING_ACTIVITY_TRANSACTION: {
584 data.enforceInterface(IActivityManager.descriptor);
585 IBinder token = data.readStrongBinder();
586 ComponentName cn = getCallingActivity(token);
587 reply.writeNoException();
588 ComponentName.writeToParcel(cn, reply);
589 return true;
590 }
591
Winson Chung1147c402014-05-14 11:05:00 -0700592 case GET_APP_TASKS_TRANSACTION: {
593 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700594 String callingPackage = data.readString();
595 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700596 reply.writeNoException();
597 int N = list != null ? list.size() : -1;
598 reply.writeInt(N);
599 int i;
600 for (i=0; i<N; i++) {
601 IAppTask task = list.get(i);
602 reply.writeStrongBinder(task.asBinder());
603 }
604 return true;
605 }
606
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700607 case ADD_APP_TASK_TRANSACTION: {
608 data.enforceInterface(IActivityManager.descriptor);
609 IBinder activityToken = data.readStrongBinder();
610 Intent intent = Intent.CREATOR.createFromParcel(data);
611 ActivityManager.TaskDescription descr
612 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
613 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
614 int res = addAppTask(activityToken, intent, descr, thumbnail);
615 reply.writeNoException();
616 reply.writeInt(res);
617 return true;
618 }
619
620 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
621 data.enforceInterface(IActivityManager.descriptor);
622 Point size = getAppTaskThumbnailSize();
623 reply.writeNoException();
624 size.writeToParcel(reply, 0);
625 return true;
626 }
627
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800628 case GET_TASKS_TRANSACTION: {
629 data.enforceInterface(IActivityManager.descriptor);
630 int maxNum = data.readInt();
631 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700632 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800633 reply.writeNoException();
634 int N = list != null ? list.size() : -1;
635 reply.writeInt(N);
636 int i;
637 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700638 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800639 info.writeToParcel(reply, 0);
640 }
641 return true;
642 }
643
644 case GET_RECENT_TASKS_TRANSACTION: {
645 data.enforceInterface(IActivityManager.descriptor);
646 int maxNum = data.readInt();
647 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700648 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800649 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700650 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800651 reply.writeNoException();
652 reply.writeTypedList(list);
653 return true;
654 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700655
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700656 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800657 data.enforceInterface(IActivityManager.descriptor);
658 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700659 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800660 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700661 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800662 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700663 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700664 } else {
665 reply.writeInt(0);
666 }
667 return true;
668 }
669
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 case GET_SERVICES_TRANSACTION: {
671 data.enforceInterface(IActivityManager.descriptor);
672 int maxNum = data.readInt();
673 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700674 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800675 reply.writeNoException();
676 int N = list != null ? list.size() : -1;
677 reply.writeInt(N);
678 int i;
679 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700680 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800681 info.writeToParcel(reply, 0);
682 }
683 return true;
684 }
685
686 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
687 data.enforceInterface(IActivityManager.descriptor);
688 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
689 reply.writeNoException();
690 reply.writeTypedList(list);
691 return true;
692 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700693
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800694 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
695 data.enforceInterface(IActivityManager.descriptor);
696 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
697 reply.writeNoException();
698 reply.writeTypedList(list);
699 return true;
700 }
701
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700702 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
703 data.enforceInterface(IActivityManager.descriptor);
704 List<ApplicationInfo> list = getRunningExternalApplications();
705 reply.writeNoException();
706 reply.writeTypedList(list);
707 return true;
708 }
709
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 case MOVE_TASK_TO_FRONT_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800713 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700714 Bundle options = data.readInt() != 0
715 ? Bundle.CREATOR.createFromParcel(data) : null;
716 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800717 reply.writeNoException();
718 return true;
719 }
720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 IBinder token = data.readStrongBinder();
724 boolean nonRoot = data.readInt() != 0;
725 boolean res = moveActivityTaskToBack(token, nonRoot);
726 reply.writeNoException();
727 reply.writeInt(res ? 1 : 0);
728 return true;
729 }
730
731 case MOVE_TASK_BACKWARDS_TRANSACTION: {
732 data.enforceInterface(IActivityManager.descriptor);
733 int task = data.readInt();
734 moveTaskBackwards(task);
735 reply.writeNoException();
736 return true;
737 }
738
Craig Mautnerc00204b2013-03-05 15:02:14 -0800739 case MOVE_TASK_TO_STACK_TRANSACTION: {
740 data.enforceInterface(IActivityManager.descriptor);
741 int taskId = data.readInt();
742 int stackId = data.readInt();
743 boolean toTop = data.readInt() != 0;
744 moveTaskToStack(taskId, stackId, toTop);
745 reply.writeNoException();
746 return true;
747 }
748
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700749 case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: {
750 data.enforceInterface(IActivityManager.descriptor);
751 int taskId = data.readInt();
752 int createMode = data.readInt();
753 boolean toTop = data.readInt() != 0;
754 moveTaskToDockedStack(taskId, createMode, toTop);
755 reply.writeNoException();
756 return true;
757 }
758
Wale Ogunwale079a0042015-10-24 11:44:07 -0700759 case MOVE_TOP_ACTIVITY_TO_PINNED_STACK: {
760 data.enforceInterface(IActivityManager.descriptor);
761 final int stackId = data.readInt();
762 final Rect r = Rect.CREATOR.createFromParcel(data);
763 final boolean res = moveTopActivityToPinnedStack(stackId, r);
764 reply.writeNoException();
765 reply.writeInt(res ? 1 : 0);
766 return true;
767 }
768
Craig Mautnerc00204b2013-03-05 15:02:14 -0800769 case RESIZE_STACK_TRANSACTION: {
770 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700771 final int stackId = data.readInt();
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100772 final boolean hasRect = data.readInt() != 0;
773 Rect r = null;
774 if (hasRect) {
775 r = Rect.CREATOR.createFromParcel(data);
776 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700777 final boolean allowResizeInDockedMode = data.readInt() == 1;
778 resizeStack(stackId, r, allowResizeInDockedMode);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800779 reply.writeNoException();
780 return true;
781 }
782
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700783 case POSITION_TASK_IN_STACK_TRANSACTION: {
784 data.enforceInterface(IActivityManager.descriptor);
785 int taskId = data.readInt();
786 int stackId = data.readInt();
787 int position = data.readInt();
788 positionTaskInStack(taskId, stackId, position);
789 reply.writeNoException();
790 return true;
791 }
792
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800793 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700794 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800795 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700796 reply.writeNoException();
797 reply.writeTypedList(list);
798 return true;
799 }
800
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800801 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700802 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800803 int stackId = data.readInt();
804 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700805 reply.writeNoException();
806 if (info != null) {
807 reply.writeInt(1);
808 info.writeToParcel(reply, 0);
809 } else {
810 reply.writeInt(0);
811 }
812 return true;
813 }
814
Winson Chung303e1ff2014-03-07 15:06:19 -0800815 case IS_IN_HOME_STACK_TRANSACTION: {
816 data.enforceInterface(IActivityManager.descriptor);
817 int taskId = data.readInt();
818 boolean isInHomeStack = isInHomeStack(taskId);
819 reply.writeNoException();
820 reply.writeInt(isInHomeStack ? 1 : 0);
821 return true;
822 }
823
Craig Mautnercf910b02013-04-23 11:23:27 -0700824 case SET_FOCUSED_STACK_TRANSACTION: {
825 data.enforceInterface(IActivityManager.descriptor);
826 int stackId = data.readInt();
827 setFocusedStack(stackId);
828 reply.writeNoException();
829 return true;
830 }
831
Winson Chungd16c5652015-01-26 16:11:07 -0800832 case GET_FOCUSED_STACK_ID_TRANSACTION: {
833 data.enforceInterface(IActivityManager.descriptor);
834 int focusedStackId = getFocusedStackId();
835 reply.writeNoException();
836 reply.writeInt(focusedStackId);
837 return true;
838 }
839
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700840 case SET_FOCUSED_TASK_TRANSACTION: {
841 data.enforceInterface(IActivityManager.descriptor);
842 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700843 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700844 reply.writeNoException();
845 return true;
846 }
847
Winson Chung740c3ac2014-11-12 16:14:38 -0800848 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
849 data.enforceInterface(IActivityManager.descriptor);
850 IBinder token = data.readStrongBinder();
851 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
852 reply.writeNoException();
853 return true;
854 }
855
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800856 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
857 data.enforceInterface(IActivityManager.descriptor);
858 IBinder token = data.readStrongBinder();
859 boolean onlyRoot = data.readInt() != 0;
860 int res = token != null
861 ? getTaskForActivity(token, onlyRoot) : -1;
862 reply.writeNoException();
863 reply.writeInt(res);
864 return true;
865 }
866
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800867 case GET_CONTENT_PROVIDER_TRANSACTION: {
868 data.enforceInterface(IActivityManager.descriptor);
869 IBinder b = data.readStrongBinder();
870 IApplicationThread app = ApplicationThreadNative.asInterface(b);
871 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700872 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700873 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700874 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800875 reply.writeNoException();
876 if (cph != null) {
877 reply.writeInt(1);
878 cph.writeToParcel(reply, 0);
879 } else {
880 reply.writeInt(0);
881 }
882 return true;
883 }
884
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800885 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
886 data.enforceInterface(IActivityManager.descriptor);
887 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700888 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800889 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700890 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800891 reply.writeNoException();
892 if (cph != null) {
893 reply.writeInt(1);
894 cph.writeToParcel(reply, 0);
895 } else {
896 reply.writeInt(0);
897 }
898 return true;
899 }
900
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800901 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
902 data.enforceInterface(IActivityManager.descriptor);
903 IBinder b = data.readStrongBinder();
904 IApplicationThread app = ApplicationThreadNative.asInterface(b);
905 ArrayList<ContentProviderHolder> providers =
906 data.createTypedArrayList(ContentProviderHolder.CREATOR);
907 publishContentProviders(app, providers);
908 reply.writeNoException();
909 return true;
910 }
911
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700912 case REF_CONTENT_PROVIDER_TRANSACTION: {
913 data.enforceInterface(IActivityManager.descriptor);
914 IBinder b = data.readStrongBinder();
915 int stable = data.readInt();
916 int unstable = data.readInt();
917 boolean res = refContentProvider(b, stable, unstable);
918 reply.writeNoException();
919 reply.writeInt(res ? 1 : 0);
920 return true;
921 }
922
923 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
924 data.enforceInterface(IActivityManager.descriptor);
925 IBinder b = data.readStrongBinder();
926 unstableProviderDied(b);
927 reply.writeNoException();
928 return true;
929 }
930
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700931 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
932 data.enforceInterface(IActivityManager.descriptor);
933 IBinder b = data.readStrongBinder();
934 appNotRespondingViaProvider(b);
935 reply.writeNoException();
936 return true;
937 }
938
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800939 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
940 data.enforceInterface(IActivityManager.descriptor);
941 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700942 boolean stable = data.readInt() != 0;
943 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800944 reply.writeNoException();
945 return true;
946 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800947
948 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
949 data.enforceInterface(IActivityManager.descriptor);
950 String name = data.readString();
951 IBinder token = data.readStrongBinder();
952 removeContentProviderExternal(name, token);
953 reply.writeNoException();
954 return true;
955 }
956
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700957 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
958 data.enforceInterface(IActivityManager.descriptor);
959 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
960 PendingIntent pi = getRunningServiceControlPanel(comp);
961 reply.writeNoException();
962 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
963 return true;
964 }
965
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800966 case START_SERVICE_TRANSACTION: {
967 data.enforceInterface(IActivityManager.descriptor);
968 IBinder b = data.readStrongBinder();
969 IApplicationThread app = ApplicationThreadNative.asInterface(b);
970 Intent service = Intent.CREATOR.createFromParcel(data);
971 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -0700972 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700973 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700974 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800975 reply.writeNoException();
976 ComponentName.writeToParcel(cn, reply);
977 return true;
978 }
979
980 case STOP_SERVICE_TRANSACTION: {
981 data.enforceInterface(IActivityManager.descriptor);
982 IBinder b = data.readStrongBinder();
983 IApplicationThread app = ApplicationThreadNative.asInterface(b);
984 Intent service = Intent.CREATOR.createFromParcel(data);
985 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700986 int userId = data.readInt();
987 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800988 reply.writeNoException();
989 reply.writeInt(res);
990 return true;
991 }
992
993 case STOP_SERVICE_TOKEN_TRANSACTION: {
994 data.enforceInterface(IActivityManager.descriptor);
995 ComponentName className = ComponentName.readFromParcel(data);
996 IBinder token = data.readStrongBinder();
997 int startId = data.readInt();
998 boolean res = stopServiceToken(className, token, startId);
999 reply.writeNoException();
1000 reply.writeInt(res ? 1 : 0);
1001 return true;
1002 }
1003
1004 case SET_SERVICE_FOREGROUND_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 ComponentName className = ComponentName.readFromParcel(data);
1007 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001008 int id = data.readInt();
1009 Notification notification = null;
1010 if (data.readInt() != 0) {
1011 notification = Notification.CREATOR.createFromParcel(data);
1012 }
1013 boolean removeNotification = data.readInt() != 0;
1014 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001015 reply.writeNoException();
1016 return true;
1017 }
1018
1019 case BIND_SERVICE_TRANSACTION: {
1020 data.enforceInterface(IActivityManager.descriptor);
1021 IBinder b = data.readStrongBinder();
1022 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1023 IBinder token = data.readStrongBinder();
1024 Intent service = Intent.CREATOR.createFromParcel(data);
1025 String resolvedType = data.readString();
1026 b = data.readStrongBinder();
1027 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001028 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001029 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001030 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001031 int res = bindService(app, token, service, resolvedType, conn, fl,
1032 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001033 reply.writeNoException();
1034 reply.writeInt(res);
1035 return true;
1036 }
1037
1038 case UNBIND_SERVICE_TRANSACTION: {
1039 data.enforceInterface(IActivityManager.descriptor);
1040 IBinder b = data.readStrongBinder();
1041 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1042 boolean res = unbindService(conn);
1043 reply.writeNoException();
1044 reply.writeInt(res ? 1 : 0);
1045 return true;
1046 }
1047
1048 case PUBLISH_SERVICE_TRANSACTION: {
1049 data.enforceInterface(IActivityManager.descriptor);
1050 IBinder token = data.readStrongBinder();
1051 Intent intent = Intent.CREATOR.createFromParcel(data);
1052 IBinder service = data.readStrongBinder();
1053 publishService(token, intent, service);
1054 reply.writeNoException();
1055 return true;
1056 }
1057
1058 case UNBIND_FINISHED_TRANSACTION: {
1059 data.enforceInterface(IActivityManager.descriptor);
1060 IBinder token = data.readStrongBinder();
1061 Intent intent = Intent.CREATOR.createFromParcel(data);
1062 boolean doRebind = data.readInt() != 0;
1063 unbindFinished(token, intent, doRebind);
1064 reply.writeNoException();
1065 return true;
1066 }
1067
1068 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1069 data.enforceInterface(IActivityManager.descriptor);
1070 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001071 int type = data.readInt();
1072 int startId = data.readInt();
1073 int res = data.readInt();
1074 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001075 reply.writeNoException();
1076 return true;
1077 }
1078
1079 case START_INSTRUMENTATION_TRANSACTION: {
1080 data.enforceInterface(IActivityManager.descriptor);
1081 ComponentName className = ComponentName.readFromParcel(data);
1082 String profileFile = data.readString();
1083 int fl = data.readInt();
1084 Bundle arguments = data.readBundle();
1085 IBinder b = data.readStrongBinder();
1086 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001087 b = data.readStrongBinder();
1088 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001089 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001090 String abiOverride = data.readString();
1091 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1092 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001093 reply.writeNoException();
1094 reply.writeInt(res ? 1 : 0);
1095 return true;
1096 }
1097
1098
1099 case FINISH_INSTRUMENTATION_TRANSACTION: {
1100 data.enforceInterface(IActivityManager.descriptor);
1101 IBinder b = data.readStrongBinder();
1102 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1103 int resultCode = data.readInt();
1104 Bundle results = data.readBundle();
1105 finishInstrumentation(app, resultCode, results);
1106 reply.writeNoException();
1107 return true;
1108 }
1109
1110 case GET_CONFIGURATION_TRANSACTION: {
1111 data.enforceInterface(IActivityManager.descriptor);
1112 Configuration config = getConfiguration();
1113 reply.writeNoException();
1114 config.writeToParcel(reply, 0);
1115 return true;
1116 }
1117
1118 case UPDATE_CONFIGURATION_TRANSACTION: {
1119 data.enforceInterface(IActivityManager.descriptor);
1120 Configuration config = Configuration.CREATOR.createFromParcel(data);
1121 updateConfiguration(config);
1122 reply.writeNoException();
1123 return true;
1124 }
1125
1126 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1127 data.enforceInterface(IActivityManager.descriptor);
1128 IBinder token = data.readStrongBinder();
1129 int requestedOrientation = data.readInt();
1130 setRequestedOrientation(token, requestedOrientation);
1131 reply.writeNoException();
1132 return true;
1133 }
1134
1135 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1136 data.enforceInterface(IActivityManager.descriptor);
1137 IBinder token = data.readStrongBinder();
1138 int req = getRequestedOrientation(token);
1139 reply.writeNoException();
1140 reply.writeInt(req);
1141 return true;
1142 }
1143
1144 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1145 data.enforceInterface(IActivityManager.descriptor);
1146 IBinder token = data.readStrongBinder();
1147 ComponentName cn = getActivityClassForToken(token);
1148 reply.writeNoException();
1149 ComponentName.writeToParcel(cn, reply);
1150 return true;
1151 }
1152
1153 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1154 data.enforceInterface(IActivityManager.descriptor);
1155 IBinder token = data.readStrongBinder();
1156 reply.writeNoException();
1157 reply.writeString(getPackageForToken(token));
1158 return true;
1159 }
1160
1161 case GET_INTENT_SENDER_TRANSACTION: {
1162 data.enforceInterface(IActivityManager.descriptor);
1163 int type = data.readInt();
1164 String packageName = data.readString();
1165 IBinder token = data.readStrongBinder();
1166 String resultWho = data.readString();
1167 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001168 Intent[] requestIntents;
1169 String[] requestResolvedTypes;
1170 if (data.readInt() != 0) {
1171 requestIntents = data.createTypedArray(Intent.CREATOR);
1172 requestResolvedTypes = data.createStringArray();
1173 } else {
1174 requestIntents = null;
1175 requestResolvedTypes = null;
1176 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001177 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001178 Bundle options = data.readInt() != 0
1179 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001180 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001181 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001182 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001183 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001184 reply.writeNoException();
1185 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1186 return true;
1187 }
1188
1189 case CANCEL_INTENT_SENDER_TRANSACTION: {
1190 data.enforceInterface(IActivityManager.descriptor);
1191 IIntentSender r = IIntentSender.Stub.asInterface(
1192 data.readStrongBinder());
1193 cancelIntentSender(r);
1194 reply.writeNoException();
1195 return true;
1196 }
1197
1198 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1199 data.enforceInterface(IActivityManager.descriptor);
1200 IIntentSender r = IIntentSender.Stub.asInterface(
1201 data.readStrongBinder());
1202 String res = getPackageForIntentSender(r);
1203 reply.writeNoException();
1204 reply.writeString(res);
1205 return true;
1206 }
1207
Christopher Tatec4a07d12012-04-06 14:19:13 -07001208 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1209 data.enforceInterface(IActivityManager.descriptor);
1210 IIntentSender r = IIntentSender.Stub.asInterface(
1211 data.readStrongBinder());
1212 int res = getUidForIntentSender(r);
1213 reply.writeNoException();
1214 reply.writeInt(res);
1215 return true;
1216 }
1217
Dianne Hackborn41203752012-08-31 14:05:51 -07001218 case HANDLE_INCOMING_USER_TRANSACTION: {
1219 data.enforceInterface(IActivityManager.descriptor);
1220 int callingPid = data.readInt();
1221 int callingUid = data.readInt();
1222 int userId = data.readInt();
1223 boolean allowAll = data.readInt() != 0 ;
1224 boolean requireFull = data.readInt() != 0;
1225 String name = data.readString();
1226 String callerPackage = data.readString();
1227 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1228 requireFull, name, callerPackage);
1229 reply.writeNoException();
1230 reply.writeInt(res);
1231 return true;
1232 }
1233
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001234 case SET_PROCESS_LIMIT_TRANSACTION: {
1235 data.enforceInterface(IActivityManager.descriptor);
1236 int max = data.readInt();
1237 setProcessLimit(max);
1238 reply.writeNoException();
1239 return true;
1240 }
1241
1242 case GET_PROCESS_LIMIT_TRANSACTION: {
1243 data.enforceInterface(IActivityManager.descriptor);
1244 int limit = getProcessLimit();
1245 reply.writeNoException();
1246 reply.writeInt(limit);
1247 return true;
1248 }
1249
1250 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1251 data.enforceInterface(IActivityManager.descriptor);
1252 IBinder token = data.readStrongBinder();
1253 int pid = data.readInt();
1254 boolean isForeground = data.readInt() != 0;
1255 setProcessForeground(token, pid, isForeground);
1256 reply.writeNoException();
1257 return true;
1258 }
1259
1260 case CHECK_PERMISSION_TRANSACTION: {
1261 data.enforceInterface(IActivityManager.descriptor);
1262 String perm = data.readString();
1263 int pid = data.readInt();
1264 int uid = data.readInt();
1265 int res = checkPermission(perm, pid, uid);
1266 reply.writeNoException();
1267 reply.writeInt(res);
1268 return true;
1269 }
1270
Dianne Hackbornff170242014-11-19 10:59:01 -08001271 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1272 data.enforceInterface(IActivityManager.descriptor);
1273 String perm = data.readString();
1274 int pid = data.readInt();
1275 int uid = data.readInt();
1276 IBinder token = data.readStrongBinder();
1277 int res = checkPermissionWithToken(perm, pid, uid, token);
1278 reply.writeNoException();
1279 reply.writeInt(res);
1280 return true;
1281 }
1282
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001283 case CHECK_URI_PERMISSION_TRANSACTION: {
1284 data.enforceInterface(IActivityManager.descriptor);
1285 Uri uri = Uri.CREATOR.createFromParcel(data);
1286 int pid = data.readInt();
1287 int uid = data.readInt();
1288 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001289 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001290 IBinder callerToken = data.readStrongBinder();
1291 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001292 reply.writeNoException();
1293 reply.writeInt(res);
1294 return true;
1295 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001296
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001297 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001298 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001299 String packageName = data.readString();
1300 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1301 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001302 int userId = data.readInt();
1303 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001304 reply.writeNoException();
1305 reply.writeInt(res ? 1 : 0);
1306 return true;
1307 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001308
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001309 case GRANT_URI_PERMISSION_TRANSACTION: {
1310 data.enforceInterface(IActivityManager.descriptor);
1311 IBinder b = data.readStrongBinder();
1312 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1313 String targetPkg = data.readString();
1314 Uri uri = Uri.CREATOR.createFromParcel(data);
1315 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001316 int userId = data.readInt();
1317 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001318 reply.writeNoException();
1319 return true;
1320 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001321
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001322 case REVOKE_URI_PERMISSION_TRANSACTION: {
1323 data.enforceInterface(IActivityManager.descriptor);
1324 IBinder b = data.readStrongBinder();
1325 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1326 Uri uri = Uri.CREATOR.createFromParcel(data);
1327 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001328 int userId = data.readInt();
1329 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001330 reply.writeNoException();
1331 return true;
1332 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001333
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001334 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1335 data.enforceInterface(IActivityManager.descriptor);
1336 Uri uri = Uri.CREATOR.createFromParcel(data);
1337 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001338 int userId = data.readInt();
1339 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001340 reply.writeNoException();
1341 return true;
1342 }
1343
1344 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1345 data.enforceInterface(IActivityManager.descriptor);
1346 Uri uri = Uri.CREATOR.createFromParcel(data);
1347 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001348 int userId = data.readInt();
1349 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001350 reply.writeNoException();
1351 return true;
1352 }
1353
1354 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1355 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001356 final String packageName = data.readString();
1357 final boolean incoming = data.readInt() != 0;
1358 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1359 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001360 reply.writeNoException();
1361 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1362 return true;
1363 }
1364
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001365 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1366 data.enforceInterface(IActivityManager.descriptor);
1367 IBinder b = data.readStrongBinder();
1368 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1369 boolean waiting = data.readInt() != 0;
1370 showWaitingForDebugger(app, waiting);
1371 reply.writeNoException();
1372 return true;
1373 }
1374
1375 case GET_MEMORY_INFO_TRANSACTION: {
1376 data.enforceInterface(IActivityManager.descriptor);
1377 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1378 getMemoryInfo(mi);
1379 reply.writeNoException();
1380 mi.writeToParcel(reply, 0);
1381 return true;
1382 }
1383
1384 case UNHANDLED_BACK_TRANSACTION: {
1385 data.enforceInterface(IActivityManager.descriptor);
1386 unhandledBack();
1387 reply.writeNoException();
1388 return true;
1389 }
1390
1391 case OPEN_CONTENT_URI_TRANSACTION: {
1392 data.enforceInterface(IActivityManager.descriptor);
1393 Uri uri = Uri.parse(data.readString());
1394 ParcelFileDescriptor pfd = openContentUri(uri);
1395 reply.writeNoException();
1396 if (pfd != null) {
1397 reply.writeInt(1);
1398 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1399 } else {
1400 reply.writeInt(0);
1401 }
1402 return true;
1403 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001404
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001405 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1406 data.enforceInterface(IActivityManager.descriptor);
1407 setLockScreenShown(data.readInt() != 0);
1408 reply.writeNoException();
1409 return true;
1410 }
1411
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001412 case SET_DEBUG_APP_TRANSACTION: {
1413 data.enforceInterface(IActivityManager.descriptor);
1414 String pn = data.readString();
1415 boolean wfd = data.readInt() != 0;
1416 boolean per = data.readInt() != 0;
1417 setDebugApp(pn, wfd, per);
1418 reply.writeNoException();
1419 return true;
1420 }
1421
1422 case SET_ALWAYS_FINISH_TRANSACTION: {
1423 data.enforceInterface(IActivityManager.descriptor);
1424 boolean enabled = data.readInt() != 0;
1425 setAlwaysFinish(enabled);
1426 reply.writeNoException();
1427 return true;
1428 }
1429
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001430 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001431 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001432 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001433 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001434 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001435 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001436 return true;
1437 }
1438
1439 case ENTER_SAFE_MODE_TRANSACTION: {
1440 data.enforceInterface(IActivityManager.descriptor);
1441 enterSafeMode();
1442 reply.writeNoException();
1443 return true;
1444 }
1445
1446 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
1448 IIntentSender is = IIntentSender.Stub.asInterface(
1449 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001450 int sourceUid = data.readInt();
1451 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001452 String tag = data.readString();
1453 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1454 reply.writeNoException();
1455 return true;
1456 }
1457
1458 case NOTE_ALARM_START_TRANSACTION: {
1459 data.enforceInterface(IActivityManager.descriptor);
1460 IIntentSender is = IIntentSender.Stub.asInterface(
1461 data.readStrongBinder());
1462 int sourceUid = data.readInt();
1463 String tag = data.readString();
1464 noteAlarmStart(is, sourceUid, tag);
1465 reply.writeNoException();
1466 return true;
1467 }
1468
1469 case NOTE_ALARM_FINISH_TRANSACTION: {
1470 data.enforceInterface(IActivityManager.descriptor);
1471 IIntentSender is = IIntentSender.Stub.asInterface(
1472 data.readStrongBinder());
1473 int sourceUid = data.readInt();
1474 String tag = data.readString();
1475 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001476 reply.writeNoException();
1477 return true;
1478 }
1479
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001480 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001481 data.enforceInterface(IActivityManager.descriptor);
1482 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001483 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001484 boolean secure = data.readInt() != 0;
1485 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001486 reply.writeNoException();
1487 reply.writeInt(res ? 1 : 0);
1488 return true;
1489 }
1490
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001491 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1492 data.enforceInterface(IActivityManager.descriptor);
1493 String reason = data.readString();
1494 boolean res = killProcessesBelowForeground(reason);
1495 reply.writeNoException();
1496 reply.writeInt(res ? 1 : 0);
1497 return true;
1498 }
1499
Dan Egnor60d87622009-12-16 16:32:58 -08001500 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1501 data.enforceInterface(IActivityManager.descriptor);
1502 IBinder app = data.readStrongBinder();
1503 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1504 handleApplicationCrash(app, ci);
1505 reply.writeNoException();
1506 return true;
1507 }
1508
1509 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001510 data.enforceInterface(IActivityManager.descriptor);
1511 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001512 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001513 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001514 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001515 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001516 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001517 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001518 return true;
1519 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001520
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001521 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1522 data.enforceInterface(IActivityManager.descriptor);
1523 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001524 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001525 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1526 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001527 reply.writeNoException();
1528 return true;
1529 }
1530
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001531 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1532 data.enforceInterface(IActivityManager.descriptor);
1533 int sig = data.readInt();
1534 signalPersistentProcesses(sig);
1535 reply.writeNoException();
1536 return true;
1537 }
1538
Dianne Hackborn03abb812010-01-04 18:43:19 -08001539 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1540 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001541 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001542 int userId = data.readInt();
1543 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001544 reply.writeNoException();
1545 return true;
1546 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001547
1548 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1549 data.enforceInterface(IActivityManager.descriptor);
1550 killAllBackgroundProcesses();
1551 reply.writeNoException();
1552 return true;
1553 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001554
Dianne Hackborn03abb812010-01-04 18:43:19 -08001555 case FORCE_STOP_PACKAGE_TRANSACTION: {
1556 data.enforceInterface(IActivityManager.descriptor);
1557 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001558 int userId = data.readInt();
1559 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001560 reply.writeNoException();
1561 return true;
1562 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001563
1564 case GET_MY_MEMORY_STATE_TRANSACTION: {
1565 data.enforceInterface(IActivityManager.descriptor);
1566 ActivityManager.RunningAppProcessInfo info =
1567 new ActivityManager.RunningAppProcessInfo();
1568 getMyMemoryState(info);
1569 reply.writeNoException();
1570 info.writeToParcel(reply, 0);
1571 return true;
1572 }
1573
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001574 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1575 data.enforceInterface(IActivityManager.descriptor);
1576 ConfigurationInfo config = getDeviceConfigurationInfo();
1577 reply.writeNoException();
1578 config.writeToParcel(reply, 0);
1579 return true;
1580 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001581
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001582 case PROFILE_CONTROL_TRANSACTION: {
1583 data.enforceInterface(IActivityManager.descriptor);
1584 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001585 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001586 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001587 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001588 ProfilerInfo profilerInfo = data.readInt() != 0
1589 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1590 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001591 reply.writeNoException();
1592 reply.writeInt(res ? 1 : 0);
1593 return true;
1594 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001595
Dianne Hackborn55280a92009-05-07 15:53:46 -07001596 case SHUTDOWN_TRANSACTION: {
1597 data.enforceInterface(IActivityManager.descriptor);
1598 boolean res = shutdown(data.readInt());
1599 reply.writeNoException();
1600 reply.writeInt(res ? 1 : 0);
1601 return true;
1602 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001603
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001604 case STOP_APP_SWITCHES_TRANSACTION: {
1605 data.enforceInterface(IActivityManager.descriptor);
1606 stopAppSwitches();
1607 reply.writeNoException();
1608 return true;
1609 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001610
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001611 case RESUME_APP_SWITCHES_TRANSACTION: {
1612 data.enforceInterface(IActivityManager.descriptor);
1613 resumeAppSwitches();
1614 reply.writeNoException();
1615 return true;
1616 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001617
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001618 case PEEK_SERVICE_TRANSACTION: {
1619 data.enforceInterface(IActivityManager.descriptor);
1620 Intent service = Intent.CREATOR.createFromParcel(data);
1621 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001622 String callingPackage = data.readString();
1623 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001624 reply.writeNoException();
1625 reply.writeStrongBinder(binder);
1626 return true;
1627 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001628
Christopher Tate181fafa2009-05-14 11:12:14 -07001629 case START_BACKUP_AGENT_TRANSACTION: {
1630 data.enforceInterface(IActivityManager.descriptor);
1631 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1632 int backupRestoreMode = data.readInt();
1633 boolean success = bindBackupAgent(info, backupRestoreMode);
1634 reply.writeNoException();
1635 reply.writeInt(success ? 1 : 0);
1636 return true;
1637 }
1638
1639 case BACKUP_AGENT_CREATED_TRANSACTION: {
1640 data.enforceInterface(IActivityManager.descriptor);
1641 String packageName = data.readString();
1642 IBinder agent = data.readStrongBinder();
1643 backupAgentCreated(packageName, agent);
1644 reply.writeNoException();
1645 return true;
1646 }
1647
1648 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1649 data.enforceInterface(IActivityManager.descriptor);
1650 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1651 unbindBackupAgent(info);
1652 reply.writeNoException();
1653 return true;
1654 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001655
1656 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1657 data.enforceInterface(IActivityManager.descriptor);
1658 String packageName = data.readString();
1659 addPackageDependency(packageName);
1660 reply.writeNoException();
1661 return true;
1662 }
1663
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001664 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001665 data.enforceInterface(IActivityManager.descriptor);
1666 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001667 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001668 String reason = data.readString();
1669 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001670 reply.writeNoException();
1671 return true;
1672 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001673
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001674 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1675 data.enforceInterface(IActivityManager.descriptor);
1676 String reason = data.readString();
1677 closeSystemDialogs(reason);
1678 reply.writeNoException();
1679 return true;
1680 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001681
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001682 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1683 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001684 int[] pids = data.createIntArray();
1685 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001686 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001687 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001688 return true;
1689 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001690
1691 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1692 data.enforceInterface(IActivityManager.descriptor);
1693 String processName = data.readString();
1694 int uid = data.readInt();
1695 killApplicationProcess(processName, uid);
1696 reply.writeNoException();
1697 return true;
1698 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001699
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001700 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1701 data.enforceInterface(IActivityManager.descriptor);
1702 IBinder token = data.readStrongBinder();
1703 String packageName = data.readString();
1704 int enterAnim = data.readInt();
1705 int exitAnim = data.readInt();
1706 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001707 reply.writeNoException();
1708 return true;
1709 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001710
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001711 case IS_USER_A_MONKEY_TRANSACTION: {
1712 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001713 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001714 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001715 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001716 return true;
1717 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001718
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001719 case SET_USER_IS_MONKEY_TRANSACTION: {
1720 data.enforceInterface(IActivityManager.descriptor);
1721 final boolean monkey = (data.readInt() == 1);
1722 setUserIsMonkey(monkey);
1723 reply.writeNoException();
1724 return true;
1725 }
1726
Dianne Hackborn860755f2010-06-03 18:47:52 -07001727 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1728 data.enforceInterface(IActivityManager.descriptor);
1729 finishHeavyWeightApp();
1730 reply.writeNoException();
1731 return true;
1732 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001733
1734 case IS_IMMERSIVE_TRANSACTION: {
1735 data.enforceInterface(IActivityManager.descriptor);
1736 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001737 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001738 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001739 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001740 return true;
1741 }
1742
Craig Mautnerd61dc202014-07-07 11:09:11 -07001743 case IS_TOP_OF_TASK_TRANSACTION: {
1744 data.enforceInterface(IActivityManager.descriptor);
1745 IBinder token = data.readStrongBinder();
1746 final boolean isTopOfTask = isTopOfTask(token);
1747 reply.writeNoException();
1748 reply.writeInt(isTopOfTask ? 1 : 0);
1749 return true;
1750 }
1751
Craig Mautner5eda9b32013-07-02 11:58:16 -07001752 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001753 data.enforceInterface(IActivityManager.descriptor);
1754 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001755 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001756 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001757 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001758 return true;
1759 }
1760
1761 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001764 final Bundle bundle;
1765 if (data.readInt() == 0) {
1766 bundle = null;
1767 } else {
1768 bundle = data.readBundle();
1769 }
Chong Zhang280d3322015-11-03 17:27:26 -08001770 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Craig Mautner233ceee2014-05-09 17:05:11 -07001771 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001772 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001773 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001774 return true;
1775 }
1776
Craig Mautner233ceee2014-05-09 17:05:11 -07001777 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1778 data.enforceInterface(IActivityManager.descriptor);
1779 IBinder token = data.readStrongBinder();
1780 final ActivityOptions options = getActivityOptions(token);
1781 reply.writeNoException();
1782 reply.writeBundle(options == null ? null : options.toBundle());
1783 return true;
1784 }
1785
Daniel Sandler69a48172010-06-23 16:29:36 -04001786 case SET_IMMERSIVE_TRANSACTION: {
1787 data.enforceInterface(IActivityManager.descriptor);
1788 IBinder token = data.readStrongBinder();
1789 boolean imm = data.readInt() == 1;
1790 setImmersive(token, imm);
1791 reply.writeNoException();
1792 return true;
1793 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001794
Daniel Sandler69a48172010-06-23 16:29:36 -04001795 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1796 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001797 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001798 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001799 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001800 return true;
1801 }
1802
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001803 case CRASH_APPLICATION_TRANSACTION: {
1804 data.enforceInterface(IActivityManager.descriptor);
1805 int uid = data.readInt();
1806 int initialPid = data.readInt();
1807 String packageName = data.readString();
1808 String message = data.readString();
1809 crashApplication(uid, initialPid, packageName, message);
1810 reply.writeNoException();
1811 return true;
1812 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001813
1814 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1815 data.enforceInterface(IActivityManager.descriptor);
1816 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001817 int userId = data.readInt();
1818 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001819 reply.writeNoException();
1820 reply.writeString(type);
1821 return true;
1822 }
1823
Dianne Hackborn7e269642010-08-25 19:50:20 -07001824 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1825 data.enforceInterface(IActivityManager.descriptor);
1826 String name = data.readString();
1827 IBinder perm = newUriPermissionOwner(name);
1828 reply.writeNoException();
1829 reply.writeStrongBinder(perm);
1830 return true;
1831 }
1832
1833 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1834 data.enforceInterface(IActivityManager.descriptor);
1835 IBinder owner = data.readStrongBinder();
1836 int fromUid = data.readInt();
1837 String targetPkg = data.readString();
1838 Uri uri = Uri.CREATOR.createFromParcel(data);
1839 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001840 int sourceUserId = data.readInt();
1841 int targetUserId = data.readInt();
1842 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1843 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001844 reply.writeNoException();
1845 return true;
1846 }
1847
1848 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1849 data.enforceInterface(IActivityManager.descriptor);
1850 IBinder owner = data.readStrongBinder();
1851 Uri uri = null;
1852 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001853 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001854 }
1855 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001856 int userId = data.readInt();
1857 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001858 reply.writeNoException();
1859 return true;
1860 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001861
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001862 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1863 data.enforceInterface(IActivityManager.descriptor);
1864 int callingUid = data.readInt();
1865 String targetPkg = data.readString();
1866 Uri uri = Uri.CREATOR.createFromParcel(data);
1867 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001868 int userId = data.readInt();
1869 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001870 reply.writeNoException();
1871 reply.writeInt(res);
1872 return true;
1873 }
1874
Andy McFadden824c5102010-07-09 16:26:57 -07001875 case DUMP_HEAP_TRANSACTION: {
1876 data.enforceInterface(IActivityManager.descriptor);
1877 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001878 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001879 boolean managed = data.readInt() != 0;
1880 String path = data.readString();
1881 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001882 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001883 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001884 reply.writeNoException();
1885 reply.writeInt(res ? 1 : 0);
1886 return true;
1887 }
1888
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001889 case START_ACTIVITIES_TRANSACTION:
1890 {
1891 data.enforceInterface(IActivityManager.descriptor);
1892 IBinder b = data.readStrongBinder();
1893 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001894 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001895 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1896 String[] resolvedTypes = data.createStringArray();
1897 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001898 Bundle options = data.readInt() != 0
1899 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001900 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001901 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001902 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001903 reply.writeNoException();
1904 reply.writeInt(result);
1905 return true;
1906 }
1907
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001908 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1909 {
1910 data.enforceInterface(IActivityManager.descriptor);
1911 int mode = getFrontActivityScreenCompatMode();
1912 reply.writeNoException();
1913 reply.writeInt(mode);
1914 return true;
1915 }
1916
1917 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1918 {
1919 data.enforceInterface(IActivityManager.descriptor);
1920 int mode = data.readInt();
1921 setFrontActivityScreenCompatMode(mode);
1922 reply.writeNoException();
1923 reply.writeInt(mode);
1924 return true;
1925 }
1926
1927 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1928 {
1929 data.enforceInterface(IActivityManager.descriptor);
1930 String pkg = data.readString();
1931 int mode = getPackageScreenCompatMode(pkg);
1932 reply.writeNoException();
1933 reply.writeInt(mode);
1934 return true;
1935 }
1936
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001937 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1938 {
1939 data.enforceInterface(IActivityManager.descriptor);
1940 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001941 int mode = data.readInt();
1942 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001943 reply.writeNoException();
1944 return true;
1945 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001946
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001947 case SWITCH_USER_TRANSACTION: {
1948 data.enforceInterface(IActivityManager.descriptor);
1949 int userid = data.readInt();
1950 boolean result = switchUser(userid);
1951 reply.writeNoException();
1952 reply.writeInt(result ? 1 : 0);
1953 return true;
1954 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001955
Kenny Guy08488bf2014-02-21 17:40:37 +00001956 case START_USER_IN_BACKGROUND_TRANSACTION: {
1957 data.enforceInterface(IActivityManager.descriptor);
1958 int userid = data.readInt();
1959 boolean result = startUserInBackground(userid);
1960 reply.writeNoException();
1961 reply.writeInt(result ? 1 : 0);
1962 return true;
1963 }
1964
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001965 case STOP_USER_TRANSACTION: {
1966 data.enforceInterface(IActivityManager.descriptor);
1967 int userid = data.readInt();
1968 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1969 data.readStrongBinder());
1970 int result = stopUser(userid, callback);
1971 reply.writeNoException();
1972 reply.writeInt(result);
1973 return true;
1974 }
1975
Amith Yamasani52f1d752012-03-28 18:19:29 -07001976 case GET_CURRENT_USER_TRANSACTION: {
1977 data.enforceInterface(IActivityManager.descriptor);
1978 UserInfo userInfo = getCurrentUser();
1979 reply.writeNoException();
1980 userInfo.writeToParcel(reply, 0);
1981 return true;
1982 }
1983
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001984 case IS_USER_RUNNING_TRANSACTION: {
1985 data.enforceInterface(IActivityManager.descriptor);
1986 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08001987 int _flags = data.readInt();
1988 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001989 reply.writeNoException();
1990 reply.writeInt(result ? 1 : 0);
1991 return true;
1992 }
1993
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001994 case GET_RUNNING_USER_IDS_TRANSACTION: {
1995 data.enforceInterface(IActivityManager.descriptor);
1996 int[] result = getRunningUserIds();
1997 reply.writeNoException();
1998 reply.writeIntArray(result);
1999 return true;
2000 }
2001
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002002 case REMOVE_TASK_TRANSACTION:
2003 {
2004 data.enforceInterface(IActivityManager.descriptor);
2005 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002006 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002007 reply.writeNoException();
2008 reply.writeInt(result ? 1 : 0);
2009 return true;
2010 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002011
Jeff Sharkeya4620792011-05-20 15:29:23 -07002012 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2013 data.enforceInterface(IActivityManager.descriptor);
2014 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2015 data.readStrongBinder());
2016 registerProcessObserver(observer);
2017 return true;
2018 }
2019
2020 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2021 data.enforceInterface(IActivityManager.descriptor);
2022 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2023 data.readStrongBinder());
2024 unregisterProcessObserver(observer);
2025 return true;
2026 }
2027
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002028 case REGISTER_UID_OBSERVER_TRANSACTION: {
2029 data.enforceInterface(IActivityManager.descriptor);
2030 IUidObserver observer = IUidObserver.Stub.asInterface(
2031 data.readStrongBinder());
2032 registerUidObserver(observer);
2033 return true;
2034 }
2035
2036 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2037 data.enforceInterface(IActivityManager.descriptor);
2038 IUidObserver observer = IUidObserver.Stub.asInterface(
2039 data.readStrongBinder());
2040 unregisterUidObserver(observer);
2041 return true;
2042 }
2043
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002044 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2045 {
2046 data.enforceInterface(IActivityManager.descriptor);
2047 String pkg = data.readString();
2048 boolean ask = getPackageAskScreenCompat(pkg);
2049 reply.writeNoException();
2050 reply.writeInt(ask ? 1 : 0);
2051 return true;
2052 }
2053
2054 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2055 {
2056 data.enforceInterface(IActivityManager.descriptor);
2057 String pkg = data.readString();
2058 boolean ask = data.readInt() != 0;
2059 setPackageAskScreenCompat(pkg, ask);
2060 reply.writeNoException();
2061 return true;
2062 }
2063
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002064 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2065 data.enforceInterface(IActivityManager.descriptor);
2066 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002067 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002068 boolean res = isIntentSenderTargetedToPackage(r);
2069 reply.writeNoException();
2070 reply.writeInt(res ? 1 : 0);
2071 return true;
2072 }
2073
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002074 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2075 data.enforceInterface(IActivityManager.descriptor);
2076 IIntentSender r = IIntentSender.Stub.asInterface(
2077 data.readStrongBinder());
2078 boolean res = isIntentSenderAnActivity(r);
2079 reply.writeNoException();
2080 reply.writeInt(res ? 1 : 0);
2081 return true;
2082 }
2083
Dianne Hackborn81038902012-11-26 17:04:09 -08002084 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2085 data.enforceInterface(IActivityManager.descriptor);
2086 IIntentSender r = IIntentSender.Stub.asInterface(
2087 data.readStrongBinder());
2088 Intent intent = getIntentForIntentSender(r);
2089 reply.writeNoException();
2090 if (intent != null) {
2091 reply.writeInt(1);
2092 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2093 } else {
2094 reply.writeInt(0);
2095 }
2096 return true;
2097 }
2098
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002099 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2100 data.enforceInterface(IActivityManager.descriptor);
2101 IIntentSender r = IIntentSender.Stub.asInterface(
2102 data.readStrongBinder());
2103 String prefix = data.readString();
2104 String tag = getTagForIntentSender(r, prefix);
2105 reply.writeNoException();
2106 reply.writeString(tag);
2107 return true;
2108 }
2109
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002110 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2111 data.enforceInterface(IActivityManager.descriptor);
2112 Configuration config = Configuration.CREATOR.createFromParcel(data);
2113 updatePersistentConfiguration(config);
2114 reply.writeNoException();
2115 return true;
2116 }
2117
Dianne Hackbornb437e092011-08-05 17:50:29 -07002118 case GET_PROCESS_PSS_TRANSACTION: {
2119 data.enforceInterface(IActivityManager.descriptor);
2120 int[] pids = data.createIntArray();
2121 long[] pss = getProcessPss(pids);
2122 reply.writeNoException();
2123 reply.writeLongArray(pss);
2124 return true;
2125 }
2126
Dianne Hackborn661cd522011-08-22 00:26:20 -07002127 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2128 data.enforceInterface(IActivityManager.descriptor);
2129 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2130 boolean always = data.readInt() != 0;
2131 showBootMessage(msg, always);
2132 reply.writeNoException();
2133 return true;
2134 }
2135
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002136 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002137 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002138 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002139 reply.writeNoException();
2140 return true;
2141 }
2142
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002143 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2144 data.enforceInterface(IActivityManager.descriptor);
2145 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2146 reply.writeNoException();
2147 return true;
2148 }
2149
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002150 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002151 data.enforceInterface(IActivityManager.descriptor);
2152 IBinder token = data.readStrongBinder();
2153 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002154 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002155 reply.writeNoException();
2156 reply.writeInt(res ? 1 : 0);
2157 return true;
2158 }
2159
2160 case NAVIGATE_UP_TO_TRANSACTION: {
2161 data.enforceInterface(IActivityManager.descriptor);
2162 IBinder token = data.readStrongBinder();
2163 Intent target = Intent.CREATOR.createFromParcel(data);
2164 int resultCode = data.readInt();
2165 Intent resultData = null;
2166 if (data.readInt() != 0) {
2167 resultData = Intent.CREATOR.createFromParcel(data);
2168 }
2169 boolean res = navigateUpTo(token, target, resultCode, resultData);
2170 reply.writeNoException();
2171 reply.writeInt(res ? 1 : 0);
2172 return true;
2173 }
2174
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002175 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2176 data.enforceInterface(IActivityManager.descriptor);
2177 IBinder token = data.readStrongBinder();
2178 int res = getLaunchedFromUid(token);
2179 reply.writeNoException();
2180 reply.writeInt(res);
2181 return true;
2182 }
2183
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002184 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2185 data.enforceInterface(IActivityManager.descriptor);
2186 IBinder token = data.readStrongBinder();
2187 String res = getLaunchedFromPackage(token);
2188 reply.writeNoException();
2189 reply.writeString(res);
2190 return true;
2191 }
2192
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002193 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2194 data.enforceInterface(IActivityManager.descriptor);
2195 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2196 data.readStrongBinder());
2197 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002198 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002199 return true;
2200 }
2201
2202 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2203 data.enforceInterface(IActivityManager.descriptor);
2204 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2205 data.readStrongBinder());
2206 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002207 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002208 return true;
2209 }
2210
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002211 case REQUEST_BUG_REPORT_TRANSACTION: {
2212 data.enforceInterface(IActivityManager.descriptor);
2213 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002214 reply.writeNoException();
2215 return true;
2216 }
2217
2218 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2219 data.enforceInterface(IActivityManager.descriptor);
2220 int pid = data.readInt();
2221 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002222 String reason = data.readString();
2223 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002224 reply.writeNoException();
2225 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002226 return true;
2227 }
2228
Adam Skorydfc7fd72013-08-05 19:23:41 -07002229 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002230 data.enforceInterface(IActivityManager.descriptor);
2231 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002232 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002233 reply.writeNoException();
2234 reply.writeBundle(res);
2235 return true;
2236 }
2237
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002238 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2239 data.enforceInterface(IActivityManager.descriptor);
2240 int requestType = data.readInt();
2241 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002242 IBinder activityToken = data.readStrongBinder();
2243 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002244 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002245 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002246 return true;
2247 }
2248
Adam Skorydfc7fd72013-08-05 19:23:41 -07002249 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002250 data.enforceInterface(IActivityManager.descriptor);
2251 IBinder token = data.readStrongBinder();
2252 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002253 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2254 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002255 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2256 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002257 reply.writeNoException();
2258 return true;
2259 }
2260
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002261 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2262 data.enforceInterface(IActivityManager.descriptor);
2263 Intent intent = Intent.CREATOR.createFromParcel(data);
2264 int requestType = data.readInt();
2265 String hint = data.readString();
2266 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002267 Bundle args = data.readBundle();
2268 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002269 reply.writeNoException();
2270 reply.writeInt(res ? 1 : 0);
2271 return true;
2272 }
2273
Benjamin Franzc200f442015-06-25 18:20:04 +01002274 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2275 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002276 boolean res = isAssistDataAllowedOnCurrentActivity();
2277 reply.writeNoException();
2278 reply.writeInt(res ? 1 : 0);
2279 return true;
2280 }
2281
2282 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2283 data.enforceInterface(IActivityManager.descriptor);
2284 IBinder token = data.readStrongBinder();
2285 Bundle args = data.readBundle();
2286 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002287 reply.writeNoException();
2288 reply.writeInt(res ? 1 : 0);
2289 return true;
2290 }
2291
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002292 case KILL_UID_TRANSACTION: {
2293 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002294 int appId = data.readInt();
2295 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002296 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002297 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002298 reply.writeNoException();
2299 return true;
2300 }
2301
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002302 case HANG_TRANSACTION: {
2303 data.enforceInterface(IActivityManager.descriptor);
2304 IBinder who = data.readStrongBinder();
2305 boolean allowRestart = data.readInt() != 0;
2306 hang(who, allowRestart);
2307 reply.writeNoException();
2308 return true;
2309 }
2310
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002311 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2312 data.enforceInterface(IActivityManager.descriptor);
2313 IBinder token = data.readStrongBinder();
2314 reportActivityFullyDrawn(token);
2315 reply.writeNoException();
2316 return true;
2317 }
2318
Craig Mautner5eda9b32013-07-02 11:58:16 -07002319 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2320 data.enforceInterface(IActivityManager.descriptor);
2321 IBinder token = data.readStrongBinder();
2322 notifyActivityDrawn(token);
2323 reply.writeNoException();
2324 return true;
2325 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002326
2327 case RESTART_TRANSACTION: {
2328 data.enforceInterface(IActivityManager.descriptor);
2329 restart();
2330 reply.writeNoException();
2331 return true;
2332 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002333
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002334 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2335 data.enforceInterface(IActivityManager.descriptor);
2336 performIdleMaintenance();
2337 reply.writeNoException();
2338 return true;
2339 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002340
Todd Kennedyca4d8422015-01-15 15:19:22 -08002341 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002342 data.enforceInterface(IActivityManager.descriptor);
2343 IBinder parentActivityToken = data.readStrongBinder();
2344 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002345 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002346 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002347 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002348 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002349 if (activityContainer != null) {
2350 reply.writeInt(1);
2351 reply.writeStrongBinder(activityContainer.asBinder());
2352 } else {
2353 reply.writeInt(0);
2354 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002355 return true;
2356 }
2357
Craig Mautner95da1082014-02-24 17:54:35 -08002358 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2359 data.enforceInterface(IActivityManager.descriptor);
2360 IActivityContainer activityContainer =
2361 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2362 deleteActivityContainer(activityContainer);
2363 reply.writeNoException();
2364 return true;
2365 }
2366
Todd Kennedy4900bf92015-01-16 16:05:14 -08002367 case CREATE_STACK_ON_DISPLAY: {
2368 data.enforceInterface(IActivityManager.descriptor);
2369 int displayId = data.readInt();
2370 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2371 reply.writeNoException();
2372 if (activityContainer != null) {
2373 reply.writeInt(1);
2374 reply.writeStrongBinder(activityContainer.asBinder());
2375 } else {
2376 reply.writeInt(0);
2377 }
2378 return true;
2379 }
2380
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002381 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002382 data.enforceInterface(IActivityManager.descriptor);
2383 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002384 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002385 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002386 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002387 return true;
2388 }
2389
Craig Mautneraea74a52014-03-08 14:23:10 -08002390 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2391 data.enforceInterface(IActivityManager.descriptor);
2392 final int taskId = data.readInt();
2393 startLockTaskMode(taskId);
2394 reply.writeNoException();
2395 return true;
2396 }
2397
2398 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2399 data.enforceInterface(IActivityManager.descriptor);
2400 IBinder token = data.readStrongBinder();
2401 startLockTaskMode(token);
2402 reply.writeNoException();
2403 return true;
2404 }
2405
Craig Mautnerd61dc202014-07-07 11:09:11 -07002406 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002407 data.enforceInterface(IActivityManager.descriptor);
2408 startLockTaskModeOnCurrent();
2409 reply.writeNoException();
2410 return true;
2411 }
2412
Craig Mautneraea74a52014-03-08 14:23:10 -08002413 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2414 data.enforceInterface(IActivityManager.descriptor);
2415 stopLockTaskMode();
2416 reply.writeNoException();
2417 return true;
2418 }
2419
Craig Mautnerd61dc202014-07-07 11:09:11 -07002420 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002421 data.enforceInterface(IActivityManager.descriptor);
2422 stopLockTaskModeOnCurrent();
2423 reply.writeNoException();
2424 return true;
2425 }
2426
Craig Mautneraea74a52014-03-08 14:23:10 -08002427 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2428 data.enforceInterface(IActivityManager.descriptor);
2429 final boolean isInLockTaskMode = isInLockTaskMode();
2430 reply.writeNoException();
2431 reply.writeInt(isInLockTaskMode ? 1 : 0);
2432 return true;
2433 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002434
Benjamin Franz43261142015-02-11 15:59:44 +00002435 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2436 data.enforceInterface(IActivityManager.descriptor);
2437 final int lockTaskModeState = getLockTaskModeState();
2438 reply.writeNoException();
2439 reply.writeInt(lockTaskModeState);
2440 return true;
2441 }
2442
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002443 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2444 data.enforceInterface(IActivityManager.descriptor);
2445 final IBinder token = data.readStrongBinder();
2446 showLockTaskEscapeMessage(token);
2447 reply.writeNoException();
2448 return true;
2449 }
2450
Winson Chunga449dc02014-05-16 11:15:04 -07002451 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002452 data.enforceInterface(IActivityManager.descriptor);
2453 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002454 ActivityManager.TaskDescription values =
2455 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2456 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002457 reply.writeNoException();
2458 return true;
2459 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002460
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002461 case SET_TASK_RESIZEABLE_TRANSACTION: {
2462 data.enforceInterface(IActivityManager.descriptor);
2463 int taskId = data.readInt();
2464 boolean resizeable = (data.readInt() == 1) ? true : false;
2465 setTaskResizeable(taskId, resizeable);
2466 reply.writeNoException();
2467 return true;
2468 }
2469
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002470 case RESIZE_TASK_TRANSACTION: {
2471 data.enforceInterface(IActivityManager.descriptor);
2472 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002473 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002474 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002475 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002476 reply.writeNoException();
2477 return true;
2478 }
2479
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002480 case GET_TASK_BOUNDS_TRANSACTION: {
2481 data.enforceInterface(IActivityManager.descriptor);
2482 int taskId = data.readInt();
2483 Rect r = getTaskBounds(taskId);
2484 reply.writeNoException();
2485 r.writeToParcel(reply, 0);
2486 return true;
2487 }
2488
Craig Mautner648f69b2014-09-18 14:16:26 -07002489 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2490 data.enforceInterface(IActivityManager.descriptor);
2491 String filename = data.readString();
2492 Bitmap icon = getTaskDescriptionIcon(filename);
2493 reply.writeNoException();
2494 if (icon == null) {
2495 reply.writeInt(0);
2496 } else {
2497 reply.writeInt(1);
2498 icon.writeToParcel(reply, 0);
2499 }
2500 return true;
2501 }
2502
Winson Chung044d5292014-11-06 11:05:19 -08002503 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2504 data.enforceInterface(IActivityManager.descriptor);
2505 final Bundle bundle;
2506 if (data.readInt() == 0) {
2507 bundle = null;
2508 } else {
2509 bundle = data.readBundle();
2510 }
Chong Zhang280d3322015-11-03 17:27:26 -08002511 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002512 startInPlaceAnimationOnFrontMostApplication(options);
2513 reply.writeNoException();
2514 return true;
2515 }
2516
Jose Lima4b6c6692014-08-12 17:41:12 -07002517 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002518 data.enforceInterface(IActivityManager.descriptor);
2519 IBinder token = data.readStrongBinder();
2520 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002521 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002522 reply.writeNoException();
2523 reply.writeInt(success ? 1 : 0);
2524 return true;
2525 }
2526
Jose Lima4b6c6692014-08-12 17:41:12 -07002527 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002528 data.enforceInterface(IActivityManager.descriptor);
2529 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002530 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002531 reply.writeNoException();
2532 reply.writeInt(enabled ? 1 : 0);
2533 return true;
2534 }
2535
Jose Lima4b6c6692014-08-12 17:41:12 -07002536 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002537 data.enforceInterface(IActivityManager.descriptor);
2538 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002539 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002540 reply.writeNoException();
2541 return true;
2542 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002543
2544 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2545 data.enforceInterface(IActivityManager.descriptor);
2546 IBinder token = data.readStrongBinder();
2547 notifyLaunchTaskBehindComplete(token);
2548 reply.writeNoException();
2549 return true;
2550 }
Craig Mautner8746a472014-07-24 15:12:54 -07002551
2552 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2553 data.enforceInterface(IActivityManager.descriptor);
2554 IBinder token = data.readStrongBinder();
2555 notifyEnterAnimationComplete(token);
2556 reply.writeNoException();
2557 return true;
2558 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002559
2560 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2561 data.enforceInterface(IActivityManager.descriptor);
2562 bootAnimationComplete();
2563 reply.writeNoException();
2564 return true;
2565 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002566
Jeff Sharkey605eb792014-11-04 13:34:06 -08002567 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2568 data.enforceInterface(IActivityManager.descriptor);
2569 final int uid = data.readInt();
2570 final byte[] firstPacket = data.createByteArray();
2571 notifyCleartextNetwork(uid, firstPacket);
2572 reply.writeNoException();
2573 return true;
2574 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002575
2576 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2577 data.enforceInterface(IActivityManager.descriptor);
2578 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002579 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002580 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002581 String reportPackage = data.readString();
2582 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002583 reply.writeNoException();
2584 return true;
2585 }
2586
2587 case DUMP_HEAP_FINISHED_TRANSACTION: {
2588 data.enforceInterface(IActivityManager.descriptor);
2589 String path = data.readString();
2590 dumpHeapFinished(path);
2591 reply.writeNoException();
2592 return true;
2593 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002594
2595 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2596 data.enforceInterface(IActivityManager.descriptor);
2597 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2598 data.readStrongBinder());
2599 boolean keepAwake = data.readInt() != 0;
2600 setVoiceKeepAwake(session, keepAwake);
2601 reply.writeNoException();
2602 return true;
2603 }
Craig Mautnere5600772015-04-03 21:36:37 -07002604
2605 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2606 data.enforceInterface(IActivityManager.descriptor);
2607 int userId = data.readInt();
2608 String[] packages = data.readStringArray();
2609 updateLockTaskPackages(userId, packages);
2610 reply.writeNoException();
2611 return true;
2612 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002613
Craig Mautner015c5e52015-04-23 10:39:39 -07002614 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2615 data.enforceInterface(IActivityManager.descriptor);
2616 String packageName = data.readString();
2617 updateDeviceOwner(packageName);
2618 reply.writeNoException();
2619 return true;
2620 }
2621
Dianne Hackborn1e383822015-04-10 14:02:33 -07002622 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2623 data.enforceInterface(IActivityManager.descriptor);
2624 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002625 String callingPackage = data.readString();
2626 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002627 reply.writeNoException();
2628 reply.writeInt(res);
2629 return true;
2630 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002631
2632 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2633 data.enforceInterface(IActivityManager.descriptor);
2634 String process = data.readString();
2635 int userId = data.readInt();
2636 int level = data.readInt();
2637 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2638 reply.writeNoException();
2639 reply.writeInt(res ? 1 : 0);
2640 return true;
2641 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002642
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002643 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2644 data.enforceInterface(IActivityManager.descriptor);
2645 IBinder token = data.readStrongBinder();
2646 boolean res = isRootVoiceInteraction(token);
2647 reply.writeNoException();
2648 reply.writeInt(res ? 1 : 0);
2649 return true;
2650 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002651
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002652 case START_BINDER_TRACKING_TRANSACTION: {
2653 data.enforceInterface(IActivityManager.descriptor);
2654 boolean res = startBinderTracking();
2655 reply.writeNoException();
2656 reply.writeInt(res ? 1 : 0);
2657 return true;
2658 }
2659
2660 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2661 data.enforceInterface(IActivityManager.descriptor);
2662 ParcelFileDescriptor fd = data.readInt() != 0
2663 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2664 boolean res = stopBinderTrackingAndDump(fd);
2665 reply.writeNoException();
2666 reply.writeInt(res ? 1 : 0);
2667 return true;
2668 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002669 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2670 data.enforceInterface(IActivityManager.descriptor);
2671 IBinder token = data.readStrongBinder();
2672 int stackId = getActivityStackId(token);
2673 reply.writeNoException();
2674 reply.writeInt(stackId);
2675 return true;
2676 }
2677 case MOVE_ACTIVITY_TO_STACK_TRANSACTION: {
2678 data.enforceInterface(IActivityManager.descriptor);
2679 IBinder token = data.readStrongBinder();
2680 int stackId = data.readInt();
2681 moveActivityToStack(token, stackId);
2682 reply.writeNoException();
2683 return true;
2684 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002685 case REPORT_SIZE_CONFIGURATIONS: {
2686 data.enforceInterface(IActivityManager.descriptor);
2687 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002688 int[] horizontal = readIntArray(data);
2689 int[] vertical = readIntArray(data);
2690 int[] smallest = readIntArray(data);
2691 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002692 return true;
2693 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002694 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2695 data.enforceInterface(IActivityManager.descriptor);
2696 final boolean suppress = data.readInt() == 1;
2697 suppressResizeConfigChanges(suppress);
2698 reply.writeNoException();
2699 return true;
2700 }
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002701 case REMOVE_STACK: {
2702 data.enforceInterface(IActivityManager.descriptor);
2703 final int stackId = data.readInt();
2704 removeStack(stackId);
2705 reply.writeNoException();
2706 return true;
2707 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002708 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002709
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002710 return super.onTransact(code, data, reply, flags);
2711 }
2712
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002713 private int[] readIntArray(Parcel data) {
2714 int[] smallest = null;
2715 int smallestSize = data.readInt();
2716 if (smallestSize > 0) {
2717 smallest = new int[smallestSize];
2718 data.readIntArray(smallest);
2719 }
2720 return smallest;
2721 }
2722
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002723 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002724 return this;
2725 }
2726
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002727 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2728 protected IActivityManager create() {
2729 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002730 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002731 Log.v("ActivityManager", "default service binder = " + b);
2732 }
2733 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002734 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002735 Log.v("ActivityManager", "default service = " + am);
2736 }
2737 return am;
2738 }
2739 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002740}
2741
2742class ActivityManagerProxy implements IActivityManager
2743{
2744 public ActivityManagerProxy(IBinder remote)
2745 {
2746 mRemote = remote;
2747 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002748
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002749 public IBinder asBinder()
2750 {
2751 return mRemote;
2752 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002753
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002754 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002755 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002756 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002757 Parcel data = Parcel.obtain();
2758 Parcel reply = Parcel.obtain();
2759 data.writeInterfaceToken(IActivityManager.descriptor);
2760 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002761 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002762 intent.writeToParcel(data, 0);
2763 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002764 data.writeStrongBinder(resultTo);
2765 data.writeString(resultWho);
2766 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002767 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002768 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002769 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002770 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002771 } else {
2772 data.writeInt(0);
2773 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002774 if (options != null) {
2775 data.writeInt(1);
2776 options.writeToParcel(data, 0);
2777 } else {
2778 data.writeInt(0);
2779 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002780 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2781 reply.readException();
2782 int result = reply.readInt();
2783 reply.recycle();
2784 data.recycle();
2785 return result;
2786 }
Amith Yamasani82644082012-08-03 13:09:11 -07002787
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002788 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002789 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002790 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2791 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002792 Parcel data = Parcel.obtain();
2793 Parcel reply = Parcel.obtain();
2794 data.writeInterfaceToken(IActivityManager.descriptor);
2795 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002796 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002797 intent.writeToParcel(data, 0);
2798 data.writeString(resolvedType);
2799 data.writeStrongBinder(resultTo);
2800 data.writeString(resultWho);
2801 data.writeInt(requestCode);
2802 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002803 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002804 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002805 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002806 } else {
2807 data.writeInt(0);
2808 }
2809 if (options != null) {
2810 data.writeInt(1);
2811 options.writeToParcel(data, 0);
2812 } else {
2813 data.writeInt(0);
2814 }
2815 data.writeInt(userId);
2816 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2817 reply.readException();
2818 int result = reply.readInt();
2819 reply.recycle();
2820 data.recycle();
2821 return result;
2822 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002823 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2824 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002825 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2826 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002827 Parcel data = Parcel.obtain();
2828 Parcel reply = Parcel.obtain();
2829 data.writeInterfaceToken(IActivityManager.descriptor);
2830 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2831 data.writeString(callingPackage);
2832 intent.writeToParcel(data, 0);
2833 data.writeString(resolvedType);
2834 data.writeStrongBinder(resultTo);
2835 data.writeString(resultWho);
2836 data.writeInt(requestCode);
2837 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002838 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002839 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002840 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002841 } else {
2842 data.writeInt(0);
2843 }
2844 if (options != null) {
2845 data.writeInt(1);
2846 options.writeToParcel(data, 0);
2847 } else {
2848 data.writeInt(0);
2849 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002850 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002851 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002852 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2853 reply.readException();
2854 int result = reply.readInt();
2855 reply.recycle();
2856 data.recycle();
2857 return result;
2858 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002859 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2860 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002861 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2862 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002863 Parcel data = Parcel.obtain();
2864 Parcel reply = Parcel.obtain();
2865 data.writeInterfaceToken(IActivityManager.descriptor);
2866 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002867 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002868 intent.writeToParcel(data, 0);
2869 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002870 data.writeStrongBinder(resultTo);
2871 data.writeString(resultWho);
2872 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002873 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002874 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002875 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002876 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002877 } else {
2878 data.writeInt(0);
2879 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002880 if (options != null) {
2881 data.writeInt(1);
2882 options.writeToParcel(data, 0);
2883 } else {
2884 data.writeInt(0);
2885 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002886 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002887 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2888 reply.readException();
2889 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2890 reply.recycle();
2891 data.recycle();
2892 return result;
2893 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002894 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2895 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002896 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002897 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002898 Parcel data = Parcel.obtain();
2899 Parcel reply = Parcel.obtain();
2900 data.writeInterfaceToken(IActivityManager.descriptor);
2901 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002902 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002903 intent.writeToParcel(data, 0);
2904 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002905 data.writeStrongBinder(resultTo);
2906 data.writeString(resultWho);
2907 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002908 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002909 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002910 if (options != null) {
2911 data.writeInt(1);
2912 options.writeToParcel(data, 0);
2913 } else {
2914 data.writeInt(0);
2915 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002916 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002917 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2918 reply.readException();
2919 int result = reply.readInt();
2920 reply.recycle();
2921 data.recycle();
2922 return result;
2923 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002924 public int startActivityIntentSender(IApplicationThread caller,
2925 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002926 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002927 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002928 Parcel data = Parcel.obtain();
2929 Parcel reply = Parcel.obtain();
2930 data.writeInterfaceToken(IActivityManager.descriptor);
2931 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2932 intent.writeToParcel(data, 0);
2933 if (fillInIntent != null) {
2934 data.writeInt(1);
2935 fillInIntent.writeToParcel(data, 0);
2936 } else {
2937 data.writeInt(0);
2938 }
2939 data.writeString(resolvedType);
2940 data.writeStrongBinder(resultTo);
2941 data.writeString(resultWho);
2942 data.writeInt(requestCode);
2943 data.writeInt(flagsMask);
2944 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002945 if (options != null) {
2946 data.writeInt(1);
2947 options.writeToParcel(data, 0);
2948 } else {
2949 data.writeInt(0);
2950 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002951 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002952 reply.readException();
2953 int result = reply.readInt();
2954 reply.recycle();
2955 data.recycle();
2956 return result;
2957 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002958 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2959 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002960 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2961 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002962 Parcel data = Parcel.obtain();
2963 Parcel reply = Parcel.obtain();
2964 data.writeInterfaceToken(IActivityManager.descriptor);
2965 data.writeString(callingPackage);
2966 data.writeInt(callingPid);
2967 data.writeInt(callingUid);
2968 intent.writeToParcel(data, 0);
2969 data.writeString(resolvedType);
2970 data.writeStrongBinder(session.asBinder());
2971 data.writeStrongBinder(interactor.asBinder());
2972 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002973 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002974 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002975 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002976 } else {
2977 data.writeInt(0);
2978 }
2979 if (options != null) {
2980 data.writeInt(1);
2981 options.writeToParcel(data, 0);
2982 } else {
2983 data.writeInt(0);
2984 }
2985 data.writeInt(userId);
2986 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2987 reply.readException();
2988 int result = reply.readInt();
2989 reply.recycle();
2990 data.recycle();
2991 return result;
2992 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002993 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002994 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002995 Parcel data = Parcel.obtain();
2996 Parcel reply = Parcel.obtain();
2997 data.writeInterfaceToken(IActivityManager.descriptor);
2998 data.writeStrongBinder(callingActivity);
2999 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003000 if (options != null) {
3001 data.writeInt(1);
3002 options.writeToParcel(data, 0);
3003 } else {
3004 data.writeInt(0);
3005 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003006 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3007 reply.readException();
3008 int result = reply.readInt();
3009 reply.recycle();
3010 data.recycle();
3011 return result != 0;
3012 }
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003013 public int startActivityFromRecents(int taskId, int launchStackId, Bundle options)
3014 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003015 Parcel data = Parcel.obtain();
3016 Parcel reply = Parcel.obtain();
3017 data.writeInterfaceToken(IActivityManager.descriptor);
3018 data.writeInt(taskId);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003019 data.writeInt(launchStackId);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003020 if (options == null) {
3021 data.writeInt(0);
3022 } else {
3023 data.writeInt(1);
3024 options.writeToParcel(data, 0);
3025 }
3026 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3027 reply.readException();
3028 int result = reply.readInt();
3029 reply.recycle();
3030 data.recycle();
3031 return result;
3032 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003033 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003034 throws RemoteException {
3035 Parcel data = Parcel.obtain();
3036 Parcel reply = Parcel.obtain();
3037 data.writeInterfaceToken(IActivityManager.descriptor);
3038 data.writeStrongBinder(token);
3039 data.writeInt(resultCode);
3040 if (resultData != null) {
3041 data.writeInt(1);
3042 resultData.writeToParcel(data, 0);
3043 } else {
3044 data.writeInt(0);
3045 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003046 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003047 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3048 reply.readException();
3049 boolean res = reply.readInt() != 0;
3050 data.recycle();
3051 reply.recycle();
3052 return res;
3053 }
3054 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3055 {
3056 Parcel data = Parcel.obtain();
3057 Parcel reply = Parcel.obtain();
3058 data.writeInterfaceToken(IActivityManager.descriptor);
3059 data.writeStrongBinder(token);
3060 data.writeString(resultWho);
3061 data.writeInt(requestCode);
3062 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3063 reply.readException();
3064 data.recycle();
3065 reply.recycle();
3066 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003067 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3068 Parcel data = Parcel.obtain();
3069 Parcel reply = Parcel.obtain();
3070 data.writeInterfaceToken(IActivityManager.descriptor);
3071 data.writeStrongBinder(token);
3072 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3073 reply.readException();
3074 boolean res = reply.readInt() != 0;
3075 data.recycle();
3076 reply.recycle();
3077 return res;
3078 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003079 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3080 Parcel data = Parcel.obtain();
3081 Parcel reply = Parcel.obtain();
3082 data.writeInterfaceToken(IActivityManager.descriptor);
3083 data.writeStrongBinder(session.asBinder());
3084 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3085 reply.readException();
3086 data.recycle();
3087 reply.recycle();
3088 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003089 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3090 Parcel data = Parcel.obtain();
3091 Parcel reply = Parcel.obtain();
3092 data.writeInterfaceToken(IActivityManager.descriptor);
3093 data.writeStrongBinder(token);
3094 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3095 reply.readException();
3096 boolean res = reply.readInt() != 0;
3097 data.recycle();
3098 reply.recycle();
3099 return res;
3100 }
3101 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3102 Parcel data = Parcel.obtain();
3103 Parcel reply = Parcel.obtain();
3104 data.writeInterfaceToken(IActivityManager.descriptor);
3105 data.writeStrongBinder(app.asBinder());
3106 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3107 reply.readException();
3108 data.recycle();
3109 reply.recycle();
3110 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003111 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3112 Parcel data = Parcel.obtain();
3113 Parcel reply = Parcel.obtain();
3114 data.writeInterfaceToken(IActivityManager.descriptor);
3115 data.writeStrongBinder(token);
3116 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3117 reply.readException();
3118 boolean res = reply.readInt() != 0;
3119 data.recycle();
3120 reply.recycle();
3121 return res;
3122 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003123 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003124 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003125 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003126 {
3127 Parcel data = Parcel.obtain();
3128 Parcel reply = Parcel.obtain();
3129 data.writeInterfaceToken(IActivityManager.descriptor);
3130 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003131 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003132 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3133 filter.writeToParcel(data, 0);
3134 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003135 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003136 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3137 reply.readException();
3138 Intent intent = null;
3139 int haveIntent = reply.readInt();
3140 if (haveIntent != 0) {
3141 intent = Intent.CREATOR.createFromParcel(reply);
3142 }
3143 reply.recycle();
3144 data.recycle();
3145 return intent;
3146 }
3147 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3148 {
3149 Parcel data = Parcel.obtain();
3150 Parcel reply = Parcel.obtain();
3151 data.writeInterfaceToken(IActivityManager.descriptor);
3152 data.writeStrongBinder(receiver.asBinder());
3153 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3154 reply.readException();
3155 data.recycle();
3156 reply.recycle();
3157 }
3158 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003159 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003160 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003161 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003162 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003163 {
3164 Parcel data = Parcel.obtain();
3165 Parcel reply = Parcel.obtain();
3166 data.writeInterfaceToken(IActivityManager.descriptor);
3167 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3168 intent.writeToParcel(data, 0);
3169 data.writeString(resolvedType);
3170 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3171 data.writeInt(resultCode);
3172 data.writeString(resultData);
3173 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003174 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003175 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003176 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003177 data.writeInt(serialized ? 1 : 0);
3178 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003179 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003180 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3181 reply.readException();
3182 int res = reply.readInt();
3183 reply.recycle();
3184 data.recycle();
3185 return res;
3186 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003187 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3188 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003189 {
3190 Parcel data = Parcel.obtain();
3191 Parcel reply = Parcel.obtain();
3192 data.writeInterfaceToken(IActivityManager.descriptor);
3193 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3194 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003195 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003196 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3197 reply.readException();
3198 data.recycle();
3199 reply.recycle();
3200 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003201 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3202 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003203 {
3204 Parcel data = Parcel.obtain();
3205 Parcel reply = Parcel.obtain();
3206 data.writeInterfaceToken(IActivityManager.descriptor);
3207 data.writeStrongBinder(who);
3208 data.writeInt(resultCode);
3209 data.writeString(resultData);
3210 data.writeBundle(map);
3211 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003212 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003213 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3214 reply.readException();
3215 data.recycle();
3216 reply.recycle();
3217 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003218 public void attachApplication(IApplicationThread app) throws RemoteException
3219 {
3220 Parcel data = Parcel.obtain();
3221 Parcel reply = Parcel.obtain();
3222 data.writeInterfaceToken(IActivityManager.descriptor);
3223 data.writeStrongBinder(app.asBinder());
3224 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3225 reply.readException();
3226 data.recycle();
3227 reply.recycle();
3228 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003229 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3230 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003231 {
3232 Parcel data = Parcel.obtain();
3233 Parcel reply = Parcel.obtain();
3234 data.writeInterfaceToken(IActivityManager.descriptor);
3235 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003236 if (config != null) {
3237 data.writeInt(1);
3238 config.writeToParcel(data, 0);
3239 } else {
3240 data.writeInt(0);
3241 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003242 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003243 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3244 reply.readException();
3245 data.recycle();
3246 reply.recycle();
3247 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003248 public void activityResumed(IBinder token) throws RemoteException
3249 {
3250 Parcel data = Parcel.obtain();
3251 Parcel reply = Parcel.obtain();
3252 data.writeInterfaceToken(IActivityManager.descriptor);
3253 data.writeStrongBinder(token);
3254 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3255 reply.readException();
3256 data.recycle();
3257 reply.recycle();
3258 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003259 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003260 {
3261 Parcel data = Parcel.obtain();
3262 Parcel reply = Parcel.obtain();
3263 data.writeInterfaceToken(IActivityManager.descriptor);
3264 data.writeStrongBinder(token);
3265 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3266 reply.readException();
3267 data.recycle();
3268 reply.recycle();
3269 }
3270 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003271 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003272 {
3273 Parcel data = Parcel.obtain();
3274 Parcel reply = Parcel.obtain();
3275 data.writeInterfaceToken(IActivityManager.descriptor);
3276 data.writeStrongBinder(token);
3277 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003278 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003279 TextUtils.writeToParcel(description, data, 0);
3280 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3281 reply.readException();
3282 data.recycle();
3283 reply.recycle();
3284 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003285 public void activitySlept(IBinder token) throws RemoteException
3286 {
3287 Parcel data = Parcel.obtain();
3288 Parcel reply = Parcel.obtain();
3289 data.writeInterfaceToken(IActivityManager.descriptor);
3290 data.writeStrongBinder(token);
3291 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3292 reply.readException();
3293 data.recycle();
3294 reply.recycle();
3295 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003296 public void activityDestroyed(IBinder token) throws RemoteException
3297 {
3298 Parcel data = Parcel.obtain();
3299 Parcel reply = Parcel.obtain();
3300 data.writeInterfaceToken(IActivityManager.descriptor);
3301 data.writeStrongBinder(token);
3302 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3303 reply.readException();
3304 data.recycle();
3305 reply.recycle();
3306 }
3307 public String getCallingPackage(IBinder token) throws RemoteException
3308 {
3309 Parcel data = Parcel.obtain();
3310 Parcel reply = Parcel.obtain();
3311 data.writeInterfaceToken(IActivityManager.descriptor);
3312 data.writeStrongBinder(token);
3313 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3314 reply.readException();
3315 String res = reply.readString();
3316 data.recycle();
3317 reply.recycle();
3318 return res;
3319 }
3320 public ComponentName getCallingActivity(IBinder token)
3321 throws RemoteException {
3322 Parcel data = Parcel.obtain();
3323 Parcel reply = Parcel.obtain();
3324 data.writeInterfaceToken(IActivityManager.descriptor);
3325 data.writeStrongBinder(token);
3326 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3327 reply.readException();
3328 ComponentName res = ComponentName.readFromParcel(reply);
3329 data.recycle();
3330 reply.recycle();
3331 return res;
3332 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003333 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003334 Parcel data = Parcel.obtain();
3335 Parcel reply = Parcel.obtain();
3336 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003337 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003338 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3339 reply.readException();
3340 ArrayList<IAppTask> list = null;
3341 int N = reply.readInt();
3342 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003343 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003344 while (N > 0) {
3345 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3346 list.add(task);
3347 N--;
3348 }
3349 }
3350 data.recycle();
3351 reply.recycle();
3352 return list;
3353 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003354 public int addAppTask(IBinder activityToken, Intent intent,
3355 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3356 Parcel data = Parcel.obtain();
3357 Parcel reply = Parcel.obtain();
3358 data.writeInterfaceToken(IActivityManager.descriptor);
3359 data.writeStrongBinder(activityToken);
3360 intent.writeToParcel(data, 0);
3361 description.writeToParcel(data, 0);
3362 thumbnail.writeToParcel(data, 0);
3363 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3364 reply.readException();
3365 int res = reply.readInt();
3366 data.recycle();
3367 reply.recycle();
3368 return res;
3369 }
3370 public Point getAppTaskThumbnailSize() throws RemoteException {
3371 Parcel data = Parcel.obtain();
3372 Parcel reply = Parcel.obtain();
3373 data.writeInterfaceToken(IActivityManager.descriptor);
3374 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3375 reply.readException();
3376 Point size = Point.CREATOR.createFromParcel(reply);
3377 data.recycle();
3378 reply.recycle();
3379 return size;
3380 }
Todd Kennedye635f662015-01-20 10:36:49 -08003381 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3382 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003383 Parcel data = Parcel.obtain();
3384 Parcel reply = Parcel.obtain();
3385 data.writeInterfaceToken(IActivityManager.descriptor);
3386 data.writeInt(maxNum);
3387 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003388 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3389 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003390 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003391 int N = reply.readInt();
3392 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003393 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003394 while (N > 0) {
3395 ActivityManager.RunningTaskInfo info =
3396 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003397 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003398 list.add(info);
3399 N--;
3400 }
3401 }
3402 data.recycle();
3403 reply.recycle();
3404 return list;
3405 }
3406 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003407 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003408 Parcel data = Parcel.obtain();
3409 Parcel reply = Parcel.obtain();
3410 data.writeInterfaceToken(IActivityManager.descriptor);
3411 data.writeInt(maxNum);
3412 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003413 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003414 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3415 reply.readException();
3416 ArrayList<ActivityManager.RecentTaskInfo> list
3417 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3418 data.recycle();
3419 reply.recycle();
3420 return list;
3421 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003422 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003423 Parcel data = Parcel.obtain();
3424 Parcel reply = Parcel.obtain();
3425 data.writeInterfaceToken(IActivityManager.descriptor);
3426 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003427 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003428 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003429 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003430 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003431 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003432 }
3433 data.recycle();
3434 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003435 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003436 }
Todd Kennedye635f662015-01-20 10:36:49 -08003437 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3438 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003439 Parcel data = Parcel.obtain();
3440 Parcel reply = Parcel.obtain();
3441 data.writeInterfaceToken(IActivityManager.descriptor);
3442 data.writeInt(maxNum);
3443 data.writeInt(flags);
3444 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3445 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003446 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003447 int N = reply.readInt();
3448 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003449 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003450 while (N > 0) {
3451 ActivityManager.RunningServiceInfo info =
3452 ActivityManager.RunningServiceInfo.CREATOR
3453 .createFromParcel(reply);
3454 list.add(info);
3455 N--;
3456 }
3457 }
3458 data.recycle();
3459 reply.recycle();
3460 return list;
3461 }
3462 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3463 throws RemoteException {
3464 Parcel data = Parcel.obtain();
3465 Parcel reply = Parcel.obtain();
3466 data.writeInterfaceToken(IActivityManager.descriptor);
3467 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3468 reply.readException();
3469 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3470 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3471 data.recycle();
3472 reply.recycle();
3473 return list;
3474 }
3475 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3476 throws RemoteException {
3477 Parcel data = Parcel.obtain();
3478 Parcel reply = Parcel.obtain();
3479 data.writeInterfaceToken(IActivityManager.descriptor);
3480 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3481 reply.readException();
3482 ArrayList<ActivityManager.RunningAppProcessInfo> list
3483 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3484 data.recycle();
3485 reply.recycle();
3486 return list;
3487 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003488 public List<ApplicationInfo> getRunningExternalApplications()
3489 throws RemoteException {
3490 Parcel data = Parcel.obtain();
3491 Parcel reply = Parcel.obtain();
3492 data.writeInterfaceToken(IActivityManager.descriptor);
3493 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3494 reply.readException();
3495 ArrayList<ApplicationInfo> list
3496 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3497 data.recycle();
3498 reply.recycle();
3499 return list;
3500 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003501 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003502 {
3503 Parcel data = Parcel.obtain();
3504 Parcel reply = Parcel.obtain();
3505 data.writeInterfaceToken(IActivityManager.descriptor);
3506 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003507 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003508 if (options != null) {
3509 data.writeInt(1);
3510 options.writeToParcel(data, 0);
3511 } else {
3512 data.writeInt(0);
3513 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003514 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3515 reply.readException();
3516 data.recycle();
3517 reply.recycle();
3518 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003519 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3520 throws RemoteException {
3521 Parcel data = Parcel.obtain();
3522 Parcel reply = Parcel.obtain();
3523 data.writeInterfaceToken(IActivityManager.descriptor);
3524 data.writeStrongBinder(token);
3525 data.writeInt(nonRoot ? 1 : 0);
3526 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3527 reply.readException();
3528 boolean res = reply.readInt() != 0;
3529 data.recycle();
3530 reply.recycle();
3531 return res;
3532 }
3533 public void moveTaskBackwards(int task) throws RemoteException
3534 {
3535 Parcel data = Parcel.obtain();
3536 Parcel reply = Parcel.obtain();
3537 data.writeInterfaceToken(IActivityManager.descriptor);
3538 data.writeInt(task);
3539 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3540 reply.readException();
3541 data.recycle();
3542 reply.recycle();
3543 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003544 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003545 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3546 {
3547 Parcel data = Parcel.obtain();
3548 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003549 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003550 data.writeInt(taskId);
3551 data.writeInt(stackId);
3552 data.writeInt(toTop ? 1 : 0);
3553 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3554 reply.readException();
3555 data.recycle();
3556 reply.recycle();
3557 }
3558 @Override
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003559 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop)
3560 throws RemoteException
3561 {
3562 Parcel data = Parcel.obtain();
3563 Parcel reply = Parcel.obtain();
3564 data.writeInterfaceToken(IActivityManager.descriptor);
3565 data.writeInt(taskId);
3566 data.writeInt(createMode);
3567 data.writeInt(toTop ? 1 : 0);
3568 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3569 reply.readException();
3570 data.recycle();
3571 reply.recycle();
3572 }
3573 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003574 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3575 throws RemoteException
3576 {
3577 Parcel data = Parcel.obtain();
3578 Parcel reply = Parcel.obtain();
3579 data.writeInterfaceToken(IActivityManager.descriptor);
3580 data.writeInt(stackId);
3581 r.writeToParcel(data, 0);
3582 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK, data, reply, 0);
3583 reply.readException();
3584 final boolean res = reply.readInt() != 0;
3585 data.recycle();
3586 reply.recycle();
3587 return res;
3588 }
3589 @Override
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003590 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode)
3591 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003592 {
3593 Parcel data = Parcel.obtain();
3594 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003595 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003596 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003597 if (r != null) {
3598 data.writeInt(1);
3599 r.writeToParcel(data, 0);
3600 } else {
3601 data.writeInt(0);
3602 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003603 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003604 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003605 reply.readException();
3606 data.recycle();
3607 reply.recycle();
3608 }
Craig Mautner967212c2013-04-13 21:10:58 -07003609 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003610 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3611 {
3612 Parcel data = Parcel.obtain();
3613 Parcel reply = Parcel.obtain();
3614 data.writeInterfaceToken(IActivityManager.descriptor);
3615 data.writeInt(taskId);
3616 data.writeInt(stackId);
3617 data.writeInt(position);
3618 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3619 reply.readException();
3620 data.recycle();
3621 reply.recycle();
3622 }
3623 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003624 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003625 {
3626 Parcel data = Parcel.obtain();
3627 Parcel reply = Parcel.obtain();
3628 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003629 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003630 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003631 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003632 data.recycle();
3633 reply.recycle();
3634 return list;
3635 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003636 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003637 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003638 {
3639 Parcel data = Parcel.obtain();
3640 Parcel reply = Parcel.obtain();
3641 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003642 data.writeInt(stackId);
3643 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003644 reply.readException();
3645 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003646 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003647 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003648 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003649 }
3650 data.recycle();
3651 reply.recycle();
3652 return info;
3653 }
3654 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003655 public boolean isInHomeStack(int taskId) throws RemoteException {
3656 Parcel data = Parcel.obtain();
3657 Parcel reply = Parcel.obtain();
3658 data.writeInterfaceToken(IActivityManager.descriptor);
3659 data.writeInt(taskId);
3660 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3661 reply.readException();
3662 boolean isInHomeStack = reply.readInt() > 0;
3663 data.recycle();
3664 reply.recycle();
3665 return isInHomeStack;
3666 }
3667 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003668 public void setFocusedStack(int stackId) throws RemoteException
3669 {
3670 Parcel data = Parcel.obtain();
3671 Parcel reply = Parcel.obtain();
3672 data.writeInterfaceToken(IActivityManager.descriptor);
3673 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003674 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003675 reply.readException();
3676 data.recycle();
3677 reply.recycle();
3678 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003679 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003680 public int getFocusedStackId() throws RemoteException {
3681 Parcel data = Parcel.obtain();
3682 Parcel reply = Parcel.obtain();
3683 data.writeInterfaceToken(IActivityManager.descriptor);
3684 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3685 reply.readException();
3686 int focusedStackId = reply.readInt();
3687 data.recycle();
3688 reply.recycle();
3689 return focusedStackId;
3690 }
3691 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003692 public void setFocusedTask(int taskId) throws RemoteException
3693 {
3694 Parcel data = Parcel.obtain();
3695 Parcel reply = Parcel.obtain();
3696 data.writeInterfaceToken(IActivityManager.descriptor);
3697 data.writeInt(taskId);
3698 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3699 reply.readException();
3700 data.recycle();
3701 reply.recycle();
3702 }
3703 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003704 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3705 {
3706 Parcel data = Parcel.obtain();
3707 Parcel reply = Parcel.obtain();
3708 data.writeInterfaceToken(IActivityManager.descriptor);
3709 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003710 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003711 reply.readException();
3712 data.recycle();
3713 reply.recycle();
3714 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003715 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3716 {
3717 Parcel data = Parcel.obtain();
3718 Parcel reply = Parcel.obtain();
3719 data.writeInterfaceToken(IActivityManager.descriptor);
3720 data.writeStrongBinder(token);
3721 data.writeInt(onlyRoot ? 1 : 0);
3722 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3723 reply.readException();
3724 int res = reply.readInt();
3725 data.recycle();
3726 reply.recycle();
3727 return res;
3728 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003729 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003730 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003731 Parcel data = Parcel.obtain();
3732 Parcel reply = Parcel.obtain();
3733 data.writeInterfaceToken(IActivityManager.descriptor);
3734 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3735 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003736 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003737 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003738 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3739 reply.readException();
3740 int res = reply.readInt();
3741 ContentProviderHolder cph = null;
3742 if (res != 0) {
3743 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3744 }
3745 data.recycle();
3746 reply.recycle();
3747 return cph;
3748 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003749 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3750 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003751 Parcel data = Parcel.obtain();
3752 Parcel reply = Parcel.obtain();
3753 data.writeInterfaceToken(IActivityManager.descriptor);
3754 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003755 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003756 data.writeStrongBinder(token);
3757 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3758 reply.readException();
3759 int res = reply.readInt();
3760 ContentProviderHolder cph = null;
3761 if (res != 0) {
3762 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3763 }
3764 data.recycle();
3765 reply.recycle();
3766 return cph;
3767 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003768 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003769 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003770 {
3771 Parcel data = Parcel.obtain();
3772 Parcel reply = Parcel.obtain();
3773 data.writeInterfaceToken(IActivityManager.descriptor);
3774 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3775 data.writeTypedList(providers);
3776 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3777 reply.readException();
3778 data.recycle();
3779 reply.recycle();
3780 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003781 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3782 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003783 Parcel data = Parcel.obtain();
3784 Parcel reply = Parcel.obtain();
3785 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003786 data.writeStrongBinder(connection);
3787 data.writeInt(stable);
3788 data.writeInt(unstable);
3789 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3790 reply.readException();
3791 boolean res = reply.readInt() != 0;
3792 data.recycle();
3793 reply.recycle();
3794 return res;
3795 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003796
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003797 public void unstableProviderDied(IBinder connection) throws RemoteException {
3798 Parcel data = Parcel.obtain();
3799 Parcel reply = Parcel.obtain();
3800 data.writeInterfaceToken(IActivityManager.descriptor);
3801 data.writeStrongBinder(connection);
3802 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3803 reply.readException();
3804 data.recycle();
3805 reply.recycle();
3806 }
3807
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003808 @Override
3809 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3810 Parcel data = Parcel.obtain();
3811 Parcel reply = Parcel.obtain();
3812 data.writeInterfaceToken(IActivityManager.descriptor);
3813 data.writeStrongBinder(connection);
3814 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3815 reply.readException();
3816 data.recycle();
3817 reply.recycle();
3818 }
3819
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003820 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3821 Parcel data = Parcel.obtain();
3822 Parcel reply = Parcel.obtain();
3823 data.writeInterfaceToken(IActivityManager.descriptor);
3824 data.writeStrongBinder(connection);
3825 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003826 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3827 reply.readException();
3828 data.recycle();
3829 reply.recycle();
3830 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003831
3832 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3833 Parcel data = Parcel.obtain();
3834 Parcel reply = Parcel.obtain();
3835 data.writeInterfaceToken(IActivityManager.descriptor);
3836 data.writeString(name);
3837 data.writeStrongBinder(token);
3838 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3839 reply.readException();
3840 data.recycle();
3841 reply.recycle();
3842 }
3843
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003844 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3845 throws RemoteException
3846 {
3847 Parcel data = Parcel.obtain();
3848 Parcel reply = Parcel.obtain();
3849 data.writeInterfaceToken(IActivityManager.descriptor);
3850 service.writeToParcel(data, 0);
3851 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3852 reply.readException();
3853 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3854 data.recycle();
3855 reply.recycle();
3856 return res;
3857 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003858
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003859 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003860 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003861 {
3862 Parcel data = Parcel.obtain();
3863 Parcel reply = Parcel.obtain();
3864 data.writeInterfaceToken(IActivityManager.descriptor);
3865 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3866 service.writeToParcel(data, 0);
3867 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003868 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003869 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003870 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3871 reply.readException();
3872 ComponentName res = ComponentName.readFromParcel(reply);
3873 data.recycle();
3874 reply.recycle();
3875 return res;
3876 }
3877 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003878 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003879 {
3880 Parcel data = Parcel.obtain();
3881 Parcel reply = Parcel.obtain();
3882 data.writeInterfaceToken(IActivityManager.descriptor);
3883 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3884 service.writeToParcel(data, 0);
3885 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003886 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003887 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3888 reply.readException();
3889 int res = reply.readInt();
3890 reply.recycle();
3891 data.recycle();
3892 return res;
3893 }
3894 public boolean stopServiceToken(ComponentName className, IBinder token,
3895 int startId) throws RemoteException {
3896 Parcel data = Parcel.obtain();
3897 Parcel reply = Parcel.obtain();
3898 data.writeInterfaceToken(IActivityManager.descriptor);
3899 ComponentName.writeToParcel(className, data);
3900 data.writeStrongBinder(token);
3901 data.writeInt(startId);
3902 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3903 reply.readException();
3904 boolean res = reply.readInt() != 0;
3905 data.recycle();
3906 reply.recycle();
3907 return res;
3908 }
3909 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003910 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003911 Parcel data = Parcel.obtain();
3912 Parcel reply = Parcel.obtain();
3913 data.writeInterfaceToken(IActivityManager.descriptor);
3914 ComponentName.writeToParcel(className, data);
3915 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003916 data.writeInt(id);
3917 if (notification != null) {
3918 data.writeInt(1);
3919 notification.writeToParcel(data, 0);
3920 } else {
3921 data.writeInt(0);
3922 }
3923 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003924 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3925 reply.readException();
3926 data.recycle();
3927 reply.recycle();
3928 }
3929 public int bindService(IApplicationThread caller, IBinder token,
3930 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07003931 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003932 Parcel data = Parcel.obtain();
3933 Parcel reply = Parcel.obtain();
3934 data.writeInterfaceToken(IActivityManager.descriptor);
3935 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3936 data.writeStrongBinder(token);
3937 service.writeToParcel(data, 0);
3938 data.writeString(resolvedType);
3939 data.writeStrongBinder(connection.asBinder());
3940 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07003941 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003942 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003943 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3944 reply.readException();
3945 int res = reply.readInt();
3946 data.recycle();
3947 reply.recycle();
3948 return res;
3949 }
3950 public boolean unbindService(IServiceConnection connection) throws RemoteException
3951 {
3952 Parcel data = Parcel.obtain();
3953 Parcel reply = Parcel.obtain();
3954 data.writeInterfaceToken(IActivityManager.descriptor);
3955 data.writeStrongBinder(connection.asBinder());
3956 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3957 reply.readException();
3958 boolean res = reply.readInt() != 0;
3959 data.recycle();
3960 reply.recycle();
3961 return res;
3962 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003963
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003964 public void publishService(IBinder token,
3965 Intent intent, IBinder service) throws RemoteException {
3966 Parcel data = Parcel.obtain();
3967 Parcel reply = Parcel.obtain();
3968 data.writeInterfaceToken(IActivityManager.descriptor);
3969 data.writeStrongBinder(token);
3970 intent.writeToParcel(data, 0);
3971 data.writeStrongBinder(service);
3972 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3973 reply.readException();
3974 data.recycle();
3975 reply.recycle();
3976 }
3977
3978 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3979 throws RemoteException {
3980 Parcel data = Parcel.obtain();
3981 Parcel reply = Parcel.obtain();
3982 data.writeInterfaceToken(IActivityManager.descriptor);
3983 data.writeStrongBinder(token);
3984 intent.writeToParcel(data, 0);
3985 data.writeInt(doRebind ? 1 : 0);
3986 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3987 reply.readException();
3988 data.recycle();
3989 reply.recycle();
3990 }
3991
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003992 public void serviceDoneExecuting(IBinder token, int type, int startId,
3993 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003994 Parcel data = Parcel.obtain();
3995 Parcel reply = Parcel.obtain();
3996 data.writeInterfaceToken(IActivityManager.descriptor);
3997 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003998 data.writeInt(type);
3999 data.writeInt(startId);
4000 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004001 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4002 reply.readException();
4003 data.recycle();
4004 reply.recycle();
4005 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004006
Svet Ganov99b60432015-06-27 13:15:22 -07004007 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4008 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004009 Parcel data = Parcel.obtain();
4010 Parcel reply = Parcel.obtain();
4011 data.writeInterfaceToken(IActivityManager.descriptor);
4012 service.writeToParcel(data, 0);
4013 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004014 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004015 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4016 reply.readException();
4017 IBinder binder = reply.readStrongBinder();
4018 reply.recycle();
4019 data.recycle();
4020 return binder;
4021 }
4022
Christopher Tate181fafa2009-05-14 11:12:14 -07004023 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4024 throws RemoteException {
4025 Parcel data = Parcel.obtain();
4026 Parcel reply = Parcel.obtain();
4027 data.writeInterfaceToken(IActivityManager.descriptor);
4028 app.writeToParcel(data, 0);
4029 data.writeInt(backupRestoreMode);
4030 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4031 reply.readException();
4032 boolean success = reply.readInt() != 0;
4033 reply.recycle();
4034 data.recycle();
4035 return success;
4036 }
4037
Christopher Tate346acb12012-10-15 19:20:25 -07004038 public void clearPendingBackup() throws RemoteException {
4039 Parcel data = Parcel.obtain();
4040 Parcel reply = Parcel.obtain();
4041 data.writeInterfaceToken(IActivityManager.descriptor);
4042 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4043 reply.recycle();
4044 data.recycle();
4045 }
4046
Christopher Tate181fafa2009-05-14 11:12:14 -07004047 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4048 Parcel data = Parcel.obtain();
4049 Parcel reply = Parcel.obtain();
4050 data.writeInterfaceToken(IActivityManager.descriptor);
4051 data.writeString(packageName);
4052 data.writeStrongBinder(agent);
4053 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4054 reply.recycle();
4055 data.recycle();
4056 }
4057
4058 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4059 Parcel data = Parcel.obtain();
4060 Parcel reply = Parcel.obtain();
4061 data.writeInterfaceToken(IActivityManager.descriptor);
4062 app.writeToParcel(data, 0);
4063 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4064 reply.readException();
4065 reply.recycle();
4066 data.recycle();
4067 }
4068
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004069 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004070 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004071 IUiAutomationConnection connection, int userId, String instructionSet)
4072 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004073 Parcel data = Parcel.obtain();
4074 Parcel reply = Parcel.obtain();
4075 data.writeInterfaceToken(IActivityManager.descriptor);
4076 ComponentName.writeToParcel(className, data);
4077 data.writeString(profileFile);
4078 data.writeInt(flags);
4079 data.writeBundle(arguments);
4080 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004081 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004082 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004083 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004084 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4085 reply.readException();
4086 boolean res = reply.readInt() != 0;
4087 reply.recycle();
4088 data.recycle();
4089 return res;
4090 }
4091
4092 public void finishInstrumentation(IApplicationThread target,
4093 int resultCode, Bundle results) throws RemoteException {
4094 Parcel data = Parcel.obtain();
4095 Parcel reply = Parcel.obtain();
4096 data.writeInterfaceToken(IActivityManager.descriptor);
4097 data.writeStrongBinder(target != null ? target.asBinder() : null);
4098 data.writeInt(resultCode);
4099 data.writeBundle(results);
4100 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4101 reply.readException();
4102 data.recycle();
4103 reply.recycle();
4104 }
4105 public Configuration getConfiguration() throws RemoteException
4106 {
4107 Parcel data = Parcel.obtain();
4108 Parcel reply = Parcel.obtain();
4109 data.writeInterfaceToken(IActivityManager.descriptor);
4110 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4111 reply.readException();
4112 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4113 reply.recycle();
4114 data.recycle();
4115 return res;
4116 }
4117 public void updateConfiguration(Configuration values) throws RemoteException
4118 {
4119 Parcel data = Parcel.obtain();
4120 Parcel reply = Parcel.obtain();
4121 data.writeInterfaceToken(IActivityManager.descriptor);
4122 values.writeToParcel(data, 0);
4123 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4124 reply.readException();
4125 data.recycle();
4126 reply.recycle();
4127 }
4128 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4129 throws RemoteException {
4130 Parcel data = Parcel.obtain();
4131 Parcel reply = Parcel.obtain();
4132 data.writeInterfaceToken(IActivityManager.descriptor);
4133 data.writeStrongBinder(token);
4134 data.writeInt(requestedOrientation);
4135 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4136 reply.readException();
4137 data.recycle();
4138 reply.recycle();
4139 }
4140 public int getRequestedOrientation(IBinder token) throws RemoteException {
4141 Parcel data = Parcel.obtain();
4142 Parcel reply = Parcel.obtain();
4143 data.writeInterfaceToken(IActivityManager.descriptor);
4144 data.writeStrongBinder(token);
4145 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4146 reply.readException();
4147 int res = reply.readInt();
4148 data.recycle();
4149 reply.recycle();
4150 return res;
4151 }
4152 public ComponentName getActivityClassForToken(IBinder token)
4153 throws RemoteException {
4154 Parcel data = Parcel.obtain();
4155 Parcel reply = Parcel.obtain();
4156 data.writeInterfaceToken(IActivityManager.descriptor);
4157 data.writeStrongBinder(token);
4158 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4159 reply.readException();
4160 ComponentName res = ComponentName.readFromParcel(reply);
4161 data.recycle();
4162 reply.recycle();
4163 return res;
4164 }
4165 public String getPackageForToken(IBinder token) throws RemoteException
4166 {
4167 Parcel data = Parcel.obtain();
4168 Parcel reply = Parcel.obtain();
4169 data.writeInterfaceToken(IActivityManager.descriptor);
4170 data.writeStrongBinder(token);
4171 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4172 reply.readException();
4173 String res = reply.readString();
4174 data.recycle();
4175 reply.recycle();
4176 return res;
4177 }
4178 public IIntentSender getIntentSender(int type,
4179 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004180 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004181 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004182 Parcel data = Parcel.obtain();
4183 Parcel reply = Parcel.obtain();
4184 data.writeInterfaceToken(IActivityManager.descriptor);
4185 data.writeInt(type);
4186 data.writeString(packageName);
4187 data.writeStrongBinder(token);
4188 data.writeString(resultWho);
4189 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004190 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004191 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004192 data.writeTypedArray(intents, 0);
4193 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004194 } else {
4195 data.writeInt(0);
4196 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004197 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004198 if (options != null) {
4199 data.writeInt(1);
4200 options.writeToParcel(data, 0);
4201 } else {
4202 data.writeInt(0);
4203 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004204 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004205 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4206 reply.readException();
4207 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004208 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004209 data.recycle();
4210 reply.recycle();
4211 return res;
4212 }
4213 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4214 Parcel data = Parcel.obtain();
4215 Parcel reply = Parcel.obtain();
4216 data.writeInterfaceToken(IActivityManager.descriptor);
4217 data.writeStrongBinder(sender.asBinder());
4218 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4219 reply.readException();
4220 data.recycle();
4221 reply.recycle();
4222 }
4223 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4224 Parcel data = Parcel.obtain();
4225 Parcel reply = Parcel.obtain();
4226 data.writeInterfaceToken(IActivityManager.descriptor);
4227 data.writeStrongBinder(sender.asBinder());
4228 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4229 reply.readException();
4230 String res = reply.readString();
4231 data.recycle();
4232 reply.recycle();
4233 return res;
4234 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004235 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4236 Parcel data = Parcel.obtain();
4237 Parcel reply = Parcel.obtain();
4238 data.writeInterfaceToken(IActivityManager.descriptor);
4239 data.writeStrongBinder(sender.asBinder());
4240 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4241 reply.readException();
4242 int res = reply.readInt();
4243 data.recycle();
4244 reply.recycle();
4245 return res;
4246 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004247 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4248 boolean requireFull, String name, String callerPackage) throws RemoteException {
4249 Parcel data = Parcel.obtain();
4250 Parcel reply = Parcel.obtain();
4251 data.writeInterfaceToken(IActivityManager.descriptor);
4252 data.writeInt(callingPid);
4253 data.writeInt(callingUid);
4254 data.writeInt(userId);
4255 data.writeInt(allowAll ? 1 : 0);
4256 data.writeInt(requireFull ? 1 : 0);
4257 data.writeString(name);
4258 data.writeString(callerPackage);
4259 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4260 reply.readException();
4261 int res = reply.readInt();
4262 data.recycle();
4263 reply.recycle();
4264 return res;
4265 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004266 public void setProcessLimit(int max) throws RemoteException
4267 {
4268 Parcel data = Parcel.obtain();
4269 Parcel reply = Parcel.obtain();
4270 data.writeInterfaceToken(IActivityManager.descriptor);
4271 data.writeInt(max);
4272 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4273 reply.readException();
4274 data.recycle();
4275 reply.recycle();
4276 }
4277 public int getProcessLimit() throws RemoteException
4278 {
4279 Parcel data = Parcel.obtain();
4280 Parcel reply = Parcel.obtain();
4281 data.writeInterfaceToken(IActivityManager.descriptor);
4282 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4283 reply.readException();
4284 int res = reply.readInt();
4285 data.recycle();
4286 reply.recycle();
4287 return res;
4288 }
4289 public void setProcessForeground(IBinder token, int pid,
4290 boolean isForeground) throws RemoteException {
4291 Parcel data = Parcel.obtain();
4292 Parcel reply = Parcel.obtain();
4293 data.writeInterfaceToken(IActivityManager.descriptor);
4294 data.writeStrongBinder(token);
4295 data.writeInt(pid);
4296 data.writeInt(isForeground ? 1 : 0);
4297 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4298 reply.readException();
4299 data.recycle();
4300 reply.recycle();
4301 }
4302 public int checkPermission(String permission, int pid, int uid)
4303 throws RemoteException {
4304 Parcel data = Parcel.obtain();
4305 Parcel reply = Parcel.obtain();
4306 data.writeInterfaceToken(IActivityManager.descriptor);
4307 data.writeString(permission);
4308 data.writeInt(pid);
4309 data.writeInt(uid);
4310 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4311 reply.readException();
4312 int res = reply.readInt();
4313 data.recycle();
4314 reply.recycle();
4315 return res;
4316 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004317 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4318 throws RemoteException {
4319 Parcel data = Parcel.obtain();
4320 Parcel reply = Parcel.obtain();
4321 data.writeInterfaceToken(IActivityManager.descriptor);
4322 data.writeString(permission);
4323 data.writeInt(pid);
4324 data.writeInt(uid);
4325 data.writeStrongBinder(callerToken);
4326 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4327 reply.readException();
4328 int res = reply.readInt();
4329 data.recycle();
4330 reply.recycle();
4331 return res;
4332 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004333 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004334 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004335 Parcel data = Parcel.obtain();
4336 Parcel reply = Parcel.obtain();
4337 data.writeInterfaceToken(IActivityManager.descriptor);
4338 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004339 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004340 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004341 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4342 reply.readException();
4343 boolean res = reply.readInt() != 0;
4344 data.recycle();
4345 reply.recycle();
4346 return res;
4347 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004348 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4349 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004350 Parcel data = Parcel.obtain();
4351 Parcel reply = Parcel.obtain();
4352 data.writeInterfaceToken(IActivityManager.descriptor);
4353 uri.writeToParcel(data, 0);
4354 data.writeInt(pid);
4355 data.writeInt(uid);
4356 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004357 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004358 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004359 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4360 reply.readException();
4361 int res = reply.readInt();
4362 data.recycle();
4363 reply.recycle();
4364 return res;
4365 }
4366 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004367 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004368 Parcel data = Parcel.obtain();
4369 Parcel reply = Parcel.obtain();
4370 data.writeInterfaceToken(IActivityManager.descriptor);
4371 data.writeStrongBinder(caller.asBinder());
4372 data.writeString(targetPkg);
4373 uri.writeToParcel(data, 0);
4374 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004375 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004376 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4377 reply.readException();
4378 data.recycle();
4379 reply.recycle();
4380 }
4381 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004382 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004383 Parcel data = Parcel.obtain();
4384 Parcel reply = Parcel.obtain();
4385 data.writeInterfaceToken(IActivityManager.descriptor);
4386 data.writeStrongBinder(caller.asBinder());
4387 uri.writeToParcel(data, 0);
4388 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004389 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004390 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4391 reply.readException();
4392 data.recycle();
4393 reply.recycle();
4394 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004395
4396 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004397 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4398 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004399 Parcel data = Parcel.obtain();
4400 Parcel reply = Parcel.obtain();
4401 data.writeInterfaceToken(IActivityManager.descriptor);
4402 uri.writeToParcel(data, 0);
4403 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004404 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004405 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4406 reply.readException();
4407 data.recycle();
4408 reply.recycle();
4409 }
4410
4411 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004412 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4413 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004414 Parcel data = Parcel.obtain();
4415 Parcel reply = Parcel.obtain();
4416 data.writeInterfaceToken(IActivityManager.descriptor);
4417 uri.writeToParcel(data, 0);
4418 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004419 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004420 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4421 reply.readException();
4422 data.recycle();
4423 reply.recycle();
4424 }
4425
4426 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004427 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4428 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004429 Parcel data = Parcel.obtain();
4430 Parcel reply = Parcel.obtain();
4431 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004432 data.writeString(packageName);
4433 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004434 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4435 reply.readException();
4436 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4437 reply);
4438 data.recycle();
4439 reply.recycle();
4440 return perms;
4441 }
4442
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004443 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4444 throws RemoteException {
4445 Parcel data = Parcel.obtain();
4446 Parcel reply = Parcel.obtain();
4447 data.writeInterfaceToken(IActivityManager.descriptor);
4448 data.writeStrongBinder(who.asBinder());
4449 data.writeInt(waiting ? 1 : 0);
4450 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4451 reply.readException();
4452 data.recycle();
4453 reply.recycle();
4454 }
4455 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4456 Parcel data = Parcel.obtain();
4457 Parcel reply = Parcel.obtain();
4458 data.writeInterfaceToken(IActivityManager.descriptor);
4459 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4460 reply.readException();
4461 outInfo.readFromParcel(reply);
4462 data.recycle();
4463 reply.recycle();
4464 }
4465 public void unhandledBack() throws RemoteException
4466 {
4467 Parcel data = Parcel.obtain();
4468 Parcel reply = Parcel.obtain();
4469 data.writeInterfaceToken(IActivityManager.descriptor);
4470 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4471 reply.readException();
4472 data.recycle();
4473 reply.recycle();
4474 }
4475 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4476 {
4477 Parcel data = Parcel.obtain();
4478 Parcel reply = Parcel.obtain();
4479 data.writeInterfaceToken(IActivityManager.descriptor);
4480 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4481 reply.readException();
4482 ParcelFileDescriptor pfd = null;
4483 if (reply.readInt() != 0) {
4484 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4485 }
4486 data.recycle();
4487 reply.recycle();
4488 return pfd;
4489 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004490 public void setLockScreenShown(boolean shown) throws RemoteException
4491 {
4492 Parcel data = Parcel.obtain();
4493 Parcel reply = Parcel.obtain();
4494 data.writeInterfaceToken(IActivityManager.descriptor);
4495 data.writeInt(shown ? 1 : 0);
4496 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4497 reply.readException();
4498 data.recycle();
4499 reply.recycle();
4500 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004501 public void setDebugApp(
4502 String packageName, boolean waitForDebugger, boolean persistent)
4503 throws RemoteException
4504 {
4505 Parcel data = Parcel.obtain();
4506 Parcel reply = Parcel.obtain();
4507 data.writeInterfaceToken(IActivityManager.descriptor);
4508 data.writeString(packageName);
4509 data.writeInt(waitForDebugger ? 1 : 0);
4510 data.writeInt(persistent ? 1 : 0);
4511 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4512 reply.readException();
4513 data.recycle();
4514 reply.recycle();
4515 }
4516 public void setAlwaysFinish(boolean enabled) throws RemoteException
4517 {
4518 Parcel data = Parcel.obtain();
4519 Parcel reply = Parcel.obtain();
4520 data.writeInterfaceToken(IActivityManager.descriptor);
4521 data.writeInt(enabled ? 1 : 0);
4522 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4523 reply.readException();
4524 data.recycle();
4525 reply.recycle();
4526 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004527 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004528 {
4529 Parcel data = Parcel.obtain();
4530 Parcel reply = Parcel.obtain();
4531 data.writeInterfaceToken(IActivityManager.descriptor);
4532 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004533 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004534 reply.readException();
4535 data.recycle();
4536 reply.recycle();
4537 }
4538 public void enterSafeMode() throws RemoteException {
4539 Parcel data = Parcel.obtain();
4540 data.writeInterfaceToken(IActivityManager.descriptor);
4541 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4542 data.recycle();
4543 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004544 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004545 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004546 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004547 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004548 data.writeStrongBinder(sender.asBinder());
4549 data.writeInt(sourceUid);
4550 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004551 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004552 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4553 data.recycle();
4554 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004555 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4556 throws RemoteException {
4557 Parcel data = Parcel.obtain();
4558 data.writeInterfaceToken(IActivityManager.descriptor);
4559 data.writeStrongBinder(sender.asBinder());
4560 data.writeInt(sourceUid);
4561 data.writeString(tag);
4562 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4563 data.recycle();
4564 }
4565 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4566 throws RemoteException {
4567 Parcel data = Parcel.obtain();
4568 data.writeInterfaceToken(IActivityManager.descriptor);
4569 data.writeStrongBinder(sender.asBinder());
4570 data.writeInt(sourceUid);
4571 data.writeString(tag);
4572 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4573 data.recycle();
4574 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004575 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004576 Parcel data = Parcel.obtain();
4577 Parcel reply = Parcel.obtain();
4578 data.writeInterfaceToken(IActivityManager.descriptor);
4579 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004580 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004581 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004582 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004583 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004584 boolean res = reply.readInt() != 0;
4585 data.recycle();
4586 reply.recycle();
4587 return res;
4588 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004589 @Override
4590 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4591 Parcel data = Parcel.obtain();
4592 Parcel reply = Parcel.obtain();
4593 data.writeInterfaceToken(IActivityManager.descriptor);
4594 data.writeString(reason);
4595 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4596 boolean res = reply.readInt() != 0;
4597 data.recycle();
4598 reply.recycle();
4599 return res;
4600 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004601 public boolean testIsSystemReady()
4602 {
4603 /* this base class version is never called */
4604 return true;
4605 }
Dan Egnor60d87622009-12-16 16:32:58 -08004606 public void handleApplicationCrash(IBinder app,
4607 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4608 {
4609 Parcel data = Parcel.obtain();
4610 Parcel reply = Parcel.obtain();
4611 data.writeInterfaceToken(IActivityManager.descriptor);
4612 data.writeStrongBinder(app);
4613 crashInfo.writeToParcel(data, 0);
4614 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4615 reply.readException();
4616 reply.recycle();
4617 data.recycle();
4618 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004619
Dianne Hackborn52322712014-08-26 22:47:26 -07004620 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004621 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004622 {
4623 Parcel data = Parcel.obtain();
4624 Parcel reply = Parcel.obtain();
4625 data.writeInterfaceToken(IActivityManager.descriptor);
4626 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004627 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004628 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004629 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004630 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004631 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004632 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004633 reply.recycle();
4634 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004635 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004636 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004637
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004638 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004639 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004640 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004641 {
4642 Parcel data = Parcel.obtain();
4643 Parcel reply = Parcel.obtain();
4644 data.writeInterfaceToken(IActivityManager.descriptor);
4645 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004646 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004647 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004648 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4649 reply.readException();
4650 reply.recycle();
4651 data.recycle();
4652 }
4653
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004654 public void signalPersistentProcesses(int sig) throws RemoteException {
4655 Parcel data = Parcel.obtain();
4656 Parcel reply = Parcel.obtain();
4657 data.writeInterfaceToken(IActivityManager.descriptor);
4658 data.writeInt(sig);
4659 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4660 reply.readException();
4661 data.recycle();
4662 reply.recycle();
4663 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004664
Dianne Hackborn1676c852012-09-10 14:52:30 -07004665 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004666 Parcel data = Parcel.obtain();
4667 Parcel reply = Parcel.obtain();
4668 data.writeInterfaceToken(IActivityManager.descriptor);
4669 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004670 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004671 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4672 reply.readException();
4673 data.recycle();
4674 reply.recycle();
4675 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004676
4677 public void killAllBackgroundProcesses() throws RemoteException {
4678 Parcel data = Parcel.obtain();
4679 Parcel reply = Parcel.obtain();
4680 data.writeInterfaceToken(IActivityManager.descriptor);
4681 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4682 reply.readException();
4683 data.recycle();
4684 reply.recycle();
4685 }
4686
Dianne Hackborn1676c852012-09-10 14:52:30 -07004687 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004688 Parcel data = Parcel.obtain();
4689 Parcel reply = Parcel.obtain();
4690 data.writeInterfaceToken(IActivityManager.descriptor);
4691 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004692 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004693 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004694 reply.readException();
4695 data.recycle();
4696 reply.recycle();
4697 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004698
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004699 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4700 throws RemoteException
4701 {
4702 Parcel data = Parcel.obtain();
4703 Parcel reply = Parcel.obtain();
4704 data.writeInterfaceToken(IActivityManager.descriptor);
4705 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4706 reply.readException();
4707 outInfo.readFromParcel(reply);
4708 reply.recycle();
4709 data.recycle();
4710 }
4711
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004712 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4713 {
4714 Parcel data = Parcel.obtain();
4715 Parcel reply = Parcel.obtain();
4716 data.writeInterfaceToken(IActivityManager.descriptor);
4717 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4718 reply.readException();
4719 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4720 reply.recycle();
4721 data.recycle();
4722 return res;
4723 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004724
Dianne Hackborn1676c852012-09-10 14:52:30 -07004725 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004726 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004727 {
4728 Parcel data = Parcel.obtain();
4729 Parcel reply = Parcel.obtain();
4730 data.writeInterfaceToken(IActivityManager.descriptor);
4731 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004732 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004733 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004734 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004735 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004736 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004737 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004738 } else {
4739 data.writeInt(0);
4740 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004741 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4742 reply.readException();
4743 boolean res = reply.readInt() != 0;
4744 reply.recycle();
4745 data.recycle();
4746 return res;
4747 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004748
Dianne Hackborn55280a92009-05-07 15:53:46 -07004749 public boolean shutdown(int timeout) throws RemoteException
4750 {
4751 Parcel data = Parcel.obtain();
4752 Parcel reply = Parcel.obtain();
4753 data.writeInterfaceToken(IActivityManager.descriptor);
4754 data.writeInt(timeout);
4755 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4756 reply.readException();
4757 boolean res = reply.readInt() != 0;
4758 reply.recycle();
4759 data.recycle();
4760 return res;
4761 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004762
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004763 public void stopAppSwitches() throws RemoteException {
4764 Parcel data = Parcel.obtain();
4765 Parcel reply = Parcel.obtain();
4766 data.writeInterfaceToken(IActivityManager.descriptor);
4767 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4768 reply.readException();
4769 reply.recycle();
4770 data.recycle();
4771 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004772
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004773 public void resumeAppSwitches() throws RemoteException {
4774 Parcel data = Parcel.obtain();
4775 Parcel reply = Parcel.obtain();
4776 data.writeInterfaceToken(IActivityManager.descriptor);
4777 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4778 reply.readException();
4779 reply.recycle();
4780 data.recycle();
4781 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004782
4783 public void addPackageDependency(String packageName) throws RemoteException {
4784 Parcel data = Parcel.obtain();
4785 Parcel reply = Parcel.obtain();
4786 data.writeInterfaceToken(IActivityManager.descriptor);
4787 data.writeString(packageName);
4788 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4789 reply.readException();
4790 data.recycle();
4791 reply.recycle();
4792 }
4793
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004794 public void killApplicationWithAppId(String pkg, int appid, String reason)
4795 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004796 Parcel data = Parcel.obtain();
4797 Parcel reply = Parcel.obtain();
4798 data.writeInterfaceToken(IActivityManager.descriptor);
4799 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004800 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004801 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004802 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004803 reply.readException();
4804 data.recycle();
4805 reply.recycle();
4806 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004807
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004808 public void closeSystemDialogs(String reason) throws RemoteException {
4809 Parcel data = Parcel.obtain();
4810 Parcel reply = Parcel.obtain();
4811 data.writeInterfaceToken(IActivityManager.descriptor);
4812 data.writeString(reason);
4813 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4814 reply.readException();
4815 data.recycle();
4816 reply.recycle();
4817 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004818
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004819 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004820 throws RemoteException {
4821 Parcel data = Parcel.obtain();
4822 Parcel reply = Parcel.obtain();
4823 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004824 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004825 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4826 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004827 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004828 data.recycle();
4829 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004830 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004831 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004832
4833 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4834 Parcel data = Parcel.obtain();
4835 Parcel reply = Parcel.obtain();
4836 data.writeInterfaceToken(IActivityManager.descriptor);
4837 data.writeString(processName);
4838 data.writeInt(uid);
4839 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4840 reply.readException();
4841 data.recycle();
4842 reply.recycle();
4843 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004844
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004845 public void overridePendingTransition(IBinder token, String packageName,
4846 int enterAnim, int exitAnim) throws RemoteException {
4847 Parcel data = Parcel.obtain();
4848 Parcel reply = Parcel.obtain();
4849 data.writeInterfaceToken(IActivityManager.descriptor);
4850 data.writeStrongBinder(token);
4851 data.writeString(packageName);
4852 data.writeInt(enterAnim);
4853 data.writeInt(exitAnim);
4854 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4855 reply.readException();
4856 data.recycle();
4857 reply.recycle();
4858 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004859
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004860 public boolean isUserAMonkey() throws RemoteException {
4861 Parcel data = Parcel.obtain();
4862 Parcel reply = Parcel.obtain();
4863 data.writeInterfaceToken(IActivityManager.descriptor);
4864 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4865 reply.readException();
4866 boolean res = reply.readInt() != 0;
4867 data.recycle();
4868 reply.recycle();
4869 return res;
4870 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004871
4872 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4873 Parcel data = Parcel.obtain();
4874 Parcel reply = Parcel.obtain();
4875 data.writeInterfaceToken(IActivityManager.descriptor);
4876 data.writeInt(monkey ? 1 : 0);
4877 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4878 reply.readException();
4879 data.recycle();
4880 reply.recycle();
4881 }
4882
Dianne Hackborn860755f2010-06-03 18:47:52 -07004883 public void finishHeavyWeightApp() throws RemoteException {
4884 Parcel data = Parcel.obtain();
4885 Parcel reply = Parcel.obtain();
4886 data.writeInterfaceToken(IActivityManager.descriptor);
4887 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4888 reply.readException();
4889 data.recycle();
4890 reply.recycle();
4891 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004892
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004893 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004894 throws RemoteException {
4895 Parcel data = Parcel.obtain();
4896 Parcel reply = Parcel.obtain();
4897 data.writeInterfaceToken(IActivityManager.descriptor);
4898 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004899 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4900 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004901 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004902 data.recycle();
4903 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004904 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004905 }
4906
Craig Mautner233ceee2014-05-09 17:05:11 -07004907 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004908 throws RemoteException {
4909 Parcel data = Parcel.obtain();
4910 Parcel reply = Parcel.obtain();
4911 data.writeInterfaceToken(IActivityManager.descriptor);
4912 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004913 if (options == null) {
4914 data.writeInt(0);
4915 } else {
4916 data.writeInt(1);
4917 data.writeBundle(options.toBundle());
4918 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004919 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004920 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004921 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004922 data.recycle();
4923 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004924 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004925 }
4926
Craig Mautner233ceee2014-05-09 17:05:11 -07004927 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4928 Parcel data = Parcel.obtain();
4929 Parcel reply = Parcel.obtain();
4930 data.writeInterfaceToken(IActivityManager.descriptor);
4931 data.writeStrongBinder(token);
4932 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4933 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08004934 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07004935 data.recycle();
4936 reply.recycle();
4937 return options;
4938 }
4939
Daniel Sandler69a48172010-06-23 16:29:36 -04004940 public void setImmersive(IBinder token, boolean immersive)
4941 throws RemoteException {
4942 Parcel data = Parcel.obtain();
4943 Parcel reply = Parcel.obtain();
4944 data.writeInterfaceToken(IActivityManager.descriptor);
4945 data.writeStrongBinder(token);
4946 data.writeInt(immersive ? 1 : 0);
4947 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4948 reply.readException();
4949 data.recycle();
4950 reply.recycle();
4951 }
4952
4953 public boolean isImmersive(IBinder token)
4954 throws RemoteException {
4955 Parcel data = Parcel.obtain();
4956 Parcel reply = Parcel.obtain();
4957 data.writeInterfaceToken(IActivityManager.descriptor);
4958 data.writeStrongBinder(token);
4959 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004960 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004961 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004962 data.recycle();
4963 reply.recycle();
4964 return res;
4965 }
4966
Craig Mautnerd61dc202014-07-07 11:09:11 -07004967 public boolean isTopOfTask(IBinder token) throws RemoteException {
4968 Parcel data = Parcel.obtain();
4969 Parcel reply = Parcel.obtain();
4970 data.writeInterfaceToken(IActivityManager.descriptor);
4971 data.writeStrongBinder(token);
4972 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4973 reply.readException();
4974 boolean res = reply.readInt() == 1;
4975 data.recycle();
4976 reply.recycle();
4977 return res;
4978 }
4979
Daniel Sandler69a48172010-06-23 16:29:36 -04004980 public boolean isTopActivityImmersive()
4981 throws RemoteException {
4982 Parcel data = Parcel.obtain();
4983 Parcel reply = Parcel.obtain();
4984 data.writeInterfaceToken(IActivityManager.descriptor);
4985 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004986 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004987 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004988 data.recycle();
4989 reply.recycle();
4990 return res;
4991 }
4992
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004993 public void crashApplication(int uid, int initialPid, String packageName,
4994 String message) throws RemoteException {
4995 Parcel data = Parcel.obtain();
4996 Parcel reply = Parcel.obtain();
4997 data.writeInterfaceToken(IActivityManager.descriptor);
4998 data.writeInt(uid);
4999 data.writeInt(initialPid);
5000 data.writeString(packageName);
5001 data.writeString(message);
5002 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5003 reply.readException();
5004 data.recycle();
5005 reply.recycle();
5006 }
Andy McFadden824c5102010-07-09 16:26:57 -07005007
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005008 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005009 Parcel data = Parcel.obtain();
5010 Parcel reply = Parcel.obtain();
5011 data.writeInterfaceToken(IActivityManager.descriptor);
5012 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005013 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005014 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5015 reply.readException();
5016 String res = reply.readString();
5017 data.recycle();
5018 reply.recycle();
5019 return res;
5020 }
5021
Dianne Hackborn7e269642010-08-25 19:50:20 -07005022 public IBinder newUriPermissionOwner(String name)
5023 throws RemoteException {
5024 Parcel data = Parcel.obtain();
5025 Parcel reply = Parcel.obtain();
5026 data.writeInterfaceToken(IActivityManager.descriptor);
5027 data.writeString(name);
5028 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5029 reply.readException();
5030 IBinder res = reply.readStrongBinder();
5031 data.recycle();
5032 reply.recycle();
5033 return res;
5034 }
5035
5036 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005037 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005038 Parcel data = Parcel.obtain();
5039 Parcel reply = Parcel.obtain();
5040 data.writeInterfaceToken(IActivityManager.descriptor);
5041 data.writeStrongBinder(owner);
5042 data.writeInt(fromUid);
5043 data.writeString(targetPkg);
5044 uri.writeToParcel(data, 0);
5045 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005046 data.writeInt(sourceUserId);
5047 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005048 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5049 reply.readException();
5050 data.recycle();
5051 reply.recycle();
5052 }
5053
5054 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005055 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005056 Parcel data = Parcel.obtain();
5057 Parcel reply = Parcel.obtain();
5058 data.writeInterfaceToken(IActivityManager.descriptor);
5059 data.writeStrongBinder(owner);
5060 if (uri != null) {
5061 data.writeInt(1);
5062 uri.writeToParcel(data, 0);
5063 } else {
5064 data.writeInt(0);
5065 }
5066 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005067 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005068 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5069 reply.readException();
5070 data.recycle();
5071 reply.recycle();
5072 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005073
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005074 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005075 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005076 Parcel data = Parcel.obtain();
5077 Parcel reply = Parcel.obtain();
5078 data.writeInterfaceToken(IActivityManager.descriptor);
5079 data.writeInt(callingUid);
5080 data.writeString(targetPkg);
5081 uri.writeToParcel(data, 0);
5082 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005083 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005084 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5085 reply.readException();
5086 int res = reply.readInt();
5087 data.recycle();
5088 reply.recycle();
5089 return res;
5090 }
5091
Dianne Hackborn1676c852012-09-10 14:52:30 -07005092 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005093 String path, ParcelFileDescriptor fd) throws RemoteException {
5094 Parcel data = Parcel.obtain();
5095 Parcel reply = Parcel.obtain();
5096 data.writeInterfaceToken(IActivityManager.descriptor);
5097 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005098 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005099 data.writeInt(managed ? 1 : 0);
5100 data.writeString(path);
5101 if (fd != null) {
5102 data.writeInt(1);
5103 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5104 } else {
5105 data.writeInt(0);
5106 }
5107 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5108 reply.readException();
5109 boolean res = reply.readInt() != 0;
5110 reply.recycle();
5111 data.recycle();
5112 return res;
5113 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005114
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005115 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005116 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005117 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005118 Parcel data = Parcel.obtain();
5119 Parcel reply = Parcel.obtain();
5120 data.writeInterfaceToken(IActivityManager.descriptor);
5121 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005122 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005123 data.writeTypedArray(intents, 0);
5124 data.writeStringArray(resolvedTypes);
5125 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005126 if (options != null) {
5127 data.writeInt(1);
5128 options.writeToParcel(data, 0);
5129 } else {
5130 data.writeInt(0);
5131 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005132 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005133 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5134 reply.readException();
5135 int result = reply.readInt();
5136 reply.recycle();
5137 data.recycle();
5138 return result;
5139 }
5140
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005141 public int getFrontActivityScreenCompatMode() throws RemoteException {
5142 Parcel data = Parcel.obtain();
5143 Parcel reply = Parcel.obtain();
5144 data.writeInterfaceToken(IActivityManager.descriptor);
5145 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5146 reply.readException();
5147 int mode = reply.readInt();
5148 reply.recycle();
5149 data.recycle();
5150 return mode;
5151 }
5152
5153 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5154 Parcel data = Parcel.obtain();
5155 Parcel reply = Parcel.obtain();
5156 data.writeInterfaceToken(IActivityManager.descriptor);
5157 data.writeInt(mode);
5158 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5159 reply.readException();
5160 reply.recycle();
5161 data.recycle();
5162 }
5163
5164 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5165 Parcel data = Parcel.obtain();
5166 Parcel reply = Parcel.obtain();
5167 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005168 data.writeString(packageName);
5169 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005170 reply.readException();
5171 int mode = reply.readInt();
5172 reply.recycle();
5173 data.recycle();
5174 return mode;
5175 }
5176
5177 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005178 throws RemoteException {
5179 Parcel data = Parcel.obtain();
5180 Parcel reply = Parcel.obtain();
5181 data.writeInterfaceToken(IActivityManager.descriptor);
5182 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005183 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005184 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5185 reply.readException();
5186 reply.recycle();
5187 data.recycle();
5188 }
5189
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005190 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5191 Parcel data = Parcel.obtain();
5192 Parcel reply = Parcel.obtain();
5193 data.writeInterfaceToken(IActivityManager.descriptor);
5194 data.writeString(packageName);
5195 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5196 reply.readException();
5197 boolean ask = reply.readInt() != 0;
5198 reply.recycle();
5199 data.recycle();
5200 return ask;
5201 }
5202
5203 public void setPackageAskScreenCompat(String packageName, boolean ask)
5204 throws RemoteException {
5205 Parcel data = Parcel.obtain();
5206 Parcel reply = Parcel.obtain();
5207 data.writeInterfaceToken(IActivityManager.descriptor);
5208 data.writeString(packageName);
5209 data.writeInt(ask ? 1 : 0);
5210 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5211 reply.readException();
5212 reply.recycle();
5213 data.recycle();
5214 }
5215
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005216 public boolean switchUser(int userid) throws RemoteException {
5217 Parcel data = Parcel.obtain();
5218 Parcel reply = Parcel.obtain();
5219 data.writeInterfaceToken(IActivityManager.descriptor);
5220 data.writeInt(userid);
5221 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5222 reply.readException();
5223 boolean result = reply.readInt() != 0;
5224 reply.recycle();
5225 data.recycle();
5226 return result;
5227 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005228
Kenny Guy08488bf2014-02-21 17:40:37 +00005229 public boolean startUserInBackground(int userid) throws RemoteException {
5230 Parcel data = Parcel.obtain();
5231 Parcel reply = Parcel.obtain();
5232 data.writeInterfaceToken(IActivityManager.descriptor);
5233 data.writeInt(userid);
5234 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5235 reply.readException();
5236 boolean result = reply.readInt() != 0;
5237 reply.recycle();
5238 data.recycle();
5239 return result;
5240 }
5241
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005242 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5243 Parcel data = Parcel.obtain();
5244 Parcel reply = Parcel.obtain();
5245 data.writeInterfaceToken(IActivityManager.descriptor);
5246 data.writeInt(userid);
5247 data.writeStrongInterface(callback);
5248 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5249 reply.readException();
5250 int result = reply.readInt();
5251 reply.recycle();
5252 data.recycle();
5253 return result;
5254 }
5255
Amith Yamasani52f1d752012-03-28 18:19:29 -07005256 public UserInfo getCurrentUser() throws RemoteException {
5257 Parcel data = Parcel.obtain();
5258 Parcel reply = Parcel.obtain();
5259 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005260 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005261 reply.readException();
5262 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5263 reply.recycle();
5264 data.recycle();
5265 return userInfo;
5266 }
5267
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005268 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005269 Parcel data = Parcel.obtain();
5270 Parcel reply = Parcel.obtain();
5271 data.writeInterfaceToken(IActivityManager.descriptor);
5272 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005273 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005274 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5275 reply.readException();
5276 boolean result = reply.readInt() != 0;
5277 reply.recycle();
5278 data.recycle();
5279 return result;
5280 }
5281
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005282 public int[] getRunningUserIds() throws RemoteException {
5283 Parcel data = Parcel.obtain();
5284 Parcel reply = Parcel.obtain();
5285 data.writeInterfaceToken(IActivityManager.descriptor);
5286 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5287 reply.readException();
5288 int[] result = reply.createIntArray();
5289 reply.recycle();
5290 data.recycle();
5291 return result;
5292 }
5293
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005294 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005295 Parcel data = Parcel.obtain();
5296 Parcel reply = Parcel.obtain();
5297 data.writeInterfaceToken(IActivityManager.descriptor);
5298 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005299 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5300 reply.readException();
5301 boolean result = reply.readInt() != 0;
5302 reply.recycle();
5303 data.recycle();
5304 return result;
5305 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005306
Jeff Sharkeya4620792011-05-20 15:29:23 -07005307 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5308 Parcel data = Parcel.obtain();
5309 Parcel reply = Parcel.obtain();
5310 data.writeInterfaceToken(IActivityManager.descriptor);
5311 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5312 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5313 reply.readException();
5314 data.recycle();
5315 reply.recycle();
5316 }
5317
5318 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5319 Parcel data = Parcel.obtain();
5320 Parcel reply = Parcel.obtain();
5321 data.writeInterfaceToken(IActivityManager.descriptor);
5322 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5323 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5324 reply.readException();
5325 data.recycle();
5326 reply.recycle();
5327 }
5328
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005329 public void registerUidObserver(IUidObserver observer) throws RemoteException {
5330 Parcel data = Parcel.obtain();
5331 Parcel reply = Parcel.obtain();
5332 data.writeInterfaceToken(IActivityManager.descriptor);
5333 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5334 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5335 reply.readException();
5336 data.recycle();
5337 reply.recycle();
5338 }
5339
5340 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5341 Parcel data = Parcel.obtain();
5342 Parcel reply = Parcel.obtain();
5343 data.writeInterfaceToken(IActivityManager.descriptor);
5344 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5345 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5346 reply.readException();
5347 data.recycle();
5348 reply.recycle();
5349 }
5350
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005351 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5352 Parcel data = Parcel.obtain();
5353 Parcel reply = Parcel.obtain();
5354 data.writeInterfaceToken(IActivityManager.descriptor);
5355 data.writeStrongBinder(sender.asBinder());
5356 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5357 reply.readException();
5358 boolean res = reply.readInt() != 0;
5359 data.recycle();
5360 reply.recycle();
5361 return res;
5362 }
5363
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005364 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5365 Parcel data = Parcel.obtain();
5366 Parcel reply = Parcel.obtain();
5367 data.writeInterfaceToken(IActivityManager.descriptor);
5368 data.writeStrongBinder(sender.asBinder());
5369 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5370 reply.readException();
5371 boolean res = reply.readInt() != 0;
5372 data.recycle();
5373 reply.recycle();
5374 return res;
5375 }
5376
Dianne Hackborn81038902012-11-26 17:04:09 -08005377 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5378 Parcel data = Parcel.obtain();
5379 Parcel reply = Parcel.obtain();
5380 data.writeInterfaceToken(IActivityManager.descriptor);
5381 data.writeStrongBinder(sender.asBinder());
5382 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5383 reply.readException();
5384 Intent res = reply.readInt() != 0
5385 ? Intent.CREATOR.createFromParcel(reply) : null;
5386 data.recycle();
5387 reply.recycle();
5388 return res;
5389 }
5390
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005391 public String getTagForIntentSender(IIntentSender sender, String prefix)
5392 throws RemoteException {
5393 Parcel data = Parcel.obtain();
5394 Parcel reply = Parcel.obtain();
5395 data.writeInterfaceToken(IActivityManager.descriptor);
5396 data.writeStrongBinder(sender.asBinder());
5397 data.writeString(prefix);
5398 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5399 reply.readException();
5400 String res = reply.readString();
5401 data.recycle();
5402 reply.recycle();
5403 return res;
5404 }
5405
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005406 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5407 {
5408 Parcel data = Parcel.obtain();
5409 Parcel reply = Parcel.obtain();
5410 data.writeInterfaceToken(IActivityManager.descriptor);
5411 values.writeToParcel(data, 0);
5412 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5413 reply.readException();
5414 data.recycle();
5415 reply.recycle();
5416 }
5417
Dianne Hackbornb437e092011-08-05 17:50:29 -07005418 public long[] getProcessPss(int[] pids) throws RemoteException {
5419 Parcel data = Parcel.obtain();
5420 Parcel reply = Parcel.obtain();
5421 data.writeInterfaceToken(IActivityManager.descriptor);
5422 data.writeIntArray(pids);
5423 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5424 reply.readException();
5425 long[] res = reply.createLongArray();
5426 data.recycle();
5427 reply.recycle();
5428 return res;
5429 }
5430
Dianne Hackborn661cd522011-08-22 00:26:20 -07005431 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5432 Parcel data = Parcel.obtain();
5433 Parcel reply = Parcel.obtain();
5434 data.writeInterfaceToken(IActivityManager.descriptor);
5435 TextUtils.writeToParcel(msg, data, 0);
5436 data.writeInt(always ? 1 : 0);
5437 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5438 reply.readException();
5439 data.recycle();
5440 reply.recycle();
5441 }
5442
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005443 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005444 Parcel data = Parcel.obtain();
5445 Parcel reply = Parcel.obtain();
5446 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005447 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005448 reply.readException();
5449 data.recycle();
5450 reply.recycle();
5451 }
5452
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005453 public void keyguardGoingAway(boolean disableWindowAnimations,
5454 boolean keyguardGoingToNotificationShade) throws RemoteException {
5455 Parcel data = Parcel.obtain();
5456 Parcel reply = Parcel.obtain();
5457 data.writeInterfaceToken(IActivityManager.descriptor);
5458 data.writeInt(disableWindowAnimations ? 1 : 0);
5459 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5460 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5461 reply.readException();
5462 data.recycle();
5463 reply.recycle();
5464 }
5465
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005466 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005467 throws RemoteException {
5468 Parcel data = Parcel.obtain();
5469 Parcel reply = Parcel.obtain();
5470 data.writeInterfaceToken(IActivityManager.descriptor);
5471 data.writeStrongBinder(token);
5472 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005473 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005474 reply.readException();
5475 boolean result = reply.readInt() != 0;
5476 data.recycle();
5477 reply.recycle();
5478 return result;
5479 }
5480
5481 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5482 throws RemoteException {
5483 Parcel data = Parcel.obtain();
5484 Parcel reply = Parcel.obtain();
5485 data.writeInterfaceToken(IActivityManager.descriptor);
5486 data.writeStrongBinder(token);
5487 target.writeToParcel(data, 0);
5488 data.writeInt(resultCode);
5489 if (resultData != null) {
5490 data.writeInt(1);
5491 resultData.writeToParcel(data, 0);
5492 } else {
5493 data.writeInt(0);
5494 }
5495 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5496 reply.readException();
5497 boolean result = reply.readInt() != 0;
5498 data.recycle();
5499 reply.recycle();
5500 return result;
5501 }
5502
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005503 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5504 Parcel data = Parcel.obtain();
5505 Parcel reply = Parcel.obtain();
5506 data.writeInterfaceToken(IActivityManager.descriptor);
5507 data.writeStrongBinder(activityToken);
5508 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5509 reply.readException();
5510 int result = reply.readInt();
5511 data.recycle();
5512 reply.recycle();
5513 return result;
5514 }
5515
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005516 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5517 Parcel data = Parcel.obtain();
5518 Parcel reply = Parcel.obtain();
5519 data.writeInterfaceToken(IActivityManager.descriptor);
5520 data.writeStrongBinder(activityToken);
5521 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5522 reply.readException();
5523 String result = reply.readString();
5524 data.recycle();
5525 reply.recycle();
5526 return result;
5527 }
5528
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005529 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5530 Parcel data = Parcel.obtain();
5531 Parcel reply = Parcel.obtain();
5532 data.writeInterfaceToken(IActivityManager.descriptor);
5533 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5534 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5535 reply.readException();
5536 data.recycle();
5537 reply.recycle();
5538 }
5539
5540 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5541 Parcel data = Parcel.obtain();
5542 Parcel reply = Parcel.obtain();
5543 data.writeInterfaceToken(IActivityManager.descriptor);
5544 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5545 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5546 reply.readException();
5547 data.recycle();
5548 reply.recycle();
5549 }
5550
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005551 public void requestBugReport() throws RemoteException {
5552 Parcel data = Parcel.obtain();
5553 Parcel reply = Parcel.obtain();
5554 data.writeInterfaceToken(IActivityManager.descriptor);
5555 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5556 reply.readException();
5557 data.recycle();
5558 reply.recycle();
5559 }
5560
Jeff Brownbd181bb2013-09-10 16:44:24 -07005561 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5562 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005563 Parcel data = Parcel.obtain();
5564 Parcel reply = Parcel.obtain();
5565 data.writeInterfaceToken(IActivityManager.descriptor);
5566 data.writeInt(pid);
5567 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005568 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005569 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5570 reply.readException();
5571 long res = reply.readInt();
5572 data.recycle();
5573 reply.recycle();
5574 return res;
5575 }
5576
Adam Skorydfc7fd72013-08-05 19:23:41 -07005577 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005578 Parcel data = Parcel.obtain();
5579 Parcel reply = Parcel.obtain();
5580 data.writeInterfaceToken(IActivityManager.descriptor);
5581 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005582 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005583 reply.readException();
5584 Bundle res = reply.readBundle();
5585 data.recycle();
5586 reply.recycle();
5587 return res;
5588 }
5589
Dianne Hackborn17f69352015-07-17 18:04:14 -07005590 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5591 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005592 Parcel data = Parcel.obtain();
5593 Parcel reply = Parcel.obtain();
5594 data.writeInterfaceToken(IActivityManager.descriptor);
5595 data.writeInt(requestType);
5596 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005597 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005598 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5599 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005600 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005601 data.recycle();
5602 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005603 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005604 }
5605
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005606 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005607 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005608 Parcel data = Parcel.obtain();
5609 Parcel reply = Parcel.obtain();
5610 data.writeInterfaceToken(IActivityManager.descriptor);
5611 data.writeStrongBinder(token);
5612 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005613 structure.writeToParcel(data, 0);
5614 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005615 if (referrer != null) {
5616 data.writeInt(1);
5617 referrer.writeToParcel(data, 0);
5618 } else {
5619 data.writeInt(0);
5620 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005621 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005622 reply.readException();
5623 data.recycle();
5624 reply.recycle();
5625 }
5626
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005627 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5628 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005629 Parcel data = Parcel.obtain();
5630 Parcel reply = Parcel.obtain();
5631 data.writeInterfaceToken(IActivityManager.descriptor);
5632 intent.writeToParcel(data, 0);
5633 data.writeInt(requestType);
5634 data.writeString(hint);
5635 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005636 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005637 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5638 reply.readException();
5639 boolean res = reply.readInt() != 0;
5640 data.recycle();
5641 reply.recycle();
5642 return res;
5643 }
5644
Dianne Hackborn17f69352015-07-17 18:04:14 -07005645 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005646 Parcel data = Parcel.obtain();
5647 Parcel reply = Parcel.obtain();
5648 data.writeInterfaceToken(IActivityManager.descriptor);
5649 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5650 reply.readException();
5651 boolean res = reply.readInt() != 0;
5652 data.recycle();
5653 reply.recycle();
5654 return res;
5655 }
5656
Dianne Hackborn17f69352015-07-17 18:04:14 -07005657 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5658 Parcel data = Parcel.obtain();
5659 Parcel reply = Parcel.obtain();
5660 data.writeInterfaceToken(IActivityManager.descriptor);
5661 data.writeStrongBinder(token);
5662 data.writeBundle(args);
5663 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5664 reply.readException();
5665 boolean res = reply.readInt() != 0;
5666 data.recycle();
5667 reply.recycle();
5668 return res;
5669 }
5670
Svetoslavaa41add2015-08-06 15:03:55 -07005671 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005672 Parcel data = Parcel.obtain();
5673 Parcel reply = Parcel.obtain();
5674 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07005675 data.writeInt(appId);
5676 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005677 data.writeString(reason);
5678 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5679 reply.readException();
5680 data.recycle();
5681 reply.recycle();
5682 }
5683
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005684 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5685 Parcel data = Parcel.obtain();
5686 Parcel reply = Parcel.obtain();
5687 data.writeInterfaceToken(IActivityManager.descriptor);
5688 data.writeStrongBinder(who);
5689 data.writeInt(allowRestart ? 1 : 0);
5690 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5691 reply.readException();
5692 data.recycle();
5693 reply.recycle();
5694 }
5695
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005696 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5697 Parcel data = Parcel.obtain();
5698 Parcel reply = Parcel.obtain();
5699 data.writeInterfaceToken(IActivityManager.descriptor);
5700 data.writeStrongBinder(token);
5701 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5702 reply.readException();
5703 data.recycle();
5704 reply.recycle();
5705 }
5706
Craig Mautner5eda9b32013-07-02 11:58:16 -07005707 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5708 Parcel data = Parcel.obtain();
5709 Parcel reply = Parcel.obtain();
5710 data.writeInterfaceToken(IActivityManager.descriptor);
5711 data.writeStrongBinder(token);
5712 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5713 reply.readException();
5714 data.recycle();
5715 reply.recycle();
5716 }
5717
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005718 public void restart() throws RemoteException {
5719 Parcel data = Parcel.obtain();
5720 Parcel reply = Parcel.obtain();
5721 data.writeInterfaceToken(IActivityManager.descriptor);
5722 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5723 reply.readException();
5724 data.recycle();
5725 reply.recycle();
5726 }
5727
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005728 public void performIdleMaintenance() throws RemoteException {
5729 Parcel data = Parcel.obtain();
5730 Parcel reply = Parcel.obtain();
5731 data.writeInterfaceToken(IActivityManager.descriptor);
5732 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5733 reply.readException();
5734 data.recycle();
5735 reply.recycle();
5736 }
5737
Todd Kennedyca4d8422015-01-15 15:19:22 -08005738 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005739 IActivityContainerCallback callback) throws RemoteException {
5740 Parcel data = Parcel.obtain();
5741 Parcel reply = Parcel.obtain();
5742 data.writeInterfaceToken(IActivityManager.descriptor);
5743 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005744 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005745 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005746 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005747 final int result = reply.readInt();
5748 final IActivityContainer res;
5749 if (result == 1) {
5750 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5751 } else {
5752 res = null;
5753 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005754 data.recycle();
5755 reply.recycle();
5756 return res;
5757 }
5758
Craig Mautner95da1082014-02-24 17:54:35 -08005759 public void deleteActivityContainer(IActivityContainer activityContainer)
5760 throws RemoteException {
5761 Parcel data = Parcel.obtain();
5762 Parcel reply = Parcel.obtain();
5763 data.writeInterfaceToken(IActivityManager.descriptor);
5764 data.writeStrongBinder(activityContainer.asBinder());
5765 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5766 reply.readException();
5767 data.recycle();
5768 reply.recycle();
5769 }
5770
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04005771 public boolean startBinderTracking() throws RemoteException {
5772 Parcel data = Parcel.obtain();
5773 Parcel reply = Parcel.obtain();
5774 data.writeInterfaceToken(IActivityManager.descriptor);
5775 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
5776 reply.readException();
5777 boolean res = reply.readInt() != 0;
5778 reply.recycle();
5779 data.recycle();
5780 return res;
5781 }
5782
5783 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
5784 Parcel data = Parcel.obtain();
5785 Parcel reply = Parcel.obtain();
5786 data.writeInterfaceToken(IActivityManager.descriptor);
5787 if (fd != null) {
5788 data.writeInt(1);
5789 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5790 } else {
5791 data.writeInt(0);
5792 }
5793 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
5794 reply.readException();
5795 boolean res = reply.readInt() != 0;
5796 reply.recycle();
5797 data.recycle();
5798 return res;
5799 }
5800
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005801 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005802 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5803 Parcel data = Parcel.obtain();
5804 Parcel reply = Parcel.obtain();
5805 data.writeInterfaceToken(IActivityManager.descriptor);
5806 data.writeInt(displayId);
5807 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5808 reply.readException();
5809 final int result = reply.readInt();
5810 final IActivityContainer res;
5811 if (result == 1) {
5812 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5813 } else {
5814 res = null;
5815 }
5816 data.recycle();
5817 reply.recycle();
5818 return res;
5819 }
5820
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005821 @Override
5822 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005823 throws RemoteException {
5824 Parcel data = Parcel.obtain();
5825 Parcel reply = Parcel.obtain();
5826 data.writeInterfaceToken(IActivityManager.descriptor);
5827 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005828 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005829 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005830 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005831 data.recycle();
5832 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005833 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005834 }
5835
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005836 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005837 public void startLockTaskMode(int taskId) throws RemoteException {
5838 Parcel data = Parcel.obtain();
5839 Parcel reply = Parcel.obtain();
5840 data.writeInterfaceToken(IActivityManager.descriptor);
5841 data.writeInt(taskId);
5842 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5843 reply.readException();
5844 data.recycle();
5845 reply.recycle();
5846 }
5847
5848 @Override
5849 public void startLockTaskMode(IBinder token) throws RemoteException {
5850 Parcel data = Parcel.obtain();
5851 Parcel reply = Parcel.obtain();
5852 data.writeInterfaceToken(IActivityManager.descriptor);
5853 data.writeStrongBinder(token);
5854 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5855 reply.readException();
5856 data.recycle();
5857 reply.recycle();
5858 }
5859
5860 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005861 public void startLockTaskModeOnCurrent() throws RemoteException {
5862 Parcel data = Parcel.obtain();
5863 Parcel reply = Parcel.obtain();
5864 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005865 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005866 reply.readException();
5867 data.recycle();
5868 reply.recycle();
5869 }
5870
5871 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005872 public void stopLockTaskMode() throws RemoteException {
5873 Parcel data = Parcel.obtain();
5874 Parcel reply = Parcel.obtain();
5875 data.writeInterfaceToken(IActivityManager.descriptor);
5876 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5877 reply.readException();
5878 data.recycle();
5879 reply.recycle();
5880 }
5881
5882 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005883 public void stopLockTaskModeOnCurrent() throws RemoteException {
5884 Parcel data = Parcel.obtain();
5885 Parcel reply = Parcel.obtain();
5886 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005887 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005888 reply.readException();
5889 data.recycle();
5890 reply.recycle();
5891 }
5892
5893 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005894 public boolean isInLockTaskMode() throws RemoteException {
5895 Parcel data = Parcel.obtain();
5896 Parcel reply = Parcel.obtain();
5897 data.writeInterfaceToken(IActivityManager.descriptor);
5898 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5899 reply.readException();
5900 boolean isInLockTaskMode = reply.readInt() == 1;
5901 data.recycle();
5902 reply.recycle();
5903 return isInLockTaskMode;
5904 }
5905
Craig Mautner688b5102014-03-27 16:55:03 -07005906 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005907 public int getLockTaskModeState() throws RemoteException {
5908 Parcel data = Parcel.obtain();
5909 Parcel reply = Parcel.obtain();
5910 data.writeInterfaceToken(IActivityManager.descriptor);
5911 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5912 reply.readException();
5913 int lockTaskModeState = reply.readInt();
5914 data.recycle();
5915 reply.recycle();
5916 return lockTaskModeState;
5917 }
5918
5919 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005920 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5921 Parcel data = Parcel.obtain();
5922 Parcel reply = Parcel.obtain();
5923 data.writeInterfaceToken(IActivityManager.descriptor);
5924 data.writeStrongBinder(token);
5925 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5926 IBinder.FLAG_ONEWAY);
5927 reply.readException();
5928 data.recycle();
5929 reply.recycle();
5930 }
5931
5932 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005933 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005934 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005935 Parcel data = Parcel.obtain();
5936 Parcel reply = Parcel.obtain();
5937 data.writeInterfaceToken(IActivityManager.descriptor);
5938 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005939 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005940 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005941 reply.readException();
5942 data.recycle();
5943 reply.recycle();
5944 }
5945
Craig Mautneree2e45a2014-06-27 12:10:03 -07005946 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005947 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5948 Parcel data = Parcel.obtain();
5949 Parcel reply = Parcel.obtain();
5950 data.writeInterfaceToken(IActivityManager.descriptor);
5951 data.writeInt(taskId);
5952 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005953 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005954 reply.readException();
5955 data.recycle();
5956 reply.recycle();
5957 }
5958
5959 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07005960 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005961 {
5962 Parcel data = Parcel.obtain();
5963 Parcel reply = Parcel.obtain();
5964 data.writeInterfaceToken(IActivityManager.descriptor);
5965 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07005966 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005967 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005968 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005969 reply.readException();
5970 data.recycle();
5971 reply.recycle();
5972 }
5973
5974 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07005975 public Rect getTaskBounds(int taskId) throws RemoteException
5976 {
5977 Parcel data = Parcel.obtain();
5978 Parcel reply = Parcel.obtain();
5979 data.writeInterfaceToken(IActivityManager.descriptor);
5980 data.writeInt(taskId);
5981 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
5982 reply.readException();
5983 Rect rect = Rect.CREATOR.createFromParcel(reply);
5984 data.recycle();
5985 reply.recycle();
5986 return rect;
5987 }
5988
5989 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005990 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5991 Parcel data = Parcel.obtain();
5992 Parcel reply = Parcel.obtain();
5993 data.writeInterfaceToken(IActivityManager.descriptor);
5994 data.writeString(filename);
5995 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5996 reply.readException();
5997 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5998 data.recycle();
5999 reply.recycle();
6000 return icon;
6001 }
6002
6003 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006004 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6005 throws RemoteException {
6006 Parcel data = Parcel.obtain();
6007 Parcel reply = Parcel.obtain();
6008 data.writeInterfaceToken(IActivityManager.descriptor);
6009 if (options == null) {
6010 data.writeInt(0);
6011 } else {
6012 data.writeInt(1);
6013 data.writeBundle(options.toBundle());
6014 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006015 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006016 reply.readException();
6017 data.recycle();
6018 reply.recycle();
6019 }
6020
6021 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006022 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006023 Parcel data = Parcel.obtain();
6024 Parcel reply = Parcel.obtain();
6025 data.writeInterfaceToken(IActivityManager.descriptor);
6026 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006027 data.writeInt(visible ? 1 : 0);
6028 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006029 reply.readException();
6030 boolean success = reply.readInt() > 0;
6031 data.recycle();
6032 reply.recycle();
6033 return success;
6034 }
6035
6036 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006037 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006038 Parcel data = Parcel.obtain();
6039 Parcel reply = Parcel.obtain();
6040 data.writeInterfaceToken(IActivityManager.descriptor);
6041 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006042 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006043 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006044 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006045 data.recycle();
6046 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006047 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006048 }
6049
6050 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006051 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006052 Parcel data = Parcel.obtain();
6053 Parcel reply = Parcel.obtain();
6054 data.writeInterfaceToken(IActivityManager.descriptor);
6055 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006056 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006057 reply.readException();
6058 data.recycle();
6059 reply.recycle();
6060 }
6061
6062 @Override
6063 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6064 Parcel data = Parcel.obtain();
6065 Parcel reply = Parcel.obtain();
6066 data.writeInterfaceToken(IActivityManager.descriptor);
6067 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006068 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006069 reply.readException();
6070 data.recycle();
6071 reply.recycle();
6072 }
6073
Craig Mautner8746a472014-07-24 15:12:54 -07006074 @Override
6075 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6076 Parcel data = Parcel.obtain();
6077 Parcel reply = Parcel.obtain();
6078 data.writeInterfaceToken(IActivityManager.descriptor);
6079 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006080 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006081 reply.readException();
6082 data.recycle();
6083 reply.recycle();
6084 }
6085
Craig Mautner6e2f3952014-09-09 14:26:41 -07006086 @Override
6087 public void bootAnimationComplete() throws RemoteException {
6088 Parcel data = Parcel.obtain();
6089 Parcel reply = Parcel.obtain();
6090 data.writeInterfaceToken(IActivityManager.descriptor);
6091 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6092 reply.readException();
6093 data.recycle();
6094 reply.recycle();
6095 }
6096
Wale Ogunwale18795a22014-12-03 11:38:33 -08006097 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006098 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6099 Parcel data = Parcel.obtain();
6100 Parcel reply = Parcel.obtain();
6101 data.writeInterfaceToken(IActivityManager.descriptor);
6102 data.writeInt(uid);
6103 data.writeByteArray(firstPacket);
6104 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6105 reply.readException();
6106 data.recycle();
6107 reply.recycle();
6108 }
6109
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006110 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006111 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6112 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006113 Parcel data = Parcel.obtain();
6114 Parcel reply = Parcel.obtain();
6115 data.writeInterfaceToken(IActivityManager.descriptor);
6116 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006117 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006118 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006119 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006120 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6121 reply.readException();
6122 data.recycle();
6123 reply.recycle();
6124 }
6125
6126 @Override
6127 public void dumpHeapFinished(String path) throws RemoteException {
6128 Parcel data = Parcel.obtain();
6129 Parcel reply = Parcel.obtain();
6130 data.writeInterfaceToken(IActivityManager.descriptor);
6131 data.writeString(path);
6132 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6133 reply.readException();
6134 data.recycle();
6135 reply.recycle();
6136 }
6137
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006138 @Override
6139 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6140 throws RemoteException {
6141 Parcel data = Parcel.obtain();
6142 Parcel reply = Parcel.obtain();
6143 data.writeInterfaceToken(IActivityManager.descriptor);
6144 data.writeStrongBinder(session.asBinder());
6145 data.writeInt(keepAwake ? 1 : 0);
6146 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6147 reply.readException();
6148 data.recycle();
6149 reply.recycle();
6150 }
6151
Craig Mautnere5600772015-04-03 21:36:37 -07006152 @Override
6153 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6154 Parcel data = Parcel.obtain();
6155 Parcel reply = Parcel.obtain();
6156 data.writeInterfaceToken(IActivityManager.descriptor);
6157 data.writeInt(userId);
6158 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006159 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006160 reply.readException();
6161 data.recycle();
6162 reply.recycle();
6163 }
6164
Dianne Hackborn1e383822015-04-10 14:02:33 -07006165 @Override
Craig Mautner015c5e52015-04-23 10:39:39 -07006166 public void updateDeviceOwner(String packageName) throws RemoteException {
6167 Parcel data = Parcel.obtain();
6168 Parcel reply = Parcel.obtain();
6169 data.writeInterfaceToken(IActivityManager.descriptor);
6170 data.writeString(packageName);
6171 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6172 reply.readException();
6173 data.recycle();
6174 reply.recycle();
6175 }
6176
6177 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006178 public int getPackageProcessState(String packageName, String callingPackage)
6179 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006180 Parcel data = Parcel.obtain();
6181 Parcel reply = Parcel.obtain();
6182 data.writeInterfaceToken(IActivityManager.descriptor);
6183 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006184 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006185 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6186 reply.readException();
6187 int res = reply.readInt();
6188 data.recycle();
6189 reply.recycle();
6190 return res;
6191 }
6192
Stefan Kuhne16045c22015-06-05 07:18:06 -07006193 @Override
6194 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6195 throws RemoteException {
6196 Parcel data = Parcel.obtain();
6197 Parcel reply = Parcel.obtain();
6198 data.writeInterfaceToken(IActivityManager.descriptor);
6199 data.writeString(process);
6200 data.writeInt(userId);
6201 data.writeInt(level);
6202 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6203 reply.readException();
6204 int res = reply.readInt();
6205 data.recycle();
6206 reply.recycle();
6207 return res != 0;
6208 }
6209
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006210 @Override
6211 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6212 Parcel data = Parcel.obtain();
6213 Parcel reply = Parcel.obtain();
6214 data.writeInterfaceToken(IActivityManager.descriptor);
6215 data.writeStrongBinder(token);
6216 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6217 reply.readException();
6218 int res = reply.readInt();
6219 data.recycle();
6220 reply.recycle();
6221 return res != 0;
6222 }
6223
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006224 @Override
6225 public void moveActivityToStack(IBinder token, int stackId) throws RemoteException {
6226 Parcel data = Parcel.obtain();
6227 Parcel reply = Parcel.obtain();
6228 data.writeInterfaceToken(IActivityManager.descriptor);
6229 data.writeStrongBinder(token);
6230 data.writeInt(stackId);
6231 mRemote.transact(MOVE_ACTIVITY_TO_STACK_TRANSACTION, data, reply, 0);
6232 reply.readException();
6233 data.recycle();
6234 reply.recycle();
6235 }
6236
6237 @Override
6238 public int getActivityStackId(IBinder token) throws RemoteException {
6239 Parcel data = Parcel.obtain();
6240 Parcel reply = Parcel.obtain();
6241 data.writeInterfaceToken(IActivityManager.descriptor);
6242 data.writeStrongBinder(token);
6243 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6244 reply.readException();
6245 int stackId = reply.readInt();
6246 data.recycle();
6247 reply.recycle();
6248 return stackId;
6249 }
6250
Filip Gruszczynski23493322015-07-29 17:02:59 -07006251 @Override
6252 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006253 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6254 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006255 Parcel data = Parcel.obtain();
6256 Parcel reply = Parcel.obtain();
6257 data.writeInterfaceToken(IActivityManager.descriptor);
6258 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006259 writeIntArray(horizontalSizeConfiguration, data);
6260 writeIntArray(verticalSizeConfigurations, data);
6261 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006262 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6263 reply.readException();
6264 data.recycle();
6265 reply.recycle();
6266 }
6267
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006268 private static void writeIntArray(int[] array, Parcel data) {
6269 if (array == null) {
6270 data.writeInt(0);
6271 } else {
6272 data.writeInt(array.length);
6273 data.writeIntArray(array);
6274 }
6275 }
6276
Wale Ogunwale83301a92015-09-24 15:54:08 -07006277 @Override
6278 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6279 Parcel data = Parcel.obtain();
6280 Parcel reply = Parcel.obtain();
6281 data.writeInterfaceToken(IActivityManager.descriptor);
6282 data.writeInt(suppress ? 1 : 0);
6283 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6284 reply.readException();
6285 data.recycle();
6286 reply.recycle();
6287 }
6288
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006289 @Override
6290 public void removeStack(int stackId) throws RemoteException {
6291 Parcel data = Parcel.obtain();
6292 Parcel reply = Parcel.obtain();
6293 data.writeInterfaceToken(IActivityManager.descriptor);
6294 data.writeInt(stackId);
6295 mRemote.transact(REMOVE_STACK, data, reply, 0);
6296 reply.readException();
6297 data.recycle();
6298 reply.recycle();
6299 }
6300
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006301 private IBinder mRemote;
6302}