blob: 73b81cdc35bb3db083d0f16fc68742fe42f81c9b [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
Dianne Hackborn69c6adc2015-06-02 10:52:59 -070020import android.app.assist.AssistContent;
21import android.app.assist.AssistStructure;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070023import android.content.IIntentReceiver;
24import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.content.Intent;
26import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070027import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070028import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070029import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.pm.ConfigurationInfo;
31import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070032import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070033import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.content.res.Configuration;
Dianne Hackbornaec68bb2014-08-20 15:25:13 -070035import android.graphics.Bitmap;
36import android.graphics.Point;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080037import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.net.Uri;
39import android.os.Binder;
40import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070041import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.os.IBinder;
43import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.ParcelFileDescriptor;
45import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070046import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070047import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070049import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070050import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080053import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070054import com.android.internal.app.IVoiceInteractor;
Dianne Hackbornae6688b2015-02-11 17:02:41 -080055import com.android.internal.os.IResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057import java.util.ArrayList;
58import java.util.List;
59
60/** {@hide} */
61public abstract class ActivityManagerNative extends Binder implements IActivityManager
62{
63 /**
64 * Cast a Binder object into an activity manager interface, generating
65 * a proxy if needed.
66 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080067 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 if (obj == null) {
69 return null;
70 }
71 IActivityManager in =
72 (IActivityManager)obj.queryLocalInterface(descriptor);
73 if (in != null) {
74 return in;
75 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 return new ActivityManagerProxy(obj);
78 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 /**
81 * Retrieve the system's default/global activity manager.
82 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080083 static public IActivityManager getDefault() {
84 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 }
86
87 /**
88 * Convenience for checking whether the system is ready. For internal use only.
89 */
90 static public boolean isSystemReady() {
91 if (!sSystemReady) {
92 sSystemReady = getDefault().testIsSystemReady();
93 }
94 return sSystemReady;
95 }
96 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080097
Svet Ganov16a16892015-04-16 10:32:04 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
99 broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId);
100 }
101
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102 /**
103 * Convenience for sending a sticky broadcast. For internal use only.
104 * If you don't care about permission, use null.
105 */
Svet Ganov16a16892015-04-16 10:32:04 -0700106 static public void broadcastStickyIntent(Intent intent, String permission, int appOp,
107 int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
109 getDefault().broadcastIntent(
Filip Gruszczynski23493322015-07-29 17:02:59 -0700110 null, intent, null, null, Activity.RESULT_OK, null, null,
111 null /*permission*/, appOp, null, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 } catch (RemoteException ex) {
113 }
114 }
115
Dianne Hackborn1e383822015-04-10 14:02:33 -0700116 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg,
117 String tag) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700119 getDefault().noteWakeupAlarm((ps != null) ? ps.getTarget() : null,
120 sourceUid, sourcePkg, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700121 } catch (RemoteException ex) {
122 }
123 }
124
125 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
126 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700127 getDefault().noteAlarmStart((ps != null) ? ps.getTarget() : null, sourceUid, tag);
Dianne Hackborn1e383822015-04-10 14:02:33 -0700128 } catch (RemoteException ex) {
129 }
130 }
131
132 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
133 try {
Christopher Tate14a7bb02015-10-01 10:24:31 -0700134 getDefault().noteAlarmFinish((ps != null) ? ps.getTarget() : null, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135 } catch (RemoteException ex) {
136 }
137 }
138
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800139 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800140 attachInterface(this, descriptor);
141 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700142
143 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
145 throws RemoteException {
146 switch (code) {
147 case START_ACTIVITY_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800155 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800156 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700158 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700159 ProfilerInfo profilerInfo = data.readInt() != 0
160 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700161 Bundle options = data.readInt() != 0
162 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800163 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700164 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165 reply.writeNoException();
166 reply.writeInt(result);
167 return true;
168 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700169
Amith Yamasani82644082012-08-03 13:09:11 -0700170 case START_ACTIVITY_AS_USER_TRANSACTION:
171 {
172 data.enforceInterface(IActivityManager.descriptor);
173 IBinder b = data.readStrongBinder();
174 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800175 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700176 Intent intent = Intent.CREATOR.createFromParcel(data);
177 String resolvedType = data.readString();
178 IBinder resultTo = data.readStrongBinder();
179 String resultWho = data.readString();
180 int requestCode = data.readInt();
181 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700182 ProfilerInfo profilerInfo = data.readInt() != 0
183 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700184 Bundle options = data.readInt() != 0
185 ? Bundle.CREATOR.createFromParcel(data) : null;
186 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800187 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700188 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700189 reply.writeNoException();
190 reply.writeInt(result);
191 return true;
192 }
193
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700194 case START_ACTIVITY_AS_CALLER_TRANSACTION:
195 {
196 data.enforceInterface(IActivityManager.descriptor);
197 IBinder b = data.readStrongBinder();
198 IApplicationThread app = ApplicationThreadNative.asInterface(b);
199 String callingPackage = data.readString();
200 Intent intent = Intent.CREATOR.createFromParcel(data);
201 String resolvedType = data.readString();
202 IBinder resultTo = data.readStrongBinder();
203 String resultWho = data.readString();
204 int requestCode = data.readInt();
205 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700206 ProfilerInfo profilerInfo = data.readInt() != 0
207 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700208 Bundle options = data.readInt() != 0
209 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700210 boolean ignoreTargetSecurity = data.readInt() != 0;
Jeff Sharkey97978802014-10-14 10:48:18 -0700211 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700212 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700213 resultTo, resultWho, requestCode, startFlags, profilerInfo, options,
214 ignoreTargetSecurity, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700215 reply.writeNoException();
216 reply.writeInt(result);
217 return true;
218 }
219
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800220 case START_ACTIVITY_AND_WAIT_TRANSACTION:
221 {
222 data.enforceInterface(IActivityManager.descriptor);
223 IBinder b = data.readStrongBinder();
224 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800225 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800226 Intent intent = Intent.CREATOR.createFromParcel(data);
227 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800228 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800229 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800230 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700232 ProfilerInfo profilerInfo = data.readInt() != 0
233 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700234 Bundle options = data.readInt() != 0
235 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700236 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800237 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700238 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800239 reply.writeNoException();
240 result.writeToParcel(reply, 0);
241 return true;
242 }
243
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700244 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
245 {
246 data.enforceInterface(IActivityManager.descriptor);
247 IBinder b = data.readStrongBinder();
248 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800249 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700250 Intent intent = Intent.CREATOR.createFromParcel(data);
251 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700252 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700253 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700254 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700255 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700256 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700257 Bundle options = data.readInt() != 0
258 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700259 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800260 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700261 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700262 reply.writeNoException();
263 reply.writeInt(result);
264 return true;
265 }
266
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700267 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700268 {
269 data.enforceInterface(IActivityManager.descriptor);
270 IBinder b = data.readStrongBinder();
271 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700272 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700273 Intent fillInIntent = null;
274 if (data.readInt() != 0) {
275 fillInIntent = Intent.CREATOR.createFromParcel(data);
276 }
277 String resolvedType = data.readString();
278 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700279 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700280 int requestCode = data.readInt();
281 int flagsMask = data.readInt();
282 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700283 Bundle options = data.readInt() != 0
284 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700285 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700286 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700287 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700288 reply.writeNoException();
289 reply.writeInt(result);
290 return true;
291 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700292
Dianne Hackborn91097de2014-04-04 18:02:06 -0700293 case START_VOICE_ACTIVITY_TRANSACTION:
294 {
295 data.enforceInterface(IActivityManager.descriptor);
296 String callingPackage = data.readString();
297 int callingPid = data.readInt();
298 int callingUid = data.readInt();
299 Intent intent = Intent.CREATOR.createFromParcel(data);
300 String resolvedType = data.readString();
301 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
302 data.readStrongBinder());
303 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
304 data.readStrongBinder());
305 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700306 ProfilerInfo profilerInfo = data.readInt() != 0
307 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700308 Bundle options = data.readInt() != 0
309 ? Bundle.CREATOR.createFromParcel(data) : null;
310 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700311 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
312 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700313 reply.writeNoException();
314 reply.writeInt(result);
315 return true;
316 }
317
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800318 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
319 {
320 data.enforceInterface(IActivityManager.descriptor);
321 IBinder callingActivity = data.readStrongBinder();
322 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700323 Bundle options = data.readInt() != 0
324 ? Bundle.CREATOR.createFromParcel(data) : null;
325 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 reply.writeNoException();
327 reply.writeInt(result ? 1 : 0);
328 return true;
329 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700330
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700331 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
332 {
333 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -0700334 final int taskId = data.readInt();
335 final int launchStackId = data.readInt();
336 final Bundle options =
337 data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
338 final int result = startActivityFromRecents(taskId, launchStackId, options);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700339 reply.writeNoException();
340 reply.writeInt(result);
341 return true;
342 }
343
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800344 case FINISH_ACTIVITY_TRANSACTION: {
345 data.enforceInterface(IActivityManager.descriptor);
346 IBinder token = data.readStrongBinder();
347 Intent resultData = null;
348 int resultCode = data.readInt();
349 if (data.readInt() != 0) {
350 resultData = Intent.CREATOR.createFromParcel(data);
351 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -0700352 int finishTask = data.readInt();
Winson Chung3b3f4642014-04-22 10:08:18 -0700353 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 reply.writeNoException();
355 reply.writeInt(res ? 1 : 0);
356 return true;
357 }
358
359 case FINISH_SUB_ACTIVITY_TRANSACTION: {
360 data.enforceInterface(IActivityManager.descriptor);
361 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700362 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 int requestCode = data.readInt();
364 finishSubActivity(token, resultWho, requestCode);
365 reply.writeNoException();
366 return true;
367 }
368
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700369 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
370 data.enforceInterface(IActivityManager.descriptor);
371 IBinder token = data.readStrongBinder();
372 boolean res = finishActivityAffinity(token);
373 reply.writeNoException();
374 reply.writeInt(res ? 1 : 0);
375 return true;
376 }
377
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700378 case FINISH_VOICE_TASK_TRANSACTION: {
379 data.enforceInterface(IActivityManager.descriptor);
380 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
381 data.readStrongBinder());
382 finishVoiceTask(session);
383 reply.writeNoException();
384 return true;
385 }
386
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700387 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
388 data.enforceInterface(IActivityManager.descriptor);
389 IBinder token = data.readStrongBinder();
390 boolean res = releaseActivityInstance(token);
391 reply.writeNoException();
392 reply.writeInt(res ? 1 : 0);
393 return true;
394 }
395
396 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
397 data.enforceInterface(IActivityManager.descriptor);
398 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
399 releaseSomeActivities(app);
400 reply.writeNoException();
401 return true;
402 }
403
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800404 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
405 data.enforceInterface(IActivityManager.descriptor);
406 IBinder token = data.readStrongBinder();
407 boolean res = willActivityBeVisible(token);
408 reply.writeNoException();
409 reply.writeInt(res ? 1 : 0);
410 return true;
411 }
412
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800413 case REGISTER_RECEIVER_TRANSACTION:
414 {
415 data.enforceInterface(IActivityManager.descriptor);
416 IBinder b = data.readStrongBinder();
417 IApplicationThread app =
418 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700419 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800420 b = data.readStrongBinder();
421 IIntentReceiver rec
422 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
423 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
424 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700425 int userId = data.readInt();
426 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 reply.writeNoException();
428 if (intent != null) {
429 reply.writeInt(1);
430 intent.writeToParcel(reply, 0);
431 } else {
432 reply.writeInt(0);
433 }
434 return true;
435 }
436
437 case UNREGISTER_RECEIVER_TRANSACTION:
438 {
439 data.enforceInterface(IActivityManager.descriptor);
440 IBinder b = data.readStrongBinder();
441 if (b == null) {
442 return true;
443 }
444 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
445 unregisterReceiver(rec);
446 reply.writeNoException();
447 return true;
448 }
449
450 case BROADCAST_INTENT_TRANSACTION:
451 {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder b = data.readStrongBinder();
454 IApplicationThread app =
455 b != null ? ApplicationThreadNative.asInterface(b) : null;
456 Intent intent = Intent.CREATOR.createFromParcel(data);
457 String resolvedType = data.readString();
458 b = data.readStrongBinder();
459 IIntentReceiver resultTo =
460 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
461 int resultCode = data.readInt();
462 String resultData = data.readString();
463 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700464 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800465 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700466 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 boolean serialized = data.readInt() != 0;
468 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700469 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700471 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700472 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800473 reply.writeNoException();
474 reply.writeInt(res);
475 return true;
476 }
477
478 case UNBROADCAST_INTENT_TRANSACTION:
479 {
480 data.enforceInterface(IActivityManager.descriptor);
481 IBinder b = data.readStrongBinder();
482 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
483 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700484 int userId = data.readInt();
485 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800486 reply.writeNoException();
487 return true;
488 }
489
490 case FINISH_RECEIVER_TRANSACTION: {
491 data.enforceInterface(IActivityManager.descriptor);
492 IBinder who = data.readStrongBinder();
493 int resultCode = data.readInt();
494 String resultData = data.readString();
495 Bundle resultExtras = data.readBundle();
496 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800497 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800498 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800499 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 }
501 reply.writeNoException();
502 return true;
503 }
504
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 case ATTACH_APPLICATION_TRANSACTION: {
506 data.enforceInterface(IActivityManager.descriptor);
507 IApplicationThread app = ApplicationThreadNative.asInterface(
508 data.readStrongBinder());
509 if (app != null) {
510 attachApplication(app);
511 }
512 reply.writeNoException();
513 return true;
514 }
515
516 case ACTIVITY_IDLE_TRANSACTION: {
517 data.enforceInterface(IActivityManager.descriptor);
518 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700519 Configuration config = null;
520 if (data.readInt() != 0) {
521 config = Configuration.CREATOR.createFromParcel(data);
522 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700523 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800524 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700525 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 }
527 reply.writeNoException();
528 return true;
529 }
530
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700531 case ACTIVITY_RESUMED_TRANSACTION: {
532 data.enforceInterface(IActivityManager.descriptor);
533 IBinder token = data.readStrongBinder();
534 activityResumed(token);
535 reply.writeNoException();
536 return true;
537 }
538
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800539 case ACTIVITY_PAUSED_TRANSACTION: {
540 data.enforceInterface(IActivityManager.descriptor);
541 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700542 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800543 reply.writeNoException();
544 return true;
545 }
546
547 case ACTIVITY_STOPPED_TRANSACTION: {
548 data.enforceInterface(IActivityManager.descriptor);
549 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800550 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700551 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800552 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700553 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554 reply.writeNoException();
555 return true;
556 }
557
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800558 case ACTIVITY_SLEPT_TRANSACTION: {
559 data.enforceInterface(IActivityManager.descriptor);
560 IBinder token = data.readStrongBinder();
561 activitySlept(token);
562 reply.writeNoException();
563 return true;
564 }
565
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800566 case ACTIVITY_DESTROYED_TRANSACTION: {
567 data.enforceInterface(IActivityManager.descriptor);
568 IBinder token = data.readStrongBinder();
569 activityDestroyed(token);
570 reply.writeNoException();
571 return true;
572 }
573
574 case GET_CALLING_PACKAGE_TRANSACTION: {
575 data.enforceInterface(IActivityManager.descriptor);
576 IBinder token = data.readStrongBinder();
577 String res = token != null ? getCallingPackage(token) : null;
578 reply.writeNoException();
579 reply.writeString(res);
580 return true;
581 }
582
583 case GET_CALLING_ACTIVITY_TRANSACTION: {
584 data.enforceInterface(IActivityManager.descriptor);
585 IBinder token = data.readStrongBinder();
586 ComponentName cn = getCallingActivity(token);
587 reply.writeNoException();
588 ComponentName.writeToParcel(cn, reply);
589 return true;
590 }
591
Winson Chung1147c402014-05-14 11:05:00 -0700592 case GET_APP_TASKS_TRANSACTION: {
593 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700594 String callingPackage = data.readString();
595 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700596 reply.writeNoException();
597 int N = list != null ? list.size() : -1;
598 reply.writeInt(N);
599 int i;
600 for (i=0; i<N; i++) {
601 IAppTask task = list.get(i);
602 reply.writeStrongBinder(task.asBinder());
603 }
604 return true;
605 }
606
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700607 case ADD_APP_TASK_TRANSACTION: {
608 data.enforceInterface(IActivityManager.descriptor);
609 IBinder activityToken = data.readStrongBinder();
610 Intent intent = Intent.CREATOR.createFromParcel(data);
611 ActivityManager.TaskDescription descr
612 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
613 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
614 int res = addAppTask(activityToken, intent, descr, thumbnail);
615 reply.writeNoException();
616 reply.writeInt(res);
617 return true;
618 }
619
620 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
621 data.enforceInterface(IActivityManager.descriptor);
622 Point size = getAppTaskThumbnailSize();
623 reply.writeNoException();
624 size.writeToParcel(reply, 0);
625 return true;
626 }
627
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800628 case GET_TASKS_TRANSACTION: {
629 data.enforceInterface(IActivityManager.descriptor);
630 int maxNum = data.readInt();
631 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700632 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800633 reply.writeNoException();
634 int N = list != null ? list.size() : -1;
635 reply.writeInt(N);
636 int i;
637 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700638 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800639 info.writeToParcel(reply, 0);
640 }
641 return true;
642 }
643
644 case GET_RECENT_TASKS_TRANSACTION: {
645 data.enforceInterface(IActivityManager.descriptor);
646 int maxNum = data.readInt();
647 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700648 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800649 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700650 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800651 reply.writeNoException();
652 reply.writeTypedList(list);
653 return true;
654 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700655
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700656 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800657 data.enforceInterface(IActivityManager.descriptor);
658 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700659 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800660 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700661 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800662 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700663 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700664 } else {
665 reply.writeInt(0);
666 }
667 return true;
668 }
669
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 case GET_SERVICES_TRANSACTION: {
671 data.enforceInterface(IActivityManager.descriptor);
672 int maxNum = data.readInt();
673 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700674 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800675 reply.writeNoException();
676 int N = list != null ? list.size() : -1;
677 reply.writeInt(N);
678 int i;
679 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700680 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800681 info.writeToParcel(reply, 0);
682 }
683 return true;
684 }
685
686 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
687 data.enforceInterface(IActivityManager.descriptor);
688 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
689 reply.writeNoException();
690 reply.writeTypedList(list);
691 return true;
692 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700693
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800694 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
695 data.enforceInterface(IActivityManager.descriptor);
696 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
697 reply.writeNoException();
698 reply.writeTypedList(list);
699 return true;
700 }
701
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700702 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
703 data.enforceInterface(IActivityManager.descriptor);
704 List<ApplicationInfo> list = getRunningExternalApplications();
705 reply.writeNoException();
706 reply.writeTypedList(list);
707 return true;
708 }
709
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 case MOVE_TASK_TO_FRONT_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800713 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700714 Bundle options = data.readInt() != 0
715 ? Bundle.CREATOR.createFromParcel(data) : null;
716 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800717 reply.writeNoException();
718 return true;
719 }
720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 IBinder token = data.readStrongBinder();
724 boolean nonRoot = data.readInt() != 0;
725 boolean res = moveActivityTaskToBack(token, nonRoot);
726 reply.writeNoException();
727 reply.writeInt(res ? 1 : 0);
728 return true;
729 }
730
731 case MOVE_TASK_BACKWARDS_TRANSACTION: {
732 data.enforceInterface(IActivityManager.descriptor);
733 int task = data.readInt();
734 moveTaskBackwards(task);
735 reply.writeNoException();
736 return true;
737 }
738
Craig Mautnerc00204b2013-03-05 15:02:14 -0800739 case MOVE_TASK_TO_STACK_TRANSACTION: {
740 data.enforceInterface(IActivityManager.descriptor);
741 int taskId = data.readInt();
742 int stackId = data.readInt();
743 boolean toTop = data.readInt() != 0;
744 moveTaskToStack(taskId, stackId, toTop);
745 reply.writeNoException();
746 return true;
747 }
748
Wale Ogunwale59a73ca2015-09-14 12:54:50 -0700749 case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: {
750 data.enforceInterface(IActivityManager.descriptor);
751 int taskId = data.readInt();
752 int createMode = data.readInt();
753 boolean toTop = data.readInt() != 0;
754 moveTaskToDockedStack(taskId, createMode, toTop);
755 reply.writeNoException();
756 return true;
757 }
758
Dianne Hackbornbef28fe2015-10-29 17:57:11 -0700759 case MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION: {
Wale Ogunwale079a0042015-10-24 11:44:07 -0700760 data.enforceInterface(IActivityManager.descriptor);
761 final int stackId = data.readInt();
762 final Rect r = Rect.CREATOR.createFromParcel(data);
763 final boolean res = moveTopActivityToPinnedStack(stackId, r);
764 reply.writeNoException();
765 reply.writeInt(res ? 1 : 0);
766 return true;
767 }
768
Craig Mautnerc00204b2013-03-05 15:02:14 -0800769 case RESIZE_STACK_TRANSACTION: {
770 data.enforceInterface(IActivityManager.descriptor);
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700771 final int stackId = data.readInt();
Jorim Jaggi61f39a72015-10-29 16:54:18 +0100772 final boolean hasRect = data.readInt() != 0;
773 Rect r = null;
774 if (hasRect) {
775 r = Rect.CREATOR.createFromParcel(data);
776 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -0700777 final boolean allowResizeInDockedMode = data.readInt() == 1;
778 resizeStack(stackId, r, allowResizeInDockedMode);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800779 reply.writeNoException();
780 return true;
781 }
782
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700783 case POSITION_TASK_IN_STACK_TRANSACTION: {
784 data.enforceInterface(IActivityManager.descriptor);
785 int taskId = data.readInt();
786 int stackId = data.readInt();
787 int position = data.readInt();
788 positionTaskInStack(taskId, stackId, position);
789 reply.writeNoException();
790 return true;
791 }
792
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800793 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700794 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800795 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700796 reply.writeNoException();
797 reply.writeTypedList(list);
798 return true;
799 }
800
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800801 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700802 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800803 int stackId = data.readInt();
804 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700805 reply.writeNoException();
806 if (info != null) {
807 reply.writeInt(1);
808 info.writeToParcel(reply, 0);
809 } else {
810 reply.writeInt(0);
811 }
812 return true;
813 }
814
Winson Chung303e1ff2014-03-07 15:06:19 -0800815 case IS_IN_HOME_STACK_TRANSACTION: {
816 data.enforceInterface(IActivityManager.descriptor);
817 int taskId = data.readInt();
818 boolean isInHomeStack = isInHomeStack(taskId);
819 reply.writeNoException();
820 reply.writeInt(isInHomeStack ? 1 : 0);
821 return true;
822 }
823
Craig Mautnercf910b02013-04-23 11:23:27 -0700824 case SET_FOCUSED_STACK_TRANSACTION: {
825 data.enforceInterface(IActivityManager.descriptor);
826 int stackId = data.readInt();
827 setFocusedStack(stackId);
828 reply.writeNoException();
829 return true;
830 }
831
Winson Chungd16c5652015-01-26 16:11:07 -0800832 case GET_FOCUSED_STACK_ID_TRANSACTION: {
833 data.enforceInterface(IActivityManager.descriptor);
834 int focusedStackId = getFocusedStackId();
835 reply.writeNoException();
836 reply.writeInt(focusedStackId);
837 return true;
838 }
839
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700840 case SET_FOCUSED_TASK_TRANSACTION: {
841 data.enforceInterface(IActivityManager.descriptor);
842 int taskId = data.readInt();
Skuhnef36bb0c2015-08-26 14:26:17 -0700843 setFocusedTask(taskId);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700844 reply.writeNoException();
845 return true;
846 }
847
Winson Chung740c3ac2014-11-12 16:14:38 -0800848 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
849 data.enforceInterface(IActivityManager.descriptor);
850 IBinder token = data.readStrongBinder();
851 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
852 reply.writeNoException();
853 return true;
854 }
855
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800856 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
857 data.enforceInterface(IActivityManager.descriptor);
858 IBinder token = data.readStrongBinder();
859 boolean onlyRoot = data.readInt() != 0;
860 int res = token != null
861 ? getTaskForActivity(token, onlyRoot) : -1;
862 reply.writeNoException();
863 reply.writeInt(res);
864 return true;
865 }
866
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800867 case GET_CONTENT_PROVIDER_TRANSACTION: {
868 data.enforceInterface(IActivityManager.descriptor);
869 IBinder b = data.readStrongBinder();
870 IApplicationThread app = ApplicationThreadNative.asInterface(b);
871 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700872 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700873 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700874 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800875 reply.writeNoException();
876 if (cph != null) {
877 reply.writeInt(1);
878 cph.writeToParcel(reply, 0);
879 } else {
880 reply.writeInt(0);
881 }
882 return true;
883 }
884
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800885 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
886 data.enforceInterface(IActivityManager.descriptor);
887 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700888 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800889 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700890 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800891 reply.writeNoException();
892 if (cph != null) {
893 reply.writeInt(1);
894 cph.writeToParcel(reply, 0);
895 } else {
896 reply.writeInt(0);
897 }
898 return true;
899 }
900
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800901 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
902 data.enforceInterface(IActivityManager.descriptor);
903 IBinder b = data.readStrongBinder();
904 IApplicationThread app = ApplicationThreadNative.asInterface(b);
905 ArrayList<ContentProviderHolder> providers =
906 data.createTypedArrayList(ContentProviderHolder.CREATOR);
907 publishContentProviders(app, providers);
908 reply.writeNoException();
909 return true;
910 }
911
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700912 case REF_CONTENT_PROVIDER_TRANSACTION: {
913 data.enforceInterface(IActivityManager.descriptor);
914 IBinder b = data.readStrongBinder();
915 int stable = data.readInt();
916 int unstable = data.readInt();
917 boolean res = refContentProvider(b, stable, unstable);
918 reply.writeNoException();
919 reply.writeInt(res ? 1 : 0);
920 return true;
921 }
922
923 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
924 data.enforceInterface(IActivityManager.descriptor);
925 IBinder b = data.readStrongBinder();
926 unstableProviderDied(b);
927 reply.writeNoException();
928 return true;
929 }
930
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700931 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
932 data.enforceInterface(IActivityManager.descriptor);
933 IBinder b = data.readStrongBinder();
934 appNotRespondingViaProvider(b);
935 reply.writeNoException();
936 return true;
937 }
938
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800939 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
940 data.enforceInterface(IActivityManager.descriptor);
941 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700942 boolean stable = data.readInt() != 0;
943 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800944 reply.writeNoException();
945 return true;
946 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800947
948 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
949 data.enforceInterface(IActivityManager.descriptor);
950 String name = data.readString();
951 IBinder token = data.readStrongBinder();
952 removeContentProviderExternal(name, token);
953 reply.writeNoException();
954 return true;
955 }
956
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700957 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
958 data.enforceInterface(IActivityManager.descriptor);
959 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
960 PendingIntent pi = getRunningServiceControlPanel(comp);
961 reply.writeNoException();
962 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
963 return true;
964 }
965
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800966 case START_SERVICE_TRANSACTION: {
967 data.enforceInterface(IActivityManager.descriptor);
968 IBinder b = data.readStrongBinder();
969 IApplicationThread app = ApplicationThreadNative.asInterface(b);
970 Intent service = Intent.CREATOR.createFromParcel(data);
971 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -0700972 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700973 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700974 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800975 reply.writeNoException();
976 ComponentName.writeToParcel(cn, reply);
977 return true;
978 }
979
980 case STOP_SERVICE_TRANSACTION: {
981 data.enforceInterface(IActivityManager.descriptor);
982 IBinder b = data.readStrongBinder();
983 IApplicationThread app = ApplicationThreadNative.asInterface(b);
984 Intent service = Intent.CREATOR.createFromParcel(data);
985 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700986 int userId = data.readInt();
987 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800988 reply.writeNoException();
989 reply.writeInt(res);
990 return true;
991 }
992
993 case STOP_SERVICE_TOKEN_TRANSACTION: {
994 data.enforceInterface(IActivityManager.descriptor);
995 ComponentName className = ComponentName.readFromParcel(data);
996 IBinder token = data.readStrongBinder();
997 int startId = data.readInt();
998 boolean res = stopServiceToken(className, token, startId);
999 reply.writeNoException();
1000 reply.writeInt(res ? 1 : 0);
1001 return true;
1002 }
1003
1004 case SET_SERVICE_FOREGROUND_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 ComponentName className = ComponentName.readFromParcel(data);
1007 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001008 int id = data.readInt();
1009 Notification notification = null;
1010 if (data.readInt() != 0) {
1011 notification = Notification.CREATOR.createFromParcel(data);
1012 }
1013 boolean removeNotification = data.readInt() != 0;
1014 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001015 reply.writeNoException();
1016 return true;
1017 }
1018
1019 case BIND_SERVICE_TRANSACTION: {
1020 data.enforceInterface(IActivityManager.descriptor);
1021 IBinder b = data.readStrongBinder();
1022 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1023 IBinder token = data.readStrongBinder();
1024 Intent service = Intent.CREATOR.createFromParcel(data);
1025 String resolvedType = data.readString();
1026 b = data.readStrongBinder();
1027 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -07001028 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -08001029 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001030 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -07001031 int res = bindService(app, token, service, resolvedType, conn, fl,
1032 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001033 reply.writeNoException();
1034 reply.writeInt(res);
1035 return true;
1036 }
1037
1038 case UNBIND_SERVICE_TRANSACTION: {
1039 data.enforceInterface(IActivityManager.descriptor);
1040 IBinder b = data.readStrongBinder();
1041 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
1042 boolean res = unbindService(conn);
1043 reply.writeNoException();
1044 reply.writeInt(res ? 1 : 0);
1045 return true;
1046 }
1047
1048 case PUBLISH_SERVICE_TRANSACTION: {
1049 data.enforceInterface(IActivityManager.descriptor);
1050 IBinder token = data.readStrongBinder();
1051 Intent intent = Intent.CREATOR.createFromParcel(data);
1052 IBinder service = data.readStrongBinder();
1053 publishService(token, intent, service);
1054 reply.writeNoException();
1055 return true;
1056 }
1057
1058 case UNBIND_FINISHED_TRANSACTION: {
1059 data.enforceInterface(IActivityManager.descriptor);
1060 IBinder token = data.readStrongBinder();
1061 Intent intent = Intent.CREATOR.createFromParcel(data);
1062 boolean doRebind = data.readInt() != 0;
1063 unbindFinished(token, intent, doRebind);
1064 reply.writeNoException();
1065 return true;
1066 }
1067
1068 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1069 data.enforceInterface(IActivityManager.descriptor);
1070 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001071 int type = data.readInt();
1072 int startId = data.readInt();
1073 int res = data.readInt();
1074 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001075 reply.writeNoException();
1076 return true;
1077 }
1078
1079 case START_INSTRUMENTATION_TRANSACTION: {
1080 data.enforceInterface(IActivityManager.descriptor);
1081 ComponentName className = ComponentName.readFromParcel(data);
1082 String profileFile = data.readString();
1083 int fl = data.readInt();
1084 Bundle arguments = data.readBundle();
1085 IBinder b = data.readStrongBinder();
1086 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001087 b = data.readStrongBinder();
1088 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001089 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001090 String abiOverride = data.readString();
1091 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1092 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001093 reply.writeNoException();
1094 reply.writeInt(res ? 1 : 0);
1095 return true;
1096 }
1097
1098
1099 case FINISH_INSTRUMENTATION_TRANSACTION: {
1100 data.enforceInterface(IActivityManager.descriptor);
1101 IBinder b = data.readStrongBinder();
1102 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1103 int resultCode = data.readInt();
1104 Bundle results = data.readBundle();
1105 finishInstrumentation(app, resultCode, results);
1106 reply.writeNoException();
1107 return true;
1108 }
1109
1110 case GET_CONFIGURATION_TRANSACTION: {
1111 data.enforceInterface(IActivityManager.descriptor);
1112 Configuration config = getConfiguration();
1113 reply.writeNoException();
1114 config.writeToParcel(reply, 0);
1115 return true;
1116 }
1117
1118 case UPDATE_CONFIGURATION_TRANSACTION: {
1119 data.enforceInterface(IActivityManager.descriptor);
1120 Configuration config = Configuration.CREATOR.createFromParcel(data);
1121 updateConfiguration(config);
1122 reply.writeNoException();
1123 return true;
1124 }
1125
1126 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1127 data.enforceInterface(IActivityManager.descriptor);
1128 IBinder token = data.readStrongBinder();
1129 int requestedOrientation = data.readInt();
1130 setRequestedOrientation(token, requestedOrientation);
1131 reply.writeNoException();
1132 return true;
1133 }
1134
1135 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1136 data.enforceInterface(IActivityManager.descriptor);
1137 IBinder token = data.readStrongBinder();
1138 int req = getRequestedOrientation(token);
1139 reply.writeNoException();
1140 reply.writeInt(req);
1141 return true;
1142 }
1143
1144 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1145 data.enforceInterface(IActivityManager.descriptor);
1146 IBinder token = data.readStrongBinder();
1147 ComponentName cn = getActivityClassForToken(token);
1148 reply.writeNoException();
1149 ComponentName.writeToParcel(cn, reply);
1150 return true;
1151 }
1152
1153 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1154 data.enforceInterface(IActivityManager.descriptor);
1155 IBinder token = data.readStrongBinder();
1156 reply.writeNoException();
1157 reply.writeString(getPackageForToken(token));
1158 return true;
1159 }
1160
1161 case GET_INTENT_SENDER_TRANSACTION: {
1162 data.enforceInterface(IActivityManager.descriptor);
1163 int type = data.readInt();
1164 String packageName = data.readString();
1165 IBinder token = data.readStrongBinder();
1166 String resultWho = data.readString();
1167 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001168 Intent[] requestIntents;
1169 String[] requestResolvedTypes;
1170 if (data.readInt() != 0) {
1171 requestIntents = data.createTypedArray(Intent.CREATOR);
1172 requestResolvedTypes = data.createStringArray();
1173 } else {
1174 requestIntents = null;
1175 requestResolvedTypes = null;
1176 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001177 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001178 Bundle options = data.readInt() != 0
1179 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001180 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001181 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001182 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001183 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001184 reply.writeNoException();
1185 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1186 return true;
1187 }
1188
1189 case CANCEL_INTENT_SENDER_TRANSACTION: {
1190 data.enforceInterface(IActivityManager.descriptor);
1191 IIntentSender r = IIntentSender.Stub.asInterface(
1192 data.readStrongBinder());
1193 cancelIntentSender(r);
1194 reply.writeNoException();
1195 return true;
1196 }
1197
1198 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1199 data.enforceInterface(IActivityManager.descriptor);
1200 IIntentSender r = IIntentSender.Stub.asInterface(
1201 data.readStrongBinder());
1202 String res = getPackageForIntentSender(r);
1203 reply.writeNoException();
1204 reply.writeString(res);
1205 return true;
1206 }
1207
Christopher Tatec4a07d12012-04-06 14:19:13 -07001208 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1209 data.enforceInterface(IActivityManager.descriptor);
1210 IIntentSender r = IIntentSender.Stub.asInterface(
1211 data.readStrongBinder());
1212 int res = getUidForIntentSender(r);
1213 reply.writeNoException();
1214 reply.writeInt(res);
1215 return true;
1216 }
1217
Dianne Hackborn41203752012-08-31 14:05:51 -07001218 case HANDLE_INCOMING_USER_TRANSACTION: {
1219 data.enforceInterface(IActivityManager.descriptor);
1220 int callingPid = data.readInt();
1221 int callingUid = data.readInt();
1222 int userId = data.readInt();
1223 boolean allowAll = data.readInt() != 0 ;
1224 boolean requireFull = data.readInt() != 0;
1225 String name = data.readString();
1226 String callerPackage = data.readString();
1227 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1228 requireFull, name, callerPackage);
1229 reply.writeNoException();
1230 reply.writeInt(res);
1231 return true;
1232 }
1233
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001234 case SET_PROCESS_LIMIT_TRANSACTION: {
1235 data.enforceInterface(IActivityManager.descriptor);
1236 int max = data.readInt();
1237 setProcessLimit(max);
1238 reply.writeNoException();
1239 return true;
1240 }
1241
1242 case GET_PROCESS_LIMIT_TRANSACTION: {
1243 data.enforceInterface(IActivityManager.descriptor);
1244 int limit = getProcessLimit();
1245 reply.writeNoException();
1246 reply.writeInt(limit);
1247 return true;
1248 }
1249
1250 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1251 data.enforceInterface(IActivityManager.descriptor);
1252 IBinder token = data.readStrongBinder();
1253 int pid = data.readInt();
1254 boolean isForeground = data.readInt() != 0;
1255 setProcessForeground(token, pid, isForeground);
1256 reply.writeNoException();
1257 return true;
1258 }
1259
1260 case CHECK_PERMISSION_TRANSACTION: {
1261 data.enforceInterface(IActivityManager.descriptor);
1262 String perm = data.readString();
1263 int pid = data.readInt();
1264 int uid = data.readInt();
1265 int res = checkPermission(perm, pid, uid);
1266 reply.writeNoException();
1267 reply.writeInt(res);
1268 return true;
1269 }
1270
Dianne Hackbornff170242014-11-19 10:59:01 -08001271 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1272 data.enforceInterface(IActivityManager.descriptor);
1273 String perm = data.readString();
1274 int pid = data.readInt();
1275 int uid = data.readInt();
1276 IBinder token = data.readStrongBinder();
1277 int res = checkPermissionWithToken(perm, pid, uid, token);
1278 reply.writeNoException();
1279 reply.writeInt(res);
1280 return true;
1281 }
1282
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001283 case CHECK_URI_PERMISSION_TRANSACTION: {
1284 data.enforceInterface(IActivityManager.descriptor);
1285 Uri uri = Uri.CREATOR.createFromParcel(data);
1286 int pid = data.readInt();
1287 int uid = data.readInt();
1288 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001289 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001290 IBinder callerToken = data.readStrongBinder();
1291 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001292 reply.writeNoException();
1293 reply.writeInt(res);
1294 return true;
1295 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001296
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001297 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001298 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001299 String packageName = data.readString();
1300 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1301 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001302 int userId = data.readInt();
1303 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001304 reply.writeNoException();
1305 reply.writeInt(res ? 1 : 0);
1306 return true;
1307 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001308
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001309 case GRANT_URI_PERMISSION_TRANSACTION: {
1310 data.enforceInterface(IActivityManager.descriptor);
1311 IBinder b = data.readStrongBinder();
1312 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1313 String targetPkg = data.readString();
1314 Uri uri = Uri.CREATOR.createFromParcel(data);
1315 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001316 int userId = data.readInt();
1317 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001318 reply.writeNoException();
1319 return true;
1320 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001321
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001322 case REVOKE_URI_PERMISSION_TRANSACTION: {
1323 data.enforceInterface(IActivityManager.descriptor);
1324 IBinder b = data.readStrongBinder();
1325 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1326 Uri uri = Uri.CREATOR.createFromParcel(data);
1327 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001328 int userId = data.readInt();
1329 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001330 reply.writeNoException();
1331 return true;
1332 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001333
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001334 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1335 data.enforceInterface(IActivityManager.descriptor);
1336 Uri uri = Uri.CREATOR.createFromParcel(data);
1337 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001338 int userId = data.readInt();
1339 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001340 reply.writeNoException();
1341 return true;
1342 }
1343
1344 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1345 data.enforceInterface(IActivityManager.descriptor);
1346 Uri uri = Uri.CREATOR.createFromParcel(data);
1347 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001348 int userId = data.readInt();
1349 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001350 reply.writeNoException();
1351 return true;
1352 }
1353
1354 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1355 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001356 final String packageName = data.readString();
1357 final boolean incoming = data.readInt() != 0;
1358 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1359 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001360 reply.writeNoException();
1361 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1362 return true;
1363 }
1364
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001365 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1366 data.enforceInterface(IActivityManager.descriptor);
1367 IBinder b = data.readStrongBinder();
1368 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1369 boolean waiting = data.readInt() != 0;
1370 showWaitingForDebugger(app, waiting);
1371 reply.writeNoException();
1372 return true;
1373 }
1374
1375 case GET_MEMORY_INFO_TRANSACTION: {
1376 data.enforceInterface(IActivityManager.descriptor);
1377 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1378 getMemoryInfo(mi);
1379 reply.writeNoException();
1380 mi.writeToParcel(reply, 0);
1381 return true;
1382 }
1383
1384 case UNHANDLED_BACK_TRANSACTION: {
1385 data.enforceInterface(IActivityManager.descriptor);
1386 unhandledBack();
1387 reply.writeNoException();
1388 return true;
1389 }
1390
1391 case OPEN_CONTENT_URI_TRANSACTION: {
1392 data.enforceInterface(IActivityManager.descriptor);
1393 Uri uri = Uri.parse(data.readString());
1394 ParcelFileDescriptor pfd = openContentUri(uri);
1395 reply.writeNoException();
1396 if (pfd != null) {
1397 reply.writeInt(1);
1398 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1399 } else {
1400 reply.writeInt(0);
1401 }
1402 return true;
1403 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001404
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001405 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1406 data.enforceInterface(IActivityManager.descriptor);
1407 setLockScreenShown(data.readInt() != 0);
1408 reply.writeNoException();
1409 return true;
1410 }
1411
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001412 case SET_DEBUG_APP_TRANSACTION: {
1413 data.enforceInterface(IActivityManager.descriptor);
1414 String pn = data.readString();
1415 boolean wfd = data.readInt() != 0;
1416 boolean per = data.readInt() != 0;
1417 setDebugApp(pn, wfd, per);
1418 reply.writeNoException();
1419 return true;
1420 }
1421
1422 case SET_ALWAYS_FINISH_TRANSACTION: {
1423 data.enforceInterface(IActivityManager.descriptor);
1424 boolean enabled = data.readInt() != 0;
1425 setAlwaysFinish(enabled);
1426 reply.writeNoException();
1427 return true;
1428 }
1429
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001430 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001431 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001432 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001433 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001434 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001435 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001436 return true;
1437 }
1438
1439 case ENTER_SAFE_MODE_TRANSACTION: {
1440 data.enforceInterface(IActivityManager.descriptor);
1441 enterSafeMode();
1442 reply.writeNoException();
1443 return true;
1444 }
1445
1446 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
1448 IIntentSender is = IIntentSender.Stub.asInterface(
1449 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001450 int sourceUid = data.readInt();
1451 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001452 String tag = data.readString();
1453 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1454 reply.writeNoException();
1455 return true;
1456 }
1457
1458 case NOTE_ALARM_START_TRANSACTION: {
1459 data.enforceInterface(IActivityManager.descriptor);
1460 IIntentSender is = IIntentSender.Stub.asInterface(
1461 data.readStrongBinder());
1462 int sourceUid = data.readInt();
1463 String tag = data.readString();
1464 noteAlarmStart(is, sourceUid, tag);
1465 reply.writeNoException();
1466 return true;
1467 }
1468
1469 case NOTE_ALARM_FINISH_TRANSACTION: {
1470 data.enforceInterface(IActivityManager.descriptor);
1471 IIntentSender is = IIntentSender.Stub.asInterface(
1472 data.readStrongBinder());
1473 int sourceUid = data.readInt();
1474 String tag = data.readString();
1475 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001476 reply.writeNoException();
1477 return true;
1478 }
1479
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001480 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001481 data.enforceInterface(IActivityManager.descriptor);
1482 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001483 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001484 boolean secure = data.readInt() != 0;
1485 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001486 reply.writeNoException();
1487 reply.writeInt(res ? 1 : 0);
1488 return true;
1489 }
1490
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001491 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1492 data.enforceInterface(IActivityManager.descriptor);
1493 String reason = data.readString();
1494 boolean res = killProcessesBelowForeground(reason);
1495 reply.writeNoException();
1496 reply.writeInt(res ? 1 : 0);
1497 return true;
1498 }
1499
Dan Egnor60d87622009-12-16 16:32:58 -08001500 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1501 data.enforceInterface(IActivityManager.descriptor);
1502 IBinder app = data.readStrongBinder();
1503 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1504 handleApplicationCrash(app, ci);
1505 reply.writeNoException();
1506 return true;
1507 }
1508
1509 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001510 data.enforceInterface(IActivityManager.descriptor);
1511 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001512 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001513 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001514 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001515 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001516 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001517 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001518 return true;
1519 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001520
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001521 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1522 data.enforceInterface(IActivityManager.descriptor);
1523 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001524 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001525 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1526 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001527 reply.writeNoException();
1528 return true;
1529 }
1530
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001531 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1532 data.enforceInterface(IActivityManager.descriptor);
1533 int sig = data.readInt();
1534 signalPersistentProcesses(sig);
1535 reply.writeNoException();
1536 return true;
1537 }
1538
Dianne Hackborn03abb812010-01-04 18:43:19 -08001539 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1540 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001541 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001542 int userId = data.readInt();
1543 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001544 reply.writeNoException();
1545 return true;
1546 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001547
1548 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1549 data.enforceInterface(IActivityManager.descriptor);
1550 killAllBackgroundProcesses();
1551 reply.writeNoException();
1552 return true;
1553 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001554
Dianne Hackborn03abb812010-01-04 18:43:19 -08001555 case FORCE_STOP_PACKAGE_TRANSACTION: {
1556 data.enforceInterface(IActivityManager.descriptor);
1557 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001558 int userId = data.readInt();
1559 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001560 reply.writeNoException();
1561 return true;
1562 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001563
1564 case GET_MY_MEMORY_STATE_TRANSACTION: {
1565 data.enforceInterface(IActivityManager.descriptor);
1566 ActivityManager.RunningAppProcessInfo info =
1567 new ActivityManager.RunningAppProcessInfo();
1568 getMyMemoryState(info);
1569 reply.writeNoException();
1570 info.writeToParcel(reply, 0);
1571 return true;
1572 }
1573
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001574 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1575 data.enforceInterface(IActivityManager.descriptor);
1576 ConfigurationInfo config = getDeviceConfigurationInfo();
1577 reply.writeNoException();
1578 config.writeToParcel(reply, 0);
1579 return true;
1580 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001581
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001582 case PROFILE_CONTROL_TRANSACTION: {
1583 data.enforceInterface(IActivityManager.descriptor);
1584 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001585 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001586 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001587 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001588 ProfilerInfo profilerInfo = data.readInt() != 0
1589 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1590 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001591 reply.writeNoException();
1592 reply.writeInt(res ? 1 : 0);
1593 return true;
1594 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001595
Dianne Hackborn55280a92009-05-07 15:53:46 -07001596 case SHUTDOWN_TRANSACTION: {
1597 data.enforceInterface(IActivityManager.descriptor);
1598 boolean res = shutdown(data.readInt());
1599 reply.writeNoException();
1600 reply.writeInt(res ? 1 : 0);
1601 return true;
1602 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001603
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001604 case STOP_APP_SWITCHES_TRANSACTION: {
1605 data.enforceInterface(IActivityManager.descriptor);
1606 stopAppSwitches();
1607 reply.writeNoException();
1608 return true;
1609 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001610
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001611 case RESUME_APP_SWITCHES_TRANSACTION: {
1612 data.enforceInterface(IActivityManager.descriptor);
1613 resumeAppSwitches();
1614 reply.writeNoException();
1615 return true;
1616 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001617
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001618 case PEEK_SERVICE_TRANSACTION: {
1619 data.enforceInterface(IActivityManager.descriptor);
1620 Intent service = Intent.CREATOR.createFromParcel(data);
1621 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001622 String callingPackage = data.readString();
1623 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001624 reply.writeNoException();
1625 reply.writeStrongBinder(binder);
1626 return true;
1627 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001628
Christopher Tate181fafa2009-05-14 11:12:14 -07001629 case START_BACKUP_AGENT_TRANSACTION: {
1630 data.enforceInterface(IActivityManager.descriptor);
1631 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1632 int backupRestoreMode = data.readInt();
1633 boolean success = bindBackupAgent(info, backupRestoreMode);
1634 reply.writeNoException();
1635 reply.writeInt(success ? 1 : 0);
1636 return true;
1637 }
1638
1639 case BACKUP_AGENT_CREATED_TRANSACTION: {
1640 data.enforceInterface(IActivityManager.descriptor);
1641 String packageName = data.readString();
1642 IBinder agent = data.readStrongBinder();
1643 backupAgentCreated(packageName, agent);
1644 reply.writeNoException();
1645 return true;
1646 }
1647
1648 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1649 data.enforceInterface(IActivityManager.descriptor);
1650 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1651 unbindBackupAgent(info);
1652 reply.writeNoException();
1653 return true;
1654 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001655
1656 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1657 data.enforceInterface(IActivityManager.descriptor);
1658 String packageName = data.readString();
1659 addPackageDependency(packageName);
1660 reply.writeNoException();
1661 return true;
1662 }
1663
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001664 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001665 data.enforceInterface(IActivityManager.descriptor);
1666 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001667 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001668 String reason = data.readString();
1669 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001670 reply.writeNoException();
1671 return true;
1672 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001673
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001674 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1675 data.enforceInterface(IActivityManager.descriptor);
1676 String reason = data.readString();
1677 closeSystemDialogs(reason);
1678 reply.writeNoException();
1679 return true;
1680 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001681
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001682 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1683 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001684 int[] pids = data.createIntArray();
1685 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001686 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001687 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001688 return true;
1689 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001690
1691 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1692 data.enforceInterface(IActivityManager.descriptor);
1693 String processName = data.readString();
1694 int uid = data.readInt();
1695 killApplicationProcess(processName, uid);
1696 reply.writeNoException();
1697 return true;
1698 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001699
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001700 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1701 data.enforceInterface(IActivityManager.descriptor);
1702 IBinder token = data.readStrongBinder();
1703 String packageName = data.readString();
1704 int enterAnim = data.readInt();
1705 int exitAnim = data.readInt();
1706 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001707 reply.writeNoException();
1708 return true;
1709 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001710
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001711 case IS_USER_A_MONKEY_TRANSACTION: {
1712 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001713 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001714 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001715 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001716 return true;
1717 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001718
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001719 case SET_USER_IS_MONKEY_TRANSACTION: {
1720 data.enforceInterface(IActivityManager.descriptor);
1721 final boolean monkey = (data.readInt() == 1);
1722 setUserIsMonkey(monkey);
1723 reply.writeNoException();
1724 return true;
1725 }
1726
Dianne Hackborn860755f2010-06-03 18:47:52 -07001727 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1728 data.enforceInterface(IActivityManager.descriptor);
1729 finishHeavyWeightApp();
1730 reply.writeNoException();
1731 return true;
1732 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001733
1734 case IS_IMMERSIVE_TRANSACTION: {
1735 data.enforceInterface(IActivityManager.descriptor);
1736 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001737 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001738 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001739 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001740 return true;
1741 }
1742
Craig Mautnerd61dc202014-07-07 11:09:11 -07001743 case IS_TOP_OF_TASK_TRANSACTION: {
1744 data.enforceInterface(IActivityManager.descriptor);
1745 IBinder token = data.readStrongBinder();
1746 final boolean isTopOfTask = isTopOfTask(token);
1747 reply.writeNoException();
1748 reply.writeInt(isTopOfTask ? 1 : 0);
1749 return true;
1750 }
1751
Craig Mautner5eda9b32013-07-02 11:58:16 -07001752 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001753 data.enforceInterface(IActivityManager.descriptor);
1754 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001755 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001756 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001757 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001758 return true;
1759 }
1760
1761 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001764 final Bundle bundle;
1765 if (data.readInt() == 0) {
1766 bundle = null;
1767 } else {
1768 bundle = data.readBundle();
1769 }
Chong Zhang280d3322015-11-03 17:27:26 -08001770 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Craig Mautner233ceee2014-05-09 17:05:11 -07001771 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001772 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001773 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001774 return true;
1775 }
1776
Craig Mautner233ceee2014-05-09 17:05:11 -07001777 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1778 data.enforceInterface(IActivityManager.descriptor);
1779 IBinder token = data.readStrongBinder();
1780 final ActivityOptions options = getActivityOptions(token);
1781 reply.writeNoException();
1782 reply.writeBundle(options == null ? null : options.toBundle());
1783 return true;
1784 }
1785
Daniel Sandler69a48172010-06-23 16:29:36 -04001786 case SET_IMMERSIVE_TRANSACTION: {
1787 data.enforceInterface(IActivityManager.descriptor);
1788 IBinder token = data.readStrongBinder();
1789 boolean imm = data.readInt() == 1;
1790 setImmersive(token, imm);
1791 reply.writeNoException();
1792 return true;
1793 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001794
Daniel Sandler69a48172010-06-23 16:29:36 -04001795 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1796 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001797 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001798 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001799 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001800 return true;
1801 }
1802
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001803 case CRASH_APPLICATION_TRANSACTION: {
1804 data.enforceInterface(IActivityManager.descriptor);
1805 int uid = data.readInt();
1806 int initialPid = data.readInt();
1807 String packageName = data.readString();
1808 String message = data.readString();
1809 crashApplication(uid, initialPid, packageName, message);
1810 reply.writeNoException();
1811 return true;
1812 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001813
1814 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1815 data.enforceInterface(IActivityManager.descriptor);
1816 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001817 int userId = data.readInt();
1818 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001819 reply.writeNoException();
1820 reply.writeString(type);
1821 return true;
1822 }
1823
Dianne Hackborn7e269642010-08-25 19:50:20 -07001824 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1825 data.enforceInterface(IActivityManager.descriptor);
1826 String name = data.readString();
1827 IBinder perm = newUriPermissionOwner(name);
1828 reply.writeNoException();
1829 reply.writeStrongBinder(perm);
1830 return true;
1831 }
1832
1833 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1834 data.enforceInterface(IActivityManager.descriptor);
1835 IBinder owner = data.readStrongBinder();
1836 int fromUid = data.readInt();
1837 String targetPkg = data.readString();
1838 Uri uri = Uri.CREATOR.createFromParcel(data);
1839 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001840 int sourceUserId = data.readInt();
1841 int targetUserId = data.readInt();
1842 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1843 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001844 reply.writeNoException();
1845 return true;
1846 }
1847
1848 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1849 data.enforceInterface(IActivityManager.descriptor);
1850 IBinder owner = data.readStrongBinder();
1851 Uri uri = null;
1852 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001853 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001854 }
1855 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001856 int userId = data.readInt();
1857 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001858 reply.writeNoException();
1859 return true;
1860 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001861
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001862 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1863 data.enforceInterface(IActivityManager.descriptor);
1864 int callingUid = data.readInt();
1865 String targetPkg = data.readString();
1866 Uri uri = Uri.CREATOR.createFromParcel(data);
1867 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001868 int userId = data.readInt();
1869 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001870 reply.writeNoException();
1871 reply.writeInt(res);
1872 return true;
1873 }
1874
Andy McFadden824c5102010-07-09 16:26:57 -07001875 case DUMP_HEAP_TRANSACTION: {
1876 data.enforceInterface(IActivityManager.descriptor);
1877 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001878 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001879 boolean managed = data.readInt() != 0;
1880 String path = data.readString();
1881 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001882 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001883 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001884 reply.writeNoException();
1885 reply.writeInt(res ? 1 : 0);
1886 return true;
1887 }
1888
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001889 case START_ACTIVITIES_TRANSACTION:
1890 {
1891 data.enforceInterface(IActivityManager.descriptor);
1892 IBinder b = data.readStrongBinder();
1893 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001894 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001895 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1896 String[] resolvedTypes = data.createStringArray();
1897 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001898 Bundle options = data.readInt() != 0
1899 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001900 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001901 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001902 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001903 reply.writeNoException();
1904 reply.writeInt(result);
1905 return true;
1906 }
1907
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001908 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1909 {
1910 data.enforceInterface(IActivityManager.descriptor);
1911 int mode = getFrontActivityScreenCompatMode();
1912 reply.writeNoException();
1913 reply.writeInt(mode);
1914 return true;
1915 }
1916
1917 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1918 {
1919 data.enforceInterface(IActivityManager.descriptor);
1920 int mode = data.readInt();
1921 setFrontActivityScreenCompatMode(mode);
1922 reply.writeNoException();
1923 reply.writeInt(mode);
1924 return true;
1925 }
1926
1927 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1928 {
1929 data.enforceInterface(IActivityManager.descriptor);
1930 String pkg = data.readString();
1931 int mode = getPackageScreenCompatMode(pkg);
1932 reply.writeNoException();
1933 reply.writeInt(mode);
1934 return true;
1935 }
1936
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001937 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1938 {
1939 data.enforceInterface(IActivityManager.descriptor);
1940 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001941 int mode = data.readInt();
1942 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001943 reply.writeNoException();
1944 return true;
1945 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001946
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001947 case SWITCH_USER_TRANSACTION: {
1948 data.enforceInterface(IActivityManager.descriptor);
1949 int userid = data.readInt();
1950 boolean result = switchUser(userid);
1951 reply.writeNoException();
1952 reply.writeInt(result ? 1 : 0);
1953 return true;
1954 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001955
Kenny Guy08488bf2014-02-21 17:40:37 +00001956 case START_USER_IN_BACKGROUND_TRANSACTION: {
1957 data.enforceInterface(IActivityManager.descriptor);
1958 int userid = data.readInt();
1959 boolean result = startUserInBackground(userid);
1960 reply.writeNoException();
1961 reply.writeInt(result ? 1 : 0);
1962 return true;
1963 }
1964
Jeff Sharkeyba512352015-11-12 20:17:45 -08001965 case UNLOCK_USER_TRANSACTION: {
1966 data.enforceInterface(IActivityManager.descriptor);
1967 int userId = data.readInt();
1968 byte[] token = data.createByteArray();
1969 boolean result = unlockUser(userId, token);
1970 reply.writeNoException();
1971 reply.writeInt(result ? 1 : 0);
1972 return true;
1973 }
1974
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001975 case STOP_USER_TRANSACTION: {
1976 data.enforceInterface(IActivityManager.descriptor);
1977 int userid = data.readInt();
1978 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1979 data.readStrongBinder());
1980 int result = stopUser(userid, callback);
1981 reply.writeNoException();
1982 reply.writeInt(result);
1983 return true;
1984 }
1985
Amith Yamasani52f1d752012-03-28 18:19:29 -07001986 case GET_CURRENT_USER_TRANSACTION: {
1987 data.enforceInterface(IActivityManager.descriptor);
1988 UserInfo userInfo = getCurrentUser();
1989 reply.writeNoException();
1990 userInfo.writeToParcel(reply, 0);
1991 return true;
1992 }
1993
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001994 case IS_USER_RUNNING_TRANSACTION: {
1995 data.enforceInterface(IActivityManager.descriptor);
1996 int userid = data.readInt();
Jeff Sharkeye17ac152015-11-06 22:40:29 -08001997 int _flags = data.readInt();
1998 boolean result = isUserRunning(userid, _flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001999 reply.writeNoException();
2000 reply.writeInt(result ? 1 : 0);
2001 return true;
2002 }
2003
Dianne Hackbornc72fc672012-09-20 13:12:03 -07002004 case GET_RUNNING_USER_IDS_TRANSACTION: {
2005 data.enforceInterface(IActivityManager.descriptor);
2006 int[] result = getRunningUserIds();
2007 reply.writeNoException();
2008 reply.writeIntArray(result);
2009 return true;
2010 }
2011
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002012 case REMOVE_TASK_TRANSACTION:
2013 {
2014 data.enforceInterface(IActivityManager.descriptor);
2015 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07002016 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07002017 reply.writeNoException();
2018 reply.writeInt(result ? 1 : 0);
2019 return true;
2020 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07002021
Jeff Sharkeya4620792011-05-20 15:29:23 -07002022 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
2023 data.enforceInterface(IActivityManager.descriptor);
2024 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2025 data.readStrongBinder());
2026 registerProcessObserver(observer);
2027 return true;
2028 }
2029
2030 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
2031 data.enforceInterface(IActivityManager.descriptor);
2032 IProcessObserver observer = IProcessObserver.Stub.asInterface(
2033 data.readStrongBinder());
2034 unregisterProcessObserver(observer);
2035 return true;
2036 }
2037
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002038 case REGISTER_UID_OBSERVER_TRANSACTION: {
2039 data.enforceInterface(IActivityManager.descriptor);
2040 IUidObserver observer = IUidObserver.Stub.asInterface(
2041 data.readStrongBinder());
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002042 int which = data.readInt();
2043 registerUidObserver(observer, which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07002044 return true;
2045 }
2046
2047 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
2048 data.enforceInterface(IActivityManager.descriptor);
2049 IUidObserver observer = IUidObserver.Stub.asInterface(
2050 data.readStrongBinder());
2051 unregisterUidObserver(observer);
2052 return true;
2053 }
2054
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07002055 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2056 {
2057 data.enforceInterface(IActivityManager.descriptor);
2058 String pkg = data.readString();
2059 boolean ask = getPackageAskScreenCompat(pkg);
2060 reply.writeNoException();
2061 reply.writeInt(ask ? 1 : 0);
2062 return true;
2063 }
2064
2065 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2066 {
2067 data.enforceInterface(IActivityManager.descriptor);
2068 String pkg = data.readString();
2069 boolean ask = data.readInt() != 0;
2070 setPackageAskScreenCompat(pkg, ask);
2071 reply.writeNoException();
2072 return true;
2073 }
2074
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002075 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2076 data.enforceInterface(IActivityManager.descriptor);
2077 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002078 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002079 boolean res = isIntentSenderTargetedToPackage(r);
2080 reply.writeNoException();
2081 reply.writeInt(res ? 1 : 0);
2082 return true;
2083 }
2084
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002085 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2086 data.enforceInterface(IActivityManager.descriptor);
2087 IIntentSender r = IIntentSender.Stub.asInterface(
2088 data.readStrongBinder());
2089 boolean res = isIntentSenderAnActivity(r);
2090 reply.writeNoException();
2091 reply.writeInt(res ? 1 : 0);
2092 return true;
2093 }
2094
Dianne Hackborn81038902012-11-26 17:04:09 -08002095 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2096 data.enforceInterface(IActivityManager.descriptor);
2097 IIntentSender r = IIntentSender.Stub.asInterface(
2098 data.readStrongBinder());
2099 Intent intent = getIntentForIntentSender(r);
2100 reply.writeNoException();
2101 if (intent != null) {
2102 reply.writeInt(1);
2103 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2104 } else {
2105 reply.writeInt(0);
2106 }
2107 return true;
2108 }
2109
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002110 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2111 data.enforceInterface(IActivityManager.descriptor);
2112 IIntentSender r = IIntentSender.Stub.asInterface(
2113 data.readStrongBinder());
2114 String prefix = data.readString();
2115 String tag = getTagForIntentSender(r, prefix);
2116 reply.writeNoException();
2117 reply.writeString(tag);
2118 return true;
2119 }
2120
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002121 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2122 data.enforceInterface(IActivityManager.descriptor);
2123 Configuration config = Configuration.CREATOR.createFromParcel(data);
2124 updatePersistentConfiguration(config);
2125 reply.writeNoException();
2126 return true;
2127 }
2128
Dianne Hackbornb437e092011-08-05 17:50:29 -07002129 case GET_PROCESS_PSS_TRANSACTION: {
2130 data.enforceInterface(IActivityManager.descriptor);
2131 int[] pids = data.createIntArray();
2132 long[] pss = getProcessPss(pids);
2133 reply.writeNoException();
2134 reply.writeLongArray(pss);
2135 return true;
2136 }
2137
Dianne Hackborn661cd522011-08-22 00:26:20 -07002138 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2139 data.enforceInterface(IActivityManager.descriptor);
2140 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2141 boolean always = data.readInt() != 0;
2142 showBootMessage(msg, always);
2143 reply.writeNoException();
2144 return true;
2145 }
2146
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002147 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002148 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002149 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002150 reply.writeNoException();
2151 return true;
2152 }
2153
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002154 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2155 data.enforceInterface(IActivityManager.descriptor);
2156 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2157 reply.writeNoException();
2158 return true;
2159 }
2160
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002161 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002162 data.enforceInterface(IActivityManager.descriptor);
2163 IBinder token = data.readStrongBinder();
2164 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002165 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002166 reply.writeNoException();
2167 reply.writeInt(res ? 1 : 0);
2168 return true;
2169 }
2170
2171 case NAVIGATE_UP_TO_TRANSACTION: {
2172 data.enforceInterface(IActivityManager.descriptor);
2173 IBinder token = data.readStrongBinder();
2174 Intent target = Intent.CREATOR.createFromParcel(data);
2175 int resultCode = data.readInt();
2176 Intent resultData = null;
2177 if (data.readInt() != 0) {
2178 resultData = Intent.CREATOR.createFromParcel(data);
2179 }
2180 boolean res = navigateUpTo(token, target, resultCode, resultData);
2181 reply.writeNoException();
2182 reply.writeInt(res ? 1 : 0);
2183 return true;
2184 }
2185
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002186 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2187 data.enforceInterface(IActivityManager.descriptor);
2188 IBinder token = data.readStrongBinder();
2189 int res = getLaunchedFromUid(token);
2190 reply.writeNoException();
2191 reply.writeInt(res);
2192 return true;
2193 }
2194
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002195 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2196 data.enforceInterface(IActivityManager.descriptor);
2197 IBinder token = data.readStrongBinder();
2198 String res = getLaunchedFromPackage(token);
2199 reply.writeNoException();
2200 reply.writeString(res);
2201 return true;
2202 }
2203
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002204 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2205 data.enforceInterface(IActivityManager.descriptor);
2206 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2207 data.readStrongBinder());
2208 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002209 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002210 return true;
2211 }
2212
2213 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2214 data.enforceInterface(IActivityManager.descriptor);
2215 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2216 data.readStrongBinder());
2217 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002218 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002219 return true;
2220 }
2221
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002222 case REQUEST_BUG_REPORT_TRANSACTION: {
2223 data.enforceInterface(IActivityManager.descriptor);
2224 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002225 reply.writeNoException();
2226 return true;
2227 }
2228
2229 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2230 data.enforceInterface(IActivityManager.descriptor);
2231 int pid = data.readInt();
2232 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002233 String reason = data.readString();
2234 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002235 reply.writeNoException();
2236 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002237 return true;
2238 }
2239
Adam Skorydfc7fd72013-08-05 19:23:41 -07002240 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002241 data.enforceInterface(IActivityManager.descriptor);
2242 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002243 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002244 reply.writeNoException();
2245 reply.writeBundle(res);
2246 return true;
2247 }
2248
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002249 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2250 data.enforceInterface(IActivityManager.descriptor);
2251 int requestType = data.readInt();
2252 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002253 IBinder activityToken = data.readStrongBinder();
2254 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002255 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002256 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002257 return true;
2258 }
2259
Adam Skorydfc7fd72013-08-05 19:23:41 -07002260 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002261 data.enforceInterface(IActivityManager.descriptor);
2262 IBinder token = data.readStrongBinder();
2263 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002264 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2265 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002266 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2267 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002268 reply.writeNoException();
2269 return true;
2270 }
2271
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002272 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2273 data.enforceInterface(IActivityManager.descriptor);
2274 Intent intent = Intent.CREATOR.createFromParcel(data);
2275 int requestType = data.readInt();
2276 String hint = data.readString();
2277 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002278 Bundle args = data.readBundle();
2279 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002280 reply.writeNoException();
2281 reply.writeInt(res ? 1 : 0);
2282 return true;
2283 }
2284
Benjamin Franzc200f442015-06-25 18:20:04 +01002285 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2286 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002287 boolean res = isAssistDataAllowedOnCurrentActivity();
2288 reply.writeNoException();
2289 reply.writeInt(res ? 1 : 0);
2290 return true;
2291 }
2292
2293 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2294 data.enforceInterface(IActivityManager.descriptor);
2295 IBinder token = data.readStrongBinder();
2296 Bundle args = data.readBundle();
2297 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002298 reply.writeNoException();
2299 reply.writeInt(res ? 1 : 0);
2300 return true;
2301 }
2302
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002303 case KILL_UID_TRANSACTION: {
2304 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002305 int appId = data.readInt();
2306 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002307 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002308 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002309 reply.writeNoException();
2310 return true;
2311 }
2312
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002313 case HANG_TRANSACTION: {
2314 data.enforceInterface(IActivityManager.descriptor);
2315 IBinder who = data.readStrongBinder();
2316 boolean allowRestart = data.readInt() != 0;
2317 hang(who, allowRestart);
2318 reply.writeNoException();
2319 return true;
2320 }
2321
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002322 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2323 data.enforceInterface(IActivityManager.descriptor);
2324 IBinder token = data.readStrongBinder();
2325 reportActivityFullyDrawn(token);
2326 reply.writeNoException();
2327 return true;
2328 }
2329
Craig Mautner5eda9b32013-07-02 11:58:16 -07002330 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2331 data.enforceInterface(IActivityManager.descriptor);
2332 IBinder token = data.readStrongBinder();
2333 notifyActivityDrawn(token);
2334 reply.writeNoException();
2335 return true;
2336 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002337
2338 case RESTART_TRANSACTION: {
2339 data.enforceInterface(IActivityManager.descriptor);
2340 restart();
2341 reply.writeNoException();
2342 return true;
2343 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002344
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002345 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2346 data.enforceInterface(IActivityManager.descriptor);
2347 performIdleMaintenance();
2348 reply.writeNoException();
2349 return true;
2350 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002351
Todd Kennedyca4d8422015-01-15 15:19:22 -08002352 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002353 data.enforceInterface(IActivityManager.descriptor);
2354 IBinder parentActivityToken = data.readStrongBinder();
2355 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002356 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002357 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002358 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002359 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002360 if (activityContainer != null) {
2361 reply.writeInt(1);
2362 reply.writeStrongBinder(activityContainer.asBinder());
2363 } else {
2364 reply.writeInt(0);
2365 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002366 return true;
2367 }
2368
Craig Mautner95da1082014-02-24 17:54:35 -08002369 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2370 data.enforceInterface(IActivityManager.descriptor);
2371 IActivityContainer activityContainer =
2372 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2373 deleteActivityContainer(activityContainer);
2374 reply.writeNoException();
2375 return true;
2376 }
2377
Todd Kennedy4900bf92015-01-16 16:05:14 -08002378 case CREATE_STACK_ON_DISPLAY: {
2379 data.enforceInterface(IActivityManager.descriptor);
2380 int displayId = data.readInt();
2381 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2382 reply.writeNoException();
2383 if (activityContainer != null) {
2384 reply.writeInt(1);
2385 reply.writeStrongBinder(activityContainer.asBinder());
2386 } else {
2387 reply.writeInt(0);
2388 }
2389 return true;
2390 }
2391
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002392 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002393 data.enforceInterface(IActivityManager.descriptor);
2394 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002395 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002396 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002397 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002398 return true;
2399 }
2400
Craig Mautneraea74a52014-03-08 14:23:10 -08002401 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2402 data.enforceInterface(IActivityManager.descriptor);
2403 final int taskId = data.readInt();
2404 startLockTaskMode(taskId);
2405 reply.writeNoException();
2406 return true;
2407 }
2408
2409 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2410 data.enforceInterface(IActivityManager.descriptor);
2411 IBinder token = data.readStrongBinder();
2412 startLockTaskMode(token);
2413 reply.writeNoException();
2414 return true;
2415 }
2416
Craig Mautnerd61dc202014-07-07 11:09:11 -07002417 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002418 data.enforceInterface(IActivityManager.descriptor);
2419 startLockTaskModeOnCurrent();
2420 reply.writeNoException();
2421 return true;
2422 }
2423
Craig Mautneraea74a52014-03-08 14:23:10 -08002424 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2425 data.enforceInterface(IActivityManager.descriptor);
2426 stopLockTaskMode();
2427 reply.writeNoException();
2428 return true;
2429 }
2430
Craig Mautnerd61dc202014-07-07 11:09:11 -07002431 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002432 data.enforceInterface(IActivityManager.descriptor);
2433 stopLockTaskModeOnCurrent();
2434 reply.writeNoException();
2435 return true;
2436 }
2437
Craig Mautneraea74a52014-03-08 14:23:10 -08002438 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2439 data.enforceInterface(IActivityManager.descriptor);
2440 final boolean isInLockTaskMode = isInLockTaskMode();
2441 reply.writeNoException();
2442 reply.writeInt(isInLockTaskMode ? 1 : 0);
2443 return true;
2444 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002445
Benjamin Franz43261142015-02-11 15:59:44 +00002446 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2447 data.enforceInterface(IActivityManager.descriptor);
2448 final int lockTaskModeState = getLockTaskModeState();
2449 reply.writeNoException();
2450 reply.writeInt(lockTaskModeState);
2451 return true;
2452 }
2453
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002454 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2455 data.enforceInterface(IActivityManager.descriptor);
2456 final IBinder token = data.readStrongBinder();
2457 showLockTaskEscapeMessage(token);
2458 reply.writeNoException();
2459 return true;
2460 }
2461
Winson Chunga449dc02014-05-16 11:15:04 -07002462 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002463 data.enforceInterface(IActivityManager.descriptor);
2464 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002465 ActivityManager.TaskDescription values =
2466 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2467 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002468 reply.writeNoException();
2469 return true;
2470 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002471
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002472 case SET_TASK_RESIZEABLE_TRANSACTION: {
2473 data.enforceInterface(IActivityManager.descriptor);
2474 int taskId = data.readInt();
2475 boolean resizeable = (data.readInt() == 1) ? true : false;
2476 setTaskResizeable(taskId, resizeable);
2477 reply.writeNoException();
2478 return true;
2479 }
2480
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002481 case RESIZE_TASK_TRANSACTION: {
2482 data.enforceInterface(IActivityManager.descriptor);
2483 int taskId = data.readInt();
Chong Zhang87b21722015-09-21 15:39:51 -07002484 int resizeMode = data.readInt();
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002485 Rect r = Rect.CREATOR.createFromParcel(data);
Chong Zhang87b21722015-09-21 15:39:51 -07002486 resizeTask(taskId, r, resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002487 reply.writeNoException();
2488 return true;
2489 }
2490
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07002491 case GET_TASK_BOUNDS_TRANSACTION: {
2492 data.enforceInterface(IActivityManager.descriptor);
2493 int taskId = data.readInt();
2494 Rect r = getTaskBounds(taskId);
2495 reply.writeNoException();
2496 r.writeToParcel(reply, 0);
2497 return true;
2498 }
2499
Craig Mautner648f69b2014-09-18 14:16:26 -07002500 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2501 data.enforceInterface(IActivityManager.descriptor);
2502 String filename = data.readString();
2503 Bitmap icon = getTaskDescriptionIcon(filename);
2504 reply.writeNoException();
2505 if (icon == null) {
2506 reply.writeInt(0);
2507 } else {
2508 reply.writeInt(1);
2509 icon.writeToParcel(reply, 0);
2510 }
2511 return true;
2512 }
2513
Winson Chung044d5292014-11-06 11:05:19 -08002514 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2515 data.enforceInterface(IActivityManager.descriptor);
2516 final Bundle bundle;
2517 if (data.readInt() == 0) {
2518 bundle = null;
2519 } else {
2520 bundle = data.readBundle();
2521 }
Chong Zhang280d3322015-11-03 17:27:26 -08002522 final ActivityOptions options = ActivityOptions.fromBundle(bundle);
Winson Chung044d5292014-11-06 11:05:19 -08002523 startInPlaceAnimationOnFrontMostApplication(options);
2524 reply.writeNoException();
2525 return true;
2526 }
2527
Jose Lima4b6c6692014-08-12 17:41:12 -07002528 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002529 data.enforceInterface(IActivityManager.descriptor);
2530 IBinder token = data.readStrongBinder();
2531 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002532 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002533 reply.writeNoException();
2534 reply.writeInt(success ? 1 : 0);
2535 return true;
2536 }
2537
Jose Lima4b6c6692014-08-12 17:41:12 -07002538 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002539 data.enforceInterface(IActivityManager.descriptor);
2540 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002541 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002542 reply.writeNoException();
2543 reply.writeInt(enabled ? 1 : 0);
2544 return true;
2545 }
2546
Jose Lima4b6c6692014-08-12 17:41:12 -07002547 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002548 data.enforceInterface(IActivityManager.descriptor);
2549 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002550 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002551 reply.writeNoException();
2552 return true;
2553 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002554
2555 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2556 data.enforceInterface(IActivityManager.descriptor);
2557 IBinder token = data.readStrongBinder();
2558 notifyLaunchTaskBehindComplete(token);
2559 reply.writeNoException();
2560 return true;
2561 }
Craig Mautner8746a472014-07-24 15:12:54 -07002562
2563 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2564 data.enforceInterface(IActivityManager.descriptor);
2565 IBinder token = data.readStrongBinder();
2566 notifyEnterAnimationComplete(token);
2567 reply.writeNoException();
2568 return true;
2569 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002570
2571 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2572 data.enforceInterface(IActivityManager.descriptor);
2573 bootAnimationComplete();
2574 reply.writeNoException();
2575 return true;
2576 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002577
Jeff Sharkey605eb792014-11-04 13:34:06 -08002578 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2579 data.enforceInterface(IActivityManager.descriptor);
2580 final int uid = data.readInt();
2581 final byte[] firstPacket = data.createByteArray();
2582 notifyCleartextNetwork(uid, firstPacket);
2583 reply.writeNoException();
2584 return true;
2585 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002586
2587 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2588 data.enforceInterface(IActivityManager.descriptor);
2589 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002590 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002591 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002592 String reportPackage = data.readString();
2593 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002594 reply.writeNoException();
2595 return true;
2596 }
2597
2598 case DUMP_HEAP_FINISHED_TRANSACTION: {
2599 data.enforceInterface(IActivityManager.descriptor);
2600 String path = data.readString();
2601 dumpHeapFinished(path);
2602 reply.writeNoException();
2603 return true;
2604 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002605
2606 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2607 data.enforceInterface(IActivityManager.descriptor);
2608 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2609 data.readStrongBinder());
2610 boolean keepAwake = data.readInt() != 0;
2611 setVoiceKeepAwake(session, keepAwake);
2612 reply.writeNoException();
2613 return true;
2614 }
Craig Mautnere5600772015-04-03 21:36:37 -07002615
2616 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2617 data.enforceInterface(IActivityManager.descriptor);
2618 int userId = data.readInt();
2619 String[] packages = data.readStringArray();
2620 updateLockTaskPackages(userId, packages);
2621 reply.writeNoException();
2622 return true;
2623 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002624
Makoto Onuki219bbaf2015-11-12 01:38:47 +00002625 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2626 data.enforceInterface(IActivityManager.descriptor);
2627 String packageName = data.readString();
2628 updateDeviceOwner(packageName);
2629 reply.writeNoException();
2630 return true;
2631 }
2632
Dianne Hackborn1e383822015-04-10 14:02:33 -07002633 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2634 data.enforceInterface(IActivityManager.descriptor);
2635 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002636 String callingPackage = data.readString();
2637 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002638 reply.writeNoException();
2639 reply.writeInt(res);
2640 return true;
2641 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002642
2643 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2644 data.enforceInterface(IActivityManager.descriptor);
2645 String process = data.readString();
2646 int userId = data.readInt();
2647 int level = data.readInt();
2648 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2649 reply.writeNoException();
2650 reply.writeInt(res ? 1 : 0);
2651 return true;
2652 }
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002653
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002654 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2655 data.enforceInterface(IActivityManager.descriptor);
2656 IBinder token = data.readStrongBinder();
2657 boolean res = isRootVoiceInteraction(token);
2658 reply.writeNoException();
2659 reply.writeInt(res ? 1 : 0);
2660 return true;
2661 }
Ian Pedowitza3710842015-08-03 23:36:15 -07002662
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04002663 case START_BINDER_TRACKING_TRANSACTION: {
2664 data.enforceInterface(IActivityManager.descriptor);
2665 boolean res = startBinderTracking();
2666 reply.writeNoException();
2667 reply.writeInt(res ? 1 : 0);
2668 return true;
2669 }
2670
2671 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: {
2672 data.enforceInterface(IActivityManager.descriptor);
2673 ParcelFileDescriptor fd = data.readInt() != 0
2674 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
2675 boolean res = stopBinderTrackingAndDump(fd);
2676 reply.writeNoException();
2677 reply.writeInt(res ? 1 : 0);
2678 return true;
2679 }
Wale Ogunwale868a5e12015-08-02 16:19:20 -07002680 case GET_ACTIVITY_STACK_ID_TRANSACTION: {
2681 data.enforceInterface(IActivityManager.descriptor);
2682 IBinder token = data.readStrongBinder();
2683 int stackId = getActivityStackId(token);
2684 reply.writeNoException();
2685 reply.writeInt(stackId);
2686 return true;
2687 }
2688 case MOVE_ACTIVITY_TO_STACK_TRANSACTION: {
2689 data.enforceInterface(IActivityManager.descriptor);
2690 IBinder token = data.readStrongBinder();
2691 int stackId = data.readInt();
2692 moveActivityToStack(token, stackId);
2693 reply.writeNoException();
2694 return true;
2695 }
Filip Gruszczynski23493322015-07-29 17:02:59 -07002696 case REPORT_SIZE_CONFIGURATIONS: {
2697 data.enforceInterface(IActivityManager.descriptor);
2698 IBinder token = data.readStrongBinder();
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002699 int[] horizontal = readIntArray(data);
2700 int[] vertical = readIntArray(data);
2701 int[] smallest = readIntArray(data);
2702 reportSizeConfigurations(token, horizontal, vertical, smallest);
Filip Gruszczynski23493322015-07-29 17:02:59 -07002703 return true;
2704 }
Wale Ogunwale83301a92015-09-24 15:54:08 -07002705 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: {
2706 data.enforceInterface(IActivityManager.descriptor);
2707 final boolean suppress = data.readInt() == 1;
2708 suppressResizeConfigChanges(suppress);
2709 reply.writeNoException();
2710 return true;
2711 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002712 case REMOVE_STACK_TRANSACTION: {
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07002713 data.enforceInterface(IActivityManager.descriptor);
2714 final int stackId = data.readInt();
2715 removeStack(stackId);
2716 reply.writeNoException();
2717 return true;
2718 }
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07002719 case GET_APP_START_MODE_TRANSACTION: {
2720 data.enforceInterface(IActivityManager.descriptor);
2721 final int uid = data.readInt();
2722 final String pkg = data.readString();
2723 int res = getAppStartMode(uid, pkg);
2724 reply.writeNoException();
2725 reply.writeInt(res);
2726 return true;
2727 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002728 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002729
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002730 return super.onTransact(code, data, reply, flags);
2731 }
2732
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07002733 private int[] readIntArray(Parcel data) {
2734 int[] smallest = null;
2735 int smallestSize = data.readInt();
2736 if (smallestSize > 0) {
2737 smallest = new int[smallestSize];
2738 data.readIntArray(smallest);
2739 }
2740 return smallest;
2741 }
2742
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002743 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002744 return this;
2745 }
2746
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002747 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2748 protected IActivityManager create() {
2749 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002750 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002751 Log.v("ActivityManager", "default service binder = " + b);
2752 }
2753 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002754 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002755 Log.v("ActivityManager", "default service = " + am);
2756 }
2757 return am;
2758 }
2759 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002760}
2761
2762class ActivityManagerProxy implements IActivityManager
2763{
2764 public ActivityManagerProxy(IBinder remote)
2765 {
2766 mRemote = remote;
2767 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002768
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002769 public IBinder asBinder()
2770 {
2771 return mRemote;
2772 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002773
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002774 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002775 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002776 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002777 Parcel data = Parcel.obtain();
2778 Parcel reply = Parcel.obtain();
2779 data.writeInterfaceToken(IActivityManager.descriptor);
2780 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002781 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002782 intent.writeToParcel(data, 0);
2783 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002784 data.writeStrongBinder(resultTo);
2785 data.writeString(resultWho);
2786 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002787 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002788 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002789 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002790 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002791 } else {
2792 data.writeInt(0);
2793 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002794 if (options != null) {
2795 data.writeInt(1);
2796 options.writeToParcel(data, 0);
2797 } else {
2798 data.writeInt(0);
2799 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002800 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2801 reply.readException();
2802 int result = reply.readInt();
2803 reply.recycle();
2804 data.recycle();
2805 return result;
2806 }
Amith Yamasani82644082012-08-03 13:09:11 -07002807
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002808 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002809 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002810 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2811 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002812 Parcel data = Parcel.obtain();
2813 Parcel reply = Parcel.obtain();
2814 data.writeInterfaceToken(IActivityManager.descriptor);
2815 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002816 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002817 intent.writeToParcel(data, 0);
2818 data.writeString(resolvedType);
2819 data.writeStrongBinder(resultTo);
2820 data.writeString(resultWho);
2821 data.writeInt(requestCode);
2822 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002823 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002824 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002825 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002826 } else {
2827 data.writeInt(0);
2828 }
2829 if (options != null) {
2830 data.writeInt(1);
2831 options.writeToParcel(data, 0);
2832 } else {
2833 data.writeInt(0);
2834 }
2835 data.writeInt(userId);
2836 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2837 reply.readException();
2838 int result = reply.readInt();
2839 reply.recycle();
2840 data.recycle();
2841 return result;
2842 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002843 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2844 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002845 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2846 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002847 Parcel data = Parcel.obtain();
2848 Parcel reply = Parcel.obtain();
2849 data.writeInterfaceToken(IActivityManager.descriptor);
2850 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2851 data.writeString(callingPackage);
2852 intent.writeToParcel(data, 0);
2853 data.writeString(resolvedType);
2854 data.writeStrongBinder(resultTo);
2855 data.writeString(resultWho);
2856 data.writeInt(requestCode);
2857 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002858 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002859 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002860 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002861 } else {
2862 data.writeInt(0);
2863 }
2864 if (options != null) {
2865 data.writeInt(1);
2866 options.writeToParcel(data, 0);
2867 } else {
2868 data.writeInt(0);
2869 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002870 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002871 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002872 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2873 reply.readException();
2874 int result = reply.readInt();
2875 reply.recycle();
2876 data.recycle();
2877 return result;
2878 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002879 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2880 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002881 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2882 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002883 Parcel data = Parcel.obtain();
2884 Parcel reply = Parcel.obtain();
2885 data.writeInterfaceToken(IActivityManager.descriptor);
2886 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002887 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002888 intent.writeToParcel(data, 0);
2889 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002890 data.writeStrongBinder(resultTo);
2891 data.writeString(resultWho);
2892 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002893 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002894 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002895 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002896 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002897 } else {
2898 data.writeInt(0);
2899 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002900 if (options != null) {
2901 data.writeInt(1);
2902 options.writeToParcel(data, 0);
2903 } else {
2904 data.writeInt(0);
2905 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002906 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002907 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2908 reply.readException();
2909 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2910 reply.recycle();
2911 data.recycle();
2912 return result;
2913 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002914 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2915 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002916 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002917 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002918 Parcel data = Parcel.obtain();
2919 Parcel reply = Parcel.obtain();
2920 data.writeInterfaceToken(IActivityManager.descriptor);
2921 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002922 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002923 intent.writeToParcel(data, 0);
2924 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002925 data.writeStrongBinder(resultTo);
2926 data.writeString(resultWho);
2927 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002928 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002929 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002930 if (options != null) {
2931 data.writeInt(1);
2932 options.writeToParcel(data, 0);
2933 } else {
2934 data.writeInt(0);
2935 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002936 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002937 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2938 reply.readException();
2939 int result = reply.readInt();
2940 reply.recycle();
2941 data.recycle();
2942 return result;
2943 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002944 public int startActivityIntentSender(IApplicationThread caller,
2945 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002946 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002947 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002948 Parcel data = Parcel.obtain();
2949 Parcel reply = Parcel.obtain();
2950 data.writeInterfaceToken(IActivityManager.descriptor);
2951 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2952 intent.writeToParcel(data, 0);
2953 if (fillInIntent != null) {
2954 data.writeInt(1);
2955 fillInIntent.writeToParcel(data, 0);
2956 } else {
2957 data.writeInt(0);
2958 }
2959 data.writeString(resolvedType);
2960 data.writeStrongBinder(resultTo);
2961 data.writeString(resultWho);
2962 data.writeInt(requestCode);
2963 data.writeInt(flagsMask);
2964 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002965 if (options != null) {
2966 data.writeInt(1);
2967 options.writeToParcel(data, 0);
2968 } else {
2969 data.writeInt(0);
2970 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002971 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002972 reply.readException();
2973 int result = reply.readInt();
2974 reply.recycle();
2975 data.recycle();
2976 return result;
2977 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002978 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2979 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002980 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2981 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002982 Parcel data = Parcel.obtain();
2983 Parcel reply = Parcel.obtain();
2984 data.writeInterfaceToken(IActivityManager.descriptor);
2985 data.writeString(callingPackage);
2986 data.writeInt(callingPid);
2987 data.writeInt(callingUid);
2988 intent.writeToParcel(data, 0);
2989 data.writeString(resolvedType);
2990 data.writeStrongBinder(session.asBinder());
2991 data.writeStrongBinder(interactor.asBinder());
2992 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002993 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002994 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002995 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002996 } else {
2997 data.writeInt(0);
2998 }
2999 if (options != null) {
3000 data.writeInt(1);
3001 options.writeToParcel(data, 0);
3002 } else {
3003 data.writeInt(0);
3004 }
3005 data.writeInt(userId);
3006 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
3007 reply.readException();
3008 int result = reply.readInt();
3009 reply.recycle();
3010 data.recycle();
3011 return result;
3012 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003013 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003014 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003015 Parcel data = Parcel.obtain();
3016 Parcel reply = Parcel.obtain();
3017 data.writeInterfaceToken(IActivityManager.descriptor);
3018 data.writeStrongBinder(callingActivity);
3019 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003020 if (options != null) {
3021 data.writeInt(1);
3022 options.writeToParcel(data, 0);
3023 } else {
3024 data.writeInt(0);
3025 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003026 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
3027 reply.readException();
3028 int result = reply.readInt();
3029 reply.recycle();
3030 data.recycle();
3031 return result != 0;
3032 }
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003033 public int startActivityFromRecents(int taskId, int launchStackId, Bundle options)
3034 throws RemoteException {
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003035 Parcel data = Parcel.obtain();
3036 Parcel reply = Parcel.obtain();
3037 data.writeInterfaceToken(IActivityManager.descriptor);
3038 data.writeInt(taskId);
Wale Ogunwale7e8184b2015-10-05 14:37:03 -07003039 data.writeInt(launchStackId);
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07003040 if (options == null) {
3041 data.writeInt(0);
3042 } else {
3043 data.writeInt(1);
3044 options.writeToParcel(data, 0);
3045 }
3046 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
3047 reply.readException();
3048 int result = reply.readInt();
3049 reply.recycle();
3050 data.recycle();
3051 return result;
3052 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003053 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003054 throws RemoteException {
3055 Parcel data = Parcel.obtain();
3056 Parcel reply = Parcel.obtain();
3057 data.writeInterfaceToken(IActivityManager.descriptor);
3058 data.writeStrongBinder(token);
3059 data.writeInt(resultCode);
3060 if (resultData != null) {
3061 data.writeInt(1);
3062 resultData.writeToParcel(data, 0);
3063 } else {
3064 data.writeInt(0);
3065 }
Wale Ogunwaleba7881c2015-08-01 19:28:29 -07003066 data.writeInt(finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003067 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
3068 reply.readException();
3069 boolean res = reply.readInt() != 0;
3070 data.recycle();
3071 reply.recycle();
3072 return res;
3073 }
3074 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
3075 {
3076 Parcel data = Parcel.obtain();
3077 Parcel reply = Parcel.obtain();
3078 data.writeInterfaceToken(IActivityManager.descriptor);
3079 data.writeStrongBinder(token);
3080 data.writeString(resultWho);
3081 data.writeInt(requestCode);
3082 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
3083 reply.readException();
3084 data.recycle();
3085 reply.recycle();
3086 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07003087 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
3088 Parcel data = Parcel.obtain();
3089 Parcel reply = Parcel.obtain();
3090 data.writeInterfaceToken(IActivityManager.descriptor);
3091 data.writeStrongBinder(token);
3092 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
3093 reply.readException();
3094 boolean res = reply.readInt() != 0;
3095 data.recycle();
3096 reply.recycle();
3097 return res;
3098 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07003099 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
3100 Parcel data = Parcel.obtain();
3101 Parcel reply = Parcel.obtain();
3102 data.writeInterfaceToken(IActivityManager.descriptor);
3103 data.writeStrongBinder(session.asBinder());
3104 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
3105 reply.readException();
3106 data.recycle();
3107 reply.recycle();
3108 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07003109 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
3110 Parcel data = Parcel.obtain();
3111 Parcel reply = Parcel.obtain();
3112 data.writeInterfaceToken(IActivityManager.descriptor);
3113 data.writeStrongBinder(token);
3114 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
3115 reply.readException();
3116 boolean res = reply.readInt() != 0;
3117 data.recycle();
3118 reply.recycle();
3119 return res;
3120 }
3121 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
3122 Parcel data = Parcel.obtain();
3123 Parcel reply = Parcel.obtain();
3124 data.writeInterfaceToken(IActivityManager.descriptor);
3125 data.writeStrongBinder(app.asBinder());
3126 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
3127 reply.readException();
3128 data.recycle();
3129 reply.recycle();
3130 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08003131 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
3132 Parcel data = Parcel.obtain();
3133 Parcel reply = Parcel.obtain();
3134 data.writeInterfaceToken(IActivityManager.descriptor);
3135 data.writeStrongBinder(token);
3136 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
3137 reply.readException();
3138 boolean res = reply.readInt() != 0;
3139 data.recycle();
3140 reply.recycle();
3141 return res;
3142 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003143 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003144 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003145 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003146 {
3147 Parcel data = Parcel.obtain();
3148 Parcel reply = Parcel.obtain();
3149 data.writeInterfaceToken(IActivityManager.descriptor);
3150 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003151 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003152 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3153 filter.writeToParcel(data, 0);
3154 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003155 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003156 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3157 reply.readException();
3158 Intent intent = null;
3159 int haveIntent = reply.readInt();
3160 if (haveIntent != 0) {
3161 intent = Intent.CREATOR.createFromParcel(reply);
3162 }
3163 reply.recycle();
3164 data.recycle();
3165 return intent;
3166 }
3167 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3168 {
3169 Parcel data = Parcel.obtain();
3170 Parcel reply = Parcel.obtain();
3171 data.writeInterfaceToken(IActivityManager.descriptor);
3172 data.writeStrongBinder(receiver.asBinder());
3173 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3174 reply.readException();
3175 data.recycle();
3176 reply.recycle();
3177 }
3178 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003179 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003180 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003181 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003182 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003183 {
3184 Parcel data = Parcel.obtain();
3185 Parcel reply = Parcel.obtain();
3186 data.writeInterfaceToken(IActivityManager.descriptor);
3187 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3188 intent.writeToParcel(data, 0);
3189 data.writeString(resolvedType);
3190 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3191 data.writeInt(resultCode);
3192 data.writeString(resultData);
3193 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003194 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003195 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003196 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003197 data.writeInt(serialized ? 1 : 0);
3198 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003199 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003200 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3201 reply.readException();
3202 int res = reply.readInt();
3203 reply.recycle();
3204 data.recycle();
3205 return res;
3206 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003207 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3208 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003209 {
3210 Parcel data = Parcel.obtain();
3211 Parcel reply = Parcel.obtain();
3212 data.writeInterfaceToken(IActivityManager.descriptor);
3213 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3214 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003215 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003216 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3217 reply.readException();
3218 data.recycle();
3219 reply.recycle();
3220 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003221 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3222 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003223 {
3224 Parcel data = Parcel.obtain();
3225 Parcel reply = Parcel.obtain();
3226 data.writeInterfaceToken(IActivityManager.descriptor);
3227 data.writeStrongBinder(who);
3228 data.writeInt(resultCode);
3229 data.writeString(resultData);
3230 data.writeBundle(map);
3231 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003232 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003233 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3234 reply.readException();
3235 data.recycle();
3236 reply.recycle();
3237 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003238 public void attachApplication(IApplicationThread app) throws RemoteException
3239 {
3240 Parcel data = Parcel.obtain();
3241 Parcel reply = Parcel.obtain();
3242 data.writeInterfaceToken(IActivityManager.descriptor);
3243 data.writeStrongBinder(app.asBinder());
3244 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3245 reply.readException();
3246 data.recycle();
3247 reply.recycle();
3248 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003249 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3250 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003251 {
3252 Parcel data = Parcel.obtain();
3253 Parcel reply = Parcel.obtain();
3254 data.writeInterfaceToken(IActivityManager.descriptor);
3255 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003256 if (config != null) {
3257 data.writeInt(1);
3258 config.writeToParcel(data, 0);
3259 } else {
3260 data.writeInt(0);
3261 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003262 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003263 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3264 reply.readException();
3265 data.recycle();
3266 reply.recycle();
3267 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003268 public void activityResumed(IBinder token) throws RemoteException
3269 {
3270 Parcel data = Parcel.obtain();
3271 Parcel reply = Parcel.obtain();
3272 data.writeInterfaceToken(IActivityManager.descriptor);
3273 data.writeStrongBinder(token);
3274 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3275 reply.readException();
3276 data.recycle();
3277 reply.recycle();
3278 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003279 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003280 {
3281 Parcel data = Parcel.obtain();
3282 Parcel reply = Parcel.obtain();
3283 data.writeInterfaceToken(IActivityManager.descriptor);
3284 data.writeStrongBinder(token);
3285 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3286 reply.readException();
3287 data.recycle();
3288 reply.recycle();
3289 }
3290 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003291 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003292 {
3293 Parcel data = Parcel.obtain();
3294 Parcel reply = Parcel.obtain();
3295 data.writeInterfaceToken(IActivityManager.descriptor);
3296 data.writeStrongBinder(token);
3297 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003298 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003299 TextUtils.writeToParcel(description, data, 0);
3300 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3301 reply.readException();
3302 data.recycle();
3303 reply.recycle();
3304 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003305 public void activitySlept(IBinder token) throws RemoteException
3306 {
3307 Parcel data = Parcel.obtain();
3308 Parcel reply = Parcel.obtain();
3309 data.writeInterfaceToken(IActivityManager.descriptor);
3310 data.writeStrongBinder(token);
3311 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3312 reply.readException();
3313 data.recycle();
3314 reply.recycle();
3315 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003316 public void activityDestroyed(IBinder token) throws RemoteException
3317 {
3318 Parcel data = Parcel.obtain();
3319 Parcel reply = Parcel.obtain();
3320 data.writeInterfaceToken(IActivityManager.descriptor);
3321 data.writeStrongBinder(token);
3322 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3323 reply.readException();
3324 data.recycle();
3325 reply.recycle();
3326 }
3327 public String getCallingPackage(IBinder token) throws RemoteException
3328 {
3329 Parcel data = Parcel.obtain();
3330 Parcel reply = Parcel.obtain();
3331 data.writeInterfaceToken(IActivityManager.descriptor);
3332 data.writeStrongBinder(token);
3333 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3334 reply.readException();
3335 String res = reply.readString();
3336 data.recycle();
3337 reply.recycle();
3338 return res;
3339 }
3340 public ComponentName getCallingActivity(IBinder token)
3341 throws RemoteException {
3342 Parcel data = Parcel.obtain();
3343 Parcel reply = Parcel.obtain();
3344 data.writeInterfaceToken(IActivityManager.descriptor);
3345 data.writeStrongBinder(token);
3346 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3347 reply.readException();
3348 ComponentName res = ComponentName.readFromParcel(reply);
3349 data.recycle();
3350 reply.recycle();
3351 return res;
3352 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003353 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003354 Parcel data = Parcel.obtain();
3355 Parcel reply = Parcel.obtain();
3356 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003357 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003358 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3359 reply.readException();
3360 ArrayList<IAppTask> list = null;
3361 int N = reply.readInt();
3362 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003363 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003364 while (N > 0) {
3365 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3366 list.add(task);
3367 N--;
3368 }
3369 }
3370 data.recycle();
3371 reply.recycle();
3372 return list;
3373 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003374 public int addAppTask(IBinder activityToken, Intent intent,
3375 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3376 Parcel data = Parcel.obtain();
3377 Parcel reply = Parcel.obtain();
3378 data.writeInterfaceToken(IActivityManager.descriptor);
3379 data.writeStrongBinder(activityToken);
3380 intent.writeToParcel(data, 0);
3381 description.writeToParcel(data, 0);
3382 thumbnail.writeToParcel(data, 0);
3383 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3384 reply.readException();
3385 int res = reply.readInt();
3386 data.recycle();
3387 reply.recycle();
3388 return res;
3389 }
3390 public Point getAppTaskThumbnailSize() throws RemoteException {
3391 Parcel data = Parcel.obtain();
3392 Parcel reply = Parcel.obtain();
3393 data.writeInterfaceToken(IActivityManager.descriptor);
3394 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3395 reply.readException();
3396 Point size = Point.CREATOR.createFromParcel(reply);
3397 data.recycle();
3398 reply.recycle();
3399 return size;
3400 }
Todd Kennedye635f662015-01-20 10:36:49 -08003401 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3402 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003403 Parcel data = Parcel.obtain();
3404 Parcel reply = Parcel.obtain();
3405 data.writeInterfaceToken(IActivityManager.descriptor);
3406 data.writeInt(maxNum);
3407 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003408 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3409 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003410 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003411 int N = reply.readInt();
3412 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003413 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003414 while (N > 0) {
3415 ActivityManager.RunningTaskInfo info =
3416 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003417 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003418 list.add(info);
3419 N--;
3420 }
3421 }
3422 data.recycle();
3423 reply.recycle();
3424 return list;
3425 }
3426 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003427 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003428 Parcel data = Parcel.obtain();
3429 Parcel reply = Parcel.obtain();
3430 data.writeInterfaceToken(IActivityManager.descriptor);
3431 data.writeInt(maxNum);
3432 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003433 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003434 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3435 reply.readException();
3436 ArrayList<ActivityManager.RecentTaskInfo> list
3437 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3438 data.recycle();
3439 reply.recycle();
3440 return list;
3441 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003442 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003443 Parcel data = Parcel.obtain();
3444 Parcel reply = Parcel.obtain();
3445 data.writeInterfaceToken(IActivityManager.descriptor);
3446 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003447 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003448 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003449 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003450 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003451 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003452 }
3453 data.recycle();
3454 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003455 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003456 }
Todd Kennedye635f662015-01-20 10:36:49 -08003457 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3458 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003459 Parcel data = Parcel.obtain();
3460 Parcel reply = Parcel.obtain();
3461 data.writeInterfaceToken(IActivityManager.descriptor);
3462 data.writeInt(maxNum);
3463 data.writeInt(flags);
3464 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3465 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003466 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003467 int N = reply.readInt();
3468 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003469 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003470 while (N > 0) {
3471 ActivityManager.RunningServiceInfo info =
3472 ActivityManager.RunningServiceInfo.CREATOR
3473 .createFromParcel(reply);
3474 list.add(info);
3475 N--;
3476 }
3477 }
3478 data.recycle();
3479 reply.recycle();
3480 return list;
3481 }
3482 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3483 throws RemoteException {
3484 Parcel data = Parcel.obtain();
3485 Parcel reply = Parcel.obtain();
3486 data.writeInterfaceToken(IActivityManager.descriptor);
3487 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3488 reply.readException();
3489 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3490 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3491 data.recycle();
3492 reply.recycle();
3493 return list;
3494 }
3495 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3496 throws RemoteException {
3497 Parcel data = Parcel.obtain();
3498 Parcel reply = Parcel.obtain();
3499 data.writeInterfaceToken(IActivityManager.descriptor);
3500 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3501 reply.readException();
3502 ArrayList<ActivityManager.RunningAppProcessInfo> list
3503 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3504 data.recycle();
3505 reply.recycle();
3506 return list;
3507 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003508 public List<ApplicationInfo> getRunningExternalApplications()
3509 throws RemoteException {
3510 Parcel data = Parcel.obtain();
3511 Parcel reply = Parcel.obtain();
3512 data.writeInterfaceToken(IActivityManager.descriptor);
3513 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3514 reply.readException();
3515 ArrayList<ApplicationInfo> list
3516 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3517 data.recycle();
3518 reply.recycle();
3519 return list;
3520 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003521 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003522 {
3523 Parcel data = Parcel.obtain();
3524 Parcel reply = Parcel.obtain();
3525 data.writeInterfaceToken(IActivityManager.descriptor);
3526 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003527 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003528 if (options != null) {
3529 data.writeInt(1);
3530 options.writeToParcel(data, 0);
3531 } else {
3532 data.writeInt(0);
3533 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003534 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3535 reply.readException();
3536 data.recycle();
3537 reply.recycle();
3538 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003539 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3540 throws RemoteException {
3541 Parcel data = Parcel.obtain();
3542 Parcel reply = Parcel.obtain();
3543 data.writeInterfaceToken(IActivityManager.descriptor);
3544 data.writeStrongBinder(token);
3545 data.writeInt(nonRoot ? 1 : 0);
3546 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3547 reply.readException();
3548 boolean res = reply.readInt() != 0;
3549 data.recycle();
3550 reply.recycle();
3551 return res;
3552 }
3553 public void moveTaskBackwards(int task) throws RemoteException
3554 {
3555 Parcel data = Parcel.obtain();
3556 Parcel reply = Parcel.obtain();
3557 data.writeInterfaceToken(IActivityManager.descriptor);
3558 data.writeInt(task);
3559 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3560 reply.readException();
3561 data.recycle();
3562 reply.recycle();
3563 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003564 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003565 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3566 {
3567 Parcel data = Parcel.obtain();
3568 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003569 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003570 data.writeInt(taskId);
3571 data.writeInt(stackId);
3572 data.writeInt(toTop ? 1 : 0);
3573 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3574 reply.readException();
3575 data.recycle();
3576 reply.recycle();
3577 }
3578 @Override
Wale Ogunwale59a73ca2015-09-14 12:54:50 -07003579 public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop)
3580 throws RemoteException
3581 {
3582 Parcel data = Parcel.obtain();
3583 Parcel reply = Parcel.obtain();
3584 data.writeInterfaceToken(IActivityManager.descriptor);
3585 data.writeInt(taskId);
3586 data.writeInt(createMode);
3587 data.writeInt(toTop ? 1 : 0);
3588 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
3589 reply.readException();
3590 data.recycle();
3591 reply.recycle();
3592 }
3593 @Override
Wale Ogunwale079a0042015-10-24 11:44:07 -07003594 public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
3595 throws RemoteException
3596 {
3597 Parcel data = Parcel.obtain();
3598 Parcel reply = Parcel.obtain();
3599 data.writeInterfaceToken(IActivityManager.descriptor);
3600 data.writeInt(stackId);
3601 r.writeToParcel(data, 0);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07003602 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0);
Wale Ogunwale079a0042015-10-24 11:44:07 -07003603 reply.readException();
3604 final boolean res = reply.readInt() != 0;
3605 data.recycle();
3606 reply.recycle();
3607 return res;
3608 }
3609 @Override
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003610 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode)
3611 throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003612 {
3613 Parcel data = Parcel.obtain();
3614 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003615 data.writeInterfaceToken(IActivityManager.descriptor);
Wale Ogunwaleb34a7ad2015-08-14 11:05:30 -07003616 data.writeInt(stackId);
Jorim Jaggi61f39a72015-10-29 16:54:18 +01003617 if (r != null) {
3618 data.writeInt(1);
3619 r.writeToParcel(data, 0);
3620 } else {
3621 data.writeInt(0);
3622 }
Wale Ogunwaleffc11bb2015-10-10 13:05:45 -07003623 data.writeInt(allowResizeInDockedMode ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003624 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003625 reply.readException();
3626 data.recycle();
3627 reply.recycle();
3628 }
Craig Mautner967212c2013-04-13 21:10:58 -07003629 @Override
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -07003630 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
3631 {
3632 Parcel data = Parcel.obtain();
3633 Parcel reply = Parcel.obtain();
3634 data.writeInterfaceToken(IActivityManager.descriptor);
3635 data.writeInt(taskId);
3636 data.writeInt(stackId);
3637 data.writeInt(position);
3638 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
3639 reply.readException();
3640 data.recycle();
3641 reply.recycle();
3642 }
3643 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003644 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003645 {
3646 Parcel data = Parcel.obtain();
3647 Parcel reply = Parcel.obtain();
3648 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003649 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003650 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003651 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003652 data.recycle();
3653 reply.recycle();
3654 return list;
3655 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003656 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003657 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003658 {
3659 Parcel data = Parcel.obtain();
3660 Parcel reply = Parcel.obtain();
3661 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003662 data.writeInt(stackId);
3663 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003664 reply.readException();
3665 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003666 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003667 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003668 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003669 }
3670 data.recycle();
3671 reply.recycle();
3672 return info;
3673 }
3674 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003675 public boolean isInHomeStack(int taskId) throws RemoteException {
3676 Parcel data = Parcel.obtain();
3677 Parcel reply = Parcel.obtain();
3678 data.writeInterfaceToken(IActivityManager.descriptor);
3679 data.writeInt(taskId);
3680 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3681 reply.readException();
3682 boolean isInHomeStack = reply.readInt() > 0;
3683 data.recycle();
3684 reply.recycle();
3685 return isInHomeStack;
3686 }
3687 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003688 public void setFocusedStack(int stackId) throws RemoteException
3689 {
3690 Parcel data = Parcel.obtain();
3691 Parcel reply = Parcel.obtain();
3692 data.writeInterfaceToken(IActivityManager.descriptor);
3693 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003694 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003695 reply.readException();
3696 data.recycle();
3697 reply.recycle();
3698 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003699 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003700 public int getFocusedStackId() throws RemoteException {
3701 Parcel data = Parcel.obtain();
3702 Parcel reply = Parcel.obtain();
3703 data.writeInterfaceToken(IActivityManager.descriptor);
3704 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3705 reply.readException();
3706 int focusedStackId = reply.readInt();
3707 data.recycle();
3708 reply.recycle();
3709 return focusedStackId;
3710 }
3711 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07003712 public void setFocusedTask(int taskId) throws RemoteException
3713 {
3714 Parcel data = Parcel.obtain();
3715 Parcel reply = Parcel.obtain();
3716 data.writeInterfaceToken(IActivityManager.descriptor);
3717 data.writeInt(taskId);
3718 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0);
3719 reply.readException();
3720 data.recycle();
3721 reply.recycle();
3722 }
3723 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003724 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3725 {
3726 Parcel data = Parcel.obtain();
3727 Parcel reply = Parcel.obtain();
3728 data.writeInterfaceToken(IActivityManager.descriptor);
3729 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003730 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003731 reply.readException();
3732 data.recycle();
3733 reply.recycle();
3734 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003735 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3736 {
3737 Parcel data = Parcel.obtain();
3738 Parcel reply = Parcel.obtain();
3739 data.writeInterfaceToken(IActivityManager.descriptor);
3740 data.writeStrongBinder(token);
3741 data.writeInt(onlyRoot ? 1 : 0);
3742 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3743 reply.readException();
3744 int res = reply.readInt();
3745 data.recycle();
3746 reply.recycle();
3747 return res;
3748 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003749 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003750 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003751 Parcel data = Parcel.obtain();
3752 Parcel reply = Parcel.obtain();
3753 data.writeInterfaceToken(IActivityManager.descriptor);
3754 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3755 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003756 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003757 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003758 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3759 reply.readException();
3760 int res = reply.readInt();
3761 ContentProviderHolder cph = null;
3762 if (res != 0) {
3763 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3764 }
3765 data.recycle();
3766 reply.recycle();
3767 return cph;
3768 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003769 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3770 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003771 Parcel data = Parcel.obtain();
3772 Parcel reply = Parcel.obtain();
3773 data.writeInterfaceToken(IActivityManager.descriptor);
3774 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003775 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003776 data.writeStrongBinder(token);
3777 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3778 reply.readException();
3779 int res = reply.readInt();
3780 ContentProviderHolder cph = null;
3781 if (res != 0) {
3782 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3783 }
3784 data.recycle();
3785 reply.recycle();
3786 return cph;
3787 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003788 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003789 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003790 {
3791 Parcel data = Parcel.obtain();
3792 Parcel reply = Parcel.obtain();
3793 data.writeInterfaceToken(IActivityManager.descriptor);
3794 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3795 data.writeTypedList(providers);
3796 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3797 reply.readException();
3798 data.recycle();
3799 reply.recycle();
3800 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003801 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3802 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003803 Parcel data = Parcel.obtain();
3804 Parcel reply = Parcel.obtain();
3805 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003806 data.writeStrongBinder(connection);
3807 data.writeInt(stable);
3808 data.writeInt(unstable);
3809 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3810 reply.readException();
3811 boolean res = reply.readInt() != 0;
3812 data.recycle();
3813 reply.recycle();
3814 return res;
3815 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003816
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003817 public void unstableProviderDied(IBinder connection) throws RemoteException {
3818 Parcel data = Parcel.obtain();
3819 Parcel reply = Parcel.obtain();
3820 data.writeInterfaceToken(IActivityManager.descriptor);
3821 data.writeStrongBinder(connection);
3822 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3823 reply.readException();
3824 data.recycle();
3825 reply.recycle();
3826 }
3827
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003828 @Override
3829 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3830 Parcel data = Parcel.obtain();
3831 Parcel reply = Parcel.obtain();
3832 data.writeInterfaceToken(IActivityManager.descriptor);
3833 data.writeStrongBinder(connection);
3834 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3835 reply.readException();
3836 data.recycle();
3837 reply.recycle();
3838 }
3839
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003840 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3841 Parcel data = Parcel.obtain();
3842 Parcel reply = Parcel.obtain();
3843 data.writeInterfaceToken(IActivityManager.descriptor);
3844 data.writeStrongBinder(connection);
3845 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003846 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3847 reply.readException();
3848 data.recycle();
3849 reply.recycle();
3850 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003851
3852 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3853 Parcel data = Parcel.obtain();
3854 Parcel reply = Parcel.obtain();
3855 data.writeInterfaceToken(IActivityManager.descriptor);
3856 data.writeString(name);
3857 data.writeStrongBinder(token);
3858 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3859 reply.readException();
3860 data.recycle();
3861 reply.recycle();
3862 }
3863
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003864 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3865 throws RemoteException
3866 {
3867 Parcel data = Parcel.obtain();
3868 Parcel reply = Parcel.obtain();
3869 data.writeInterfaceToken(IActivityManager.descriptor);
3870 service.writeToParcel(data, 0);
3871 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3872 reply.readException();
3873 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3874 data.recycle();
3875 reply.recycle();
3876 return res;
3877 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003878
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003879 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003880 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003881 {
3882 Parcel data = Parcel.obtain();
3883 Parcel reply = Parcel.obtain();
3884 data.writeInterfaceToken(IActivityManager.descriptor);
3885 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3886 service.writeToParcel(data, 0);
3887 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003888 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003889 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003890 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3891 reply.readException();
3892 ComponentName res = ComponentName.readFromParcel(reply);
3893 data.recycle();
3894 reply.recycle();
3895 return res;
3896 }
3897 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003898 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003899 {
3900 Parcel data = Parcel.obtain();
3901 Parcel reply = Parcel.obtain();
3902 data.writeInterfaceToken(IActivityManager.descriptor);
3903 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3904 service.writeToParcel(data, 0);
3905 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003906 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003907 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3908 reply.readException();
3909 int res = reply.readInt();
3910 reply.recycle();
3911 data.recycle();
3912 return res;
3913 }
3914 public boolean stopServiceToken(ComponentName className, IBinder token,
3915 int startId) throws RemoteException {
3916 Parcel data = Parcel.obtain();
3917 Parcel reply = Parcel.obtain();
3918 data.writeInterfaceToken(IActivityManager.descriptor);
3919 ComponentName.writeToParcel(className, data);
3920 data.writeStrongBinder(token);
3921 data.writeInt(startId);
3922 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3923 reply.readException();
3924 boolean res = reply.readInt() != 0;
3925 data.recycle();
3926 reply.recycle();
3927 return res;
3928 }
3929 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003930 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003931 Parcel data = Parcel.obtain();
3932 Parcel reply = Parcel.obtain();
3933 data.writeInterfaceToken(IActivityManager.descriptor);
3934 ComponentName.writeToParcel(className, data);
3935 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003936 data.writeInt(id);
3937 if (notification != null) {
3938 data.writeInt(1);
3939 notification.writeToParcel(data, 0);
3940 } else {
3941 data.writeInt(0);
3942 }
3943 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003944 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3945 reply.readException();
3946 data.recycle();
3947 reply.recycle();
3948 }
3949 public int bindService(IApplicationThread caller, IBinder token,
3950 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07003951 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003952 Parcel data = Parcel.obtain();
3953 Parcel reply = Parcel.obtain();
3954 data.writeInterfaceToken(IActivityManager.descriptor);
3955 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3956 data.writeStrongBinder(token);
3957 service.writeToParcel(data, 0);
3958 data.writeString(resolvedType);
3959 data.writeStrongBinder(connection.asBinder());
3960 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07003961 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003962 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003963 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3964 reply.readException();
3965 int res = reply.readInt();
3966 data.recycle();
3967 reply.recycle();
3968 return res;
3969 }
3970 public boolean unbindService(IServiceConnection connection) throws RemoteException
3971 {
3972 Parcel data = Parcel.obtain();
3973 Parcel reply = Parcel.obtain();
3974 data.writeInterfaceToken(IActivityManager.descriptor);
3975 data.writeStrongBinder(connection.asBinder());
3976 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3977 reply.readException();
3978 boolean res = reply.readInt() != 0;
3979 data.recycle();
3980 reply.recycle();
3981 return res;
3982 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003983
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003984 public void publishService(IBinder token,
3985 Intent intent, IBinder service) throws RemoteException {
3986 Parcel data = Parcel.obtain();
3987 Parcel reply = Parcel.obtain();
3988 data.writeInterfaceToken(IActivityManager.descriptor);
3989 data.writeStrongBinder(token);
3990 intent.writeToParcel(data, 0);
3991 data.writeStrongBinder(service);
3992 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3993 reply.readException();
3994 data.recycle();
3995 reply.recycle();
3996 }
3997
3998 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3999 throws RemoteException {
4000 Parcel data = Parcel.obtain();
4001 Parcel reply = Parcel.obtain();
4002 data.writeInterfaceToken(IActivityManager.descriptor);
4003 data.writeStrongBinder(token);
4004 intent.writeToParcel(data, 0);
4005 data.writeInt(doRebind ? 1 : 0);
4006 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
4007 reply.readException();
4008 data.recycle();
4009 reply.recycle();
4010 }
4011
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004012 public void serviceDoneExecuting(IBinder token, int type, int startId,
4013 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004014 Parcel data = Parcel.obtain();
4015 Parcel reply = Parcel.obtain();
4016 data.writeInterfaceToken(IActivityManager.descriptor);
4017 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07004018 data.writeInt(type);
4019 data.writeInt(startId);
4020 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004021 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4022 reply.readException();
4023 data.recycle();
4024 reply.recycle();
4025 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004026
Svet Ganov99b60432015-06-27 13:15:22 -07004027 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
4028 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004029 Parcel data = Parcel.obtain();
4030 Parcel reply = Parcel.obtain();
4031 data.writeInterfaceToken(IActivityManager.descriptor);
4032 service.writeToParcel(data, 0);
4033 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07004034 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004035 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
4036 reply.readException();
4037 IBinder binder = reply.readStrongBinder();
4038 reply.recycle();
4039 data.recycle();
4040 return binder;
4041 }
4042
Christopher Tate181fafa2009-05-14 11:12:14 -07004043 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
4044 throws RemoteException {
4045 Parcel data = Parcel.obtain();
4046 Parcel reply = Parcel.obtain();
4047 data.writeInterfaceToken(IActivityManager.descriptor);
4048 app.writeToParcel(data, 0);
4049 data.writeInt(backupRestoreMode);
4050 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4051 reply.readException();
4052 boolean success = reply.readInt() != 0;
4053 reply.recycle();
4054 data.recycle();
4055 return success;
4056 }
4057
Christopher Tate346acb12012-10-15 19:20:25 -07004058 public void clearPendingBackup() throws RemoteException {
4059 Parcel data = Parcel.obtain();
4060 Parcel reply = Parcel.obtain();
4061 data.writeInterfaceToken(IActivityManager.descriptor);
4062 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
4063 reply.recycle();
4064 data.recycle();
4065 }
4066
Christopher Tate181fafa2009-05-14 11:12:14 -07004067 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
4068 Parcel data = Parcel.obtain();
4069 Parcel reply = Parcel.obtain();
4070 data.writeInterfaceToken(IActivityManager.descriptor);
4071 data.writeString(packageName);
4072 data.writeStrongBinder(agent);
4073 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
4074 reply.recycle();
4075 data.recycle();
4076 }
4077
4078 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
4079 Parcel data = Parcel.obtain();
4080 Parcel reply = Parcel.obtain();
4081 data.writeInterfaceToken(IActivityManager.descriptor);
4082 app.writeToParcel(data, 0);
4083 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
4084 reply.readException();
4085 reply.recycle();
4086 data.recycle();
4087 }
4088
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004089 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004090 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004091 IUiAutomationConnection connection, int userId, String instructionSet)
4092 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004093 Parcel data = Parcel.obtain();
4094 Parcel reply = Parcel.obtain();
4095 data.writeInterfaceToken(IActivityManager.descriptor);
4096 ComponentName.writeToParcel(className, data);
4097 data.writeString(profileFile);
4098 data.writeInt(flags);
4099 data.writeBundle(arguments);
4100 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08004101 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004102 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01004103 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004104 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4105 reply.readException();
4106 boolean res = reply.readInt() != 0;
4107 reply.recycle();
4108 data.recycle();
4109 return res;
4110 }
4111
4112 public void finishInstrumentation(IApplicationThread target,
4113 int resultCode, Bundle results) throws RemoteException {
4114 Parcel data = Parcel.obtain();
4115 Parcel reply = Parcel.obtain();
4116 data.writeInterfaceToken(IActivityManager.descriptor);
4117 data.writeStrongBinder(target != null ? target.asBinder() : null);
4118 data.writeInt(resultCode);
4119 data.writeBundle(results);
4120 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
4121 reply.readException();
4122 data.recycle();
4123 reply.recycle();
4124 }
4125 public Configuration getConfiguration() throws RemoteException
4126 {
4127 Parcel data = Parcel.obtain();
4128 Parcel reply = Parcel.obtain();
4129 data.writeInterfaceToken(IActivityManager.descriptor);
4130 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
4131 reply.readException();
4132 Configuration res = Configuration.CREATOR.createFromParcel(reply);
4133 reply.recycle();
4134 data.recycle();
4135 return res;
4136 }
4137 public void updateConfiguration(Configuration values) throws RemoteException
4138 {
4139 Parcel data = Parcel.obtain();
4140 Parcel reply = Parcel.obtain();
4141 data.writeInterfaceToken(IActivityManager.descriptor);
4142 values.writeToParcel(data, 0);
4143 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
4144 reply.readException();
4145 data.recycle();
4146 reply.recycle();
4147 }
4148 public void setRequestedOrientation(IBinder token, int requestedOrientation)
4149 throws RemoteException {
4150 Parcel data = Parcel.obtain();
4151 Parcel reply = Parcel.obtain();
4152 data.writeInterfaceToken(IActivityManager.descriptor);
4153 data.writeStrongBinder(token);
4154 data.writeInt(requestedOrientation);
4155 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4156 reply.readException();
4157 data.recycle();
4158 reply.recycle();
4159 }
4160 public int getRequestedOrientation(IBinder token) throws RemoteException {
4161 Parcel data = Parcel.obtain();
4162 Parcel reply = Parcel.obtain();
4163 data.writeInterfaceToken(IActivityManager.descriptor);
4164 data.writeStrongBinder(token);
4165 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
4166 reply.readException();
4167 int res = reply.readInt();
4168 data.recycle();
4169 reply.recycle();
4170 return res;
4171 }
4172 public ComponentName getActivityClassForToken(IBinder token)
4173 throws RemoteException {
4174 Parcel data = Parcel.obtain();
4175 Parcel reply = Parcel.obtain();
4176 data.writeInterfaceToken(IActivityManager.descriptor);
4177 data.writeStrongBinder(token);
4178 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
4179 reply.readException();
4180 ComponentName res = ComponentName.readFromParcel(reply);
4181 data.recycle();
4182 reply.recycle();
4183 return res;
4184 }
4185 public String getPackageForToken(IBinder token) throws RemoteException
4186 {
4187 Parcel data = Parcel.obtain();
4188 Parcel reply = Parcel.obtain();
4189 data.writeInterfaceToken(IActivityManager.descriptor);
4190 data.writeStrongBinder(token);
4191 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
4192 reply.readException();
4193 String res = reply.readString();
4194 data.recycle();
4195 reply.recycle();
4196 return res;
4197 }
4198 public IIntentSender getIntentSender(int type,
4199 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004200 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07004201 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004202 Parcel data = Parcel.obtain();
4203 Parcel reply = Parcel.obtain();
4204 data.writeInterfaceToken(IActivityManager.descriptor);
4205 data.writeInt(type);
4206 data.writeString(packageName);
4207 data.writeStrongBinder(token);
4208 data.writeString(resultWho);
4209 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004210 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004211 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004212 data.writeTypedArray(intents, 0);
4213 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004214 } else {
4215 data.writeInt(0);
4216 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004217 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004218 if (options != null) {
4219 data.writeInt(1);
4220 options.writeToParcel(data, 0);
4221 } else {
4222 data.writeInt(0);
4223 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004224 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004225 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4226 reply.readException();
4227 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004228 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004229 data.recycle();
4230 reply.recycle();
4231 return res;
4232 }
4233 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4234 Parcel data = Parcel.obtain();
4235 Parcel reply = Parcel.obtain();
4236 data.writeInterfaceToken(IActivityManager.descriptor);
4237 data.writeStrongBinder(sender.asBinder());
4238 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4239 reply.readException();
4240 data.recycle();
4241 reply.recycle();
4242 }
4243 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4244 Parcel data = Parcel.obtain();
4245 Parcel reply = Parcel.obtain();
4246 data.writeInterfaceToken(IActivityManager.descriptor);
4247 data.writeStrongBinder(sender.asBinder());
4248 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4249 reply.readException();
4250 String res = reply.readString();
4251 data.recycle();
4252 reply.recycle();
4253 return res;
4254 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004255 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4256 Parcel data = Parcel.obtain();
4257 Parcel reply = Parcel.obtain();
4258 data.writeInterfaceToken(IActivityManager.descriptor);
4259 data.writeStrongBinder(sender.asBinder());
4260 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4261 reply.readException();
4262 int res = reply.readInt();
4263 data.recycle();
4264 reply.recycle();
4265 return res;
4266 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004267 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4268 boolean requireFull, String name, String callerPackage) throws RemoteException {
4269 Parcel data = Parcel.obtain();
4270 Parcel reply = Parcel.obtain();
4271 data.writeInterfaceToken(IActivityManager.descriptor);
4272 data.writeInt(callingPid);
4273 data.writeInt(callingUid);
4274 data.writeInt(userId);
4275 data.writeInt(allowAll ? 1 : 0);
4276 data.writeInt(requireFull ? 1 : 0);
4277 data.writeString(name);
4278 data.writeString(callerPackage);
4279 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4280 reply.readException();
4281 int res = reply.readInt();
4282 data.recycle();
4283 reply.recycle();
4284 return res;
4285 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004286 public void setProcessLimit(int max) throws RemoteException
4287 {
4288 Parcel data = Parcel.obtain();
4289 Parcel reply = Parcel.obtain();
4290 data.writeInterfaceToken(IActivityManager.descriptor);
4291 data.writeInt(max);
4292 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4293 reply.readException();
4294 data.recycle();
4295 reply.recycle();
4296 }
4297 public int getProcessLimit() throws RemoteException
4298 {
4299 Parcel data = Parcel.obtain();
4300 Parcel reply = Parcel.obtain();
4301 data.writeInterfaceToken(IActivityManager.descriptor);
4302 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4303 reply.readException();
4304 int res = reply.readInt();
4305 data.recycle();
4306 reply.recycle();
4307 return res;
4308 }
4309 public void setProcessForeground(IBinder token, int pid,
4310 boolean isForeground) throws RemoteException {
4311 Parcel data = Parcel.obtain();
4312 Parcel reply = Parcel.obtain();
4313 data.writeInterfaceToken(IActivityManager.descriptor);
4314 data.writeStrongBinder(token);
4315 data.writeInt(pid);
4316 data.writeInt(isForeground ? 1 : 0);
4317 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4318 reply.readException();
4319 data.recycle();
4320 reply.recycle();
4321 }
4322 public int checkPermission(String permission, int pid, int uid)
4323 throws RemoteException {
4324 Parcel data = Parcel.obtain();
4325 Parcel reply = Parcel.obtain();
4326 data.writeInterfaceToken(IActivityManager.descriptor);
4327 data.writeString(permission);
4328 data.writeInt(pid);
4329 data.writeInt(uid);
4330 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4331 reply.readException();
4332 int res = reply.readInt();
4333 data.recycle();
4334 reply.recycle();
4335 return res;
4336 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004337 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4338 throws RemoteException {
4339 Parcel data = Parcel.obtain();
4340 Parcel reply = Parcel.obtain();
4341 data.writeInterfaceToken(IActivityManager.descriptor);
4342 data.writeString(permission);
4343 data.writeInt(pid);
4344 data.writeInt(uid);
4345 data.writeStrongBinder(callerToken);
4346 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4347 reply.readException();
4348 int res = reply.readInt();
4349 data.recycle();
4350 reply.recycle();
4351 return res;
4352 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004353 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004354 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004355 Parcel data = Parcel.obtain();
4356 Parcel reply = Parcel.obtain();
4357 data.writeInterfaceToken(IActivityManager.descriptor);
4358 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004359 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004360 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004361 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4362 reply.readException();
4363 boolean res = reply.readInt() != 0;
4364 data.recycle();
4365 reply.recycle();
4366 return res;
4367 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004368 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4369 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004370 Parcel data = Parcel.obtain();
4371 Parcel reply = Parcel.obtain();
4372 data.writeInterfaceToken(IActivityManager.descriptor);
4373 uri.writeToParcel(data, 0);
4374 data.writeInt(pid);
4375 data.writeInt(uid);
4376 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004377 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004378 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004379 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4380 reply.readException();
4381 int res = reply.readInt();
4382 data.recycle();
4383 reply.recycle();
4384 return res;
4385 }
4386 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004387 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004388 Parcel data = Parcel.obtain();
4389 Parcel reply = Parcel.obtain();
4390 data.writeInterfaceToken(IActivityManager.descriptor);
4391 data.writeStrongBinder(caller.asBinder());
4392 data.writeString(targetPkg);
4393 uri.writeToParcel(data, 0);
4394 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004395 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004396 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4397 reply.readException();
4398 data.recycle();
4399 reply.recycle();
4400 }
4401 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004402 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004403 Parcel data = Parcel.obtain();
4404 Parcel reply = Parcel.obtain();
4405 data.writeInterfaceToken(IActivityManager.descriptor);
4406 data.writeStrongBinder(caller.asBinder());
4407 uri.writeToParcel(data, 0);
4408 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004409 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004410 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4411 reply.readException();
4412 data.recycle();
4413 reply.recycle();
4414 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004415
4416 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004417 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4418 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004419 Parcel data = Parcel.obtain();
4420 Parcel reply = Parcel.obtain();
4421 data.writeInterfaceToken(IActivityManager.descriptor);
4422 uri.writeToParcel(data, 0);
4423 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004424 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004425 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4426 reply.readException();
4427 data.recycle();
4428 reply.recycle();
4429 }
4430
4431 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004432 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4433 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004434 Parcel data = Parcel.obtain();
4435 Parcel reply = Parcel.obtain();
4436 data.writeInterfaceToken(IActivityManager.descriptor);
4437 uri.writeToParcel(data, 0);
4438 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004439 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004440 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4441 reply.readException();
4442 data.recycle();
4443 reply.recycle();
4444 }
4445
4446 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004447 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4448 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004449 Parcel data = Parcel.obtain();
4450 Parcel reply = Parcel.obtain();
4451 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004452 data.writeString(packageName);
4453 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004454 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4455 reply.readException();
4456 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4457 reply);
4458 data.recycle();
4459 reply.recycle();
4460 return perms;
4461 }
4462
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004463 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4464 throws RemoteException {
4465 Parcel data = Parcel.obtain();
4466 Parcel reply = Parcel.obtain();
4467 data.writeInterfaceToken(IActivityManager.descriptor);
4468 data.writeStrongBinder(who.asBinder());
4469 data.writeInt(waiting ? 1 : 0);
4470 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4471 reply.readException();
4472 data.recycle();
4473 reply.recycle();
4474 }
4475 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4476 Parcel data = Parcel.obtain();
4477 Parcel reply = Parcel.obtain();
4478 data.writeInterfaceToken(IActivityManager.descriptor);
4479 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4480 reply.readException();
4481 outInfo.readFromParcel(reply);
4482 data.recycle();
4483 reply.recycle();
4484 }
4485 public void unhandledBack() throws RemoteException
4486 {
4487 Parcel data = Parcel.obtain();
4488 Parcel reply = Parcel.obtain();
4489 data.writeInterfaceToken(IActivityManager.descriptor);
4490 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4491 reply.readException();
4492 data.recycle();
4493 reply.recycle();
4494 }
4495 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4496 {
4497 Parcel data = Parcel.obtain();
4498 Parcel reply = Parcel.obtain();
4499 data.writeInterfaceToken(IActivityManager.descriptor);
4500 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4501 reply.readException();
4502 ParcelFileDescriptor pfd = null;
4503 if (reply.readInt() != 0) {
4504 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4505 }
4506 data.recycle();
4507 reply.recycle();
4508 return pfd;
4509 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004510 public void setLockScreenShown(boolean shown) throws RemoteException
4511 {
4512 Parcel data = Parcel.obtain();
4513 Parcel reply = Parcel.obtain();
4514 data.writeInterfaceToken(IActivityManager.descriptor);
4515 data.writeInt(shown ? 1 : 0);
4516 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4517 reply.readException();
4518 data.recycle();
4519 reply.recycle();
4520 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004521 public void setDebugApp(
4522 String packageName, boolean waitForDebugger, boolean persistent)
4523 throws RemoteException
4524 {
4525 Parcel data = Parcel.obtain();
4526 Parcel reply = Parcel.obtain();
4527 data.writeInterfaceToken(IActivityManager.descriptor);
4528 data.writeString(packageName);
4529 data.writeInt(waitForDebugger ? 1 : 0);
4530 data.writeInt(persistent ? 1 : 0);
4531 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4532 reply.readException();
4533 data.recycle();
4534 reply.recycle();
4535 }
4536 public void setAlwaysFinish(boolean enabled) throws RemoteException
4537 {
4538 Parcel data = Parcel.obtain();
4539 Parcel reply = Parcel.obtain();
4540 data.writeInterfaceToken(IActivityManager.descriptor);
4541 data.writeInt(enabled ? 1 : 0);
4542 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4543 reply.readException();
4544 data.recycle();
4545 reply.recycle();
4546 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004547 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004548 {
4549 Parcel data = Parcel.obtain();
4550 Parcel reply = Parcel.obtain();
4551 data.writeInterfaceToken(IActivityManager.descriptor);
4552 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004553 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004554 reply.readException();
4555 data.recycle();
4556 reply.recycle();
4557 }
4558 public void enterSafeMode() throws RemoteException {
4559 Parcel data = Parcel.obtain();
4560 data.writeInterfaceToken(IActivityManager.descriptor);
4561 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4562 data.recycle();
4563 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004564 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004565 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004566 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004567 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004568 data.writeStrongBinder(sender.asBinder());
4569 data.writeInt(sourceUid);
4570 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004571 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004572 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4573 data.recycle();
4574 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004575 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4576 throws RemoteException {
4577 Parcel data = Parcel.obtain();
4578 data.writeInterfaceToken(IActivityManager.descriptor);
4579 data.writeStrongBinder(sender.asBinder());
4580 data.writeInt(sourceUid);
4581 data.writeString(tag);
4582 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4583 data.recycle();
4584 }
4585 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4586 throws RemoteException {
4587 Parcel data = Parcel.obtain();
4588 data.writeInterfaceToken(IActivityManager.descriptor);
4589 data.writeStrongBinder(sender.asBinder());
4590 data.writeInt(sourceUid);
4591 data.writeString(tag);
4592 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4593 data.recycle();
4594 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004595 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004596 Parcel data = Parcel.obtain();
4597 Parcel reply = Parcel.obtain();
4598 data.writeInterfaceToken(IActivityManager.descriptor);
4599 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004600 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004601 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004602 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004603 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004604 boolean res = reply.readInt() != 0;
4605 data.recycle();
4606 reply.recycle();
4607 return res;
4608 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004609 @Override
4610 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4611 Parcel data = Parcel.obtain();
4612 Parcel reply = Parcel.obtain();
4613 data.writeInterfaceToken(IActivityManager.descriptor);
4614 data.writeString(reason);
4615 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4616 boolean res = reply.readInt() != 0;
4617 data.recycle();
4618 reply.recycle();
4619 return res;
4620 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004621 public boolean testIsSystemReady()
4622 {
4623 /* this base class version is never called */
4624 return true;
4625 }
Dan Egnor60d87622009-12-16 16:32:58 -08004626 public void handleApplicationCrash(IBinder app,
4627 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4628 {
4629 Parcel data = Parcel.obtain();
4630 Parcel reply = Parcel.obtain();
4631 data.writeInterfaceToken(IActivityManager.descriptor);
4632 data.writeStrongBinder(app);
4633 crashInfo.writeToParcel(data, 0);
4634 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4635 reply.readException();
4636 reply.recycle();
4637 data.recycle();
4638 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004639
Dianne Hackborn52322712014-08-26 22:47:26 -07004640 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004641 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004642 {
4643 Parcel data = Parcel.obtain();
4644 Parcel reply = Parcel.obtain();
4645 data.writeInterfaceToken(IActivityManager.descriptor);
4646 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004647 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004648 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004649 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004650 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004651 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004652 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004653 reply.recycle();
4654 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004655 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004656 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004657
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004658 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004659 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004660 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004661 {
4662 Parcel data = Parcel.obtain();
4663 Parcel reply = Parcel.obtain();
4664 data.writeInterfaceToken(IActivityManager.descriptor);
4665 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004666 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004667 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004668 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4669 reply.readException();
4670 reply.recycle();
4671 data.recycle();
4672 }
4673
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004674 public void signalPersistentProcesses(int sig) throws RemoteException {
4675 Parcel data = Parcel.obtain();
4676 Parcel reply = Parcel.obtain();
4677 data.writeInterfaceToken(IActivityManager.descriptor);
4678 data.writeInt(sig);
4679 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4680 reply.readException();
4681 data.recycle();
4682 reply.recycle();
4683 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004684
Dianne Hackborn1676c852012-09-10 14:52:30 -07004685 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004686 Parcel data = Parcel.obtain();
4687 Parcel reply = Parcel.obtain();
4688 data.writeInterfaceToken(IActivityManager.descriptor);
4689 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004690 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004691 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4692 reply.readException();
4693 data.recycle();
4694 reply.recycle();
4695 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004696
4697 public void killAllBackgroundProcesses() throws RemoteException {
4698 Parcel data = Parcel.obtain();
4699 Parcel reply = Parcel.obtain();
4700 data.writeInterfaceToken(IActivityManager.descriptor);
4701 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4702 reply.readException();
4703 data.recycle();
4704 reply.recycle();
4705 }
4706
Dianne Hackborn1676c852012-09-10 14:52:30 -07004707 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004708 Parcel data = Parcel.obtain();
4709 Parcel reply = Parcel.obtain();
4710 data.writeInterfaceToken(IActivityManager.descriptor);
4711 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004712 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004713 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004714 reply.readException();
4715 data.recycle();
4716 reply.recycle();
4717 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004718
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004719 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4720 throws RemoteException
4721 {
4722 Parcel data = Parcel.obtain();
4723 Parcel reply = Parcel.obtain();
4724 data.writeInterfaceToken(IActivityManager.descriptor);
4725 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4726 reply.readException();
4727 outInfo.readFromParcel(reply);
4728 reply.recycle();
4729 data.recycle();
4730 }
4731
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004732 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4733 {
4734 Parcel data = Parcel.obtain();
4735 Parcel reply = Parcel.obtain();
4736 data.writeInterfaceToken(IActivityManager.descriptor);
4737 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4738 reply.readException();
4739 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4740 reply.recycle();
4741 data.recycle();
4742 return res;
4743 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004744
Dianne Hackborn1676c852012-09-10 14:52:30 -07004745 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004746 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004747 {
4748 Parcel data = Parcel.obtain();
4749 Parcel reply = Parcel.obtain();
4750 data.writeInterfaceToken(IActivityManager.descriptor);
4751 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004752 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004753 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004754 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004755 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004756 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004757 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004758 } else {
4759 data.writeInt(0);
4760 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004761 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4762 reply.readException();
4763 boolean res = reply.readInt() != 0;
4764 reply.recycle();
4765 data.recycle();
4766 return res;
4767 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004768
Dianne Hackborn55280a92009-05-07 15:53:46 -07004769 public boolean shutdown(int timeout) throws RemoteException
4770 {
4771 Parcel data = Parcel.obtain();
4772 Parcel reply = Parcel.obtain();
4773 data.writeInterfaceToken(IActivityManager.descriptor);
4774 data.writeInt(timeout);
4775 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4776 reply.readException();
4777 boolean res = reply.readInt() != 0;
4778 reply.recycle();
4779 data.recycle();
4780 return res;
4781 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004782
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004783 public void stopAppSwitches() throws RemoteException {
4784 Parcel data = Parcel.obtain();
4785 Parcel reply = Parcel.obtain();
4786 data.writeInterfaceToken(IActivityManager.descriptor);
4787 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4788 reply.readException();
4789 reply.recycle();
4790 data.recycle();
4791 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004792
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004793 public void resumeAppSwitches() throws RemoteException {
4794 Parcel data = Parcel.obtain();
4795 Parcel reply = Parcel.obtain();
4796 data.writeInterfaceToken(IActivityManager.descriptor);
4797 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4798 reply.readException();
4799 reply.recycle();
4800 data.recycle();
4801 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004802
4803 public void addPackageDependency(String packageName) throws RemoteException {
4804 Parcel data = Parcel.obtain();
4805 Parcel reply = Parcel.obtain();
4806 data.writeInterfaceToken(IActivityManager.descriptor);
4807 data.writeString(packageName);
4808 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4809 reply.readException();
4810 data.recycle();
4811 reply.recycle();
4812 }
4813
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004814 public void killApplicationWithAppId(String pkg, int appid, String reason)
4815 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004816 Parcel data = Parcel.obtain();
4817 Parcel reply = Parcel.obtain();
4818 data.writeInterfaceToken(IActivityManager.descriptor);
4819 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004820 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004821 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004822 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004823 reply.readException();
4824 data.recycle();
4825 reply.recycle();
4826 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004827
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004828 public void closeSystemDialogs(String reason) throws RemoteException {
4829 Parcel data = Parcel.obtain();
4830 Parcel reply = Parcel.obtain();
4831 data.writeInterfaceToken(IActivityManager.descriptor);
4832 data.writeString(reason);
4833 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4834 reply.readException();
4835 data.recycle();
4836 reply.recycle();
4837 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004838
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004839 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004840 throws RemoteException {
4841 Parcel data = Parcel.obtain();
4842 Parcel reply = Parcel.obtain();
4843 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004844 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004845 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4846 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004847 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004848 data.recycle();
4849 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004850 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004851 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004852
4853 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4854 Parcel data = Parcel.obtain();
4855 Parcel reply = Parcel.obtain();
4856 data.writeInterfaceToken(IActivityManager.descriptor);
4857 data.writeString(processName);
4858 data.writeInt(uid);
4859 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4860 reply.readException();
4861 data.recycle();
4862 reply.recycle();
4863 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004864
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004865 public void overridePendingTransition(IBinder token, String packageName,
4866 int enterAnim, int exitAnim) throws RemoteException {
4867 Parcel data = Parcel.obtain();
4868 Parcel reply = Parcel.obtain();
4869 data.writeInterfaceToken(IActivityManager.descriptor);
4870 data.writeStrongBinder(token);
4871 data.writeString(packageName);
4872 data.writeInt(enterAnim);
4873 data.writeInt(exitAnim);
4874 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4875 reply.readException();
4876 data.recycle();
4877 reply.recycle();
4878 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004879
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004880 public boolean isUserAMonkey() throws RemoteException {
4881 Parcel data = Parcel.obtain();
4882 Parcel reply = Parcel.obtain();
4883 data.writeInterfaceToken(IActivityManager.descriptor);
4884 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4885 reply.readException();
4886 boolean res = reply.readInt() != 0;
4887 data.recycle();
4888 reply.recycle();
4889 return res;
4890 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004891
4892 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4893 Parcel data = Parcel.obtain();
4894 Parcel reply = Parcel.obtain();
4895 data.writeInterfaceToken(IActivityManager.descriptor);
4896 data.writeInt(monkey ? 1 : 0);
4897 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4898 reply.readException();
4899 data.recycle();
4900 reply.recycle();
4901 }
4902
Dianne Hackborn860755f2010-06-03 18:47:52 -07004903 public void finishHeavyWeightApp() throws RemoteException {
4904 Parcel data = Parcel.obtain();
4905 Parcel reply = Parcel.obtain();
4906 data.writeInterfaceToken(IActivityManager.descriptor);
4907 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4908 reply.readException();
4909 data.recycle();
4910 reply.recycle();
4911 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004912
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004913 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004914 throws RemoteException {
4915 Parcel data = Parcel.obtain();
4916 Parcel reply = Parcel.obtain();
4917 data.writeInterfaceToken(IActivityManager.descriptor);
4918 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004919 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4920 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004921 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004922 data.recycle();
4923 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004924 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004925 }
4926
Craig Mautner233ceee2014-05-09 17:05:11 -07004927 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004928 throws RemoteException {
4929 Parcel data = Parcel.obtain();
4930 Parcel reply = Parcel.obtain();
4931 data.writeInterfaceToken(IActivityManager.descriptor);
4932 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004933 if (options == null) {
4934 data.writeInt(0);
4935 } else {
4936 data.writeInt(1);
4937 data.writeBundle(options.toBundle());
4938 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004939 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004940 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004941 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004942 data.recycle();
4943 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004944 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004945 }
4946
Craig Mautner233ceee2014-05-09 17:05:11 -07004947 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4948 Parcel data = Parcel.obtain();
4949 Parcel reply = Parcel.obtain();
4950 data.writeInterfaceToken(IActivityManager.descriptor);
4951 data.writeStrongBinder(token);
4952 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4953 reply.readException();
Chong Zhang280d3322015-11-03 17:27:26 -08004954 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle());
Craig Mautner233ceee2014-05-09 17:05:11 -07004955 data.recycle();
4956 reply.recycle();
4957 return options;
4958 }
4959
Daniel Sandler69a48172010-06-23 16:29:36 -04004960 public void setImmersive(IBinder token, boolean immersive)
4961 throws RemoteException {
4962 Parcel data = Parcel.obtain();
4963 Parcel reply = Parcel.obtain();
4964 data.writeInterfaceToken(IActivityManager.descriptor);
4965 data.writeStrongBinder(token);
4966 data.writeInt(immersive ? 1 : 0);
4967 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4968 reply.readException();
4969 data.recycle();
4970 reply.recycle();
4971 }
4972
4973 public boolean isImmersive(IBinder token)
4974 throws RemoteException {
4975 Parcel data = Parcel.obtain();
4976 Parcel reply = Parcel.obtain();
4977 data.writeInterfaceToken(IActivityManager.descriptor);
4978 data.writeStrongBinder(token);
4979 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004980 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004981 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004982 data.recycle();
4983 reply.recycle();
4984 return res;
4985 }
4986
Craig Mautnerd61dc202014-07-07 11:09:11 -07004987 public boolean isTopOfTask(IBinder token) throws RemoteException {
4988 Parcel data = Parcel.obtain();
4989 Parcel reply = Parcel.obtain();
4990 data.writeInterfaceToken(IActivityManager.descriptor);
4991 data.writeStrongBinder(token);
4992 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4993 reply.readException();
4994 boolean res = reply.readInt() == 1;
4995 data.recycle();
4996 reply.recycle();
4997 return res;
4998 }
4999
Daniel Sandler69a48172010-06-23 16:29:36 -04005000 public boolean isTopActivityImmersive()
5001 throws RemoteException {
5002 Parcel data = Parcel.obtain();
5003 Parcel reply = Parcel.obtain();
5004 data.writeInterfaceToken(IActivityManager.descriptor);
5005 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04005006 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07005007 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04005008 data.recycle();
5009 reply.recycle();
5010 return res;
5011 }
5012
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07005013 public void crashApplication(int uid, int initialPid, String packageName,
5014 String message) throws RemoteException {
5015 Parcel data = Parcel.obtain();
5016 Parcel reply = Parcel.obtain();
5017 data.writeInterfaceToken(IActivityManager.descriptor);
5018 data.writeInt(uid);
5019 data.writeInt(initialPid);
5020 data.writeString(packageName);
5021 data.writeString(message);
5022 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
5023 reply.readException();
5024 data.recycle();
5025 reply.recycle();
5026 }
Andy McFadden824c5102010-07-09 16:26:57 -07005027
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005028 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005029 Parcel data = Parcel.obtain();
5030 Parcel reply = Parcel.obtain();
5031 data.writeInterfaceToken(IActivityManager.descriptor);
5032 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005033 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07005034 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
5035 reply.readException();
5036 String res = reply.readString();
5037 data.recycle();
5038 reply.recycle();
5039 return res;
5040 }
5041
Dianne Hackborn7e269642010-08-25 19:50:20 -07005042 public IBinder newUriPermissionOwner(String name)
5043 throws RemoteException {
5044 Parcel data = Parcel.obtain();
5045 Parcel reply = Parcel.obtain();
5046 data.writeInterfaceToken(IActivityManager.descriptor);
5047 data.writeString(name);
5048 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
5049 reply.readException();
5050 IBinder res = reply.readStrongBinder();
5051 data.recycle();
5052 reply.recycle();
5053 return res;
5054 }
5055
5056 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01005057 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005058 Parcel data = Parcel.obtain();
5059 Parcel reply = Parcel.obtain();
5060 data.writeInterfaceToken(IActivityManager.descriptor);
5061 data.writeStrongBinder(owner);
5062 data.writeInt(fromUid);
5063 data.writeString(targetPkg);
5064 uri.writeToParcel(data, 0);
5065 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01005066 data.writeInt(sourceUserId);
5067 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005068 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5069 reply.readException();
5070 data.recycle();
5071 reply.recycle();
5072 }
5073
5074 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005075 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07005076 Parcel data = Parcel.obtain();
5077 Parcel reply = Parcel.obtain();
5078 data.writeInterfaceToken(IActivityManager.descriptor);
5079 data.writeStrongBinder(owner);
5080 if (uri != null) {
5081 data.writeInt(1);
5082 uri.writeToParcel(data, 0);
5083 } else {
5084 data.writeInt(0);
5085 }
5086 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005087 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07005088 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
5089 reply.readException();
5090 data.recycle();
5091 reply.recycle();
5092 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07005093
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005094 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005095 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005096 Parcel data = Parcel.obtain();
5097 Parcel reply = Parcel.obtain();
5098 data.writeInterfaceToken(IActivityManager.descriptor);
5099 data.writeInt(callingUid);
5100 data.writeString(targetPkg);
5101 uri.writeToParcel(data, 0);
5102 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01005103 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07005104 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
5105 reply.readException();
5106 int res = reply.readInt();
5107 data.recycle();
5108 reply.recycle();
5109 return res;
5110 }
5111
Dianne Hackborn1676c852012-09-10 14:52:30 -07005112 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07005113 String path, ParcelFileDescriptor fd) throws RemoteException {
5114 Parcel data = Parcel.obtain();
5115 Parcel reply = Parcel.obtain();
5116 data.writeInterfaceToken(IActivityManager.descriptor);
5117 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07005118 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07005119 data.writeInt(managed ? 1 : 0);
5120 data.writeString(path);
5121 if (fd != null) {
5122 data.writeInt(1);
5123 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5124 } else {
5125 data.writeInt(0);
5126 }
5127 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
5128 reply.readException();
5129 boolean res = reply.readInt() != 0;
5130 reply.recycle();
5131 data.recycle();
5132 return res;
5133 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07005134
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005135 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07005136 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005137 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005138 Parcel data = Parcel.obtain();
5139 Parcel reply = Parcel.obtain();
5140 data.writeInterfaceToken(IActivityManager.descriptor);
5141 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005142 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005143 data.writeTypedArray(intents, 0);
5144 data.writeStringArray(resolvedTypes);
5145 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07005146 if (options != null) {
5147 data.writeInt(1);
5148 options.writeToParcel(data, 0);
5149 } else {
5150 data.writeInt(0);
5151 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07005152 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08005153 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
5154 reply.readException();
5155 int result = reply.readInt();
5156 reply.recycle();
5157 data.recycle();
5158 return result;
5159 }
5160
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005161 public int getFrontActivityScreenCompatMode() throws RemoteException {
5162 Parcel data = Parcel.obtain();
5163 Parcel reply = Parcel.obtain();
5164 data.writeInterfaceToken(IActivityManager.descriptor);
5165 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5166 reply.readException();
5167 int mode = reply.readInt();
5168 reply.recycle();
5169 data.recycle();
5170 return mode;
5171 }
5172
5173 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
5174 Parcel data = Parcel.obtain();
5175 Parcel reply = Parcel.obtain();
5176 data.writeInterfaceToken(IActivityManager.descriptor);
5177 data.writeInt(mode);
5178 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5179 reply.readException();
5180 reply.recycle();
5181 data.recycle();
5182 }
5183
5184 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
5185 Parcel data = Parcel.obtain();
5186 Parcel reply = Parcel.obtain();
5187 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005188 data.writeString(packageName);
5189 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005190 reply.readException();
5191 int mode = reply.readInt();
5192 reply.recycle();
5193 data.recycle();
5194 return mode;
5195 }
5196
5197 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005198 throws RemoteException {
5199 Parcel data = Parcel.obtain();
5200 Parcel reply = Parcel.obtain();
5201 data.writeInterfaceToken(IActivityManager.descriptor);
5202 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07005203 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04005204 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
5205 reply.readException();
5206 reply.recycle();
5207 data.recycle();
5208 }
5209
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005210 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5211 Parcel data = Parcel.obtain();
5212 Parcel reply = Parcel.obtain();
5213 data.writeInterfaceToken(IActivityManager.descriptor);
5214 data.writeString(packageName);
5215 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5216 reply.readException();
5217 boolean ask = reply.readInt() != 0;
5218 reply.recycle();
5219 data.recycle();
5220 return ask;
5221 }
5222
5223 public void setPackageAskScreenCompat(String packageName, boolean ask)
5224 throws RemoteException {
5225 Parcel data = Parcel.obtain();
5226 Parcel reply = Parcel.obtain();
5227 data.writeInterfaceToken(IActivityManager.descriptor);
5228 data.writeString(packageName);
5229 data.writeInt(ask ? 1 : 0);
5230 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5231 reply.readException();
5232 reply.recycle();
5233 data.recycle();
5234 }
5235
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005236 public boolean switchUser(int userid) throws RemoteException {
5237 Parcel data = Parcel.obtain();
5238 Parcel reply = Parcel.obtain();
5239 data.writeInterfaceToken(IActivityManager.descriptor);
5240 data.writeInt(userid);
5241 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5242 reply.readException();
5243 boolean result = reply.readInt() != 0;
5244 reply.recycle();
5245 data.recycle();
5246 return result;
5247 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005248
Kenny Guy08488bf2014-02-21 17:40:37 +00005249 public boolean startUserInBackground(int userid) throws RemoteException {
5250 Parcel data = Parcel.obtain();
5251 Parcel reply = Parcel.obtain();
5252 data.writeInterfaceToken(IActivityManager.descriptor);
5253 data.writeInt(userid);
5254 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5255 reply.readException();
5256 boolean result = reply.readInt() != 0;
5257 reply.recycle();
5258 data.recycle();
5259 return result;
5260 }
5261
Jeff Sharkeyba512352015-11-12 20:17:45 -08005262 public boolean unlockUser(int userId, byte[] token) throws RemoteException {
5263 Parcel data = Parcel.obtain();
5264 Parcel reply = Parcel.obtain();
5265 data.writeInterfaceToken(IActivityManager.descriptor);
5266 data.writeInt(userId);
5267 data.writeByteArray(token);
5268 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0);
5269 reply.readException();
5270 boolean result = reply.readInt() != 0;
5271 reply.recycle();
5272 data.recycle();
5273 return result;
5274 }
5275
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005276 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5277 Parcel data = Parcel.obtain();
5278 Parcel reply = Parcel.obtain();
5279 data.writeInterfaceToken(IActivityManager.descriptor);
5280 data.writeInt(userid);
5281 data.writeStrongInterface(callback);
5282 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5283 reply.readException();
5284 int result = reply.readInt();
5285 reply.recycle();
5286 data.recycle();
5287 return result;
5288 }
5289
Amith Yamasani52f1d752012-03-28 18:19:29 -07005290 public UserInfo getCurrentUser() throws RemoteException {
5291 Parcel data = Parcel.obtain();
5292 Parcel reply = Parcel.obtain();
5293 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005294 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005295 reply.readException();
5296 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5297 reply.recycle();
5298 data.recycle();
5299 return userInfo;
5300 }
5301
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005302 public boolean isUserRunning(int userid, int flags) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005303 Parcel data = Parcel.obtain();
5304 Parcel reply = Parcel.obtain();
5305 data.writeInterfaceToken(IActivityManager.descriptor);
5306 data.writeInt(userid);
Jeff Sharkeye17ac152015-11-06 22:40:29 -08005307 data.writeInt(flags);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005308 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5309 reply.readException();
5310 boolean result = reply.readInt() != 0;
5311 reply.recycle();
5312 data.recycle();
5313 return result;
5314 }
5315
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005316 public int[] getRunningUserIds() throws RemoteException {
5317 Parcel data = Parcel.obtain();
5318 Parcel reply = Parcel.obtain();
5319 data.writeInterfaceToken(IActivityManager.descriptor);
5320 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5321 reply.readException();
5322 int[] result = reply.createIntArray();
5323 reply.recycle();
5324 data.recycle();
5325 return result;
5326 }
5327
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005328 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005329 Parcel data = Parcel.obtain();
5330 Parcel reply = Parcel.obtain();
5331 data.writeInterfaceToken(IActivityManager.descriptor);
5332 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005333 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5334 reply.readException();
5335 boolean result = reply.readInt() != 0;
5336 reply.recycle();
5337 data.recycle();
5338 return result;
5339 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005340
Jeff Sharkeya4620792011-05-20 15:29:23 -07005341 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5342 Parcel data = Parcel.obtain();
5343 Parcel reply = Parcel.obtain();
5344 data.writeInterfaceToken(IActivityManager.descriptor);
5345 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5346 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5347 reply.readException();
5348 data.recycle();
5349 reply.recycle();
5350 }
5351
5352 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5353 Parcel data = Parcel.obtain();
5354 Parcel reply = Parcel.obtain();
5355 data.writeInterfaceToken(IActivityManager.descriptor);
5356 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5357 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5358 reply.readException();
5359 data.recycle();
5360 reply.recycle();
5361 }
5362
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005363 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException {
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005364 Parcel data = Parcel.obtain();
5365 Parcel reply = Parcel.obtain();
5366 data.writeInterfaceToken(IActivityManager.descriptor);
5367 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07005368 data.writeInt(which);
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005369 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5370 reply.readException();
5371 data.recycle();
5372 reply.recycle();
5373 }
5374
5375 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5376 Parcel data = Parcel.obtain();
5377 Parcel reply = Parcel.obtain();
5378 data.writeInterfaceToken(IActivityManager.descriptor);
5379 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5380 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5381 reply.readException();
5382 data.recycle();
5383 reply.recycle();
5384 }
5385
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005386 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5387 Parcel data = Parcel.obtain();
5388 Parcel reply = Parcel.obtain();
5389 data.writeInterfaceToken(IActivityManager.descriptor);
5390 data.writeStrongBinder(sender.asBinder());
5391 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5392 reply.readException();
5393 boolean res = reply.readInt() != 0;
5394 data.recycle();
5395 reply.recycle();
5396 return res;
5397 }
5398
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005399 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5400 Parcel data = Parcel.obtain();
5401 Parcel reply = Parcel.obtain();
5402 data.writeInterfaceToken(IActivityManager.descriptor);
5403 data.writeStrongBinder(sender.asBinder());
5404 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5405 reply.readException();
5406 boolean res = reply.readInt() != 0;
5407 data.recycle();
5408 reply.recycle();
5409 return res;
5410 }
5411
Dianne Hackborn81038902012-11-26 17:04:09 -08005412 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5413 Parcel data = Parcel.obtain();
5414 Parcel reply = Parcel.obtain();
5415 data.writeInterfaceToken(IActivityManager.descriptor);
5416 data.writeStrongBinder(sender.asBinder());
5417 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5418 reply.readException();
5419 Intent res = reply.readInt() != 0
5420 ? Intent.CREATOR.createFromParcel(reply) : null;
5421 data.recycle();
5422 reply.recycle();
5423 return res;
5424 }
5425
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005426 public String getTagForIntentSender(IIntentSender sender, String prefix)
5427 throws RemoteException {
5428 Parcel data = Parcel.obtain();
5429 Parcel reply = Parcel.obtain();
5430 data.writeInterfaceToken(IActivityManager.descriptor);
5431 data.writeStrongBinder(sender.asBinder());
5432 data.writeString(prefix);
5433 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5434 reply.readException();
5435 String res = reply.readString();
5436 data.recycle();
5437 reply.recycle();
5438 return res;
5439 }
5440
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005441 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5442 {
5443 Parcel data = Parcel.obtain();
5444 Parcel reply = Parcel.obtain();
5445 data.writeInterfaceToken(IActivityManager.descriptor);
5446 values.writeToParcel(data, 0);
5447 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5448 reply.readException();
5449 data.recycle();
5450 reply.recycle();
5451 }
5452
Dianne Hackbornb437e092011-08-05 17:50:29 -07005453 public long[] getProcessPss(int[] pids) throws RemoteException {
5454 Parcel data = Parcel.obtain();
5455 Parcel reply = Parcel.obtain();
5456 data.writeInterfaceToken(IActivityManager.descriptor);
5457 data.writeIntArray(pids);
5458 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5459 reply.readException();
5460 long[] res = reply.createLongArray();
5461 data.recycle();
5462 reply.recycle();
5463 return res;
5464 }
5465
Dianne Hackborn661cd522011-08-22 00:26:20 -07005466 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5467 Parcel data = Parcel.obtain();
5468 Parcel reply = Parcel.obtain();
5469 data.writeInterfaceToken(IActivityManager.descriptor);
5470 TextUtils.writeToParcel(msg, data, 0);
5471 data.writeInt(always ? 1 : 0);
5472 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5473 reply.readException();
5474 data.recycle();
5475 reply.recycle();
5476 }
5477
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005478 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005479 Parcel data = Parcel.obtain();
5480 Parcel reply = Parcel.obtain();
5481 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005482 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005483 reply.readException();
5484 data.recycle();
5485 reply.recycle();
5486 }
5487
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005488 public void keyguardGoingAway(boolean disableWindowAnimations,
5489 boolean keyguardGoingToNotificationShade) throws RemoteException {
5490 Parcel data = Parcel.obtain();
5491 Parcel reply = Parcel.obtain();
5492 data.writeInterfaceToken(IActivityManager.descriptor);
5493 data.writeInt(disableWindowAnimations ? 1 : 0);
5494 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5495 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5496 reply.readException();
5497 data.recycle();
5498 reply.recycle();
5499 }
5500
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005501 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005502 throws RemoteException {
5503 Parcel data = Parcel.obtain();
5504 Parcel reply = Parcel.obtain();
5505 data.writeInterfaceToken(IActivityManager.descriptor);
5506 data.writeStrongBinder(token);
5507 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005508 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005509 reply.readException();
5510 boolean result = reply.readInt() != 0;
5511 data.recycle();
5512 reply.recycle();
5513 return result;
5514 }
5515
5516 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5517 throws RemoteException {
5518 Parcel data = Parcel.obtain();
5519 Parcel reply = Parcel.obtain();
5520 data.writeInterfaceToken(IActivityManager.descriptor);
5521 data.writeStrongBinder(token);
5522 target.writeToParcel(data, 0);
5523 data.writeInt(resultCode);
5524 if (resultData != null) {
5525 data.writeInt(1);
5526 resultData.writeToParcel(data, 0);
5527 } else {
5528 data.writeInt(0);
5529 }
5530 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5531 reply.readException();
5532 boolean result = reply.readInt() != 0;
5533 data.recycle();
5534 reply.recycle();
5535 return result;
5536 }
5537
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005538 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5539 Parcel data = Parcel.obtain();
5540 Parcel reply = Parcel.obtain();
5541 data.writeInterfaceToken(IActivityManager.descriptor);
5542 data.writeStrongBinder(activityToken);
5543 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5544 reply.readException();
5545 int result = reply.readInt();
5546 data.recycle();
5547 reply.recycle();
5548 return result;
5549 }
5550
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005551 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5552 Parcel data = Parcel.obtain();
5553 Parcel reply = Parcel.obtain();
5554 data.writeInterfaceToken(IActivityManager.descriptor);
5555 data.writeStrongBinder(activityToken);
5556 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5557 reply.readException();
5558 String result = reply.readString();
5559 data.recycle();
5560 reply.recycle();
5561 return result;
5562 }
5563
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005564 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5565 Parcel data = Parcel.obtain();
5566 Parcel reply = Parcel.obtain();
5567 data.writeInterfaceToken(IActivityManager.descriptor);
5568 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5569 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5570 reply.readException();
5571 data.recycle();
5572 reply.recycle();
5573 }
5574
5575 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
5576 Parcel data = Parcel.obtain();
5577 Parcel reply = Parcel.obtain();
5578 data.writeInterfaceToken(IActivityManager.descriptor);
5579 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5580 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5581 reply.readException();
5582 data.recycle();
5583 reply.recycle();
5584 }
5585
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005586 public void requestBugReport() throws RemoteException {
5587 Parcel data = Parcel.obtain();
5588 Parcel reply = Parcel.obtain();
5589 data.writeInterfaceToken(IActivityManager.descriptor);
5590 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5591 reply.readException();
5592 data.recycle();
5593 reply.recycle();
5594 }
5595
Jeff Brownbd181bb2013-09-10 16:44:24 -07005596 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5597 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005598 Parcel data = Parcel.obtain();
5599 Parcel reply = Parcel.obtain();
5600 data.writeInterfaceToken(IActivityManager.descriptor);
5601 data.writeInt(pid);
5602 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005603 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005604 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5605 reply.readException();
5606 long res = reply.readInt();
5607 data.recycle();
5608 reply.recycle();
5609 return res;
5610 }
5611
Adam Skorydfc7fd72013-08-05 19:23:41 -07005612 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005613 Parcel data = Parcel.obtain();
5614 Parcel reply = Parcel.obtain();
5615 data.writeInterfaceToken(IActivityManager.descriptor);
5616 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005617 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005618 reply.readException();
5619 Bundle res = reply.readBundle();
5620 data.recycle();
5621 reply.recycle();
5622 return res;
5623 }
5624
Dianne Hackborn17f69352015-07-17 18:04:14 -07005625 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5626 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005627 Parcel data = Parcel.obtain();
5628 Parcel reply = Parcel.obtain();
5629 data.writeInterfaceToken(IActivityManager.descriptor);
5630 data.writeInt(requestType);
5631 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005632 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005633 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5634 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005635 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005636 data.recycle();
5637 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005638 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005639 }
5640
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005641 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005642 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005643 Parcel data = Parcel.obtain();
5644 Parcel reply = Parcel.obtain();
5645 data.writeInterfaceToken(IActivityManager.descriptor);
5646 data.writeStrongBinder(token);
5647 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005648 structure.writeToParcel(data, 0);
5649 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005650 if (referrer != null) {
5651 data.writeInt(1);
5652 referrer.writeToParcel(data, 0);
5653 } else {
5654 data.writeInt(0);
5655 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005656 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005657 reply.readException();
5658 data.recycle();
5659 reply.recycle();
5660 }
5661
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005662 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5663 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005664 Parcel data = Parcel.obtain();
5665 Parcel reply = Parcel.obtain();
5666 data.writeInterfaceToken(IActivityManager.descriptor);
5667 intent.writeToParcel(data, 0);
5668 data.writeInt(requestType);
5669 data.writeString(hint);
5670 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005671 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005672 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5673 reply.readException();
5674 boolean res = reply.readInt() != 0;
5675 data.recycle();
5676 reply.recycle();
5677 return res;
5678 }
5679
Dianne Hackborn17f69352015-07-17 18:04:14 -07005680 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005681 Parcel data = Parcel.obtain();
5682 Parcel reply = Parcel.obtain();
5683 data.writeInterfaceToken(IActivityManager.descriptor);
5684 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5685 reply.readException();
5686 boolean res = reply.readInt() != 0;
5687 data.recycle();
5688 reply.recycle();
5689 return res;
5690 }
5691
Dianne Hackborn17f69352015-07-17 18:04:14 -07005692 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5693 Parcel data = Parcel.obtain();
5694 Parcel reply = Parcel.obtain();
5695 data.writeInterfaceToken(IActivityManager.descriptor);
5696 data.writeStrongBinder(token);
5697 data.writeBundle(args);
5698 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5699 reply.readException();
5700 boolean res = reply.readInt() != 0;
5701 data.recycle();
5702 reply.recycle();
5703 return res;
5704 }
5705
Svetoslavaa41add2015-08-06 15:03:55 -07005706 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005707 Parcel data = Parcel.obtain();
5708 Parcel reply = Parcel.obtain();
5709 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07005710 data.writeInt(appId);
5711 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005712 data.writeString(reason);
5713 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5714 reply.readException();
5715 data.recycle();
5716 reply.recycle();
5717 }
5718
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005719 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5720 Parcel data = Parcel.obtain();
5721 Parcel reply = Parcel.obtain();
5722 data.writeInterfaceToken(IActivityManager.descriptor);
5723 data.writeStrongBinder(who);
5724 data.writeInt(allowRestart ? 1 : 0);
5725 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5726 reply.readException();
5727 data.recycle();
5728 reply.recycle();
5729 }
5730
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005731 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5732 Parcel data = Parcel.obtain();
5733 Parcel reply = Parcel.obtain();
5734 data.writeInterfaceToken(IActivityManager.descriptor);
5735 data.writeStrongBinder(token);
5736 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5737 reply.readException();
5738 data.recycle();
5739 reply.recycle();
5740 }
5741
Craig Mautner5eda9b32013-07-02 11:58:16 -07005742 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5743 Parcel data = Parcel.obtain();
5744 Parcel reply = Parcel.obtain();
5745 data.writeInterfaceToken(IActivityManager.descriptor);
5746 data.writeStrongBinder(token);
5747 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5748 reply.readException();
5749 data.recycle();
5750 reply.recycle();
5751 }
5752
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005753 public void restart() throws RemoteException {
5754 Parcel data = Parcel.obtain();
5755 Parcel reply = Parcel.obtain();
5756 data.writeInterfaceToken(IActivityManager.descriptor);
5757 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5758 reply.readException();
5759 data.recycle();
5760 reply.recycle();
5761 }
5762
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005763 public void performIdleMaintenance() throws RemoteException {
5764 Parcel data = Parcel.obtain();
5765 Parcel reply = Parcel.obtain();
5766 data.writeInterfaceToken(IActivityManager.descriptor);
5767 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5768 reply.readException();
5769 data.recycle();
5770 reply.recycle();
5771 }
5772
Todd Kennedyca4d8422015-01-15 15:19:22 -08005773 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005774 IActivityContainerCallback callback) throws RemoteException {
5775 Parcel data = Parcel.obtain();
5776 Parcel reply = Parcel.obtain();
5777 data.writeInterfaceToken(IActivityManager.descriptor);
5778 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005779 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005780 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005781 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005782 final int result = reply.readInt();
5783 final IActivityContainer res;
5784 if (result == 1) {
5785 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5786 } else {
5787 res = null;
5788 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005789 data.recycle();
5790 reply.recycle();
5791 return res;
5792 }
5793
Craig Mautner95da1082014-02-24 17:54:35 -08005794 public void deleteActivityContainer(IActivityContainer activityContainer)
5795 throws RemoteException {
5796 Parcel data = Parcel.obtain();
5797 Parcel reply = Parcel.obtain();
5798 data.writeInterfaceToken(IActivityManager.descriptor);
5799 data.writeStrongBinder(activityContainer.asBinder());
5800 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5801 reply.readException();
5802 data.recycle();
5803 reply.recycle();
5804 }
5805
Rahul Chaturvedi52613f92015-06-17 23:54:08 -04005806 public boolean startBinderTracking() throws RemoteException {
5807 Parcel data = Parcel.obtain();
5808 Parcel reply = Parcel.obtain();
5809 data.writeInterfaceToken(IActivityManager.descriptor);
5810 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0);
5811 reply.readException();
5812 boolean res = reply.readInt() != 0;
5813 reply.recycle();
5814 data.recycle();
5815 return res;
5816 }
5817
5818 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException {
5819 Parcel data = Parcel.obtain();
5820 Parcel reply = Parcel.obtain();
5821 data.writeInterfaceToken(IActivityManager.descriptor);
5822 if (fd != null) {
5823 data.writeInt(1);
5824 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
5825 } else {
5826 data.writeInt(0);
5827 }
5828 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0);
5829 reply.readException();
5830 boolean res = reply.readInt() != 0;
5831 reply.recycle();
5832 data.recycle();
5833 return res;
5834 }
5835
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005836 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005837 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5838 Parcel data = Parcel.obtain();
5839 Parcel reply = Parcel.obtain();
5840 data.writeInterfaceToken(IActivityManager.descriptor);
5841 data.writeInt(displayId);
5842 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5843 reply.readException();
5844 final int result = reply.readInt();
5845 final IActivityContainer res;
5846 if (result == 1) {
5847 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5848 } else {
5849 res = null;
5850 }
5851 data.recycle();
5852 reply.recycle();
5853 return res;
5854 }
5855
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005856 @Override
5857 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005858 throws RemoteException {
5859 Parcel data = Parcel.obtain();
5860 Parcel reply = Parcel.obtain();
5861 data.writeInterfaceToken(IActivityManager.descriptor);
5862 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005863 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005864 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005865 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005866 data.recycle();
5867 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005868 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005869 }
5870
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005871 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005872 public void startLockTaskMode(int taskId) throws RemoteException {
5873 Parcel data = Parcel.obtain();
5874 Parcel reply = Parcel.obtain();
5875 data.writeInterfaceToken(IActivityManager.descriptor);
5876 data.writeInt(taskId);
5877 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5878 reply.readException();
5879 data.recycle();
5880 reply.recycle();
5881 }
5882
5883 @Override
5884 public void startLockTaskMode(IBinder token) throws RemoteException {
5885 Parcel data = Parcel.obtain();
5886 Parcel reply = Parcel.obtain();
5887 data.writeInterfaceToken(IActivityManager.descriptor);
5888 data.writeStrongBinder(token);
5889 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5890 reply.readException();
5891 data.recycle();
5892 reply.recycle();
5893 }
5894
5895 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005896 public void startLockTaskModeOnCurrent() throws RemoteException {
5897 Parcel data = Parcel.obtain();
5898 Parcel reply = Parcel.obtain();
5899 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005900 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005901 reply.readException();
5902 data.recycle();
5903 reply.recycle();
5904 }
5905
5906 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005907 public void stopLockTaskMode() throws RemoteException {
5908 Parcel data = Parcel.obtain();
5909 Parcel reply = Parcel.obtain();
5910 data.writeInterfaceToken(IActivityManager.descriptor);
5911 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5912 reply.readException();
5913 data.recycle();
5914 reply.recycle();
5915 }
5916
5917 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005918 public void stopLockTaskModeOnCurrent() throws RemoteException {
5919 Parcel data = Parcel.obtain();
5920 Parcel reply = Parcel.obtain();
5921 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005922 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005923 reply.readException();
5924 data.recycle();
5925 reply.recycle();
5926 }
5927
5928 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005929 public boolean isInLockTaskMode() throws RemoteException {
5930 Parcel data = Parcel.obtain();
5931 Parcel reply = Parcel.obtain();
5932 data.writeInterfaceToken(IActivityManager.descriptor);
5933 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5934 reply.readException();
5935 boolean isInLockTaskMode = reply.readInt() == 1;
5936 data.recycle();
5937 reply.recycle();
5938 return isInLockTaskMode;
5939 }
5940
Craig Mautner688b5102014-03-27 16:55:03 -07005941 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005942 public int getLockTaskModeState() throws RemoteException {
5943 Parcel data = Parcel.obtain();
5944 Parcel reply = Parcel.obtain();
5945 data.writeInterfaceToken(IActivityManager.descriptor);
5946 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5947 reply.readException();
5948 int lockTaskModeState = reply.readInt();
5949 data.recycle();
5950 reply.recycle();
5951 return lockTaskModeState;
5952 }
5953
5954 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005955 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5956 Parcel data = Parcel.obtain();
5957 Parcel reply = Parcel.obtain();
5958 data.writeInterfaceToken(IActivityManager.descriptor);
5959 data.writeStrongBinder(token);
5960 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5961 IBinder.FLAG_ONEWAY);
5962 reply.readException();
5963 data.recycle();
5964 reply.recycle();
5965 }
5966
5967 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005968 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005969 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005970 Parcel data = Parcel.obtain();
5971 Parcel reply = Parcel.obtain();
5972 data.writeInterfaceToken(IActivityManager.descriptor);
5973 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005974 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005975 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005976 reply.readException();
5977 data.recycle();
5978 reply.recycle();
5979 }
5980
Craig Mautneree2e45a2014-06-27 12:10:03 -07005981 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005982 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5983 Parcel data = Parcel.obtain();
5984 Parcel reply = Parcel.obtain();
5985 data.writeInterfaceToken(IActivityManager.descriptor);
5986 data.writeInt(taskId);
5987 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005988 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005989 reply.readException();
5990 data.recycle();
5991 reply.recycle();
5992 }
5993
5994 @Override
Chong Zhang87b21722015-09-21 15:39:51 -07005995 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005996 {
5997 Parcel data = Parcel.obtain();
5998 Parcel reply = Parcel.obtain();
5999 data.writeInterfaceToken(IActivityManager.descriptor);
6000 data.writeInt(taskId);
Chong Zhang87b21722015-09-21 15:39:51 -07006001 data.writeInt(resizeMode);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006002 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006003 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08006004 reply.readException();
6005 data.recycle();
6006 reply.recycle();
6007 }
6008
6009 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -07006010 public Rect getTaskBounds(int taskId) throws RemoteException
6011 {
6012 Parcel data = Parcel.obtain();
6013 Parcel reply = Parcel.obtain();
6014 data.writeInterfaceToken(IActivityManager.descriptor);
6015 data.writeInt(taskId);
6016 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0);
6017 reply.readException();
6018 Rect rect = Rect.CREATOR.createFromParcel(reply);
6019 data.recycle();
6020 reply.recycle();
6021 return rect;
6022 }
6023
6024 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07006025 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
6026 Parcel data = Parcel.obtain();
6027 Parcel reply = Parcel.obtain();
6028 data.writeInterfaceToken(IActivityManager.descriptor);
6029 data.writeString(filename);
6030 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
6031 reply.readException();
6032 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
6033 data.recycle();
6034 reply.recycle();
6035 return icon;
6036 }
6037
6038 @Override
Winson Chung044d5292014-11-06 11:05:19 -08006039 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
6040 throws RemoteException {
6041 Parcel data = Parcel.obtain();
6042 Parcel reply = Parcel.obtain();
6043 data.writeInterfaceToken(IActivityManager.descriptor);
6044 if (options == null) {
6045 data.writeInt(0);
6046 } else {
6047 data.writeInt(1);
6048 data.writeBundle(options.toBundle());
6049 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07006050 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08006051 reply.readException();
6052 data.recycle();
6053 reply.recycle();
6054 }
6055
6056 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006057 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006058 Parcel data = Parcel.obtain();
6059 Parcel reply = Parcel.obtain();
6060 data.writeInterfaceToken(IActivityManager.descriptor);
6061 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006062 data.writeInt(visible ? 1 : 0);
6063 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006064 reply.readException();
6065 boolean success = reply.readInt() > 0;
6066 data.recycle();
6067 reply.recycle();
6068 return success;
6069 }
6070
6071 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006072 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006073 Parcel data = Parcel.obtain();
6074 Parcel reply = Parcel.obtain();
6075 data.writeInterfaceToken(IActivityManager.descriptor);
6076 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07006077 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006078 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07006079 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006080 data.recycle();
6081 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07006082 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07006083 }
6084
6085 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07006086 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07006087 Parcel data = Parcel.obtain();
6088 Parcel reply = Parcel.obtain();
6089 data.writeInterfaceToken(IActivityManager.descriptor);
6090 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006091 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07006092 reply.readException();
6093 data.recycle();
6094 reply.recycle();
6095 }
6096
6097 @Override
6098 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
6099 Parcel data = Parcel.obtain();
6100 Parcel reply = Parcel.obtain();
6101 data.writeInterfaceToken(IActivityManager.descriptor);
6102 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006103 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07006104 reply.readException();
6105 data.recycle();
6106 reply.recycle();
6107 }
6108
Craig Mautner8746a472014-07-24 15:12:54 -07006109 @Override
6110 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
6111 Parcel data = Parcel.obtain();
6112 Parcel reply = Parcel.obtain();
6113 data.writeInterfaceToken(IActivityManager.descriptor);
6114 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006115 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07006116 reply.readException();
6117 data.recycle();
6118 reply.recycle();
6119 }
6120
Craig Mautner6e2f3952014-09-09 14:26:41 -07006121 @Override
6122 public void bootAnimationComplete() throws RemoteException {
6123 Parcel data = Parcel.obtain();
6124 Parcel reply = Parcel.obtain();
6125 data.writeInterfaceToken(IActivityManager.descriptor);
6126 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
6127 reply.readException();
6128 data.recycle();
6129 reply.recycle();
6130 }
6131
Wale Ogunwale18795a22014-12-03 11:38:33 -08006132 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08006133 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
6134 Parcel data = Parcel.obtain();
6135 Parcel reply = Parcel.obtain();
6136 data.writeInterfaceToken(IActivityManager.descriptor);
6137 data.writeInt(uid);
6138 data.writeByteArray(firstPacket);
6139 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
6140 reply.readException();
6141 data.recycle();
6142 reply.recycle();
6143 }
6144
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006145 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006146 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
6147 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006148 Parcel data = Parcel.obtain();
6149 Parcel reply = Parcel.obtain();
6150 data.writeInterfaceToken(IActivityManager.descriptor);
6151 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006152 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006153 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07006154 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08006155 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
6156 reply.readException();
6157 data.recycle();
6158 reply.recycle();
6159 }
6160
6161 @Override
6162 public void dumpHeapFinished(String path) throws RemoteException {
6163 Parcel data = Parcel.obtain();
6164 Parcel reply = Parcel.obtain();
6165 data.writeInterfaceToken(IActivityManager.descriptor);
6166 data.writeString(path);
6167 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
6168 reply.readException();
6169 data.recycle();
6170 reply.recycle();
6171 }
6172
Dianne Hackborn3d07c942015-03-13 18:02:54 -07006173 @Override
6174 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
6175 throws RemoteException {
6176 Parcel data = Parcel.obtain();
6177 Parcel reply = Parcel.obtain();
6178 data.writeInterfaceToken(IActivityManager.descriptor);
6179 data.writeStrongBinder(session.asBinder());
6180 data.writeInt(keepAwake ? 1 : 0);
6181 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
6182 reply.readException();
6183 data.recycle();
6184 reply.recycle();
6185 }
6186
Craig Mautnere5600772015-04-03 21:36:37 -07006187 @Override
6188 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
6189 Parcel data = Parcel.obtain();
6190 Parcel reply = Parcel.obtain();
6191 data.writeInterfaceToken(IActivityManager.descriptor);
6192 data.writeInt(userId);
6193 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006194 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07006195 reply.readException();
6196 data.recycle();
6197 reply.recycle();
6198 }
6199
Dianne Hackborn1e383822015-04-10 14:02:33 -07006200 @Override
Makoto Onuki219bbaf2015-11-12 01:38:47 +00006201 public void updateDeviceOwner(String packageName) throws RemoteException {
6202 Parcel data = Parcel.obtain();
6203 Parcel reply = Parcel.obtain();
6204 data.writeInterfaceToken(IActivityManager.descriptor);
6205 data.writeString(packageName);
6206 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
6207 reply.readException();
6208 data.recycle();
6209 reply.recycle();
6210 }
6211
6212 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07006213 public int getPackageProcessState(String packageName, String callingPackage)
6214 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07006215 Parcel data = Parcel.obtain();
6216 Parcel reply = Parcel.obtain();
6217 data.writeInterfaceToken(IActivityManager.descriptor);
6218 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07006219 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07006220 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
6221 reply.readException();
6222 int res = reply.readInt();
6223 data.recycle();
6224 reply.recycle();
6225 return res;
6226 }
6227
Stefan Kuhne16045c22015-06-05 07:18:06 -07006228 @Override
6229 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
6230 throws RemoteException {
6231 Parcel data = Parcel.obtain();
6232 Parcel reply = Parcel.obtain();
6233 data.writeInterfaceToken(IActivityManager.descriptor);
6234 data.writeString(process);
6235 data.writeInt(userId);
6236 data.writeInt(level);
6237 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
6238 reply.readException();
6239 int res = reply.readInt();
6240 data.recycle();
6241 reply.recycle();
6242 return res != 0;
6243 }
6244
Dianne Hackbornfb81d092015-08-03 17:14:46 -07006245 @Override
6246 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
6247 Parcel data = Parcel.obtain();
6248 Parcel reply = Parcel.obtain();
6249 data.writeInterfaceToken(IActivityManager.descriptor);
6250 data.writeStrongBinder(token);
6251 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
6252 reply.readException();
6253 int res = reply.readInt();
6254 data.recycle();
6255 reply.recycle();
6256 return res != 0;
6257 }
6258
Wale Ogunwale868a5e12015-08-02 16:19:20 -07006259 @Override
6260 public void moveActivityToStack(IBinder token, int stackId) throws RemoteException {
6261 Parcel data = Parcel.obtain();
6262 Parcel reply = Parcel.obtain();
6263 data.writeInterfaceToken(IActivityManager.descriptor);
6264 data.writeStrongBinder(token);
6265 data.writeInt(stackId);
6266 mRemote.transact(MOVE_ACTIVITY_TO_STACK_TRANSACTION, data, reply, 0);
6267 reply.readException();
6268 data.recycle();
6269 reply.recycle();
6270 }
6271
6272 @Override
6273 public int getActivityStackId(IBinder token) throws RemoteException {
6274 Parcel data = Parcel.obtain();
6275 Parcel reply = Parcel.obtain();
6276 data.writeInterfaceToken(IActivityManager.descriptor);
6277 data.writeStrongBinder(token);
6278 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0);
6279 reply.readException();
6280 int stackId = reply.readInt();
6281 data.recycle();
6282 reply.recycle();
6283 return stackId;
6284 }
6285
Filip Gruszczynski23493322015-07-29 17:02:59 -07006286 @Override
6287 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration,
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006288 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)
6289 throws RemoteException {
Filip Gruszczynski23493322015-07-29 17:02:59 -07006290 Parcel data = Parcel.obtain();
6291 Parcel reply = Parcel.obtain();
6292 data.writeInterfaceToken(IActivityManager.descriptor);
6293 data.writeStrongBinder(token);
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006294 writeIntArray(horizontalSizeConfiguration, data);
6295 writeIntArray(verticalSizeConfigurations, data);
6296 writeIntArray(smallestSizeConfigurations, data);
Filip Gruszczynski23493322015-07-29 17:02:59 -07006297 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0);
6298 reply.readException();
6299 data.recycle();
6300 reply.recycle();
6301 }
6302
Filip Gruszczynski20aa0ae2015-10-30 10:08:27 -07006303 private static void writeIntArray(int[] array, Parcel data) {
6304 if (array == null) {
6305 data.writeInt(0);
6306 } else {
6307 data.writeInt(array.length);
6308 data.writeIntArray(array);
6309 }
6310 }
6311
Wale Ogunwale83301a92015-09-24 15:54:08 -07006312 @Override
6313 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException {
6314 Parcel data = Parcel.obtain();
6315 Parcel reply = Parcel.obtain();
6316 data.writeInterfaceToken(IActivityManager.descriptor);
6317 data.writeInt(suppress ? 1 : 0);
6318 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0);
6319 reply.readException();
6320 data.recycle();
6321 reply.recycle();
6322 }
6323
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006324 @Override
6325 public void removeStack(int stackId) throws RemoteException {
6326 Parcel data = Parcel.obtain();
6327 Parcel reply = Parcel.obtain();
6328 data.writeInterfaceToken(IActivityManager.descriptor);
6329 data.writeInt(stackId);
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006330 mRemote.transact(REMOVE_STACK_TRANSACTION, data, reply, 0);
Filip Gruszczynski57b6cce2015-10-06 09:50:51 -07006331 reply.readException();
6332 data.recycle();
6333 reply.recycle();
6334 }
6335
Dianne Hackbornbef28fe2015-10-29 17:57:11 -07006336 @Override
6337 public int getAppStartMode(int uid, String packageName) throws RemoteException {
6338 Parcel data = Parcel.obtain();
6339 Parcel reply = Parcel.obtain();
6340 data.writeInterfaceToken(IActivityManager.descriptor);
6341 data.writeInt(uid);
6342 data.writeString(packageName);
6343 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0);
6344 reply.readException();
6345 int res = reply.readInt();
6346 data.recycle();
6347 reply.recycle();
6348 return res;
6349 }
6350
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006351 private IBinder mRemote;
6352}