blob: f6e0735a2b0f2ef92bb10cc8afbc336c9f2b07af [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(
110 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackborna750a632015-06-16 17:18:23 -0700111 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 {
Dianne Hackborn1e383822015-04-10 14:02:33 -0700119 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg, tag);
120 } catch (RemoteException ex) {
121 }
122 }
123
124 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) {
125 try {
126 getDefault().noteAlarmStart(ps.getTarget(), sourceUid, tag);
127 } catch (RemoteException ex) {
128 }
129 }
130
131 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) {
132 try {
133 getDefault().noteAlarmFinish(ps.getTarget(), sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 } catch (RemoteException ex) {
135 }
136 }
137
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800138 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 attachInterface(this, descriptor);
140 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700141
142 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800143 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
144 throws RemoteException {
145 switch (code) {
146 case START_ACTIVITY_TRANSACTION:
147 {
148 data.enforceInterface(IActivityManager.descriptor);
149 IBinder b = data.readStrongBinder();
150 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800151 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800152 Intent intent = Intent.CREATOR.createFromParcel(data);
153 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800154 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800155 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800156 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700157 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700158 ProfilerInfo profilerInfo = data.readInt() != 0
159 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700160 Bundle options = data.readInt() != 0
161 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800162 int result = startActivity(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700163 resultTo, resultWho, requestCode, startFlags, profilerInfo, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800164 reply.writeNoException();
165 reply.writeInt(result);
166 return true;
167 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700168
Amith Yamasani82644082012-08-03 13:09:11 -0700169 case START_ACTIVITY_AS_USER_TRANSACTION:
170 {
171 data.enforceInterface(IActivityManager.descriptor);
172 IBinder b = data.readStrongBinder();
173 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800174 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700175 Intent intent = Intent.CREATOR.createFromParcel(data);
176 String resolvedType = data.readString();
177 IBinder resultTo = data.readStrongBinder();
178 String resultWho = data.readString();
179 int requestCode = data.readInt();
180 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700181 ProfilerInfo profilerInfo = data.readInt() != 0
182 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700183 Bundle options = data.readInt() != 0
184 ? Bundle.CREATOR.createFromParcel(data) : null;
185 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800186 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700187 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Amith Yamasani82644082012-08-03 13:09:11 -0700188 reply.writeNoException();
189 reply.writeInt(result);
190 return true;
191 }
192
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700193 case START_ACTIVITY_AS_CALLER_TRANSACTION:
194 {
195 data.enforceInterface(IActivityManager.descriptor);
196 IBinder b = data.readStrongBinder();
197 IApplicationThread app = ApplicationThreadNative.asInterface(b);
198 String callingPackage = data.readString();
199 Intent intent = Intent.CREATOR.createFromParcel(data);
200 String resolvedType = data.readString();
201 IBinder resultTo = data.readStrongBinder();
202 String resultWho = data.readString();
203 int requestCode = data.readInt();
204 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700205 ProfilerInfo profilerInfo = data.readInt() != 0
206 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700207 Bundle options = data.readInt() != 0
208 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700209 boolean ignoreTargetSecurity = data.readInt() != 0;
Jeff Sharkey97978802014-10-14 10:48:18 -0700210 int userId = data.readInt();
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700211 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -0700212 resultTo, resultWho, requestCode, startFlags, profilerInfo, options,
213 ignoreTargetSecurity, userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -0700214 reply.writeNoException();
215 reply.writeInt(result);
216 return true;
217 }
218
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800219 case START_ACTIVITY_AND_WAIT_TRANSACTION:
220 {
221 data.enforceInterface(IActivityManager.descriptor);
222 IBinder b = data.readStrongBinder();
223 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800224 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800225 Intent intent = Intent.CREATOR.createFromParcel(data);
226 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800227 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800228 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800229 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700230 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700231 ProfilerInfo profilerInfo = data.readInt() != 0
232 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700233 Bundle options = data.readInt() != 0
234 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700235 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800236 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Jeff Hao1b012d32014-08-20 10:35:34 -0700237 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800238 reply.writeNoException();
239 result.writeToParcel(reply, 0);
240 return true;
241 }
242
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700243 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
244 {
245 data.enforceInterface(IActivityManager.descriptor);
246 IBinder b = data.readStrongBinder();
247 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800248 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700249 Intent intent = Intent.CREATOR.createFromParcel(data);
250 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700251 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700252 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700253 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700254 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700255 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700256 Bundle options = data.readInt() != 0
257 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700258 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800259 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700260 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700261 reply.writeNoException();
262 reply.writeInt(result);
263 return true;
264 }
265
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700266 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700267 {
268 data.enforceInterface(IActivityManager.descriptor);
269 IBinder b = data.readStrongBinder();
270 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700271 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700272 Intent fillInIntent = null;
273 if (data.readInt() != 0) {
274 fillInIntent = Intent.CREATOR.createFromParcel(data);
275 }
276 String resolvedType = data.readString();
277 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700278 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700279 int requestCode = data.readInt();
280 int flagsMask = data.readInt();
281 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700282 Bundle options = data.readInt() != 0
283 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700284 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700285 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700286 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700287 reply.writeNoException();
288 reply.writeInt(result);
289 return true;
290 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700291
Dianne Hackborn91097de2014-04-04 18:02:06 -0700292 case START_VOICE_ACTIVITY_TRANSACTION:
293 {
294 data.enforceInterface(IActivityManager.descriptor);
295 String callingPackage = data.readString();
296 int callingPid = data.readInt();
297 int callingUid = data.readInt();
298 Intent intent = Intent.CREATOR.createFromParcel(data);
299 String resolvedType = data.readString();
300 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
301 data.readStrongBinder());
302 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
303 data.readStrongBinder());
304 int startFlags = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700305 ProfilerInfo profilerInfo = data.readInt() != 0
306 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
Dianne Hackborn91097de2014-04-04 18:02:06 -0700307 Bundle options = data.readInt() != 0
308 ? Bundle.CREATOR.createFromParcel(data) : null;
309 int userId = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -0700310 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent,
311 resolvedType, session, interactor, startFlags, profilerInfo, options, userId);
Dianne Hackborn91097de2014-04-04 18:02:06 -0700312 reply.writeNoException();
313 reply.writeInt(result);
314 return true;
315 }
316
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800317 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
318 {
319 data.enforceInterface(IActivityManager.descriptor);
320 IBinder callingActivity = data.readStrongBinder();
321 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700322 Bundle options = data.readInt() != 0
323 ? Bundle.CREATOR.createFromParcel(data) : null;
324 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800325 reply.writeNoException();
326 reply.writeInt(result ? 1 : 0);
327 return true;
328 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700329
Craig Mautnerdc00cbe2014-07-20 17:48:47 -0700330 case START_ACTIVITY_FROM_RECENTS_TRANSACTION:
331 {
332 data.enforceInterface(IActivityManager.descriptor);
333 int taskId = data.readInt();
334 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data);
335 int result = startActivityFromRecents(taskId, options);
336 reply.writeNoException();
337 reply.writeInt(result);
338 return true;
339 }
340
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800341 case FINISH_ACTIVITY_TRANSACTION: {
342 data.enforceInterface(IActivityManager.descriptor);
343 IBinder token = data.readStrongBinder();
344 Intent resultData = null;
345 int resultCode = data.readInt();
346 if (data.readInt() != 0) {
347 resultData = Intent.CREATOR.createFromParcel(data);
348 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700349 boolean finishTask = (data.readInt() != 0);
350 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 reply.writeNoException();
352 reply.writeInt(res ? 1 : 0);
353 return true;
354 }
355
356 case FINISH_SUB_ACTIVITY_TRANSACTION: {
357 data.enforceInterface(IActivityManager.descriptor);
358 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700359 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800360 int requestCode = data.readInt();
361 finishSubActivity(token, resultWho, requestCode);
362 reply.writeNoException();
363 return true;
364 }
365
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700366 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
367 data.enforceInterface(IActivityManager.descriptor);
368 IBinder token = data.readStrongBinder();
369 boolean res = finishActivityAffinity(token);
370 reply.writeNoException();
371 reply.writeInt(res ? 1 : 0);
372 return true;
373 }
374
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700375 case FINISH_VOICE_TASK_TRANSACTION: {
376 data.enforceInterface(IActivityManager.descriptor);
377 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
378 data.readStrongBinder());
379 finishVoiceTask(session);
380 reply.writeNoException();
381 return true;
382 }
383
Dianne Hackborn89ad4562014-08-24 16:45:38 -0700384 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: {
385 data.enforceInterface(IActivityManager.descriptor);
386 IBinder token = data.readStrongBinder();
387 boolean res = releaseActivityInstance(token);
388 reply.writeNoException();
389 reply.writeInt(res ? 1 : 0);
390 return true;
391 }
392
393 case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
394 data.enforceInterface(IActivityManager.descriptor);
395 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
396 releaseSomeActivities(app);
397 reply.writeNoException();
398 return true;
399 }
400
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800401 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
402 data.enforceInterface(IActivityManager.descriptor);
403 IBinder token = data.readStrongBinder();
404 boolean res = willActivityBeVisible(token);
405 reply.writeNoException();
406 reply.writeInt(res ? 1 : 0);
407 return true;
408 }
409
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800410 case REGISTER_RECEIVER_TRANSACTION:
411 {
412 data.enforceInterface(IActivityManager.descriptor);
413 IBinder b = data.readStrongBinder();
414 IApplicationThread app =
415 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700416 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800417 b = data.readStrongBinder();
418 IIntentReceiver rec
419 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
420 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
421 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700422 int userId = data.readInt();
423 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800424 reply.writeNoException();
425 if (intent != null) {
426 reply.writeInt(1);
427 intent.writeToParcel(reply, 0);
428 } else {
429 reply.writeInt(0);
430 }
431 return true;
432 }
433
434 case UNREGISTER_RECEIVER_TRANSACTION:
435 {
436 data.enforceInterface(IActivityManager.descriptor);
437 IBinder b = data.readStrongBinder();
438 if (b == null) {
439 return true;
440 }
441 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
442 unregisterReceiver(rec);
443 reply.writeNoException();
444 return true;
445 }
446
447 case BROADCAST_INTENT_TRANSACTION:
448 {
449 data.enforceInterface(IActivityManager.descriptor);
450 IBinder b = data.readStrongBinder();
451 IApplicationThread app =
452 b != null ? ApplicationThreadNative.asInterface(b) : null;
453 Intent intent = Intent.CREATOR.createFromParcel(data);
454 String resolvedType = data.readString();
455 b = data.readStrongBinder();
456 IIntentReceiver resultTo =
457 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
458 int resultCode = data.readInt();
459 String resultData = data.readString();
460 Bundle resultExtras = data.readBundle();
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700461 String[] perms = data.readStringArray();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800462 int appOp = data.readInt();
Dianne Hackborna750a632015-06-16 17:18:23 -0700463 Bundle options = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800464 boolean serialized = data.readInt() != 0;
465 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700466 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -0700468 resultCode, resultData, resultExtras, perms, appOp,
Dianne Hackborna750a632015-06-16 17:18:23 -0700469 options, serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 reply.writeNoException();
471 reply.writeInt(res);
472 return true;
473 }
474
475 case UNBROADCAST_INTENT_TRANSACTION:
476 {
477 data.enforceInterface(IActivityManager.descriptor);
478 IBinder b = data.readStrongBinder();
479 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
480 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700481 int userId = data.readInt();
482 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800483 reply.writeNoException();
484 return true;
485 }
486
487 case FINISH_RECEIVER_TRANSACTION: {
488 data.enforceInterface(IActivityManager.descriptor);
489 IBinder who = data.readStrongBinder();
490 int resultCode = data.readInt();
491 String resultData = data.readString();
492 Bundle resultExtras = data.readBundle();
493 boolean resultAbort = data.readInt() != 0;
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800494 int intentFlags = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800495 if (who != null) {
riddle_hsu1f5ac4d2015-01-03 15:38:21 +0800496 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 }
498 reply.writeNoException();
499 return true;
500 }
501
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800502 case ATTACH_APPLICATION_TRANSACTION: {
503 data.enforceInterface(IActivityManager.descriptor);
504 IApplicationThread app = ApplicationThreadNative.asInterface(
505 data.readStrongBinder());
506 if (app != null) {
507 attachApplication(app);
508 }
509 reply.writeNoException();
510 return true;
511 }
512
513 case ACTIVITY_IDLE_TRANSACTION: {
514 data.enforceInterface(IActivityManager.descriptor);
515 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700516 Configuration config = null;
517 if (data.readInt() != 0) {
518 config = Configuration.CREATOR.createFromParcel(data);
519 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700520 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800521 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700522 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800523 }
524 reply.writeNoException();
525 return true;
526 }
527
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700528 case ACTIVITY_RESUMED_TRANSACTION: {
529 data.enforceInterface(IActivityManager.descriptor);
530 IBinder token = data.readStrongBinder();
531 activityResumed(token);
532 reply.writeNoException();
533 return true;
534 }
535
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800536 case ACTIVITY_PAUSED_TRANSACTION: {
537 data.enforceInterface(IActivityManager.descriptor);
538 IBinder token = data.readStrongBinder();
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700539 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800540 reply.writeNoException();
541 return true;
542 }
543
544 case ACTIVITY_STOPPED_TRANSACTION: {
545 data.enforceInterface(IActivityManager.descriptor);
546 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800547 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700548 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800549 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700550 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800551 reply.writeNoException();
552 return true;
553 }
554
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800555 case ACTIVITY_SLEPT_TRANSACTION: {
556 data.enforceInterface(IActivityManager.descriptor);
557 IBinder token = data.readStrongBinder();
558 activitySlept(token);
559 reply.writeNoException();
560 return true;
561 }
562
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800563 case ACTIVITY_DESTROYED_TRANSACTION: {
564 data.enforceInterface(IActivityManager.descriptor);
565 IBinder token = data.readStrongBinder();
566 activityDestroyed(token);
567 reply.writeNoException();
568 return true;
569 }
570
571 case GET_CALLING_PACKAGE_TRANSACTION: {
572 data.enforceInterface(IActivityManager.descriptor);
573 IBinder token = data.readStrongBinder();
574 String res = token != null ? getCallingPackage(token) : null;
575 reply.writeNoException();
576 reply.writeString(res);
577 return true;
578 }
579
580 case GET_CALLING_ACTIVITY_TRANSACTION: {
581 data.enforceInterface(IActivityManager.descriptor);
582 IBinder token = data.readStrongBinder();
583 ComponentName cn = getCallingActivity(token);
584 reply.writeNoException();
585 ComponentName.writeToParcel(cn, reply);
586 return true;
587 }
588
Winson Chung1147c402014-05-14 11:05:00 -0700589 case GET_APP_TASKS_TRANSACTION: {
590 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -0700591 String callingPackage = data.readString();
592 List<IAppTask> list = getAppTasks(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -0700593 reply.writeNoException();
594 int N = list != null ? list.size() : -1;
595 reply.writeInt(N);
596 int i;
597 for (i=0; i<N; i++) {
598 IAppTask task = list.get(i);
599 reply.writeStrongBinder(task.asBinder());
600 }
601 return true;
602 }
603
Dianne Hackbornaec68bb2014-08-20 15:25:13 -0700604 case ADD_APP_TASK_TRANSACTION: {
605 data.enforceInterface(IActivityManager.descriptor);
606 IBinder activityToken = data.readStrongBinder();
607 Intent intent = Intent.CREATOR.createFromParcel(data);
608 ActivityManager.TaskDescription descr
609 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
610 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data);
611 int res = addAppTask(activityToken, intent, descr, thumbnail);
612 reply.writeNoException();
613 reply.writeInt(res);
614 return true;
615 }
616
617 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: {
618 data.enforceInterface(IActivityManager.descriptor);
619 Point size = getAppTaskThumbnailSize();
620 reply.writeNoException();
621 size.writeToParcel(reply, 0);
622 return true;
623 }
624
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800625 case GET_TASKS_TRANSACTION: {
626 data.enforceInterface(IActivityManager.descriptor);
627 int maxNum = data.readInt();
628 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700629 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800630 reply.writeNoException();
631 int N = list != null ? list.size() : -1;
632 reply.writeInt(N);
633 int i;
634 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700635 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800636 info.writeToParcel(reply, 0);
637 }
638 return true;
639 }
640
641 case GET_RECENT_TASKS_TRANSACTION: {
642 data.enforceInterface(IActivityManager.descriptor);
643 int maxNum = data.readInt();
644 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700645 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800646 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700647 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800648 reply.writeNoException();
649 reply.writeTypedList(list);
650 return true;
651 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700652
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700653 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800654 data.enforceInterface(IActivityManager.descriptor);
655 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700656 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800657 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700658 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800659 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700660 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700661 } else {
662 reply.writeInt(0);
663 }
664 return true;
665 }
666
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800667 case GET_SERVICES_TRANSACTION: {
668 data.enforceInterface(IActivityManager.descriptor);
669 int maxNum = data.readInt();
670 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700671 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800672 reply.writeNoException();
673 int N = list != null ? list.size() : -1;
674 reply.writeInt(N);
675 int i;
676 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700677 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800678 info.writeToParcel(reply, 0);
679 }
680 return true;
681 }
682
683 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
684 data.enforceInterface(IActivityManager.descriptor);
685 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
686 reply.writeNoException();
687 reply.writeTypedList(list);
688 return true;
689 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700690
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800691 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
692 data.enforceInterface(IActivityManager.descriptor);
693 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
694 reply.writeNoException();
695 reply.writeTypedList(list);
696 return true;
697 }
698
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700699 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
700 data.enforceInterface(IActivityManager.descriptor);
701 List<ApplicationInfo> list = getRunningExternalApplications();
702 reply.writeNoException();
703 reply.writeTypedList(list);
704 return true;
705 }
706
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800707 case MOVE_TASK_TO_FRONT_TRANSACTION: {
708 data.enforceInterface(IActivityManager.descriptor);
709 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800710 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700711 Bundle options = data.readInt() != 0
712 ? Bundle.CREATOR.createFromParcel(data) : null;
713 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800714 reply.writeNoException();
715 return true;
716 }
717
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800718 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
719 data.enforceInterface(IActivityManager.descriptor);
720 IBinder token = data.readStrongBinder();
721 boolean nonRoot = data.readInt() != 0;
722 boolean res = moveActivityTaskToBack(token, nonRoot);
723 reply.writeNoException();
724 reply.writeInt(res ? 1 : 0);
725 return true;
726 }
727
728 case MOVE_TASK_BACKWARDS_TRANSACTION: {
729 data.enforceInterface(IActivityManager.descriptor);
730 int task = data.readInt();
731 moveTaskBackwards(task);
732 reply.writeNoException();
733 return true;
734 }
735
Craig Mautnerc00204b2013-03-05 15:02:14 -0800736 case MOVE_TASK_TO_STACK_TRANSACTION: {
737 data.enforceInterface(IActivityManager.descriptor);
738 int taskId = data.readInt();
739 int stackId = data.readInt();
740 boolean toTop = data.readInt() != 0;
741 moveTaskToStack(taskId, stackId, toTop);
742 reply.writeNoException();
743 return true;
744 }
745
746 case RESIZE_STACK_TRANSACTION: {
747 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800748 int stackId = data.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800749 Rect r = Rect.CREATOR.createFromParcel(data);
750 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800751 reply.writeNoException();
752 return true;
753 }
754
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800755 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700756 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800757 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700758 reply.writeNoException();
759 reply.writeTypedList(list);
760 return true;
761 }
762
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800763 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700764 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800765 int stackId = data.readInt();
766 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700767 reply.writeNoException();
768 if (info != null) {
769 reply.writeInt(1);
770 info.writeToParcel(reply, 0);
771 } else {
772 reply.writeInt(0);
773 }
774 return true;
775 }
776
Winson Chung303e1ff2014-03-07 15:06:19 -0800777 case IS_IN_HOME_STACK_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 int taskId = data.readInt();
780 boolean isInHomeStack = isInHomeStack(taskId);
781 reply.writeNoException();
782 reply.writeInt(isInHomeStack ? 1 : 0);
783 return true;
784 }
785
Craig Mautnercf910b02013-04-23 11:23:27 -0700786 case SET_FOCUSED_STACK_TRANSACTION: {
787 data.enforceInterface(IActivityManager.descriptor);
788 int stackId = data.readInt();
789 setFocusedStack(stackId);
790 reply.writeNoException();
791 return true;
792 }
793
Winson Chungd16c5652015-01-26 16:11:07 -0800794 case GET_FOCUSED_STACK_ID_TRANSACTION: {
795 data.enforceInterface(IActivityManager.descriptor);
796 int focusedStackId = getFocusedStackId();
797 reply.writeNoException();
798 reply.writeInt(focusedStackId);
799 return true;
800 }
801
Winson Chung740c3ac2014-11-12 16:14:38 -0800802 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: {
803 data.enforceInterface(IActivityManager.descriptor);
804 IBinder token = data.readStrongBinder();
805 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token));
806 reply.writeNoException();
807 return true;
808 }
809
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800810 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
811 data.enforceInterface(IActivityManager.descriptor);
812 IBinder token = data.readStrongBinder();
813 boolean onlyRoot = data.readInt() != 0;
814 int res = token != null
815 ? getTaskForActivity(token, onlyRoot) : -1;
816 reply.writeNoException();
817 reply.writeInt(res);
818 return true;
819 }
820
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800821 case GET_CONTENT_PROVIDER_TRANSACTION: {
822 data.enforceInterface(IActivityManager.descriptor);
823 IBinder b = data.readStrongBinder();
824 IApplicationThread app = ApplicationThreadNative.asInterface(b);
825 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700826 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700827 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700828 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800829 reply.writeNoException();
830 if (cph != null) {
831 reply.writeInt(1);
832 cph.writeToParcel(reply, 0);
833 } else {
834 reply.writeInt(0);
835 }
836 return true;
837 }
838
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800839 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
840 data.enforceInterface(IActivityManager.descriptor);
841 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700842 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800843 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700844 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800845 reply.writeNoException();
846 if (cph != null) {
847 reply.writeInt(1);
848 cph.writeToParcel(reply, 0);
849 } else {
850 reply.writeInt(0);
851 }
852 return true;
853 }
854
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800855 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
856 data.enforceInterface(IActivityManager.descriptor);
857 IBinder b = data.readStrongBinder();
858 IApplicationThread app = ApplicationThreadNative.asInterface(b);
859 ArrayList<ContentProviderHolder> providers =
860 data.createTypedArrayList(ContentProviderHolder.CREATOR);
861 publishContentProviders(app, providers);
862 reply.writeNoException();
863 return true;
864 }
865
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700866 case REF_CONTENT_PROVIDER_TRANSACTION: {
867 data.enforceInterface(IActivityManager.descriptor);
868 IBinder b = data.readStrongBinder();
869 int stable = data.readInt();
870 int unstable = data.readInt();
871 boolean res = refContentProvider(b, stable, unstable);
872 reply.writeNoException();
873 reply.writeInt(res ? 1 : 0);
874 return true;
875 }
876
877 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
878 data.enforceInterface(IActivityManager.descriptor);
879 IBinder b = data.readStrongBinder();
880 unstableProviderDied(b);
881 reply.writeNoException();
882 return true;
883 }
884
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700885 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
886 data.enforceInterface(IActivityManager.descriptor);
887 IBinder b = data.readStrongBinder();
888 appNotRespondingViaProvider(b);
889 reply.writeNoException();
890 return true;
891 }
892
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800893 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
894 data.enforceInterface(IActivityManager.descriptor);
895 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700896 boolean stable = data.readInt() != 0;
897 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800898 reply.writeNoException();
899 return true;
900 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800901
902 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
903 data.enforceInterface(IActivityManager.descriptor);
904 String name = data.readString();
905 IBinder token = data.readStrongBinder();
906 removeContentProviderExternal(name, token);
907 reply.writeNoException();
908 return true;
909 }
910
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700911 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
912 data.enforceInterface(IActivityManager.descriptor);
913 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
914 PendingIntent pi = getRunningServiceControlPanel(comp);
915 reply.writeNoException();
916 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
917 return true;
918 }
919
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800920 case START_SERVICE_TRANSACTION: {
921 data.enforceInterface(IActivityManager.descriptor);
922 IBinder b = data.readStrongBinder();
923 IApplicationThread app = ApplicationThreadNative.asInterface(b);
924 Intent service = Intent.CREATOR.createFromParcel(data);
925 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -0700926 String callingPackage = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700927 int userId = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700928 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800929 reply.writeNoException();
930 ComponentName.writeToParcel(cn, reply);
931 return true;
932 }
933
934 case STOP_SERVICE_TRANSACTION: {
935 data.enforceInterface(IActivityManager.descriptor);
936 IBinder b = data.readStrongBinder();
937 IApplicationThread app = ApplicationThreadNative.asInterface(b);
938 Intent service = Intent.CREATOR.createFromParcel(data);
939 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700940 int userId = data.readInt();
941 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800942 reply.writeNoException();
943 reply.writeInt(res);
944 return true;
945 }
946
947 case STOP_SERVICE_TOKEN_TRANSACTION: {
948 data.enforceInterface(IActivityManager.descriptor);
949 ComponentName className = ComponentName.readFromParcel(data);
950 IBinder token = data.readStrongBinder();
951 int startId = data.readInt();
952 boolean res = stopServiceToken(className, token, startId);
953 reply.writeNoException();
954 reply.writeInt(res ? 1 : 0);
955 return true;
956 }
957
958 case SET_SERVICE_FOREGROUND_TRANSACTION: {
959 data.enforceInterface(IActivityManager.descriptor);
960 ComponentName className = ComponentName.readFromParcel(data);
961 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700962 int id = data.readInt();
963 Notification notification = null;
964 if (data.readInt() != 0) {
965 notification = Notification.CREATOR.createFromParcel(data);
966 }
967 boolean removeNotification = data.readInt() != 0;
968 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800969 reply.writeNoException();
970 return true;
971 }
972
973 case BIND_SERVICE_TRANSACTION: {
974 data.enforceInterface(IActivityManager.descriptor);
975 IBinder b = data.readStrongBinder();
976 IApplicationThread app = ApplicationThreadNative.asInterface(b);
977 IBinder token = data.readStrongBinder();
978 Intent service = Intent.CREATOR.createFromParcel(data);
979 String resolvedType = data.readString();
980 b = data.readStrongBinder();
981 int fl = data.readInt();
Svet Ganov99b60432015-06-27 13:15:22 -0700982 String callingPackage = data.readString();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800983 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800984 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Svet Ganov99b60432015-06-27 13:15:22 -0700985 int res = bindService(app, token, service, resolvedType, conn, fl,
986 callingPackage, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800987 reply.writeNoException();
988 reply.writeInt(res);
989 return true;
990 }
991
992 case UNBIND_SERVICE_TRANSACTION: {
993 data.enforceInterface(IActivityManager.descriptor);
994 IBinder b = data.readStrongBinder();
995 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
996 boolean res = unbindService(conn);
997 reply.writeNoException();
998 reply.writeInt(res ? 1 : 0);
999 return true;
1000 }
1001
1002 case PUBLISH_SERVICE_TRANSACTION: {
1003 data.enforceInterface(IActivityManager.descriptor);
1004 IBinder token = data.readStrongBinder();
1005 Intent intent = Intent.CREATOR.createFromParcel(data);
1006 IBinder service = data.readStrongBinder();
1007 publishService(token, intent, service);
1008 reply.writeNoException();
1009 return true;
1010 }
1011
1012 case UNBIND_FINISHED_TRANSACTION: {
1013 data.enforceInterface(IActivityManager.descriptor);
1014 IBinder token = data.readStrongBinder();
1015 Intent intent = Intent.CREATOR.createFromParcel(data);
1016 boolean doRebind = data.readInt() != 0;
1017 unbindFinished(token, intent, doRebind);
1018 reply.writeNoException();
1019 return true;
1020 }
1021
1022 case SERVICE_DONE_EXECUTING_TRANSACTION: {
1023 data.enforceInterface(IActivityManager.descriptor);
1024 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07001025 int type = data.readInt();
1026 int startId = data.readInt();
1027 int res = data.readInt();
1028 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001029 reply.writeNoException();
1030 return true;
1031 }
1032
1033 case START_INSTRUMENTATION_TRANSACTION: {
1034 data.enforceInterface(IActivityManager.descriptor);
1035 ComponentName className = ComponentName.readFromParcel(data);
1036 String profileFile = data.readString();
1037 int fl = data.readInt();
1038 Bundle arguments = data.readBundle();
1039 IBinder b = data.readStrongBinder();
1040 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08001041 b = data.readStrongBinder();
1042 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001043 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01001044 String abiOverride = data.readString();
1045 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
1046 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001047 reply.writeNoException();
1048 reply.writeInt(res ? 1 : 0);
1049 return true;
1050 }
1051
1052
1053 case FINISH_INSTRUMENTATION_TRANSACTION: {
1054 data.enforceInterface(IActivityManager.descriptor);
1055 IBinder b = data.readStrongBinder();
1056 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1057 int resultCode = data.readInt();
1058 Bundle results = data.readBundle();
1059 finishInstrumentation(app, resultCode, results);
1060 reply.writeNoException();
1061 return true;
1062 }
1063
1064 case GET_CONFIGURATION_TRANSACTION: {
1065 data.enforceInterface(IActivityManager.descriptor);
1066 Configuration config = getConfiguration();
1067 reply.writeNoException();
1068 config.writeToParcel(reply, 0);
1069 return true;
1070 }
1071
1072 case UPDATE_CONFIGURATION_TRANSACTION: {
1073 data.enforceInterface(IActivityManager.descriptor);
1074 Configuration config = Configuration.CREATOR.createFromParcel(data);
1075 updateConfiguration(config);
1076 reply.writeNoException();
1077 return true;
1078 }
1079
1080 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
1081 data.enforceInterface(IActivityManager.descriptor);
1082 IBinder token = data.readStrongBinder();
1083 int requestedOrientation = data.readInt();
1084 setRequestedOrientation(token, requestedOrientation);
1085 reply.writeNoException();
1086 return true;
1087 }
1088
1089 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
1090 data.enforceInterface(IActivityManager.descriptor);
1091 IBinder token = data.readStrongBinder();
1092 int req = getRequestedOrientation(token);
1093 reply.writeNoException();
1094 reply.writeInt(req);
1095 return true;
1096 }
1097
1098 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
1099 data.enforceInterface(IActivityManager.descriptor);
1100 IBinder token = data.readStrongBinder();
1101 ComponentName cn = getActivityClassForToken(token);
1102 reply.writeNoException();
1103 ComponentName.writeToParcel(cn, reply);
1104 return true;
1105 }
1106
1107 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1108 data.enforceInterface(IActivityManager.descriptor);
1109 IBinder token = data.readStrongBinder();
1110 reply.writeNoException();
1111 reply.writeString(getPackageForToken(token));
1112 return true;
1113 }
1114
1115 case GET_INTENT_SENDER_TRANSACTION: {
1116 data.enforceInterface(IActivityManager.descriptor);
1117 int type = data.readInt();
1118 String packageName = data.readString();
1119 IBinder token = data.readStrongBinder();
1120 String resultWho = data.readString();
1121 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001122 Intent[] requestIntents;
1123 String[] requestResolvedTypes;
1124 if (data.readInt() != 0) {
1125 requestIntents = data.createTypedArray(Intent.CREATOR);
1126 requestResolvedTypes = data.createStringArray();
1127 } else {
1128 requestIntents = null;
1129 requestResolvedTypes = null;
1130 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001131 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001132 Bundle options = data.readInt() != 0
1133 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001134 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001135 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001136 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001137 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001138 reply.writeNoException();
1139 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1140 return true;
1141 }
1142
1143 case CANCEL_INTENT_SENDER_TRANSACTION: {
1144 data.enforceInterface(IActivityManager.descriptor);
1145 IIntentSender r = IIntentSender.Stub.asInterface(
1146 data.readStrongBinder());
1147 cancelIntentSender(r);
1148 reply.writeNoException();
1149 return true;
1150 }
1151
1152 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 IIntentSender r = IIntentSender.Stub.asInterface(
1155 data.readStrongBinder());
1156 String res = getPackageForIntentSender(r);
1157 reply.writeNoException();
1158 reply.writeString(res);
1159 return true;
1160 }
1161
Christopher Tatec4a07d12012-04-06 14:19:13 -07001162 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1163 data.enforceInterface(IActivityManager.descriptor);
1164 IIntentSender r = IIntentSender.Stub.asInterface(
1165 data.readStrongBinder());
1166 int res = getUidForIntentSender(r);
1167 reply.writeNoException();
1168 reply.writeInt(res);
1169 return true;
1170 }
1171
Dianne Hackborn41203752012-08-31 14:05:51 -07001172 case HANDLE_INCOMING_USER_TRANSACTION: {
1173 data.enforceInterface(IActivityManager.descriptor);
1174 int callingPid = data.readInt();
1175 int callingUid = data.readInt();
1176 int userId = data.readInt();
1177 boolean allowAll = data.readInt() != 0 ;
1178 boolean requireFull = data.readInt() != 0;
1179 String name = data.readString();
1180 String callerPackage = data.readString();
1181 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1182 requireFull, name, callerPackage);
1183 reply.writeNoException();
1184 reply.writeInt(res);
1185 return true;
1186 }
1187
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001188 case SET_PROCESS_LIMIT_TRANSACTION: {
1189 data.enforceInterface(IActivityManager.descriptor);
1190 int max = data.readInt();
1191 setProcessLimit(max);
1192 reply.writeNoException();
1193 return true;
1194 }
1195
1196 case GET_PROCESS_LIMIT_TRANSACTION: {
1197 data.enforceInterface(IActivityManager.descriptor);
1198 int limit = getProcessLimit();
1199 reply.writeNoException();
1200 reply.writeInt(limit);
1201 return true;
1202 }
1203
1204 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1205 data.enforceInterface(IActivityManager.descriptor);
1206 IBinder token = data.readStrongBinder();
1207 int pid = data.readInt();
1208 boolean isForeground = data.readInt() != 0;
1209 setProcessForeground(token, pid, isForeground);
1210 reply.writeNoException();
1211 return true;
1212 }
1213
1214 case CHECK_PERMISSION_TRANSACTION: {
1215 data.enforceInterface(IActivityManager.descriptor);
1216 String perm = data.readString();
1217 int pid = data.readInt();
1218 int uid = data.readInt();
1219 int res = checkPermission(perm, pid, uid);
1220 reply.writeNoException();
1221 reply.writeInt(res);
1222 return true;
1223 }
1224
Dianne Hackbornff170242014-11-19 10:59:01 -08001225 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: {
1226 data.enforceInterface(IActivityManager.descriptor);
1227 String perm = data.readString();
1228 int pid = data.readInt();
1229 int uid = data.readInt();
1230 IBinder token = data.readStrongBinder();
1231 int res = checkPermissionWithToken(perm, pid, uid, token);
1232 reply.writeNoException();
1233 reply.writeInt(res);
1234 return true;
1235 }
1236
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001237 case CHECK_URI_PERMISSION_TRANSACTION: {
1238 data.enforceInterface(IActivityManager.descriptor);
1239 Uri uri = Uri.CREATOR.createFromParcel(data);
1240 int pid = data.readInt();
1241 int uid = data.readInt();
1242 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001243 int userId = data.readInt();
Dianne Hackbornff170242014-11-19 10:59:01 -08001244 IBinder callerToken = data.readStrongBinder();
1245 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001246 reply.writeNoException();
1247 reply.writeInt(res);
1248 return true;
1249 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001250
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001251 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001252 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 String packageName = data.readString();
1254 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1255 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001256 int userId = data.readInt();
1257 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001258 reply.writeNoException();
1259 reply.writeInt(res ? 1 : 0);
1260 return true;
1261 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001262
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001263 case GRANT_URI_PERMISSION_TRANSACTION: {
1264 data.enforceInterface(IActivityManager.descriptor);
1265 IBinder b = data.readStrongBinder();
1266 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1267 String targetPkg = data.readString();
1268 Uri uri = Uri.CREATOR.createFromParcel(data);
1269 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001270 int userId = data.readInt();
1271 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001272 reply.writeNoException();
1273 return true;
1274 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001275
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001276 case REVOKE_URI_PERMISSION_TRANSACTION: {
1277 data.enforceInterface(IActivityManager.descriptor);
1278 IBinder b = data.readStrongBinder();
1279 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1280 Uri uri = Uri.CREATOR.createFromParcel(data);
1281 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001282 int userId = data.readInt();
1283 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001284 reply.writeNoException();
1285 return true;
1286 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001287
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001288 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 Uri uri = Uri.CREATOR.createFromParcel(data);
1291 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001292 int userId = data.readInt();
1293 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001294 reply.writeNoException();
1295 return true;
1296 }
1297
1298 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1299 data.enforceInterface(IActivityManager.descriptor);
1300 Uri uri = Uri.CREATOR.createFromParcel(data);
1301 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001302 int userId = data.readInt();
1303 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001304 reply.writeNoException();
1305 return true;
1306 }
1307
1308 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1309 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001310 final String packageName = data.readString();
1311 final boolean incoming = data.readInt() != 0;
1312 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1313 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001314 reply.writeNoException();
1315 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1316 return true;
1317 }
1318
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001319 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1320 data.enforceInterface(IActivityManager.descriptor);
1321 IBinder b = data.readStrongBinder();
1322 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1323 boolean waiting = data.readInt() != 0;
1324 showWaitingForDebugger(app, waiting);
1325 reply.writeNoException();
1326 return true;
1327 }
1328
1329 case GET_MEMORY_INFO_TRANSACTION: {
1330 data.enforceInterface(IActivityManager.descriptor);
1331 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1332 getMemoryInfo(mi);
1333 reply.writeNoException();
1334 mi.writeToParcel(reply, 0);
1335 return true;
1336 }
1337
1338 case UNHANDLED_BACK_TRANSACTION: {
1339 data.enforceInterface(IActivityManager.descriptor);
1340 unhandledBack();
1341 reply.writeNoException();
1342 return true;
1343 }
1344
1345 case OPEN_CONTENT_URI_TRANSACTION: {
1346 data.enforceInterface(IActivityManager.descriptor);
1347 Uri uri = Uri.parse(data.readString());
1348 ParcelFileDescriptor pfd = openContentUri(uri);
1349 reply.writeNoException();
1350 if (pfd != null) {
1351 reply.writeInt(1);
1352 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1353 } else {
1354 reply.writeInt(0);
1355 }
1356 return true;
1357 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001358
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001359 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1360 data.enforceInterface(IActivityManager.descriptor);
1361 setLockScreenShown(data.readInt() != 0);
1362 reply.writeNoException();
1363 return true;
1364 }
1365
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001366 case SET_DEBUG_APP_TRANSACTION: {
1367 data.enforceInterface(IActivityManager.descriptor);
1368 String pn = data.readString();
1369 boolean wfd = data.readInt() != 0;
1370 boolean per = data.readInt() != 0;
1371 setDebugApp(pn, wfd, per);
1372 reply.writeNoException();
1373 return true;
1374 }
1375
1376 case SET_ALWAYS_FINISH_TRANSACTION: {
1377 data.enforceInterface(IActivityManager.descriptor);
1378 boolean enabled = data.readInt() != 0;
1379 setAlwaysFinish(enabled);
1380 reply.writeNoException();
1381 return true;
1382 }
1383
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001384 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001385 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001386 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001387 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001388 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001389 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001390 return true;
1391 }
1392
1393 case ENTER_SAFE_MODE_TRANSACTION: {
1394 data.enforceInterface(IActivityManager.descriptor);
1395 enterSafeMode();
1396 reply.writeNoException();
1397 return true;
1398 }
1399
1400 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1401 data.enforceInterface(IActivityManager.descriptor);
1402 IIntentSender is = IIntentSender.Stub.asInterface(
1403 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001404 int sourceUid = data.readInt();
1405 String sourcePkg = data.readString();
Dianne Hackborn1e383822015-04-10 14:02:33 -07001406 String tag = data.readString();
1407 noteWakeupAlarm(is, sourceUid, sourcePkg, tag);
1408 reply.writeNoException();
1409 return true;
1410 }
1411
1412 case NOTE_ALARM_START_TRANSACTION: {
1413 data.enforceInterface(IActivityManager.descriptor);
1414 IIntentSender is = IIntentSender.Stub.asInterface(
1415 data.readStrongBinder());
1416 int sourceUid = data.readInt();
1417 String tag = data.readString();
1418 noteAlarmStart(is, sourceUid, tag);
1419 reply.writeNoException();
1420 return true;
1421 }
1422
1423 case NOTE_ALARM_FINISH_TRANSACTION: {
1424 data.enforceInterface(IActivityManager.descriptor);
1425 IIntentSender is = IIntentSender.Stub.asInterface(
1426 data.readStrongBinder());
1427 int sourceUid = data.readInt();
1428 String tag = data.readString();
1429 noteAlarmFinish(is, sourceUid, tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001430 reply.writeNoException();
1431 return true;
1432 }
1433
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001434 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001435 data.enforceInterface(IActivityManager.descriptor);
1436 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001437 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001438 boolean secure = data.readInt() != 0;
1439 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001440 reply.writeNoException();
1441 reply.writeInt(res ? 1 : 0);
1442 return true;
1443 }
1444
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001445 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1446 data.enforceInterface(IActivityManager.descriptor);
1447 String reason = data.readString();
1448 boolean res = killProcessesBelowForeground(reason);
1449 reply.writeNoException();
1450 reply.writeInt(res ? 1 : 0);
1451 return true;
1452 }
1453
Dan Egnor60d87622009-12-16 16:32:58 -08001454 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1455 data.enforceInterface(IActivityManager.descriptor);
1456 IBinder app = data.readStrongBinder();
1457 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1458 handleApplicationCrash(app, ci);
1459 reply.writeNoException();
1460 return true;
1461 }
1462
1463 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001464 data.enforceInterface(IActivityManager.descriptor);
1465 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001466 String tag = data.readString();
Dianne Hackborn52322712014-08-26 22:47:26 -07001467 boolean system = data.readInt() != 0;
Dan Egnorb7f03672009-12-09 16:22:32 -08001468 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dianne Hackborn52322712014-08-26 22:47:26 -07001469 boolean res = handleApplicationWtf(app, tag, system, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001470 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001471 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001472 return true;
1473 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001474
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001475 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1476 data.enforceInterface(IActivityManager.descriptor);
1477 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001478 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001479 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1480 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001481 reply.writeNoException();
1482 return true;
1483 }
1484
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001485 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 int sig = data.readInt();
1488 signalPersistentProcesses(sig);
1489 reply.writeNoException();
1490 return true;
1491 }
1492
Dianne Hackborn03abb812010-01-04 18:43:19 -08001493 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1494 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001495 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001496 int userId = data.readInt();
1497 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001498 reply.writeNoException();
1499 return true;
1500 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001501
1502 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1503 data.enforceInterface(IActivityManager.descriptor);
1504 killAllBackgroundProcesses();
1505 reply.writeNoException();
1506 return true;
1507 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001508
Dianne Hackborn03abb812010-01-04 18:43:19 -08001509 case FORCE_STOP_PACKAGE_TRANSACTION: {
1510 data.enforceInterface(IActivityManager.descriptor);
1511 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001512 int userId = data.readInt();
1513 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001514 reply.writeNoException();
1515 return true;
1516 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001517
1518 case GET_MY_MEMORY_STATE_TRANSACTION: {
1519 data.enforceInterface(IActivityManager.descriptor);
1520 ActivityManager.RunningAppProcessInfo info =
1521 new ActivityManager.RunningAppProcessInfo();
1522 getMyMemoryState(info);
1523 reply.writeNoException();
1524 info.writeToParcel(reply, 0);
1525 return true;
1526 }
1527
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001528 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1529 data.enforceInterface(IActivityManager.descriptor);
1530 ConfigurationInfo config = getDeviceConfigurationInfo();
1531 reply.writeNoException();
1532 config.writeToParcel(reply, 0);
1533 return true;
1534 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001535
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001536 case PROFILE_CONTROL_TRANSACTION: {
1537 data.enforceInterface(IActivityManager.descriptor);
1538 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001539 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001540 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001541 int profileType = data.readInt();
Jeff Hao1b012d32014-08-20 10:35:34 -07001542 ProfilerInfo profilerInfo = data.readInt() != 0
1543 ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
1544 boolean res = profileControl(process, userId, start, profilerInfo, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001545 reply.writeNoException();
1546 reply.writeInt(res ? 1 : 0);
1547 return true;
1548 }
Jeff Hao1b012d32014-08-20 10:35:34 -07001549
Dianne Hackborn55280a92009-05-07 15:53:46 -07001550 case SHUTDOWN_TRANSACTION: {
1551 data.enforceInterface(IActivityManager.descriptor);
1552 boolean res = shutdown(data.readInt());
1553 reply.writeNoException();
1554 reply.writeInt(res ? 1 : 0);
1555 return true;
1556 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001557
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001558 case STOP_APP_SWITCHES_TRANSACTION: {
1559 data.enforceInterface(IActivityManager.descriptor);
1560 stopAppSwitches();
1561 reply.writeNoException();
1562 return true;
1563 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001564
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001565 case RESUME_APP_SWITCHES_TRANSACTION: {
1566 data.enforceInterface(IActivityManager.descriptor);
1567 resumeAppSwitches();
1568 reply.writeNoException();
1569 return true;
1570 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001571
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001572 case PEEK_SERVICE_TRANSACTION: {
1573 data.enforceInterface(IActivityManager.descriptor);
1574 Intent service = Intent.CREATOR.createFromParcel(data);
1575 String resolvedType = data.readString();
Svet Ganov99b60432015-06-27 13:15:22 -07001576 String callingPackage = data.readString();
1577 IBinder binder = peekService(service, resolvedType, callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001578 reply.writeNoException();
1579 reply.writeStrongBinder(binder);
1580 return true;
1581 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001582
Christopher Tate181fafa2009-05-14 11:12:14 -07001583 case START_BACKUP_AGENT_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1586 int backupRestoreMode = data.readInt();
1587 boolean success = bindBackupAgent(info, backupRestoreMode);
1588 reply.writeNoException();
1589 reply.writeInt(success ? 1 : 0);
1590 return true;
1591 }
1592
1593 case BACKUP_AGENT_CREATED_TRANSACTION: {
1594 data.enforceInterface(IActivityManager.descriptor);
1595 String packageName = data.readString();
1596 IBinder agent = data.readStrongBinder();
1597 backupAgentCreated(packageName, agent);
1598 reply.writeNoException();
1599 return true;
1600 }
1601
1602 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1603 data.enforceInterface(IActivityManager.descriptor);
1604 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1605 unbindBackupAgent(info);
1606 reply.writeNoException();
1607 return true;
1608 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001609
1610 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: {
1611 data.enforceInterface(IActivityManager.descriptor);
1612 String packageName = data.readString();
1613 addPackageDependency(packageName);
1614 reply.writeNoException();
1615 return true;
1616 }
1617
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001618 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001619 data.enforceInterface(IActivityManager.descriptor);
1620 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001621 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001622 String reason = data.readString();
1623 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001624 reply.writeNoException();
1625 return true;
1626 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07001627
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001628 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1629 data.enforceInterface(IActivityManager.descriptor);
1630 String reason = data.readString();
1631 closeSystemDialogs(reason);
1632 reply.writeNoException();
1633 return true;
1634 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001635
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001636 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1637 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001638 int[] pids = data.createIntArray();
1639 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001640 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001641 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001642 return true;
1643 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001644
1645 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1646 data.enforceInterface(IActivityManager.descriptor);
1647 String processName = data.readString();
1648 int uid = data.readInt();
1649 killApplicationProcess(processName, uid);
1650 reply.writeNoException();
1651 return true;
1652 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001653
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001654 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1655 data.enforceInterface(IActivityManager.descriptor);
1656 IBinder token = data.readStrongBinder();
1657 String packageName = data.readString();
1658 int enterAnim = data.readInt();
1659 int exitAnim = data.readInt();
1660 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001661 reply.writeNoException();
1662 return true;
1663 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001664
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001665 case IS_USER_A_MONKEY_TRANSACTION: {
1666 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001667 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001668 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001669 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001670 return true;
1671 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001672
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001673 case SET_USER_IS_MONKEY_TRANSACTION: {
1674 data.enforceInterface(IActivityManager.descriptor);
1675 final boolean monkey = (data.readInt() == 1);
1676 setUserIsMonkey(monkey);
1677 reply.writeNoException();
1678 return true;
1679 }
1680
Dianne Hackborn860755f2010-06-03 18:47:52 -07001681 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1682 data.enforceInterface(IActivityManager.descriptor);
1683 finishHeavyWeightApp();
1684 reply.writeNoException();
1685 return true;
1686 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001687
1688 case IS_IMMERSIVE_TRANSACTION: {
1689 data.enforceInterface(IActivityManager.descriptor);
1690 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001691 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001692 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001693 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001694 return true;
1695 }
1696
Craig Mautnerd61dc202014-07-07 11:09:11 -07001697 case IS_TOP_OF_TASK_TRANSACTION: {
1698 data.enforceInterface(IActivityManager.descriptor);
1699 IBinder token = data.readStrongBinder();
1700 final boolean isTopOfTask = isTopOfTask(token);
1701 reply.writeNoException();
1702 reply.writeInt(isTopOfTask ? 1 : 0);
1703 return true;
1704 }
1705
Craig Mautner5eda9b32013-07-02 11:58:16 -07001706 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001707 data.enforceInterface(IActivityManager.descriptor);
1708 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001709 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001710 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001711 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001712 return true;
1713 }
1714
1715 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1716 data.enforceInterface(IActivityManager.descriptor);
1717 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001718 final Bundle bundle;
1719 if (data.readInt() == 0) {
1720 bundle = null;
1721 } else {
1722 bundle = data.readBundle();
1723 }
1724 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1725 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001726 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001727 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001728 return true;
1729 }
1730
Craig Mautner233ceee2014-05-09 17:05:11 -07001731 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1732 data.enforceInterface(IActivityManager.descriptor);
1733 IBinder token = data.readStrongBinder();
1734 final ActivityOptions options = getActivityOptions(token);
1735 reply.writeNoException();
1736 reply.writeBundle(options == null ? null : options.toBundle());
1737 return true;
1738 }
1739
Daniel Sandler69a48172010-06-23 16:29:36 -04001740 case SET_IMMERSIVE_TRANSACTION: {
1741 data.enforceInterface(IActivityManager.descriptor);
1742 IBinder token = data.readStrongBinder();
1743 boolean imm = data.readInt() == 1;
1744 setImmersive(token, imm);
1745 reply.writeNoException();
1746 return true;
1747 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001748
Daniel Sandler69a48172010-06-23 16:29:36 -04001749 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1750 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001751 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001752 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001753 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001754 return true;
1755 }
1756
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001757 case CRASH_APPLICATION_TRANSACTION: {
1758 data.enforceInterface(IActivityManager.descriptor);
1759 int uid = data.readInt();
1760 int initialPid = data.readInt();
1761 String packageName = data.readString();
1762 String message = data.readString();
1763 crashApplication(uid, initialPid, packageName, message);
1764 reply.writeNoException();
1765 return true;
1766 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001767
1768 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1769 data.enforceInterface(IActivityManager.descriptor);
1770 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001771 int userId = data.readInt();
1772 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001773 reply.writeNoException();
1774 reply.writeString(type);
1775 return true;
1776 }
1777
Dianne Hackborn7e269642010-08-25 19:50:20 -07001778 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1779 data.enforceInterface(IActivityManager.descriptor);
1780 String name = data.readString();
1781 IBinder perm = newUriPermissionOwner(name);
1782 reply.writeNoException();
1783 reply.writeStrongBinder(perm);
1784 return true;
1785 }
1786
1787 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1788 data.enforceInterface(IActivityManager.descriptor);
1789 IBinder owner = data.readStrongBinder();
1790 int fromUid = data.readInt();
1791 String targetPkg = data.readString();
1792 Uri uri = Uri.CREATOR.createFromParcel(data);
1793 int mode = data.readInt();
Nicolas Prevotf1939902014-06-25 09:29:02 +01001794 int sourceUserId = data.readInt();
1795 int targetUserId = data.readInt();
1796 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId,
1797 targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001798 reply.writeNoException();
1799 return true;
1800 }
1801
1802 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1803 data.enforceInterface(IActivityManager.descriptor);
1804 IBinder owner = data.readStrongBinder();
1805 Uri uri = null;
1806 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001807 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001808 }
1809 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001810 int userId = data.readInt();
1811 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001812 reply.writeNoException();
1813 return true;
1814 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001815
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001816 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1817 data.enforceInterface(IActivityManager.descriptor);
1818 int callingUid = data.readInt();
1819 String targetPkg = data.readString();
1820 Uri uri = Uri.CREATOR.createFromParcel(data);
1821 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001822 int userId = data.readInt();
1823 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001824 reply.writeNoException();
1825 reply.writeInt(res);
1826 return true;
1827 }
1828
Andy McFadden824c5102010-07-09 16:26:57 -07001829 case DUMP_HEAP_TRANSACTION: {
1830 data.enforceInterface(IActivityManager.descriptor);
1831 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001832 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001833 boolean managed = data.readInt() != 0;
1834 String path = data.readString();
1835 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001836 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001837 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001838 reply.writeNoException();
1839 reply.writeInt(res ? 1 : 0);
1840 return true;
1841 }
1842
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001843 case START_ACTIVITIES_TRANSACTION:
1844 {
1845 data.enforceInterface(IActivityManager.descriptor);
1846 IBinder b = data.readStrongBinder();
1847 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001848 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001849 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1850 String[] resolvedTypes = data.createStringArray();
1851 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001852 Bundle options = data.readInt() != 0
1853 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001854 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001855 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001856 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001857 reply.writeNoException();
1858 reply.writeInt(result);
1859 return true;
1860 }
1861
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001862 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1863 {
1864 data.enforceInterface(IActivityManager.descriptor);
1865 int mode = getFrontActivityScreenCompatMode();
1866 reply.writeNoException();
1867 reply.writeInt(mode);
1868 return true;
1869 }
1870
1871 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1872 {
1873 data.enforceInterface(IActivityManager.descriptor);
1874 int mode = data.readInt();
1875 setFrontActivityScreenCompatMode(mode);
1876 reply.writeNoException();
1877 reply.writeInt(mode);
1878 return true;
1879 }
1880
1881 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1882 {
1883 data.enforceInterface(IActivityManager.descriptor);
1884 String pkg = data.readString();
1885 int mode = getPackageScreenCompatMode(pkg);
1886 reply.writeNoException();
1887 reply.writeInt(mode);
1888 return true;
1889 }
1890
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001891 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1892 {
1893 data.enforceInterface(IActivityManager.descriptor);
1894 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001895 int mode = data.readInt();
1896 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001897 reply.writeNoException();
1898 return true;
1899 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07001900
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001901 case SWITCH_USER_TRANSACTION: {
1902 data.enforceInterface(IActivityManager.descriptor);
1903 int userid = data.readInt();
1904 boolean result = switchUser(userid);
1905 reply.writeNoException();
1906 reply.writeInt(result ? 1 : 0);
1907 return true;
1908 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001909
Kenny Guy08488bf2014-02-21 17:40:37 +00001910 case START_USER_IN_BACKGROUND_TRANSACTION: {
1911 data.enforceInterface(IActivityManager.descriptor);
1912 int userid = data.readInt();
1913 boolean result = startUserInBackground(userid);
1914 reply.writeNoException();
1915 reply.writeInt(result ? 1 : 0);
1916 return true;
1917 }
1918
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001919 case STOP_USER_TRANSACTION: {
1920 data.enforceInterface(IActivityManager.descriptor);
1921 int userid = data.readInt();
1922 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1923 data.readStrongBinder());
1924 int result = stopUser(userid, callback);
1925 reply.writeNoException();
1926 reply.writeInt(result);
1927 return true;
1928 }
1929
Amith Yamasani52f1d752012-03-28 18:19:29 -07001930 case GET_CURRENT_USER_TRANSACTION: {
1931 data.enforceInterface(IActivityManager.descriptor);
1932 UserInfo userInfo = getCurrentUser();
1933 reply.writeNoException();
1934 userInfo.writeToParcel(reply, 0);
1935 return true;
1936 }
1937
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001938 case IS_USER_RUNNING_TRANSACTION: {
1939 data.enforceInterface(IActivityManager.descriptor);
1940 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001941 boolean orStopping = data.readInt() != 0;
1942 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001943 reply.writeNoException();
1944 reply.writeInt(result ? 1 : 0);
1945 return true;
1946 }
1947
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001948 case GET_RUNNING_USER_IDS_TRANSACTION: {
1949 data.enforceInterface(IActivityManager.descriptor);
1950 int[] result = getRunningUserIds();
1951 reply.writeNoException();
1952 reply.writeIntArray(result);
1953 return true;
1954 }
1955
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001956 case REMOVE_TASK_TRANSACTION:
1957 {
1958 data.enforceInterface(IActivityManager.descriptor);
1959 int taskId = data.readInt();
Wale Ogunwaled54b5782014-10-23 15:55:23 -07001960 boolean result = removeTask(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001961 reply.writeNoException();
1962 reply.writeInt(result ? 1 : 0);
1963 return true;
1964 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001965
Jeff Sharkeya4620792011-05-20 15:29:23 -07001966 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1967 data.enforceInterface(IActivityManager.descriptor);
1968 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1969 data.readStrongBinder());
1970 registerProcessObserver(observer);
1971 return true;
1972 }
1973
1974 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1975 data.enforceInterface(IActivityManager.descriptor);
1976 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1977 data.readStrongBinder());
1978 unregisterProcessObserver(observer);
1979 return true;
1980 }
1981
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07001982 case REGISTER_UID_OBSERVER_TRANSACTION: {
1983 data.enforceInterface(IActivityManager.descriptor);
1984 IUidObserver observer = IUidObserver.Stub.asInterface(
1985 data.readStrongBinder());
1986 registerUidObserver(observer);
1987 return true;
1988 }
1989
1990 case UNREGISTER_UID_OBSERVER_TRANSACTION: {
1991 data.enforceInterface(IActivityManager.descriptor);
1992 IUidObserver observer = IUidObserver.Stub.asInterface(
1993 data.readStrongBinder());
1994 unregisterUidObserver(observer);
1995 return true;
1996 }
1997
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001998 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1999 {
2000 data.enforceInterface(IActivityManager.descriptor);
2001 String pkg = data.readString();
2002 boolean ask = getPackageAskScreenCompat(pkg);
2003 reply.writeNoException();
2004 reply.writeInt(ask ? 1 : 0);
2005 return true;
2006 }
2007
2008 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
2009 {
2010 data.enforceInterface(IActivityManager.descriptor);
2011 String pkg = data.readString();
2012 boolean ask = data.readInt() != 0;
2013 setPackageAskScreenCompat(pkg, ask);
2014 reply.writeNoException();
2015 return true;
2016 }
2017
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002018 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
2019 data.enforceInterface(IActivityManager.descriptor);
2020 IIntentSender r = IIntentSender.Stub.asInterface(
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002021 data.readStrongBinder());
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002022 boolean res = isIntentSenderTargetedToPackage(r);
2023 reply.writeNoException();
2024 reply.writeInt(res ? 1 : 0);
2025 return true;
2026 }
2027
Dianne Hackborn1927ae82012-06-22 15:21:36 -07002028 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
2029 data.enforceInterface(IActivityManager.descriptor);
2030 IIntentSender r = IIntentSender.Stub.asInterface(
2031 data.readStrongBinder());
2032 boolean res = isIntentSenderAnActivity(r);
2033 reply.writeNoException();
2034 reply.writeInt(res ? 1 : 0);
2035 return true;
2036 }
2037
Dianne Hackborn81038902012-11-26 17:04:09 -08002038 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
2039 data.enforceInterface(IActivityManager.descriptor);
2040 IIntentSender r = IIntentSender.Stub.asInterface(
2041 data.readStrongBinder());
2042 Intent intent = getIntentForIntentSender(r);
2043 reply.writeNoException();
2044 if (intent != null) {
2045 reply.writeInt(1);
2046 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2047 } else {
2048 reply.writeInt(0);
2049 }
2050 return true;
2051 }
2052
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08002053 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
2054 data.enforceInterface(IActivityManager.descriptor);
2055 IIntentSender r = IIntentSender.Stub.asInterface(
2056 data.readStrongBinder());
2057 String prefix = data.readString();
2058 String tag = getTagForIntentSender(r, prefix);
2059 reply.writeNoException();
2060 reply.writeString(tag);
2061 return true;
2062 }
2063
Dianne Hackborn31ca8542011-07-19 14:58:28 -07002064 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
2065 data.enforceInterface(IActivityManager.descriptor);
2066 Configuration config = Configuration.CREATOR.createFromParcel(data);
2067 updatePersistentConfiguration(config);
2068 reply.writeNoException();
2069 return true;
2070 }
2071
Dianne Hackbornb437e092011-08-05 17:50:29 -07002072 case GET_PROCESS_PSS_TRANSACTION: {
2073 data.enforceInterface(IActivityManager.descriptor);
2074 int[] pids = data.createIntArray();
2075 long[] pss = getProcessPss(pids);
2076 reply.writeNoException();
2077 reply.writeLongArray(pss);
2078 return true;
2079 }
2080
Dianne Hackborn661cd522011-08-22 00:26:20 -07002081 case SHOW_BOOT_MESSAGE_TRANSACTION: {
2082 data.enforceInterface(IActivityManager.descriptor);
2083 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2084 boolean always = data.readInt() != 0;
2085 showBootMessage(msg, always);
2086 reply.writeNoException();
2087 return true;
2088 }
2089
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002090 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002091 data.enforceInterface(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02002092 keyguardWaitingForActivityDrawn();
Dianne Hackborn90c52de2011-09-23 12:57:44 -07002093 reply.writeNoException();
2094 return true;
2095 }
2096
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07002097 case KEYGUARD_GOING_AWAY_TRANSACTION: {
2098 data.enforceInterface(IActivityManager.descriptor);
2099 keyguardGoingAway(data.readInt() != 0, data.readInt() != 0);
2100 reply.writeNoException();
2101 return true;
2102 }
2103
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002104 case SHOULD_UP_RECREATE_TASK_TRANSACTION: {
Adam Powelldd8fab22012-03-22 17:47:27 -07002105 data.enforceInterface(IActivityManager.descriptor);
2106 IBinder token = data.readStrongBinder();
2107 String destAffinity = data.readString();
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07002108 boolean res = shouldUpRecreateTask(token, destAffinity);
Adam Powelldd8fab22012-03-22 17:47:27 -07002109 reply.writeNoException();
2110 reply.writeInt(res ? 1 : 0);
2111 return true;
2112 }
2113
2114 case NAVIGATE_UP_TO_TRANSACTION: {
2115 data.enforceInterface(IActivityManager.descriptor);
2116 IBinder token = data.readStrongBinder();
2117 Intent target = Intent.CREATOR.createFromParcel(data);
2118 int resultCode = data.readInt();
2119 Intent resultData = null;
2120 if (data.readInt() != 0) {
2121 resultData = Intent.CREATOR.createFromParcel(data);
2122 }
2123 boolean res = navigateUpTo(token, target, resultCode, resultData);
2124 reply.writeNoException();
2125 reply.writeInt(res ? 1 : 0);
2126 return true;
2127 }
2128
Dianne Hackborn5320eb82012-05-18 12:05:04 -07002129 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
2130 data.enforceInterface(IActivityManager.descriptor);
2131 IBinder token = data.readStrongBinder();
2132 int res = getLaunchedFromUid(token);
2133 reply.writeNoException();
2134 reply.writeInt(res);
2135 return true;
2136 }
2137
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002138 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
2139 data.enforceInterface(IActivityManager.descriptor);
2140 IBinder token = data.readStrongBinder();
2141 String res = getLaunchedFromPackage(token);
2142 reply.writeNoException();
2143 reply.writeString(res);
2144 return true;
2145 }
2146
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002147 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2148 data.enforceInterface(IActivityManager.descriptor);
2149 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2150 data.readStrongBinder());
2151 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002152 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002153 return true;
2154 }
2155
2156 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
2157 data.enforceInterface(IActivityManager.descriptor);
2158 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
2159 data.readStrongBinder());
2160 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002161 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07002162 return true;
2163 }
2164
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002165 case REQUEST_BUG_REPORT_TRANSACTION: {
2166 data.enforceInterface(IActivityManager.descriptor);
2167 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002168 reply.writeNoException();
2169 return true;
2170 }
2171
2172 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2173 data.enforceInterface(IActivityManager.descriptor);
2174 int pid = data.readInt();
2175 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002176 String reason = data.readString();
2177 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002178 reply.writeNoException();
2179 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002180 return true;
2181 }
2182
Adam Skorydfc7fd72013-08-05 19:23:41 -07002183 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002184 data.enforceInterface(IActivityManager.descriptor);
2185 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002186 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002187 reply.writeNoException();
2188 reply.writeBundle(res);
2189 return true;
2190 }
2191
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002192 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
2193 data.enforceInterface(IActivityManager.descriptor);
2194 int requestType = data.readInt();
2195 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07002196 IBinder activityToken = data.readStrongBinder();
2197 boolean res = requestAssistContextExtras(requestType, receiver, activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002198 reply.writeNoException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07002199 reply.writeInt(res ? 1 : 0);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08002200 return true;
2201 }
2202
Adam Skorydfc7fd72013-08-05 19:23:41 -07002203 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002204 data.enforceInterface(IActivityManager.descriptor);
2205 IBinder token = data.readStrongBinder();
2206 Bundle extras = data.readBundle();
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07002207 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data);
2208 AssistContent content = AssistContent.CREATOR.createFromParcel(data);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07002209 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null;
2210 reportAssistContextExtras(token, extras, structure, content, referrer);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002211 reply.writeNoException();
2212 return true;
2213 }
2214
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002215 case LAUNCH_ASSIST_INTENT_TRANSACTION: {
2216 data.enforceInterface(IActivityManager.descriptor);
2217 Intent intent = Intent.CREATOR.createFromParcel(data);
2218 int requestType = data.readInt();
2219 String hint = data.readString();
2220 int userHandle = data.readInt();
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07002221 Bundle args = data.readBundle();
2222 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07002223 reply.writeNoException();
2224 reply.writeInt(res ? 1 : 0);
2225 return true;
2226 }
2227
Benjamin Franzc200f442015-06-25 18:20:04 +01002228 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: {
2229 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn17f69352015-07-17 18:04:14 -07002230 boolean res = isAssistDataAllowedOnCurrentActivity();
2231 reply.writeNoException();
2232 reply.writeInt(res ? 1 : 0);
2233 return true;
2234 }
2235
2236 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: {
2237 data.enforceInterface(IActivityManager.descriptor);
2238 IBinder token = data.readStrongBinder();
2239 Bundle args = data.readBundle();
2240 boolean res = showAssistFromActivity(token, args);
Benjamin Franzc200f442015-06-25 18:20:04 +01002241 reply.writeNoException();
2242 reply.writeInt(res ? 1 : 0);
2243 return true;
2244 }
2245
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002246 case KILL_UID_TRANSACTION: {
2247 data.enforceInterface(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07002248 int appId = data.readInt();
2249 int userId = data.readInt();
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002250 String reason = data.readString();
Svetoslavaa41add2015-08-06 15:03:55 -07002251 killUid(appId, userId, reason);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002252 reply.writeNoException();
2253 return true;
2254 }
2255
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002256 case HANG_TRANSACTION: {
2257 data.enforceInterface(IActivityManager.descriptor);
2258 IBinder who = data.readStrongBinder();
2259 boolean allowRestart = data.readInt() != 0;
2260 hang(who, allowRestart);
2261 reply.writeNoException();
2262 return true;
2263 }
2264
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002265 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2266 data.enforceInterface(IActivityManager.descriptor);
2267 IBinder token = data.readStrongBinder();
2268 reportActivityFullyDrawn(token);
2269 reply.writeNoException();
2270 return true;
2271 }
2272
Craig Mautner5eda9b32013-07-02 11:58:16 -07002273 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2274 data.enforceInterface(IActivityManager.descriptor);
2275 IBinder token = data.readStrongBinder();
2276 notifyActivityDrawn(token);
2277 reply.writeNoException();
2278 return true;
2279 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002280
2281 case RESTART_TRANSACTION: {
2282 data.enforceInterface(IActivityManager.descriptor);
2283 restart();
2284 reply.writeNoException();
2285 return true;
2286 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002287
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002288 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2289 data.enforceInterface(IActivityManager.descriptor);
2290 performIdleMaintenance();
2291 reply.writeNoException();
2292 return true;
2293 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002294
Todd Kennedyca4d8422015-01-15 15:19:22 -08002295 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: {
Craig Mautner4a1cb222013-12-04 16:14:06 -08002296 data.enforceInterface(IActivityManager.descriptor);
2297 IBinder parentActivityToken = data.readStrongBinder();
2298 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002299 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002300 IActivityContainer activityContainer =
Todd Kennedyca4d8422015-01-15 15:19:22 -08002301 createVirtualActivityContainer(parentActivityToken, callback);
Craig Mautner4a1cb222013-12-04 16:14:06 -08002302 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002303 if (activityContainer != null) {
2304 reply.writeInt(1);
2305 reply.writeStrongBinder(activityContainer.asBinder());
2306 } else {
2307 reply.writeInt(0);
2308 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002309 return true;
2310 }
2311
Craig Mautner95da1082014-02-24 17:54:35 -08002312 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2313 data.enforceInterface(IActivityManager.descriptor);
2314 IActivityContainer activityContainer =
2315 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2316 deleteActivityContainer(activityContainer);
2317 reply.writeNoException();
2318 return true;
2319 }
2320
Todd Kennedy4900bf92015-01-16 16:05:14 -08002321 case CREATE_STACK_ON_DISPLAY: {
2322 data.enforceInterface(IActivityManager.descriptor);
2323 int displayId = data.readInt();
2324 IActivityContainer activityContainer = createStackOnDisplay(displayId);
2325 reply.writeNoException();
2326 if (activityContainer != null) {
2327 reply.writeInt(1);
2328 reply.writeStrongBinder(activityContainer.asBinder());
2329 } else {
2330 reply.writeInt(0);
2331 }
2332 return true;
2333 }
2334
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002335 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: {
Craig Mautnere0a38842013-12-16 16:14:02 -08002336 data.enforceInterface(IActivityManager.descriptor);
2337 IBinder activityToken = data.readStrongBinder();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002338 int displayId = getActivityDisplayId(activityToken);
Craig Mautnere0a38842013-12-16 16:14:02 -08002339 reply.writeNoException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08002340 reply.writeInt(displayId);
Craig Mautnere0a38842013-12-16 16:14:02 -08002341 return true;
2342 }
2343
Craig Mautneraea74a52014-03-08 14:23:10 -08002344 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2345 data.enforceInterface(IActivityManager.descriptor);
2346 final int taskId = data.readInt();
2347 startLockTaskMode(taskId);
2348 reply.writeNoException();
2349 return true;
2350 }
2351
2352 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2353 data.enforceInterface(IActivityManager.descriptor);
2354 IBinder token = data.readStrongBinder();
2355 startLockTaskMode(token);
2356 reply.writeNoException();
2357 return true;
2358 }
2359
Craig Mautnerd61dc202014-07-07 11:09:11 -07002360 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002361 data.enforceInterface(IActivityManager.descriptor);
2362 startLockTaskModeOnCurrent();
2363 reply.writeNoException();
2364 return true;
2365 }
2366
Craig Mautneraea74a52014-03-08 14:23:10 -08002367 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2368 data.enforceInterface(IActivityManager.descriptor);
2369 stopLockTaskMode();
2370 reply.writeNoException();
2371 return true;
2372 }
2373
Craig Mautnerd61dc202014-07-07 11:09:11 -07002374 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002375 data.enforceInterface(IActivityManager.descriptor);
2376 stopLockTaskModeOnCurrent();
2377 reply.writeNoException();
2378 return true;
2379 }
2380
Craig Mautneraea74a52014-03-08 14:23:10 -08002381 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2382 data.enforceInterface(IActivityManager.descriptor);
2383 final boolean isInLockTaskMode = isInLockTaskMode();
2384 reply.writeNoException();
2385 reply.writeInt(isInLockTaskMode ? 1 : 0);
2386 return true;
2387 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002388
Benjamin Franz43261142015-02-11 15:59:44 +00002389 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: {
2390 data.enforceInterface(IActivityManager.descriptor);
2391 final int lockTaskModeState = getLockTaskModeState();
2392 reply.writeNoException();
2393 reply.writeInt(lockTaskModeState);
2394 return true;
2395 }
2396
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07002397 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: {
2398 data.enforceInterface(IActivityManager.descriptor);
2399 final IBinder token = data.readStrongBinder();
2400 showLockTaskEscapeMessage(token);
2401 reply.writeNoException();
2402 return true;
2403 }
2404
Winson Chunga449dc02014-05-16 11:15:04 -07002405 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002406 data.enforceInterface(IActivityManager.descriptor);
2407 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002408 ActivityManager.TaskDescription values =
2409 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2410 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002411 reply.writeNoException();
2412 return true;
2413 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002414
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08002415 case SET_TASK_RESIZEABLE_TRANSACTION: {
2416 data.enforceInterface(IActivityManager.descriptor);
2417 int taskId = data.readInt();
2418 boolean resizeable = (data.readInt() == 1) ? true : false;
2419 setTaskResizeable(taskId, resizeable);
2420 reply.writeNoException();
2421 return true;
2422 }
2423
Wale Ogunwale53a29a92015-02-23 15:42:52 -08002424 case RESIZE_TASK_TRANSACTION: {
2425 data.enforceInterface(IActivityManager.descriptor);
2426 int taskId = data.readInt();
2427 Rect r = Rect.CREATOR.createFromParcel(data);
2428 resizeTask(taskId, r);
2429 reply.writeNoException();
2430 return true;
2431 }
2432
Craig Mautner648f69b2014-09-18 14:16:26 -07002433 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: {
2434 data.enforceInterface(IActivityManager.descriptor);
2435 String filename = data.readString();
2436 Bitmap icon = getTaskDescriptionIcon(filename);
2437 reply.writeNoException();
2438 if (icon == null) {
2439 reply.writeInt(0);
2440 } else {
2441 reply.writeInt(1);
2442 icon.writeToParcel(reply, 0);
2443 }
2444 return true;
2445 }
2446
Winson Chung044d5292014-11-06 11:05:19 -08002447 case START_IN_PLACE_ANIMATION_TRANSACTION: {
2448 data.enforceInterface(IActivityManager.descriptor);
2449 final Bundle bundle;
2450 if (data.readInt() == 0) {
2451 bundle = null;
2452 } else {
2453 bundle = data.readBundle();
2454 }
2455 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
2456 startInPlaceAnimationOnFrontMostApplication(options);
2457 reply.writeNoException();
2458 return true;
2459 }
2460
Jose Lima4b6c6692014-08-12 17:41:12 -07002461 case REQUEST_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002462 data.enforceInterface(IActivityManager.descriptor);
2463 IBinder token = data.readStrongBinder();
2464 boolean enable = data.readInt() > 0;
Jose Lima4b6c6692014-08-12 17:41:12 -07002465 boolean success = requestVisibleBehind(token, enable);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002466 reply.writeNoException();
2467 reply.writeInt(success ? 1 : 0);
2468 return true;
2469 }
2470
Jose Lima4b6c6692014-08-12 17:41:12 -07002471 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002472 data.enforceInterface(IActivityManager.descriptor);
2473 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002474 final boolean enabled = isBackgroundVisibleBehind(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002475 reply.writeNoException();
2476 reply.writeInt(enabled ? 1 : 0);
2477 return true;
2478 }
2479
Jose Lima4b6c6692014-08-12 17:41:12 -07002480 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: {
Craig Mautneree2e45a2014-06-27 12:10:03 -07002481 data.enforceInterface(IActivityManager.descriptor);
2482 IBinder token = data.readStrongBinder();
Jose Lima4b6c6692014-08-12 17:41:12 -07002483 backgroundResourcesReleased(token);
Craig Mautneree2e45a2014-06-27 12:10:03 -07002484 reply.writeNoException();
2485 return true;
2486 }
Craig Mautnerbb742462014-07-07 15:28:55 -07002487
2488 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: {
2489 data.enforceInterface(IActivityManager.descriptor);
2490 IBinder token = data.readStrongBinder();
2491 notifyLaunchTaskBehindComplete(token);
2492 reply.writeNoException();
2493 return true;
2494 }
Craig Mautner8746a472014-07-24 15:12:54 -07002495
2496 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: {
2497 data.enforceInterface(IActivityManager.descriptor);
2498 IBinder token = data.readStrongBinder();
2499 notifyEnterAnimationComplete(token);
2500 reply.writeNoException();
2501 return true;
2502 }
Craig Mautner6e2f3952014-09-09 14:26:41 -07002503
2504 case BOOT_ANIMATION_COMPLETE_TRANSACTION: {
2505 data.enforceInterface(IActivityManager.descriptor);
2506 bootAnimationComplete();
2507 reply.writeNoException();
2508 return true;
2509 }
Wale Ogunwale18795a22014-12-03 11:38:33 -08002510
Jeff Sharkey605eb792014-11-04 13:34:06 -08002511 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: {
2512 data.enforceInterface(IActivityManager.descriptor);
2513 final int uid = data.readInt();
2514 final byte[] firstPacket = data.createByteArray();
2515 notifyCleartextNetwork(uid, firstPacket);
2516 reply.writeNoException();
2517 return true;
2518 }
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002519
2520 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
2521 data.enforceInterface(IActivityManager.descriptor);
2522 String procName = data.readString();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002523 int uid = data.readInt();
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002524 long maxMemSize = data.readLong();
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07002525 String reportPackage = data.readString();
2526 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08002527 reply.writeNoException();
2528 return true;
2529 }
2530
2531 case DUMP_HEAP_FINISHED_TRANSACTION: {
2532 data.enforceInterface(IActivityManager.descriptor);
2533 String path = data.readString();
2534 dumpHeapFinished(path);
2535 reply.writeNoException();
2536 return true;
2537 }
Dianne Hackborn3d07c942015-03-13 18:02:54 -07002538
2539 case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
2540 data.enforceInterface(IActivityManager.descriptor);
2541 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
2542 data.readStrongBinder());
2543 boolean keepAwake = data.readInt() != 0;
2544 setVoiceKeepAwake(session, keepAwake);
2545 reply.writeNoException();
2546 return true;
2547 }
Craig Mautnere5600772015-04-03 21:36:37 -07002548
2549 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: {
2550 data.enforceInterface(IActivityManager.descriptor);
2551 int userId = data.readInt();
2552 String[] packages = data.readStringArray();
2553 updateLockTaskPackages(userId, packages);
2554 reply.writeNoException();
2555 return true;
2556 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07002557
Craig Mautner015c5e52015-04-23 10:39:39 -07002558 case UPDATE_DEVICE_OWNER_TRANSACTION: {
2559 data.enforceInterface(IActivityManager.descriptor);
2560 String packageName = data.readString();
2561 updateDeviceOwner(packageName);
2562 reply.writeNoException();
2563 return true;
2564 }
2565
Dianne Hackborn1e383822015-04-10 14:02:33 -07002566 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: {
2567 data.enforceInterface(IActivityManager.descriptor);
2568 String pkg = data.readString();
Adam Lesinskic30454c2015-06-24 13:24:35 -07002569 String callingPackage = data.readString();
2570 int res = getPackageProcessState(pkg, callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07002571 reply.writeNoException();
2572 reply.writeInt(res);
2573 return true;
2574 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07002575
2576 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: {
2577 data.enforceInterface(IActivityManager.descriptor);
2578 String process = data.readString();
2579 int userId = data.readInt();
2580 int level = data.readInt();
2581 boolean res = setProcessMemoryTrimLevel(process, userId, level);
2582 reply.writeNoException();
2583 reply.writeInt(res ? 1 : 0);
2584 return true;
2585 }
Dianne Hackbornfb81d092015-08-03 17:14:46 -07002586
2587 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: {
2588 data.enforceInterface(IActivityManager.descriptor);
2589 IBinder token = data.readStrongBinder();
2590 boolean res = isRootVoiceInteraction(token);
2591 reply.writeNoException();
2592 reply.writeInt(res ? 1 : 0);
2593 return true;
2594 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002595 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002596
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002597 return super.onTransact(code, data, reply, flags);
2598 }
2599
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002600 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002601 return this;
2602 }
2603
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002604 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2605 protected IActivityManager create() {
2606 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002607 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002608 Log.v("ActivityManager", "default service binder = " + b);
2609 }
2610 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002611 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002612 Log.v("ActivityManager", "default service = " + am);
2613 }
2614 return am;
2615 }
2616 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002617}
2618
2619class ActivityManagerProxy implements IActivityManager
2620{
2621 public ActivityManagerProxy(IBinder remote)
2622 {
2623 mRemote = remote;
2624 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002625
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002626 public IBinder asBinder()
2627 {
2628 return mRemote;
2629 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002630
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002631 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002632 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002633 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002634 Parcel data = Parcel.obtain();
2635 Parcel reply = Parcel.obtain();
2636 data.writeInterfaceToken(IActivityManager.descriptor);
2637 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002638 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002639 intent.writeToParcel(data, 0);
2640 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002641 data.writeStrongBinder(resultTo);
2642 data.writeString(resultWho);
2643 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002644 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002645 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002646 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002647 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002648 } else {
2649 data.writeInt(0);
2650 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002651 if (options != null) {
2652 data.writeInt(1);
2653 options.writeToParcel(data, 0);
2654 } else {
2655 data.writeInt(0);
2656 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002657 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2658 reply.readException();
2659 int result = reply.readInt();
2660 reply.recycle();
2661 data.recycle();
2662 return result;
2663 }
Amith Yamasani82644082012-08-03 13:09:11 -07002664
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002665 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002666 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Jeff Hao1b012d32014-08-20 10:35:34 -07002667 int startFlags, ProfilerInfo profilerInfo, Bundle options,
2668 int userId) throws RemoteException {
Amith Yamasani82644082012-08-03 13:09:11 -07002669 Parcel data = Parcel.obtain();
2670 Parcel reply = Parcel.obtain();
2671 data.writeInterfaceToken(IActivityManager.descriptor);
2672 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002673 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002674 intent.writeToParcel(data, 0);
2675 data.writeString(resolvedType);
2676 data.writeStrongBinder(resultTo);
2677 data.writeString(resultWho);
2678 data.writeInt(requestCode);
2679 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002680 if (profilerInfo != null) {
Amith Yamasani82644082012-08-03 13:09:11 -07002681 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002682 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Amith Yamasani82644082012-08-03 13:09:11 -07002683 } else {
2684 data.writeInt(0);
2685 }
2686 if (options != null) {
2687 data.writeInt(1);
2688 options.writeToParcel(data, 0);
2689 } else {
2690 data.writeInt(0);
2691 }
2692 data.writeInt(userId);
2693 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2694 reply.readException();
2695 int result = reply.readInt();
2696 reply.recycle();
2697 data.recycle();
2698 return result;
2699 }
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002700 public int startActivityAsCaller(IApplicationThread caller, String callingPackage,
2701 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002702 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity,
2703 int userId) throws RemoteException {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002704 Parcel data = Parcel.obtain();
2705 Parcel reply = Parcel.obtain();
2706 data.writeInterfaceToken(IActivityManager.descriptor);
2707 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2708 data.writeString(callingPackage);
2709 intent.writeToParcel(data, 0);
2710 data.writeString(resolvedType);
2711 data.writeStrongBinder(resultTo);
2712 data.writeString(resultWho);
2713 data.writeInt(requestCode);
2714 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002715 if (profilerInfo != null) {
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002716 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002717 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002718 } else {
2719 data.writeInt(0);
2720 }
2721 if (options != null) {
2722 data.writeInt(1);
2723 options.writeToParcel(data, 0);
2724 } else {
2725 data.writeInt(0);
2726 }
Dianne Hackborna7cfbe02015-07-16 10:52:52 -07002727 data.writeInt(ignoreTargetSecurity ? 1 : 0);
Jeff Sharkey97978802014-10-14 10:48:18 -07002728 data.writeInt(userId);
Dianne Hackborn028ceeb2014-08-17 17:45:48 -07002729 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0);
2730 reply.readException();
2731 int result = reply.readInt();
2732 reply.recycle();
2733 data.recycle();
2734 return result;
2735 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002736 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2737 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Jeff Hao1b012d32014-08-20 10:35:34 -07002738 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options,
2739 int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002740 Parcel data = Parcel.obtain();
2741 Parcel reply = Parcel.obtain();
2742 data.writeInterfaceToken(IActivityManager.descriptor);
2743 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002744 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002745 intent.writeToParcel(data, 0);
2746 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002747 data.writeStrongBinder(resultTo);
2748 data.writeString(resultWho);
2749 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002750 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002751 if (profilerInfo != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002752 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002753 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002754 } else {
2755 data.writeInt(0);
2756 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002757 if (options != null) {
2758 data.writeInt(1);
2759 options.writeToParcel(data, 0);
2760 } else {
2761 data.writeInt(0);
2762 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002763 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002764 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2765 reply.readException();
2766 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2767 reply.recycle();
2768 data.recycle();
2769 return result;
2770 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002771 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2772 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002773 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002774 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002775 Parcel data = Parcel.obtain();
2776 Parcel reply = Parcel.obtain();
2777 data.writeInterfaceToken(IActivityManager.descriptor);
2778 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002779 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002780 intent.writeToParcel(data, 0);
2781 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002782 data.writeStrongBinder(resultTo);
2783 data.writeString(resultWho);
2784 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002785 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002786 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002787 if (options != null) {
2788 data.writeInt(1);
2789 options.writeToParcel(data, 0);
2790 } else {
2791 data.writeInt(0);
2792 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002793 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002794 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2795 reply.readException();
2796 int result = reply.readInt();
2797 reply.recycle();
2798 data.recycle();
2799 return result;
2800 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002801 public int startActivityIntentSender(IApplicationThread caller,
2802 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002803 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002804 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002805 Parcel data = Parcel.obtain();
2806 Parcel reply = Parcel.obtain();
2807 data.writeInterfaceToken(IActivityManager.descriptor);
2808 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2809 intent.writeToParcel(data, 0);
2810 if (fillInIntent != null) {
2811 data.writeInt(1);
2812 fillInIntent.writeToParcel(data, 0);
2813 } else {
2814 data.writeInt(0);
2815 }
2816 data.writeString(resolvedType);
2817 data.writeStrongBinder(resultTo);
2818 data.writeString(resultWho);
2819 data.writeInt(requestCode);
2820 data.writeInt(flagsMask);
2821 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002822 if (options != null) {
2823 data.writeInt(1);
2824 options.writeToParcel(data, 0);
2825 } else {
2826 data.writeInt(0);
2827 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002828 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002829 reply.readException();
2830 int result = reply.readInt();
2831 reply.recycle();
2832 data.recycle();
2833 return result;
2834 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002835 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2836 Intent intent, String resolvedType, IVoiceInteractionSession session,
Jeff Hao1b012d32014-08-20 10:35:34 -07002837 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo,
2838 Bundle options, int userId) throws RemoteException {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002839 Parcel data = Parcel.obtain();
2840 Parcel reply = Parcel.obtain();
2841 data.writeInterfaceToken(IActivityManager.descriptor);
2842 data.writeString(callingPackage);
2843 data.writeInt(callingPid);
2844 data.writeInt(callingUid);
2845 intent.writeToParcel(data, 0);
2846 data.writeString(resolvedType);
2847 data.writeStrongBinder(session.asBinder());
2848 data.writeStrongBinder(interactor.asBinder());
2849 data.writeInt(startFlags);
Jeff Hao1b012d32014-08-20 10:35:34 -07002850 if (profilerInfo != null) {
Dianne Hackborn91097de2014-04-04 18:02:06 -07002851 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07002852 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn91097de2014-04-04 18:02:06 -07002853 } else {
2854 data.writeInt(0);
2855 }
2856 if (options != null) {
2857 data.writeInt(1);
2858 options.writeToParcel(data, 0);
2859 } else {
2860 data.writeInt(0);
2861 }
2862 data.writeInt(userId);
2863 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2864 reply.readException();
2865 int result = reply.readInt();
2866 reply.recycle();
2867 data.recycle();
2868 return result;
2869 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002870 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002871 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002872 Parcel data = Parcel.obtain();
2873 Parcel reply = Parcel.obtain();
2874 data.writeInterfaceToken(IActivityManager.descriptor);
2875 data.writeStrongBinder(callingActivity);
2876 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002877 if (options != null) {
2878 data.writeInt(1);
2879 options.writeToParcel(data, 0);
2880 } else {
2881 data.writeInt(0);
2882 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002883 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2884 reply.readException();
2885 int result = reply.readInt();
2886 reply.recycle();
2887 data.recycle();
2888 return result != 0;
2889 }
Craig Mautnerdc00cbe2014-07-20 17:48:47 -07002890 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
2891 Parcel data = Parcel.obtain();
2892 Parcel reply = Parcel.obtain();
2893 data.writeInterfaceToken(IActivityManager.descriptor);
2894 data.writeInt(taskId);
2895 if (options == null) {
2896 data.writeInt(0);
2897 } else {
2898 data.writeInt(1);
2899 options.writeToParcel(data, 0);
2900 }
2901 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
2902 reply.readException();
2903 int result = reply.readInt();
2904 reply.recycle();
2905 data.recycle();
2906 return result;
2907 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002908 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002909 throws RemoteException {
2910 Parcel data = Parcel.obtain();
2911 Parcel reply = Parcel.obtain();
2912 data.writeInterfaceToken(IActivityManager.descriptor);
2913 data.writeStrongBinder(token);
2914 data.writeInt(resultCode);
2915 if (resultData != null) {
2916 data.writeInt(1);
2917 resultData.writeToParcel(data, 0);
2918 } else {
2919 data.writeInt(0);
2920 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002921 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002922 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2923 reply.readException();
2924 boolean res = reply.readInt() != 0;
2925 data.recycle();
2926 reply.recycle();
2927 return res;
2928 }
2929 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2930 {
2931 Parcel data = Parcel.obtain();
2932 Parcel reply = Parcel.obtain();
2933 data.writeInterfaceToken(IActivityManager.descriptor);
2934 data.writeStrongBinder(token);
2935 data.writeString(resultWho);
2936 data.writeInt(requestCode);
2937 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2938 reply.readException();
2939 data.recycle();
2940 reply.recycle();
2941 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002942 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2943 Parcel data = Parcel.obtain();
2944 Parcel reply = Parcel.obtain();
2945 data.writeInterfaceToken(IActivityManager.descriptor);
2946 data.writeStrongBinder(token);
2947 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2948 reply.readException();
2949 boolean res = reply.readInt() != 0;
2950 data.recycle();
2951 reply.recycle();
2952 return res;
2953 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002954 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2955 Parcel data = Parcel.obtain();
2956 Parcel reply = Parcel.obtain();
2957 data.writeInterfaceToken(IActivityManager.descriptor);
2958 data.writeStrongBinder(session.asBinder());
2959 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2960 reply.readException();
2961 data.recycle();
2962 reply.recycle();
2963 }
Dianne Hackborn89ad4562014-08-24 16:45:38 -07002964 public boolean releaseActivityInstance(IBinder token) throws RemoteException {
2965 Parcel data = Parcel.obtain();
2966 Parcel reply = Parcel.obtain();
2967 data.writeInterfaceToken(IActivityManager.descriptor);
2968 data.writeStrongBinder(token);
2969 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0);
2970 reply.readException();
2971 boolean res = reply.readInt() != 0;
2972 data.recycle();
2973 reply.recycle();
2974 return res;
2975 }
2976 public void releaseSomeActivities(IApplicationThread app) throws RemoteException {
2977 Parcel data = Parcel.obtain();
2978 Parcel reply = Parcel.obtain();
2979 data.writeInterfaceToken(IActivityManager.descriptor);
2980 data.writeStrongBinder(app.asBinder());
2981 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0);
2982 reply.readException();
2983 data.recycle();
2984 reply.recycle();
2985 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002986 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2987 Parcel data = Parcel.obtain();
2988 Parcel reply = Parcel.obtain();
2989 data.writeInterfaceToken(IActivityManager.descriptor);
2990 data.writeStrongBinder(token);
2991 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2992 reply.readException();
2993 boolean res = reply.readInt() != 0;
2994 data.recycle();
2995 reply.recycle();
2996 return res;
2997 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002998 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002999 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07003000 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003001 {
3002 Parcel data = Parcel.obtain();
3003 Parcel reply = Parcel.obtain();
3004 data.writeInterfaceToken(IActivityManager.descriptor);
3005 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003006 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003007 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
3008 filter.writeToParcel(data, 0);
3009 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07003010 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003011 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3012 reply.readException();
3013 Intent intent = null;
3014 int haveIntent = reply.readInt();
3015 if (haveIntent != 0) {
3016 intent = Intent.CREATOR.createFromParcel(reply);
3017 }
3018 reply.recycle();
3019 data.recycle();
3020 return intent;
3021 }
3022 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
3023 {
3024 Parcel data = Parcel.obtain();
3025 Parcel reply = Parcel.obtain();
3026 data.writeInterfaceToken(IActivityManager.descriptor);
3027 data.writeStrongBinder(receiver.asBinder());
3028 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
3029 reply.readException();
3030 data.recycle();
3031 reply.recycle();
3032 }
3033 public int broadcastIntent(IApplicationThread caller,
Dianne Hackborna750a632015-06-16 17:18:23 -07003034 Intent intent, String resolvedType, IIntentReceiver resultTo,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003035 int resultCode, String resultData, Bundle map,
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003036 String[] requiredPermissions, int appOp, Bundle options, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07003037 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003038 {
3039 Parcel data = Parcel.obtain();
3040 Parcel reply = Parcel.obtain();
3041 data.writeInterfaceToken(IActivityManager.descriptor);
3042 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3043 intent.writeToParcel(data, 0);
3044 data.writeString(resolvedType);
3045 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
3046 data.writeInt(resultCode);
3047 data.writeString(resultData);
3048 data.writeBundle(map);
Fyodor Kupolovd4fd8c72015-07-13 19:19:25 -07003049 data.writeStringArray(requiredPermissions);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08003050 data.writeInt(appOp);
Dianne Hackborna750a632015-06-16 17:18:23 -07003051 data.writeBundle(options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003052 data.writeInt(serialized ? 1 : 0);
3053 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003054 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003055 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
3056 reply.readException();
3057 int res = reply.readInt();
3058 reply.recycle();
3059 data.recycle();
3060 return res;
3061 }
Amith Yamasani742a6712011-05-04 14:49:28 -07003062 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
3063 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003064 {
3065 Parcel data = Parcel.obtain();
3066 Parcel reply = Parcel.obtain();
3067 data.writeInterfaceToken(IActivityManager.descriptor);
3068 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3069 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07003070 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003071 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
3072 reply.readException();
3073 data.recycle();
3074 reply.recycle();
3075 }
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003076 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
3077 boolean abortBroadcast, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003078 {
3079 Parcel data = Parcel.obtain();
3080 Parcel reply = Parcel.obtain();
3081 data.writeInterfaceToken(IActivityManager.descriptor);
3082 data.writeStrongBinder(who);
3083 data.writeInt(resultCode);
3084 data.writeString(resultData);
3085 data.writeBundle(map);
3086 data.writeInt(abortBroadcast ? 1 : 0);
riddle_hsu1f5ac4d2015-01-03 15:38:21 +08003087 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003088 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3089 reply.readException();
3090 data.recycle();
3091 reply.recycle();
3092 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003093 public void attachApplication(IApplicationThread app) throws RemoteException
3094 {
3095 Parcel data = Parcel.obtain();
3096 Parcel reply = Parcel.obtain();
3097 data.writeInterfaceToken(IActivityManager.descriptor);
3098 data.writeStrongBinder(app.asBinder());
3099 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
3100 reply.readException();
3101 data.recycle();
3102 reply.recycle();
3103 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003104 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
3105 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003106 {
3107 Parcel data = Parcel.obtain();
3108 Parcel reply = Parcel.obtain();
3109 data.writeInterfaceToken(IActivityManager.descriptor);
3110 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07003111 if (config != null) {
3112 data.writeInt(1);
3113 config.writeToParcel(data, 0);
3114 } else {
3115 data.writeInt(0);
3116 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07003117 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003118 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3119 reply.readException();
3120 data.recycle();
3121 reply.recycle();
3122 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07003123 public void activityResumed(IBinder token) throws RemoteException
3124 {
3125 Parcel data = Parcel.obtain();
3126 Parcel reply = Parcel.obtain();
3127 data.writeInterfaceToken(IActivityManager.descriptor);
3128 data.writeStrongBinder(token);
3129 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
3130 reply.readException();
3131 data.recycle();
3132 reply.recycle();
3133 }
Dianne Hackborna4e102e2014-09-04 22:52:27 -07003134 public void activityPaused(IBinder token) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08003135 {
3136 Parcel data = Parcel.obtain();
3137 Parcel reply = Parcel.obtain();
3138 data.writeInterfaceToken(IActivityManager.descriptor);
3139 data.writeStrongBinder(token);
3140 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
3141 reply.readException();
3142 data.recycle();
3143 reply.recycle();
3144 }
3145 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07003146 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003147 {
3148 Parcel data = Parcel.obtain();
3149 Parcel reply = Parcel.obtain();
3150 data.writeInterfaceToken(IActivityManager.descriptor);
3151 data.writeStrongBinder(token);
3152 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07003153 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003154 TextUtils.writeToParcel(description, data, 0);
3155 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3156 reply.readException();
3157 data.recycle();
3158 reply.recycle();
3159 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08003160 public void activitySlept(IBinder token) throws RemoteException
3161 {
3162 Parcel data = Parcel.obtain();
3163 Parcel reply = Parcel.obtain();
3164 data.writeInterfaceToken(IActivityManager.descriptor);
3165 data.writeStrongBinder(token);
3166 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3167 reply.readException();
3168 data.recycle();
3169 reply.recycle();
3170 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003171 public void activityDestroyed(IBinder token) throws RemoteException
3172 {
3173 Parcel data = Parcel.obtain();
3174 Parcel reply = Parcel.obtain();
3175 data.writeInterfaceToken(IActivityManager.descriptor);
3176 data.writeStrongBinder(token);
3177 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3178 reply.readException();
3179 data.recycle();
3180 reply.recycle();
3181 }
3182 public String getCallingPackage(IBinder token) throws RemoteException
3183 {
3184 Parcel data = Parcel.obtain();
3185 Parcel reply = Parcel.obtain();
3186 data.writeInterfaceToken(IActivityManager.descriptor);
3187 data.writeStrongBinder(token);
3188 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
3189 reply.readException();
3190 String res = reply.readString();
3191 data.recycle();
3192 reply.recycle();
3193 return res;
3194 }
3195 public ComponentName getCallingActivity(IBinder token)
3196 throws RemoteException {
3197 Parcel data = Parcel.obtain();
3198 Parcel reply = Parcel.obtain();
3199 data.writeInterfaceToken(IActivityManager.descriptor);
3200 data.writeStrongBinder(token);
3201 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
3202 reply.readException();
3203 ComponentName res = ComponentName.readFromParcel(reply);
3204 data.recycle();
3205 reply.recycle();
3206 return res;
3207 }
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003208 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
Winson Chung1147c402014-05-14 11:05:00 -07003209 Parcel data = Parcel.obtain();
3210 Parcel reply = Parcel.obtain();
3211 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn885fbe52014-08-23 15:23:58 -07003212 data.writeString(callingPackage);
Winson Chung1147c402014-05-14 11:05:00 -07003213 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
3214 reply.readException();
3215 ArrayList<IAppTask> list = null;
3216 int N = reply.readInt();
3217 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003218 list = new ArrayList<>();
Winson Chung1147c402014-05-14 11:05:00 -07003219 while (N > 0) {
3220 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
3221 list.add(task);
3222 N--;
3223 }
3224 }
3225 data.recycle();
3226 reply.recycle();
3227 return list;
3228 }
Dianne Hackbornaec68bb2014-08-20 15:25:13 -07003229 public int addAppTask(IBinder activityToken, Intent intent,
3230 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException {
3231 Parcel data = Parcel.obtain();
3232 Parcel reply = Parcel.obtain();
3233 data.writeInterfaceToken(IActivityManager.descriptor);
3234 data.writeStrongBinder(activityToken);
3235 intent.writeToParcel(data, 0);
3236 description.writeToParcel(data, 0);
3237 thumbnail.writeToParcel(data, 0);
3238 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0);
3239 reply.readException();
3240 int res = reply.readInt();
3241 data.recycle();
3242 reply.recycle();
3243 return res;
3244 }
3245 public Point getAppTaskThumbnailSize() throws RemoteException {
3246 Parcel data = Parcel.obtain();
3247 Parcel reply = Parcel.obtain();
3248 data.writeInterfaceToken(IActivityManager.descriptor);
3249 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0);
3250 reply.readException();
3251 Point size = Point.CREATOR.createFromParcel(reply);
3252 data.recycle();
3253 reply.recycle();
3254 return size;
3255 }
Todd Kennedye635f662015-01-20 10:36:49 -08003256 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags)
3257 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003258 Parcel data = Parcel.obtain();
3259 Parcel reply = Parcel.obtain();
3260 data.writeInterfaceToken(IActivityManager.descriptor);
3261 data.writeInt(maxNum);
3262 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003263 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
3264 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003265 ArrayList<ActivityManager.RunningTaskInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003266 int N = reply.readInt();
3267 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003268 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003269 while (N > 0) {
3270 ActivityManager.RunningTaskInfo info =
3271 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07003272 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003273 list.add(info);
3274 N--;
3275 }
3276 }
3277 data.recycle();
3278 reply.recycle();
3279 return list;
3280 }
3281 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07003282 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003283 Parcel data = Parcel.obtain();
3284 Parcel reply = Parcel.obtain();
3285 data.writeInterfaceToken(IActivityManager.descriptor);
3286 data.writeInt(maxNum);
3287 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07003288 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003289 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
3290 reply.readException();
3291 ArrayList<ActivityManager.RecentTaskInfo> list
3292 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
3293 data.recycle();
3294 reply.recycle();
3295 return list;
3296 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003297 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08003298 Parcel data = Parcel.obtain();
3299 Parcel reply = Parcel.obtain();
3300 data.writeInterfaceToken(IActivityManager.descriptor);
3301 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003302 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003303 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003304 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08003305 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003306 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08003307 }
3308 data.recycle();
3309 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07003310 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07003311 }
Todd Kennedye635f662015-01-20 10:36:49 -08003312 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags)
3313 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003314 Parcel data = Parcel.obtain();
3315 Parcel reply = Parcel.obtain();
3316 data.writeInterfaceToken(IActivityManager.descriptor);
3317 data.writeInt(maxNum);
3318 data.writeInt(flags);
3319 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
3320 reply.readException();
Todd Kennedye635f662015-01-20 10:36:49 -08003321 ArrayList<ActivityManager.RunningServiceInfo> list = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003322 int N = reply.readInt();
3323 if (N >= 0) {
Todd Kennedye635f662015-01-20 10:36:49 -08003324 list = new ArrayList<>();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003325 while (N > 0) {
3326 ActivityManager.RunningServiceInfo info =
3327 ActivityManager.RunningServiceInfo.CREATOR
3328 .createFromParcel(reply);
3329 list.add(info);
3330 N--;
3331 }
3332 }
3333 data.recycle();
3334 reply.recycle();
3335 return list;
3336 }
3337 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
3338 throws RemoteException {
3339 Parcel data = Parcel.obtain();
3340 Parcel reply = Parcel.obtain();
3341 data.writeInterfaceToken(IActivityManager.descriptor);
3342 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
3343 reply.readException();
3344 ArrayList<ActivityManager.ProcessErrorStateInfo> list
3345 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
3346 data.recycle();
3347 reply.recycle();
3348 return list;
3349 }
3350 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
3351 throws RemoteException {
3352 Parcel data = Parcel.obtain();
3353 Parcel reply = Parcel.obtain();
3354 data.writeInterfaceToken(IActivityManager.descriptor);
3355 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
3356 reply.readException();
3357 ArrayList<ActivityManager.RunningAppProcessInfo> list
3358 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
3359 data.recycle();
3360 reply.recycle();
3361 return list;
3362 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07003363 public List<ApplicationInfo> getRunningExternalApplications()
3364 throws RemoteException {
3365 Parcel data = Parcel.obtain();
3366 Parcel reply = Parcel.obtain();
3367 data.writeInterfaceToken(IActivityManager.descriptor);
3368 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
3369 reply.readException();
3370 ArrayList<ApplicationInfo> list
3371 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
3372 data.recycle();
3373 reply.recycle();
3374 return list;
3375 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003376 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003377 {
3378 Parcel data = Parcel.obtain();
3379 Parcel reply = Parcel.obtain();
3380 data.writeInterfaceToken(IActivityManager.descriptor);
3381 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003382 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07003383 if (options != null) {
3384 data.writeInt(1);
3385 options.writeToParcel(data, 0);
3386 } else {
3387 data.writeInt(0);
3388 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003389 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
3390 reply.readException();
3391 data.recycle();
3392 reply.recycle();
3393 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003394 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
3395 throws RemoteException {
3396 Parcel data = Parcel.obtain();
3397 Parcel reply = Parcel.obtain();
3398 data.writeInterfaceToken(IActivityManager.descriptor);
3399 data.writeStrongBinder(token);
3400 data.writeInt(nonRoot ? 1 : 0);
3401 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
3402 reply.readException();
3403 boolean res = reply.readInt() != 0;
3404 data.recycle();
3405 reply.recycle();
3406 return res;
3407 }
3408 public void moveTaskBackwards(int task) throws RemoteException
3409 {
3410 Parcel data = Parcel.obtain();
3411 Parcel reply = Parcel.obtain();
3412 data.writeInterfaceToken(IActivityManager.descriptor);
3413 data.writeInt(task);
3414 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
3415 reply.readException();
3416 data.recycle();
3417 reply.recycle();
3418 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08003419 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08003420 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
3421 {
3422 Parcel data = Parcel.obtain();
3423 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003424 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003425 data.writeInt(taskId);
3426 data.writeInt(stackId);
3427 data.writeInt(toTop ? 1 : 0);
3428 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
3429 reply.readException();
3430 data.recycle();
3431 reply.recycle();
3432 }
3433 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003434 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08003435 {
3436 Parcel data = Parcel.obtain();
3437 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07003438 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07003439 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003440 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003441 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
Craig Mautnerc00204b2013-03-05 15:02:14 -08003442 reply.readException();
3443 data.recycle();
3444 reply.recycle();
3445 }
Craig Mautner967212c2013-04-13 21:10:58 -07003446 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003447 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07003448 {
3449 Parcel data = Parcel.obtain();
3450 Parcel reply = Parcel.obtain();
3451 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003452 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07003453 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003454 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07003455 data.recycle();
3456 reply.recycle();
3457 return list;
3458 }
Craig Mautnercf910b02013-04-23 11:23:27 -07003459 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003460 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003461 {
3462 Parcel data = Parcel.obtain();
3463 Parcel reply = Parcel.obtain();
3464 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003465 data.writeInt(stackId);
3466 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003467 reply.readException();
3468 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003469 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003470 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08003471 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07003472 }
3473 data.recycle();
3474 reply.recycle();
3475 return info;
3476 }
3477 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08003478 public boolean isInHomeStack(int taskId) throws RemoteException {
3479 Parcel data = Parcel.obtain();
3480 Parcel reply = Parcel.obtain();
3481 data.writeInterfaceToken(IActivityManager.descriptor);
3482 data.writeInt(taskId);
3483 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3484 reply.readException();
3485 boolean isInHomeStack = reply.readInt() > 0;
3486 data.recycle();
3487 reply.recycle();
3488 return isInHomeStack;
3489 }
3490 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003491 public void setFocusedStack(int stackId) throws RemoteException
3492 {
3493 Parcel data = Parcel.obtain();
3494 Parcel reply = Parcel.obtain();
3495 data.writeInterfaceToken(IActivityManager.descriptor);
3496 data.writeInt(stackId);
Dianne Hackborn1e383822015-04-10 14:02:33 -07003497 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07003498 reply.readException();
3499 data.recycle();
3500 reply.recycle();
3501 }
Winson Chung740c3ac2014-11-12 16:14:38 -08003502 @Override
Winson Chungd16c5652015-01-26 16:11:07 -08003503 public int getFocusedStackId() throws RemoteException {
3504 Parcel data = Parcel.obtain();
3505 Parcel reply = Parcel.obtain();
3506 data.writeInterfaceToken(IActivityManager.descriptor);
3507 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0);
3508 reply.readException();
3509 int focusedStackId = reply.readInt();
3510 data.recycle();
3511 reply.recycle();
3512 return focusedStackId;
3513 }
3514 @Override
Winson Chung740c3ac2014-11-12 16:14:38 -08003515 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException
3516 {
3517 Parcel data = Parcel.obtain();
3518 Parcel reply = Parcel.obtain();
3519 data.writeInterfaceToken(IActivityManager.descriptor);
3520 data.writeStrongBinder(listener.asBinder());
Dianne Hackborn1e383822015-04-10 14:02:33 -07003521 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0);
Winson Chung740c3ac2014-11-12 16:14:38 -08003522 reply.readException();
3523 data.recycle();
3524 reply.recycle();
3525 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003526 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3527 {
3528 Parcel data = Parcel.obtain();
3529 Parcel reply = Parcel.obtain();
3530 data.writeInterfaceToken(IActivityManager.descriptor);
3531 data.writeStrongBinder(token);
3532 data.writeInt(onlyRoot ? 1 : 0);
3533 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3534 reply.readException();
3535 int res = reply.readInt();
3536 data.recycle();
3537 reply.recycle();
3538 return res;
3539 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003540 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003541 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003542 Parcel data = Parcel.obtain();
3543 Parcel reply = Parcel.obtain();
3544 data.writeInterfaceToken(IActivityManager.descriptor);
3545 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3546 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003547 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003548 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003549 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3550 reply.readException();
3551 int res = reply.readInt();
3552 ContentProviderHolder cph = null;
3553 if (res != 0) {
3554 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3555 }
3556 data.recycle();
3557 reply.recycle();
3558 return cph;
3559 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003560 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3561 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003562 Parcel data = Parcel.obtain();
3563 Parcel reply = Parcel.obtain();
3564 data.writeInterfaceToken(IActivityManager.descriptor);
3565 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003566 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003567 data.writeStrongBinder(token);
3568 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3569 reply.readException();
3570 int res = reply.readInt();
3571 ContentProviderHolder cph = null;
3572 if (res != 0) {
3573 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3574 }
3575 data.recycle();
3576 reply.recycle();
3577 return cph;
3578 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003579 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003580 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003581 {
3582 Parcel data = Parcel.obtain();
3583 Parcel reply = Parcel.obtain();
3584 data.writeInterfaceToken(IActivityManager.descriptor);
3585 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3586 data.writeTypedList(providers);
3587 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3588 reply.readException();
3589 data.recycle();
3590 reply.recycle();
3591 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003592 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3593 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003594 Parcel data = Parcel.obtain();
3595 Parcel reply = Parcel.obtain();
3596 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003597 data.writeStrongBinder(connection);
3598 data.writeInt(stable);
3599 data.writeInt(unstable);
3600 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3601 reply.readException();
3602 boolean res = reply.readInt() != 0;
3603 data.recycle();
3604 reply.recycle();
3605 return res;
3606 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003607
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003608 public void unstableProviderDied(IBinder connection) throws RemoteException {
3609 Parcel data = Parcel.obtain();
3610 Parcel reply = Parcel.obtain();
3611 data.writeInterfaceToken(IActivityManager.descriptor);
3612 data.writeStrongBinder(connection);
3613 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3614 reply.readException();
3615 data.recycle();
3616 reply.recycle();
3617 }
3618
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003619 @Override
3620 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3621 Parcel data = Parcel.obtain();
3622 Parcel reply = Parcel.obtain();
3623 data.writeInterfaceToken(IActivityManager.descriptor);
3624 data.writeStrongBinder(connection);
3625 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3626 reply.readException();
3627 data.recycle();
3628 reply.recycle();
3629 }
3630
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003631 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3632 Parcel data = Parcel.obtain();
3633 Parcel reply = Parcel.obtain();
3634 data.writeInterfaceToken(IActivityManager.descriptor);
3635 data.writeStrongBinder(connection);
3636 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003637 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3638 reply.readException();
3639 data.recycle();
3640 reply.recycle();
3641 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003642
3643 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3644 Parcel data = Parcel.obtain();
3645 Parcel reply = Parcel.obtain();
3646 data.writeInterfaceToken(IActivityManager.descriptor);
3647 data.writeString(name);
3648 data.writeStrongBinder(token);
3649 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3650 reply.readException();
3651 data.recycle();
3652 reply.recycle();
3653 }
3654
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003655 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3656 throws RemoteException
3657 {
3658 Parcel data = Parcel.obtain();
3659 Parcel reply = Parcel.obtain();
3660 data.writeInterfaceToken(IActivityManager.descriptor);
3661 service.writeToParcel(data, 0);
3662 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3663 reply.readException();
3664 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3665 data.recycle();
3666 reply.recycle();
3667 return res;
3668 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003669
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003670 public ComponentName startService(IApplicationThread caller, Intent service,
Svet Ganov99b60432015-06-27 13:15:22 -07003671 String resolvedType, String callingPackage, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003672 {
3673 Parcel data = Parcel.obtain();
3674 Parcel reply = Parcel.obtain();
3675 data.writeInterfaceToken(IActivityManager.descriptor);
3676 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3677 service.writeToParcel(data, 0);
3678 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003679 data.writeString(callingPackage);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003680 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003681 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3682 reply.readException();
3683 ComponentName res = ComponentName.readFromParcel(reply);
3684 data.recycle();
3685 reply.recycle();
3686 return res;
3687 }
3688 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003689 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003690 {
3691 Parcel data = Parcel.obtain();
3692 Parcel reply = Parcel.obtain();
3693 data.writeInterfaceToken(IActivityManager.descriptor);
3694 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3695 service.writeToParcel(data, 0);
3696 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003697 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003698 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3699 reply.readException();
3700 int res = reply.readInt();
3701 reply.recycle();
3702 data.recycle();
3703 return res;
3704 }
3705 public boolean stopServiceToken(ComponentName className, IBinder token,
3706 int startId) throws RemoteException {
3707 Parcel data = Parcel.obtain();
3708 Parcel reply = Parcel.obtain();
3709 data.writeInterfaceToken(IActivityManager.descriptor);
3710 ComponentName.writeToParcel(className, data);
3711 data.writeStrongBinder(token);
3712 data.writeInt(startId);
3713 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3714 reply.readException();
3715 boolean res = reply.readInt() != 0;
3716 data.recycle();
3717 reply.recycle();
3718 return res;
3719 }
3720 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003721 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003722 Parcel data = Parcel.obtain();
3723 Parcel reply = Parcel.obtain();
3724 data.writeInterfaceToken(IActivityManager.descriptor);
3725 ComponentName.writeToParcel(className, data);
3726 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003727 data.writeInt(id);
3728 if (notification != null) {
3729 data.writeInt(1);
3730 notification.writeToParcel(data, 0);
3731 } else {
3732 data.writeInt(0);
3733 }
3734 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003735 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3736 reply.readException();
3737 data.recycle();
3738 reply.recycle();
3739 }
3740 public int bindService(IApplicationThread caller, IBinder token,
3741 Intent service, String resolvedType, IServiceConnection connection,
Svet Ganov99b60432015-06-27 13:15:22 -07003742 int flags, String callingPackage, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003743 Parcel data = Parcel.obtain();
3744 Parcel reply = Parcel.obtain();
3745 data.writeInterfaceToken(IActivityManager.descriptor);
3746 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3747 data.writeStrongBinder(token);
3748 service.writeToParcel(data, 0);
3749 data.writeString(resolvedType);
3750 data.writeStrongBinder(connection.asBinder());
3751 data.writeInt(flags);
Svet Ganov99b60432015-06-27 13:15:22 -07003752 data.writeString(callingPackage);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003753 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003754 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3755 reply.readException();
3756 int res = reply.readInt();
3757 data.recycle();
3758 reply.recycle();
3759 return res;
3760 }
3761 public boolean unbindService(IServiceConnection connection) throws RemoteException
3762 {
3763 Parcel data = Parcel.obtain();
3764 Parcel reply = Parcel.obtain();
3765 data.writeInterfaceToken(IActivityManager.descriptor);
3766 data.writeStrongBinder(connection.asBinder());
3767 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3768 reply.readException();
3769 boolean res = reply.readInt() != 0;
3770 data.recycle();
3771 reply.recycle();
3772 return res;
3773 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003774
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003775 public void publishService(IBinder token,
3776 Intent intent, IBinder service) throws RemoteException {
3777 Parcel data = Parcel.obtain();
3778 Parcel reply = Parcel.obtain();
3779 data.writeInterfaceToken(IActivityManager.descriptor);
3780 data.writeStrongBinder(token);
3781 intent.writeToParcel(data, 0);
3782 data.writeStrongBinder(service);
3783 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3784 reply.readException();
3785 data.recycle();
3786 reply.recycle();
3787 }
3788
3789 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3790 throws RemoteException {
3791 Parcel data = Parcel.obtain();
3792 Parcel reply = Parcel.obtain();
3793 data.writeInterfaceToken(IActivityManager.descriptor);
3794 data.writeStrongBinder(token);
3795 intent.writeToParcel(data, 0);
3796 data.writeInt(doRebind ? 1 : 0);
3797 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3798 reply.readException();
3799 data.recycle();
3800 reply.recycle();
3801 }
3802
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003803 public void serviceDoneExecuting(IBinder token, int type, int startId,
3804 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003805 Parcel data = Parcel.obtain();
3806 Parcel reply = Parcel.obtain();
3807 data.writeInterfaceToken(IActivityManager.descriptor);
3808 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003809 data.writeInt(type);
3810 data.writeInt(startId);
3811 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003812 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3813 reply.readException();
3814 data.recycle();
3815 reply.recycle();
3816 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07003817
Svet Ganov99b60432015-06-27 13:15:22 -07003818 public IBinder peekService(Intent service, String resolvedType, String callingPackage)
3819 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003820 Parcel data = Parcel.obtain();
3821 Parcel reply = Parcel.obtain();
3822 data.writeInterfaceToken(IActivityManager.descriptor);
3823 service.writeToParcel(data, 0);
3824 data.writeString(resolvedType);
Svet Ganov99b60432015-06-27 13:15:22 -07003825 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003826 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3827 reply.readException();
3828 IBinder binder = reply.readStrongBinder();
3829 reply.recycle();
3830 data.recycle();
3831 return binder;
3832 }
3833
Christopher Tate181fafa2009-05-14 11:12:14 -07003834 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3835 throws RemoteException {
3836 Parcel data = Parcel.obtain();
3837 Parcel reply = Parcel.obtain();
3838 data.writeInterfaceToken(IActivityManager.descriptor);
3839 app.writeToParcel(data, 0);
3840 data.writeInt(backupRestoreMode);
3841 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3842 reply.readException();
3843 boolean success = reply.readInt() != 0;
3844 reply.recycle();
3845 data.recycle();
3846 return success;
3847 }
3848
Christopher Tate346acb12012-10-15 19:20:25 -07003849 public void clearPendingBackup() throws RemoteException {
3850 Parcel data = Parcel.obtain();
3851 Parcel reply = Parcel.obtain();
3852 data.writeInterfaceToken(IActivityManager.descriptor);
3853 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3854 reply.recycle();
3855 data.recycle();
3856 }
3857
Christopher Tate181fafa2009-05-14 11:12:14 -07003858 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3859 Parcel data = Parcel.obtain();
3860 Parcel reply = Parcel.obtain();
3861 data.writeInterfaceToken(IActivityManager.descriptor);
3862 data.writeString(packageName);
3863 data.writeStrongBinder(agent);
3864 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3865 reply.recycle();
3866 data.recycle();
3867 }
3868
3869 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3870 Parcel data = Parcel.obtain();
3871 Parcel reply = Parcel.obtain();
3872 data.writeInterfaceToken(IActivityManager.descriptor);
3873 app.writeToParcel(data, 0);
3874 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3875 reply.readException();
3876 reply.recycle();
3877 data.recycle();
3878 }
3879
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003880 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003881 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003882 IUiAutomationConnection connection, int userId, String instructionSet)
3883 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003884 Parcel data = Parcel.obtain();
3885 Parcel reply = Parcel.obtain();
3886 data.writeInterfaceToken(IActivityManager.descriptor);
3887 ComponentName.writeToParcel(className, data);
3888 data.writeString(profileFile);
3889 data.writeInt(flags);
3890 data.writeBundle(arguments);
3891 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003892 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003893 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003894 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003895 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3896 reply.readException();
3897 boolean res = reply.readInt() != 0;
3898 reply.recycle();
3899 data.recycle();
3900 return res;
3901 }
3902
3903 public void finishInstrumentation(IApplicationThread target,
3904 int resultCode, Bundle results) throws RemoteException {
3905 Parcel data = Parcel.obtain();
3906 Parcel reply = Parcel.obtain();
3907 data.writeInterfaceToken(IActivityManager.descriptor);
3908 data.writeStrongBinder(target != null ? target.asBinder() : null);
3909 data.writeInt(resultCode);
3910 data.writeBundle(results);
3911 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3912 reply.readException();
3913 data.recycle();
3914 reply.recycle();
3915 }
3916 public Configuration getConfiguration() throws RemoteException
3917 {
3918 Parcel data = Parcel.obtain();
3919 Parcel reply = Parcel.obtain();
3920 data.writeInterfaceToken(IActivityManager.descriptor);
3921 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3922 reply.readException();
3923 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3924 reply.recycle();
3925 data.recycle();
3926 return res;
3927 }
3928 public void updateConfiguration(Configuration values) throws RemoteException
3929 {
3930 Parcel data = Parcel.obtain();
3931 Parcel reply = Parcel.obtain();
3932 data.writeInterfaceToken(IActivityManager.descriptor);
3933 values.writeToParcel(data, 0);
3934 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3935 reply.readException();
3936 data.recycle();
3937 reply.recycle();
3938 }
3939 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3940 throws RemoteException {
3941 Parcel data = Parcel.obtain();
3942 Parcel reply = Parcel.obtain();
3943 data.writeInterfaceToken(IActivityManager.descriptor);
3944 data.writeStrongBinder(token);
3945 data.writeInt(requestedOrientation);
3946 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3947 reply.readException();
3948 data.recycle();
3949 reply.recycle();
3950 }
3951 public int getRequestedOrientation(IBinder token) throws RemoteException {
3952 Parcel data = Parcel.obtain();
3953 Parcel reply = Parcel.obtain();
3954 data.writeInterfaceToken(IActivityManager.descriptor);
3955 data.writeStrongBinder(token);
3956 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3957 reply.readException();
3958 int res = reply.readInt();
3959 data.recycle();
3960 reply.recycle();
3961 return res;
3962 }
3963 public ComponentName getActivityClassForToken(IBinder token)
3964 throws RemoteException {
3965 Parcel data = Parcel.obtain();
3966 Parcel reply = Parcel.obtain();
3967 data.writeInterfaceToken(IActivityManager.descriptor);
3968 data.writeStrongBinder(token);
3969 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3970 reply.readException();
3971 ComponentName res = ComponentName.readFromParcel(reply);
3972 data.recycle();
3973 reply.recycle();
3974 return res;
3975 }
3976 public String getPackageForToken(IBinder token) throws RemoteException
3977 {
3978 Parcel data = Parcel.obtain();
3979 Parcel reply = Parcel.obtain();
3980 data.writeInterfaceToken(IActivityManager.descriptor);
3981 data.writeStrongBinder(token);
3982 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3983 reply.readException();
3984 String res = reply.readString();
3985 data.recycle();
3986 reply.recycle();
3987 return res;
3988 }
3989 public IIntentSender getIntentSender(int type,
3990 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003991 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003992 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003993 Parcel data = Parcel.obtain();
3994 Parcel reply = Parcel.obtain();
3995 data.writeInterfaceToken(IActivityManager.descriptor);
3996 data.writeInt(type);
3997 data.writeString(packageName);
3998 data.writeStrongBinder(token);
3999 data.writeString(resultWho);
4000 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004001 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004002 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004003 data.writeTypedArray(intents, 0);
4004 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004005 } else {
4006 data.writeInt(0);
4007 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004008 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07004009 if (options != null) {
4010 data.writeInt(1);
4011 options.writeToParcel(data, 0);
4012 } else {
4013 data.writeInt(0);
4014 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004015 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004016 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
4017 reply.readException();
4018 IIntentSender res = IIntentSender.Stub.asInterface(
Dianne Hackbornff170242014-11-19 10:59:01 -08004019 reply.readStrongBinder());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004020 data.recycle();
4021 reply.recycle();
4022 return res;
4023 }
4024 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
4025 Parcel data = Parcel.obtain();
4026 Parcel reply = Parcel.obtain();
4027 data.writeInterfaceToken(IActivityManager.descriptor);
4028 data.writeStrongBinder(sender.asBinder());
4029 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
4030 reply.readException();
4031 data.recycle();
4032 reply.recycle();
4033 }
4034 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
4035 Parcel data = Parcel.obtain();
4036 Parcel reply = Parcel.obtain();
4037 data.writeInterfaceToken(IActivityManager.descriptor);
4038 data.writeStrongBinder(sender.asBinder());
4039 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4040 reply.readException();
4041 String res = reply.readString();
4042 data.recycle();
4043 reply.recycle();
4044 return res;
4045 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07004046 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
4047 Parcel data = Parcel.obtain();
4048 Parcel reply = Parcel.obtain();
4049 data.writeInterfaceToken(IActivityManager.descriptor);
4050 data.writeStrongBinder(sender.asBinder());
4051 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4052 reply.readException();
4053 int res = reply.readInt();
4054 data.recycle();
4055 reply.recycle();
4056 return res;
4057 }
Dianne Hackborn41203752012-08-31 14:05:51 -07004058 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
4059 boolean requireFull, String name, String callerPackage) throws RemoteException {
4060 Parcel data = Parcel.obtain();
4061 Parcel reply = Parcel.obtain();
4062 data.writeInterfaceToken(IActivityManager.descriptor);
4063 data.writeInt(callingPid);
4064 data.writeInt(callingUid);
4065 data.writeInt(userId);
4066 data.writeInt(allowAll ? 1 : 0);
4067 data.writeInt(requireFull ? 1 : 0);
4068 data.writeString(name);
4069 data.writeString(callerPackage);
4070 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
4071 reply.readException();
4072 int res = reply.readInt();
4073 data.recycle();
4074 reply.recycle();
4075 return res;
4076 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004077 public void setProcessLimit(int max) throws RemoteException
4078 {
4079 Parcel data = Parcel.obtain();
4080 Parcel reply = Parcel.obtain();
4081 data.writeInterfaceToken(IActivityManager.descriptor);
4082 data.writeInt(max);
4083 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4084 reply.readException();
4085 data.recycle();
4086 reply.recycle();
4087 }
4088 public int getProcessLimit() throws RemoteException
4089 {
4090 Parcel data = Parcel.obtain();
4091 Parcel reply = Parcel.obtain();
4092 data.writeInterfaceToken(IActivityManager.descriptor);
4093 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
4094 reply.readException();
4095 int res = reply.readInt();
4096 data.recycle();
4097 reply.recycle();
4098 return res;
4099 }
4100 public void setProcessForeground(IBinder token, int pid,
4101 boolean isForeground) throws RemoteException {
4102 Parcel data = Parcel.obtain();
4103 Parcel reply = Parcel.obtain();
4104 data.writeInterfaceToken(IActivityManager.descriptor);
4105 data.writeStrongBinder(token);
4106 data.writeInt(pid);
4107 data.writeInt(isForeground ? 1 : 0);
4108 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
4109 reply.readException();
4110 data.recycle();
4111 reply.recycle();
4112 }
4113 public int checkPermission(String permission, int pid, int uid)
4114 throws RemoteException {
4115 Parcel data = Parcel.obtain();
4116 Parcel reply = Parcel.obtain();
4117 data.writeInterfaceToken(IActivityManager.descriptor);
4118 data.writeString(permission);
4119 data.writeInt(pid);
4120 data.writeInt(uid);
4121 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
4122 reply.readException();
4123 int res = reply.readInt();
4124 data.recycle();
4125 reply.recycle();
4126 return res;
4127 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004128 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)
4129 throws RemoteException {
4130 Parcel data = Parcel.obtain();
4131 Parcel reply = Parcel.obtain();
4132 data.writeInterfaceToken(IActivityManager.descriptor);
4133 data.writeString(permission);
4134 data.writeInt(pid);
4135 data.writeInt(uid);
4136 data.writeStrongBinder(callerToken);
4137 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0);
4138 reply.readException();
4139 int res = reply.readInt();
4140 data.recycle();
4141 reply.recycle();
4142 return res;
4143 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004144 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07004145 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004146 Parcel data = Parcel.obtain();
4147 Parcel reply = Parcel.obtain();
4148 data.writeInterfaceToken(IActivityManager.descriptor);
4149 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07004150 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07004151 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004152 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
4153 reply.readException();
4154 boolean res = reply.readInt() != 0;
4155 data.recycle();
4156 reply.recycle();
4157 return res;
4158 }
Dianne Hackbornff170242014-11-19 10:59:01 -08004159 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId,
4160 IBinder callerToken) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004161 Parcel data = Parcel.obtain();
4162 Parcel reply = Parcel.obtain();
4163 data.writeInterfaceToken(IActivityManager.descriptor);
4164 uri.writeToParcel(data, 0);
4165 data.writeInt(pid);
4166 data.writeInt(uid);
4167 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004168 data.writeInt(userId);
Dianne Hackbornff170242014-11-19 10:59:01 -08004169 data.writeStrongBinder(callerToken);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004170 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
4171 reply.readException();
4172 int res = reply.readInt();
4173 data.recycle();
4174 reply.recycle();
4175 return res;
4176 }
4177 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004178 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004179 Parcel data = Parcel.obtain();
4180 Parcel reply = Parcel.obtain();
4181 data.writeInterfaceToken(IActivityManager.descriptor);
4182 data.writeStrongBinder(caller.asBinder());
4183 data.writeString(targetPkg);
4184 uri.writeToParcel(data, 0);
4185 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004186 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004187 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4188 reply.readException();
4189 data.recycle();
4190 reply.recycle();
4191 }
4192 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004193 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004194 Parcel data = Parcel.obtain();
4195 Parcel reply = Parcel.obtain();
4196 data.writeInterfaceToken(IActivityManager.descriptor);
4197 data.writeStrongBinder(caller.asBinder());
4198 uri.writeToParcel(data, 0);
4199 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004200 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004201 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4202 reply.readException();
4203 data.recycle();
4204 reply.recycle();
4205 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004206
4207 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004208 public void takePersistableUriPermission(Uri uri, int mode, int userId)
4209 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004210 Parcel data = Parcel.obtain();
4211 Parcel reply = Parcel.obtain();
4212 data.writeInterfaceToken(IActivityManager.descriptor);
4213 uri.writeToParcel(data, 0);
4214 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004215 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004216 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4217 reply.readException();
4218 data.recycle();
4219 reply.recycle();
4220 }
4221
4222 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004223 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
4224 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004225 Parcel data = Parcel.obtain();
4226 Parcel reply = Parcel.obtain();
4227 data.writeInterfaceToken(IActivityManager.descriptor);
4228 uri.writeToParcel(data, 0);
4229 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004230 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004231 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4232 reply.readException();
4233 data.recycle();
4234 reply.recycle();
4235 }
4236
4237 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004238 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
4239 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004240 Parcel data = Parcel.obtain();
4241 Parcel reply = Parcel.obtain();
4242 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07004243 data.writeString(packageName);
4244 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07004245 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
4246 reply.readException();
4247 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
4248 reply);
4249 data.recycle();
4250 reply.recycle();
4251 return perms;
4252 }
4253
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004254 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
4255 throws RemoteException {
4256 Parcel data = Parcel.obtain();
4257 Parcel reply = Parcel.obtain();
4258 data.writeInterfaceToken(IActivityManager.descriptor);
4259 data.writeStrongBinder(who.asBinder());
4260 data.writeInt(waiting ? 1 : 0);
4261 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
4262 reply.readException();
4263 data.recycle();
4264 reply.recycle();
4265 }
4266 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
4267 Parcel data = Parcel.obtain();
4268 Parcel reply = Parcel.obtain();
4269 data.writeInterfaceToken(IActivityManager.descriptor);
4270 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
4271 reply.readException();
4272 outInfo.readFromParcel(reply);
4273 data.recycle();
4274 reply.recycle();
4275 }
4276 public void unhandledBack() throws RemoteException
4277 {
4278 Parcel data = Parcel.obtain();
4279 Parcel reply = Parcel.obtain();
4280 data.writeInterfaceToken(IActivityManager.descriptor);
4281 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
4282 reply.readException();
4283 data.recycle();
4284 reply.recycle();
4285 }
4286 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
4287 {
4288 Parcel data = Parcel.obtain();
4289 Parcel reply = Parcel.obtain();
4290 data.writeInterfaceToken(IActivityManager.descriptor);
4291 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
4292 reply.readException();
4293 ParcelFileDescriptor pfd = null;
4294 if (reply.readInt() != 0) {
4295 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
4296 }
4297 data.recycle();
4298 reply.recycle();
4299 return pfd;
4300 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07004301 public void setLockScreenShown(boolean shown) throws RemoteException
4302 {
4303 Parcel data = Parcel.obtain();
4304 Parcel reply = Parcel.obtain();
4305 data.writeInterfaceToken(IActivityManager.descriptor);
4306 data.writeInt(shown ? 1 : 0);
4307 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
4308 reply.readException();
4309 data.recycle();
4310 reply.recycle();
4311 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004312 public void setDebugApp(
4313 String packageName, boolean waitForDebugger, boolean persistent)
4314 throws RemoteException
4315 {
4316 Parcel data = Parcel.obtain();
4317 Parcel reply = Parcel.obtain();
4318 data.writeInterfaceToken(IActivityManager.descriptor);
4319 data.writeString(packageName);
4320 data.writeInt(waitForDebugger ? 1 : 0);
4321 data.writeInt(persistent ? 1 : 0);
4322 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
4323 reply.readException();
4324 data.recycle();
4325 reply.recycle();
4326 }
4327 public void setAlwaysFinish(boolean enabled) throws RemoteException
4328 {
4329 Parcel data = Parcel.obtain();
4330 Parcel reply = Parcel.obtain();
4331 data.writeInterfaceToken(IActivityManager.descriptor);
4332 data.writeInt(enabled ? 1 : 0);
4333 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
4334 reply.readException();
4335 data.recycle();
4336 reply.recycle();
4337 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004338 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004339 {
4340 Parcel data = Parcel.obtain();
4341 Parcel reply = Parcel.obtain();
4342 data.writeInterfaceToken(IActivityManager.descriptor);
4343 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07004344 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004345 reply.readException();
4346 data.recycle();
4347 reply.recycle();
4348 }
4349 public void enterSafeMode() throws RemoteException {
4350 Parcel data = Parcel.obtain();
4351 data.writeInterfaceToken(IActivityManager.descriptor);
4352 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
4353 data.recycle();
4354 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004355 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)
Dianne Hackborn099bc622014-01-22 13:39:16 -08004356 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004357 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004358 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08004359 data.writeStrongBinder(sender.asBinder());
4360 data.writeInt(sourceUid);
4361 data.writeString(sourcePkg);
Dianne Hackborn1e383822015-04-10 14:02:33 -07004362 data.writeString(tag);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004363 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
4364 data.recycle();
4365 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07004366 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag)
4367 throws RemoteException {
4368 Parcel data = Parcel.obtain();
4369 data.writeInterfaceToken(IActivityManager.descriptor);
4370 data.writeStrongBinder(sender.asBinder());
4371 data.writeInt(sourceUid);
4372 data.writeString(tag);
4373 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0);
4374 data.recycle();
4375 }
4376 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)
4377 throws RemoteException {
4378 Parcel data = Parcel.obtain();
4379 data.writeInterfaceToken(IActivityManager.descriptor);
4380 data.writeStrongBinder(sender.asBinder());
4381 data.writeInt(sourceUid);
4382 data.writeString(tag);
4383 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0);
4384 data.recycle();
4385 }
Dianne Hackborn64825172011-03-02 21:32:58 -08004386 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004387 Parcel data = Parcel.obtain();
4388 Parcel reply = Parcel.obtain();
4389 data.writeInterfaceToken(IActivityManager.descriptor);
4390 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004391 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08004392 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07004393 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004394 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004395 boolean res = reply.readInt() != 0;
4396 data.recycle();
4397 reply.recycle();
4398 return res;
4399 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07004400 @Override
4401 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
4402 Parcel data = Parcel.obtain();
4403 Parcel reply = Parcel.obtain();
4404 data.writeInterfaceToken(IActivityManager.descriptor);
4405 data.writeString(reason);
4406 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
4407 boolean res = reply.readInt() != 0;
4408 data.recycle();
4409 reply.recycle();
4410 return res;
4411 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004412 public boolean testIsSystemReady()
4413 {
4414 /* this base class version is never called */
4415 return true;
4416 }
Dan Egnor60d87622009-12-16 16:32:58 -08004417 public void handleApplicationCrash(IBinder app,
4418 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
4419 {
4420 Parcel data = Parcel.obtain();
4421 Parcel reply = Parcel.obtain();
4422 data.writeInterfaceToken(IActivityManager.descriptor);
4423 data.writeStrongBinder(app);
4424 crashInfo.writeToParcel(data, 0);
4425 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
4426 reply.readException();
4427 reply.recycle();
4428 data.recycle();
4429 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004430
Dianne Hackborn52322712014-08-26 22:47:26 -07004431 public boolean handleApplicationWtf(IBinder app, String tag, boolean system,
Dan Egnorb7f03672009-12-09 16:22:32 -08004432 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004433 {
4434 Parcel data = Parcel.obtain();
4435 Parcel reply = Parcel.obtain();
4436 data.writeInterfaceToken(IActivityManager.descriptor);
4437 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004438 data.writeString(tag);
Dianne Hackborn52322712014-08-26 22:47:26 -07004439 data.writeInt(system ? 1 : 0);
Dan Egnorb7f03672009-12-09 16:22:32 -08004440 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08004441 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004442 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08004443 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004444 reply.recycle();
4445 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08004446 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004447 }
Dan Egnorb7f03672009-12-09 16:22:32 -08004448
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004449 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004450 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004451 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004452 {
4453 Parcel data = Parcel.obtain();
4454 Parcel reply = Parcel.obtain();
4455 data.writeInterfaceToken(IActivityManager.descriptor);
4456 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07004457 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07004458 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07004459 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
4460 reply.readException();
4461 reply.recycle();
4462 data.recycle();
4463 }
4464
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004465 public void signalPersistentProcesses(int sig) throws RemoteException {
4466 Parcel data = Parcel.obtain();
4467 Parcel reply = Parcel.obtain();
4468 data.writeInterfaceToken(IActivityManager.descriptor);
4469 data.writeInt(sig);
4470 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
4471 reply.readException();
4472 data.recycle();
4473 reply.recycle();
4474 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004475
Dianne Hackborn1676c852012-09-10 14:52:30 -07004476 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004477 Parcel data = Parcel.obtain();
4478 Parcel reply = Parcel.obtain();
4479 data.writeInterfaceToken(IActivityManager.descriptor);
4480 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004481 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004482 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4483 reply.readException();
4484 data.recycle();
4485 reply.recycle();
4486 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08004487
4488 public void killAllBackgroundProcesses() throws RemoteException {
4489 Parcel data = Parcel.obtain();
4490 Parcel reply = Parcel.obtain();
4491 data.writeInterfaceToken(IActivityManager.descriptor);
4492 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
4493 reply.readException();
4494 data.recycle();
4495 reply.recycle();
4496 }
4497
Dianne Hackborn1676c852012-09-10 14:52:30 -07004498 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08004499 Parcel data = Parcel.obtain();
4500 Parcel reply = Parcel.obtain();
4501 data.writeInterfaceToken(IActivityManager.descriptor);
4502 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004503 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08004504 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004505 reply.readException();
4506 data.recycle();
4507 reply.recycle();
4508 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004509
Dianne Hackborn27ff9132012-03-06 14:57:58 -08004510 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
4511 throws RemoteException
4512 {
4513 Parcel data = Parcel.obtain();
4514 Parcel reply = Parcel.obtain();
4515 data.writeInterfaceToken(IActivityManager.descriptor);
4516 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
4517 reply.readException();
4518 outInfo.readFromParcel(reply);
4519 reply.recycle();
4520 data.recycle();
4521 }
4522
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004523 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
4524 {
4525 Parcel data = Parcel.obtain();
4526 Parcel reply = Parcel.obtain();
4527 data.writeInterfaceToken(IActivityManager.descriptor);
4528 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
4529 reply.readException();
4530 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
4531 reply.recycle();
4532 data.recycle();
4533 return res;
4534 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004535
Dianne Hackborn1676c852012-09-10 14:52:30 -07004536 public boolean profileControl(String process, int userId, boolean start,
Jeff Hao1b012d32014-08-20 10:35:34 -07004537 ProfilerInfo profilerInfo, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004538 {
4539 Parcel data = Parcel.obtain();
4540 Parcel reply = Parcel.obtain();
4541 data.writeInterfaceToken(IActivityManager.descriptor);
4542 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004543 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004544 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07004545 data.writeInt(profileType);
Jeff Hao1b012d32014-08-20 10:35:34 -07004546 if (profilerInfo != null) {
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004547 data.writeInt(1);
Jeff Hao1b012d32014-08-20 10:35:34 -07004548 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07004549 } else {
4550 data.writeInt(0);
4551 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004552 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4553 reply.readException();
4554 boolean res = reply.readInt() != 0;
4555 reply.recycle();
4556 data.recycle();
4557 return res;
4558 }
Jeff Hao1b012d32014-08-20 10:35:34 -07004559
Dianne Hackborn55280a92009-05-07 15:53:46 -07004560 public boolean shutdown(int timeout) throws RemoteException
4561 {
4562 Parcel data = Parcel.obtain();
4563 Parcel reply = Parcel.obtain();
4564 data.writeInterfaceToken(IActivityManager.descriptor);
4565 data.writeInt(timeout);
4566 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4567 reply.readException();
4568 boolean res = reply.readInt() != 0;
4569 reply.recycle();
4570 data.recycle();
4571 return res;
4572 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004573
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004574 public void stopAppSwitches() throws RemoteException {
4575 Parcel data = Parcel.obtain();
4576 Parcel reply = Parcel.obtain();
4577 data.writeInterfaceToken(IActivityManager.descriptor);
4578 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4579 reply.readException();
4580 reply.recycle();
4581 data.recycle();
4582 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004583
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004584 public void resumeAppSwitches() throws RemoteException {
4585 Parcel data = Parcel.obtain();
4586 Parcel reply = Parcel.obtain();
4587 data.writeInterfaceToken(IActivityManager.descriptor);
4588 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4589 reply.readException();
4590 reply.recycle();
4591 data.recycle();
4592 }
Dianne Hackbornfee756f2014-07-16 17:31:10 -07004593
4594 public void addPackageDependency(String packageName) throws RemoteException {
4595 Parcel data = Parcel.obtain();
4596 Parcel reply = Parcel.obtain();
4597 data.writeInterfaceToken(IActivityManager.descriptor);
4598 data.writeString(packageName);
4599 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0);
4600 reply.readException();
4601 data.recycle();
4602 reply.recycle();
4603 }
4604
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004605 public void killApplicationWithAppId(String pkg, int appid, String reason)
4606 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004607 Parcel data = Parcel.obtain();
4608 Parcel reply = Parcel.obtain();
4609 data.writeInterfaceToken(IActivityManager.descriptor);
4610 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004611 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004612 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004613 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004614 reply.readException();
4615 data.recycle();
4616 reply.recycle();
4617 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004618
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004619 public void closeSystemDialogs(String reason) throws RemoteException {
4620 Parcel data = Parcel.obtain();
4621 Parcel reply = Parcel.obtain();
4622 data.writeInterfaceToken(IActivityManager.descriptor);
4623 data.writeString(reason);
4624 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4625 reply.readException();
4626 data.recycle();
4627 reply.recycle();
4628 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004629
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004630 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004631 throws RemoteException {
4632 Parcel data = Parcel.obtain();
4633 Parcel reply = Parcel.obtain();
4634 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004635 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004636 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4637 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004638 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004639 data.recycle();
4640 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004641 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004642 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004643
4644 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4645 Parcel data = Parcel.obtain();
4646 Parcel reply = Parcel.obtain();
4647 data.writeInterfaceToken(IActivityManager.descriptor);
4648 data.writeString(processName);
4649 data.writeInt(uid);
4650 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4651 reply.readException();
4652 data.recycle();
4653 reply.recycle();
4654 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004655
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004656 public void overridePendingTransition(IBinder token, String packageName,
4657 int enterAnim, int exitAnim) throws RemoteException {
4658 Parcel data = Parcel.obtain();
4659 Parcel reply = Parcel.obtain();
4660 data.writeInterfaceToken(IActivityManager.descriptor);
4661 data.writeStrongBinder(token);
4662 data.writeString(packageName);
4663 data.writeInt(enterAnim);
4664 data.writeInt(exitAnim);
4665 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4666 reply.readException();
4667 data.recycle();
4668 reply.recycle();
4669 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004670
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004671 public boolean isUserAMonkey() throws RemoteException {
4672 Parcel data = Parcel.obtain();
4673 Parcel reply = Parcel.obtain();
4674 data.writeInterfaceToken(IActivityManager.descriptor);
4675 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4676 reply.readException();
4677 boolean res = reply.readInt() != 0;
4678 data.recycle();
4679 reply.recycle();
4680 return res;
4681 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004682
4683 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4684 Parcel data = Parcel.obtain();
4685 Parcel reply = Parcel.obtain();
4686 data.writeInterfaceToken(IActivityManager.descriptor);
4687 data.writeInt(monkey ? 1 : 0);
4688 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4689 reply.readException();
4690 data.recycle();
4691 reply.recycle();
4692 }
4693
Dianne Hackborn860755f2010-06-03 18:47:52 -07004694 public void finishHeavyWeightApp() throws RemoteException {
4695 Parcel data = Parcel.obtain();
4696 Parcel reply = Parcel.obtain();
4697 data.writeInterfaceToken(IActivityManager.descriptor);
4698 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4699 reply.readException();
4700 data.recycle();
4701 reply.recycle();
4702 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004703
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004704 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004705 throws RemoteException {
4706 Parcel data = Parcel.obtain();
4707 Parcel reply = Parcel.obtain();
4708 data.writeInterfaceToken(IActivityManager.descriptor);
4709 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004710 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4711 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004712 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004713 data.recycle();
4714 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004715 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004716 }
4717
Craig Mautner233ceee2014-05-09 17:05:11 -07004718 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004719 throws RemoteException {
4720 Parcel data = Parcel.obtain();
4721 Parcel reply = Parcel.obtain();
4722 data.writeInterfaceToken(IActivityManager.descriptor);
4723 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004724 if (options == null) {
4725 data.writeInt(0);
4726 } else {
4727 data.writeInt(1);
4728 data.writeBundle(options.toBundle());
4729 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004730 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004731 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004732 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004733 data.recycle();
4734 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004735 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004736 }
4737
Craig Mautner233ceee2014-05-09 17:05:11 -07004738 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4739 Parcel data = Parcel.obtain();
4740 Parcel reply = Parcel.obtain();
4741 data.writeInterfaceToken(IActivityManager.descriptor);
4742 data.writeStrongBinder(token);
4743 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4744 reply.readException();
4745 Bundle bundle = reply.readBundle();
4746 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4747 data.recycle();
4748 reply.recycle();
4749 return options;
4750 }
4751
Daniel Sandler69a48172010-06-23 16:29:36 -04004752 public void setImmersive(IBinder token, boolean immersive)
4753 throws RemoteException {
4754 Parcel data = Parcel.obtain();
4755 Parcel reply = Parcel.obtain();
4756 data.writeInterfaceToken(IActivityManager.descriptor);
4757 data.writeStrongBinder(token);
4758 data.writeInt(immersive ? 1 : 0);
4759 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4760 reply.readException();
4761 data.recycle();
4762 reply.recycle();
4763 }
4764
4765 public boolean isImmersive(IBinder token)
4766 throws RemoteException {
4767 Parcel data = Parcel.obtain();
4768 Parcel reply = Parcel.obtain();
4769 data.writeInterfaceToken(IActivityManager.descriptor);
4770 data.writeStrongBinder(token);
4771 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004772 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004773 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004774 data.recycle();
4775 reply.recycle();
4776 return res;
4777 }
4778
Craig Mautnerd61dc202014-07-07 11:09:11 -07004779 public boolean isTopOfTask(IBinder token) throws RemoteException {
4780 Parcel data = Parcel.obtain();
4781 Parcel reply = Parcel.obtain();
4782 data.writeInterfaceToken(IActivityManager.descriptor);
4783 data.writeStrongBinder(token);
4784 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4785 reply.readException();
4786 boolean res = reply.readInt() == 1;
4787 data.recycle();
4788 reply.recycle();
4789 return res;
4790 }
4791
Daniel Sandler69a48172010-06-23 16:29:36 -04004792 public boolean isTopActivityImmersive()
4793 throws RemoteException {
4794 Parcel data = Parcel.obtain();
4795 Parcel reply = Parcel.obtain();
4796 data.writeInterfaceToken(IActivityManager.descriptor);
4797 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004798 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004799 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004800 data.recycle();
4801 reply.recycle();
4802 return res;
4803 }
4804
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004805 public void crashApplication(int uid, int initialPid, String packageName,
4806 String message) throws RemoteException {
4807 Parcel data = Parcel.obtain();
4808 Parcel reply = Parcel.obtain();
4809 data.writeInterfaceToken(IActivityManager.descriptor);
4810 data.writeInt(uid);
4811 data.writeInt(initialPid);
4812 data.writeString(packageName);
4813 data.writeString(message);
4814 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4815 reply.readException();
4816 data.recycle();
4817 reply.recycle();
4818 }
Andy McFadden824c5102010-07-09 16:26:57 -07004819
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004820 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004821 Parcel data = Parcel.obtain();
4822 Parcel reply = Parcel.obtain();
4823 data.writeInterfaceToken(IActivityManager.descriptor);
4824 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004825 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004826 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4827 reply.readException();
4828 String res = reply.readString();
4829 data.recycle();
4830 reply.recycle();
4831 return res;
4832 }
4833
Dianne Hackborn7e269642010-08-25 19:50:20 -07004834 public IBinder newUriPermissionOwner(String name)
4835 throws RemoteException {
4836 Parcel data = Parcel.obtain();
4837 Parcel reply = Parcel.obtain();
4838 data.writeInterfaceToken(IActivityManager.descriptor);
4839 data.writeString(name);
4840 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4841 reply.readException();
4842 IBinder res = reply.readStrongBinder();
4843 data.recycle();
4844 reply.recycle();
4845 return res;
4846 }
4847
4848 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotf1939902014-06-25 09:29:02 +01004849 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004850 Parcel data = Parcel.obtain();
4851 Parcel reply = Parcel.obtain();
4852 data.writeInterfaceToken(IActivityManager.descriptor);
4853 data.writeStrongBinder(owner);
4854 data.writeInt(fromUid);
4855 data.writeString(targetPkg);
4856 uri.writeToParcel(data, 0);
4857 data.writeInt(mode);
Nicolas Prevotf1939902014-06-25 09:29:02 +01004858 data.writeInt(sourceUserId);
4859 data.writeInt(targetUserId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004860 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4861 reply.readException();
4862 data.recycle();
4863 reply.recycle();
4864 }
4865
4866 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004867 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004868 Parcel data = Parcel.obtain();
4869 Parcel reply = Parcel.obtain();
4870 data.writeInterfaceToken(IActivityManager.descriptor);
4871 data.writeStrongBinder(owner);
4872 if (uri != null) {
4873 data.writeInt(1);
4874 uri.writeToParcel(data, 0);
4875 } else {
4876 data.writeInt(0);
4877 }
4878 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004879 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004880 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4881 reply.readException();
4882 data.recycle();
4883 reply.recycle();
4884 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004885
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004886 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004887 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004888 Parcel data = Parcel.obtain();
4889 Parcel reply = Parcel.obtain();
4890 data.writeInterfaceToken(IActivityManager.descriptor);
4891 data.writeInt(callingUid);
4892 data.writeString(targetPkg);
4893 uri.writeToParcel(data, 0);
4894 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004895 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004896 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4897 reply.readException();
4898 int res = reply.readInt();
4899 data.recycle();
4900 reply.recycle();
4901 return res;
4902 }
4903
Dianne Hackborn1676c852012-09-10 14:52:30 -07004904 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004905 String path, ParcelFileDescriptor fd) throws RemoteException {
4906 Parcel data = Parcel.obtain();
4907 Parcel reply = Parcel.obtain();
4908 data.writeInterfaceToken(IActivityManager.descriptor);
4909 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004910 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004911 data.writeInt(managed ? 1 : 0);
4912 data.writeString(path);
4913 if (fd != null) {
4914 data.writeInt(1);
4915 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4916 } else {
4917 data.writeInt(0);
4918 }
4919 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4920 reply.readException();
4921 boolean res = reply.readInt() != 0;
4922 reply.recycle();
4923 data.recycle();
4924 return res;
4925 }
Stefan Kuhne16045c22015-06-05 07:18:06 -07004926
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004927 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004928 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004929 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004930 Parcel data = Parcel.obtain();
4931 Parcel reply = Parcel.obtain();
4932 data.writeInterfaceToken(IActivityManager.descriptor);
4933 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004934 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004935 data.writeTypedArray(intents, 0);
4936 data.writeStringArray(resolvedTypes);
4937 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004938 if (options != null) {
4939 data.writeInt(1);
4940 options.writeToParcel(data, 0);
4941 } else {
4942 data.writeInt(0);
4943 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004944 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004945 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4946 reply.readException();
4947 int result = reply.readInt();
4948 reply.recycle();
4949 data.recycle();
4950 return result;
4951 }
4952
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004953 public int getFrontActivityScreenCompatMode() throws RemoteException {
4954 Parcel data = Parcel.obtain();
4955 Parcel reply = Parcel.obtain();
4956 data.writeInterfaceToken(IActivityManager.descriptor);
4957 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4958 reply.readException();
4959 int mode = reply.readInt();
4960 reply.recycle();
4961 data.recycle();
4962 return mode;
4963 }
4964
4965 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4966 Parcel data = Parcel.obtain();
4967 Parcel reply = Parcel.obtain();
4968 data.writeInterfaceToken(IActivityManager.descriptor);
4969 data.writeInt(mode);
4970 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4971 reply.readException();
4972 reply.recycle();
4973 data.recycle();
4974 }
4975
4976 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4977 Parcel data = Parcel.obtain();
4978 Parcel reply = Parcel.obtain();
4979 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004980 data.writeString(packageName);
4981 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004982 reply.readException();
4983 int mode = reply.readInt();
4984 reply.recycle();
4985 data.recycle();
4986 return mode;
4987 }
4988
4989 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004990 throws RemoteException {
4991 Parcel data = Parcel.obtain();
4992 Parcel reply = Parcel.obtain();
4993 data.writeInterfaceToken(IActivityManager.descriptor);
4994 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004995 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004996 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4997 reply.readException();
4998 reply.recycle();
4999 data.recycle();
5000 }
5001
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07005002 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
5003 Parcel data = Parcel.obtain();
5004 Parcel reply = Parcel.obtain();
5005 data.writeInterfaceToken(IActivityManager.descriptor);
5006 data.writeString(packageName);
5007 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5008 reply.readException();
5009 boolean ask = reply.readInt() != 0;
5010 reply.recycle();
5011 data.recycle();
5012 return ask;
5013 }
5014
5015 public void setPackageAskScreenCompat(String packageName, boolean ask)
5016 throws RemoteException {
5017 Parcel data = Parcel.obtain();
5018 Parcel reply = Parcel.obtain();
5019 data.writeInterfaceToken(IActivityManager.descriptor);
5020 data.writeString(packageName);
5021 data.writeInt(ask ? 1 : 0);
5022 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
5023 reply.readException();
5024 reply.recycle();
5025 data.recycle();
5026 }
5027
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005028 public boolean switchUser(int userid) throws RemoteException {
5029 Parcel data = Parcel.obtain();
5030 Parcel reply = Parcel.obtain();
5031 data.writeInterfaceToken(IActivityManager.descriptor);
5032 data.writeInt(userid);
5033 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
5034 reply.readException();
5035 boolean result = reply.readInt() != 0;
5036 reply.recycle();
5037 data.recycle();
5038 return result;
5039 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07005040
Kenny Guy08488bf2014-02-21 17:40:37 +00005041 public boolean startUserInBackground(int userid) throws RemoteException {
5042 Parcel data = Parcel.obtain();
5043 Parcel reply = Parcel.obtain();
5044 data.writeInterfaceToken(IActivityManager.descriptor);
5045 data.writeInt(userid);
5046 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
5047 reply.readException();
5048 boolean result = reply.readInt() != 0;
5049 reply.recycle();
5050 data.recycle();
5051 return result;
5052 }
5053
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005054 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
5055 Parcel data = Parcel.obtain();
5056 Parcel reply = Parcel.obtain();
5057 data.writeInterfaceToken(IActivityManager.descriptor);
5058 data.writeInt(userid);
5059 data.writeStrongInterface(callback);
5060 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
5061 reply.readException();
5062 int result = reply.readInt();
5063 reply.recycle();
5064 data.recycle();
5065 return result;
5066 }
5067
Amith Yamasani52f1d752012-03-28 18:19:29 -07005068 public UserInfo getCurrentUser() throws RemoteException {
5069 Parcel data = Parcel.obtain();
5070 Parcel reply = Parcel.obtain();
5071 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07005072 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07005073 reply.readException();
5074 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
5075 reply.recycle();
5076 data.recycle();
5077 return userInfo;
5078 }
5079
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005080 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005081 Parcel data = Parcel.obtain();
5082 Parcel reply = Parcel.obtain();
5083 data.writeInterfaceToken(IActivityManager.descriptor);
5084 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07005085 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07005086 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
5087 reply.readException();
5088 boolean result = reply.readInt() != 0;
5089 reply.recycle();
5090 data.recycle();
5091 return result;
5092 }
5093
Dianne Hackbornc72fc672012-09-20 13:12:03 -07005094 public int[] getRunningUserIds() throws RemoteException {
5095 Parcel data = Parcel.obtain();
5096 Parcel reply = Parcel.obtain();
5097 data.writeInterfaceToken(IActivityManager.descriptor);
5098 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
5099 reply.readException();
5100 int[] result = reply.createIntArray();
5101 reply.recycle();
5102 data.recycle();
5103 return result;
5104 }
5105
Wale Ogunwaled54b5782014-10-23 15:55:23 -07005106 public boolean removeTask(int taskId) throws RemoteException {
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005107 Parcel data = Parcel.obtain();
5108 Parcel reply = Parcel.obtain();
5109 data.writeInterfaceToken(IActivityManager.descriptor);
5110 data.writeInt(taskId);
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07005111 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
5112 reply.readException();
5113 boolean result = reply.readInt() != 0;
5114 reply.recycle();
5115 data.recycle();
5116 return result;
5117 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07005118
Jeff Sharkeya4620792011-05-20 15:29:23 -07005119 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
5120 Parcel data = Parcel.obtain();
5121 Parcel reply = Parcel.obtain();
5122 data.writeInterfaceToken(IActivityManager.descriptor);
5123 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5124 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5125 reply.readException();
5126 data.recycle();
5127 reply.recycle();
5128 }
5129
5130 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
5131 Parcel data = Parcel.obtain();
5132 Parcel reply = Parcel.obtain();
5133 data.writeInterfaceToken(IActivityManager.descriptor);
5134 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5135 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
5136 reply.readException();
5137 data.recycle();
5138 reply.recycle();
5139 }
5140
Dianne Hackbornd23e0d62015-05-15 16:36:12 -07005141 public void registerUidObserver(IUidObserver observer) throws RemoteException {
5142 Parcel data = Parcel.obtain();
5143 Parcel reply = Parcel.obtain();
5144 data.writeInterfaceToken(IActivityManager.descriptor);
5145 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5146 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5147 reply.readException();
5148 data.recycle();
5149 reply.recycle();
5150 }
5151
5152 public void unregisterUidObserver(IUidObserver observer) throws RemoteException {
5153 Parcel data = Parcel.obtain();
5154 Parcel reply = Parcel.obtain();
5155 data.writeInterfaceToken(IActivityManager.descriptor);
5156 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
5157 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0);
5158 reply.readException();
5159 data.recycle();
5160 reply.recycle();
5161 }
5162
Dianne Hackborn6c418d52011-06-29 14:05:33 -07005163 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
5164 Parcel data = Parcel.obtain();
5165 Parcel reply = Parcel.obtain();
5166 data.writeInterfaceToken(IActivityManager.descriptor);
5167 data.writeStrongBinder(sender.asBinder());
5168 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
5169 reply.readException();
5170 boolean res = reply.readInt() != 0;
5171 data.recycle();
5172 reply.recycle();
5173 return res;
5174 }
5175
Dianne Hackborn1927ae82012-06-22 15:21:36 -07005176 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
5177 Parcel data = Parcel.obtain();
5178 Parcel reply = Parcel.obtain();
5179 data.writeInterfaceToken(IActivityManager.descriptor);
5180 data.writeStrongBinder(sender.asBinder());
5181 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
5182 reply.readException();
5183 boolean res = reply.readInt() != 0;
5184 data.recycle();
5185 reply.recycle();
5186 return res;
5187 }
5188
Dianne Hackborn81038902012-11-26 17:04:09 -08005189 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
5190 Parcel data = Parcel.obtain();
5191 Parcel reply = Parcel.obtain();
5192 data.writeInterfaceToken(IActivityManager.descriptor);
5193 data.writeStrongBinder(sender.asBinder());
5194 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5195 reply.readException();
5196 Intent res = reply.readInt() != 0
5197 ? Intent.CREATOR.createFromParcel(reply) : null;
5198 data.recycle();
5199 reply.recycle();
5200 return res;
5201 }
5202
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08005203 public String getTagForIntentSender(IIntentSender sender, String prefix)
5204 throws RemoteException {
5205 Parcel data = Parcel.obtain();
5206 Parcel reply = Parcel.obtain();
5207 data.writeInterfaceToken(IActivityManager.descriptor);
5208 data.writeStrongBinder(sender.asBinder());
5209 data.writeString(prefix);
5210 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
5211 reply.readException();
5212 String res = reply.readString();
5213 data.recycle();
5214 reply.recycle();
5215 return res;
5216 }
5217
Dianne Hackborn31ca8542011-07-19 14:58:28 -07005218 public void updatePersistentConfiguration(Configuration values) throws RemoteException
5219 {
5220 Parcel data = Parcel.obtain();
5221 Parcel reply = Parcel.obtain();
5222 data.writeInterfaceToken(IActivityManager.descriptor);
5223 values.writeToParcel(data, 0);
5224 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
5225 reply.readException();
5226 data.recycle();
5227 reply.recycle();
5228 }
5229
Dianne Hackbornb437e092011-08-05 17:50:29 -07005230 public long[] getProcessPss(int[] pids) throws RemoteException {
5231 Parcel data = Parcel.obtain();
5232 Parcel reply = Parcel.obtain();
5233 data.writeInterfaceToken(IActivityManager.descriptor);
5234 data.writeIntArray(pids);
5235 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
5236 reply.readException();
5237 long[] res = reply.createLongArray();
5238 data.recycle();
5239 reply.recycle();
5240 return res;
5241 }
5242
Dianne Hackborn661cd522011-08-22 00:26:20 -07005243 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
5244 Parcel data = Parcel.obtain();
5245 Parcel reply = Parcel.obtain();
5246 data.writeInterfaceToken(IActivityManager.descriptor);
5247 TextUtils.writeToParcel(msg, data, 0);
5248 data.writeInt(always ? 1 : 0);
5249 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
5250 reply.readException();
5251 data.recycle();
5252 reply.recycle();
5253 }
5254
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005255 public void keyguardWaitingForActivityDrawn() throws RemoteException {
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005256 Parcel data = Parcel.obtain();
5257 Parcel reply = Parcel.obtain();
5258 data.writeInterfaceToken(IActivityManager.descriptor);
Jorim Jaggi8de4311c2014-08-11 22:36:20 +02005259 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
Dianne Hackborn90c52de2011-09-23 12:57:44 -07005260 reply.readException();
5261 data.recycle();
5262 reply.recycle();
5263 }
5264
Jorim Jaggi827e0fa2015-05-07 11:41:41 -07005265 public void keyguardGoingAway(boolean disableWindowAnimations,
5266 boolean keyguardGoingToNotificationShade) throws RemoteException {
5267 Parcel data = Parcel.obtain();
5268 Parcel reply = Parcel.obtain();
5269 data.writeInterfaceToken(IActivityManager.descriptor);
5270 data.writeInt(disableWindowAnimations ? 1 : 0);
5271 data.writeInt(keyguardGoingToNotificationShade ? 1 : 0);
5272 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0);
5273 reply.readException();
5274 data.recycle();
5275 reply.recycle();
5276 }
5277
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005278 public boolean shouldUpRecreateTask(IBinder token, String destAffinity)
Adam Powelldd8fab22012-03-22 17:47:27 -07005279 throws RemoteException {
5280 Parcel data = Parcel.obtain();
5281 Parcel reply = Parcel.obtain();
5282 data.writeInterfaceToken(IActivityManager.descriptor);
5283 data.writeStrongBinder(token);
5284 data.writeString(destAffinity);
Dianne Hackborn6f4d61f2014-08-21 17:50:42 -07005285 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0);
Adam Powelldd8fab22012-03-22 17:47:27 -07005286 reply.readException();
5287 boolean result = reply.readInt() != 0;
5288 data.recycle();
5289 reply.recycle();
5290 return result;
5291 }
5292
5293 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
5294 throws RemoteException {
5295 Parcel data = Parcel.obtain();
5296 Parcel reply = Parcel.obtain();
5297 data.writeInterfaceToken(IActivityManager.descriptor);
5298 data.writeStrongBinder(token);
5299 target.writeToParcel(data, 0);
5300 data.writeInt(resultCode);
5301 if (resultData != null) {
5302 data.writeInt(1);
5303 resultData.writeToParcel(data, 0);
5304 } else {
5305 data.writeInt(0);
5306 }
5307 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
5308 reply.readException();
5309 boolean result = reply.readInt() != 0;
5310 data.recycle();
5311 reply.recycle();
5312 return result;
5313 }
5314
Dianne Hackborn5320eb82012-05-18 12:05:04 -07005315 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
5316 Parcel data = Parcel.obtain();
5317 Parcel reply = Parcel.obtain();
5318 data.writeInterfaceToken(IActivityManager.descriptor);
5319 data.writeStrongBinder(activityToken);
5320 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
5321 reply.readException();
5322 int result = reply.readInt();
5323 data.recycle();
5324 reply.recycle();
5325 return result;
5326 }
5327
Dianne Hackbornf265ea92013-01-31 15:00:51 -08005328 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
5329 Parcel data = Parcel.obtain();
5330 Parcel reply = Parcel.obtain();
5331 data.writeInterfaceToken(IActivityManager.descriptor);
5332 data.writeStrongBinder(activityToken);
5333 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
5334 reply.readException();
5335 String result = reply.readString();
5336 data.recycle();
5337 reply.recycle();
5338 return result;
5339 }
5340
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07005341 public void registerUserSwitchObserver(IUserSwitchObserver 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_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5347 reply.readException();
5348 data.recycle();
5349 reply.recycle();
5350 }
5351
5352 public void unregisterUserSwitchObserver(IUserSwitchObserver 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_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
5358 reply.readException();
5359 data.recycle();
5360 reply.recycle();
5361 }
5362
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07005363 public void requestBugReport() throws RemoteException {
5364 Parcel data = Parcel.obtain();
5365 Parcel reply = Parcel.obtain();
5366 data.writeInterfaceToken(IActivityManager.descriptor);
5367 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
5368 reply.readException();
5369 data.recycle();
5370 reply.recycle();
5371 }
5372
Jeff Brownbd181bb2013-09-10 16:44:24 -07005373 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
5374 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005375 Parcel data = Parcel.obtain();
5376 Parcel reply = Parcel.obtain();
5377 data.writeInterfaceToken(IActivityManager.descriptor);
5378 data.writeInt(pid);
5379 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07005380 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07005381 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
5382 reply.readException();
5383 long res = reply.readInt();
5384 data.recycle();
5385 reply.recycle();
5386 return res;
5387 }
5388
Adam Skorydfc7fd72013-08-05 19:23:41 -07005389 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005390 Parcel data = Parcel.obtain();
5391 Parcel reply = Parcel.obtain();
5392 data.writeInterfaceToken(IActivityManager.descriptor);
5393 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07005394 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005395 reply.readException();
5396 Bundle res = reply.readBundle();
5397 data.recycle();
5398 reply.recycle();
5399 return res;
5400 }
5401
Dianne Hackborn17f69352015-07-17 18:04:14 -07005402 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver,
5403 IBinder activityToken) throws RemoteException {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005404 Parcel data = Parcel.obtain();
5405 Parcel reply = Parcel.obtain();
5406 data.writeInterfaceToken(IActivityManager.descriptor);
5407 data.writeInt(requestType);
5408 data.writeStrongBinder(receiver.asBinder());
Dianne Hackborn17f69352015-07-17 18:04:14 -07005409 data.writeStrongBinder(activityToken);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005410 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
5411 reply.readException();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005412 boolean res = reply.readInt() != 0;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005413 data.recycle();
5414 reply.recycle();
Dianne Hackborn17f69352015-07-17 18:04:14 -07005415 return res;
Dianne Hackbornae6688b2015-02-11 17:02:41 -08005416 }
5417
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005418 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure,
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005419 AssistContent content, Uri referrer) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005420 Parcel data = Parcel.obtain();
5421 Parcel reply = Parcel.obtain();
5422 data.writeInterfaceToken(IActivityManager.descriptor);
5423 data.writeStrongBinder(token);
5424 data.writeBundle(extras);
Dianne Hackborn09d57fe2015-05-27 18:05:52 -07005425 structure.writeToParcel(data, 0);
5426 content.writeToParcel(data, 0);
Dianne Hackborna3acdb32015-06-08 17:07:40 -07005427 if (referrer != null) {
5428 data.writeInt(1);
5429 referrer.writeToParcel(data, 0);
5430 } else {
5431 data.writeInt(0);
5432 }
Adam Skorydfc7fd72013-08-05 19:23:41 -07005433 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08005434 reply.readException();
5435 data.recycle();
5436 reply.recycle();
5437 }
5438
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005439 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
5440 Bundle args) throws RemoteException {
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005441 Parcel data = Parcel.obtain();
5442 Parcel reply = Parcel.obtain();
5443 data.writeInterfaceToken(IActivityManager.descriptor);
5444 intent.writeToParcel(data, 0);
5445 data.writeInt(requestType);
5446 data.writeString(hint);
5447 data.writeInt(userHandle);
Tim Kilbourn0e5f1102015-06-05 16:18:09 -07005448 data.writeBundle(args);
Dianne Hackbornfdf5b352014-10-08 17:43:48 -07005449 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0);
5450 reply.readException();
5451 boolean res = reply.readInt() != 0;
5452 data.recycle();
5453 reply.recycle();
5454 return res;
5455 }
5456
Dianne Hackborn17f69352015-07-17 18:04:14 -07005457 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException {
Benjamin Franzc200f442015-06-25 18:20:04 +01005458 Parcel data = Parcel.obtain();
5459 Parcel reply = Parcel.obtain();
5460 data.writeInterfaceToken(IActivityManager.descriptor);
5461 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0);
5462 reply.readException();
5463 boolean res = reply.readInt() != 0;
5464 data.recycle();
5465 reply.recycle();
5466 return res;
5467 }
5468
Dianne Hackborn17f69352015-07-17 18:04:14 -07005469 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException {
5470 Parcel data = Parcel.obtain();
5471 Parcel reply = Parcel.obtain();
5472 data.writeInterfaceToken(IActivityManager.descriptor);
5473 data.writeStrongBinder(token);
5474 data.writeBundle(args);
5475 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0);
5476 reply.readException();
5477 boolean res = reply.readInt() != 0;
5478 data.recycle();
5479 reply.recycle();
5480 return res;
5481 }
5482
Svetoslavaa41add2015-08-06 15:03:55 -07005483 public void killUid(int appId, int userId, String reason) throws RemoteException {
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005484 Parcel data = Parcel.obtain();
5485 Parcel reply = Parcel.obtain();
5486 data.writeInterfaceToken(IActivityManager.descriptor);
Svetoslavaa41add2015-08-06 15:03:55 -07005487 data.writeInt(appId);
5488 data.writeInt(userId);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07005489 data.writeString(reason);
5490 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
5491 reply.readException();
5492 data.recycle();
5493 reply.recycle();
5494 }
5495
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07005496 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
5497 Parcel data = Parcel.obtain();
5498 Parcel reply = Parcel.obtain();
5499 data.writeInterfaceToken(IActivityManager.descriptor);
5500 data.writeStrongBinder(who);
5501 data.writeInt(allowRestart ? 1 : 0);
5502 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
5503 reply.readException();
5504 data.recycle();
5505 reply.recycle();
5506 }
5507
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07005508 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
5509 Parcel data = Parcel.obtain();
5510 Parcel reply = Parcel.obtain();
5511 data.writeInterfaceToken(IActivityManager.descriptor);
5512 data.writeStrongBinder(token);
5513 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
5514 reply.readException();
5515 data.recycle();
5516 reply.recycle();
5517 }
5518
Craig Mautner5eda9b32013-07-02 11:58:16 -07005519 public void notifyActivityDrawn(IBinder token) throws RemoteException {
5520 Parcel data = Parcel.obtain();
5521 Parcel reply = Parcel.obtain();
5522 data.writeInterfaceToken(IActivityManager.descriptor);
5523 data.writeStrongBinder(token);
5524 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
5525 reply.readException();
5526 data.recycle();
5527 reply.recycle();
5528 }
5529
Dianne Hackborn57a7f592013-07-22 18:21:32 -07005530 public void restart() throws RemoteException {
5531 Parcel data = Parcel.obtain();
5532 Parcel reply = Parcel.obtain();
5533 data.writeInterfaceToken(IActivityManager.descriptor);
5534 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
5535 reply.readException();
5536 data.recycle();
5537 reply.recycle();
5538 }
5539
Dianne Hackborn35f72be2013-09-16 10:57:39 -07005540 public void performIdleMaintenance() throws RemoteException {
5541 Parcel data = Parcel.obtain();
5542 Parcel reply = Parcel.obtain();
5543 data.writeInterfaceToken(IActivityManager.descriptor);
5544 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
5545 reply.readException();
5546 data.recycle();
5547 reply.recycle();
5548 }
5549
Todd Kennedyca4d8422015-01-15 15:19:22 -08005550 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken,
Craig Mautner4a1cb222013-12-04 16:14:06 -08005551 IActivityContainerCallback callback) throws RemoteException {
5552 Parcel data = Parcel.obtain();
5553 Parcel reply = Parcel.obtain();
5554 data.writeInterfaceToken(IActivityManager.descriptor);
5555 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07005556 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Todd Kennedyca4d8422015-01-15 15:19:22 -08005557 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
Craig Mautner4a1cb222013-12-04 16:14:06 -08005558 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08005559 final int result = reply.readInt();
5560 final IActivityContainer res;
5561 if (result == 1) {
5562 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5563 } else {
5564 res = null;
5565 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08005566 data.recycle();
5567 reply.recycle();
5568 return res;
5569 }
5570
Craig Mautner95da1082014-02-24 17:54:35 -08005571 public void deleteActivityContainer(IActivityContainer activityContainer)
5572 throws RemoteException {
5573 Parcel data = Parcel.obtain();
5574 Parcel reply = Parcel.obtain();
5575 data.writeInterfaceToken(IActivityManager.descriptor);
5576 data.writeStrongBinder(activityContainer.asBinder());
5577 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
5578 reply.readException();
5579 data.recycle();
5580 reply.recycle();
5581 }
5582
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005583 @Override
Todd Kennedy4900bf92015-01-16 16:05:14 -08005584 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException {
5585 Parcel data = Parcel.obtain();
5586 Parcel reply = Parcel.obtain();
5587 data.writeInterfaceToken(IActivityManager.descriptor);
5588 data.writeInt(displayId);
5589 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0);
5590 reply.readException();
5591 final int result = reply.readInt();
5592 final IActivityContainer res;
5593 if (result == 1) {
5594 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
5595 } else {
5596 res = null;
5597 }
5598 data.recycle();
5599 reply.recycle();
5600 return res;
5601 }
5602
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005603 @Override
5604 public int getActivityDisplayId(IBinder activityToken)
Craig Mautnere0a38842013-12-16 16:14:02 -08005605 throws RemoteException {
5606 Parcel data = Parcel.obtain();
5607 Parcel reply = Parcel.obtain();
5608 data.writeInterfaceToken(IActivityManager.descriptor);
5609 data.writeStrongBinder(activityToken);
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005610 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0);
Craig Mautnere0a38842013-12-16 16:14:02 -08005611 reply.readException();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005612 final int displayId = reply.readInt();
Craig Mautnere0a38842013-12-16 16:14:02 -08005613 data.recycle();
5614 reply.recycle();
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005615 return displayId;
Craig Mautnere0a38842013-12-16 16:14:02 -08005616 }
5617
Craig Mautneraa7e3ed2015-02-17 10:17:21 -08005618 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005619 public void startLockTaskMode(int taskId) throws RemoteException {
5620 Parcel data = Parcel.obtain();
5621 Parcel reply = Parcel.obtain();
5622 data.writeInterfaceToken(IActivityManager.descriptor);
5623 data.writeInt(taskId);
5624 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
5625 reply.readException();
5626 data.recycle();
5627 reply.recycle();
5628 }
5629
5630 @Override
5631 public void startLockTaskMode(IBinder token) throws RemoteException {
5632 Parcel data = Parcel.obtain();
5633 Parcel reply = Parcel.obtain();
5634 data.writeInterfaceToken(IActivityManager.descriptor);
5635 data.writeStrongBinder(token);
5636 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
5637 reply.readException();
5638 data.recycle();
5639 reply.recycle();
5640 }
5641
5642 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005643 public void startLockTaskModeOnCurrent() throws RemoteException {
5644 Parcel data = Parcel.obtain();
5645 Parcel reply = Parcel.obtain();
5646 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005647 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005648 reply.readException();
5649 data.recycle();
5650 reply.recycle();
5651 }
5652
5653 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005654 public void stopLockTaskMode() throws RemoteException {
5655 Parcel data = Parcel.obtain();
5656 Parcel reply = Parcel.obtain();
5657 data.writeInterfaceToken(IActivityManager.descriptor);
5658 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5659 reply.readException();
5660 data.recycle();
5661 reply.recycle();
5662 }
5663
5664 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005665 public void stopLockTaskModeOnCurrent() throws RemoteException {
5666 Parcel data = Parcel.obtain();
5667 Parcel reply = Parcel.obtain();
5668 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005669 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005670 reply.readException();
5671 data.recycle();
5672 reply.recycle();
5673 }
5674
5675 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005676 public boolean isInLockTaskMode() throws RemoteException {
5677 Parcel data = Parcel.obtain();
5678 Parcel reply = Parcel.obtain();
5679 data.writeInterfaceToken(IActivityManager.descriptor);
5680 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5681 reply.readException();
5682 boolean isInLockTaskMode = reply.readInt() == 1;
5683 data.recycle();
5684 reply.recycle();
5685 return isInLockTaskMode;
5686 }
5687
Craig Mautner688b5102014-03-27 16:55:03 -07005688 @Override
Benjamin Franz43261142015-02-11 15:59:44 +00005689 public int getLockTaskModeState() throws RemoteException {
5690 Parcel data = Parcel.obtain();
5691 Parcel reply = Parcel.obtain();
5692 data.writeInterfaceToken(IActivityManager.descriptor);
5693 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0);
5694 reply.readException();
5695 int lockTaskModeState = reply.readInt();
5696 data.recycle();
5697 reply.recycle();
5698 return lockTaskModeState;
5699 }
5700
5701 @Override
Craig Mautnerc21ae9e2015-04-15 09:45:42 -07005702 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException {
5703 Parcel data = Parcel.obtain();
5704 Parcel reply = Parcel.obtain();
5705 data.writeInterfaceToken(IActivityManager.descriptor);
5706 data.writeStrongBinder(token);
5707 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply,
5708 IBinder.FLAG_ONEWAY);
5709 reply.readException();
5710 data.recycle();
5711 reply.recycle();
5712 }
5713
5714 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005715 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005716 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005717 Parcel data = Parcel.obtain();
5718 Parcel reply = Parcel.obtain();
5719 data.writeInterfaceToken(IActivityManager.descriptor);
5720 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005721 values.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005722 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005723 reply.readException();
5724 data.recycle();
5725 reply.recycle();
5726 }
5727
Craig Mautneree2e45a2014-06-27 12:10:03 -07005728 @Override
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005729 public void setTaskResizeable(int taskId, boolean resizeable) throws RemoteException {
5730 Parcel data = Parcel.obtain();
5731 Parcel reply = Parcel.obtain();
5732 data.writeInterfaceToken(IActivityManager.descriptor);
5733 data.writeInt(taskId);
5734 data.writeInt(resizeable ? 1 : 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005735 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0);
Wale Ogunwale9d3de4c2015-02-01 16:49:44 -08005736 reply.readException();
5737 data.recycle();
5738 reply.recycle();
5739 }
5740
5741 @Override
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005742 public void resizeTask(int taskId, Rect r) throws RemoteException
5743 {
5744 Parcel data = Parcel.obtain();
5745 Parcel reply = Parcel.obtain();
5746 data.writeInterfaceToken(IActivityManager.descriptor);
5747 data.writeInt(taskId);
5748 r.writeToParcel(data, 0);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005749 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0);
Wale Ogunwale53a29a92015-02-23 15:42:52 -08005750 reply.readException();
5751 data.recycle();
5752 reply.recycle();
5753 }
5754
5755 @Override
Craig Mautner648f69b2014-09-18 14:16:26 -07005756 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException {
5757 Parcel data = Parcel.obtain();
5758 Parcel reply = Parcel.obtain();
5759 data.writeInterfaceToken(IActivityManager.descriptor);
5760 data.writeString(filename);
5761 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0);
5762 reply.readException();
5763 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply);
5764 data.recycle();
5765 reply.recycle();
5766 return icon;
5767 }
5768
5769 @Override
Winson Chung044d5292014-11-06 11:05:19 -08005770 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)
5771 throws RemoteException {
5772 Parcel data = Parcel.obtain();
5773 Parcel reply = Parcel.obtain();
5774 data.writeInterfaceToken(IActivityManager.descriptor);
5775 if (options == null) {
5776 data.writeInt(0);
5777 } else {
5778 data.writeInt(1);
5779 data.writeBundle(options.toBundle());
5780 }
Dianne Hackborn1e383822015-04-10 14:02:33 -07005781 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0);
Winson Chung044d5292014-11-06 11:05:19 -08005782 reply.readException();
5783 data.recycle();
5784 reply.recycle();
5785 }
5786
5787 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005788 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005789 Parcel data = Parcel.obtain();
5790 Parcel reply = Parcel.obtain();
5791 data.writeInterfaceToken(IActivityManager.descriptor);
5792 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005793 data.writeInt(visible ? 1 : 0);
5794 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005795 reply.readException();
5796 boolean success = reply.readInt() > 0;
5797 data.recycle();
5798 reply.recycle();
5799 return success;
5800 }
5801
5802 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005803 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005804 Parcel data = Parcel.obtain();
5805 Parcel reply = Parcel.obtain();
5806 data.writeInterfaceToken(IActivityManager.descriptor);
5807 data.writeStrongBinder(token);
Jose Lima4b6c6692014-08-12 17:41:12 -07005808 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005809 reply.readException();
Jose Lima4b6c6692014-08-12 17:41:12 -07005810 final boolean visible = reply.readInt() > 0;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005811 data.recycle();
5812 reply.recycle();
Jose Lima4b6c6692014-08-12 17:41:12 -07005813 return visible;
Craig Mautneree2e45a2014-06-27 12:10:03 -07005814 }
5815
5816 @Override
Jose Lima4b6c6692014-08-12 17:41:12 -07005817 public void backgroundResourcesReleased(IBinder token) throws RemoteException {
Craig Mautneree2e45a2014-06-27 12:10:03 -07005818 Parcel data = Parcel.obtain();
5819 Parcel reply = Parcel.obtain();
5820 data.writeInterfaceToken(IActivityManager.descriptor);
5821 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005822 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0);
Craig Mautnerbb742462014-07-07 15:28:55 -07005823 reply.readException();
5824 data.recycle();
5825 reply.recycle();
5826 }
5827
5828 @Override
5829 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException {
5830 Parcel data = Parcel.obtain();
5831 Parcel reply = Parcel.obtain();
5832 data.writeInterfaceToken(IActivityManager.descriptor);
5833 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005834 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautneree2e45a2014-06-27 12:10:03 -07005835 reply.readException();
5836 data.recycle();
5837 reply.recycle();
5838 }
5839
Craig Mautner8746a472014-07-24 15:12:54 -07005840 @Override
5841 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException {
5842 Parcel data = Parcel.obtain();
5843 Parcel reply = Parcel.obtain();
5844 data.writeInterfaceToken(IActivityManager.descriptor);
5845 data.writeStrongBinder(token);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005846 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
Craig Mautner8746a472014-07-24 15:12:54 -07005847 reply.readException();
5848 data.recycle();
5849 reply.recycle();
5850 }
5851
Craig Mautner6e2f3952014-09-09 14:26:41 -07005852 @Override
5853 public void bootAnimationComplete() throws RemoteException {
5854 Parcel data = Parcel.obtain();
5855 Parcel reply = Parcel.obtain();
5856 data.writeInterfaceToken(IActivityManager.descriptor);
5857 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0);
5858 reply.readException();
5859 data.recycle();
5860 reply.recycle();
5861 }
5862
Wale Ogunwale18795a22014-12-03 11:38:33 -08005863 @Override
Jeff Sharkey605eb792014-11-04 13:34:06 -08005864 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException {
5865 Parcel data = Parcel.obtain();
5866 Parcel reply = Parcel.obtain();
5867 data.writeInterfaceToken(IActivityManager.descriptor);
5868 data.writeInt(uid);
5869 data.writeByteArray(firstPacket);
5870 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0);
5871 reply.readException();
5872 data.recycle();
5873 reply.recycle();
5874 }
5875
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005876 @Override
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005877 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
5878 String reportPackage) throws RemoteException {
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005879 Parcel data = Parcel.obtain();
5880 Parcel reply = Parcel.obtain();
5881 data.writeInterfaceToken(IActivityManager.descriptor);
5882 data.writeString(processName);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005883 data.writeInt(uid);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005884 data.writeLong(maxMemSize);
Dianne Hackbornd59a5d52015-04-04 14:52:14 -07005885 data.writeString(reportPackage);
Dianne Hackbornb9a5e4a2015-03-03 17:04:12 -08005886 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
5887 reply.readException();
5888 data.recycle();
5889 reply.recycle();
5890 }
5891
5892 @Override
5893 public void dumpHeapFinished(String path) throws RemoteException {
5894 Parcel data = Parcel.obtain();
5895 Parcel reply = Parcel.obtain();
5896 data.writeInterfaceToken(IActivityManager.descriptor);
5897 data.writeString(path);
5898 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0);
5899 reply.readException();
5900 data.recycle();
5901 reply.recycle();
5902 }
5903
Dianne Hackborn3d07c942015-03-13 18:02:54 -07005904 @Override
5905 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
5906 throws RemoteException {
5907 Parcel data = Parcel.obtain();
5908 Parcel reply = Parcel.obtain();
5909 data.writeInterfaceToken(IActivityManager.descriptor);
5910 data.writeStrongBinder(session.asBinder());
5911 data.writeInt(keepAwake ? 1 : 0);
5912 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
5913 reply.readException();
5914 data.recycle();
5915 reply.recycle();
5916 }
5917
Craig Mautnere5600772015-04-03 21:36:37 -07005918 @Override
5919 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException {
5920 Parcel data = Parcel.obtain();
5921 Parcel reply = Parcel.obtain();
5922 data.writeInterfaceToken(IActivityManager.descriptor);
5923 data.writeInt(userId);
5924 data.writeStringArray(packages);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005925 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0);
Craig Mautnere5600772015-04-03 21:36:37 -07005926 reply.readException();
5927 data.recycle();
5928 reply.recycle();
5929 }
5930
Dianne Hackborn1e383822015-04-10 14:02:33 -07005931 @Override
Craig Mautner015c5e52015-04-23 10:39:39 -07005932 public void updateDeviceOwner(String packageName) throws RemoteException {
5933 Parcel data = Parcel.obtain();
5934 Parcel reply = Parcel.obtain();
5935 data.writeInterfaceToken(IActivityManager.descriptor);
5936 data.writeString(packageName);
5937 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0);
5938 reply.readException();
5939 data.recycle();
5940 reply.recycle();
5941 }
5942
5943 @Override
Adam Lesinskic30454c2015-06-24 13:24:35 -07005944 public int getPackageProcessState(String packageName, String callingPackage)
5945 throws RemoteException {
Dianne Hackborn1e383822015-04-10 14:02:33 -07005946 Parcel data = Parcel.obtain();
5947 Parcel reply = Parcel.obtain();
5948 data.writeInterfaceToken(IActivityManager.descriptor);
5949 data.writeString(packageName);
Adam Lesinskic30454c2015-06-24 13:24:35 -07005950 data.writeString(callingPackage);
Dianne Hackborn1e383822015-04-10 14:02:33 -07005951 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0);
5952 reply.readException();
5953 int res = reply.readInt();
5954 data.recycle();
5955 reply.recycle();
5956 return res;
5957 }
5958
Stefan Kuhne16045c22015-06-05 07:18:06 -07005959 @Override
5960 public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
5961 throws RemoteException {
5962 Parcel data = Parcel.obtain();
5963 Parcel reply = Parcel.obtain();
5964 data.writeInterfaceToken(IActivityManager.descriptor);
5965 data.writeString(process);
5966 data.writeInt(userId);
5967 data.writeInt(level);
5968 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0);
5969 reply.readException();
5970 int res = reply.readInt();
5971 data.recycle();
5972 reply.recycle();
5973 return res != 0;
5974 }
5975
Dianne Hackbornfb81d092015-08-03 17:14:46 -07005976 @Override
5977 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException {
5978 Parcel data = Parcel.obtain();
5979 Parcel reply = Parcel.obtain();
5980 data.writeInterfaceToken(IActivityManager.descriptor);
5981 data.writeStrongBinder(token);
5982 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0);
5983 reply.readException();
5984 int res = reply.readInt();
5985 data.recycle();
5986 reply.recycle();
5987 return res != 0;
5988 }
5989
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005990 private IBinder mRemote;
5991}